mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
command line options for cpio (default=off)
This commit is contained in:
parent
daf3516d1c
commit
d5ae3ef2b4
@ -550,6 +550,7 @@ def main(opts, argv):
|
||||
print 'Updating cache of required packages'
|
||||
|
||||
urllist = []
|
||||
if not opts.download_api_only:
|
||||
# transform 'url1, url2, url3' form into a list
|
||||
if 'urllist' in config:
|
||||
if type(config['urllist']) == str:
|
||||
@ -561,12 +562,15 @@ def main(opts, argv):
|
||||
# OBS 1.5 and before has no downloadurl defined in buildinfo
|
||||
if bi.downloadurl:
|
||||
urllist.append(bi.downloadurl + '/%(extproject)s/%(extrepository)s/%(arch)s/%(filename)s')
|
||||
elif not opts.cpio_bulk_download:
|
||||
urllist.append( '%(apiurl)s/build/%(project)s/%(repository)s/%(repoarch)s/%(repopackage)s/%(repofilename)s' )
|
||||
|
||||
fetcher = Fetcher(cachedir = config['packagecachedir'],
|
||||
urllist = urllist,
|
||||
api_host_options = config['api_host_options'],
|
||||
offline = opts.noinit,
|
||||
http_debug = config['http_debug'],
|
||||
enable_cpio = opts.cpio_bulk_download,
|
||||
cookiejar=cookiejar)
|
||||
|
||||
# now update the package cache
|
||||
|
@ -11,6 +11,7 @@ import cmdln
|
||||
import conf
|
||||
import oscerr
|
||||
import urlgrabber.progress
|
||||
from optparse import SUPPRESS_HELP
|
||||
|
||||
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
|
||||
.SH NAME
|
||||
@ -3241,6 +3242,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='Create -32bit/-64bit/-x86 rpms for other architectures')
|
||||
@cmdln.option('--release', metavar='N',
|
||||
help='set release number of the package to N')
|
||||
@cmdln.option('--cpio-bulk-download', action='store_true',
|
||||
help='enable downloading packages as cpio archive from api')
|
||||
@cmdln.option('--download-api-only', action='store_true',
|
||||
help=SUPPRESS_HELP)
|
||||
def do_build(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Build a package on your local machine
|
||||
|
||||
|
10
osc/fetch.py
10
osc/fetch.py
@ -24,7 +24,8 @@ def join_url(self, base_url, rel_url):
|
||||
|
||||
|
||||
class Fetcher:
|
||||
def __init__(self, cachedir = '/tmp', api_host_options = {}, urllist = [], http_debug = False, cookiejar = None, offline = False):
|
||||
def __init__(self, cachedir = '/tmp', api_host_options = {}, urllist = [], http_debug = False,
|
||||
cookiejar = None, offline = False, enable_cpio = False):
|
||||
|
||||
__version__ = '0.1'
|
||||
__user_agent__ = 'osbuild/%s' % __version__
|
||||
@ -41,6 +42,7 @@ class Fetcher:
|
||||
self.http_debug = http_debug
|
||||
self.offline = offline
|
||||
self.cpio = {}
|
||||
self.enable_cpio = enable_cpio
|
||||
|
||||
passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||
for host in api_host_options.keys():
|
||||
@ -91,7 +93,7 @@ class Fetcher:
|
||||
text = '%s(%s) %s' %(prefix, pac.project, pac.filename))
|
||||
self.move_package(tmpfile, pac.localdir, pac)
|
||||
except URLGrabError, e:
|
||||
if e.errno == 256:
|
||||
if self.enable_cpio and e.errno == 256:
|
||||
self.cpio.setdefault(pac.project, {})[pac.name] = pac
|
||||
return
|
||||
print
|
||||
@ -157,10 +159,10 @@ class Fetcher:
|
||||
try:
|
||||
# if there isn't a progress bar, there is no output at all
|
||||
if not self.progress_obj:
|
||||
print '%d/%d (%s) %s' % (done, needed, i.project, i.filename)
|
||||
print '%d/%d (%s) %s' % (done, all, i.project, i.filename)
|
||||
self.fetch(i)
|
||||
if self.progress_obj:
|
||||
print " %d/%d\r" % (done,needed),
|
||||
print " %d/%d\r" % (done,all),
|
||||
sys.stdout.flush()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
Loading…
Reference in New Issue
Block a user