Merge lp:~wgrant/launchpad/delete-archiveroot into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 17136
Proposed branch: lp:~wgrant/launchpad/delete-archiveroot
Merge into: lp:launchpad
Prerequisite: lp:~wgrant/launchpad/htaccess-in-archiveroot
Diff against target: 59 lines (+7/-13)
2 files modified
lib/lp/archivepublisher/publishing.py (+3/-7)
lib/lp/archivepublisher/tests/test_publisher.py (+4/-6)
To merge this branch: bzr merge lp:~wgrant/launchpad/delete-archiveroot
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+225797@code.launchpad.net

Commit message

Delete archiveroot instead of its parent (/wgrant/ppa/ubuntu instead of /wgrant/ppa). This lets us have PPAs for different distros with the same name.

Description of the change

Now that .htaccess and .htpasswd live in archiveroot (/wgrant/ppa/ubuntu/.htaccess instead of /wgrant/ppa/.htaccess) Publisher.deleteArchive can just remove /wgrant/ppa/ubuntu rather than /wgrant/ppa, letting PPAs with the same name but from other distros survive the purge.

The empty directory cleanup cron job will handle /wgrant/ppa when all the distros are gone, as it already handles /wgrant when all the PPAs are gone.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) :
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/publishing.py'
2--- lib/lp/archivepublisher/publishing.py 2014-07-28 01:49:27 +0000
3+++ lib/lp/archivepublisher/publishing.py 2014-07-28 02:00:29 +0000
4@@ -966,13 +966,10 @@
5 be caught and an OOPS report generated.
6 """
7 assert self.archive.is_ppa
8- root_dir = os.path.join(
9- self._config.distroroot, self.archive.owner.name,
10- self.archive.name)
11-
12 self.log.info(
13 "Attempting to delete archive '%s/%s' at '%s'." % (
14- self.archive.owner.name, self.archive.name, root_dir))
15+ self.archive.owner.name, self.archive.name,
16+ self._config.archiveroot))
17
18 # Set all the publications to DELETED.
19 sources = self.archive.getPublishedSources(
20@@ -996,8 +993,7 @@
21 for pub in self.archive.getAllPublishedBinaries(include_removed=False):
22 pub.dateremoved = UTC_NOW
23
24- # XXX wgrant 2014-07-03: Needs checking for multi-distro sanity.
25- for directory in (root_dir, self._config.metaroot):
26+ for directory in (self._config.archiveroot, self._config.metaroot):
27 if directory is None or not os.path.exists(directory):
28 continue
29 try:
30
31=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
32--- lib/lp/archivepublisher/tests/test_publisher.py 2014-07-28 01:49:27 +0000
33+++ lib/lp/archivepublisher/tests/test_publisher.py 2014-07-28 02:00:29 +0000
34@@ -506,10 +506,9 @@
35 os.makedirs(publisher._config.metaroot)
36 open(os.path.join(publisher._config.metaroot, 'test'), 'w').close()
37
38+ root_dir = publisher._config.archiveroot
39+ self.assertTrue(os.path.exists(root_dir))
40 publisher.deleteArchive()
41- root_dir = os.path.join(
42- publisher._config.distroroot, test_archive.owner.name,
43- test_archive.name)
44 self.assertFalse(os.path.exists(root_dir))
45 self.assertFalse(os.path.exists(publisher._config.metaroot))
46 self.assertEqual(ArchiveStatus.DELETED, test_archive.status)
47@@ -549,10 +548,9 @@
48 open(os.path.join(
49 publisher._config.archiveroot, 'test_file'), 'w').close()
50
51+ root_dir = publisher._config.archiveroot
52+ self.assertTrue(os.path.exists(root_dir))
53 publisher.deleteArchive()
54- root_dir = os.path.join(
55- publisher._config.distroroot, test_archive.owner.name,
56- test_archive.name)
57 self.assertFalse(os.path.exists(root_dir))
58 self.assertNotIn('WARNING', logger.getLogBuffer())
59 self.assertNotIn('ERROR', logger.getLogBuffer())