mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-28 10:46:15 +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['repopackage'] = node.get('package') or '_repository'
|
||||||
self.mp['repoarch'] = node.get('repoarch') or self.mp['arch']
|
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(
|
raise oscerr.APIError(
|
||||||
"buildinfo for package %s/%s/%s is incomplete"
|
"buildinfo for package %s/%s/%s is incomplete"
|
||||||
% (self.mp['name'], self.mp['arch'], self.mp['version']))
|
% (self.mp['name'], self.mp['arch'], self.mp['version']))
|
||||||
|
@ -3565,6 +3565,12 @@ def tag_to_rpmpy(tag):
|
|||||||
try:
|
try:
|
||||||
import rpm
|
import rpm
|
||||||
tags = { 'Name:' : rpm.RPMTAG_NAME,
|
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,
|
'Summary:' : rpm.RPMTAG_SUMMARY,
|
||||||
'%description' : rpm.RPMTAG_DESCRIPTION,
|
'%description' : rpm.RPMTAG_DESCRIPTION,
|
||||||
'Url:' : rpm.RPMTAG_URL
|
'Url:' : rpm.RPMTAG_URL
|
||||||
|
19
osc/fetch.py
19
osc/fetch.py
@ -7,6 +7,7 @@ import sys, os
|
|||||||
import urllib2
|
import urllib2
|
||||||
from urlgrabber.grabber import URLGrabber, URLGrabError
|
from urlgrabber.grabber import URLGrabber, URLGrabError
|
||||||
from urlgrabber.mirror import MirrorGroup
|
from urlgrabber.mirror import MirrorGroup
|
||||||
|
from core import data_from_rpm
|
||||||
try:
|
try:
|
||||||
from meter import TextMeter
|
from meter import TextMeter
|
||||||
except:
|
except:
|
||||||
@ -67,6 +68,7 @@ class Fetcher:
|
|||||||
|
|
||||||
MirrorGroup._join_url = join_url
|
MirrorGroup._join_url = join_url
|
||||||
mg = MirrorGroup(self.gr, pac.urllist)
|
mg = MirrorGroup(self.gr, pac.urllist)
|
||||||
|
partname = pac.fullfilename + ".part"
|
||||||
|
|
||||||
if self.http_debug:
|
if self.http_debug:
|
||||||
print
|
print
|
||||||
@ -77,7 +79,7 @@ class Fetcher:
|
|||||||
try:
|
try:
|
||||||
# it returns the filename
|
# it returns the filename
|
||||||
ret = mg.urlgrab(pac.filename,
|
ret = mg.urlgrab(pac.filename,
|
||||||
filename=pac.fullfilename,
|
filename=partname,
|
||||||
text = '(%s) %s' %(pac.project, pac.filename))
|
text = '(%s) %s' %(pac.project, pac.filename))
|
||||||
|
|
||||||
except URLGrabError, e:
|
except URLGrabError, e:
|
||||||
@ -88,6 +90,21 @@ class Fetcher:
|
|||||||
|
|
||||||
sys.exit(1)
|
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):
|
def dirSetup(self, pac):
|
||||||
dir = os.path.join(self.cachedir, pac.localdir)
|
dir = os.path.join(self.cachedir, pac.localdir)
|
||||||
|
Loading…
Reference in New Issue
Block a user