Merge lp:~jtv/launchpad/bug-824499 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 13693 |
Proposed branch: | lp:~jtv/launchpad/bug-824499 |
Merge into: | lp:launchpad |
Prerequisite: | lp:~jtv/launchpad/pre-824499 |
Diff against target: | 0 lines |
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-824499 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Henning Eggers (community) | Approve | ||
Review via email: mp+71544@code.launchpad.net |
This proposal supersedes a proposal from 2011-08-15.
Commit message
All-derived-distros option for publish-ftpmaster.
Description of the change
= Summary =
This adds an option to publish-ftpmaster to, rather than publishing a single distribution named on the command line (and let's face it, that's probably going to be Ubuntu) loops over all Ubuntu-derived distributions. That way we can (and will) set up a separate server to published derived distros, without needing admin intervention for each new distro.
== Proposed fix ==
Replace the script's self.distribution with a list, self.distributions, and loop over it. That gives us the same code path for a single distro (the existing mode of operation) and a loop over several. Next, add code for looking up the derived distros (dead easy since I've done it exactly twice before so it's in a reusable place) and checking that no more than one of the options is given.
== Pre-implementation notes ==
Julian expected me to do this as part of the same work on publish-distro, but as per Sod's Law I ended up forgetting that part. Understandable I hope, since publish-ftpmaster calls publish-distro instead of the other way around.
== Implementation details ==
The self.archives attribute is gone, and self.configs gets one extra layer of indirection. Removing self.archives also let me inline getArchives.
The ordering between setUpDirs and processAccepted has changed. I couldn't see any disadvantage to that, but it let me avoid calling setUpDirs separately for each distro. (This avoids a lot of noise in tests). Another method that stayed outside the distributions loop is recoverWorkingD
== Tests ==
{{{
./bin/test -vvc lp.archivepubli
}}}
== Demo and Q/A ==
Run publish-ftpmaster with the --all-derived option (instead of the usual --distribution=
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
Hello Jeroen,
this looks like it's very well done. Thank you. I just have a few
little suggestion.
review approve
Cheers,
Henning
> > === modified file 'lib/lp/ archivepublishe r/scripts/ publish_ ftpmaster. py' archivepublishe r/scripts/ publish_ ftpmaster. py archivepublishe r/scripts/ publish_ ftpmaster. py scripts. processaccepted import ProcessAccepted scripts. publishdistro import PublishDistro TO_PUBLISH = [ PRIMARY, PARTNER, _archives( distribution) : on.all_ distro_ archives) directly. PRIMARY, PARTNER, all_distro_ archives TO_PUBLISH]
> > --- lib/lp/
> > 2011-08-15 11:04:41 +0000
> > +++ lib/lp/
> > 2011-08-15 11:04:41 +0000
> > @@ -31,12 +31,20 @@
> > from lp.soyuz.
> > from lp.soyuz.
> >
> > -# XXX JeroenVermeulen 2011-03-31 bug=746229: to start publishing debug
> > -# archives, get rid of this list.
> > -ARCHIVES_
> > - ArchivePurpose.
> > - ArchivePurpose.
> > - ]
> > +
> > +def get_publishable
> > + """Get all archives for `distribution` that should be published."""
> > + # XXX JeroenVermeulen 2011-03-31 bug=746229: to start publishing
> > + # debug archives, simply stop filtering them out here. It may be
> > + # enough to return list(distributi
> > + ARCHIVES_TO_PUBLISH = [
> > + ArchivePurpose.
> > + ArchivePurpose.
> > + ]
> > + return [
> > + archive
> > + for archive in distribution.
> > + if archive.purpose in ARCHIVES_
I don't know if you like lambdas but they are not banned anymore
AFAIK. So this could be written as:
return filter(
distribution. all_distro_ archives, TO_PUBLISH)
lambda archive: archive.purpose in ARCHIVES_
But I let you decide what you find more readable. I personally do not
prefer the dangling if clause.
> > shell_boolean( boolean_ value): options( self): t`.""" add_option( 'store_ true', add_option( ion', default=None, add_option( self): ions` to the `Distribution`s to publish. distribution is None: Failure( "Specify a distribution.") distribution is None and not all_derived: Failure( distribution is not None and all_derived: Failure( IDistributionSe t).getByName( distribution) Failure( distribution) all_derived: IDistributionSe t)
> >
> > def compose_
> > @@ -166,6 +174,9 @@
> > def add_my_
> > """See `LaunchpadScrip
> > self.parser.
> > + '-a', '--all-derived', dest='all_derived',
> > action=
> > + default=False, help="Process all derived distributions.")
> > + self.parser.
> > '-d', '--distribution', dest='distribut
> > help="Distribution to publish.")
> > self.parser.
> > @@ -179,16 +190,25 @@
> > def processOptions(
> > """Handle command-line options.
> >
> > - Sets `self.distribution` to the `Distribution` to publish.
> > + Sets `self.distribut
> > """
> > - if self.options.
> > - raise LaunchpadScript
> > + if self.options.
> > self.options.
> > + raise LaunchpadScript
> > + "Specify a distribution, or --all-derived.")
> > + if self.options.
> > self.options.
> > + raise LaunchpadScript
> > + "Can't combine the --distribution and --all-derived
> > options.")
> >
> > - self.distribution = getUtility(
> > - self.options.
> > - if self.distribution is None:
> > - raise LaunchpadScript
> > - "Distribution %s not found." %
> > self.options.
> > + if self.options.
> > + distro_set = getUtility(
> > + self.distributions = distro_set.getDe...