1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-15 01:56:17 +01:00

make it possible to run local source services on checkout/update

This commit is contained in:
Adrian Schröter 2010-06-08 11:24:10 +02:00
parent c6d417d6b7
commit 01d349d0e8
2 changed files with 19 additions and 17 deletions

View File

@ -2477,8 +2477,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='place PACKAGE folder in the current directory' \ help='place PACKAGE folder in the current directory' \
'instead of a PROJECT/PACKAGE directory') 'instead of a PROJECT/PACKAGE directory')
@cmdln.option('-s', '--source-service-files', action='store_true', @cmdln.option('-s', '--source-service-files', action='store_true',
help='server side generated files of source services' \ help='Use server side generated sources instead of local generation.' )
'gets downloaded as well' ) @cmdln.option('-S', '--server-side-source-service-files', action='store_true',
help='Use server side generated sources instead of local generation.' )
@cmdln.option('-l', '--limit-size', metavar='limit_size', @cmdln.option('-l', '--limit-size', metavar='limit_size',
help='Skip all files with a given size') help='Skip all files with a given size')
@cmdln.alias('co') @cmdln.alias('co')
@ -2511,10 +2512,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
expand_link = False expand_link = False
else: else:
expand_link = True expand_link = True
if opts.source_service_files:
service_files = True
else:
service_files = False
args = slash_split(args) args = slash_split(args)
project = package = filename = None project = package = filename = None
@ -2550,7 +2547,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.current_dir: if opts.current_dir:
project_dir = None project_dir = None
checkout_package(apiurl, project, package, rev, expand_link=expand_link, \ checkout_package(apiurl, project, package, rev, expand_link=expand_link, \
prj_dir=project_dir, service_files=service_files, progress_obj=self.download_progress, limit_size=opts.limit_size, meta=opts.meta) prj_dir=project_dir, service_files = opts.source_service_files, server_service_files=opts.server_side_source_service_files, progress_obj=self.download_progress, limit_size=opts.limit_size, meta=opts.meta)
print_request_list(apiurl, project, package) print_request_list(apiurl, project, package)
elif project: elif project:
@ -2570,13 +2567,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for package in meta_get_packagelist(apiurl, project): for package in meta_get_packagelist(apiurl, project):
try: try:
checkout_package(apiurl, project, package, expand_link = expand_link, \ checkout_package(apiurl, project, package, expand_link = expand_link, \
prj_dir = prj_dir, service_files = service_files, progress_obj=self.download_progress, limit_size=opts.limit_size, meta=opts.meta) prj_dir = prj_dir, service_files = opts.source_service_files, server_service_files = opts.server_side_source_service_files, progress_obj=self.download_progress, limit_size=opts.limit_size, meta=opts.meta)
except oscerr.LinkExpandError, e: except oscerr.LinkExpandError, e:
print >>sys.stderr, 'Link cannot be expanded:\n', e print >>sys.stderr, 'Link cannot be expanded:\n', e
print >>sys.stderr, 'Use "osc repairlink" for fixing merge conflicts:\n' print >>sys.stderr, 'Use "osc repairlink" for fixing merge conflicts:\n'
# check out in unexpanded form at least # check out in unexpanded form at least
checkout_package(apiurl, project, package, expand_link = False, \ checkout_package(apiurl, project, package, expand_link = False, \
prj_dir = prj_dir, service_files = service_files, progress_obj=self.download_progress, limit_size=opts.limit_size, meta=opts.meta) prj_dir = prj_dir, service_files = opts.source_service_files, server_service_files = opts.server_side_source_service_files, progress_obj=self.download_progress, limit_size=opts.limit_size, meta=opts.meta)
print_request_list(apiurl, project) print_request_list(apiurl, project)
else: else:
@ -2900,6 +2897,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='if a package is a link, update to the expanded sources') help='if a package is a link, update to the expanded sources')
@cmdln.option('-s', '--source-service-files', action='store_true', @cmdln.option('-s', '--source-service-files', action='store_true',
help='Use server side generated sources instead of local generation.' ) help='Use server side generated sources instead of local generation.' )
@cmdln.option('-S', '--server-side-source-service-files', action='store_true',
help='Use server side generated sources instead of local generation.' )
@cmdln.option('-l', '--limit-size', metavar='limit_size', @cmdln.option('-l', '--limit-size', metavar='limit_size',
help='Skip all files with a given size') help='Skip all files with a given size')
@cmdln.alias('up') @cmdln.alias('up')
@ -2935,9 +2934,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.WrongOptions('Sorry, the options --expand-link, --unexpand-link and ' raise oscerr.WrongOptions('Sorry, the options --expand-link, --unexpand-link and '
'--revision are mutually exclusive.') '--revision are mutually exclusive.')
if opts.source_service_files: service_files = True
else: service_files = False
args = parseargs(args) args = parseargs(args)
arg_list = args[:] arg_list = args[:]
@ -2991,17 +2987,20 @@ Please submit there instead, or use --nodevelproject to force direct submission.
rev = p.show_upstream_xsrcmd5(linkrev="base") rev = p.show_upstream_xsrcmd5(linkrev="base")
p.mark_frozen() p.mark_frozen()
else: else:
p.update(rev, service_files, opts.limit_size) p.update(rev, opts.server_side_source_service_files, opts.limit_size)
rev = p.linkinfo.xsrcmd5 rev = p.linkinfo.xsrcmd5
print 'Expanding to rev', rev print 'Expanding to rev', rev
elif opts.unexpand_link and p.islink() and p.isexpanded(): elif opts.unexpand_link and p.islink() and p.isexpanded():
print 'Unexpanding to rev', p.linkinfo.lsrcmd5 print 'Unexpanding to rev', p.linkinfo.lsrcmd5
p.update(rev, service_files, opts.limit_size) p.update(rev, opts.server_side_source_service_files, opts.limit_size)
rev = p.linkinfo.lsrcmd5 rev = p.linkinfo.lsrcmd5
elif p.islink() and p.isexpanded(): elif p.islink() and p.isexpanded():
rev = p.latest_rev() rev = p.latest_rev()
p.update(rev, service_files, opts.limit_size) p.update(rev, opts.server_side_source_service_files, opts.limit_size)
if opts.source_service_files:
print 'Running local source services'
p.run_source_services()
if opts.unexpand_link: if opts.unexpand_link:
p.unmark_frozen() p.unmark_frozen()
rev = None rev = None

View File

@ -3202,7 +3202,7 @@ def make_dir(apiurl, project, package, pathname=None, prj_dir=None):
def checkout_package(apiurl, project, package, def checkout_package(apiurl, project, package,
revision=None, pathname=None, prj_obj=None, revision=None, pathname=None, prj_obj=None,
expand_link=False, prj_dir=None, service_files=None, progress_obj=None, limit_size=None, meta=False): expand_link=False, prj_dir=None, server_service_files = None, service_files=None, progress_obj=None, limit_size=None, meta=False):
try: try:
# the project we're in might be deleted. # the project we're in might be deleted.
# that'll throw an error then. # that'll throw an error then.
@ -3248,7 +3248,7 @@ def checkout_package(apiurl, project, package,
for filename in p.filenamelist: for filename in p.filenamelist:
if filename in p.skipped: if filename in p.skipped:
continue continue
if service_files or not filename.startswith('_service:'): if server_service_files or not filename.startswith('_service:'):
p.updatefile(filename, revision) p.updatefile(filename, revision)
# print 'A ', os.path.join(project, package, filename) # print 'A ', os.path.join(project, package, filename)
print statfrmt('A', os.path.join(pathname, filename)) print statfrmt('A', os.path.join(pathname, filename))
@ -3258,6 +3258,9 @@ def checkout_package(apiurl, project, package,
prj_obj = Project(os.getcwd()) prj_obj = Project(os.getcwd())
prj_obj.set_state(p.name, ' ') prj_obj.set_state(p.name, ' ')
prj_obj.write_packages() prj_obj.write_packages()
if service_files:
print "Running local source services"
p.run_source_services()
os.chdir(olddir) os.chdir(olddir)