diff --git a/NEWS b/NEWS index 14895992..48f5ad4d 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,7 @@ - osc build has a smarter default platform selection - it checks the availibility config value, 'standard' and 'opensuse_Factory' in platforms list and in case of fail it uses the last entry from that list +- new osc linkpac -f to allow to override existing _link files 0.117: - support checkout of single package via "osc co PACKAGE" when local dir is project diff --git a/osc/commandline.py b/osc/commandline.py index 5cf3266d..cd7f9502 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -874,6 +874,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. help='cicount attribute in the link, known values are add, copy, and local, default in buildservice is currently add.') @cmdln.option('-r', '--revision', metavar='rev', help='link the specified revision.') + @cmdln.option('-f', '--force', action='store_true', + help='overwrite an existing link file if it is there.') def do_linkpac(self, subcmd, opts, *args): """${cmd_name}: "Link" a package to another package @@ -922,7 +924,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. print >>sys.stderr, 'Revision \'%s\' does not exist' % rev sys.exit(1) - link_pac(src_project, src_package, dst_project, dst_package, rev, opts.cicount) + link_pac(src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount) def do_aggregatepac(self, subcmd, opts, *args): """${cmd_name}: "Aggregate" a package to another package diff --git a/osc/core.py b/osc/core.py index a52c569e..7677df40 100755 --- a/osc/core.py +++ b/osc/core.py @@ -2622,7 +2622,7 @@ def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False, root.remove(dp) return ET.tostring(root) -def link_pac(src_project, src_package, dst_project, dst_package, rev='', cicount=''): +def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount=''): """ create a linked package - "src" is the original package @@ -2639,9 +2639,12 @@ def link_pac(src_project, src_package, dst_project, dst_package, rev='', cicount # create the _link file # but first, make sure not to overwrite an existing one if '_link' in meta_get_filelist(conf.config['apiurl'], dst_project, dst_package): - print >>sys.stderr - print >>sys.stderr, '_link file already exists...! Aborting' - sys.exit(1) + if force: + print >>sys.stderr, 'forced overwrite of existing _link file' + else: + print >>sys.stderr + print >>sys.stderr, '_link file already exists...! Aborting' + sys.exit(1) if rev: rev = 'rev="%s"' % rev