mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-14 00:21:08 +00:00
* pbuilder-dist.new:
- Add compatibility for cowbuilder. Once pbuilder-dist.new replaces pbuilder-dist, we will also create a cowbuilder-dist symlink to it.
This commit is contained in:
parent
eee4c697d5
commit
190908d291
7
debian/changelog
vendored
7
debian/changelog
vendored
@ -11,7 +11,12 @@ ubuntu-dev-tools (0.51) UNRELEASED; urgency=low
|
||||
- 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
|
||||
[ 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.
|
||||
|
||||
-- Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> Fri, 02 Jan 2009 14:40:51 +0100
|
||||
|
||||
ubuntu-dev-tools (0.50.1) jaunty; urgency=low
|
||||
|
||||
|
@ -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,15 +167,33 @@ 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',
|
||||
@ -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
|
||||
|
||||
@ -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))
|
||||
@ -331,7 +324,7 @@ def main():
|
||||
app.set_operation(args.pop(0))
|
||||
|
||||
# Execute the pbuilder command
|
||||
sys.exit(os.system(app.get_command(args)))
|
||||
print app.get_command(args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user