Merge lp://staging/~cody-somerville/launchpad/ppa-deletion into lp://staging/launchpad/db-devel
Proposed by
Cody A.W. Somerville
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Julian Edwards | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp://staging/~cody-somerville/launchpad/ppa-deletion | ||||
Merge into: | lp://staging/launchpad/db-devel | ||||
Diff against target: |
272 lines (+142/-23) 5 files modified
lib/lp/archivepublisher/publishing.py (+40/-1) lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py (+8/-1) lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py (+42/-0) lib/lp/archivepublisher/tests/test_publisher.py (+19/-1) lib/lp/soyuz/scripts/publishdistro.py (+33/-20) |
||||
To merge this branch: | bzr merge lp://staging/~cody-somerville/launchpad/ppa-deletion | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julian Edwards (community) | Approve | ||
Review via email: mp+22176@code.staging.launchpad.net |
Commit message
Add support to publisher for deleting PPAs; and update generate_
Description of the change
Add a deleteArchive method to the publisher which will be called by the publishdistro script when an archive (for now just PPAs) has a status of ArchiveStatus.
To post a comment you must log in.
> === modified file 'lib/lp/ archivepublishe r/publishing. py' archivepublishe r/publishing. py 2010-02-09 00:17:40 +0000 archivepublishe r/publishing. py 2010-03-25 20:23:14 +0000 COMPONENT_ ORDER database. sqlbase import sqlvalues interfaces. pocket import ( ngPocket, pocketsuffix) interfaces. archive import ArchivePurpose interfaces. archive import ArchivePurpose, ArchiveStatus interfaces. binarypackagere lease import ( rmat) interfaces. component import IComponentSet interfaces. publishing import PackagePublishi ngStatus librarian. client import LibrarianClient launchpad. webapp. errorlog import ( tility, ScriptRequest) items() ) self): owner.name, self.archive.name, archiveroot) ) exists( self._config. archiveroot) : rmtree( self._config. archiveroot) archiveroot) [('error- explanation' , message)]) tility( ).raising( sys.exc_ info(), request) archiveroot, self.archive. owner.name, DELETED
> --- lib/lp/
> +++ lib/lp/
> @@ -12,9 +12,11 @@
> import hashlib
> import logging
> import os
> +import shutil
>
> from datetime import datetime
>
> +from storm.store import Store
> from zope.component import getUtility
>
> from lp.archivepublisher import HARDCODED_
> @@ -29,13 +31,15 @@
> from canonical.
> from lp.registry.
> PackagePublishi
> -from lp.soyuz.
> +from lp.soyuz.
> from lp.soyuz.
> BinaryPackageFo
> from lp.soyuz.
> from lp.soyuz.
>
> from canonical.
> +from canonical.
> + ErrorReportingU
>
> suffixpocket = dict((v, k) for (k, v) in pocketsuffix.
>
> @@ -596,3 +600,37 @@
> in_file.close()
>
> out_file.write(" %s % 16d %s\n" % (checksum, length, file_name))
> +
> + def deleteArchive(
> + """Delete the archive.
> +
> + Physically remove the entire archive from disk and set the
archive's
> + status to DELETED.
> +
> + Any errors encountered while removing the archive from disk will
> + be caught and an OOPS report generated.
> + """
> +
> + self.log.info(
> + "Attempting to delete archive '%s/%s' at '%s'." % (
> + self.archive.
> + self._config.
> +
> + # Attempt to rmdir if the path to the root of the archive exists.
> + if os.path.
> + try:
> + shutil.
> + except:
> + message = 'Exception while deleting archive root %s' % (
> + self._config.
> + request = ScriptRequest(
> + ErrorReportingU
> + self.log.error('%s (%s)' % (message, request.oopsid))
> + else:
> + self.log.warning(
> + "Root directory '%s' for archive '%s/%s' does not exist." %
(
> + self._config.
> + self.archive.name))
> +
> + # Set archive's status to DELETED.
> + self.archive.status = ArchiveStatus.
This is all good. I was trying to think of failure scenarios with it but I
think you have them all covered!
> archivepublishe r/tests/ test_publisher. py' archivepublishe r/tests/ test_publisher. py 2010-02-10 00:25:55 archivepublishe r/tests/ test_publisher. py 2010-03-25 20:23:14
> === modified file 'lib/lp/
> --- lib/lp/
+0000
> +++ lib/lp/
+0000
> @@ -26,7 +2...