1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 06:46:13 +01:00

- fixed #590611 ("'osc build' uses incorrect filename for debian debs")

This commit is contained in:
Marcus Huewe 2010-03-24 13:20:09 +01:00
parent 56e728fc44
commit af273d0bdb
5 changed files with 25 additions and 7 deletions

View File

@ -12,6 +12,7 @@ from tempfile import NamedTemporaryFile
from shutil import rmtree
from osc.fetch import *
from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig, is_package_dir
from osc.util import rpmquery, debquery
import osc.conf
import oscerr
import subprocess
@ -165,10 +166,10 @@ class Pac:
self.mp['apiurl'] = apiurl
if self.mp['release']:
self.filename = '%(name)s-%(version)s-%(release)s.%(arch)s.%(pacsuffix)s' % self.mp
if pacsuffix == 'deb':
self.filename = debquery.DebQuery.filename(self.mp['name'], self.mp['version'], self.mp['release'], self.mp['arch'])
else:
self.filename = '%(name)s-%(version)s.%(arch)s.%(pacsuffix)s' % self.mp
self.filename = rpmquery.RpmQuery.filename(self.mp['name'], self.mp['version'], self.mp['release'], self.mp['arch'])
self.mp['filename'] = self.filename
if self.mp['repopackage'] == '_repository':

View File

@ -120,10 +120,7 @@ class Fetcher:
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)
canonname = pkgq.canonname()
fullfilename = os.path.join(destdir, canonname)
if pac_obj is not None:
pac_obj.filename = canonname

View File

@ -107,6 +107,9 @@ class DebQuery(packagequery.PackageQuery):
def gettag(self, num):
return self.fields.get(num, None)
def canonname(self):
return DebQuery.filename(self.name(), self.version(), self.release(), self.arch())
@staticmethod
def query(filename, all_tags = False, *extra_tags):
f = open(filename, 'rb')
@ -149,6 +152,13 @@ class DebQuery(packagequery.PackageQuery):
return -1
return 0
@staticmethod
def filename(name, version, release, arch):
if release:
return '%s_%s-%s_%s.deb' % (name, version, release, arch)
else:
return '%s_%s_%s.deb' % (name, version, arch)
if __name__ == '__main__':
import sys
try:

View File

@ -79,6 +79,9 @@ class PackageQuery:
def vercmp(self, pkgquery):
raise NotImplementedError
def canonname(self):
raise NotImplementedError
@staticmethod
def query(filename, all_tags = False, extra_rpmtags = (), extra_debtags = ()):
f = open(filename, 'rb')

View File

@ -220,6 +220,9 @@ class RpmQuery(packagequery.PackageQuery):
def gettag(self, num):
return self.header.gettag(num)
def canonname(self):
return RpmQuery.filename(self.name(), self.version(), self.release(), self.arch())
@staticmethod
def query(filename):
f = open(filename, 'rb')
@ -275,6 +278,10 @@ class RpmQuery(packagequery.PackageQuery):
return -1
return cmp(ver1, ver2)
@staticmethod
def filename(name, version, release, arch):
return '%s-%s-%s.%s.rpm' % (name, version, release, arch)
def unpack_string(data):
"""unpack a '\\0' terminated string from data"""
val = ''