Merge lp://staging/~lifeless/bzr-builder/blocking into lp://staging/~james-w/bzr-builder/trunk-old

Proposed by Robert Collins
Status: Merged
Merge reported by: James Westby
Merged at revision: not available
Proposed branch: lp://staging/~lifeless/bzr-builder/blocking
Merge into: lp://staging/~james-w/bzr-builder/trunk-old
Diff against target: 1297 lines (+603/-227)
9 files modified
TODO (+0/-3)
__init__.py (+182/-98)
ppa.py (+124/-0)
recipe.py (+139/-79)
setup.py (+13/-12)
tests/__init__.py (+4/-3)
tests/test_blackbox.py (+47/-9)
tests/test_ppa.py (+31/-0)
tests/test_recipe.py (+63/-23)
To merge this branch: bzr merge lp://staging/~lifeless/bzr-builder/blocking
Reviewer Review Type Date Requested Status
James Westby Needs Resubmitting
Review via email: mp+13826@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

This adds the ability to block on a build till its done - useful for integration with test builders.

Revision history for this message
James Westby (james-w) wrote :
Download full text (8.4 KiB)

12 === modified file '__init__.py'
13 --- __init__.py 2009-09-25 19:50:30 +0000
14 +++ __init__.py 2009-10-23 07:30:27 +0000
15 @@ -249,17 +249,25 @@
16 Option("key-id", type=str, short_name="k",
17 help="Sign the packages with the specified GnuPG key, "
18 "must be specified if you use --dput."),
19 + Option("watch-ppa", help="Watch the PPA the package was "
20 + "dput to and exit with 0 only if it builds and "
21 + "publishes successfully."),

--dput is planned to become a list option, at the request of Neil
who wants to put the package in multiple PPAs. How would this work
if there were multiple PPAs to watch?

Any chance we could make that change first? (bug 433454)

Is the default for an Option action=store_true?

37 + elif dput:
38 + target_from_dput(dput)

Is that just a check that the dput target is valid?

For the reasons given below I'm not sure I like the
restriction on every use, as this will break some people's use.
I assume it is there as a "fail fast" check?

46 + if watch_ppa:
47 + from bzrlib.plugins.builder.ppa import watch
48 + target = target_from_dput(dput)
49 + return watch(target, self.package, base_branch.deb_version)

Has self.package always been set to something reliable here?

Nice API, but it probably needs to take a list of PPAs given the above?

Also, it would be nice to parallelise the watches if you are uploading
a bunch (cron usecase, rather than hook). We don't have code to use this
but would it work to extend the API in that direction so that I could
add that feature easily once we do (planned soon)?

52 def _add_changelog_entry(self, base_branch, basedir, distribution=None,
53 @@ -330,6 +342,7 @@
54 "specified.")
55 if distribution is None:
56 distribution = "jaunty"
57 + self.package = package

Ah, so I assume this is the self.package thing I asked about above
answered?

65 +def target_from_dput(dput):
66 + """Convert a dput specification to a LP API specification.
67 +
68 + :param dput: A dput command spec like ppa:team-name.
69 + :return: A LP API target like team-name/ppa.
70 + """
71 + if not dput.startswith('ppa:'):
72 + raise errors.BzrCommandError('not a ppa %s' % dput)

I don't like that error.

I don't mind only supporting ppa: targets, but there will be some people
that have defined a specific target like my-ppa (or even 'ppa'). Having
the error be clear about that, and perhaps even explaining how to use
ppa: would be great.

73 + base, _, suffix = dput[4:].partition('/')

I'd prefer "len('ppa:')" than '4'.

74 + if not suffix:
75 + suffix = 'ppa'
76 + return base + '/' + suffix

I'm not entirely sure about the scheme used for ppas, but I'll
assume this is correct as you have presumably used it :-)

83 === added file 'ppa.py'
84 --- ppa.py 1970-01-01 00:00:00 +0000
85 +++ ppa.py 2009-10-23 07:30:27 +0000
103 +from optparse import OptionParser
104 +import os
105 +import sys
106 +import time
107 +
108 +from launch...

Read more...

review: Needs Resubmitting
54. By James Westby

EMAIL is the correct env var for the email address, not MAIL

Revision history for this message
Robert Collins (lifeless) wrote :
Download full text (11.0 KiB)

On Fri, 2009-10-23 at 10:48 +0000, James Westby wrote:
> Review: Resubmit
>
> 12 === modified file '__init__.py'
> 13 --- __init__.py 2009-09-25 19:50:30 +0000
> 14 +++ __init__.py 2009-10-23 07:30:27 +0000
> 15 @@ -249,17 +249,25 @@
> 16 Option("key-id", type=str, short_name="k",
> 17 help="Sign the packages with the specified GnuPG key, "
> 18 "must be specified if you use --dput."),
> 19 + Option("watch-ppa", help="Watch the PPA the package was "
> 20 + "dput to and exit with 0 only if it builds and "
> 21 + "publishes successfully."),
>
> --dput is planned to become a list option, at the request of Neil
> who wants to put the package in multiple PPAs. How would this work
> if there were multiple PPAs to watch?
>
> Any chance we could make that change first? (bug 433454)

Well, this is written, and that isn't. By written I mean "I'm using
it" :).

I'd either watch all the PPA's, serially, or make the options
incompatible.

> Is the default for an Option action=store_true?

Yes.

> 37 + elif dput:
> 38 + target_from_dput(dput)
>
> Is that just a check that the dput target is valid?

valid-to-watch, yes - so that we don't upload something we can't watch.
It can be bypassed of course, IFF we are not going to try to watch.

> 46 + if watch_ppa:
> 47 + from bzrlib.plugins.builder.ppa import watch
> 48 + target = target_from_dput(dput)
> 49 + return watch(target, self.package, base_branch.deb_version)
>
> Has self.package always been set to something reliable here?

Yes, as long as we've made a changelog entry.

> Nice API, but it probably needs to take a list of PPAs given the above?

I don't think so - a loop at this level is fine.

> Also, it would be nice to parallelise the watches if you are uploading
> a bunch (cron usecase, rather than hook). We don't have code to use this
> but would it work to extend the API in that direction so that I could
> add that feature easily once we do (planned soon)?

Personally, I'd loop, unless you really need 'fail as soon as any FTB.
If you need that then yes, you need to push the triple down into the
watch routine and split that up more.

> 65 +def target_from_dput(dput):
> 66 + """Convert a dput specification to a LP API specification.
> 67 +
> 68 + :param dput: A dput command spec like ppa:team-name.
> 69 + :return: A LP API target like team-name/ppa.
> 70 + """
> 71 + if not dput.startswith('ppa:'):
> 72 + raise errors.BzrCommandError('not a ppa %s' % dput)
>
> I don't like that error.
>
> I don't mind only supporting ppa: targets, but there will be some people
> that have defined a specific target like my-ppa (or even 'ppa'). Having
> the error be clear about that, and perhaps even explaining how to use
> ppa: would be great.

Feel free to make the text longer when you merge :) [round trips cost,
so we should only round trip on merge changes when the submitter has to
make changes anyhow].

> 73 + base, _, suffix = dput[4:].partition('/')
>
> I'd prefer "len('ppa:')" than '4'.

I'd put a co...

Revision history for this message
Robert Collins (lifeless) wrote :

On Fri, 2009-10-23 at 20:09 +0000, Robert Collins wrote:

> The only things I saw that I would consider a must are changing the
> early check on dput parsing, the better error message for 'not a ppa',
> and adding a timeout on not finding source records - everything else
> will communicate what is going on to the user adequately and either
> won't be made appreciably better, or could be made worse by changing.
> (For instance, changing the bare except will cause any number of unknown
> exceptions to float past - and if I had a test harness where I could
> diagnose those, I would be delighted to change it, but I don't, so other
> than making it 'except Exception:' [happy to do that]) I'd rather not
> touch it.

Done these things.

-Rob

Revision history for this message
James Westby (james-w) wrote :

On Fri Oct 23 20:09:09 UTC 2009 Robert Collins wrote:
> I'd appreciate it if you can go over this mail and categorise 'must' vs
> 'should' - most of the support code for LP API's is cargo culted and
> repeated in other lp tools - really it should be factored into
> launchpadlib itself, so I don't think polishing it here is a good use of
> anyones time.

I consider most of them to be a 'must', as you are asking me to maintain
the code. I wouldn't block on supporting code that wasn't written yet though.

If you don't want to make the changes then please say so and I will happily
do the work myself when I have some time.

Thanks,

James

Revision history for this message
Robert Collins (lifeless) wrote :

I've got this in production now, and had to make further changes so its using trace.note now.

55. By James Westby

Merge some doc changes to improve formatting. Thanks Ian.

56. By James Westby

Typo fix from Michael, thanks.

57. By James Westby

Newer bzr requires declaration that some paths will be accessed.

If we are using the newer bzr then declare that the root will be
accessed in the blackbox tests. This allows them to run, but bypasses
the improved isolation.

58. By James Westby

Add {debupstream} variable that expands to the upstream version from d/c.

debian/changelog is read once the tree is built and the upstream part of
the latest version number is placed in to this variable. Thanks Rob.

59. By James Westby

Refactor to use objects and polymorphism rather than tuples and if blocks.

Thanks Andrew.

60. By James Westby

Some minor code cleanups. Thanks Ian.

61. By James Westby

pyflakes cleanup. Thanks Michael.

62. By James Westby

Move calculate_package_dir to be a function rather than a private method.

63. By James Westby

Allow add_changelog_entry to take user data to override environment.

64. By James Westby

Add a --no-build option that doesn't actually build the source package.

This is for the benefit of Launchpad, but may be useful for other scripts too.

65. By James Westby

If --no-build is passed still write any --manifest

66. By James Westby

Prepare 0.2.

67. By James Westby

Make build_manifest into __str__ and make it work for recipes too.

68. By James Westby

Allow child branches to be stringifyed without being built.

69. By James Westby

Guard setup in setup.py so that it can be imported.

70. By James Westby

Merge --watch-ppa support. Thanks Rob.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches