1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 00:06:15 +01:00

support buildinfos with binary present - and don't die with XML

This commit is contained in:
Stephan Kulow 2012-02-22 11:33:34 +01:00
parent d449a12c09
commit b1502a5715
3 changed files with 16 additions and 4 deletions

View File

@ -164,7 +164,7 @@ class Pac:
def __init__(self, node, buildarch, pacsuffix, apiurl, localpkgs = []):
self.mp = {}
for i in ['name', 'package',
for i in ['binary', 'package',
'version', 'release',
'project', 'repository',
'preinstall', 'vminstall', 'noinstall', 'runscripts',
@ -176,6 +176,7 @@ class Pac:
self.mp['pacsuffix'] = pacsuffix
self.mp['arch'] = node.get('arch') or self.mp['buildarch']
self.mp['name'] = node.get('name') or self.mp['binary']
# this is not the ideal place to check if the package is a localdep or not
localdep = self.mp['name'] in localpkgs and not self.mp['noinstall']
@ -205,7 +206,8 @@ class Pac:
if self.mp['repopackage'] == '_repository':
self.mp['repofilename'] = self.mp['name']
else:
self.mp['repofilename'] = self.mp['filename']
# OBS 2.3 puts binary into product bdeps (noinstall ones)
self.mp['repofilename'] = self.mp['binary'] or self.mp['filename']
# make the content of the dictionary accessible as class attributes
self.__dict__.update(self.mp)

View File

@ -165,7 +165,14 @@ class Fetcher:
def move_package(self, tmpfile, destdir, pac_obj = None):
import shutil
pkgq = packagequery.PackageQuery.query(tmpfile, extra_rpmtags=(1044, 1051, 1052))
if pkgq:
canonname = pkgq.canonname()
else:
if pac_obj is None:
print >>sys.stderr, 'Unsupported file type: ', tmpfile
sys.exit(1)
canonname = pac_obj.binary
fullfilename = os.path.join(destdir, canonname)
if pac_obj is not None:
pac_obj.filename = canonname

View File

@ -98,8 +98,11 @@ class PackageQuery:
import debquery
pkgquery = debquery.DebQuery(f)
extra_tags = extra_debtags
elif magic[:5] == '<?xml':
f.close()
return None
else:
raise PackageError('unsupported package type. magic: \'%s\' (%s)' % (magic, filename))
raise PackageError(filename, 'unsupported package type. magic: \'%s\'' % magic)
pkgquery.read(all_tags, *extra_tags)
f.close()
return pkgquery