mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-31 21:01:07 +00:00
Further progress with the pbuilder-dist rewrite.
This commit is contained in:
parent
da8c21b86f
commit
80435aaceb
@ -156,10 +156,13 @@ class pbuilder_dist:
|
|||||||
arguments = ('create', 'update', 'build', 'clean', 'login', 'execute')
|
arguments = ('create', 'update', 'build', 'clean', 'login', 'execute')
|
||||||
|
|
||||||
if operation not in arguments:
|
if operation not in arguments:
|
||||||
|
if item_ends_with(arguments, '.dsc'):
|
||||||
|
self.operation = 'build'
|
||||||
|
else:
|
||||||
print 'Error: «%s» is not a recognized argument.' % operation
|
print 'Error: «%s» is not a recognized argument.' % operation
|
||||||
print 'Please use one of those: ' + ', '.join(arguments) + '.'
|
print 'Please use one of those: ' + ', '.join(arguments) + '.'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
else:
|
||||||
self.operation = operation
|
self.operation = operation
|
||||||
|
|
||||||
def get_command(self, remaining_arguments = None):
|
def get_command(self, remaining_arguments = None):
|
||||||
@ -180,6 +183,7 @@ class pbuilder_dist:
|
|||||||
'--buildresult "%(base)s/%(chroot_string)s_result/"' % self,
|
'--buildresult "%(base)s/%(chroot_string)s_result/"' % self,
|
||||||
'--logfile "%(logfile)s"' % self,
|
'--logfile "%(logfile)s"' % self,
|
||||||
'--aptcache "/var/cache/apt/archives/"',
|
'--aptcache "/var/cache/apt/archives/"',
|
||||||
|
### --mirror "${ARCHIVE}" \
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.build_architecture != self.system_architecture:
|
if self.build_architecture != self.system_architecture:
|
||||||
@ -189,12 +193,13 @@ class pbuilder_dist:
|
|||||||
if self.proxy:
|
if self.proxy:
|
||||||
arguments.append('--http-proxy "%(proxy)s"' % self)
|
arguments.append('--http-proxy "%(proxy)s"' % self)
|
||||||
|
|
||||||
return self.auth + ' /usr/sbin/pbuilder ' + ' '.join(arguments)
|
### $( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \
|
||||||
|
|
||||||
"""
|
# Append remaining arguments
|
||||||
--mirror "${ARCHIVE}" \
|
if remaining_arguments:
|
||||||
$( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \
|
arguments.extend(remaining_arguments)
|
||||||
$@"""
|
|
||||||
|
return self.auth + ' /usr/sbin/pbuilder ' + ' '.join(arguments)
|
||||||
|
|
||||||
def host_architecture():
|
def host_architecture():
|
||||||
""" host_architecture -> string
|
""" host_architecture -> string
|
||||||
@ -206,6 +211,20 @@ def host_architecture():
|
|||||||
|
|
||||||
return os.uname()[4].replace('x86_64', 'amd64').replace('i586', 'i386').replace('i686', 'i386')
|
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):
|
def ask(question):
|
||||||
""" ask(question) -> string
|
""" ask(question) -> string
|
||||||
|
|
||||||
@ -294,8 +313,10 @@ def main():
|
|||||||
print 'Insufficient number of arguments.'
|
print 'Insufficient number of arguments.'
|
||||||
help(1)
|
help(1)
|
||||||
|
|
||||||
|
# Parse the operation
|
||||||
app.set_operation(args.pop(0))
|
app.set_operation(args.pop(0))
|
||||||
|
|
||||||
|
# Execute the pbuilder command
|
||||||
sys.exit(os.system(app.get_command(args)))
|
sys.exit(os.system(app.get_command(args)))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user