Skip to content

Commit

Permalink
- support prefer pkgs for kiwi builds
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Nov 8, 2012
1 parent a45c602 commit 3af9762
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions osc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ def has_dep(self, name):
def remove_dep(self, name):
# we need to iterate over all deps because if this a
# kiwi build the same package might appear multiple times
for i in self.deps:
# only remove those which are needed for the build itself
if i.name == name and not i.noinstall:
self.deps.remove(i)
# NOTE: do not loop and remove items, the second same one would not get catched
self.deps = [i for i in self.deps if not i.name == name]


class Pac:
Expand All @@ -181,7 +179,7 @@ def __init__(self, node, buildarch, pacsuffix, apiurl, localpkgs = []):
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']
localdep = self.mp['name'] in localpkgs # and not self.mp['noinstall']
if not localdep and not (node.get('project') and node.get('repository')):
raise oscerr.APIError('incomplete information for package %s, may be caused by a broken project configuration.'
% self.mp['name'] )
Expand Down Expand Up @@ -777,6 +775,10 @@ def __str__(self):
shutil.rmtree('repos')
os.mkdir('repos')
for i in bi.deps:
if not i.extproject:
# remove
bi.deps.remove(i)
continue
# project
pdir = str(i.extproject).replace(':/', ':')
# repo
Expand All @@ -789,16 +791,26 @@ def __str__(self):
pradir = prdir+"/"+adir
# source fullfilename
sffn = i.fullfilename
print "Using package: "+sffn
filename=sffn.split("/")[-1]
# target fullfilename
tffn = pradir+"/"+sffn.split("/")[-1]
tffn = pradir+"/"+filename
if not os.path.exists(os.path.join(pradir)):
os.makedirs(os.path.join(pradir))
if not os.path.exists(tffn):
print "Using package: "+sffn
if opts.linksources:
os.link(sffn, tffn)
else:
os.symlink(sffn, tffn)
if prefer_pkgs:
for name, path in prefer_pkgs.iteritems():
if name == filename:
print "Using prefered package: " + path + "/" + filename
os.unlink(tffn)
if opts.linksources:
os.link(path + "/" + filename, tffn)
else:
os.symlink(path + "/" + filename, tffn)

if bi.pacsuffix == 'rpm':
if opts.no_verify:
Expand Down

0 comments on commit 3af9762

Please sign in to comment.