mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 18:06:13 +01:00
- util/rpmquery.py, util/debquery.py: added "filename_suffix" attribute
- fetch.py: also rewrite the filename for debian packages (this is only useful for older obs instances)
This commit is contained in:
parent
eec733fda5
commit
62be2245e7
35
osc/fetch.py
35
osc/fetch.py
@ -7,7 +7,7 @@ import sys, os
|
||||
import urllib2
|
||||
from urlgrabber.grabber import URLGrabber, URLGrabError
|
||||
from urlgrabber.mirror import MirrorGroup
|
||||
from util import rpmquery
|
||||
from util import packagequery
|
||||
try:
|
||||
from meter import TextMeter
|
||||
except:
|
||||
@ -89,20 +89,21 @@ class Fetcher:
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
if pac.partname.endswith('.rpm.part'):
|
||||
rpmq = rpmquery.RpmQuery.query(pac.fullpartname)
|
||||
arch = rpmq.arch()
|
||||
# SOURCERPM = 1044
|
||||
if not rpmq.getTag(1044):
|
||||
# NOSOURCE = 1051, NOPATCH = 1052
|
||||
if rpmq.getTag(1051) or rpmq.getTag(1052):
|
||||
arch = "nosrc"
|
||||
else:
|
||||
arch = "src"
|
||||
canonname = "%s-%s-%s.%s.rpm" % (rpmq.name(), rpmq.version(), rpmq.release(), arch)
|
||||
head, tail = os.path.split(pac.fullfilename)
|
||||
pac.filename = canonname
|
||||
pac.fullfilename = os.path.join(head, canonname)
|
||||
pkgq = packagequery.PackageQuery.query(pac.fullpartname)
|
||||
arch = pkgq.arch()
|
||||
# SOURCERPM = 1044
|
||||
if pkgq.filename_suffix == 'rpm' and not pkgq.getTag(1044):
|
||||
# NOSOURCE = 1051, NOPATCH = 1052
|
||||
if pkgq.getTag(1051) or pkgq.getTag(1052):
|
||||
arch = "nosrc"
|
||||
else:
|
||||
arch = "src"
|
||||
if pkgq.release():
|
||||
canonname = '%s-%s-%s.%s.%s' % (pkgq.name(), pkgq.version(), pkgq.release(), arch, pkgq.filename_suffix)
|
||||
else:
|
||||
canonname = '%s-%s.%s.%s' % (pkgq.name(), pkgq.version(), arch, pkgq.filename_suffix)
|
||||
pac.filename = canonname
|
||||
pac.fullfilename = os.path.join(pac.localdir, canonname)
|
||||
|
||||
os.rename(pac.fullpartname, pac.fullfilename);
|
||||
|
||||
@ -120,15 +121,13 @@ class Fetcher:
|
||||
def run(self, buildinfo):
|
||||
for i in buildinfo.deps:
|
||||
i.makeurls(self.cachedir, self.urllist)
|
||||
|
||||
if not os.path.exists(os.path.join(i.localdir, i.fullfilename)):
|
||||
if not os.path.exists(i.fullfilename):
|
||||
self.dirSetup(i)
|
||||
try:
|
||||
# if there isn't a progress bar, there is no output at all
|
||||
if not self.progress_obj:
|
||||
print '(%s) %s' % (i.project, i.filename)
|
||||
self.fetch(i)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print 'Cancelled by user (ctrl-c)'
|
||||
print 'Exiting.'
|
||||
|
@ -9,6 +9,7 @@ class DebError(packagequery.PackageError):
|
||||
class DebQuery(packagequery.PackageQuery):
|
||||
def __init__(self, fh):
|
||||
self.__file = fh
|
||||
self.filename_suffix = 'deb'
|
||||
self.fields = {}
|
||||
|
||||
def read(self):
|
||||
|
@ -55,6 +55,7 @@ class RpmQuery(packagequery.PackageQuery):
|
||||
EQUAL = 1 << 3
|
||||
def __init__(self, fh):
|
||||
self.__file = fh
|
||||
self.filename_suffix = 'rpm'
|
||||
self.header = None
|
||||
|
||||
def read(self, *tags):
|
||||
|
Loading…
Reference in New Issue
Block a user