Merge lp:~apw/launchpad/signing-checksum-fix-cross-device-links into lp:launchpad

Proposed by Andy Whitcroft on 2016-06-22
Status: Merged
Merged at revision: 18112
Proposed branch: lp:~apw/launchpad/signing-checksum-fix-cross-device-links
Merge into: lp:launchpad
Diff against target: 54 lines (+11/-1)
2 files modified
lib/lp/archivepublisher/signing.py (+2/-1)
lib/lp/archivepublisher/tests/test_signing.py (+9/-0)
To merge this branch: bzr merge lp:~apw/launchpad/signing-checksum-fix-cross-device-links
Reviewer Review Type Date Requested Status
Colin Watson 2016-06-22 Approve on 2016-06-22
Review via email: mp+298106@code.launchpad.net

Commit Message

Fix custom publisher oopses when attempting to rename prepared checksum files into place. These should be built in the archive temproot to ensure they are on the same filesystem.

Description of the Change

Fix custom publisher oopses when attempting to rename prepared checksum files into place. These should be built in the archive temproot to ensure they are on the same filesystem.

To post a comment you must log in.
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/signing.py'
2--- lib/lp/archivepublisher/signing.py 2016-06-17 21:17:58 +0000
3+++ lib/lp/archivepublisher/signing.py 2016-06-22 09:07:25 +0000
4@@ -109,6 +109,7 @@
5 self.targetdir = os.path.join(
6 dists_signed, "%s-%s" % (self.package, self.arch))
7 self.archiveroot = pubconf.archiveroot
8+ self.temproot = pubconf.temproot
9
10 self.public_keys = set()
11
12@@ -338,7 +339,7 @@
13 signer = None
14 if self.archive.signing_key:
15 signer = IArchiveSigningKey(self.archive)
16- with DirectoryHash(versiondir, self.tmpdir, signer) as hasher:
17+ with DirectoryHash(versiondir, self.temproot, signer) as hasher:
18 hasher.add_dir(versiondir)
19
20 def shouldInstall(self, filename):
21
22=== modified file 'lib/lp/archivepublisher/tests/test_signing.py'
23--- lib/lp/archivepublisher/tests/test_signing.py 2016-06-17 20:46:06 +0000
24+++ lib/lp/archivepublisher/tests/test_signing.py 2016-06-22 09:07:25 +0000
25@@ -100,6 +100,9 @@
26 self.signing_dir = os.path.join(
27 self.temp_dir, self.distro.name + "-signing")
28 self.suite = "distroseries"
29+ pubconf = getPubConfig(self.archive)
30+ if not os.path.exists(pubconf.temproot):
31+ os.makedirs(pubconf.temproot)
32 # CustomUpload.installFiles requires a umask of 0o022.
33 old_umask = os.umask(0o022)
34 self.addCleanup(os.umask, old_umask)
35@@ -115,6 +118,9 @@
36 self.signing_dir = os.path.join(
37 self.temp_dir, "signing", "signing-owner", "testing")
38 self.testcase_cn = '/CN=PPA signing-owner testing/'
39+ pubconf = getPubConfig(self.archive)
40+ if not os.path.exists(pubconf.temproot):
41+ os.makedirs(pubconf.temproot)
42
43 def setUpArchiveKey(self):
44 with KeyServerTac():
45@@ -183,6 +189,9 @@
46 # nothing is signed.
47 self.archive = self.factory.makeArchive(
48 distribution=self.distro, purpose=ArchivePurpose.COPY)
49+ pubconf = getPubConfig(self.archive)
50+ if not os.path.exists(pubconf.temproot):
51+ os.makedirs(pubconf.temproot)
52 self.openArchive("test", "1.0", "amd64")
53 self.tarfile.add_file("1.0/empty.efi", "")
54 self.tarfile.add_file("1.0/empty.ko", "")