diff --git a/system/run.py b/system/run.py index e11feea2..8f8819c9 100755 --- a/system/run.py +++ b/system/run.py @@ -8,6 +8,7 @@ import fnmatch import sys from lib import BaseTest +from s3_lib import S3Test try: from termcolor import colored @@ -32,7 +33,8 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non for name in dir(testModule): o = getattr(testModule, name) - if not (inspect.isclass(o) and issubclass(o, BaseTest) and o is not BaseTest): + if not (inspect.isclass(o) and issubclass(o, BaseTest) and o is not BaseTest and + o is not S3Test): continue if filters: diff --git a/system/s3_lib.py b/system/s3_lib.py new file mode 100644 index 00000000..831fcbc9 --- /dev/null +++ b/system/s3_lib.py @@ -0,0 +1,78 @@ +from lib import BaseTest +import uuid +import os + +try: + import boto + + if 'AWS_SECRET_ACCESS_KEY' in os.environ and 'AWS_ACCESS_KEY_ID' in os.environ: + s3_conn = boto.connect_s3() + else: + s3_conn = None +except ImportError: + s3_conn = None + + +class S3Test(BaseTest): + """ + BaseTest + support for S3 + """ + + def fixture_available(self): + return super(S3Test, self).fixture_available() and s3_conn is not None + + def prepare(self): + self.bucket_name = "aptly-sys-test-" + str(uuid.uuid4()) + self.bucket = s3_conn.create_bucket(self.bucket_name) + self.configOverride["S3PublishEndpoints"] = { + "test1": { + "region": "us-east-1", + "bucket": self.bucket_name, + } + } + + super(S3Test, self).prepare() + + def shutdown(self): + if hasattr(self, "bucket_name"): + if hasattr(self, "bucket"): + keys = self.bucket.list() + if keys: + self.bucket.delete_keys(keys) + s3_conn.delete_bucket(self.bucket_name) + + super(S3Test, self).shutdown() + + def check_path(self, path): + if not hasattr(self, "bucket_contents"): + self.bucket_contents = [key.name for key in self.bucket.list()] + + if path.startswith("public/"): + path = path[7:] + + if path in self.bucket_contents: + return True + + if not path.endswith("/"): + path = path + "/" + + for item in self.bucket_contents: + if item.startswith(path): + return True + + return False + + def check_exists(self, path): + if not self.check_path(path): + raise Exception("path %s doesn't exist" % (path, )) + + def check_not_exists(self, path): + if self.check_path(path): + raise Exception("path %s exists" % (path, )) + + def read_file(self, path): + if path.startswith("public/"): + path = path[7:] + + key = self.bucket.get_key(path, validate=True) + return key.get_contents_as_string() diff --git a/system/t06_publish/S3Publish1Test_binary b/system/t06_publish/S3Publish1Test_binary new file mode 100644 index 00000000..eecd933f --- /dev/null +++ b/system/t06_publish/S3Publish1Test_binary @@ -0,0 +1,25 @@ +Package: libboost-program-options-dev +Version: 1.49.0.1 +Installed-Size: 26 +Priority: optional +Section: libdevel +Maintainer: Debian Boost Team +Architecture: i386 +Description: program options library for C++ (default version) + This package forms part of the Boost C++ Libraries collection. + . + Library to let program developers obtain program options, that is + (name, value) pairs from the user, via conventional methods such as + command line and config file. + . + This package is a dependency package, which depends on Debian's default + Boost version (currently 1.49). +MD5sum: 0035d7822b2f8f0ec4013f270fd650c2 +SHA1: 36895eb64cfe89c33c0a2f7ac2f0c6e0e889e04b +SHA256: c76b4bd12fd92e4dfe1b55b18a67a669d92f62985d6a96c8a21d96120982cf12 +Filename: pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb +Size: 2738 +Homepage: http://www.boost.org/libs/program_options/ +Source: boost-defaults +Depends: libboost-program-options1.49-dev + diff --git a/system/t06_publish/S3Publish1Test_gold b/system/t06_publish/S3Publish1Test_gold new file mode 100644 index 00000000..b65701eb --- /dev/null +++ b/system/t06_publish/S3Publish1Test_gold @@ -0,0 +1,13 @@ +Loading packages... +Generating metadata files and linking package files... +Finalizing metadata files... +Signing file 'Release' with gpg, please enter your passphrase when prompted: +Clearsigning file 'Release' with gpg, please enter your passphrase when prompted: + +Local repo local-repo has been successfully published. +Now you can add following line to apt sources: + deb http://your-server/ maverick main + deb-src http://your-server/ maverick main +Don't forget to add your GPG key to apt with apt-key. + +You can also use `aptly serve` to publish your repositories over HTTP quickly. diff --git a/system/t06_publish/S3Publish1Test_release b/system/t06_publish/S3Publish1Test_release new file mode 100644 index 00000000..ad1fa6fd --- /dev/null +++ b/system/t06_publish/S3Publish1Test_release @@ -0,0 +1,34 @@ +Origin: . maverick +Label: . maverick +Codename: maverick +Date: Wed, 1 Oct 2014 08:48:48 UTC +Architectures: i386 +Components: main +Description: Generated by aptly +MD5Sum: + b844530d1336e9a3c431f0d36cfc01b0 602 main/binary-i386/Packages.gz + 1d7829dac8923aafe499f313abfaadd7 652 main/binary-i386/Packages.bz2 + 307b6495eab59c221e2ff8962896631b 2300 main/source/Sources + 65dd7338cfac70762457b586629e87e4 839 main/source/Sources.gz + 5cc219da21fdb8a96b265bca1c4c0808 1009 main/source/Sources.bz2 + 60b30b7b0c62ae04bb3bc457abadaced 90 main/binary-i386/Release + 945211dc923a8d1b97835232648c0aa7 92 main/source/Release + d419bd11e2b7fe9669bccdf67a18ca17 984 main/binary-i386/Packages +SHA1: + 1b314cedcf18a6d08d4aabbd8b9b5605ba293d04 602 main/binary-i386/Packages.gz + 5406a984c100b20fbebacdbac24ae3378885f73b 652 main/binary-i386/Packages.bz2 + e30d7bc51cd042ee987316967bf3043ab95c8ce9 2300 main/source/Sources + d60a7032080848eb48bcf68962698ba642dcc383 839 main/source/Sources.gz + fb194b90e0e0efd456a7346c4224294018b6677d 1009 main/source/Sources.bz2 + 2bfef2580deadf6863ee6f893e8b9a2c7522e1ed 90 main/binary-i386/Release + 8b98a2148d157bf87cc1955ef00ba1ba31275f94 92 main/source/Release + be80e1c588c6052f30865e44e3f1429f730d5bc8 984 main/binary-i386/Packages +SHA256: + a079102fdc72e6228229aaa8e5e6ad59b582026419737e81e11a8af2addd125e 602 main/binary-i386/Packages.gz + 25d101a333e85d952afc74f684cef3716d69e3c33d8a4b1544faec683c1b5d96 652 main/binary-i386/Packages.bz2 + bcf1fcf1ca2d1bb5565da8b4c39052d906832ad4885c21682d605b830e55a506 2300 main/source/Sources + 3e6cf6dc079333cdf01905957c611702f4ee10f654c84895ac7bf166bbbbd3bc 839 main/source/Sources.gz + 47b9d37fa81d23d227dd26e85821dd4f74db8f17ddefbe6ca686f62ddfedd8ad 1009 main/source/Sources.bz2 + 1d91164164e6310a5e5fc93390995028956f657490a9ce7aa136dc94291828a8 90 main/binary-i386/Release + 2d75333511325affcefe66c6cfbaa6ab21e6aa0e85a6b4fa39a4191146b81460 92 main/source/Release + 59643cc2d105694d6876dc328290a1c949b4e91e62ee8db396abac83a7034f9f 984 main/binary-i386/Packages diff --git a/system/t06_publish/S3Publish1Test_sources b/system/t06_publish/S3Publish1Test_sources new file mode 100644 index 00000000..7ea3c88c --- /dev/null +++ b/system/t06_publish/S3Publish1Test_sources @@ -0,0 +1,42 @@ +Package: pyspi +Version: 0.6.1-1.3 +Maintainer: Jose Carlos Garcia Sogo +Architecture: any +Binary: python-at-spi +Standards-Version: 3.7.3 +Format: 1.0 +Files: 22ff26db69b73d3438fdde21ab5ba2f1 3456 pyspi_0.6.1-1.3.diff.gz + b72cb94699298a117b7c82641c68b6fd 1782 pyspi_0.6.1-1.3.dsc + def336bd566ea688a06ec03db7ccf1f4 29063 pyspi_0.6.1.orig.tar.gz +Checksums-Sha1: 95a2468e4bbce730ba286f2211fa41861b9f1d90 3456 pyspi_0.6.1-1.3.diff.gz + 56c8a9b1f4ab636052be8966690998cbe865cd6c 1782 pyspi_0.6.1-1.3.dsc + 9694b80acc171c0a5bc99f707933864edfce555e 29063 pyspi_0.6.1.orig.tar.gz +Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk +Homepage: http://people.redhat.com/zcerza/dogtail +Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev +Directory: pool/main/p/pyspi +Checksums-Sha256: 2e770b28df948f3197ed0b679bdea99f3f2bf745e9ddb440c677df9c3aeaee3c 3456 pyspi_0.6.1-1.3.diff.gz + d494aaf526f1ec6b02f14c2f81e060a5722d6532ddc760ec16972e45c2625989 1782 pyspi_0.6.1-1.3.dsc + 64069ee828c50b1c597d10a3fefbba279f093a4723965388cdd0ac02f029bfb9 29063 pyspi_0.6.1.orig.tar.gz + +Package: pyspi +Version: 0.6.1-1.4 +Maintainer: Jose Carlos Garcia Sogo +Architecture: any +Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk +Standards-Version: 3.7.3 +Homepage: http://people.redhat.com/zcerza/dogtail +Directory: pool/main/p/pyspi +Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev +Checksums-Sha256: 289d3aefa970876e9c43686ce2b02f478d7f3ed35a713928464a98d54ae4fca3 893 pyspi-0.6.1-1.3.stripped.dsc + 2e770b28df948f3197ed0b679bdea99f3f2bf745e9ddb440c677df9c3aeaee3c 3456 pyspi_0.6.1-1.3.diff.gz + 64069ee828c50b1c597d10a3fefbba279f093a4723965388cdd0ac02f029bfb9 29063 pyspi_0.6.1.orig.tar.gz +Format: 1.0 +Checksums-Sha1: 5005fbd1f30637edc1d380b30f45db9b79100d07 893 pyspi-0.6.1-1.3.stripped.dsc + 95a2468e4bbce730ba286f2211fa41861b9f1d90 3456 pyspi_0.6.1-1.3.diff.gz + 9694b80acc171c0a5bc99f707933864edfce555e 29063 pyspi_0.6.1.orig.tar.gz +Binary: python-at-spi +Files: 2f5bd47cf38852b6fc927a50f98c1448 893 pyspi-0.6.1-1.3.stripped.dsc + 22ff26db69b73d3438fdde21ab5ba2f1 3456 pyspi_0.6.1-1.3.diff.gz + def336bd566ea688a06ec03db7ccf1f4 29063 pyspi_0.6.1.orig.tar.gz + diff --git a/system/t06_publish/S3Publish2Test_binary b/system/t06_publish/S3Publish2Test_binary new file mode 100644 index 00000000..05d63c09 --- /dev/null +++ b/system/t06_publish/S3Publish2Test_binary @@ -0,0 +1,25 @@ +Package: libboost-program-options-dev +Version: 1.49.0.1 +Installed-Size: 26 +Priority: optional +Section: libdevel +Maintainer: Debian Boost Team +Architecture: i386 +Description: program options library for C++ (default version) + This package forms part of the Boost C++ Libraries collection. + . + Library to let program developers obtain program options, that is + (name, value) pairs from the user, via conventional methods such as + command line and config file. + . + This package is a dependency package, which depends on Debian's default + Boost version (currently 1.49). +MD5sum: 0035d7822b2f8f0ec4013f270fd650c2 +SHA1: 36895eb64cfe89c33c0a2f7ac2f0c6e0e889e04b +SHA256: c76b4bd12fd92e4dfe1b55b18a67a669d92f62985d6a96c8a21d96120982cf12 +Source: boost-defaults +Filename: pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb +Depends: libboost-program-options1.49-dev +Homepage: http://www.boost.org/libs/program_options/ +Size: 2738 + diff --git a/system/t06_publish/S3Publish2Test_gold b/system/t06_publish/S3Publish2Test_gold new file mode 100644 index 00000000..12c9c0e6 --- /dev/null +++ b/system/t06_publish/S3Publish2Test_gold @@ -0,0 +1,8 @@ +Loading packages... +Generating metadata files and linking package files... +Finalizing metadata files... +Signing file 'Release' with gpg, please enter your passphrase when prompted: +Clearsigning file 'Release' with gpg, please enter your passphrase when prompted: +Cleaning up prefix "." components main... + +Publish for local repo s3:test1:./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated. diff --git a/system/t06_publish/S3Publish2Test_release b/system/t06_publish/S3Publish2Test_release new file mode 100644 index 00000000..7c89bc78 --- /dev/null +++ b/system/t06_publish/S3Publish2Test_release @@ -0,0 +1,34 @@ +Origin: . maverick +Label: . maverick +Codename: maverick +Date: Wed, 1 Oct 2014 09:13:14 UTC +Architectures: i386 +Components: main +Description: Generated by aptly +MD5Sum: + d41d8cd98f00b204e9800998ecf8427e 0 main/source/Sources + f41c10a4b35cd3e1ec8abb9c2ab676ed 23 main/source/Sources.gz + 4059d198768f9f8dc9372dc1c54bc3c3 14 main/source/Sources.bz2 + 60b30b7b0c62ae04bb3bc457abadaced 90 main/binary-i386/Release + 945211dc923a8d1b97835232648c0aa7 92 main/source/Release + db76ccafa3c9e4c1dba620259df78f87 984 main/binary-i386/Packages + d666eb8b2fc8a0ef525d37aff33c7b2f 603 main/binary-i386/Packages.gz + ca2b3a9fc60f4a0a1091b9f0357b11eb 651 main/binary-i386/Packages.bz2 +SHA1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 main/source/Sources + 92c6cff562771f64540523a54baaa0b2afe54b3f 23 main/source/Sources.gz + 64a543afbb5f4bf728636bdcbbe7a2ed0804adc2 14 main/source/Sources.bz2 + 2bfef2580deadf6863ee6f893e8b9a2c7522e1ed 90 main/binary-i386/Release + 8b98a2148d157bf87cc1955ef00ba1ba31275f94 92 main/source/Release + 7dcfa6945771369da0a22c2f90f2300b5d238662 984 main/binary-i386/Packages + ba6efb87b17aa8d08476b3f181702e4d3199794e 603 main/binary-i386/Packages.gz + 0b36a014d1a5ccbf3d73de0035970737659e3c0f 651 main/binary-i386/Packages.bz2 +SHA256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 main/source/Sources + 1775fca35fb6a4d31c541746eaea63c5cb3c00280c8b5a351d4e944cdca7489d 23 main/source/Sources.gz + d3dda84eb03b9738d118eb2be78e246106900493c0ae07819ad60815134a8058 14 main/source/Sources.bz2 + 1d91164164e6310a5e5fc93390995028956f657490a9ce7aa136dc94291828a8 90 main/binary-i386/Release + 2d75333511325affcefe66c6cfbaa6ab21e6aa0e85a6b4fa39a4191146b81460 92 main/source/Release + 0e2e7586903004efb49dd419be8a98260dab502352c4b1bf6074f658220aef4e 984 main/binary-i386/Packages + e2bd1d551b4983253cc26004504ead7b6987e609db8cb7185ab3dde69d346acd 603 main/binary-i386/Packages.gz + 81bcd3d47fc3e9dbe1e201d7ec1b356dd2ae3bc5c171f76247243a64755c25d6 651 main/binary-i386/Packages.bz2 diff --git a/system/t06_publish/S3Publish2Test_sources b/system/t06_publish/S3Publish2Test_sources new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/S3Publish3Test_binary b/system/t06_publish/S3Publish3Test_binary new file mode 100644 index 00000000..68a4003f --- /dev/null +++ b/system/t06_publish/S3Publish3Test_binary @@ -0,0 +1,29 @@ +Package: gnuplot-x11 +Version: 4.6.1-1~maverick2 +Installed-Size: 1604 +Priority: optional +Section: math +Maintainer: Debian Science Team +Architecture: i386 +Description: Command-line driven interactive plotting program + Gnuplot is a portable command-line driven interactive data and function + plotting utility that supports lots of output formats, including drivers + for many printers, (La)TeX, (x)fig, Postscript, and so on. The X11-output + is packaged in gnuplot-x11. + . + Data files and self-defined functions can be manipulated by the internal + C-like language. Can perform smoothing, spline-fitting, or nonlinear fits, + and can work with complex numbers. + . + This package contains the terminal driver that enables gnuplot to plot + images interactively under X11. Most users will want this, it is however + packaged separately so that low-end systems don't need X installed to use + gnuplot. +MD5sum: fcad938905d0ace50a6ce0c73b2c6583 +SHA1: 02f9a93097a8f798a054e26154dbe5789088c069 +Replaces: gnuplot (<< 4.0.0) +Filename: pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb +Depends: gnuplot-nox (>= 4.6.1-1~maverick2), libc6 (>= 2.11), libcairo2 (>= 1.6.0), libedit2 (>= 2.5.cvs.20010821-1), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg), libglib2.0-0 (>= 2.12.0), liblua5.1-0, libpango1.0-0 (>= 1.14.0), libstdc++6 (>= 4.1.1), libwxbase2.8-0 (>= 2.8.11.0), libwxgtk2.8-0 (>= 2.8.11.0), libx11-6 +Size: 724388 +Source: gnuplot + diff --git a/system/t06_publish/S3Publish3Test_gold b/system/t06_publish/S3Publish3Test_gold new file mode 100644 index 00000000..b6fc6fce --- /dev/null +++ b/system/t06_publish/S3Publish3Test_gold @@ -0,0 +1,8 @@ +Loading packages... +Generating metadata files and linking package files... +Finalizing metadata files... +Signing file 'Release' with gpg, please enter your passphrase when prompted: +Clearsigning file 'Release' with gpg, please enter your passphrase when prompted: +Cleaning up prefix "." components main... + +Publish for snapshot s3:test1:./maverick [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new snapshot. diff --git a/system/t06_publish/S3Publish3Test_release b/system/t06_publish/S3Publish3Test_release new file mode 100644 index 00000000..892aa912 --- /dev/null +++ b/system/t06_publish/S3Publish3Test_release @@ -0,0 +1,34 @@ +Origin: . maverick +Label: . maverick +Codename: maverick +Date: Wed, 1 Oct 2014 09:16:49 UTC +Architectures: amd64 i386 +Components: main +Description: Generated by aptly +MD5Sum: + 4717e26fc4a8703cd8886feb8ff9532d 91 main/binary-amd64/Release + 60b30b7b0c62ae04bb3bc457abadaced 90 main/binary-i386/Release + 2b810443a56c38746aba877b84fc74a1 1526 main/binary-amd64/Packages + 28bced4c89869001d9fe6b7c553dd1df 862 main/binary-amd64/Packages.gz + aaa2ee36bda75a9c66e31881ae128016 931 main/binary-amd64/Packages.bz2 + aac26f9e4705d03000094f76d475aea2 1524 main/binary-i386/Packages + 158aec0342fc4ca52178b4512c5ee1b5 862 main/binary-i386/Packages.gz + 34859d0bf49cb66045de43d01b1de311 939 main/binary-i386/Packages.bz2 +SHA1: + 93c9982ebbb6a74a118d07e500b596097c8c4780 91 main/binary-amd64/Release + 2bfef2580deadf6863ee6f893e8b9a2c7522e1ed 90 main/binary-i386/Release + 876cafdad8672c4b0b66baec5b12213d2bcb4cf3 1526 main/binary-amd64/Packages + b3e2e9ad945a190e2ce4aeb36d1946d9ad04a075 862 main/binary-amd64/Packages.gz + bc8a7022261b79f5aeacdca551c51aeb7530b969 931 main/binary-amd64/Packages.bz2 + 7eca65cdb4a4a6bcb51747f2c8d4829f4457f22b 1524 main/binary-i386/Packages + e1f5ab02bdd1fcaa0ab93c5680919f612692992c 862 main/binary-i386/Packages.gz + 8a7f311f39316dcedc8a199421116ba92a941028 939 main/binary-i386/Packages.bz2 +SHA256: + 73aa8d6aaf47a1bf3c546869ceb09a882a8c2d840f81878e552fe2d1260ac4e2 91 main/binary-amd64/Release + 1d91164164e6310a5e5fc93390995028956f657490a9ce7aa136dc94291828a8 90 main/binary-i386/Release + f47ca8ea0dc02b4423b1291b302e5594c0ac5c01da72c6f9de1ae17d3eddef2f 1526 main/binary-amd64/Packages + 0a939f23e1ed98ec3cf2033eb5665d4c40e7494d6331f453ac2043be3e234897 862 main/binary-amd64/Packages.gz + abdb8e2537c11272fc9f70ccbcbd2ee867ae797666d3bf11a51972fa2f4d0325 931 main/binary-amd64/Packages.bz2 + 7b1e711ab4647a3e200af742690ffee76bcf7244f597fda699495e29177b1c71 1524 main/binary-i386/Packages + 5723a156f299c657b2eebd1c17ff1a0ca3f50036fc9a1b6c7d9f985a1841c171 862 main/binary-i386/Packages.gz + 41f396a3b5c7f78d743971a1011706c6782c8abac3168ff862fa301255baa040 939 main/binary-i386/Packages.bz2 diff --git a/system/t06_publish/S3Publish4Test_gold b/system/t06_publish/S3Publish4Test_gold new file mode 100644 index 00000000..2d98c85a --- /dev/null +++ b/system/t06_publish/S3Publish4Test_gold @@ -0,0 +1,4 @@ +Published repositories: + * s3:test1:./maverick [amd64, i386] publishes {main: [local-repo]} + * s3:test1:./xyz [amd64, i386] publishes {main: [local-repo]} + * s3:test1:prefix/maverick [amd64, i386] publishes {main: [local-repo]} diff --git a/system/t06_publish/S3Publish5Test_gold b/system/t06_publish/S3Publish5Test_gold new file mode 100644 index 00000000..cadce02c --- /dev/null +++ b/system/t06_publish/S3Publish5Test_gold @@ -0,0 +1,3 @@ +Cleaning up prefix "." components main... + +Published repository has been removed successfully. diff --git a/system/t06_publish/__init__.py b/system/t06_publish/__init__.py index 55e1dd3b..45ba80df 100644 --- a/system/t06_publish/__init__.py +++ b/system/t06_publish/__init__.py @@ -8,3 +8,4 @@ from .repo import * from .snapshot import * from .switch import * from .update import * +from .s3 import * diff --git a/system/t06_publish/s3.py b/system/t06_publish/s3.py new file mode 100644 index 00000000..e244217f --- /dev/null +++ b/system/t06_publish/s3.py @@ -0,0 +1,159 @@ +from s3_lib import S3Test + + +def strip_processor(output): + return "\n".join([l for l in output.split("\n") if not l.startswith(' ') and not l.startswith('Date:')]) + + +class S3Publish1Test(S3Test): + """ + publish to S3: from repo + """ + fixtureCmds = [ + "aptly repo create -distribution=maverick local-repo", + "aptly repo add local-repo ${files}", + ] + runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo s3:test1:" + + def check(self): + super(S3Publish1Test, self).check() + + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/source/Sources') + self.check_exists('public/dists/maverick/main/source/Sources.gz') + self.check_exists('public/dists/maverick/main/source/Sources.bz2') + + self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc') + self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz') + self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz') + self.check_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc') + self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb') + + # # verify contents except of sums + self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor) + self.check_file_contents('public/dists/maverick/main/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n")))) + self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n")))) + + +class S3Publish2Test(S3Test): + """ + publish to S3: publish update removed some packages + """ + fixtureCmds = [ + "aptly repo create -distribution=maverick local-repo", + "aptly repo add local-repo ${files}/", + "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo s3:test1:", + "aptly repo remove local-repo pyspi" + ] + runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick s3:test1:" + + def check(self): + super(S3Publish2Test, self).check() + + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/source/Sources') + self.check_exists('public/dists/maverick/main/source/Sources.gz') + self.check_exists('public/dists/maverick/main/source/Sources.bz2') + + self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc') + self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz') + self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz') + self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc') + self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb') + + # verify contents except of sums + self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor) + self.check_file_contents('public/dists/maverick/main/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n")))) + self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n")))) + + +class S3Publish3Test(S3Test): + """ + publish to S3: publish switch - removed some packages + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot pull -no-deps -architectures=i386,amd64 snap2 snap1 snap3 gnuplot-x11", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap1 s3:test1:", + ] + runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick s3:test1: snap3" + + def check(self): + super(S3Publish3Test, self).check() + + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/binary-amd64/Packages') + self.check_exists('public/dists/maverick/main/binary-amd64/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-amd64/Packages.bz2') + + self.check_exists('public/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb') + self.check_exists('public/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_amd64.deb') + self.check_not_exists('public/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_i386.deb') + self.check_not_exists('public/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_amd64.deb') + + # verify contents except of sums + self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor) + self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n")))) + + +class S3Publish4Test(S3Test): + """ + publish to S3: multiple repos, list + """ + fixtureCmds = [ + "aptly repo create -distribution=maverick local-repo", + "aptly repo add local-repo ${udebs}", + "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo s3:test1:", + "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=xyz local-repo s3:test1:", + "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo s3:test1:prefix", + ] + runCmd = "aptly publish list" + + +# Breaks, as we need a fix: https://github.com/mitchellh/goamz/pull/116 +# class S3Publish5Test(S3Test): +# """ +# publish to S3: publish drop - component cleanup +# """ +# fixtureCmds = [ +# "aptly repo create local1", +# "aptly repo create local2", +# "aptly repo add local1 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb", +# "aptly repo add local2 ${files}", +# "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=sq1 local1 s3:test1:", +# "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=sq2 local2 s3:test1:", +# ] +# runCmd = "aptly publish drop sq2 s3:test1:" + +# def check(self): +# super(S3Publish5Test, self).check() + +# self.check_exists('public/dists/sq1') +# self.check_not_exists('public/dists/sq2') +# self.check_exists('public/pool/main/') + +# self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc') +# self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz') +# self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz') +# self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc') +# self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')