mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- calculate canon name from downloaded rpm, as the server may
give us the wrong/missing information - also fixes builds with packages from interconnected build services
This commit is contained in:
parent
027a0e5be1
commit
d57c82fbec
@ -145,7 +145,7 @@ class Pac:
|
||||
self.mp['repopackage'] = node.get('package') or '_repository'
|
||||
self.mp['repoarch'] = node.get('repoarch') or self.mp['arch']
|
||||
|
||||
if not (self.mp['name'] and self.mp['arch'] and self.mp['version']):
|
||||
if pacsuffix == 'deb' and not (self.mp['name'] and self.mp['arch'] and self.mp['version']):
|
||||
raise oscerr.APIError(
|
||||
"buildinfo for package %s/%s/%s is incomplete"
|
||||
% (self.mp['name'], self.mp['arch'], self.mp['version']))
|
||||
|
@ -3565,6 +3565,12 @@ def tag_to_rpmpy(tag):
|
||||
try:
|
||||
import rpm
|
||||
tags = { 'Name:' : rpm.RPMTAG_NAME,
|
||||
'Version:' : rpm.RPMTAG_VERSION,
|
||||
'Release:' : rpm.RPMTAG_RELEASE,
|
||||
'Arch:' : rpm.RPMTAG_ARCH,
|
||||
'SourceRPM:' : rpm.RPMTAG_SOURCERPM,
|
||||
'NoSource:' : 1051,
|
||||
'NoPatch:' : 1052,
|
||||
'Summary:' : rpm.RPMTAG_SUMMARY,
|
||||
'%description' : rpm.RPMTAG_DESCRIPTION,
|
||||
'Url:' : rpm.RPMTAG_URL
|
||||
|
21
osc/fetch.py
21
osc/fetch.py
@ -7,6 +7,7 @@ import sys, os
|
||||
import urllib2
|
||||
from urlgrabber.grabber import URLGrabber, URLGrabError
|
||||
from urlgrabber.mirror import MirrorGroup
|
||||
from core import data_from_rpm
|
||||
try:
|
||||
from meter import TextMeter
|
||||
except:
|
||||
@ -67,6 +68,7 @@ class Fetcher:
|
||||
|
||||
MirrorGroup._join_url = join_url
|
||||
mg = MirrorGroup(self.gr, pac.urllist)
|
||||
partname = pac.fullfilename + ".part"
|
||||
|
||||
if self.http_debug:
|
||||
print
|
||||
@ -77,7 +79,7 @@ class Fetcher:
|
||||
try:
|
||||
# it returns the filename
|
||||
ret = mg.urlgrab(pac.filename,
|
||||
filename=pac.fullfilename,
|
||||
filename=partname,
|
||||
text = '(%s) %s' %(pac.project, pac.filename))
|
||||
|
||||
except URLGrabError, e:
|
||||
@ -87,7 +89,22 @@ class Fetcher:
|
||||
print >>sys.stderr, '\n'.join(pac.urllist)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if partname.endswith('.rpm.part'):
|
||||
rpm_data = data_from_rpm(partname, 'Name:', 'Version:', 'Release:', 'Arch:', 'SourceRPM:', 'NoSource:', 'NoPatch:')
|
||||
if rpm_data:
|
||||
arch = rpm_data['Arch:']
|
||||
if not rpm_data['SourceRPM:']:
|
||||
if rpm_data['NoSource:'] or rpm_data['NoPatch:']:
|
||||
arch = "nosrc"
|
||||
else:
|
||||
arch = "src"
|
||||
canonname = "%s-%s-%s.%s.rpm" % (rpm_data['Name:'], rpm_data['Version:'], rpm_data['Release:'], arch)
|
||||
head, tail = os.path.split(pac.fullfilename)
|
||||
pac.filename = canonname
|
||||
pac.fullfilename = os.path.join(head, canonname)
|
||||
|
||||
os.rename(partname, pac.fullfilename);
|
||||
|
||||
def dirSetup(self, pac):
|
||||
dir = os.path.join(self.cachedir, pac.localdir)
|
||||
|
Loading…
Reference in New Issue
Block a user