merged changes from lp:ubuntu-dev-tools

This commit is contained in:
Markus Korn 2009-01-05 08:49:12 +01:00
commit 7e277c713c
6 changed files with 161 additions and 108 deletions

28
debian/changelog vendored
View File

@ -1,11 +1,33 @@
ubuntu-dev-tools (0.51) UNRELEASED; urgency=low
ubuntu-dev-tools (0.52) UNRELEASED; urgency=low
[ Siegfried-Angel Gevatter Pujals ]
* pbuilder-dist.new:
- Add compatibility for cowbuilder. Once pbuilder-dist.new replaces
pbuilder-dist, we will also create a cowbuilder-dist symlink to it.
[ Nathan Handler ]
* pull-debian-source:
- Pass -xu arguments to dget to be consistant with pull-lp-source
- Add support for packages with a name beginning with "lib"
[ Kees Cook ]
* mk-sbuild-lv: add --skip-updates to allow building security-only chroots.
-- Kees Cook <kees@ubuntu.com> Sat, 03 Jan 2009 10:44:02 -0800
ubuntu-dev-tools (0.51) jaunty; urgency=low
[ Jonathan Davies ]
* buildd: Added checks for arch-indep packages and packages which have no
builds in a release.
* hugdaylist: String improvements.
* requestsync:
- Use optparse instead of getopt for option parsing.
- Skip existing bug report check if python-launchpad-bugs is not
installed.
- Implemented sleeps to --lp bug reporting in case of a slow
Launchpad to stop mass bug filing (LP: #311289).
-- Jonathan Davies <jpds@ubuntu.com> Tue, 30 Dec 2008 15:51:55 +0000
-- Jonathan Davies <jpds@ubuntu.com> Tue, 30 Dec 2008 15:51:55 +0000
ubuntu-dev-tools (0.50.1) jaunty; urgency=low

View File

@ -18,16 +18,19 @@ Listed below are the command line options for mk\-sbuild\-lv:
What architecture to select (defaults to the native architecture).
.TP
.B \-\-name=NAME
Base name for the schroot (arch is appended)
Base name for the schroot (arch is appended).
.TP
.B \-\-personality=PERSONALITY
What personality to use (defaults to match \-\-arch)
What personality to use (defaults to match \-\-arch).
.TP
.B \-\-debug
Turn on script debugging
Turn on script debugging.
.TP
.B \-\-skip\-updates
Do not include the -updates pocket in the installed sources.list.
.TP
.B \-\-source\-template=FILE
Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild\-lv.sources)
Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild\-lv.sources).
.TP
.B \-\-debootstrap\-mirror=URL
Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia,
@ -36,16 +39,22 @@ official Ubuntu repositories for the supported architectures).
.SH ENVIRONMENT VARIABLES
.TP
.B LV_SIZE
Size of source LVs (defaults to 5G)
Size of source LVs (defaults to 5G).
.TP
.B SNAPSHOT_SIZE
Size of snapshot LVs (defaults to 4G)
Size of snapshot LVs (defaults to 4G).
.TP
.B SCHROOT_CONF_SUFFIX
Lines to append to schroot entries
Lines to append to schroot entries.
.TP
.B SKIP_UPDATES
Do not include the -updates pocket in the installed sources.list.
.SH FILES
.TP
.B $HOME/.mk\-sbuild\-lv.rc
Sourced for environment variables (defined above).
.TP
.B $HOME/.mk\-sbuild\-lv.sources
Can contain a customized sources.list.
It will be read when creating the schroot.

View File

@ -107,6 +107,7 @@ function usage()
echo " --name=NAME Base name for the schroot (arch is appended)"
echo " --personality=PERSONALITY What personality to use (defaults to match --arch)"
echo " --debug Turn on script debugging"
echo " --skip-updates Do not include -updates pocket in sources.list"
echo " --source-template=FILE Use FILE as the sources.list template"
echo " --debootstrap-mirror=URL Use URL as the debootstrap source"
echo ""
@ -114,6 +115,7 @@ function usage()
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})"
echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries"
echo " SKIP_UPDATES Enable --skip-updates"
exit 1
}
@ -121,7 +123,7 @@ function usage()
if [ -z "$1" ]; then
usage
fi
OPTS=`getopt -o '' --long "help,debug,arch:,name:,source-template:,debootstrap-mirror:,personality:" -- "$@"`
OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:" -- "$@"`
eval set -- "$OPTS"
name=""
@ -145,6 +147,10 @@ while :; do
personality="$2"
shift 2
;;
--skip-updates)
SKIP_UPDATES="1"
shift
;;
--name)
name="$2"
shift 2
@ -231,8 +237,14 @@ else
cat > "$TEMP_SOURCES" <<EOM
deb ${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu} RELEASE main restricted universe multiverse
deb-src ${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu} RELEASE main restricted universe multiverse
EOM
if [ -z "$SKIP_UPDATES" ]; then
cat >> "$TEMP_SOURCES" <<EOM
deb ${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu} RELEASE-updates main restricted universe multiverse
deb-src ${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu} RELEASE-updates main restricted universe multiverse
EOM
fi
cat >> "$TEMP_SOURCES" <<EOM
deb http://security.ubuntu.com/ubuntu RELEASE-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu RELEASE-security main restricted universe multiverse
EOM

View File

@ -35,7 +35,7 @@ debian_distros = ['etch', 'lenny', 'sid', 'stable', 'testing', 'unstable', 'expe
class pbuilder_dist:
def __init__(self):
def __init__(self, builder):
# Base directory where pbuilder will put all the files it creates.
self.base = None
@ -70,6 +70,9 @@ class pbuilder_dist:
# Authentication method
self.auth = 'sudo'
# Builder
self.builder = builder
##############################################################
if 'PBUILDFOLDER' in os.environ:
@ -110,25 +113,6 @@ class pbuilder_dist:
return getattr(self, name)
def _calculate(self):
""" pbuilder_dist.calculate(distro) -> None
Do all necessary variable changes (and therefore required checks)
before the string that will be executed is generated. At this
point it's expected that no more variables will be modified
outside this class.
"""
if not self.build_architecture:
self.chroot_string = self.target_distro
self.build_architecture = self.system_architecture
else:
self.chroot_string = '%(target_distro)s-%(build_architecture)s' % self
if not self.logfile:
self.logfile = '%(base)s.%(chroot_string)s.log' % self
def set_target_distro(self, distro):
""" pbuilder_dist.set_target_distro(distro) -> None
@ -162,8 +146,12 @@ class pbuilder_dist:
arguments = ('create', 'update', 'build', 'clean', 'login', 'execute')
if operation not in arguments:
if item_ends_with(arguments, '.dsc'):
if operation.endswith('.dsc'):
if os.path.isfile(operation):
self.operation = 'build'
else:
print 'Error: Could not find file «%s».' % operation
sys.exit(1)
else:
print 'Error: «%s» is not a recognized argument.' % operation
print 'Please use one of those: ' + ', '.join(arguments) + '.'
@ -179,20 +167,38 @@ class pbuilder_dist:
"""
# Calculate variables which depend on arguments given at runtime.
self._calculate()
if not self.build_architecture:
self.chroot_string = self.target_distro
self.build_architecture = self.system_architecture
else:
self.chroot_string = '%(target_distro)s-%(build_architecture)s' % self
prefix = os.path.join(self.base, self.chroot_string)
result = '%s_result/' % prefix
if not self.logfile:
self.logfile = os.path.normpath('%s/build.log' % result)
if not os.path.isdir(result):
# Create the results directory, if it doesn't exist.
os.makedirs(result)
if self.builder == 'pbuilder':
base = '--basetgz "%s-base.tgz"' % prefix
elif self.builder == 'cowbuilder':
base = '--basepath "%s-base.cow"' % prefix
arguments = [
self.operation,
'--basetgz "%(base)s%(chroot_string)s-base.tgz"' % self,
'--%s' % self.operation,
base,
'--distribution "%(target_distro)s"' % self,
'--buildresult "%(base)s%(chroot_string)s_result/"' % self,
'--logfile "%(logfile)s"' % self,
'--buildresult "%s"' % result,
'--logfile "%s"' % self.logfile,
'--aptcache "/var/cache/apt/archives/"',
### --mirror "${ARCHIVE}" \
'--override-config',
]
if os.path.exists('/var/cache/archive/'):
arguments.append('--bindmounts "/var/cache/archive/"')
@ -217,7 +223,7 @@ class pbuilder_dist:
if remaining_arguments:
arguments.extend(remaining_arguments)
return self.auth + ' /usr/sbin/pbuilder ' + ' '.join(arguments)
return self.auth + ' /usr/sbin/' + self.builder + ' ' + ' '.join(arguments)
def host_architecture():
""" host_architecture -> string
@ -229,20 +235,6 @@ def host_architecture():
return os.uname()[4].replace('x86_64', 'amd64').replace('i586', 'i386').replace('i686', 'i386')
def item_ends_with(list, string):
""" item_ends_with(list, string) -> bool
Return True if one of the items in list ends with the given string,
or else return False.
"""
for item in list:
if item.endswith(string):
return True
return False
def ask(question):
""" ask(question) -> string
@ -267,7 +259,7 @@ def help(exit_code = 0):
"""
print 'Bad...'
print 'See man pbuilder-dist for more information.'
sys.exit(exit_code)
@ -287,7 +279,8 @@ def main():
# Copy arguments into another list for save manipulation
args = sys.argv[1:]
if '-' in script_name and parts[0] != 'pbuilder' or len(parts) > 3:
if '-' in script_name and (parts[0] != 'pbuilder' and \
parts[0] != 'cowbuilder') or len(parts) > 3:
print 'Error: «%s» is not a valid name for a «pbuilder-dist» executable.' % script_name
sys.exit(1)
@ -298,9 +291,9 @@ def main():
if args[0] in ('-h', '--help', 'help'):
help(0)
app = pbuilder_dist()
app = pbuilder_dist(parts[0])
if len(parts) > 1:
if len(parts) > 1 and parts[1] != 'dist' and '.' not in parts[1]:
app.set_target_distro(parts[1])
else:
app.set_target_distro(args.pop(0))

View File

@ -28,7 +28,7 @@ my($release)=$ARGV[1] || 'unstable';
&checkRelease($release);
my($dsc)=&getDSC(&getMadison(&getURL($package,$release)));
print "$dsc\n";
exec("dget $dsc");
exec("dget -xu $dsc");
sub checkRelease {
my($release)=shift || die("No Release Passed To checkRelease!\n");
chomp $release;
@ -78,7 +78,13 @@ sub getDSC {
$version=~s/^.*?\://;
if($archs=~m/source/) {
print "Package: $package\nVersion: $version\nRelease: $release\nArchitectures: $archs\n";
my($firstLetter)=substr($package,0,1);
my($firstLetter);
if($package=~m/^lib/) {
$firstLetter="lib" . substr($package,3,1);
}
else {
$firstLetter=substr($package,0,1);
}
my($url)=$baseURL . $firstLetter . '/' . $package . '/' . $package . '_' . $version . '.dsc';
return $url;
}

View File

@ -25,13 +25,14 @@
#
# ##################################################################
import getopt
import os
import subprocess
import sys
import urllib
import urllib2
from debian_bundle.changelog import Version
from optparse import OptionParser
from time import sleep
# Use functions from ubuntu-dev-tools to create Launchpad cookie file.
sys.path.append('/usr/share/ubuntu-dev-tools/')
@ -76,6 +77,8 @@ def checkNeedsSponsorship(component):
print "If the above is correct please press Enter, otherwise please " \
"press Ctrl-C to stop this script now\nand check the cookie file " \
"at:", launchpad_cookiefile
print "Logging into Launchpad, deleting the above and rerunning this " \
"script should be enough to generate the cookie."
raw_input_exit_on_ctrlc() # Abort if necessary.
return True # Sponsorship required.
@ -87,10 +90,15 @@ def checkExistingReports(package):
If found ask for confirmation on filing a request.
"""
try:
launchpad = common.get_launchpad("ubuntu-dev-tools")
except ImportError:
print >> sys.stderr, 'Importing launchpadlib failed. Is python-launchpadlib installed?'
print >> sys.stderr, 'Importing launchpadlib failed. Is ' \
'python-launchpadlib installed?'
print >> sys.stderr, "Skipping existing report check, you should "\
"manually check at:"
print "- https://bugs.launchpad.net/ubuntu/+source/%s" % package
return False
# Fetch the package's bug list from Launchpad.
@ -210,23 +218,6 @@ def raw_input_exit_on_ctrlc(*args, **kwargs):
print 'Abort requested. No sync request filed.'
sys.exit(1)
def usage():
print '''Usage: requestsync [-d distro|-h|-n|-s|-k <keyid>|--lp] <source package> <target release> [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
base version of the package in Ubuntu.
Options:
-d distro Override Debian distribution to sync from [unstable].
-h Print this help.
-n New source package (doesn't exist yet in Ubuntu).
-s Specify that you require sponsorship.
-k <keyid> Sign email with <keyid> (only used when submitting per email).
--lp Use python-launchpad-bugs instead of email for bug submitting.
'''
sys.exit(1)
def get_email_address():
'''Get the DEBEMAIL environment variable or give an error.'''
myemailaddr = os.getenv('DEBEMAIL')
@ -370,7 +361,7 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
in_confirm_loop = False
break
else:
print "Invalid answer"
print "Invalid answer."
# Create bug
bug = launchpad.bugs.createBug(description=bugtext, title=bugtitle, target=product_url)
@ -384,7 +375,6 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
bug.subscribe(person=subscribe_url)
print 'Sync request filed as bug #%i: %s' % (bug.id, common.translate_api_web(bug.self_link))
return True
def edit_report(subject, body, changes_required=False):
@ -441,52 +431,73 @@ def edit_report(subject, body, changes_required=False):
#
if __name__ == '__main__':
newsource = False
sponsorship = False
keyid = None
use_lp_bugs = False
need_interaction = False
distro = 'unstable'
# Our usage options.
usage = "Usage: %prog [-d distro] [-k keyid] [-n] [--lp] [-s] <source "
usage += "package> <target release> [base version]"
optParser = OptionParser(usage)
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hsnd:k:', ('lp'))
except getopt.GetoptError:
usage()
for o, a in opts:
if o == '-h': usage()
if o == '-n': newsource = True
if o == '-k': keyid = a
if o == '-d': distro = a
if o == "-s": sponsorship = True
if o == '--lp': use_lp_bugs = True
optParser.add_option("-d", type = "string",
dest = "dist", default = "unstable",
help = "Debian distribution to sync from.")
optParser.add_option("-k", type = "string",
dest = "keyid", default = None,
help = "GnuPG key ID to use for signing report.")
optParser.add_option("-n", action = "store_true",
dest = "newpkg", default = False,
help = "Whether package to sync is a new package in Ubuntu.")
optParser.add_option("--lp", action = "store_true",
dest = "lpbugs", default = False,
help = "Specify whether to use the launchpadbugs module for filing " \
"report.")
optParser.add_option("-s", action = "store_true",
dest = "sponsor", default = False,
help = "Force sponsorship requirement (shall be autodetected if not " \
"specified).")
(options, args) = optParser.parse_args()
newsource = options.newpkg
sponsorship = options.sponsor
keyid = options.keyid
use_lp_bugs = options.lpbugs
need_interaction = False
distro = options.dist
if len(args) not in (2, 3):
usage()
optParser.error("Source package / target release missing - please " \
"specify.")
if not use_lp_bugs and not get_email_address():
sys.exit(1)
(srcpkg, release) = args[:2]
srcpkg = args[0]
release = args[1]
force_base_ver = None
if len(args) == 3:
force_base_ver = args[2]
# Base version specified.
if len(args) == 3: force_base_ver = args[2]
(cur_ver, component) = ('0', 'universe') # Let's assume universe
if not newsource:
(cur_ver, component) = cur_version_component(srcpkg, release)
# Find Ubuntu release's package version.
if not newsource: (cur_ver, component) = cur_version_component(srcpkg, release)
debiancomponent = debian_component(srcpkg, distro)
# Find Debian release's package version.
deb_version = cur_deb_version(srcpkg, distro)
# -s flag not specified - check if we do need sponsorship.
if not sponsorship: sponsorship = checkNeedsSponsorship(component)
# Debian and Ubuntu versions are the same - stop.
if deb_version == cur_ver:
print 'The versions in Debian and Ubuntu are the same already (%s). Aborting.' % (deb_version,)
sys.exit(1)
# -s flag not specified - check if we do need sponsorship.
if not sponsorship: sponsorship = checkNeedsSponsorship(component)
# Check for existing package reports.
if not newsource: checkExistingReports(srcpkg)
# generate bug report
# Generate bug report.
subscribe = 'ubuntu-archive'
status = 'confirmed'
if sponsorship: