diff --git a/system/files/aptly.pub b/system/files/aptly.pub new file mode 100644 index 00000000..08758e43 Binary files /dev/null and b/system/files/aptly.pub differ diff --git a/system/files/aptly.sec b/system/files/aptly.sec new file mode 100644 index 00000000..f90e1c91 Binary files /dev/null and b/system/files/aptly.sec differ diff --git a/system/gpg-gen-key b/system/gpg-gen-key new file mode 100644 index 00000000..6af211b9 --- /dev/null +++ b/system/gpg-gen-key @@ -0,0 +1,13 @@ +Key-Type: DSA +Key-Length: 1024 +Subkey-Type: ELG-E +Subkey-Length: 1024 +Name-Real: Aptly Tester +Name-Comment: don't use it +Name-Email: test@aptly.info +Expire-Date: 0 +%pubring aptly.pub +%secring aptly.sec +# Do a commit here, so that we can later print "done" :-) +%commit +%echo done \ No newline at end of file diff --git a/system/lib.py b/system/lib.py index e0be0768..3140cc9c 100644 --- a/system/lib.py +++ b/system/lib.py @@ -129,9 +129,6 @@ class BaseTest(object): os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "flat.key")]) if hasattr(self, "fixtureCmds"): - if self.fixtureWebServer: - params = {'url': self.webServerUrl} - self.fixtureCmds = [string.Template(cmd).substitute(params) for cmd in self.fixtureCmds] for cmd in self.fixtureCmds: self.run_cmd(cmd) @@ -141,6 +138,12 @@ class BaseTest(object): def run_cmd(self, command, expected_code=0): try: if not hasattr(command, "__iter__"): + params = {'files': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files")} + if self.fixtureWebServer: + params['url'] = self.webServerUrl + + command = string.Template(command).substitute(params) + command = shlex.split(command) environ = os.environ.copy() environ["LC_ALL"] = "C" diff --git a/system/t05_snapshot/drop.py b/system/t05_snapshot/drop.py index 8683ce2c..80cb4beb 100644 --- a/system/t05_snapshot/drop.py +++ b/system/t05_snapshot/drop.py @@ -51,7 +51,7 @@ class DropSnapshot4Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", - "aptly publish snapshot snap1" + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1" ] runCmd = "aptly snapshot drop snap1" expectedCode = 1 @@ -65,7 +65,7 @@ class DropSnapshot5Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", - "aptly publish snapshot snap1" + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1" ] runCmd = "aptly snapshot drop --force snap1" expectedCode = 1 @@ -88,7 +88,7 @@ class DropSnapshot7Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", - "aptly publish snapshot snap1", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1", "aptly publish drop maverick", ] runCmd = "aptly snapshot drop snap1" diff --git a/system/t06_publish/drop.py b/system/t06_publish/drop.py index c9066cc3..6a21f32f 100644 --- a/system/t06_publish/drop.py +++ b/system/t06_publish/drop.py @@ -9,7 +9,7 @@ class PublishDrop1Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", - "aptly publish snapshot snap1", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1", ] runCmd = "aptly publish drop maverick" gold_processor = BaseTest.expand_environ @@ -29,7 +29,7 @@ class PublishDrop2Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", - "aptly publish snapshot snap1 ppa/smira", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1 ppa/smira", ] runCmd = "aptly publish drop maverick ppa/smira" gold_processor = BaseTest.expand_environ diff --git a/system/t06_publish/list.py b/system/t06_publish/list.py index a0fd8694..0c720669 100644 --- a/system/t06_publish/list.py +++ b/system/t06_publish/list.py @@ -17,7 +17,7 @@ class PublishList2Test(BaseTest): fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", "aptly snapshot merge snap2 snap1", - "aptly publish snapshot snap1", - "aptly -architectures=amd64 publish snapshot -distribution=wheezy -component=contrib snap2 ppa/smira", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1", + "aptly -architectures=amd64 publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=contrib snap2 ppa/smira", ] runCmd = "aptly publish list" diff --git a/system/t06_publish/snapshot.py b/system/t06_publish/snapshot.py index cfcfd0e4..406963fd 100644 --- a/system/t06_publish/snapshot.py +++ b/system/t06_publish/snapshot.py @@ -1,5 +1,6 @@ import os import hashlib +import inspect from lib import BaseTest @@ -16,7 +17,7 @@ class PublishSnapshot1Test(BaseTest): fixtureCmds = [ "aptly snapshot create snap1 from mirror gnuplot-maverick", ] - runCmd = "aptly publish snapshot snap1" + runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1" gold_processor = BaseTest.expand_environ def check(self): @@ -39,8 +40,10 @@ class PublishSnapshot1Test(BaseTest): self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor) # verify signatures - self.run_cmd(["gpg", "--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/InRelease')]) - self.run_cmd(["gpg", "--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release.gpg'), + self.run_cmd(["gpg", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly.pub"), + "--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/InRelease')]) + self.run_cmd(["gpg", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly.pub"), + "--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release.gpg'), os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release')]) # verify sums @@ -83,7 +86,7 @@ class PublishSnapshot2Test(BaseTest): fixtureCmds = [ "aptly snapshot create snap2 from mirror gnuplot-maverick", ] - runCmd = "aptly publish snapshot -distribution=squeeze snap2" + runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap2" gold_processor = BaseTest.expand_environ def check(self): @@ -115,7 +118,7 @@ class PublishSnapshot3Test(BaseTest): fixtureCmds = [ "aptly snapshot create snap3 from mirror gnuplot-maverick", ] - runCmd = "aptly publish snapshot -distribution=squeeze -component=contrib snap3" + runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze -component=contrib snap3" gold_processor = BaseTest.expand_environ def check(self): @@ -147,7 +150,7 @@ class PublishSnapshot4Test(BaseTest): fixtureCmds = [ "aptly snapshot create snap4 from mirror gnuplot-maverick", ] - runCmd = "aptly -architectures=i386 publish snapshot -distribution=squeeze snap4" + runCmd = "aptly -architectures=i386 publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap4" gold_processor = BaseTest.expand_environ def check(self): @@ -179,7 +182,7 @@ class PublishSnapshot5Test(BaseTest): fixtureCmds = [ "aptly snapshot create snap5 from mirror gnuplot-maverick", ] - runCmd = "aptly publish snapshot -distribution=squeeze snap5 ppa/smira" + runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap5 ppa/smira" gold_processor = BaseTest.expand_environ @@ -221,7 +224,7 @@ class PublishSnapshot7Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap7 from mirror gnuplot-maverick", - "aptly publish snapshot snap7", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap7", ] runCmd = "aptly publish snapshot snap7" expectedCode = 1 @@ -235,7 +238,7 @@ class PublishSnapshot8Test(BaseTest): fixturePool = True fixtureCmds = [ "aptly snapshot create snap8 from mirror gnuplot-maverick", - "aptly publish snapshot snap8 ./ppa", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap8 ./ppa", ] runCmd = "aptly publish snapshot snap8 ppa" expectedCode = 1