From ba986123a98cf738f14c8847098e42bafa4e2b50 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Mon, 4 Aug 2008 18:43:17 +0100 Subject: [PATCH 01/66] Put wrong program name in changelog. --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ee5548c..35fe2c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,13 +9,13 @@ ubuntu-dev-tools (0.35) intrepid; urgency=low [ Iain Lane ] * Add pull-lp-source: Get source packages from LP to avoid mirror lag. - * pull-lp-source.new: + * pbuilder-dist.new: - Set mirror and componente for debian distros - Use local apt cache if available * massfile: - Modify to work with Firefox 3 cookies - -- Iain Lane Mon, 04 Aug 2008 18:29:46 +0100 + -- Iain Lane Mon, 04 Aug 2008 18:43:10 +0100 ubuntu-dev-tools (0.34) intrepid; urgency=low From f612d1cadc150627d2baf1400feaca8e65579160 Mon Sep 17 00:00:00 2001 From: Jordan Mantha Date: Thu, 7 Aug 2008 20:49:15 -0700 Subject: [PATCH 02/66] remove release specific example in requestsync man page --- doc/requestsync.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/requestsync.1 b/doc/requestsync.1 index 30ffd9e..5e9f45e 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -50,7 +50,7 @@ This is the source package that you would like to be synced from Debian. .B This is the release that you would like the source package to be synced into. -This should always be the latest development release of Ubuntu, i.e.: hardy. +This should always be the latest development release of Ubuntu. .TP .B [base version] In some cases, the base version (where the Ubuntu package started differing From 82a29e4a88f55bbd606f03772a18fa08958d58d5 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sat, 9 Aug 2008 14:12:06 +0200 Subject: [PATCH 03/66] Get ready for version 0.35. --- debian/changelog | 8 +++++++- debian/control | 2 +- debian/rules | 3 --- setup.py | 31 ++++++++++++++++--------------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/debian/changelog b/debian/changelog index f1bce31..fe0b044 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,12 @@ ubuntu-dev-tools (0.35) intrepid; urgency=low else (LP: #254632). * massfile, examples/massfile.instructions: - Make it possible to give the created bugs a determined status. + * debian/control: + - Bump Standards Version to 3.8.0. + * debian/rules: + - It's not necessary anymore to remove usr/lib. + * setup.py: + - Order the scripts list alphabetically and add pull-lp-source. [ Iain Lane ] * Add pull-lp-source, which get source packages from LP to avoid mirror lag. @@ -18,7 +24,7 @@ ubuntu-dev-tools (0.35) intrepid; urgency=low - Modify it to work with Firefox 3 cookies, taking code from requestsync. - Set the status to Confirmed, by default. - -- Iain Lane Mon, 04 Aug 2008 18:29:46 +0100 + -- Siegfried-Angel Gevatter Pujals Sat, 09 Aug 2008 13:58:23 +0200 ubuntu-dev-tools (0.34) intrepid; urgency=low diff --git a/debian/control b/debian/control index e770beb..4e351fb 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Build-Depends: cdbs (>= 0.4.49), debhelper (>= 5), python-all-dev (>= 2.4) Build-Depends-Indep: python-central (>= 0.5) XS-Python-Version: all Homepage: https://launchpad.net/ubuntu-dev-tools/ -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Package: ubuntu-dev-tools Architecture: all diff --git a/debian/rules b/debian/rules index 6a071b0..c10c010 100755 --- a/debian/rules +++ b/debian/rules @@ -6,6 +6,3 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1 - -binary-install/ubuntu-dev-tools:: - rm -rf debian/ubuntu-dev-tools/usr/lib diff --git a/setup.py b/setup.py index 7b18fdb..2783b87 100755 --- a/setup.py +++ b/setup.py @@ -15,25 +15,26 @@ if os.path.exists(changelog): setup(name='ubuntu-dev-tools', version=version, - scripts=['404main', - 'check-symbols', - 'get-branches', - 'pbuilder-dist', - 'pbuilder-dist-simple', - 'update-maintainer', + scripts=['404main', + 'check-symbols', 'dch-repeat', - 'mk-sbuild-lv', - 'pull-debian-debdiff', - 'what-patch', - 'suspicious-source', - 'requestsync', + 'dgetlp', + 'get-branches', + 'get-build-deps', + 'grab-attachments', 'hugdaylist', 'massfile', - 'submittodebian', - 'get-build-deps', - 'dgetlp', + 'mk-sbuild-lv', + 'pbuilder-dist', + 'pbuilder-dist-simple', + 'pull-debian-debdiff', + 'pull-lp-source', + 'requestsync', 'reverse-build-depends', - 'grab-attachments', + 'submittodebian', + 'suspicious-source', + 'update-maintainer', + 'what-patch', ], packages=['ubuntutools'], ) From 20881174cd12deffa80ff4a2f29e2b6331951571 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 11:06:13 +0100 Subject: [PATCH 04/66] * doc/what-patch.1: Created. * TODO: Updated. * debian/changelog: Added new entry. --- TODO | 5 +++-- debian/changelog | 7 ++++++- doc/what-patch.1 | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 doc/what-patch.1 diff --git a/TODO b/TODO index 2d40c5b..7377ce1 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ - Create missing manpages (for all commands). -- Document ubuntutools Python modules. -- Add the process-interdiff script to ubuntu-dev-tools. - Modify 404main to use the more robust python-apt module. +- Use the short version of the GPL license in all scripts. +- Ask all authors who have used GPL if they are happy with using "or any later" + versions of the license. diff --git a/debian/changelog b/debian/changelog index fe0b044..0506712 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,10 @@ -ubuntu-dev-tools (0.35) intrepid; urgency=low +ubuntu-dev-tools (0.36) intrepid; urgency=low + [ Jonathan Patrick Davies ] + * doc/what-patch.1: Written and added. + + -- Jonathan Patrick Davies Sun 10 Aug 2008 11:02:55 +0100 +ubuntu-dev-tools (0.35) intrepid; urgency=low [ Siegfried-Angel Gevatter Pujals ] * doc/update-maintainer.1: - Remove the reference to the --no-changelog option from the manpage. diff --git a/doc/what-patch.1 b/doc/what-patch.1 new file mode 100644 index 0000000..f15f02d --- /dev/null +++ b/doc/what-patch.1 @@ -0,0 +1,42 @@ +.TH WHAT-PATCH "1" "10 August 2008" "ubuntu-dev-tools" +.SH NAME +what-patch \- detects which patch system a Debian package uses. + +.SH SYNOPSIS + +.B what-patch [\-h] [\-v] + +.SH DESCRIPTION +.PP +\fBwhat-patch\fR examines the debian/rules file to determine which patch +system the Debian package is using. + +.PP +\fBwhat-patch\fR should be run from the root directory of the Debian source +package. + +.SH OPTIONS +.PP +Listed below are the command line options for what-patch: +.TP +.B \-h or \-\-help +Display a help message and exit. +.TP +.B \-v +Enable verbose mode. This shall include the listing of any files modified +outside for the debian/ directory and report any addition details about the +patch system if available. + +.SH AUTHOR +.PP +\fBwhat-patch\fR was written by Kees Cook , Siegfried-A. +Gevatter , and Daniel Hahler , among +others. This manual page was written by Jonathan Patrick Davies . + +.SH SEE ALSO +.PP +The Ubuntu MOTU team has some documentation about patch systems at the Ubuntu +wiki: \fBhttps://wiki.ubuntu.com/PackagingGuide/PatchSystems\fR + +.PP +.BR cdbs-edit-patch (1), dbs-edit-patch (1), patch-edit-patch (1) From 860a2181aececd085ccd6f3c7aece460b4ab0b1a Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 11:35:55 +0100 Subject: [PATCH 05/66] * debian/changelog: Restored accidentally removed spaces. * doc/dch-repeat.1: Created. --- debian/changelog | 6 ++++- doc/dch-repeat.1 | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 doc/dch-repeat.1 diff --git a/debian/changelog b/debian/changelog index 0506712..154bdb3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,14 @@ ubuntu-dev-tools (0.36) intrepid; urgency=low [ Jonathan Patrick Davies ] - * doc/what-patch.1: Written and added. + * doc/ Created new manpages for: + - what-patch.1. + - dch-repeat.1. -- Jonathan Patrick Davies Sun 10 Aug 2008 11:02:55 +0100 + ubuntu-dev-tools (0.35) intrepid; urgency=low + [ Siegfried-Angel Gevatter Pujals ] * doc/update-maintainer.1: - Remove the reference to the --no-changelog option from the manpage. diff --git a/doc/dch-repeat.1 b/doc/dch-repeat.1 new file mode 100644 index 0000000..5419fcf --- /dev/null +++ b/doc/dch-repeat.1 @@ -0,0 +1,58 @@ +.TH DCH-REPEAT "1" "10 August 2008" "ubuntu-dev-tools" +.SH NAME +dch-repeat \- repeats a change log entry into an older release. + +.SH SYNOPSIS + +.B dch-repeat \-\-build-tree <\fIPATH\fR> + +.B dch-repeat \-\-source-release <\fIRELEASE\fR> + +.B dch-repeat \-\-target-release <\fIRELEASE\fR> + +.B dch-repeat \-\-devel-release <\fIRELEASE\fR> + +.B dch-repeat \-\-pocket <\fIPOCKET\fR> + +.B dch-repeat \-h + +.SH DESCRIPTION +.PP +\fBdch-repeat\fR is used to repeat a change log into an older release. It +expects that --build-tree is laid out with each Ubuntu release as a separate +directory ("feisty", "edgy", etc). + +.PP +For example, if gimp had a security update prepared for Feisty in +$TREE/feisty/gimp-2.2.13, running \fBdch-repeat\fR in $TREE/edgy/gimp-2.2.13 +would pull in the latest changelog from the Feisty build. + +.SH OPTIONS +.PP +Listed below are the command line options for \fBdch-repeat\fR: +.TP +.B \-h or \-\-help +Display a help message and exit. +.TP +.B \-\-build-tree PATH +Base of build trees. Default is /scratch/ubuntu/build. +.TP +.B \-s or \-\-source-release RELEASE +Which release to take changelog from. +.TP +.B \-\-target-release RELEASE +Which release to build into. +.TP +.B \-\-devel-release RELEASE +Which release is the development release. +.TP +.B \-\-pocket POCKET +Which pocket to use. + +.SH AUTHOR +.PP +\fBdch-repeat\fR was written by Kees Cook . This manual page was written by Jonathan Patrick Davies . + +.SH SEE ALSO +.PP +.BR dch(1). From 83040c34c404e85254a93466c91620fb1a544be0 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 12:09:41 +0100 Subject: [PATCH 06/66] * doc/requestsync.1: Describe environment variables used by requestsync. (LP: #237595) --- debian/changelog | 2 ++ doc/requestsync.1 | 32 ++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 154bdb3..fef0a28 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ ubuntu-dev-tools (0.36) intrepid; urgency=low * doc/ Created new manpages for: - what-patch.1. - dch-repeat.1. + * doc/requestsync.1: Described variables used by requestsync in man + page. (LP: #237595) -- Jonathan Patrick Davies Sun 10 Aug 2008 11:02:55 +0100 diff --git a/doc/requestsync.1 b/doc/requestsync.1 index 5e9f45e..b0702d4 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -36,8 +36,8 @@ multiverse, or ubuntu-core-dev for main or restricted. .TP .B \-k \fI\fR Specifies your GPG key. -Can also be set with the line `\fIexport GPGKEY=\fR' in -.IR $HOME/.bashrc . +Can also be set with the line `\fIexport GPGKEY=\fR' in your shell's +configuration (For example: \fI$HOME/.bashrc\fR). This is only used if the sync request is mailed to Launchpad. .TP .B \-\-lp @@ -56,12 +56,36 @@ This should always be the latest development release of Ubuntu. In some cases, the base version (where the Ubuntu package started differing from the Debian package) cannot be automatically determined. Specify this option in this case. + +.SH ENVIRONMENT VARIABLES +.PP +\fBrequestsync\fR uses the following variables which should be set in your +shell's configuration by adding \fIexport VARIABLE=\fR lines, where VARIABLE is +one of the following: + +.TP +.B GPGKEY +Specifies your GnuPG key ID. +.TP +.B DEBEMAIL +Specifies which email should be used when sending to Launchpad. +.TP +.B DEBSMTP +Set which SMTP server to use when sending mail. If unspecified this defaults to +fioldland.ubuntu.com. +.TP +.B DEBSMTP_PORT +Sets which port of the SMTP server to use. Default is 25. +.TP +.B DEBSMTP_USER and DEBSMTP_PASS +Sets the username and password to use when authenticating to the SMTP server. + .SH AUTHOR .PP This manual page was pieced together by Steve Kowalik. -It was then updated by Ryan Kavanagh and Michael Bienia to reflect -additional features. +It was then updated by Ryan Kavanagh, Michael Bienia, and Jonathan Patrick +Davies to reflect additional features. .SH SEE ALSO .PP .BR rmadison (1) From 833061324a9168c33a3f769306aab8c996d45bad Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 10 Aug 2008 13:43:51 +0200 Subject: [PATCH 07/66] Fix versioning scheme to end with ubuntu1, so that Lintian doesn't complain anymore about NMU, distribution name and everything. General manpages cleanup. Fix the debian/changelog file (dch couldn't parse it). --- debian/changelog | 22 ++++++++++++++-------- debian/source.lintian-overrides | 3 --- doc/dch-repeat.1 | 11 +++++++---- doc/get-build-deps.1 | 4 ++-- doc/pbuilder-dist.1 | 24 ++++++++---------------- doc/requestsync.1 | 13 +++++++------ doc/reverse-build-depends.1 | 10 +++------- doc/submittodebian.1 | 2 ++ doc/what-patch.1 | 12 +++++++----- 9 files changed, 50 insertions(+), 51 deletions(-) delete mode 100644 debian/source.lintian-overrides diff --git a/debian/changelog b/debian/changelog index fef0a28..e24c893 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,13 +1,19 @@ -ubuntu-dev-tools (0.36) intrepid; urgency=low +ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low - [ Jonathan Patrick Davies ] - * doc/ Created new manpages for: - - what-patch.1. - - dch-repeat.1. - * doc/requestsync.1: Described variables used by requestsync in man - page. (LP: #237595) + [ Jonathan Patrick Davies ] + * doc/ Created new manpages for: + - what-patch.1. + - dch-repeat.1. + * doc/requestsync.1: Described variables used by requestsync in man + page. (LP: #237595) - -- Jonathan Patrick Davies Sun 10 Aug 2008 11:02:55 +0100 + [ Siegfried-Angel Gevatter Pujals ] + * Change the versioning scheme from 0.XX to 0.XXubuntu1. Delete + debian/source.lintian-overrides, as with this it isn't necessary anymore. + * General manpage cleanup (fix typos, use the same section names in all + manpages, etc). + + -- Siegfried-Angel Gevatter Pujals Sun, 10 Aug 2008 13:40:05 +0200 ubuntu-dev-tools (0.35) intrepid; urgency=low diff --git a/debian/source.lintian-overrides b/debian/source.lintian-overrides deleted file mode 100644 index 17ccc05..0000000 --- a/debian/source.lintian-overrides +++ /dev/null @@ -1,3 +0,0 @@ -# Override useless NMU warnings; this is a native Ubuntu package. -ubuntu-dev-tools source: changelog-should-mention-nmu -ubuntu-dev-tools source: source-nmu-has-incorrect-version-number diff --git a/doc/dch-repeat.1 b/doc/dch-repeat.1 index 5419fcf..8506b8b 100644 --- a/doc/dch-repeat.1 +++ b/doc/dch-repeat.1 @@ -1,6 +1,6 @@ .TH DCH-REPEAT "1" "10 August 2008" "ubuntu-dev-tools" .SH NAME -dch-repeat \- repeats a change log entry into an older release. +dch-repeat \- repeats a changelog entry into an older release .SH SYNOPSIS @@ -18,8 +18,8 @@ dch-repeat \- repeats a change log entry into an older release. .SH DESCRIPTION .PP -\fBdch-repeat\fR is used to repeat a change log into an older release. It -expects that --build-tree is laid out with each Ubuntu release as a separate +\fBdch-repeat\fR is used to repeat a changelog into an older release. It +expects that \-\-build-tree is laid out with each Ubuntu release as a separate directory ("feisty", "edgy", etc). .PP @@ -51,7 +51,10 @@ Which pocket to use. .SH AUTHOR .PP -\fBdch-repeat\fR was written by Kees Cook . This manual page was written by Jonathan Patrick Davies . +\fBdch-repeat\fR was written by Kees Cook . This manual page +was written by Jonathan Patrick Davies . +.PP +Both are released under the GNU General Public License, version 2. .SH SEE ALSO .PP diff --git a/doc/get-build-deps.1 b/doc/get-build-deps.1 index 2077f8b..a15b49d 100644 --- a/doc/get-build-deps.1 +++ b/doc/get-build-deps.1 @@ -55,5 +55,5 @@ the newest one available in the repositories. .SH AUTHORS \fBget\-build\-deps\fP and this manual page have been written by Siegfried-Angel -Gevatter Pujals . They are released under the GNU General Public -License, version 3 or later. +Gevatter Pujals . They are released under the GNU General +Public License, version 3 or later. diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 index 1cbd1a6..3650246 100644 --- a/doc/pbuilder-dist.1 +++ b/doc/pbuilder-dist.1 @@ -91,22 +91,14 @@ rainct@ubuntu.com. Please ensure first that the problem is really this script and not an issue with \fBpbuilder\fP. -.SH AUTHORS -\fBpbuilder\-dist\fP was originally written by Jamin W. Collins and -Jordan Mantha . -.PP -On August 2007 it was mostly rewritten, and extended, by Siegfried-Angel Gevatter Pujals -. - .SH SEE ALSO \fBpbuilder\fR, \fBpbuilderrc\fR -.SH COPYRIGHT -This manual page was written by Siegfried-Angel Gevatter Pujals (RainCT) - for YOU. -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU General Public License, -Version 2 or any later version published by the Free Software Foundation. -.PP -On Debian based systems, the complete text of the GNU General Public -License can be found in \fB/usr/share/common\-licenses/GPL\fP. +.SH AUTHORS +\fBpbuilder\-dist\fP was originally written by Jamin W. Collins + and Jordan Mantha . On August +2007 it was mostly rewritten, and extended, by Siegfried-Angel Gevatter Pujals +. +.BB +\fBpbuilder\-dist\fP is released under the GNU General Public License, version +2 or later. diff --git a/doc/requestsync.1 b/doc/requestsync.1 index b0702d4..2734455 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -80,12 +80,13 @@ Sets which port of the SMTP server to use. Default is 25. .B DEBSMTP_USER and DEBSMTP_PASS Sets the username and password to use when authenticating to the SMTP server. -.SH AUTHOR -.PP -This manual page was pieced together by Steve Kowalik. - -It was then updated by Ryan Kavanagh, Michael Bienia, and Jonathan Patrick -Davies to reflect additional features. .SH SEE ALSO .PP .BR rmadison (1) + +.SH AUTHOR +.PP +.B requestsync +and this manual page were written by the Ubuntu MOTU Team. +.PP +Both are released under the GNU General Public License, version 2. diff --git a/doc/reverse-build-depends.1 b/doc/reverse-build-depends.1 index cd097ed..4c7401b 100644 --- a/doc/reverse-build-depends.1 +++ b/doc/reverse-build-depends.1 @@ -1,7 +1,3 @@ -.\" Title: reverse-build-depends -.\" Author: Siegfried-Angel Gevatter Pujals -.\" Contact details: rainct@ubuntu.com - .TH REVERSE\-BUILD\-DEPENDS 1 "January 17, 2008" "ubuntu-dev-tools" .SH NAME @@ -26,13 +22,13 @@ If you prefer to see all build dependencies in a single line, use this option. Otherwise, each one will be printed on its own line. .SH KNOWN BUGS AND LIMITATIONS -Note that to use \fBreverse\-build\-depends\fP it is required for the source repositories -(deb-src lines) to be enabled in your sources.list. +Note that to use \fBreverse\-build\-depends\fP it is required for the source +repositories (deb-src lines) to be enabled in your sources.list. .SH SEE ALSO \fBgrep\-dctrl\fR, \fBapt\-cache\fR -.SH COPYRIGHT +.SH AUTHORS \fBreverse\-build\-depends\fP and this manual page were written by Siegfried-Angel Gevatter Pujals for YOU. Both are released under the terms of the GNU General Public License (version 2 diff --git a/doc/submittodebian.1 b/doc/submittodebian.1 index f697870..dd4fd9a 100644 --- a/doc/submittodebian.1 +++ b/doc/submittodebian.1 @@ -26,3 +26,5 @@ By examining debian/changelog it will extract the information it needs to: .br .SH AUTHOR submittodebian and this man page were written by Soren Hansen . +.PP +Both are released under the GNU General Public License, version 2 or later. diff --git a/doc/what-patch.1 b/doc/what-patch.1 index f15f02d..b160fed 100644 --- a/doc/what-patch.1 +++ b/doc/what-patch.1 @@ -1,10 +1,10 @@ .TH WHAT-PATCH "1" "10 August 2008" "ubuntu-dev-tools" .SH NAME -what-patch \- detects which patch system a Debian package uses. +what-patch \- detects which patch system a Debian package uses .SH SYNOPSIS -.B what-patch [\-h] [\-v] +.B what-patch [options] .SH DESCRIPTION .PP @@ -24,14 +24,16 @@ Display a help message and exit. .TP .B \-v Enable verbose mode. This shall include the listing of any files modified -outside for the debian/ directory and report any addition details about the +outside or the debian/ directory and report any additional details about the patch system if available. -.SH AUTHOR +.SH AUTHORS .PP \fBwhat-patch\fR was written by Kees Cook , Siegfried-A. Gevatter , and Daniel Hahler , among others. This manual page was written by Jonathan Patrick Davies . +.PP +Both are released under the GNU General Public License, version 2. .SH SEE ALSO .PP @@ -39,4 +41,4 @@ The Ubuntu MOTU team has some documentation about patch systems at the Ubuntu wiki: \fBhttps://wiki.ubuntu.com/PackagingGuide/PatchSystems\fR .PP -.BR cdbs-edit-patch (1), dbs-edit-patch (1), patch-edit-patch (1) +.B cdbs-edit-patch(1), dbs-edit-patch(1), dpatch-edit-patch(1) From f45d1724c7163d5fe524a5c7f4442f9480ccf01c Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 14:51:27 +0100 Subject: [PATCH 08/66] * doc/grab-attachments.1: Created. * TODO: Added note about fixing all Launchpad bug reports. --- TODO | 2 ++ debian/changelog | 1 + doc/grab-attachments.1 | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 doc/grab-attachments.1 diff --git a/TODO b/TODO index 7377ce1..414c944 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ +- Fix all bugs at Launchpad: + https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools - Create missing manpages (for all commands). - Modify 404main to use the more robust python-apt module. - Use the short version of the GPL license in all scripts. diff --git a/debian/changelog b/debian/changelog index e24c893..f58c649 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low * doc/ Created new manpages for: - what-patch.1. - dch-repeat.1. + - grab-attachment.1. * doc/requestsync.1: Described variables used by requestsync in man page. (LP: #237595) diff --git a/doc/grab-attachments.1 b/doc/grab-attachments.1 new file mode 100644 index 0000000..2fff303 --- /dev/null +++ b/doc/grab-attachments.1 @@ -0,0 +1,29 @@ +.TH GRAB-ATTACHMENTS "1" "10 August 2008" "ubuntu-dev-tools" +.SH NAME +grab-attachments \- downloads attachments from a Launchpad bug +.SH SYNOPSIS +.B grab-attachments\fR <\fIbug-number\fR> + +.B grab-attachments \-h +.SH DESCRIPTION +.PP +\fBgrab-attachments\fR is a script to download all attachments from a +Launchpad bug report into the current directory. + +.SH OPTIONS +.PP +Listed below are the command line options for grab-attachments: +.TP +.B \-h +Display a help message and exit. +.TP +.B +Specifies the Launchpad bug number that the script should download +attachments from. + +.SH AUTHOR +.PP +\fBgrab-attachments\fR was written by Daniel Holbach and this manual page was +written by Jonathan Patrick Davies. +.PP +Both are released under the GNU General Public License, version 2. From e3afe4de77f812a0a617b7907c82ba29d3a3e5a6 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 15:49:02 +0100 Subject: [PATCH 09/66] * hugdaylist: Added code to handle exceptions. --- debian/changelog | 1 + hugdaylist | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index f58c649..4d1adee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low - grab-attachment.1. * doc/requestsync.1: Described variables used by requestsync in man page. (LP: #237595) + * hugdaylist: Added code to handle exceptions. [ Siegfried-Angel Gevatter Pujals ] * Change the versioning scheme from 0.XX to 0.XXubuntu1. Delete diff --git a/hugdaylist b/hugdaylist index 555e112..85c2a86 100755 --- a/hugdaylist +++ b/hugdaylist @@ -21,9 +21,9 @@ try: import launchpadbugs.connector as Connector BugList = Connector.ConnectBugList() Bug = Connector.ConnectBug(method="Text") -except: +except ImportError: print >> sys.stderr, \ - "You need python-launchpad-bugs (>= 0.2.25) installed to use hugdaylist." + "You need python-launchpad-bugs (>= 0.2.25) installed to use hugdaylist." sys.exit(1) @@ -38,7 +38,10 @@ def check_args(): sys.exit(1) if sys.argv[1] == "-n": - howmany = int(sys.argv[2]) + try: + howmany = int(sys.argv[2]) + except IndexError: + print "Option '-n' requires a number." if len(sys.argv) < 4: print USAGE sys.exit(1) @@ -82,5 +85,8 @@ def main(): if __name__ == '__main__': - main() - + try: + main() + except KeyboardInterrupt: + print >> sys.stderr, "Aborted" + sys.exit(1) From 1c7abae8467aa5fbff5f0eacf9e7c8ba795729ad Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 17:20:13 +0100 Subject: [PATCH 10/66] * AUTHORS: Updated list. * debian/copyright: Synchronized with above. * hugdaylist: - Added short version of GPL to header. - Rewrote option handling with optparse. - Filter bugs subscribed to the ubuntu-archive team. --- AUTHORS | 4 ++- debian/changelog | 6 +++- debian/copyright | 6 ++-- hugdaylist | 79 +++++++++++++++++++++++++++++++++--------------- 4 files changed, 67 insertions(+), 28 deletions(-) diff --git a/AUTHORS b/AUTHORS index efee5f0..167c7dd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,13 +2,15 @@ Albert Damen Albin Tonnerre Daniel Hahler Daniel Holbach +Iain Lane Jamin W. Collins +Jonathan Patrick Davies Jordan Mantha +Kees Cook Luke Yelavich Martin Pitt Michael Bienia Pete Savage -Kees Cook Siegfried-A. Gevatter Soren Hansen Steve Kowalik diff --git a/debian/changelog b/debian/changelog index 4d1adee..e79f6c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,11 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low - grab-attachment.1. * doc/requestsync.1: Described variables used by requestsync in man page. (LP: #237595) - * hugdaylist: Added code to handle exceptions. + * hugdaylist: + - Added code to handle exceptions and short version of GPL. + - Rewrote option handling with optparse. + - Filter bugs subscribed to the ubuntu-archive team. + * debian/copyright: Updated Authors and copyrights. [ Siegfried-Angel Gevatter Pujals ] * Change the versioning scheme from 0.XX to 0.XXubuntu1. Delete diff --git a/debian/copyright b/debian/copyright index 46a43c3..8e64534 100644 --- a/debian/copyright +++ b/debian/copyright @@ -7,18 +7,19 @@ Upstream Authors: Albin Tonnerre Daniel Hahler Daniel Holbach + Iain Lane Jamin W. Collins + Jonathan Patrick Davies Jordan Mantha + Kees Cook Luke Yelavich Martin Pitt Michael Bienia Pete Savage - Kees Cook Siegfried-A. Gevatter Soren Hansen Steve Kowalik Terence Simpson - Iain Lane Copyright: @@ -34,6 +35,7 @@ Copyright: (C) 2007-2008, Siegfried-A. Gevatter (C) 2007, Terence Simpson (C) 2008, Iain Lane + (C) 2008, Jonathan Patrick Davies Licenses: diff --git a/hugdaylist b/hugdaylist index 85c2a86..22b6ac0 100755 --- a/hugdaylist +++ b/hugdaylist @@ -2,20 +2,37 @@ # -*- coding: utf-8 -*- # # Copyright 2007, Canonical, Daniel Holbach +# Copyright (C) 2008 Jonathan Patrick Davies # -# GPL 3 +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# +# hugdaylist - produces MoinMoin wiki formatted tables based on a Launchpad bug +# list. # # hugdaylist # - produces lists like https://wiki.ubuntu.com/UbuntuBugDay/20070912?action=raw # # hugdaylist -n -# - will only list URLs +# - will only list URLs. # -import re import os -import sys +import re import string +import sys +from optparse import OptionParser try: import launchpadbugs.connector as Connector @@ -23,41 +40,55 @@ try: Bug = Connector.ConnectBug(method="Text") except ImportError: print >> sys.stderr, \ - "You need python-launchpad-bugs (>= 0.2.25) installed to use hugdaylist." + "python-launchpad-bugs (>= 0.2.25) needs to be installed to use hugdaylist." sys.exit(1) - -USAGE = "hugdaylist [-n ] " - def check_args(): howmany = -1 url = "" + + # Our usage options. + usage = "usage: %prog [-n ] launchpad-buglist-url" + optParser = OptionParser(usage) + + # Options - namely just the number of bugs to output. + optParser.add_option("-n", "--number", action = "store_true", + dest = "number", help = "Number of entries to output.") + + # Parse arguments. + (options, args) = optParser.parse_args() - if len(sys.argv) < 2: - print >> sys.stderr, USAGE - sys.exit(1) - - if sys.argv[1] == "-n": + # Check if we want a number other than the default. + if options.number: try: - howmany = int(sys.argv[2]) - except IndexError: - print "Option '-n' requires a number." - if len(sys.argv) < 4: - print USAGE - sys.exit(1) - url = sys.argv[3] + howmany = int(args[0]) + except: + print >> sys.stderr, "Option '-n' requires an integer for an " \ + "argument." + optParser.print_help() + sys.exit(1) + + # Check that we have an URL. + if not args: + print >> sys.stderr, "An URL pointing to a Launchpad bug list is " \ + "required." + optParser.print_help() + sys.exit(1) else: - url = sys.argv[1] - + url = args[0] + return (howmany, url) def filter_unsolved(b): bug = Bug(int(b)) + # Filter out special types of bugs: + # - https://wiki.ubuntu.com/Bugs/HowToTriage#Special%20types%20of%20bugs return filter(lambda a: a.status != 'Fix Committed' and \ (a.assignee in ['motu','desktop-bugs'] or \ not a.assignee), bug.infotable) and \ 'ubuntu-main-sponsors' not in [str(s) for s in bug.subscribers] and \ - 'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers] + 'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers] and \ + 'ubuntu-archive' not in [str(s) for s in bug.subscribers] def main(): (howmany, url) = check_args() @@ -88,5 +119,5 @@ if __name__ == '__main__': try: main() except KeyboardInterrupt: - print >> sys.stderr, "Aborted" + print >> sys.stderr, "Aborted." sys.exit(1) From 4f9d3426b5683db9102ec7c2185ac51ad8eb72d7 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 21:53:43 +0100 Subject: [PATCH 11/66] * get-branches: - Rewrote option handling with optparse. - Added short version of GPL to header. - Fixed regular expressions to work with new Launchpad interface. - Use subprocess.call() on Bazaar instead of os.system(). --- debian/changelog | 5 ++ get-branches | 142 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 114 insertions(+), 33 deletions(-) diff --git a/debian/changelog b/debian/changelog index e79f6c8..e37c44b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,11 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low - Added code to handle exceptions and short version of GPL. - Rewrote option handling with optparse. - Filter bugs subscribed to the ubuntu-archive team. + * get-branches: + - Rewrote option handling with optparse. + - Added short version of GPL to header. + - Fixed regular expressions to work with new Launchpad interface. + - Use subprocess.call() on Bazaar instead of os.system(). * debian/copyright: Updated Authors and copyrights. [ Siegfried-Angel Gevatter Pujals ] diff --git a/get-branches b/get-branches index 58ec3c5..c263e42 100755 --- a/get-branches +++ b/get-branches @@ -7,29 +7,89 @@ # This script is used to checkout or branch all the Bazaar branches # in a Launchpad team. -import urllib2 -import sys -import re import os +import re +import subprocess +import sys +import urllib2 +from optparse import OptionParser def main(): - usage = "Usage: get-branches [checkout|branch]" - if len(sys.argv) < 3: - print >> sys.stderr, usage + usage = "Usage: %prog [-d ] -t [-o ]" + usage += "\nUsage: %prog " + optParser = OptionParser(usage) + optsParsed = 0 + + # Our options. + optParser.add_option("-d", "--directory", action = "store_true", + dest = "directory", help = "Directory to download branches to.") + optParser.add_option("-t", "--team", action = "store_true", + dest = "lpteam", help = "Launchpad team to download branches from.") + optParser.add_option("-o", "--operation", action = "store_true", + dest = "operation", help = "Whether to branch or checkout the " \ + "Bazaar branches. May be either 'branch' or 'checkout'.") + + (options, args) = optParser.parse_args() + + # Parse our options. + # Dictionary settings. + if options.directory: + try: + directory = args[optsParsed] + optsParsed += 1 + except IndexError: + print >> sys.stderr, "The '-d' option requires an argument." + optParser.print_help() + sys.exit(1) + + if not os.path.isdir(directory): # Check that it is a directory. + print >> sys.stderr, "%s is not a directory." % directory + sys.exit(1) + else: + directory = os.path.abspath(args[0]) + else: + # Otherwise use our current directory. + directory = os.getcwd() + + # Launchpad team setting. + if options.lpteam: + try: + team = args[0] + optsParsed += 1 + except IndexError: + print >> sys.stderr, "The '-t' option requires an argument." + optParser.print_help() + sys.exit(1) + + # Type of Bazaar operation to perform. + if options.operation: + try: + operation_type = args[optsParsed] + optsParsed += 1 + except IndexError: + print >> sys.stderr, "The '-o' option requires an argument." + optParser.print_help() + sys.exit(1) + + # Got an argument, check if it is valid. + if operation_type.lower() not in ("branch", "checkout"): + print >> sys.stderr, "Invalid operation '%s' for '-o' flag." % \ + operation_type + optParser.print_help() + sys.exit(1) + else: + operation_type = "branch" + + # No flags, and no team name specified. + if not options.lpteam and not args: + print >> sys.stderr, "No team has been specified." + optParser.print_help() sys.exit(1) - - directory = os.path.abspath(sys.argv[1])) - team = sys.argv[2] - operation_type = "branch" - if len(sys.argv) == 4: - operation_type = sys.argv[3] + elif args: + team = args[optsParsed] pwd = os.getcwd() - try: - os.chdir(directory) - except: - print >> sys.stderr, "Directory '%s' not found." % directory - sys.exit(1) + os.chdir(directory) try: os.makedirs(team) @@ -37,34 +97,50 @@ def main(): pass os.chdir(team) - sock = urllib2.urlopen("http://code.launchpad.net/~%s" % team) + # Try to open the teams code page. + try: + sock = urllib2.urlopen("https://code.launchpad.net/~%s" % team) + except urllib2.HTTPError: + print >> sys.stderr, "The page http://code.launchpad.net/~%s does " \ + "not exist." % team + print >> sys.stderr, "Perhaps invalid team name?" + sys.exit(1) + branch_list_page = sock.read() sock.close() + branch_page_urls_regex = r'.*Hosted on Launchpad:.*\n.*(.*)' + sock = urllib2.urlopen("https://code.launchpad.net/%s" % url) + branch_page = sock.read() + sock.close() + + branch_url_regex = r'bzr branch lp:~(.*)' branch_url = re.findall(branch_url_regex, branch_page) - print branch_url[0] + print "Downloading branch:", branch_url[0] + if branch_url[0]: product = branch_url[0].split("/")[-2] branch_nick = branch_url[0].split("/")[-1] - if not os.path.exists(product): - os.makedirs(product) - os.chdir(product) - if not os.path.exists(branch_nick): - os.system("bzr %s %s" % (operation_type, branch_url[0])) - else: - os.chdir(branch_nick) - os.system("bzr merge --pull --remember") - os.chdir(os.path.join(directory, team)) + + if not os.path.exists(product): + os.makedirs(product) + os.chdir(product) + + if not os.path.exists(branch_nick): + subprocess.call(["bzr", operation_type, "lp:~%s" % branch_url[0]]) + else: + os.chdir(branch_nick) + subprocess.call(["bzr", "merge", "--pull", "--remember"]) + os.chdir(os.path.join(directory, team)) os.chdir(pwd) sys.exit(0) - if __name__ == "__main__": main() From dba03d5022e01d29dcf3c7c06e8190a2bf2eb037 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 21:57:25 +0100 Subject: [PATCH 12/66] * get-branches: Really add copyright header. * hugdaylist: Remove "either". We use version 3 of the GPL only. --- get-branches | 20 ++++++++++++++++++-- hugdaylist | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/get-branches b/get-branches index c263e42..e808b7f 100755 --- a/get-branches +++ b/get-branches @@ -1,8 +1,24 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2007 (C) Canonical Ltd. +# # Created by Daniel Holbach -# License: GPLv3 +# Modified by Jonathan Patrick Davies +# +# Copyright 2007 (C) Canonical Ltd. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + # # This script is used to checkout or branch all the Bazaar branches # in a Launchpad team. diff --git a/hugdaylist b/hugdaylist index 22b6ac0..96b1cad 100755 --- a/hugdaylist +++ b/hugdaylist @@ -6,7 +6,7 @@ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License. +# the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of From 7d7d4c0ef920bc762c6aea3ddbbb5b7f4c139a95 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 10 Aug 2008 23:03:05 +0200 Subject: [PATCH 13/66] Unify headers. --- get-branches | 2 +- hugdaylist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/get-branches b/get-branches index e808b7f..b7c36e2 100755 --- a/get-branches +++ b/get-branches @@ -4,7 +4,7 @@ # Created by Daniel Holbach # Modified by Jonathan Patrick Davies # -# Copyright 2007 (C) Canonical Ltd. +# Copyright (C) 2007 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/hugdaylist b/hugdaylist index 96b1cad..a274ad0 100755 --- a/hugdaylist +++ b/hugdaylist @@ -1,8 +1,8 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# Copyright 2007, Canonical, Daniel Holbach -# Copyright (C) 2008 Jonathan Patrick Davies +# Copyright (C) 2007 Canonical Ltd., Daniel Holbach +# Copyright (C) 2008 Jonathan Patrick Davies # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From f928a041be451edba516c1a735a9631f177f5ffb Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sun, 10 Aug 2008 22:08:35 +0100 Subject: [PATCH 14/66] * debian/changelog: Uploaded 0.36ubuntu1 and added new entry for changes. --- debian/changelog | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e37c44b..cccd5a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low + + * Changes go here. + + -- Jonathan Patrick Davies Sun, 10 August 2008 22:07:58 +0100 + ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] @@ -24,8 +30,7 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low * General manpage cleanup (fix typos, use the same section names in all manpages, etc). - -- Siegfried-Angel Gevatter Pujals Sun, 10 Aug 2008 13:40:05 +0200 - + -- Jonathan Patrick Davies Sun, 10 Aug 2008 22:02:05 +0100 ubuntu-dev-tools (0.35) intrepid; urgency=low [ Siegfried-Angel Gevatter Pujals ] From dc80eacf3f16b87f27dcd90d7241148fc9e86bda Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 07:38:59 +0100 Subject: [PATCH 15/66] * get-branches: Open the teams code page before making a new directory. --- debian/changelog | 3 ++- get-branches | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index cccd5a4..d9a2efe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low - * Changes go here. + [ Jonathan Patrick Davies ] + * get-branches: Open the teams code page before making a new directory. -- Jonathan Patrick Davies Sun, 10 August 2008 22:07:58 +0100 diff --git a/get-branches b/get-branches index b7c36e2..fd83c5c 100755 --- a/get-branches +++ b/get-branches @@ -107,21 +107,21 @@ def main(): pwd = os.getcwd() os.chdir(directory) + # Try to open the teams code page. + try: + sock = urllib2.urlopen("https://code.launchpad.net/~%s" % team) + except urllib2.HTTPError: + print >> sys.stderr, "The page https://code.launchpad.net/~%s does " \ + "not exist." % team + print >> sys.stderr, "Perhaps invalid team name?" + sys.exit(1) + try: os.makedirs(team) except: pass os.chdir(team) - # Try to open the teams code page. - try: - sock = urllib2.urlopen("https://code.launchpad.net/~%s" % team) - except urllib2.HTTPError: - print >> sys.stderr, "The page http://code.launchpad.net/~%s does " \ - "not exist." % team - print >> sys.stderr, "Perhaps invalid team name?" - sys.exit(1) - branch_list_page = sock.read() sock.close() From 59a6f32e8e35f762540af618b72834a00d43851b Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 07:57:58 +0100 Subject: [PATCH 16/66] * get-branches: - Improve invalid directory error. - Check that the team page exists before creating new directory for downloads. * doc/get-branches.1: Created. --- debian/changelog | 1 + doc/get-branches.1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ get-branches | 5 +++-- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 doc/get-branches.1 diff --git a/debian/changelog b/debian/changelog index d9a2efe..385be90 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] * get-branches: Open the teams code page before making a new directory. + * doc/get-branches.1: Created. -- Jonathan Patrick Davies Sun, 10 August 2008 22:07:58 +0100 diff --git a/doc/get-branches.1 b/doc/get-branches.1 new file mode 100644 index 0000000..d0f29be --- /dev/null +++ b/doc/get-branches.1 @@ -0,0 +1,45 @@ +.TH GET-BRANCHES "1" "11 August 2008" "ubuntu-dev-tools" +.SH NAME +get-branches \- downloads all branches related to a Launchpad team or person + +.SH SYNOPSIS + +.B get-branches [-d directory] [-o branch|checkout] \-t + +.B get-branches + +.B get-branches \-\-help + +.SH DESCRIPTION +.PP +\fBget-branches\fR examines the code page of a Launchpad team/person, parses it, +and calls Bazaar to download all branches on that page. + +.SH OPTIONS +.PP +Listed below are the command line options for \fBget-branches\fR: +.TP +.B \-h or \-\-help +Display a help message and exit. +.TP +.B \-d or \-\-directory +Download branches to a directory other than the current directory. +.TP +.B \-o or \-\-operation +Specifies which Bazaar operation to use when downloading the branches; may be +either \fIbranch\fR or \fIcheckout\fR. +.TP +.B \-t or \-\-team +Specifies which Launchpad team/person to download branches from. This option is +required. + +.SH AUTHORS +.PP +\fBget-branches\fR was written by Daniel Holbach , and +this manual page was written by Jonathan Patrick Davies . +.PP +Both are released under the terms of the GNU General Public License, version 3. + +.SH SEE ALSO +.PP +.B bzr(1) diff --git a/get-branches b/get-branches index fd83c5c..886a758 100755 --- a/get-branches +++ b/get-branches @@ -59,7 +59,8 @@ def main(): sys.exit(1) if not os.path.isdir(directory): # Check that it is a directory. - print >> sys.stderr, "%s is not a directory." % directory + print >> sys.stderr, "%s is not a valid directory." % directory + optParser.print_help() sys.exit(1) else: directory = os.path.abspath(args[0]) @@ -138,7 +139,7 @@ def main(): branch_url_regex = r'bzr branch lp:~(.*)' branch_url = re.findall(branch_url_regex, branch_page) - print "Downloading branch:", branch_url[0] + print "Downloading branch: lp:~%s." % branch_url[0] if branch_url[0]: product = branch_url[0].split("/")[-2] From 684715ff89ee486999daa71a67e1d1abfc8ffdb8 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 10:57:19 +0100 Subject: [PATCH 17/66] * hugdaylist: Improved argument and error handling. --- debian/changelog | 1 + hugdaylist | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 385be90..9435e91 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] * get-branches: Open the teams code page before making a new directory. * doc/get-branches.1: Created. + * hugdaylist: Improved argument and error handling. -- Jonathan Patrick Davies Sun, 10 August 2008 22:07:58 +0100 diff --git a/hugdaylist b/hugdaylist index a274ad0..aae8bc3 100755 --- a/hugdaylist +++ b/hugdaylist @@ -50,6 +50,7 @@ def check_args(): # Our usage options. usage = "usage: %prog [-n ] launchpad-buglist-url" optParser = OptionParser(usage) + argsParsed = 0 # Options - namely just the number of bugs to output. optParser.add_option("-n", "--number", action = "store_true", @@ -57,11 +58,14 @@ def check_args(): # Parse arguments. (options, args) = optParser.parse_args() + print options + print args # Check if we want a number other than the default. if options.number: try: - howmany = int(args[0]) + howmany = int(args[argsParsed]) + argsParsed += 1 except: print >> sys.stderr, "Option '-n' requires an integer for an " \ "argument." @@ -75,7 +79,7 @@ def check_args(): optParser.print_help() sys.exit(1) else: - url = args[0] + url = args[argsParsed] return (howmany, url) @@ -92,8 +96,13 @@ def filter_unsolved(b): def main(): (howmany, url) = check_args() - - bl = BugList(url) + + try: + bl = BugList(url) + except: + print >> sys.stderr, "The page '%s' does not appear to exist." % url + sys.exit(1) + l = filter(filter_unsolved, bl) if not l: From 45a5d024b385961a23e45096a0175a49ea518e03 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 10:58:04 +0100 Subject: [PATCH 18/66] * hugdaylist: Must remember to remove debugging messages in future... --- hugdaylist | 2 -- 1 file changed, 2 deletions(-) diff --git a/hugdaylist b/hugdaylist index aae8bc3..e9c5057 100755 --- a/hugdaylist +++ b/hugdaylist @@ -58,8 +58,6 @@ def check_args(): # Parse arguments. (options, args) = optParser.parse_args() - print options - print args # Check if we want a number other than the default. if options.number: From 3d4017fe77bae996e9493c5e812394808e786a7c Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 14:20:38 +0100 Subject: [PATCH 19/66] * pull-lp-source: - Use optparse for option handling. - Check that 'distro' exists on Launchpad. - Use subprocess for dget calls. --- debian/changelog | 4 +++ pull-lp-source | 76 ++++++++++++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9435e91..5587b68 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,10 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * get-branches: Open the teams code page before making a new directory. * doc/get-branches.1: Created. * hugdaylist: Improved argument and error handling. + * pull-lp-source: + - Use optparse for option handling. + - Check that 'distro' exists on Launchpad. + - Use subprocess for dget calls. -- Jonathan Patrick Davies Sun, 10 August 2008 22:07:58 +0100 diff --git a/pull-lp-source b/pull-lp-source index a58ec91..527be98 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -22,11 +22,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -# TODO: Determine before going to LP whether a source package and distro exist or not. # TODO: Determine current development distro programatically -import sys import os +import subprocess +import sys +import urllib2 +from optparse import OptionParser class BackportFromLP: @@ -40,13 +42,13 @@ class BackportFromLP: def __prepare_sources(self): # Scrape the source package from Launchpad :) - import re + import re contents = os.popen('wget -q https://launchpad.net/ubuntu/%(target_distro)s/+source/%(package)s -O-' % self).read() links = re.findall('a href=\"(.*\.dsc)\"', contents) if len(links) == 1 and \ - (os.system('dget -x http://launchpad.net%s' % links[0])) == 0: + subprocess.call(['dget', '-x', 'http://launchpad.net%s' % links[0]]) == 0: print '\nSuccess!' else: raise ValueError, '\nFailed to fetch and extract the source. ' +\ @@ -55,33 +57,49 @@ class BackportFromLP: default_distro = 'intrepid' -def usage(): - print 'Usage: %s [distro]' % sys.argv[0] - if __name__ == '__main__': + usage = "Usage: %prog [distribution]" + optParser = OptionParser(usage) + (options, args) = optParser.parse_args() + + if not args: + print >> sys.stderr, "Need arguments." + optParser.print_help() + sys.exit(1) + + package = args[0] - args = sys.argv[1:] or [] + if len(args) == 2: # Custom distribution specified. + distro = args[1] + else: + distro = os.getenv('DIST') or default_distro - if args == [] or args[0] in ('-h', '--help'): - usage() - sys.exit(0) + # Correct-ish args, can proceed. + # Check distro by checking if Launchpad page exists + try: + urllib2.urlopen("https://launchpad.net/ubuntu/%s" % distro) + except urllib2.HTTPError: + print >> sys.stderr, "The distribution '%s' does not appear to exist on " \ + "Launchpad." % distro + sys.exit(1) - if len(args) >= 1: - package = args[0] + # Check package exists. + """ TODO: Find a way to check that the package exists here. + madison = subprocess.Popen(['rmadison', '-u', 'ubuntu', '-a', 'source', \ + '-s', distro, package], stdout = subprocess.PIPE) + out = madison.communicate()[0] + print madison.returncode + assert (madison.returncode == 0) + if madison == 0: + print "The '%s' package doesn't appear to exist in %s." % (package, distro) + sys.exit(1) + """ - if len(args) == 2: - distro = args[1] - elif len(args) == 1: - distro = os.getenv('DIST') or default_distro - else: # incorrect args - usage() - sys.exit(1) - - # Correct-ish args, can proceed - try: - print 'Attempting to get %s from distro %s...' % \ - (package, distro.capitalize()) - BackportFromLP(package, distro) - except ValueError, e: - print 'Error when downloading package %s from distro %s: %s' % \ - (package, distro, e) + # All good - start downloading... + try: + print 'Attempting to get %s from distro %s...' % \ + (package, distro.capitalize()) + BackportFromLP(package, distro) + except ValueError, e: + print 'Error when downloading package %s from distro %s: %s' % \ + (package, distro, e) From d3efcc879ff525bd36d1b57906f55706cc05044d Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Mon, 11 Aug 2008 20:06:35 +0200 Subject: [PATCH 20/66] Remove unneeded AUTHORS and README. Add the GPL header to all scripts. --- 404main | 17 +++++++++- AUTHORS | 17 ---------- README | 78 ------------------------------------------- TODO | 2 +- check-symbols | 19 +++++++++-- dch-repeat | 19 +++++++++-- debian/changelog | 7 +++- dgetlp | 26 ++++++++------- get-branches | 24 ++++++------- get-build-deps | 18 +++++++++- grab-attachments | 17 ++++++++-- hugdaylist | 27 +++++++-------- massfile | 17 +++++++++- mk-sbuild-lv | 17 +++++++++- pbuilder-dist | 16 ++++++++- pbuilder-dist-simple | 16 ++++++++- pbuilder-dist.new | 16 ++++++++- pull-debian-debdiff | 17 +++++++++- pull-lp-source | 13 ++++---- requestsync | 15 ++++++++- reverse-build-depends | 18 +++++++++- submittodebian | 30 +++++++++-------- suspicious-source | 14 +++++++- update-maintainer | 17 +++++++++- what-patch | 22 ++++++++++-- 25 files changed, 324 insertions(+), 175 deletions(-) delete mode 100644 AUTHORS delete mode 100644 README diff --git a/404main b/404main index 604e759..db00ce9 100755 --- a/404main +++ b/404main @@ -3,7 +3,22 @@ # # Copyright 2006-2007 (C) Pete Savage # Copyright 2007 (C) Siegfried-A. Gevatter -# License: GPLv2 or later +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # This script is used to check if a package and all its build # dependencies are in main or not. diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 167c7dd..0000000 --- a/AUTHORS +++ /dev/null @@ -1,17 +0,0 @@ -Albert Damen -Albin Tonnerre -Daniel Hahler -Daniel Holbach -Iain Lane -Jamin W. Collins -Jonathan Patrick Davies -Jordan Mantha -Kees Cook -Luke Yelavich -Martin Pitt -Michael Bienia -Pete Savage -Siegfried-A. Gevatter -Soren Hansen -Steve Kowalik -Terence Simpson diff --git a/README b/README deleted file mode 100644 index 8cf4e00..0000000 --- a/README +++ /dev/null @@ -1,78 +0,0 @@ -================================ -== Ubuntu Development Tools == -================================ - -404main - ... will check if and all it's build dependencies are - are in the "main" component or not. - -check-symbols [] - ... will compare and give you a diff of the exported symbols of all - .so files in all binary packages of . is not - mandatory and set to /var/cache/pbuilder/result by default. - -dch-repeat [--help] - ... will repeat a change log into an older release. - -dgetlp - ... will simulate «dget»'s behaviour for files hosted at - launchpadlibrarian.net. - -get-branches [checkout|branch] - ... will branch / checkout all the Bazaar branches in a Launchpad - team. - -get-build-deps [] - ... will install the build dependencies for a package, if you are - inside its source file. Alternatively, you can pass it the name of - a file containing a list of packages, one on each line, or just - pass them all as parameters, and it will get their build - dependencies. - -hugdaylist [-n ] - ... will create a list of bug list for a hug day listing - -massfile - ... will perform a massive bug reporting operation on Launchpad - according to the information in the "information" and "list" files - that are in the working directory. - -mk-sbuild-lv - ... will create LVM snapshot chroots via schroot and sbuild. It - assumes that sbuild has not be installed and configured before. - -pbuilder-dist [withlog] [create|update|build|clean|login|execute] - ... is a wrapper to use pbuilder with many different Ubuntu and/or - Debian releases. It's recommended to symlink as pbuilder-feisty, - pbuilder-gutsy, etc. - -pull-debian-debdiff - ... will attempt to find and download a specific version of a - Debian package and its immediate parent to generate a debdiff. - -requestsync [-n|-s] [base version] - ... will file a sync request for a package from Debian by sending - a bug report to Launchpad. - -reverse-build-depends [-c|-s] - ... will print 's build dependencies. - -submittodebian - ... will submit patches to Debian's BTS. Run it from inside the - source directory of a Debian package (note that there has to be - a .dsc for it in the parent directory). - -suspicious-source - ... will output a list of files which are not common source files. - This should be run in the root of a source tree to find files which - might not be the "prefered form of modification" that the GPL and - other licenses require. - -update-maintainer - ... will update the Maintainer field of an Ubuntu package to match - the DebianMaintainerField specification, and add a line about this - to the changelog. - -what-patch - ... will check what patching system is used by a package. You need - to be in its source directory in order for it to work. diff --git a/TODO b/TODO index 414c944..9ac821f 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,6 @@ https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools - Create missing manpages (for all commands). - Modify 404main to use the more robust python-apt module. -- Use the short version of the GPL license in all scripts. - Ask all authors who have used GPL if they are happy with using "or any later" versions of the license. +- pull-lp-source: determine the current development distro programatically. diff --git a/check-symbols b/check-symbols index 800764a..1adf2cc 100755 --- a/check-symbols +++ b/check-symbols @@ -1,7 +1,22 @@ #!/bin/bash -# Copyright 2006-2007 (C) Daniel Holbach +# +# Copyright (C) 2006-2007 Daniel Holbach # Modified by Siegfried-A. Gevatter -# License: GPLv2 +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-2 for more details. +# +# ################################################################## # # This script is used to get a diff of the exported symbols of all .so files in # every binary package of package $1. diff --git a/dch-repeat b/dch-repeat index ba831f0..c32938e 100755 --- a/dch-repeat +++ b/dch-repeat @@ -1,7 +1,22 @@ #!/usr/bin/perl -# Copyright 2007-2008 (C) Canonical, Ltd +# +# Copyright (C) 2007-2008 Canonical, Ltd. # Author: Kees Cook -# License: GPLv2 +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-2 for more details. +# +# ################################################################## # # This script is used to repeat a change log into an older release. It # expects that --build-tree is laid out with each Ubuntu release as a diff --git a/debian/changelog b/debian/changelog index 5587b68..13b6893 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,7 +9,12 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low - Check that 'distro' exists on Launchpad. - Use subprocess for dget calls. - -- Jonathan Patrick Davies Sun, 10 August 2008 22:07:58 +0100 + [ Siegfried-Angel Gevatter Pujals ] + * Add the GNU General Public License header to all scripts. + * Remove files AUTHORS (it duplicated content from debian/copyright) and + README (superseded by the manpages). + + -- Siegfried-Angel Gevatter Pujals Mon, 11 Aug 2008 19:44:53 +0200 ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low diff --git a/dgetlp b/dgetlp index 38b5502..9df4289 100755 --- a/dgetlp +++ b/dgetlp @@ -1,20 +1,22 @@ #!/bin/bash # Copyright (C) 2008 Terence Simpson # Modified by Siegfried-A. Gevatter -# License: -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# ################################################################## # -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # This script simulates «dget»'s behaviour for files hosted at # launchpadlibrarian.net. diff --git a/get-branches b/get-branches index 886a758..2cb248f 100755 --- a/get-branches +++ b/get-branches @@ -1,24 +1,24 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # +# Copyright (C) 2007 Canonical Ltd. # Created by Daniel Holbach # Modified by Jonathan Patrick Davies # -# Copyright (C) 2007 Canonical Ltd. +# ################################################################## # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# See file /usr/share/common-licenses/GPL-3 for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - +# ################################################################## # # This script is used to checkout or branch all the Bazaar branches # in a Launchpad team. diff --git a/get-build-deps b/get-build-deps index 3f2c6f7..50dd938 100755 --- a/get-build-deps +++ b/get-build-deps @@ -1,6 +1,22 @@ #!/bin/bash +# # Copyright 2007 (C) Siegfried-A. Gevatter -# License: GPLv3 or later +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # If you don't pass it any argument, this script will check if # there's a control (debian/control) file somewhere in the current diff --git a/grab-attachments b/grab-attachments index dbda6f2..109a119 100755 --- a/grab-attachments +++ b/grab-attachments @@ -1,9 +1,22 @@ #!/usr/bin/python # -# Copyright 2007, Canonical, Daniel Holbach +# Copyright (C) 2007, Canonical Ltd. +# Written by Daniel Holbach # -# GPL 3 +# ################################################################## # +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-3 for more details. +# +# ################################################################## import os import sys diff --git a/hugdaylist b/hugdaylist index e9c5057..3556322 100755 --- a/hugdaylist +++ b/hugdaylist @@ -1,22 +1,24 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# Copyright (C) 2007 Canonical Ltd., Daniel Holbach -# Copyright (C) 2008 Jonathan Patrick Davies +# Copyright (C) 2007 Canonical Ltd., Daniel Holbach +# Copyright (C) 2008 Jonathan Patrick Davies # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. +# ################################################################## # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# See file /usr/share/common-licenses/GPL-3 for more details. +# +# ################################################################## # - # # hugdaylist - produces MoinMoin wiki formatted tables based on a Launchpad bug # list. @@ -26,7 +28,6 @@ # # hugdaylist -n # - will only list URLs. -# import os import re diff --git a/massfile b/massfile index ccc6780..7927820 100755 --- a/massfile +++ b/massfile @@ -1,10 +1,25 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# (C) Canonical, 2007, GPL v3 +# Copyright (C) 2007 Canonical Ltd. # # Modified by Iain Lane , taking some code written by # Daniel Hahler +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-3 for more details. +# +# ################################################################## import os import sys diff --git a/mk-sbuild-lv b/mk-sbuild-lv index 51ad04c..444fed7 100755 --- a/mk-sbuild-lv +++ b/mk-sbuild-lv @@ -1,7 +1,22 @@ #!/bin/bash +# # Copyright 2006-2007 (C) Canonical Ltd. # Created by Kees Cook -# License: GPLv2 +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-2 for more details. +# +# ################################################################## # # This script creates LVM snapshot chroots via schroot and sbuild. # Much love to "man sbuild-setup", https://wiki.ubuntu.com/PbuilderHowto, diff --git a/pbuilder-dist b/pbuilder-dist index 47e54da..b3b502a 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -4,7 +4,21 @@ # Copyright (C) Jordan Mantha # Copyright (C) 2007-2008 Siegfried-A. Gevatter # -# License: GPLv2 or later +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # This script is a wrapper to be able to easily use pbuilder for # different distributions (eg, Gutsy, Hardy, Debian unstable, etc). diff --git a/pbuilder-dist-simple b/pbuilder-dist-simple index 3210226..1a4e385 100755 --- a/pbuilder-dist-simple +++ b/pbuilder-dist-simple @@ -3,7 +3,21 @@ # Copyright (C) Jamin W. Collins # Copyright (C) Jordan Mantha # -# License: GPLv2 or later +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # This script is a wrapper to be able to easily use pbuilder for # different distributions (eg, Gutsy, Hardy, Debian unstable, etc). diff --git a/pbuilder-dist.new b/pbuilder-dist.new index ab3468e..48755bb 100755 --- a/pbuilder-dist.new +++ b/pbuilder-dist.new @@ -5,7 +5,21 @@ # With some changes by Iain Lane # Based upon pbuilder-dist-simple by Jamin Collins and Jordan Mantha. # -# License: GPLv2 or later +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # This script is a wrapper to be able to easily use pbuilder for # different distributions (eg, Gutsy, Hardy, Debian unstable, etc). diff --git a/pull-debian-debdiff b/pull-debian-debdiff index 08c47bb..37f3cd8 100755 --- a/pull-debian-debdiff +++ b/pull-debian-debdiff @@ -1,6 +1,21 @@ #!/usr/bin/perl +# # Copyright 2007-2008 Kees Cook -# License GPLv3 +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-3 for more details. +# +# ################################################################## # # This script attempts to find and download a specific version of a Debian # package and its immediate parent to generate a debdiff. diff --git a/pull-lp-source b/pull-lp-source index 527be98..65eaa5f 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -1,12 +1,15 @@ #!/usr/bin/python +# # pull-lp-source -- pull a source package from Launchpad # Basic usage: pull-lp-source [] # # Copyright (C) 2008 Iain Lane # -# BackportFromLP class taken from prevu tool, which has -# copyright (C) 2006 John Dong . +# BackportFromLP class taken from prevu tool, which is: +# Copyright (C) 2006 John Dong # +# ################################################################## +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 @@ -17,12 +20,10 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# See file /usr/share/common-licenses/GPL for more details. # +# ################################################################## -# TODO: Determine current development distro programatically import os import subprocess diff --git a/requestsync b/requestsync index 4cfde41..96bce89 100755 --- a/requestsync +++ b/requestsync @@ -9,7 +9,20 @@ # Daniel Hahler # Iain Lane # -# License: GPLv2, see /usr/share/common-licenses/GPL-2 +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-2 for more details. +# +# ################################################################## import os, sys, urllib, subprocess, getopt from debian_bundle.changelog import Version diff --git a/reverse-build-depends b/reverse-build-depends index 5e4f617..8a95ca8 100755 --- a/reverse-build-depends +++ b/reverse-build-depends @@ -1,7 +1,23 @@ #!/bin/bash +# # Copyright (C) 2007 Siegfried-A. Gevatter # Based upon a short script by an unknown author -# License: GPLv2+ +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## # # This script is used to find the reverse build dependencies # that a package has. diff --git a/submittodebian b/submittodebian index 209fe7b..770b4b1 100755 --- a/submittodebian +++ b/submittodebian @@ -1,23 +1,25 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# submittodebian - tool to submit patches to Debian's bts -# Copyright (C) 2007 Canonical Ltd. -# Author: Soren Hansen +# submittodebian - tool to submit patches to Debian's BTS +# Copyright (C) 2007 Canonical Ltd. +# Author: Soren Hansen # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# ################################################################## # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. # -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# ################################################################## import re, os, sys from tempfile import mkstemp diff --git a/suspicious-source b/suspicious-source index 943376e..e4d81f9 100755 --- a/suspicious-source +++ b/suspicious-source @@ -1,7 +1,19 @@ #!/bin/bash +# # Copyright 2007 (C) Siegfried-A. Gevatter # Based upon a script by Martin Pitt -# License: GPLv3 or later +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. # # This script outputs a list of files which are not common source files. This # should be run in the root of a source tree to find files which might not be diff --git a/update-maintainer b/update-maintainer index ce03185..5403ef4 100755 --- a/update-maintainer +++ b/update-maintainer @@ -1,6 +1,21 @@ #!/bin/bash +# # Copyright 2007 (C) Albin Tonnerre (Lutin) -# License: GPLv2 +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-2 for more details. +# +# ################################################################## # # This script is used to update the Maintainer field of an Ubuntu package # to match the DebianMaintainerField specification. diff --git a/what-patch b/what-patch index 73920fa..90d3f47 100755 --- a/what-patch +++ b/what-patch @@ -1,11 +1,27 @@ #!/bin/bash +# # Copyright 2006-2008 (C) Kees Cook # Modified by Siegfried-A. Gevatter # Modified by Daniel Hahler -# License: GPLv2 +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL-2 for more details. +# +# ################################################################## +# +# By default only the name of the patch system is printed. Verbose mode can be +# enabled with -v. -# Default operation reports only the patch system. Verbose mode can be -# enabled with -v if [ "$1" = "-h" ] || [ "$1" = "--help" ] then cat < Date: Mon, 11 Aug 2008 19:24:39 +0100 Subject: [PATCH 21/66] * pull-lp-source: Now check if package exists in the release. --- debian/changelog | 2 +- pull-lp-source | 51 +++++++++++++++++++++++------------------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/debian/changelog b/debian/changelog index 13b6893..b08c0a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * hugdaylist: Improved argument and error handling. * pull-lp-source: - Use optparse for option handling. - - Check that 'distro' exists on Launchpad. + - Check that the 'release' and 'package' actually exist on Launchpad. - Use subprocess for dget calls. [ Siegfried-Angel Gevatter Pujals ] diff --git a/pull-lp-source b/pull-lp-source index 65eaa5f..06b2301 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -1,7 +1,7 @@ #!/usr/bin/python # # pull-lp-source -- pull a source package from Launchpad -# Basic usage: pull-lp-source [] +# Basic usage: pull-lp-source [] # # Copyright (C) 2008 Iain Lane # @@ -26,6 +26,7 @@ import os +import re import subprocess import sys import urllib2 @@ -36,16 +37,14 @@ class BackportFromLP: def __getitem__(self, name): return getattr(self, name) - def __init__(self, package, target_distro): + def __init__(self, package, target_release): self.package = package - self.target_distro = target_distro + self.target_release = target_release self.__prepare_sources() def __prepare_sources(self): # Scrape the source package from Launchpad :) - import re - - contents = os.popen('wget -q https://launchpad.net/ubuntu/%(target_distro)s/+source/%(package)s -O-' % self).read() + contents = os.popen('wget -q https://launchpad.net/ubuntu/%(target_release)s/+source/%(package)s -O-' % self).read() links = re.findall('a href=\"(.*\.dsc)\"', contents) if len(links) == 1 and \ @@ -56,7 +55,7 @@ class BackportFromLP: 'Ensure that the package specified is a valid source ' +\ 'package name and that Launchpad is not down.' -default_distro = 'intrepid' +default_release = 'intrepid' if __name__ == '__main__': usage = "Usage: %prog [distribution]" @@ -71,36 +70,34 @@ if __name__ == '__main__': package = args[0] if len(args) == 2: # Custom distribution specified. - distro = args[1] + release = args[1] else: - distro = os.getenv('DIST') or default_distro + release = os.getenv('DIST') or default_release # Correct-ish args, can proceed. - # Check distro by checking if Launchpad page exists + # Check release by checking if Launchpad page exists try: - urllib2.urlopen("https://launchpad.net/ubuntu/%s" % distro) + urllib2.urlopen("https://launchpad.net/ubuntu/%s" % release) except urllib2.HTTPError: - print >> sys.stderr, "The distribution '%s' does not appear to exist on " \ - "Launchpad." % distro + print >> sys.stderr, "The '%s' release does not appear to exist on " \ + "Launchpad." % release sys.exit(1) # Check package exists. - """ TODO: Find a way to check that the package exists here. - madison = subprocess.Popen(['rmadison', '-u', 'ubuntu', '-a', 'source', \ - '-s', distro, package], stdout = subprocess.PIPE) - out = madison.communicate()[0] - print madison.returncode - assert (madison.returncode == 0) - if madison == 0: - print "The '%s' package doesn't appear to exist in %s." % (package, distro) + sourcePage = urllib2.urlopen("https://launchpad.net/ubuntu/%s/+source/%s" % \ + (release, package)).read() + m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, \ + package.replace('+', '\+')), sourcePage) + if not m: + print >> sys.stderr, "The '%s' package does not appear to exist in " \ + "the '%s' release." % (package, release) sys.exit(1) - """ # All good - start downloading... try: - print 'Attempting to get %s from distro %s...' % \ - (package, distro.capitalize()) - BackportFromLP(package, distro) + print 'Attempting to get %s from release %s...' % \ + (package, release.capitalize()) + BackportFromLP(package, release) except ValueError, e: - print 'Error when downloading package %s from distro %s: %s' % \ - (package, distro, e) + print 'Error when downloading package %s from release %s: %s.' % \ + (package, release, e) From 2c4fdd6553e3d2bffad192e9f1e5c08c2d812ef3 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 19:31:12 +0100 Subject: [PATCH 22/66] * pull-lp-source: Use urllib2.urlopen() to read link to .dsc files. --- pull-lp-source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pull-lp-source b/pull-lp-source index 06b2301..dac1028 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -44,7 +44,7 @@ class BackportFromLP: def __prepare_sources(self): # Scrape the source package from Launchpad :) - contents = os.popen('wget -q https://launchpad.net/ubuntu/%(target_release)s/+source/%(package)s -O-' % self).read() + contents = urllib2.urlopen('https://launchpad.net/ubuntu/%(target_release)s/+source/%(package)s' % self).read() links = re.findall('a href=\"(.*\.dsc)\"', contents) if len(links) == 1 and \ From 2dafedde6315ea223b081d12681ea9d5a513f0fe Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 19:32:46 +0100 Subject: [PATCH 23/66] * pull-lp-source: Seems sed didn't replace distribution with release here. --- pull-lp-source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pull-lp-source b/pull-lp-source index dac1028..f666743 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -58,7 +58,7 @@ class BackportFromLP: default_release = 'intrepid' if __name__ == '__main__': - usage = "Usage: %prog [distribution]" + usage = "Usage: %prog [release]" optParser = OptionParser(usage) (options, args) = optParser.parse_args() From d3f18b8ec74ca7d3469caded7620f64938dd8ed0 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 21:48:40 +0100 Subject: [PATCH 24/66] * buildd: Imported from Martin Pitt's scripts at: http://people.ubuntu.com/~pitti/scripts/buildd.py * ubuntutools/common.py: Python module to be used to enable the use of cookies to authenticate with Launchpad. * debian/ubuntu-dev-tools.install: Added line to install common.py above to the correct location. --- buildd | 84 ++++++++++++++++++++++++++++++ debian/changelog | 5 ++ debian/ubuntu-dev-tools.install | 1 + ubuntutools/common.py | 91 +++++++++++++++++++++++++++++++++ 4 files changed, 181 insertions(+) create mode 100755 buildd create mode 100644 ubuntutools/common.py diff --git a/buildd b/buildd new file mode 100755 index 0000000..890bed6 --- /dev/null +++ b/buildd @@ -0,0 +1,84 @@ +#!/usr/bin/python +# +# buildd - command line interface for Launchpad buildd operations. +# +# Copyright (C) 2007 Canonical Ltd. +# Author: Martin Pitt . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import urllib2 +import re +import sys +from urllib import urlencode + +sys.path.append('/usr/share/ubuntu-dev-tools/') +import common + +# Parse arguments. +try: + (package, release, op) = sys.argv[1:] +except ValueError: + print >> sys.stderr, '''Usage: %s + +operation: status | retry | rescore [priority (default 5000)]''' % sys.argv[0] + sys.exit(1) + +# Prepare Launchpad cookie. +urlopener = common.prepareLaunchpadCookie() + +# Find out the version in given release. +try: + page = urlopener.open('https://launchpad.net/ubuntu/+source/' + package).read() +except urllib2.HTTPError: + print >> sys.stderr, 'This source does not appear to exist in Ubuntu' + sys.exit(1) + +m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, package.replace('+', '\+')), page) +if not m: + print >> sys.stderr, 'Cannot find this source package in this release' + sys.exit(1) +version = m.group(1) +print 'Source version:', version + +# Parse out build URLs, states, and arches. +buildstats = {} +page = urlopener.open('https://launchpad.net/ubuntu/+source/%s/%s' % (package, version)) +url = page.geturl() +page = page.read() +for m in re.finditer('"/ubuntu/\+source/%s/%s(/\+build/\d+)"[^\n]+\n\s*(\w+).*?(\w+).*?\s*([^\n]+)\n' % + (package.replace('+', '\+'), version.replace('+', '\+')), page, re.S): + if m.group(2) == release: + print '%s: %s' % (m.group(3), m.group(4)) + buildstats[url + m.group(1)] = [m.group(3).strip(), m.group(4).strip()] + +# Operations. +if op == 'status': + sys.exit(0) + +for build, (arch, status) in buildstats.iteritems(): + if op == 'rescore': + if status == 'Needs building': + print 'rescoring', build, '(%s)' % arch + urlopener.open(build+'/+rescore', urlencode( + {'SCORE': '5000', 'RESCORE': '1'})) + elif op == 'retry': + if status in ('Failed to build', 'Chroot problem', 'Failed to upload'): + print 'retrying', build, '(%s)' % arch + urlopener.open(build+'/+retry', urlencode( + {'RETRY': '1'})) + else: + print >> sys.stderr, 'Invalid operation' + sys.exit(1) diff --git a/debian/changelog b/debian/changelog index b08c0a5..7f3fc01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,11 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low - Use optparse for option handling. - Check that the 'release' and 'package' actually exist on Launchpad. - Use subprocess for dget calls. + * buildd: Imported from Martin Pitt's scripts. + * ubuntutools/common.py: Python module to be used to enable the use of cookies + to authenticate with Launchpad. + * debian/ubuntu-dev-tools.install: Added line to install common.py above to + the correct location. [ Siegfried-Angel Gevatter Pujals ] * Add the GNU General Public License header to all scripts. diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install index 40fadd6..72b8954 100644 --- a/debian/ubuntu-dev-tools.install +++ b/debian/ubuntu-dev-tools.install @@ -1 +1,2 @@ bash_completion/* etc/bash_completion.d/ +ubuntutools/common.py usr/share/ubuntu-dev-tools/ diff --git a/ubuntutools/common.py b/ubuntutools/common.py new file mode 100644 index 0000000..d3e2def --- /dev/null +++ b/ubuntutools/common.py @@ -0,0 +1,91 @@ +# +# common.py - provides functions which are commonly used by the +# ubuntu-dev-tools package. +# +# Copyright (C) 2008 Jonathan Patrick Davies +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# Based on code written by Martin Pitt and +# Kees Cook . + +""" Necessary modules. """ +import cookielib +import glob +import os.path +import sys +import urllib2 + +def prepareLaunchpadCookie(): + """ Search for a cookie file in the places as defined by try_globs. + We shall use this cookie for authentication with Launchpad. """ + + # We do not have our cookie. + launchpad_cookiefile = None + # Look in common locations. + try_globs = ('~/.lpcookie.txt', '~/.mozilla/*/*/cookies.sqlite', + '~/.mozilla/*/*/cookies.txt') + + if launchpad_cookiefile == None: + for try_glob in try_globs: + try: + cookiefile = glob.glob(os.path.expanduser(try_glob))[0] + except IndexError: + continue # Unable to glob file - carry on. + # Found: + launchpad_cookiefile = cookiefile + break + + # Unable to find an correct file. + if launchpad_cookiefile == None: + print >> sys.stderr, 'Could not find cookie file for Launchpad " \ + "(looked in " \ %s)' % ", ".join(try_globs) + print >> sys.stderr, 'You should be able to create a valid file by " \ + "logging into Launchpad with Firefox' + sys.exit(1) + + # Found SQLite file. Parse information from it. + if launchpad_cookiefile.find('cookies.sqlite') != -1: + from pysqlite2 import dbapi2 as sqlite + + con = sqlite.connect(launchpad_cookiefile) + + cur = con.cursor() + cur.execute("select host, path, isSecure, expiry, name, value from moz_cookies where host like ?", ['%%launchpad%%']) + + ftstr = ["FALSE", "TRUE"] + + newLPCookie = open("%s/.lpcookie.txt" % os.environ.get('HOME'), 'w') + newLPCookie.write("# HTTP Cookie File.\n") # Header. + + for item in cur.fetchall(): + # Write entries. + newLPCookie.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % ( + item[0], ftstr[item[0].startswith('.')], item[1], + ftstr[item[2]], item[3], item[4], item[5])) + + newLPCookie.write("\n") # New line. + newLPCookie.close() + launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME') + + print "Using cookie file at: %s." % launchpad_cookiefile + + # Build HTML opener with cookie file. + cj = cookielib.MozillaCookieJar() + cj.load(launchpad_cookiefile) + urlopener = urllib2.build_opener() + urlopener.add_handler(urllib2.HTTPCookieProcessor(cj)) + + return urlopener From 0dc2681b17b6d67641d90dee217bb886f1c08415 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Mon, 11 Aug 2008 22:53:25 +0200 Subject: [PATCH 25/66] Move ubuntutools/common.py to common.py. --- ubuntutools/common.py => common.py | 0 debian/ubuntu-dev-tools.install | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename ubuntutools/common.py => common.py (100%) diff --git a/ubuntutools/common.py b/common.py similarity index 100% rename from ubuntutools/common.py rename to common.py diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install index 72b8954..5b36808 100644 --- a/debian/ubuntu-dev-tools.install +++ b/debian/ubuntu-dev-tools.install @@ -1,2 +1,2 @@ bash_completion/* etc/bash_completion.d/ -ubuntutools/common.py usr/share/ubuntu-dev-tools/ +common.py usr/share/ubuntu-dev-tools/ From 341f2a60b53e3261403907e63c81cb95e8c85208 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 21:57:36 +0100 Subject: [PATCH 26/66] * debian/changelog: common.py has moved. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7f3fc01..5839d89 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,7 +9,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low - Check that the 'release' and 'package' actually exist on Launchpad. - Use subprocess for dget calls. * buildd: Imported from Martin Pitt's scripts. - * ubuntutools/common.py: Python module to be used to enable the use of cookies + * common.py: Python module to be used to enable the use of cookies to authenticate with Launchpad. * debian/ubuntu-dev-tools.install: Added line to install common.py above to the correct location. From 0adea5faa0718429f31e4a4b23b163a9bf78ba0e Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 22:53:37 +0100 Subject: [PATCH 27/66] * requestsync: Use the functions in the common.py file above to authenticate with Launchpad. * common.py: Check that the file written has Launchpad entries. * buildd: Use new functions in common.py. --- buildd | 3 ++- common.py | 27 ++++++++++++++++++++------- debian/changelog | 2 ++ requestsync | 22 +++++----------------- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/buildd b/buildd index 890bed6..aa4cf7b 100755 --- a/buildd +++ b/buildd @@ -37,7 +37,8 @@ operation: status | retry | rescore [priority (default 5000)]''' % sys.argv[0] sys.exit(1) # Prepare Launchpad cookie. -urlopener = common.prepareLaunchpadCookie() +launchpadCookie = common.prepareLaunchpadCookie() +urlopener = common.setupLaunchpadUrlOpener(launchpadCookie) # Find out the version in given release. try: diff --git a/common.py b/common.py index d3e2def..4f4ec4c 100644 --- a/common.py +++ b/common.py @@ -50,10 +50,10 @@ def prepareLaunchpadCookie(): # Unable to find an correct file. if launchpad_cookiefile == None: - print >> sys.stderr, 'Could not find cookie file for Launchpad " \ - "(looked in " \ %s)' % ", ".join(try_globs) - print >> sys.stderr, 'You should be able to create a valid file by " \ - "logging into Launchpad with Firefox' + print >> sys.stderr, "Could not find cookie file for Launchpad. " + print >> sys.stderr, "Looked in: %s" % ", ".join(try_globs) + print >> sys.stderr, "You should be able to create a valid file by " \ + "logging into Launchpad with Firefox." sys.exit(1) # Found SQLite file. Parse information from it. @@ -64,7 +64,7 @@ def prepareLaunchpadCookie(): cur = con.cursor() cur.execute("select host, path, isSecure, expiry, name, value from moz_cookies where host like ?", ['%%launchpad%%']) - + ftstr = ["FALSE", "TRUE"] newLPCookie = open("%s/.lpcookie.txt" % os.environ.get('HOME'), 'w') @@ -78,13 +78,26 @@ def prepareLaunchpadCookie(): newLPCookie.write("\n") # New line. newLPCookie.close() + + # Check what we have written. + checkCookie = open("%s/.lpcookie.txt" % os.environ.get('HOME')).read() + if checkCookie == "# HTTP Cookie File.\n\n": + print >> sys.stderr, "No Launchpad cookies were written to file. " \ + "Please visit and log into Launchpad and run this script again." + os.remove("%s/.lpcookie.txt" % os.environ.get('HOME')) # Delete file. + sys.exit(1) + launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME') print "Using cookie file at: %s." % launchpad_cookiefile - # Build HTML opener with cookie file. + # Return the Launchpad cookie. + return launchpad_cookiefile + +def setupLaunchpadUrlOpener(cookie): + """ Build HTML opener with cookie file. """ cj = cookielib.MozillaCookieJar() - cj.load(launchpad_cookiefile) + cj.load(cookie) urlopener = urllib2.build_opener() urlopener.add_handler(urllib2.HTTPCookieProcessor(cj)) diff --git a/debian/changelog b/debian/changelog index 5839d89..637e87c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low to authenticate with Launchpad. * debian/ubuntu-dev-tools.install: Added line to install common.py above to the correct location. + * requestsync: Use the functions in the common.py file above to authenticate + with Launchpad [ Siegfried-Angel Gevatter Pujals ] * Add the GNU General Public License header to all scripts. diff --git a/requestsync b/requestsync index 96bce89..4a54c59 100755 --- a/requestsync +++ b/requestsync @@ -255,23 +255,11 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext): print >> sys.stderr, 'Importing launchpadbugs failed. Is python-launchpad-bugs installed?' return False - # Search cookiefile (for authentication to lp) - if launchpad_cookiefile == None: - try_globs = ('~/.lpcookie.txt', '~/.mozilla/*/*/cookies.sqlite', '~/.mozilla/*/*/cookies.txt') - for try_glob in try_globs: - try: - cookiefile = glob.glob(os.path.expanduser(try_glob))[0] - except IndexError: - continue - # Found: - launchpad_cookiefile = cookiefile - print "Using cookie file at «%s».\n" % launchpad_cookiefile - break - - if launchpad_cookiefile == None: - print >> sys.stderr, 'Could not find cookie file for Launchpad (looked in %s)' % ", ".join(try_globs) - print >> sys.stderr, 'You should be able to create a valid file by logging into Launchpad with Firefox' - return False + # Use functions from ubuntu-dev-tools to create Launchpad cookie file. + sys.path.append('/usr/share/ubuntu-dev-tools/') + import common + + launchpad_cookiefile = common.prepareLaunchpadCookie() if source_package: product = {'name': source_package, 'target': 'ubuntu'} From fb7bb815e0c3eee19b60019bafd3d2913e3420b5 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 23:15:47 +0100 Subject: [PATCH 28/66] * common.py: Use sqlite3 instead of pysqlite2 as it forms part of Python 2.5. * debian/control: Changed XS-Python-Version to >= 2.5. --- common.py | 2 +- debian/changelog | 3 ++- debian/control | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common.py b/common.py index 4f4ec4c..3abb47d 100644 --- a/common.py +++ b/common.py @@ -58,7 +58,7 @@ def prepareLaunchpadCookie(): # Found SQLite file. Parse information from it. if launchpad_cookiefile.find('cookies.sqlite') != -1: - from pysqlite2 import dbapi2 as sqlite + import sqlite3 as sqlite con = sqlite.connect(launchpad_cookiefile) diff --git a/debian/changelog b/debian/changelog index 637e87c..f8d0bb4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,7 +14,8 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * debian/ubuntu-dev-tools.install: Added line to install common.py above to the correct location. * requestsync: Use the functions in the common.py file above to authenticate - with Launchpad + with Launchpad. + * debian/control: Changed XS-Python-Version to >= 2.5. [ Siegfried-Angel Gevatter Pujals ] * Add the GNU General Public License header to all scripts. diff --git a/debian/control b/debian/control index 4e351fb..c9290d3 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/trunk Vcs-Browser: http://codebrowse.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/trunk/changes Build-Depends: cdbs (>= 0.4.49), debhelper (>= 5), python-all-dev (>= 2.4) Build-Depends-Indep: python-central (>= 0.5) -XS-Python-Version: all +XS-Python-Version: >= 2.5 Homepage: https://launchpad.net/ubuntu-dev-tools/ Standards-Version: 3.8.0 From eab57aec2834afde79809f3cc422e00260089657 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 11 Aug 2008 23:45:07 +0100 Subject: [PATCH 29/66] * get-branches: Now check team option before anything else. --- debian/changelog | 1 + get-branches | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index f8d0bb4..5f3afd5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * requestsync: Use the functions in the common.py file above to authenticate with Launchpad. * debian/control: Changed XS-Python-Version to >= 2.5. + * get-branches: Now check team option before anything else. [ Siegfried-Angel Gevatter Pujals ] * Add the GNU General Public License header to all scripts. diff --git a/get-branches b/get-branches index 2cb248f..caccf23 100755 --- a/get-branches +++ b/get-branches @@ -48,6 +48,15 @@ def main(): (options, args) = optParser.parse_args() # Parse our options. + # No flags, and no team name specified. + if not options.lpteam and not args: + print >> sys.stderr, "No team has been specified." + optParser.print_help() + sys.exit(1) + + if args: + team = args[0] + # Dictionary settings. if options.directory: try: @@ -71,7 +80,7 @@ def main(): # Launchpad team setting. if options.lpteam: try: - team = args[0] + team = args[optsParsed] optsParsed += 1 except IndexError: print >> sys.stderr, "The '-t' option requires an argument." @@ -97,14 +106,6 @@ def main(): else: operation_type = "branch" - # No flags, and no team name specified. - if not options.lpteam and not args: - print >> sys.stderr, "No team has been specified." - optParser.print_help() - sys.exit(1) - elif args: - team = args[optsParsed] - pwd = os.getcwd() os.chdir(directory) From 4a493b0c7a5dbc3ba1fe7a8f27f2cc38e29db9c1 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 00:09:01 +0100 Subject: [PATCH 30/66] * get-branches: Check that the team has branches before downloading. --- debian/changelog | 6 ++++-- get-branches | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5f3afd5..f682eb3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,10 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] - * get-branches: Open the teams code page before making a new directory. + * get-branches: + - Open the teams code page before making a new directory. + - Now check team option before anything else. + - Check that the team has branches before downloading. * doc/get-branches.1: Created. * hugdaylist: Improved argument and error handling. * pull-lp-source: @@ -16,7 +19,6 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * requestsync: Use the functions in the common.py file above to authenticate with Launchpad. * debian/control: Changed XS-Python-Version to >= 2.5. - * get-branches: Now check team option before anything else. [ Siegfried-Angel Gevatter Pujals ] * Add the GNU General Public License header to all scripts. diff --git a/get-branches b/get-branches index caccf23..28eaafb 100755 --- a/get-branches +++ b/get-branches @@ -118,12 +118,6 @@ def main(): print >> sys.stderr, "Perhaps invalid team name?" sys.exit(1) - try: - os.makedirs(team) - except: - pass - os.chdir(team) - branch_list_page = sock.read() sock.close() @@ -132,6 +126,18 @@ def main(): print "Downloading all branches for the team '%s'. This may take some " \ "time." % team + + # Check the team actually has branches. + if len(branch_page_urls) == 0: + print "The team '%s' does not have any branches on Launchpad." % team + os.rmdir(team) + sys.exit(0) + + try: + os.makedirs(team) + except: + pass + os.chdir(team) for url in branch_page_urls: sock = urllib2.urlopen("https://code.launchpad.net/%s" % url) From 05c55bfbe298cb7421d118ab420d8162aadbaf3c Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 13:52:05 +0100 Subject: [PATCH 31/66] * common.py: Removed print "Using cookie file" line. * requestsync: - Using the Launchpad cookie file, validate that the user is a member the ubuntu-dev team on Launchpad. Thus, checking if the user needs sponsership or not (LP: #130648). * doc/requestsync.1: Removed mention of -s flag. Obsoleted by the above. --- common.py | 2 -- debian/changelog | 9 ++++++-- doc/requestsync.1 | 5 ---- requestsync | 59 +++++++++++++++++++++++++++++++++-------------- 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/common.py b/common.py index 3abb47d..15b7c08 100644 --- a/common.py +++ b/common.py @@ -89,8 +89,6 @@ def prepareLaunchpadCookie(): launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME') - print "Using cookie file at: %s." % launchpad_cookiefile - # Return the Launchpad cookie. return launchpad_cookiefile diff --git a/debian/changelog b/debian/changelog index f682eb3..30a35bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,8 +16,13 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low to authenticate with Launchpad. * debian/ubuntu-dev-tools.install: Added line to install common.py above to the correct location. - * requestsync: Use the functions in the common.py file above to authenticate - with Launchpad. + * requestsync: + - Use the functions in the common.py file above to authenticate with + Launchpad. + - Using the Launchpad cookie file, validate that the user is a member of + the ubuntu-dev team on Launchpad. Thus, checking if the user needs + sponsership or not (LP: #130648). + * doc/requestsync.1: Removed mention of -s flag. Obsoleted by the above. * debian/control: Changed XS-Python-Version to >= 2.5. [ Siegfried-Angel Gevatter Pujals ] diff --git a/doc/requestsync.1 b/doc/requestsync.1 index 2734455..8a24602 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -29,11 +29,6 @@ Display a help message and exit. Specifies that the package is a new package, and requestsync should not attempt to look it up in Ubuntu since it will not exist. .TP -.B \-s -Specifies that you require sponsorship. -You need this option if you are not a member of ubuntu-dev for universe or -multiverse, or ubuntu-core-dev for main or restricted. -.TP .B \-k \fI\fR Specifies your GPG key. Can also be set with the line `\fIexport GPGKEY=\fR' in your shell's diff --git a/requestsync b/requestsync index 4a54c59..dba24dd 100755 --- a/requestsync +++ b/requestsync @@ -8,6 +8,7 @@ # Michael Bienia (python-launchpad-bugs support) # Daniel Hahler # Iain Lane +# Jonathan Patrick Davies # # ################################################################## # @@ -24,17 +25,45 @@ # # ################################################################## -import os, sys, urllib, subprocess, getopt +import getopt +import os +import re +import subprocess +import sys +import urllib from debian_bundle.changelog import Version -# Set this to the path of your Launchpad cookie file, when using -# python-launchpad-bugs support (--lp). -# The following will be tried automatically, if unset (first match gets used): -# 1. ~/.lpcookie.txt -# 2. ~/.mozilla/*/*/cookies.sqlite -# 3. ~/.mozilla/*/*/cookies.txt -launchpad_cookiefile = None +# Use functions from ubuntu-dev-tools to create Launchpad cookie file. +sys.path.append('/usr/share/ubuntu-dev-tools/') +import common + +launchpad_cookiefile = common.prepareLaunchpadCookie() +def checkNeedsSponsorship(): + """ + Check that the user has the appropriate permissions by checking what + Launchpad returns while authenticating with their cookie. + + If they are an indirect or direct member of the ~ubuntu-dev team on + Launchpad - sponsorship is not required. + + The prepareLaunchpadCookie function above shall ensure that a cookie + file exists first. + """ + urlopener = common.setupLaunchpadUrlOpener(launchpad_cookiefile) + + ubuntuDevLPPage = urlopener.open('https://launchpad.net/~ubuntu-dev').read() + + if 'You are not a member of this team:' in ubuntuDevLPPage: + print "You are not a member (direct or indirect) of the ~ubuntu-dev " \ + "team on Launchpad." + print "Your sync request shall require an approval by a member of " \ + "either the ubuntu-main-sponsors or the ubuntu-universe-sponsors " \ + "team," + print "before it is processed by a member of the Ubuntu Archive admins." + return True # Sponsorship required. + else: + return False # Sponsorship not required. def cur_version_component(sourcepkg, release): '''Determine current package version in ubuntu.''' @@ -247,7 +276,6 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext): Return True if successfully posted, otherwise False.''' import glob, os.path - global launchpad_cookiefile try: import launchpadbugs.connector @@ -255,11 +283,7 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext): print >> sys.stderr, 'Importing launchpadbugs failed. Is python-launchpad-bugs installed?' return False - # Use functions from ubuntu-dev-tools to create Launchpad cookie file. - sys.path.append('/usr/share/ubuntu-dev-tools/') - import common - - launchpad_cookiefile = common.prepareLaunchpadCookie() + print "Using cookie file at", launchpad_cookiefile if source_package: product = {'name': source_package, 'target': 'ubuntu'} @@ -311,7 +335,7 @@ def edit_report(subject, body, changes_required=False): program exits. Returns (new_subject, new_body). """ - import re, string + import string report = "Summary (one line):\n%s\n\nDescription:\n%s" % (subject, body) @@ -361,16 +385,17 @@ if __name__ == '__main__': need_interaction = False try: - opts, args = getopt.gnu_getopt(sys.argv[1:], 'hnsk:', ('lp')) + opts, args = getopt.gnu_getopt(sys.argv[1:], 'hnk:', ('lp')) except getopt.GetoptError: usage() for o, a in opts: if o == '-h': usage() if o == '-n': newsource = True - if o == '-s': sponsorship = True if o == '-k': keyid = a if o == '--lp': use_lp_bugs = True + sponsorship = checkNeedsSponsorship() + if len(args) not in (2, 3): usage() From d6a19fc638c7a0c74bb3220782ed037034cf94ce Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 14:07:51 +0100 Subject: [PATCH 32/66] * requestsync: - Print usage before checking for sponsorship. - Restore 're' import to where it was. --- requestsync | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requestsync b/requestsync index dba24dd..3882188 100755 --- a/requestsync +++ b/requestsync @@ -27,7 +27,6 @@ import getopt import os -import re import subprocess import sys import urllib @@ -335,7 +334,8 @@ def edit_report(subject, body, changes_required=False): program exits. Returns (new_subject, new_body). """ - import string + import re + import string report = "Summary (one line):\n%s\n\nDescription:\n%s" % (subject, body) @@ -393,14 +393,14 @@ if __name__ == '__main__': if o == '-n': newsource = True if o == '-k': keyid = a if o == '--lp': use_lp_bugs = True - - sponsorship = checkNeedsSponsorship() if len(args) not in (2, 3): usage() if not use_lp_bugs and not get_email_address(): sys.exit(1) + + sponsorship = checkNeedsSponsorship() (srcpkg, release) = args[:2] force_base_ver = None From 0d993122eaaeca8bf1f8fdc706de9833a1165bb5 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 14:19:52 +0100 Subject: [PATCH 33/66] * setup.py: - Install buildd. - Use a #!/usr/bin/python header. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2783b87..0833139 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python from distutils.core import setup import glob @@ -16,6 +16,7 @@ if os.path.exists(changelog): setup(name='ubuntu-dev-tools', version=version, scripts=['404main', + 'buildd', 'check-symbols', 'dch-repeat', 'dgetlp', From 00b3977dd80988957c2fcdb91712ad7d97b8d041 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 14:31:06 +0100 Subject: [PATCH 34/66] * requestsync: Remove any other mentions of the "-s" flag. --- requestsync | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requestsync b/requestsync index 3882188..5e52d41 100755 --- a/requestsync +++ b/requestsync @@ -149,7 +149,7 @@ def raw_input_exit_on_ctrlc(*args, **kwargs): sys.exit(1) def usage(): - print '''Usage: requestsync [-h|-n|-s|-k |--lp] [basever] + print '''Usage: requestsync [-h|-n|-k |--lp] [basever] In some cases, the base version (fork point from Debian) cannot be determined automatically, and you'll get a complete Debian changelog. Specify the correct @@ -158,7 +158,6 @@ base version of the package in Ubuntu. Options: -h print this help -n new source package (doesn't exist yet in Ubuntu) - -s request sponsoring (through ubuntu-{main,universe}-sponsors) -k sign email with (only used when submitting per email) --lp use python-launchpad-bugs instead of email for bug submitting ''' From 615bf224cc4e7448b66fd3904d37e8093cd7012d Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 14:43:02 +0100 Subject: [PATCH 35/66] * massfile: Use the functions in the common.py file above to authenticate with Launchpad. --- debian/changelog | 3 +++ massfile | 34 ++++++---------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/debian/changelog b/debian/changelog index 30a35bf..8c501d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,9 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low the ubuntu-dev team on Launchpad. Thus, checking if the user needs sponsership or not (LP: #130648). * doc/requestsync.1: Removed mention of -s flag. Obsoleted by the above. + * massfile: + - Use the functions in the common.py file above to authenticate with + Launchpad. * debian/control: Changed XS-Python-Version to >= 2.5. [ Siegfried-Angel Gevatter Pujals ] diff --git a/massfile b/massfile index 7927820..2db25b7 100755 --- a/massfile +++ b/massfile @@ -85,6 +85,12 @@ def check_configfiles(): def file_bug(config): Bug = Connector.ConnectBug() + + sys.path.append('/usr/share/ubuntu-dev-tools/') + import common + + cookie = common.prepareLaunchpadCookie() + Bug.authentication = cookie try: @@ -122,39 +128,11 @@ def read_buglist(url): packages.add(bug.sourcepackage) return packages - -def lp_cookie(): - global cookie - cookie = None - - # Search cookiefile (for authentication to lp) - if cookie == None: - try_globs = ('~/.lpcookie.txt', '~/.mozilla/*/*/cookies.sqlite', '~/.mozilla/*/*/cookies.txt') - for try_glob in try_globs: - try: - cookiefile = glob.glob(os.path.expanduser(try_glob))[0] - except IndexError: - continue - # Found: - print "Using cookie file at «%s».\n" % cookiefile - cookie = cookiefile - break - - if cookie == None: - raise RuntimeError("Could not find cookie file for Launchpad \ -(looked in %s). You should be able to create a valid file by logging into \ -Launchpad with Firefox") % ", ".join(try_globs) def main(): if not check_configfiles(): sys.exit(1) - try: - lp_cookie() - except RuntimeError, e: - print e - sys.exit(1) - config = read_config() pack_list = read_list() buglist = read_buglist(config["buglist-url"]) From f88e66ffdd635e3567a7f49e6069659b9cfff579 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 14:46:29 +0100 Subject: [PATCH 36/66] * massfile: And here too. --- massfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/massfile b/massfile index 2db25b7..54fa27d 100755 --- a/massfile +++ b/massfile @@ -29,6 +29,10 @@ import glob import launchpadbugs.connector as Connector +sys.path.append('/usr/share/ubuntu-dev-tools/') +import common + +cookie = common.prepareLaunchpadCookie() def read_config(): instructions_file = open("instructions") @@ -55,8 +59,7 @@ def read_list(): def file_bug(): Bug = Connector.ConnectBug() - Bug.authentication = os.path.expanduser("~/.lpcookie") - + Bug.authentication = cookie def check_configfiles(): result = True @@ -86,11 +89,6 @@ def check_configfiles(): def file_bug(config): Bug = Connector.ConnectBug() - sys.path.append('/usr/share/ubuntu-dev-tools/') - import common - - cookie = common.prepareLaunchpadCookie() - Bug.authentication = cookie try: From 6d1aa801fe3c6279fcea1c133592825f6ff8670c Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 14:53:15 +0100 Subject: [PATCH 37/66] * debian/changelog: 0.37ubuntu1 uploaded to Ubuntu - new changelog entry added. --- debian/changelog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8c501d5..f14c423 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low + + * Changes go here. + + -- Jonathan Patrick Davies Tue, 12 Aug 2008 14:52:34 +0100 + ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] @@ -33,7 +39,7 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * Remove files AUTHORS (it duplicated content from debian/copyright) and README (superseded by the manpages). - -- Siegfried-Angel Gevatter Pujals Mon, 11 Aug 2008 19:44:53 +0200 + -- Jonathan Patrick Davies Tue, 12 Aug 2008 14:48:35 +0100 ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low From ff50620915114c5e117539970e5826f55a71e5e4 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 15:42:55 +0100 Subject: [PATCH 38/66] * requestsync: Check if user is a member of ubuntu-core-dev if sync request is for a package in main. --- debian/changelog | 4 +++- requestsync | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index f14c423..563fbca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low - * Changes go here. + [ Jonathan Patrick Davies ] + * requestsync: Check if user is a member of ubuntu-core-dev if sync request + is for a package in main. -- Jonathan Patrick Davies Tue, 12 Aug 2008 14:52:34 +0100 diff --git a/requestsync b/requestsync index 5e52d41..7d28373 100755 --- a/requestsync +++ b/requestsync @@ -38,27 +38,36 @@ import common launchpad_cookiefile = common.prepareLaunchpadCookie() -def checkNeedsSponsorship(): +def checkNeedsSponsorship(component): """ Check that the user has the appropriate permissions by checking what Launchpad returns while authenticating with their cookie. If they are an indirect or direct member of the ~ubuntu-dev team on - Launchpad - sponsorship is not required. + Launchpad - sponsorship is not required if the package is in the + universe / multiverse component. + + If they are in the ~ubuntu-core-dev team, no sponsorship required. The prepareLaunchpadCookie function above shall ensure that a cookie file exists first. """ urlopener = common.setupLaunchpadUrlOpener(launchpad_cookiefile) - ubuntuDevLPPage = urlopener.open('https://launchpad.net/~ubuntu-dev').read() + if component in ['main', 'restricted']: + team = "ubuntu-core-dev" + sponsor = "ubuntu-main-sponsors" + teamLPPage = urlopener.open('https://launchpad.net/~%s').read() + else: + team = "ubuntu-dev" + sponsor = "ubuntu-universe-sponsors" + teamLPPage = urlopener.open('https://launchpad.net/~%s').read() - if 'You are not a member of this team:' in ubuntuDevLPPage: - print "You are not a member (direct or indirect) of the ~ubuntu-dev " \ - "team on Launchpad." + if 'You are not a member of this team:' in teamLPPage: + print "You are not a member (direct or indirect) of the %s " \ + "team on Launchpad." % team print "Your sync request shall require an approval by a member of " \ - "either the ubuntu-main-sponsors or the ubuntu-universe-sponsors " \ - "team," + "the %s team." % sponsor print "before it is processed by a member of the Ubuntu Archive admins." return True # Sponsorship required. else: @@ -399,7 +408,6 @@ if __name__ == '__main__': if not use_lp_bugs and not get_email_address(): sys.exit(1) - sponsorship = checkNeedsSponsorship() (srcpkg, release) = args[:2] force_base_ver = None @@ -411,6 +419,8 @@ if __name__ == '__main__': debiancomponent = debian_component(srcpkg) deb_version = cur_deb_version(srcpkg) + + sponsorship = checkNeedsSponsorship(component) if deb_version == cur_ver: print 'The versions in Debian and Ubuntu are the same already (%s). Aborting.' % (deb_version,) From 575e8e76d46820b7cb4442fa83dc5de1ee627401 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 15:46:44 +0100 Subject: [PATCH 39/66] * requestsync: Added left out '% team' to urlopen(). --- requestsync | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requestsync b/requestsync index 7d28373..bc22028 100755 --- a/requestsync +++ b/requestsync @@ -57,14 +57,14 @@ def checkNeedsSponsorship(component): if component in ['main', 'restricted']: team = "ubuntu-core-dev" sponsor = "ubuntu-main-sponsors" - teamLPPage = urlopener.open('https://launchpad.net/~%s').read() else: team = "ubuntu-dev" sponsor = "ubuntu-universe-sponsors" - teamLPPage = urlopener.open('https://launchpad.net/~%s').read() + + teamLPPage = urlopener.open('https://launchpad.net/~%s' % team).read() if 'You are not a member of this team:' in teamLPPage: - print "You are not a member (direct or indirect) of the %s " \ + print "You are not a member (direct or indirect) of the '%s' " \ "team on Launchpad." % team print "Your sync request shall require an approval by a member of " \ "the %s team." % sponsor From b0528dd32ed4ec1ddede2028dd366324d28b7c42 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 18:18:11 +0100 Subject: [PATCH 40/66] * requestsync: Fixes to permission checking. * common.py: Change cookie file permissions to read and write only by user. --- common.py | 16 ++++++++++++---- debian/changelog | 1 + requestsync | 28 ++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/common.py b/common.py index 15b7c08..54b4182 100644 --- a/common.py +++ b/common.py @@ -67,7 +67,11 @@ def prepareLaunchpadCookie(): ftstr = ["FALSE", "TRUE"] - newLPCookie = open("%s/.lpcookie.txt" % os.environ.get('HOME'), 'w') + # This shall be where our new cookie file lives - at ~/.lpcookie.txt + newLPCookieLocation = "%s/.lpcookie.txt" % os.environ.get('HOME') + + # Open file for writing. + newLPCookie = open(newLPCookieLocation, 'w') newLPCookie.write("# HTTP Cookie File.\n") # Header. for item in cur.fetchall(): @@ -77,16 +81,20 @@ def prepareLaunchpadCookie(): ftstr[item[2]], item[3], item[4], item[5])) newLPCookie.write("\n") # New line. - newLPCookie.close() + newLPCookie.close() # And close file. # Check what we have written. - checkCookie = open("%s/.lpcookie.txt" % os.environ.get('HOME')).read() + checkCookie = open(newLPCookieLocation).read() if checkCookie == "# HTTP Cookie File.\n\n": print >> sys.stderr, "No Launchpad cookies were written to file. " \ "Please visit and log into Launchpad and run this script again." - os.remove("%s/.lpcookie.txt" % os.environ.get('HOME')) # Delete file. + os.remove(newLPCookieLocation) # Delete file. sys.exit(1) + # For security reasons, change file mode to write and read + # only by owner. + os.chmod(newLPCookieLocation, 0600) + launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME') # Return the Launchpad cookie. diff --git a/debian/changelog b/debian/changelog index 563fbca..d3259be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] * requestsync: Check if user is a member of ubuntu-core-dev if sync request is for a package in main. + * common.py: Change cookie file permissions to read and write only by user. -- Jonathan Patrick Davies Tue, 12 Aug 2008 14:52:34 +0100 diff --git a/requestsync b/requestsync index bc22028..7575216 100755 --- a/requestsync +++ b/requestsync @@ -53,25 +53,37 @@ def checkNeedsSponsorship(component): file exists first. """ urlopener = common.setupLaunchpadUrlOpener(launchpad_cookiefile) - + + # Check where the package is and assign the appropriate variables. if component in ['main', 'restricted']: team = "ubuntu-core-dev" sponsor = "ubuntu-main-sponsors" else: team = "ubuntu-dev" sponsor = "ubuntu-universe-sponsors" + + # Try and open up Launchpad. + try: teamLPPage = urlopener.open('https://launchpad.net/~%s' % team).read() + except urllib2.HTTPError: + print >> sys.stderr, "Unable to connect to Launchpad." + + # Check if they are a member of the team. + if "You are an indirect member of this team:" in teamLPPage or \ + "You are a member of this team." in teamLPPage: + return False # Sponsorship not required. - teamLPPage = urlopener.open('https://launchpad.net/~%s' % team).read() - - if 'You are not a member of this team:' in teamLPPage: + # Check if they are not. + if "You are not a member of this team" in teamLPPage: print "You are not a member (direct or indirect) of the '%s' " \ "team on Launchpad." % team print "Your sync request shall require an approval by a member of " \ - "the %s team." % sponsor - print "before it is processed by a member of the Ubuntu Archive admins." + "the '%s'\nteam, who shall be subscribed to this bug report." % sponsor + print "This must be done before it can be processed by a member of " \ + "the Ubuntu Archive team." + print "Should the above be incorrect, please press Control-C now to " \ + "stop this script now\nand check the cookie file at:", launchpad_cookiefile + raw_input_exit_on_ctrlc() # Abort if necessary. return True # Sponsorship required. - else: - return False # Sponsorship not required. def cur_version_component(sourcepkg, release): '''Determine current package version in ubuntu.''' From 381a361c83b2bd32a04c854e1687b35402afb4fe Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 18:32:45 +0100 Subject: [PATCH 41/66] * debian/changelog: - 0.38ubuntu1 uploaded for fixes. - Added new entry. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index d3259be..fb49496 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low + + * Changes go here. + + -- Jonathan Patrick Davies Tue, 12 Aug 2008 18:32:05 +0100 + ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] From a37b0de3223ee9a770d8aef23c5f05954064edde Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 18:43:21 +0100 Subject: [PATCH 42/66] * common.py: Use os.path.expanduser() instead of os.environ. --- common.py | 4 ++-- debian/changelog | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common.py b/common.py index 54b4182..2cd3aa5 100644 --- a/common.py +++ b/common.py @@ -68,7 +68,7 @@ def prepareLaunchpadCookie(): ftstr = ["FALSE", "TRUE"] # This shall be where our new cookie file lives - at ~/.lpcookie.txt - newLPCookieLocation = "%s/.lpcookie.txt" % os.environ.get('HOME') + newLPCookieLocation = os.path.expanduser("~/lpcookie.txt") # Open file for writing. newLPCookie = open(newLPCookieLocation, 'w') @@ -95,7 +95,7 @@ def prepareLaunchpadCookie(): # only by owner. os.chmod(newLPCookieLocation, 0600) - launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME') + launchpad_cookiefile = newLPCookieLocation # Return the Launchpad cookie. return launchpad_cookiefile diff --git a/debian/changelog b/debian/changelog index fb49496..0d58ec2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low - * Changes go here. + [ Jonathan Patrick Davies ] + * common.py: Use os.path.expanduser() instead of os.environ. -- Jonathan Patrick Davies Tue, 12 Aug 2008 18:32:05 +0100 From 8d89a43e4bbbed59936827b741b76d8f576a0810 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 18:48:56 +0100 Subject: [PATCH 43/66] * common.py: Use os.path.expanduser() instead of os.environ. --- common.py | 4 ++-- debian/changelog | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common.py b/common.py index 54b4182..7dac683 100644 --- a/common.py +++ b/common.py @@ -68,7 +68,7 @@ def prepareLaunchpadCookie(): ftstr = ["FALSE", "TRUE"] # This shall be where our new cookie file lives - at ~/.lpcookie.txt - newLPCookieLocation = "%s/.lpcookie.txt" % os.environ.get('HOME') + newLPCookieLocation = os.path.expanduser("~/.lpcookie.txt") # Open file for writing. newLPCookie = open(newLPCookieLocation, 'w') @@ -95,7 +95,7 @@ def prepareLaunchpadCookie(): # only by owner. os.chmod(newLPCookieLocation, 0600) - launchpad_cookiefile = "%s/.lpcookie.txt" % os.environ.get('HOME') + launchpad_cookiefile = newLPCookieLocation # Return the Launchpad cookie. return launchpad_cookiefile diff --git a/debian/changelog b/debian/changelog index fb49496..0d58ec2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low - * Changes go here. + [ Jonathan Patrick Davies ] + * common.py: Use os.path.expanduser() instead of os.environ. -- Jonathan Patrick Davies Tue, 12 Aug 2008 18:32:05 +0100 From 0faf0bc3e59e2fe3bd425e7ef762caf7df616b5d Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Tue, 12 Aug 2008 20:15:15 +0200 Subject: [PATCH 44/66] Relicense Kees' scripts to GPLv3+. Add sbuild as alternative recommend to pbuilder. --- common.py | 35 ++++++++++++++++++----------------- dch-repeat | 5 +++-- debian/changelog | 10 +++++++++- debian/control | 2 +- debian/copyright | 17 +++++++++-------- mk-sbuild-lv | 5 +++-- pull-debian-debdiff | 5 +++-- what-patch | 5 +++-- 8 files changed, 49 insertions(+), 35 deletions(-) diff --git a/common.py b/common.py index 2cd3aa5..521026c 100644 --- a/common.py +++ b/common.py @@ -1,27 +1,28 @@ # -# common.py - provides functions which are commonly used by the -# ubuntu-dev-tools package. +# common.py - provides functions which are commonly used by the +# ubuntu-dev-tools package. # -# Copyright (C) 2008 Jonathan Patrick Davies +# Copyright (C) 2008 Jonathan Patrick Davies # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# Some of the functions are based upon code written by Martin Pitt +# and Kees Cook . # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# ################################################################## # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## -# Based on code written by Martin Pitt and -# Kees Cook . - -""" Necessary modules. """ import cookielib import glob import os.path diff --git a/dch-repeat b/dch-repeat index c32938e..47e870c 100755 --- a/dch-repeat +++ b/dch-repeat @@ -7,14 +7,15 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2. +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# See file /usr/share/common-licenses/GPL-2 for more details. +# See file /usr/share/common-licenses/GPL for more details. # # ################################################################## # diff --git a/debian/changelog b/debian/changelog index 0d58ec2..07b2d0d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,15 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] * common.py: Use os.path.expanduser() instead of os.environ. - -- Jonathan Patrick Davies Tue, 12 Aug 2008 18:32:05 +0100 + [ Siegfried-Angel Gevatter Pujals ] + * debian/control: + - Add sbuild as an alternative recommends to pbuilder. + * what-patch, pull-debian-debdiff, mk-sbuild-lv, dch-repat, debian/copyright: + - Change the license of all scripts from Kees Cook to the GPL version 3 + or later. + - Order the script names alphabetically in debian/copyright. + + -- Siegfried-Angel Gevatter Pujals Tue, 12 Aug 2008 20:09:42 +0200 ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low diff --git a/debian/control b/debian/control index c9290d3..bd300e0 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Package: ubuntu-dev-tools Architecture: all Section: devel Depends: ${python:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), python-debian, dctrl-tools, lsb-release, diffstat, dpkg-dev -Recommends: bzr, pbuilder, reportbug (>= 3.39ubuntu1) +Recommends: bzr, pbuilder | sbuild, reportbug (>= 3.39ubuntu1) Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) XB-Python-Version: ${python:Versions} diff --git a/debian/copyright b/debian/copyright index 8e64534..252b5fc 100644 --- a/debian/copyright +++ b/debian/copyright @@ -39,9 +39,9 @@ Copyright: Licenses: -404main, check-symbols, dch-repeat, dgetlp, mk-sbuild-lv, pbuilder-dist, -requestsync, reverse-build-depends, submittodebian, update-maintainer -and what-patch are licensed under GPLv2: +404main, check-symbols, dgetlp, pbuilder-dist, requestsync, +reverse-build-depends, submittodebian and update-maintainer are licensed +under the GNU General Public License, version 2: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,8 +55,9 @@ and what-patch are licensed under GPLv2: On Debian systems, the complete text of the GNU General Public License v2 can be found in `/usr/share/common-licenses/GPL-2'. -get-branches, get-build-deps, debian-pull-debdiff, massfile, ppaput, -suspicious-source and pull-lp-source are licensed under GPLv3: +dch-repeat, get-branches, get-build-deps, massfile, mk-sbuild-lv, ppaput, +pull-debian-debdiff, pull-lp-source, suspicious-source and what-patch are +licensed under the GNU General Public License, version 3: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,6 +72,6 @@ On Debian systems, the complete text of the GNU General Public License v3 can be found in `/usr/share/common-licenses/GPL-3'. The following of the scripts can be used, at your option, regarding any -later version of the previously specified license: 404main, pbuilder-dist, -dgetlp, reverse-build-depends, suspicious-source, pull-lp-source and -get-build-deps. +later version of the previously specified license: 404main, dch-repeat, dgetlp, +get-build-deps, mk-sbuild-lv, pull-debian-debdiff, pull-lp-source, +reverse-build-depends, suspicious-source, what-patch. diff --git a/mk-sbuild-lv b/mk-sbuild-lv index 444fed7..07fd920 100755 --- a/mk-sbuild-lv +++ b/mk-sbuild-lv @@ -7,14 +7,15 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2. +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# See file /usr/share/common-licenses/GPL-2 for more details. +# See file /usr/share/common-licenses/GPL for more details. # # ################################################################## # diff --git a/pull-debian-debdiff b/pull-debian-debdiff index 37f3cd8..eb0fd60 100755 --- a/pull-debian-debdiff +++ b/pull-debian-debdiff @@ -6,14 +6,15 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 3. +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# See file /usr/share/common-licenses/GPL-3 for more details. +# See file /usr/share/common-licenses/GPL for more details. # # ################################################################## # diff --git a/what-patch b/what-patch index 90d3f47..c7bcd54 100755 --- a/what-patch +++ b/what-patch @@ -8,14 +8,15 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2. +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# See file /usr/share/common-licenses/GPL-2 for more details. +# See file /usr/share/common-licenses/GPL for more details. # # ################################################################## # From 728bb807d5c727d41621b6e77ae0c85d21f88fbc Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Wed, 13 Aug 2008 10:56:53 +0100 Subject: [PATCH 45/66] Better handle errors when going to LP --- debian/changelog | 5 ++- pull-lp-source | 83 +++++++++++++++++++++++++++++++----------------- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5e233d0..67f4635 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,7 +13,10 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low * common.py: - Add functions mkdir and readlist. - -- Siegfried-Angel Gevatter Pujals Tue, 12 Aug 2008 20:09:42 +0200 + [ Iain Lane ] + * pull-lp-source: Better handle errors when going to LP + + -- Iain Lane Wed, 13 Aug 2008 10:56:12 +0100 ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low diff --git a/pull-lp-source b/pull-lp-source index f666743..abf338c 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -34,26 +34,26 @@ from optparse import OptionParser class BackportFromLP: - def __getitem__(self, name): - return getattr(self, name) - - def __init__(self, package, target_release): - self.package = package - self.target_release = target_release - self.__prepare_sources() - - def __prepare_sources(self): - # Scrape the source package from Launchpad :) - contents = urllib2.urlopen('https://launchpad.net/ubuntu/%(target_release)s/+source/%(package)s' % self).read() - links = re.findall('a href=\"(.*\.dsc)\"', contents) - - if len(links) == 1 and \ - subprocess.call(['dget', '-x', 'http://launchpad.net%s' % links[0]]) == 0: - print '\nSuccess!' - else: - raise ValueError, '\nFailed to fetch and extract the source. ' +\ - 'Ensure that the package specified is a valid source ' +\ - 'package name and that Launchpad is not down.' + def __getitem__(self, name): + return getattr(self, name) + + def __init__(self, package, target_release): + self.package = package + self.target_release = target_release + self.__prepare_sources() + + def __prepare_sources(self): + # Scrape the source package from Launchpad :) + contents = urllib2.urlopen('https://launchpad.net/ubuntu/%(target_release)s/+source/%(package)s' % self).read() + links = re.findall('a href=\"(.*\.dsc)\"', contents) + + if len(links) == 1 and \ + subprocess.call(['dget', '-xu', 'http://launchpad.net%s' % links[0]]) == 0: + print '\nSuccess!' + else: + raise ValueError, '\nFailed to fetch and extract the source. ' +\ + 'Ensure that the package specified is a valid source ' +\ + 'package name and that Launchpad is not down.' default_release = 'intrepid' @@ -74,7 +74,7 @@ if __name__ == '__main__': else: release = os.getenv('DIST') or default_release - # Correct-ish args, can proceed. + # Correct-ish args, can proceed. # Check release by checking if Launchpad page exists try: urllib2.urlopen("https://launchpad.net/ubuntu/%s" % release) @@ -84,20 +84,43 @@ if __name__ == '__main__': sys.exit(1) # Check package exists. - sourcePage = urllib2.urlopen("https://launchpad.net/ubuntu/%s/+source/%s" % \ - (release, package)).read() - m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, \ - package.replace('+', '\+')), sourcePage) - if not m: - print >> sys.stderr, "The '%s' package does not appear to exist in " \ - "the '%s' release." % (package, release) + try: + + sourcePage = urllib2.urlopen("https://launchpad.net/ubuntu/%s/+source/%s" % \ + (release, package)).read() + m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, \ + package.replace('+', '\+')), sourcePage) + + if not m: + print >> sys.stderr, "The '%s' package does not appear to exist in " \ + "the '%s' release." % (package, release) + sys.exit(1) + + except urllib2.HTTPError, e: # Raised on 404 + + if e.code == 404: + + print >> sys.stderr, "The '%s' package does not appear to exist in " \ + "the '%s' release." % (package, release) + + else: # Other code, probably LP malfunction + + print >> sys.stderr, "Error when checking Launchpad for package: %s " % e + sys.exit(1) + except urllib2.URLError, e: # Other error (NXDOMAIN, ...) + + (_, reason) = e.reason + + print >> sys.stderr, "Error when checking Launchpad for package: %s " % reason + sys.exit(1) + # All good - start downloading... try: print 'Attempting to get %s from release %s...' % \ - (package, release.capitalize()) + (package, release.capitalize()) BackportFromLP(package, release) except ValueError, e: print 'Error when downloading package %s from release %s: %s.' % \ - (package, release, e) + (package, release, e) From e636aff6901c4e87de4452f4da72d9c61214df0a Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Wed, 13 Aug 2008 22:39:02 +0100 Subject: [PATCH 46/66] * buildd: - Added optparse support for option handling. - Added support to request the rebuilding of only one architecture. * hugdaylist: Improved number of bugs option handling. --- buildd | 82 +++++++++++++++++++++++++++++++++++------------- debian/changelog | 4 +++ hugdaylist | 12 ++----- 3 files changed, 67 insertions(+), 31 deletions(-) diff --git a/buildd b/buildd index aa4cf7b..7c45d65 100755 --- a/buildd +++ b/buildd @@ -3,7 +3,9 @@ # buildd - command line interface for Launchpad buildd operations. # # Copyright (C) 2007 Canonical Ltd. -# Author: Martin Pitt . +# Authors: +# - Martin Pitt +# - Jonathan Patrick Davies # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,23 +21,51 @@ # along with this program. If not, see . # -import urllib2 import re import sys +import urllib2 +from optparse import OptionGroup +from optparse import OptionParser from urllib import urlencode sys.path.append('/usr/share/ubuntu-dev-tools/') import common -# Parse arguments. -try: - (package, release, op) = sys.argv[1:] -except ValueError: - print >> sys.stderr, '''Usage: %s - -operation: status | retry | rescore [priority (default 5000)]''' % sys.argv[0] +# Prepare our option parser. +usage = "%prog " +optParser = OptionParser(usage) + +# Retry options +retryOptions = OptionGroup(optParser, "Retry options", + "These options may only be used with the 'retry' operation.") +retryOptions.add_option("-a", "--arch", type = "string", + action = "store", dest = "architecture", + help = "Try to rebuild a specific architecture.") + +# Add the retry options to the main group. +optParser.add_option_group(retryOptions) + +# Parse our options. +(options, args) = optParser.parse_args() + +# Check we have the correct number of arguments. +if len(args) < 3: + optParser.error("Incorrect number of arguments.") + +package = str(args[0]) +release = str(args[1]) +op = str(args[2]).lower() + +# Check our operation. +if op not in ("rescore", "retry", "status"): + print >> sys.stderr, "Invalid operation: %s." % op sys.exit(1) +# If the user has specified an architecture to build, we only wish to rebuild it +# and nothing else. +if options.architecture: oneArch = True +else: oneArch = False + # Prepare Launchpad cookie. launchpadCookie = common.prepareLaunchpadCookie() urlopener = common.setupLaunchpadUrlOpener(launchpadCookie) @@ -44,15 +74,24 @@ urlopener = common.setupLaunchpadUrlOpener(launchpadCookie) try: page = urlopener.open('https://launchpad.net/ubuntu/+source/' + package).read() except urllib2.HTTPError: - print >> sys.stderr, 'This source does not appear to exist in Ubuntu' + print >> sys.stderr, "The source package (%s) does not appear to exist " \ + "in Ubuntu." % package sys.exit(1) -m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, package.replace('+', '\+')), page) +m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, + package.replace('+', '\+')), page) if not m: - print >> sys.stderr, 'Cannot find this source package in this release' + print >> sys.stderr, "Cannot find this source package (%s) in this " \ + "release (%s)." % (package, release.capitalize()) sys.exit(1) + version = m.group(1) -print 'Source version:', version + +# Output details. +print "The source version for '%s' in %s is at %s." % (package, + release.capitalize(), version) + +print "Current build status for this package is as follows:" # Parse out build URLs, states, and arches. buildstats = {} @@ -62,7 +101,7 @@ page = page.read() for m in re.finditer('"/ubuntu/\+source/%s/%s(/\+build/\d+)"[^\n]+\n\s*(\w+).*?(\w+).*?\s*([^\n]+)\n' % (package.replace('+', '\+'), version.replace('+', '\+')), page, re.S): if m.group(2) == release: - print '%s: %s' % (m.group(3), m.group(4)) + print '%s: %s.' % (m.group(3), m.group(4)) buildstats[url + m.group(1)] = [m.group(3).strip(), m.group(4).strip()] # Operations. @@ -72,14 +111,15 @@ if op == 'status': for build, (arch, status) in buildstats.iteritems(): if op == 'rescore': if status == 'Needs building': - print 'rescoring', build, '(%s)' % arch - urlopener.open(build+'/+rescore', urlencode( + print 'Rescoring', build, '(%s).' % arch + urlopener.open(build + '/+rescore', urlencode( {'SCORE': '5000', 'RESCORE': '1'})) elif op == 'retry': if status in ('Failed to build', 'Chroot problem', 'Failed to upload'): - print 'retrying', build, '(%s)' % arch - urlopener.open(build+'/+retry', urlencode( + if oneArch and not options.architecture == arch: + # Skip this architecture. + continue + + print 'Retrying:', build, '(%s).' % arch + urlopener.open(build + '/+retry', urlencode( {'RETRY': '1'})) - else: - print >> sys.stderr, 'Invalid operation' - sys.exit(1) diff --git a/debian/changelog b/debian/changelog index 67f4635..0975c80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,10 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] * common.py: Use os.path.expanduser() instead of os.environ. + * buildd: + - Added optparse support for option handling. + - Added support to request the rebuilding of only one architecture. + * hugdaylist: Improved number of bugs option handling. [ Siegfried-Angel Gevatter Pujals ] * debian/control: diff --git a/hugdaylist b/hugdaylist index 3556322..8c9937c 100755 --- a/hugdaylist +++ b/hugdaylist @@ -54,22 +54,14 @@ def check_args(): argsParsed = 0 # Options - namely just the number of bugs to output. - optParser.add_option("-n", "--number", action = "store_true", + optParser.add_option("-n", "--number", type = "int", dest = "number", help = "Number of entries to output.") # Parse arguments. (options, args) = optParser.parse_args() # Check if we want a number other than the default. - if options.number: - try: - howmany = int(args[argsParsed]) - argsParsed += 1 - except: - print >> sys.stderr, "Option '-n' requires an integer for an " \ - "argument." - optParser.print_help() - sys.exit(1) + howmany = options.number # Check that we have an URL. if not args: From 8ba739394c65112319084fa520b3e668bce1e322 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Wed, 13 Aug 2008 23:20:55 +0100 Subject: [PATCH 47/66] * buildd: Check that the architecture specified is correct and that --arch is not used for incorrect operations. --- buildd | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/buildd b/buildd index 7c45d65..731be27 100755 --- a/buildd +++ b/buildd @@ -52,8 +52,8 @@ optParser.add_option_group(retryOptions) if len(args) < 3: optParser.error("Incorrect number of arguments.") -package = str(args[0]) -release = str(args[1]) +package = str(args[0]).lower() +release = str(args[1]).lower() op = str(args[2]).lower() # Check our operation. @@ -63,8 +63,18 @@ if op not in ("rescore", "retry", "status"): # If the user has specified an architecture to build, we only wish to rebuild it # and nothing else. -if options.architecture: oneArch = True -else: oneArch = False +if op != "retry" and options.architecture: + print >> sys.stderr, "Operation %s does not use the --arch option." % op + sys.exit(1) +elif op == "retry" and options.architecture: + if options.architecture not in ("sparc", "powerpc", "lpia", "ia64", "i386", + "hppa", "amd64"): + print >> sys.stderr, "Invalid architecture specified: %s." % options.architecture + sys.exit(1) + else: + oneArch = True +else: + oneArch = False # Prepare Launchpad cookie. launchpadCookie = common.prepareLaunchpadCookie() From abea053a514c58f8b24a9582c446f57bef3810d6 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Wed, 13 Aug 2008 23:24:59 +0100 Subject: [PATCH 48/66] * buildd: Improve usage notes. --- buildd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildd b/buildd index 731be27..86a3a97 100755 --- a/buildd +++ b/buildd @@ -31,8 +31,12 @@ from urllib import urlencode sys.path.append('/usr/share/ubuntu-dev-tools/') import common +# Usage. +usage = "%prog \n\n" +usage += "Where operation may be one of: rescore, retry, or status.\n" +usage += "Only Launchpad Buildd Admins may rescore package builds." + # Prepare our option parser. -usage = "%prog " optParser = OptionParser(usage) # Retry options From ba12b9a4d6a196a3bbcc15797d4d44374d9a7d0a Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Wed, 13 Aug 2008 23:37:06 +0100 Subject: [PATCH 49/66] * buildd: Allow the rescoring of one arch too. --- buildd | 22 +++++++++++----------- debian/changelog | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/buildd b/buildd index 86a3a97..4596373 100755 --- a/buildd +++ b/buildd @@ -40,14 +40,14 @@ usage += "Only Launchpad Buildd Admins may rescore package builds." optParser = OptionParser(usage) # Retry options -retryOptions = OptionGroup(optParser, "Retry options", - "These options may only be used with the 'retry' operation.") -retryOptions.add_option("-a", "--arch", type = "string", +retryRescoreOptions = OptionGroup(optParser, "Retry and rescore options", + "These options may only be used with the 'retry' and 'rescore' operations.") +retryRescoreOptions.add_option("-a", "--arch", type = "string", action = "store", dest = "architecture", - help = "Try to rebuild a specific architecture.") + help = "Rebuild or rescore a specific architecture.") # Add the retry options to the main group. -optParser.add_option_group(retryOptions) +optParser.add_option_group(retryRescoreOptions) # Parse our options. (options, args) = optParser.parse_args() @@ -67,10 +67,10 @@ if op not in ("rescore", "retry", "status"): # If the user has specified an architecture to build, we only wish to rebuild it # and nothing else. -if op != "retry" and options.architecture: +if op not in ("retry", 'rescore') and options.architecture: print >> sys.stderr, "Operation %s does not use the --arch option." % op sys.exit(1) -elif op == "retry" and options.architecture: +elif op in ("retry", "rescore") and options.architecture: if options.architecture not in ("sparc", "powerpc", "lpia", "ia64", "i386", "hppa", "amd64"): print >> sys.stderr, "Invalid architecture specified: %s." % options.architecture @@ -123,6 +123,10 @@ if op == 'status': sys.exit(0) for build, (arch, status) in buildstats.iteritems(): + if oneArch and not options.architecture == arch: + # Skip this architecture. + continue + if op == 'rescore': if status == 'Needs building': print 'Rescoring', build, '(%s).' % arch @@ -130,10 +134,6 @@ for build, (arch, status) in buildstats.iteritems(): {'SCORE': '5000', 'RESCORE': '1'})) elif op == 'retry': if status in ('Failed to build', 'Chroot problem', 'Failed to upload'): - if oneArch and not options.architecture == arch: - # Skip this architecture. - continue - print 'Retrying:', build, '(%s).' % arch urlopener.open(build + '/+retry', urlencode( {'RETRY': '1'})) diff --git a/debian/changelog b/debian/changelog index 0975c80..b4e726e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,8 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low * common.py: Use os.path.expanduser() instead of os.environ. * buildd: - Added optparse support for option handling. - - Added support to request the rebuilding of only one architecture. + - Added support to request the rebuilding or rescoring of only one + architecture. * hugdaylist: Improved number of bugs option handling. [ Siegfried-Angel Gevatter Pujals ] From a26bfee8bbbeda055c6c4584e538a2608d2701b7 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 10:43:20 +0100 Subject: [PATCH 50/66] * get-branches: Improved option handling. --- debian/changelog | 1 + get-branches | 101 +++++++++++++++++------------------------------ 2 files changed, 37 insertions(+), 65 deletions(-) diff --git a/debian/changelog b/debian/changelog index b4e726e..a925bf4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low - Added support to request the rebuilding or rescoring of only one architecture. * hugdaylist: Improved number of bugs option handling. + * get-branches: Improved option handling. [ Siegfried-Angel Gevatter Pujals ] * debian/control: diff --git a/get-branches b/get-branches index 28eaafb..3bd4364 100755 --- a/get-branches +++ b/get-branches @@ -21,7 +21,8 @@ # ################################################################## # # This script is used to checkout or branch all the Bazaar branches -# in a Launchpad team. +# of a Launchpad team. +# import os import re @@ -34,79 +35,49 @@ def main(): usage = "Usage: %prog [-d ] -t [-o ]" usage += "\nUsage: %prog " optParser = OptionParser(usage) - optsParsed = 0 # Our options. - optParser.add_option("-d", "--directory", action = "store_true", - dest = "directory", help = "Directory to download branches to.") - optParser.add_option("-t", "--team", action = "store_true", - dest = "lpteam", help = "Launchpad team to download branches from.") - optParser.add_option("-o", "--operation", action = "store_true", - dest = "operation", help = "Whether to branch or checkout the " \ - "Bazaar branches. May be either 'branch' or 'checkout'.") + optParser.add_option("-d", "--directory", action = "store", type = "string", + dest = "directory", default = ".", + help = "Directory to download branches to.") + optParser.add_option("-t", "--team", action = "store", type = "string", + dest = "lpteam", help = "Launchpad team to download branches from.") + optParser.add_option("-o", "--operation", action = "store", type = "string", + dest = "operation", default = "branch", + help = "Whether to branch or checkout the Bazaar branches. May be " \ + "either 'branch' or 'checkout'.") (options, args) = optParser.parse_args() - # Parse our options. - # No flags, and no team name specified. - if not options.lpteam and not args: - print >> sys.stderr, "No team has been specified." - optParser.print_help() - sys.exit(1) + # Parse our options aka Russian roulette time. + if len(args) != 1 and options.lpteam == None: + optParser.error("No team has been specified.") - if args: - team = args[0] - - # Dictionary settings. - if options.directory: - try: - directory = args[optsParsed] - optsParsed += 1 - except IndexError: - print >> sys.stderr, "The '-d' option requires an argument." - optParser.print_help() - sys.exit(1) - - if not os.path.isdir(directory): # Check that it is a directory. - print >> sys.stderr, "%s is not a valid directory." % directory - optParser.print_help() - sys.exit(1) - else: - directory = os.path.abspath(args[0]) - else: - # Otherwise use our current directory. - directory = os.getcwd() - # Launchpad team setting. if options.lpteam: - try: - team = args[optsParsed] - optsParsed += 1 - except IndexError: - print >> sys.stderr, "The '-t' option requires an argument." - optParser.print_help() - sys.exit(1) + team = str(options.lpteam).lower() + if args: + team = str(args[0]).lower() + directory = options.directory + + # Dictionary settings. + if not os.path.isdir(directory): # Check that it is a directory. + optParser.error("%s is not a valid directory." % directory) + # Type of Bazaar operation to perform. - if options.operation: - try: - operation_type = args[optsParsed] - optsParsed += 1 - except IndexError: - print >> sys.stderr, "The '-o' option requires an argument." - optParser.print_help() - sys.exit(1) + operation_type = str(options.operation).lower() - # Got an argument, check if it is valid. - if operation_type.lower() not in ("branch", "checkout"): - print >> sys.stderr, "Invalid operation '%s' for '-o' flag." % \ - operation_type - optParser.print_help() - sys.exit(1) - else: - operation_type = "branch" + # Got an argument, check if it is valid. + if operation_type.lower() not in ("branch", "checkout"): + optParser.error("Invalid operation '%s' for '-o' flag.") % \ + operation_type + + # Fetch our current directory to return to later. pwd = os.getcwd() + + # Change to the specified directory. os.chdir(directory) # Try to open the teams code page. @@ -124,19 +95,19 @@ def main(): branch_page_urls_regex = r'.* Date: Thu, 14 Aug 2008 10:50:04 +0100 Subject: [PATCH 51/66] * get-branches: Sub string for invalid operation correctly. --- get-branches | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/get-branches b/get-branches index 3bd4364..06204c0 100755 --- a/get-branches +++ b/get-branches @@ -69,9 +69,9 @@ def main(): operation_type = str(options.operation).lower() # Got an argument, check if it is valid. - if operation_type.lower() not in ("branch", "checkout"): - optParser.error("Invalid operation '%s' for '-o' flag.") % \ - operation_type + if operation_type not in ("branch", "checkout"): + optParser.error("Invalid operation '%s' for '-o' flag." % \ + operation_type) # Fetch our current directory to return to later. From f48309fd481ddb52569594e7ccade21cf9b42e33 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 11:02:27 +0100 Subject: [PATCH 52/66] * buildd: Do not rescore or retry successfully built packages. --- buildd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/buildd b/buildd index 4596373..e2d56c5 100755 --- a/buildd +++ b/buildd @@ -127,6 +127,12 @@ for build, (arch, status) in buildstats.iteritems(): # Skip this architecture. continue + if oneArch and options.architecture == arch: + if status in ('Successfully built'): + print "Package has been marked as successfully built on %s." % arch + print "A %s of this package shall not be requested." % op + sys.exit(0) + if op == 'rescore': if status == 'Needs building': print 'Rescoring', build, '(%s).' % arch From d84d81505046f87d1d800c5d6b11d825ce4311ec Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 11:20:28 +0100 Subject: [PATCH 53/66] * buildd: - Do not rescore packages not in the build queue. - Sort archs in order. --- buildd | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/buildd b/buildd index e2d56c5..6e2e10d 100755 --- a/buildd +++ b/buildd @@ -71,8 +71,8 @@ if op not in ("retry", 'rescore') and options.architecture: print >> sys.stderr, "Operation %s does not use the --arch option." % op sys.exit(1) elif op in ("retry", "rescore") and options.architecture: - if options.architecture not in ("sparc", "powerpc", "lpia", "ia64", "i386", - "hppa", "amd64"): + if options.architecture not in ("amd64", "hppa", "i386", "ia64", "lpia", + "powerpc", "sparc"): print >> sys.stderr, "Invalid architecture specified: %s." % options.architecture sys.exit(1) else: @@ -105,13 +105,14 @@ version = m.group(1) print "The source version for '%s' in %s is at %s." % (package, release.capitalize(), version) -print "Current build status for this package is as follows:" - # Parse out build URLs, states, and arches. buildstats = {} page = urlopener.open('https://launchpad.net/ubuntu/+source/%s/%s' % (package, version)) url = page.geturl() page = page.read() + +print "Current build status for this package is as follows:" + for m in re.finditer('"/ubuntu/\+source/%s/%s(/\+build/\d+)"[^\n]+\n\s*(\w+).*?(\w+).*?\s*([^\n]+)\n' % (package.replace('+', '\+'), version.replace('+', '\+')), page, re.S): if m.group(2) == release: @@ -127,12 +128,19 @@ for build, (arch, status) in buildstats.iteritems(): # Skip this architecture. continue + # Check if our package is successfully built and retry/rescore requested. if oneArch and options.architecture == arch: if status in ('Successfully built'): print "Package has been marked as successfully built on %s." % arch print "A %s of this package shall not be requested." % op sys.exit(0) + # Check if package is building, before rescoring. + if oneArch and options.architecture == arch: + if op == "rescore" and status not in ("Needs building"): + print "Package is not in the build queue on %s - shall not " \ + "rescore it." % arch + if op == 'rescore': if status == 'Needs building': print 'Rescoring', build, '(%s).' % arch From f588ea57cfa3d63bdb60a307235a5fb6a6ad3afa Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 12:18:44 +0100 Subject: [PATCH 54/66] * buildd: Improved build status checking and rescore requesting. --- buildd | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/buildd b/buildd index 6e2e10d..ab9dbd5 100755 --- a/buildd +++ b/buildd @@ -130,22 +130,28 @@ for build, (arch, status) in buildstats.iteritems(): # Check if our package is successfully built and retry/rescore requested. if oneArch and options.architecture == arch: - if status in ('Successfully built'): - print "Package has been marked as successfully built on %s." % arch + if status in ("Successfully built", "Currently building", + "Build for superseded Source", "Dependency wait"): + print "Package is marked as %s on %s." % (status.lower(), arch) print "A %s of this package shall not be requested." % op - sys.exit(0) - # Check if package is building, before rescoring. - if oneArch and options.architecture == arch: - if op == "rescore" and status not in ("Needs building"): + # Check if package is building, before rescoring. + if status not in ("Needs building") and op in ("rescore"): print "Package is not in the build queue on %s - shall not " \ "rescore it." % arch + + # Stop, no other architectures require checking. + sys.exit(0) if op == 'rescore': if status == 'Needs building': print 'Rescoring', build, '(%s).' % arch - urlopener.open(build + '/+rescore', urlencode( - {'SCORE': '5000', 'RESCORE': '1'})) + try: + urlopener.open(build + '/+rescore', urlencode( + {'SCORE': '5000', 'RESCORE': '1'})) + except: + print "Unable to request rescore of %s on %s." % (package, + arch) elif op == 'retry': if status in ('Failed to build', 'Chroot problem', 'Failed to upload'): print 'Retrying:', build, '(%s).' % arch From b65f74226c29a83a8d4398e7a7de467a3d21454c Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 12:24:50 +0100 Subject: [PATCH 55/66] 0.39ubuntu1 uploaded. New debian/changelog entry added. --- debian/changelog | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a925bf4..ac471d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,20 @@ +ubuntu-dev-tools (0.40ubuntu1) intrepid; urgency=low + + * Changes go here. + + -- Jonathan Patrick Davies Thu, 14 Aug 2008 12:23:41 +0100 + ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low + * Bazaar revision 169. + [ Jonathan Patrick Davies ] * common.py: Use os.path.expanduser() instead of os.environ. * buildd: - Added optparse support for option handling. - Added support to request the rebuilding or rescoring of only one architecture. + - Various other improvements. * hugdaylist: Improved number of bugs option handling. * get-branches: Improved option handling. @@ -22,7 +31,7 @@ ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low [ Iain Lane ] * pull-lp-source: Better handle errors when going to LP - -- Iain Lane Wed, 13 Aug 2008 10:56:12 +0100 + -- Jonathan Patrick Davies Thu, 14 Aug 2008 12:21:45 +0100 ubuntu-dev-tools (0.38ubuntu1) intrepid; urgency=low From efb92c73afc0ca41450c1476b2a49bf8e4f6e47b Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 19:50:13 +0100 Subject: [PATCH 56/66] * buildd: Code cleanup on single arch options. * doc/buildd.1: Created. * doc/requestsync.1: Added note about sponsorship detecting. --- buildd | 40 +++++++++++++++-------------------- debian/changelog | 5 ++++- doc/buildd.1 | 53 +++++++++++++++++++++++++++++++++++++++++++++++ doc/requestsync.1 | 13 ++++++++++++ 4 files changed, 87 insertions(+), 24 deletions(-) create mode 100644 doc/buildd.1 diff --git a/buildd b/buildd index ab9dbd5..7940f77 100755 --- a/buildd +++ b/buildd @@ -95,7 +95,7 @@ except urllib2.HTTPError: m = re.search('"/ubuntu/%s/\+source/%s/(\d[^"]+)"' % (release, package.replace('+', '\+')), page) if not m: - print >> sys.stderr, "Cannot find this source package (%s) in this " \ + print >> sys.stderr, "Unable to find this source package (%s) in this " \ "release (%s)." % (package, release.capitalize()) sys.exit(1) @@ -128,32 +128,26 @@ for build, (arch, status) in buildstats.iteritems(): # Skip this architecture. continue - # Check if our package is successfully built and retry/rescore requested. - if oneArch and options.architecture == arch: - if status in ("Successfully built", "Currently building", - "Build for superseded Source", "Dependency wait"): - print "Package is marked as %s on %s." % (status.lower(), arch) - print "A %s of this package shall not be requested." % op - - # Check if package is building, before rescoring. - if status not in ("Needs building") and op in ("rescore"): - print "Package is not in the build queue on %s - shall not " \ - "rescore it." % arch - - # Stop, no other architectures require checking. - sys.exit(0) - - if op == 'rescore': - if status == 'Needs building': + if op in ('rescore'): + if status in ('Needs building'): print 'Rescoring', build, '(%s).' % arch + try: urlopener.open(build + '/+rescore', urlencode( {'SCORE': '5000', 'RESCORE': '1'})) except: - print "Unable to request rescore of %s on %s." % (package, - arch) - elif op == 'retry': + print >> sys.stderr, "Unable to request rescore on %s." % arch + else: + print "Not rescoring on %s; status is: %s." % (arch, status.lower()) + + if op in ('retry'): # Retry requested. if status in ('Failed to build', 'Chroot problem', 'Failed to upload'): print 'Retrying:', build, '(%s).' % arch - urlopener.open(build + '/+retry', urlencode( - {'RETRY': '1'})) + + try: + urlopener.open(build + '/+retry', urlencode( + {'RETRY': '1'})) + except: # Error encountered while submitting request. + print >> sys.stderr, "Unable to request retry on %s." % arch + else: # The package does not require rebuilding. + print "Not retrying on %s; status is %s." % (arch, status.lower()) diff --git a/debian/changelog b/debian/changelog index ac471d2..8973b2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ ubuntu-dev-tools (0.40ubuntu1) intrepid; urgency=low - * Changes go here. + [ Jonathan Patrick Davies ] + * buildd: Code cleanup on single arch options. + * doc/buildd.1: Created. + * doc/requestsync.1: Added note about sponsorship detecting. -- Jonathan Patrick Davies Thu, 14 Aug 2008 12:23:41 +0100 diff --git a/doc/buildd.1 b/doc/buildd.1 new file mode 100644 index 0000000..1ca4cbb --- /dev/null +++ b/doc/buildd.1 @@ -0,0 +1,53 @@ +.TH BUILDD "1" "14 August 2008" "ubuntu-dev-tools" +.SH NAME +buildd \- command-line interface to Launchpad build operations + +.SH SYNOPSIS + +.B buildd + +.B buildd \-\-help + +.SH DESCRIPTION +.PP +\fBbuildd\fR provides a command line interface to the Launchpad build +operations. + +.PP +\fBbuildd\fR uses a cookie file stored at \fI~/.lpcookie.txt\fR to authenticate +to Launchpad. + +.SH OPERATIONS +.PP +Listed below are the available operations for \fBbuildd\fR: +.TP +.B status +Outputs the build status of the package on Launchpad on all architectures. +.TP +.B retry +Requests that the package has another attempt at rebuilding from source. This +shall only work if the package has \fIFailed to build\fR on Launchpad. +.TP +.B rescore +Requests that the packages build priority be raised in the build queue. Only +members of the Launchpad build administrators may issue this operation and may +only be performed on packages which \fINeed building\fR. + +.SH OPTIONS +.PP +Listed below are the command line options for \fBbuildd\fR: +.TP +.B \-h or \-\-help +Display a help message and exit. +.TP +.B \-a or \-\-architecture +Only available for \fIrescore\fR and \fIretry\fR operations only. This shall +only request the rebuilding/rescoring on the specified architecture only. + +.SH AUTHORS +.PP +\fBbuildd\fR was written by Martin Pitt , and +this manual page was written by Jonathan Patrick Davies . +.PP +Both are released under the terms of the GNU General Public License, version 3 +or (at your option) any later version. diff --git a/doc/requestsync.1 b/doc/requestsync.1 index 8a24602..a22617c 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -18,6 +18,19 @@ follows so that it can sign the mail and send it off to Launchpad. Alternatively a sync request can be filed directly using the launchpadbugs python module (option \fB\-\-lp\fR). \fBrequestsync\fR falls back to mail the sync request if submitting using the launchpadbugs module fails. + +.PP +\fBrequestsync\fR checks if you have the permissions to request the sync from +the archive administrators directly by checking if you are a member of the +\fI~ubuntu-dev\fR team (for universe/multiverse syncs) or a member of the +\fI~ubuntu-core-dev\fR team (for main/restricted syncs) on Launchpad. If you are +not a member of the appropriate team, the script shall subscribe the necessary +team with approval rights to the bug report for you. + +.PP +\fBrequestsync\fR uses a cookie file stored at \fI~/.lpcookie.txt\fR to +authenticate with Launchpad. + .SH OPTIONS .PP Listed below are the command line options for requestsync: From e5052d74a886ba54dfa43a45b7f61bb3e1250ea9 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 21:43:14 +0100 Subject: [PATCH 57/66] * Added note about Mozilla Firefox cookie file to doc/requestsync.1 and doc/buildd.1. --- doc/buildd.1 | 3 ++- doc/requestsync.1 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/buildd.1 b/doc/buildd.1 index 1ca4cbb..e79c814 100644 --- a/doc/buildd.1 +++ b/doc/buildd.1 @@ -15,7 +15,8 @@ operations. .PP \fBbuildd\fR uses a cookie file stored at \fI~/.lpcookie.txt\fR to authenticate -to Launchpad. +to Launchpad. This cookie is created on run from the Mozilla Firefox cookie +file at \fI~/.mozilla/*/*/cookies.sqlite\fR. .SH OPERATIONS .PP diff --git a/doc/requestsync.1 b/doc/requestsync.1 index a22617c..013f687 100644 --- a/doc/requestsync.1 +++ b/doc/requestsync.1 @@ -29,7 +29,8 @@ team with approval rights to the bug report for you. .PP \fBrequestsync\fR uses a cookie file stored at \fI~/.lpcookie.txt\fR to -authenticate with Launchpad. +authenticate with Launchpad. This cookie is created on run from the Mozilla +Firefox cookie file at \fI~/.mozilla/*/*/cookies.sqlite\fR. .SH OPTIONS .PP From 307417e56a5d9fc43476d84d3c85fc55a83e7526 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Thu, 14 Aug 2008 23:12:45 +0100 Subject: [PATCH 58/66] * common.py: What is with this little dot? --- common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.py b/common.py index e52618d..c091568 100644 --- a/common.py +++ b/common.py @@ -101,7 +101,7 @@ def prepareLaunchpadCookie(): ftstr = ["FALSE", "TRUE"] # This shall be where our new cookie file lives - at ~/.lpcookie.txt - newLPCookieLocation = os.path.expanduser("~/lpcookie.txt") + newLPCookieLocation = os.path.expanduser("~/.lpcookie.txt") # Open file for writing. newLPCookie = open(newLPCookieLocation, 'w') From 1359d918152f47f5a3f4ef738988eb098e5921b4 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Fri, 15 Aug 2008 22:08:10 +0100 Subject: [PATCH 59/66] * requestsync: Suggest using the --lp flag when mailing a request encounters a failure. --- debian/changelog | 2 ++ requestsync | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8973b2b..31ac87d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ ubuntu-dev-tools (0.40ubuntu1) intrepid; urgency=low * buildd: Code cleanup on single arch options. * doc/buildd.1: Created. * doc/requestsync.1: Added note about sponsorship detecting. + * requestsync: Suggest using the --lp flag when mailing a request encounters + a failure. -- Jonathan Patrick Davies Thu, 14 Aug 2008 12:23:41 +0100 diff --git a/requestsync b/requestsync index 7575216..22063bb 100755 --- a/requestsync +++ b/requestsync @@ -265,8 +265,12 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None) try: s = smtplib.SMTP(mailserver, mailserver_port) except socket.error, s: - print "ERROR: Could not connect to mailserver %s at port %s: %s (%i)" % \ + print sys.stderr, >> "Could not connect to mailserver %s at port %s: %s (%i)" % \ (mailserver, mailserver_port, s[1], s[0]) + print "The port %s may be firewalled. Please try using requestsync with" \ + % mailserver_port + print "the '--lp' flag to file a sync request with the launchpadbugs " \ + "module." return False # authenticate to the server From b961efe7c56e212f339c6dc4f578a849594dd946 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Sat, 16 Aug 2008 23:40:49 +0100 Subject: [PATCH 60/66] 0.40ubuntu1 uploaded to Ubuntu. --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 31ac87d..fdefb2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,13 +1,13 @@ ubuntu-dev-tools (0.40ubuntu1) intrepid; urgency=low - [ Jonathan Patrick Davies ] + * Bazaar revision 174. * buildd: Code cleanup on single arch options. * doc/buildd.1: Created. * doc/requestsync.1: Added note about sponsorship detecting. * requestsync: Suggest using the --lp flag when mailing a request encounters a failure. - -- Jonathan Patrick Davies Thu, 14 Aug 2008 12:23:41 +0100 + -- Jonathan Patrick Davies Sat, 16 Aug 2008 23:38:41 +0100 ubuntu-dev-tools (0.39ubuntu1) intrepid; urgency=low From 3919c682e6195842e4bd8bc60398dc1d5e1c72b2 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 18 Aug 2008 11:01:04 +0100 Subject: [PATCH 61/66] * requestsync: Correct print statement redirect to sys,stderr. --- debian/changelog | 6 ++++++ requestsync | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index fdefb2b..254398c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.40ubuntu2) intrepid; urgency=low + + * requestsync: Correct print statement redirect to sys,stderr. + + -- Jonathan Patrick Davies Mon, 18 Aug 2008 10:59:59 +0100 + ubuntu-dev-tools (0.40ubuntu1) intrepid; urgency=low * Bazaar revision 174. diff --git a/requestsync b/requestsync index 22063bb..9b3e834 100755 --- a/requestsync +++ b/requestsync @@ -265,7 +265,7 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None) try: s = smtplib.SMTP(mailserver, mailserver_port) except socket.error, s: - print sys.stderr, >> "Could not connect to mailserver %s at port %s: %s (%i)" % \ + print >> sys.stderr, "Could not connect to mailserver %s at port %s: %s (%i)" % \ (mailserver, mailserver_port, s[1], s[0]) print "The port %s may be firewalled. Please try using requestsync with" \ % mailserver_port From 9a34c5c27816499a0c8462ea2dcee3fa8c1afa29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Mon, 18 Aug 2008 12:07:45 +0200 Subject: [PATCH 62/66] Import urllib2. --- debian/changelog | 6 ++++++ requestsync | 1 + 2 files changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 254398c..5424366 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.40ubuntu3) intrepid; urgency=low + + * Import urllib2. + + -- Loic Minier Mon, 18 Aug 2008 12:07:27 +0200 + ubuntu-dev-tools (0.40ubuntu2) intrepid; urgency=low * requestsync: Correct print statement redirect to sys,stderr. diff --git a/requestsync b/requestsync index 9b3e834..e72f9e2 100755 --- a/requestsync +++ b/requestsync @@ -30,6 +30,7 @@ import os import subprocess import sys import urllib +import urllib2 from debian_bundle.changelog import Version # Use functions from ubuntu-dev-tools to create Launchpad cookie file. From 1fa64d54b048f05ba3d7591835f0ab8ac5099b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Mon, 18 Aug 2008 12:22:27 +0200 Subject: [PATCH 63/66] Replace .BB in doc/pbuilder-dist.1 with a newline to fix a syntax error. --- debian/changelog | 6 ++++++ doc/pbuilder-dist.1 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5424366..608cc05 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.40ubuntu4) UNRELEASED; urgency=low + + * Replace .BB in doc/pbuilder-dist.1 with a newline to fix a syntax error. + + -- Loic Minier Mon, 18 Aug 2008 12:21:58 +0200 + ubuntu-dev-tools (0.40ubuntu3) intrepid; urgency=low * Import urllib2. diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 index 3650246..db993f3 100644 --- a/doc/pbuilder-dist.1 +++ b/doc/pbuilder-dist.1 @@ -99,6 +99,6 @@ with \fBpbuilder\fP. and Jordan Mantha . On August 2007 it was mostly rewritten, and extended, by Siegfried-Angel Gevatter Pujals . -.BB + \fBpbuilder\-dist\fP is released under the GNU General Public License, version 2 or later. From 2875772fa69715e3f0f6f5adee0b96f381db83f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Mon, 18 Aug 2008 13:09:50 +0200 Subject: [PATCH 64/66] Drop spurious tab in buildd. --- buildd | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/buildd b/buildd index 7940f77..83c3605 100755 --- a/buildd +++ b/buildd @@ -86,7 +86,7 @@ urlopener = common.setupLaunchpadUrlOpener(launchpadCookie) # Find out the version in given release. try: - page = urlopener.open('https://launchpad.net/ubuntu/+source/' + package).read() + page = urlopener.open('https://launchpad.net/ubuntu/+source/' + package).read() except urllib2.HTTPError: print >> sys.stderr, "The source package (%s) does not appear to exist " \ "in Ubuntu." % package diff --git a/debian/changelog b/debian/changelog index 608cc05..31ceb53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ubuntu-dev-tools (0.40ubuntu4) UNRELEASED; urgency=low * Replace .BB in doc/pbuilder-dist.1 with a newline to fix a syntax error. + * Drop spurious tab in buildd. -- Loic Minier Mon, 18 Aug 2008 12:21:58 +0200 From 3407655c52c8369db99aedbc37f92f32697b601f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Mon, 18 Aug 2008 13:27:20 +0200 Subject: [PATCH 65/66] When https_proxy is in the environment, output a warning and disable it as urllib/urllib2 don't support it; see LP #122551. --- buildd | 7 +++++++ debian/changelog | 2 ++ 2 files changed, 9 insertions(+) diff --git a/buildd b/buildd index 83c3605..2e892d4 100755 --- a/buildd +++ b/buildd @@ -21,6 +21,7 @@ # along with this program. If not, see . # +import os import re import sys import urllib2 @@ -80,6 +81,12 @@ elif op in ("retry", "rescore") and options.architecture: else: oneArch = False +# Clear https_proxy env var as it's not supported in urllib/urllib2; see +# LP #122551 +if os.environ.has_key('https_proxy'): + print >> sys.stderr, "Ignoring https_proxy (no support in urllib/urllib2; see LP #122551)" + del os.environ['https_proxy'] + # Prepare Launchpad cookie. launchpadCookie = common.prepareLaunchpadCookie() urlopener = common.setupLaunchpadUrlOpener(launchpadCookie) diff --git a/debian/changelog b/debian/changelog index 31ceb53..b4e02a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ ubuntu-dev-tools (0.40ubuntu4) UNRELEASED; urgency=low * Replace .BB in doc/pbuilder-dist.1 with a newline to fix a syntax error. * Drop spurious tab in buildd. + * When https_proxy is in the environment, output a warning and disable it as + urllib/urllib2 don't support it; see LP #122551. -- Loic Minier Mon, 18 Aug 2008 12:21:58 +0200 From 884e3a857511d03d28a2798e484f3246f46dc716 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Wed, 20 Aug 2008 10:59:31 -0700 Subject: [PATCH 66/66] common.py: allow for multiple firefox instances, check all possible cookie files. --- common.py | 72 +++++++++++++++++++++++++----------------------- debian/changelog | 10 +++++-- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/common.py b/common.py index c091568..3c9cbfa 100644 --- a/common.py +++ b/common.py @@ -71,14 +71,17 @@ def prepareLaunchpadCookie(): try_globs = ('~/.lpcookie.txt', '~/.mozilla/*/*/cookies.sqlite', '~/.mozilla/*/*/cookies.txt') + cookie_file_list = [] if launchpad_cookiefile == None: for try_glob in try_globs: try: - cookiefile = glob.glob(os.path.expanduser(try_glob))[0] - except IndexError: - continue # Unable to glob file - carry on. - # Found: - launchpad_cookiefile = cookiefile + cookie_file_list += glob.glob(os.path.expanduser(try_glob)) + except: + pass + + for cookie_file in cookie_file_list: + launchpad_cookiefile = _check_for_launchpad_cookie(cookie_file) + if launchpad_cookiefile != None: break # Unable to find an correct file. @@ -88,51 +91,52 @@ def prepareLaunchpadCookie(): print >> sys.stderr, "You should be able to create a valid file by " \ "logging into Launchpad with Firefox." sys.exit(1) - - # Found SQLite file. Parse information from it. - if launchpad_cookiefile.find('cookies.sqlite') != -1: + + return launchpad_cookiefile + +def _check_for_launchpad_cookie(cookie_file): + # Found SQLite file? Parse information from it. + if cookie_file.find('cookies.sqlite') != -1: import sqlite3 as sqlite - - con = sqlite.connect(launchpad_cookiefile) - + + con = sqlite.connect(cookie_file) + cur = con.cursor() cur.execute("select host, path, isSecure, expiry, name, value from moz_cookies where host like ?", ['%%launchpad%%']) - + + # No matching cookies? Abort. + items = cur.fetchall() + if len(items) == 0: + return None + ftstr = ["FALSE", "TRUE"] - + # This shall be where our new cookie file lives - at ~/.lpcookie.txt newLPCookieLocation = os.path.expanduser("~/.lpcookie.txt") - + # Open file for writing. newLPCookie = open(newLPCookieLocation, 'w') + # For security reasons, change file mode to write and read + # only by owner. + os.chmod(newLPCookieLocation, 0600) newLPCookie.write("# HTTP Cookie File.\n") # Header. - - for item in cur.fetchall(): + + for item in items: # Write entries. newLPCookie.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % ( item[0], ftstr[item[0].startswith('.')], item[1], ftstr[item[2]], item[3], item[4], item[5])) - + newLPCookie.write("\n") # New line. newLPCookie.close() # And close file. - - # Check what we have written. - checkCookie = open(newLPCookieLocation).read() - if checkCookie == "# HTTP Cookie File.\n\n": - print >> sys.stderr, "No Launchpad cookies were written to file. " \ - "Please visit and log into Launchpad and run this script again." - os.remove(newLPCookieLocation) # Delete file. - sys.exit(1) - - # For security reasons, change file mode to write and read - # only by owner. - os.chmod(newLPCookieLocation, 0600) - - launchpad_cookiefile = newLPCookieLocation - # Return the Launchpad cookie. - return launchpad_cookiefile - + return newLPCookieLocation + else: + if open(cookie_file).read().find('launchpad.net') != -1: + return cookie_file + + return None + def setupLaunchpadUrlOpener(cookie): """ Build HTML opener with cookie file. """ cj = cookielib.MozillaCookieJar() diff --git a/debian/changelog b/debian/changelog index b4e02a8..4433ae8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,16 @@ -ubuntu-dev-tools (0.40ubuntu4) UNRELEASED; urgency=low +ubuntu-dev-tools (0.41) intrepid; urgency=low + [ Loic Minier ] * Replace .BB in doc/pbuilder-dist.1 with a newline to fix a syntax error. * Drop spurious tab in buildd. * When https_proxy is in the environment, output a warning and disable it as urllib/urllib2 don't support it; see LP #122551. - -- Loic Minier Mon, 18 Aug 2008 12:21:58 +0200 + [ Kees Cook ] + * common.py: allow for multiple firefox instances, check all possible + cookie files. + + -- Kees Cook Wed, 20 Aug 2008 10:58:24 -0700 ubuntu-dev-tools (0.40ubuntu3) intrepid; urgency=low @@ -132,6 +137,7 @@ ubuntu-dev-tools (0.36ubuntu1) intrepid; urgency=low manpages, etc). -- Jonathan Patrick Davies Sun, 10 Aug 2008 22:02:05 +0100 + ubuntu-dev-tools (0.35) intrepid; urgency=low [ Siegfried-Angel Gevatter Pujals ]