Merge pull request #158 from marineam/misc-updates

Misc updates
This commit is contained in:
Michael Marineau 2013-08-12 22:35:57 -07:00
commit 5dac798a26
16 changed files with 155 additions and 51 deletions

View File

@ -1,21 +0,0 @@
#!/bin/bash
/usr/bin/block-until-url http://169.254.169.254/
USER_DIR="/home/core"
if [ ! -d ${USER_DIR}/.ssh ] ; then
mkdir -p ${USER_DIR}/.ssh
chmod 700 ${USER_DIR}/.ssh
fi
curl -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/my-key
if [ $? -eq 0 ] ; then
cat /tmp/my-key >> ${USER_DIR}/.ssh/authorized_keys
chmod 700 ${USER_DIR}/.ssh/authorized_keys
rm /tmp/my-key
else
echo unable to download key
rm /tmp/my-key
exit 1
fi
chown -R core: $USER_DIR/.ssh

View File

@ -0,0 +1,8 @@
#!/bin/sh
set -e
KEY_URL="http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key"
block-until-url "$KEY_URL"
curl --fail -s "$KEY_URL" | update-ssh-keys -a ec2

View File

@ -1,3 +0,0 @@
#!/bin/bash
/usr/share/oem/usr/bin/install-ec2-key.sh

View File

@ -16,10 +16,8 @@ IUSE=""
S="${WORKDIR}"
src_install() {
dobin "${FILESDIR}"/install-ec2-key.sh
exeinto "/"
doexe ${FILESDIR}/run.sh
doexe ${FILESDIR}/run
insinto "/"
doins ${FILESDIR}/oem-release

View File

@ -1,17 +0,0 @@
#!/bin/bash
set -e
USER_DIR="/home/core"
if [ -e "${USER_DIR}/.ssh/authorized_keys" ]; then
exit 0
fi
if [ ! -d "${USER_DIR}/.ssh" ]; then
mkdir -p ${USER_DIR}/.ssh
chmod 700 ${USER_DIR}/.ssh
fi
cp /usr/share/oem/vagrant.pub "${USER_DIR}/.ssh/authorized_keys"
chown -R core: "${USER_DIR}/.ssh"

View File

@ -0,0 +1 @@
oem-vagrant-0.0.1.ebuild

View File

@ -17,8 +17,5 @@ S="${WORKDIR}"
src_install() {
insinto "/"
doins "${FILESDIR}/vagrant.pub"
exeinto "/"
doexe ${FILESDIR}/run.sh
doins "${FILESDIR}/authorized_keys"
}

View File

@ -1 +1,2 @@
DIST gsutil_3.31.tar.gz 1533732 SHA256 fc429054777caa6dfa49776b28c0511f0d63dc45351f9e0ba31e9fee036694f9 SHA512 acb210147d618c1a5e82259ab0183ef4349b491889d862f4619d6b10384f30a719dd1239e87d2b65260ba1f6865447b9c4989cf35959c15149d124b345d65da6 WHIRLPOOL 4279cfbdb5d452a062e6a8cc23dd49bb7bff3e264903c1da46861bc5ef39dfb73a62e22b49175652b5003e658017921873f2c6dbfdc6c114ad80cf1b71e7d004
DIST gsutil_3.34.tar.gz 1572225 SHA256 f01195a58358836d665c1760e248044fb19b85ab33565e60f0f96f915f41e7e7 SHA512 a413570c881bd222a49169da5a4e899ccb889bcbe889f3e7cb888562884b759af18253b942dfb6d0fbdede3d6b8dd8eee4bb45af3d9adfe630f96f163bf7773d WHIRLPOOL 5afc1680f402181a1d1f53fa72f9fa98ec417684cc21c7c794ed2e779ff6516fd27b35d8e48ac90e427868c6311c3450b1c373dd133290e7b5d4a1be8f753620

View File

@ -2,3 +2,5 @@
[Credentials]
gs_oauth2_refresh_token = 1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[GSUtil]

View File

@ -0,0 +1,30 @@
From 1b2eccc8a3c8c70855973d9dcff46bb0c4f79345 Mon Sep 17 00:00:00 2001
From: Michael Marineau <mike@marineau.org>
Date: Mon, 12 Aug 2013 17:42:39 -0400
Subject: [PATCH] Fix test using ? glob with ObjectToURI
Passing a ? wildcard through ObjectToURI does not work because passing
the constructed URI through urlparse.urlparse() interprets ? as a query
and strips it off since there is no query string following it. The *
glob which is actually used in the very next call doesn't have that
problem so just use that instead.
---
gslib/tests/test_naming.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gslib/tests/test_naming.py b/gslib/tests/test_naming.py
index b4d0ccd..8208238 100755
--- a/gslib/tests/test_naming.py
+++ b/gslib/tests/test_naming.py
@@ -840,7 +840,7 @@ class GsutilNamingTests(testcase.GsUtilUnitTestCase):
for i, final_dst_char in enumerate(('', '/')):
# Copy some files into place in dst bucket.
self.RunCommand(
- 'cp', [suri(src_bucket_uri, 'f%df?' % i),
+ 'cp', [suri(src_bucket_uri, 'f%df*' % i),
suri(dst_bucket_uri, 'dst_subdir%d' % i) + final_dst_char])
# Now do the move test.
self.RunCommand(
--
1.8.1.5

View File

@ -0,0 +1,45 @@
From a978811458f3d0c5379101bdda4396c62b8b0d6b Mon Sep 17 00:00:00 2001
From: Michael Marineau <mike@marineau.org>
Date: Mon, 12 Aug 2013 16:46:25 -0400
Subject: [PATCH] Fix update tests that fail for package installs.
Software updates are checked for but never offered in package installs.
Perhaps _MaybeCheckForAndOfferSoftwareUpdate should be split into two
functions so the "check for" and "offer" parts can be tested
independently but this fixes the tests as-is.
---
gslib/tests/test_command_runner.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/gslib/tests/test_command_runner.py b/gslib/tests/test_command_runner.py
index 01b5312..0a9eb01 100644
--- a/gslib/tests/test_command_runner.py
+++ b/gslib/tests/test_command_runner.py
@@ -105,8 +105,10 @@ class TestSoftwareUpdateCheckUnitTests(
self._SetBotoConfig('GSUtil', 'software_update_check_period', '1')
with open(self.timestamp_file, 'w') as f:
f.write(str(int(time.time() - 2 * SECONDS_PER_DAY)))
+ # Update will not trigger for package installs.
+ expect = not gslib.IS_PACKAGE_INSTALL
self.assertEqual(
- True,
+ expect,
self.command_runner._MaybeCheckForAndOfferSoftwareUpdate('ls', 0))
def test_not_time_for_update_yet(self):
@@ -134,9 +136,10 @@ class TestSoftwareUpdateCheckUnitTests(
with open(self.timestamp_file, 'w') as f:
f.write(str(int(time.time() - 2 * SECONDS_PER_DAY)))
- # With regular loglevel, should return True.
+ # With regular loglevel, should return True except for package installs.
+ expect = not gslib.IS_PACKAGE_INSTALL
self.assertEqual(
- True,
+ expect,
self.command_runner._MaybeCheckForAndOfferSoftwareUpdate('ls', 0))
prev_loglevel = logging.getLogger().getEffectiveLevel()
--
1.8.1.5

View File

@ -0,0 +1,22 @@
diff --git a/setup.py b/setup.py
index 1478628..c25b6e7 100755
--- a/setup.py
+++ b/setup.py
@@ -33,15 +33,13 @@ management tasks, including:
"""
requires = [
- 'boto==2.9.7',
+ 'boto>=2.9.7',
'httplib2>=0.8',
'python-gflags>=2.0',
'google-api-python-client>=1.1',
'pyOpenSSL>=0.13',
'crcmod>=1.7',
- # Not using 1.02 because of:
- # https://code.google.com/p/socksipy-branch/issues/detail?id=3
- 'SocksiPy-branch==1.01',
+ 'SocksiPy-branch>=1.01',
]
dependency_links = [

View File

@ -0,0 +1,42 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
PYTHON_COMPAT=( python{2_6,2_7} )
inherit distutils-r1
DESCRIPTION="command line tool for interacting with cloud storage services"
HOMEPAGE="https://github.com/GoogleCloudPlatform/gsutil"
SRC_URI="http://commondatastorage.googleapis.com/pub/${PN}_${PV}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
DEPEND="${PYTHON_DEPS}"
RDEPEND="${DEPEND}
>=dev-python/boto-2.9.7[${PYTHON_USEDEP}]
>=dev-python/crcmod-1.7
>=dev-python/httplib2-0.8[${PYTHON_USEDEP}]
>=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
dev-python/google-api-python-client[${PYTHON_USEDEP}]
dev-python/python-gflags[${PYTHON_USEDEP}]
dev-python/setuptools[${PYTHON_USEDEP}]
dev-python/socksipy-branch[${PYTHON_USEDEP}]
"
S=${WORKDIR}/${PN}
DOCS=( README.md CHANGES.md )
PATCHES=(
${FILESDIR}/${P}-use-friendy-version-checks.patch
${FILESDIR}/${P}-Fix-update-tests-that-fail-for-package-installs.patch
${FILESDIR}/${P}-Fix-test-using-glob-with-ObjectToURI.patch
)
python_test() {
export BOTO_CONFIG=${FILESDIR}/dummy.boto
${PYTHON} gslib/__main__.py test -u || die "tests failed"
}

View File

@ -59,7 +59,6 @@
=sys-devel/clang-3.2 ~amd64
=dev-util/shflags-1.0.3 ~amd64
=dev-util/perf-3.4 ~amd64
=dev-python/boto-2.7.0 ~amd64
=sys-libs/libnih-1.0.3 ~amd64
=sys-devel/llvm-3.2 ~amd64
=dev-python/pyusb-1.0.0_alpha3 ~amd64
@ -93,10 +92,10 @@
# Needed for docker
=sys-fs/aufs-util-3.7.6 ~amd64
# Needed by gsutil-3.31
# Needed by gsutil-3.34
=dev-python/httplib2-0.8 ~amd64
=dev-python/crcmod-1.7-r1 ~amd64
=dev-python/boto-2.9.6 ~amd64
=dev-python/boto-2.9.8 ~amd64
# Fixes XML validation failure and python eclass usage
=dev-lang/yasm-1.2.0-r1