Skip to content

Commit b1502a5

Browse files
committed
support buildinfos with binary present - and don't die with XML
1 parent d449a12 commit b1502a5

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

osc/build.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class Pac:
164164
def __init__(self, node, buildarch, pacsuffix, apiurl, localpkgs = []):
165165

166166
self.mp = {}
167-
for i in ['name', 'package',
167+
for i in ['binary', 'package',
168168
'version', 'release',
169169
'project', 'repository',
170170
'preinstall', 'vminstall', 'noinstall', 'runscripts',
@@ -176,6 +176,7 @@ def __init__(self, node, buildarch, pacsuffix, apiurl, localpkgs = []):
176176
self.mp['pacsuffix'] = pacsuffix
177177

178178
self.mp['arch'] = node.get('arch') or self.mp['buildarch']
179+
self.mp['name'] = node.get('name') or self.mp['binary']
179180

180181
# this is not the ideal place to check if the package is a localdep or not
181182
localdep = self.mp['name'] in localpkgs and not self.mp['noinstall']
@@ -205,7 +206,8 @@ def __init__(self, node, buildarch, pacsuffix, apiurl, localpkgs = []):
205206
if self.mp['repopackage'] == '_repository':
206207
self.mp['repofilename'] = self.mp['name']
207208
else:
208-
self.mp['repofilename'] = self.mp['filename']
209+
# OBS 2.3 puts binary into product bdeps (noinstall ones)
210+
self.mp['repofilename'] = self.mp['binary'] or self.mp['filename']
209211

210212
# make the content of the dictionary accessible as class attributes
211213
self.__dict__.update(self.mp)

osc/fetch.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,14 @@ def fetch(self, pac, prefix=''):
165165
def move_package(self, tmpfile, destdir, pac_obj = None):
166166
import shutil
167167
pkgq = packagequery.PackageQuery.query(tmpfile, extra_rpmtags=(1044, 1051, 1052))
168-
canonname = pkgq.canonname()
168+
if pkgq:
169+
canonname = pkgq.canonname()
170+
else:
171+
if pac_obj is None:
172+
print >>sys.stderr, 'Unsupported file type: ', tmpfile
173+
sys.exit(1)
174+
canonname = pac_obj.binary
175+
169176
fullfilename = os.path.join(destdir, canonname)
170177
if pac_obj is not None:
171178
pac_obj.filename = canonname

osc/util/packagequery.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ def query(filename, all_tags = False, extra_rpmtags = (), extra_debtags = ()):
9898
import debquery
9999
pkgquery = debquery.DebQuery(f)
100100
extra_tags = extra_debtags
101+
elif magic[:5] == '<?xml':
102+
f.close()
103+
return None
101104
else:
102-
raise PackageError('unsupported package type. magic: \'%s\' (%s)' % (magic, filename))
105+
raise PackageError(filename, 'unsupported package type. magic: \'%s\'' % magic)
103106
pkgquery.read(all_tags, *extra_tags)
104107
f.close()
105108
return pkgquery

0 commit comments

Comments
 (0)