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

optimize _link files

On Thursday 04 November 2010, Sascha Peilicke wrote:

> Could you please send a patch file?

attached.

Greetings,
Dirk

From ac737b9ff8205fe3c320ee0b41b093c7ad92c348 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dmueller@suse.de>
Date: Thu, 4 Nov 2010 11:01:08 +0100
Subject: [PATCH] linkpac: Only include src_project if it differs

osc copypac copies _link files verbatim, so if they refer
to the same project, copying them should make them also
refer to the new project. This can be done by leaving
out the project part if it is the same like the destination
project
This commit is contained in:
Dirk Müller 2010-11-04 14:41:40 +01:00 committed by Marcus Huewe
parent 668a38e978
commit 596570cebb

View File

@ -3873,8 +3873,14 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
cicount = ''
print 'Creating _link...',
# only include project if it is different
src_project_snippet=" project=\"%s\"" % (src_project)
if src_project == dst_project:
src_project_snippet = ""
link_template = """\
<link project="%s" package="%s" %s %s>
<link%s package="%s" %s %s>
<patches>
<!-- <apply name="patch" /> apply a patch on the source directory -->
<!-- <topadd>%%define build_with_feature_x 1</topadd> add a line on the top (spec file only) -->
@ -3882,7 +3888,7 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
<!-- <delete>filename</delete> delete a file -->
</patches>
</link>
""" % (src_project, src_package, rev, cicount)
""" % (src_project_snippet, src_package, rev, cicount)
u = makeurl(apiurl, ['source', dst_project, dst_package, '_link'])
http_PUT(u, data=link_template)