Mailinglist Archive: opensuse-buildservice (272 mails)

< Previous Next >
Re: [opensuse-buildservice] [PATCH]: optimize _link files
  • From: Dirk Müller <dmueller@xxxxxxx>
  • Date: Thu, 4 Nov 2010 14:41:40 +0100
  • Message-id: <201011041441.40609.dmueller@xxxxxxx>
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@xxxxxxx>
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
---
osc/core.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/osc/core.py b/osc/core.py
index 22ad8b0..de3c6aa 100644
--- a/osc/core.py
+++ b/osc/core.py
@@ -3850,8 +3850,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) -->
@@ -3859,7 +3865,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)
--
1.7.3.1

< Previous Next >