[grobisplitter] upgrade to latest splitter
This commit is contained in:
parent
da1144aa65
commit
d982c06fde
1 changed files with 34 additions and 7 deletions
|
@ -24,6 +24,20 @@ except:
|
||||||
|
|
||||||
mmd = Modulemd
|
mmd = Modulemd
|
||||||
|
|
||||||
|
# This code is from Stephen Gallagher to make my other caveman code
|
||||||
|
# less icky.
|
||||||
|
def _get_latest_streams (mymod, stream):
|
||||||
|
"""
|
||||||
|
Routine takes modulemd object and a stream name.
|
||||||
|
Finds the lates stream from that and returns that as a stream
|
||||||
|
object.
|
||||||
|
"""
|
||||||
|
all_streams = mymod.search_streams(stream, 0)
|
||||||
|
latest_streams = mymod.search_streams(stream,
|
||||||
|
all_streams[0].props.version)
|
||||||
|
|
||||||
|
return latest_streams
|
||||||
|
|
||||||
def _get_repoinfo(directory):
|
def _get_repoinfo(directory):
|
||||||
"""
|
"""
|
||||||
A function which goes into the given directory and sets up the
|
A function which goes into the given directory and sets up the
|
||||||
|
@ -190,7 +204,6 @@ def get_default_modules(directory):
|
||||||
# better way to do this that would be a lot better. However after
|
# better way to do this that would be a lot better. However after
|
||||||
# a long long day.. this is what I have.
|
# a long long day.. this is what I have.
|
||||||
|
|
||||||
|
|
||||||
# First we oo through the default streams and create a set of
|
# First we oo through the default streams and create a set of
|
||||||
# provides that we can check against later.
|
# provides that we can check against later.
|
||||||
for modname in idx.get_default_streams():
|
for modname in idx.get_default_streams():
|
||||||
|
@ -199,8 +212,8 @@ def get_default_modules(directory):
|
||||||
stream_set = mod.get_streams_by_stream_name(
|
stream_set = mod.get_streams_by_stream_name(
|
||||||
mod.get_defaults().get_default_stream())
|
mod.get_defaults().get_default_stream())
|
||||||
for stream in stream_set:
|
for stream in stream_set:
|
||||||
templist = stream.get_NSVCA().split(":")
|
tempstr = "%s:%s" % (stream.props.module_name,
|
||||||
tempstr = "%s:%s" % (templist[0],templist[1])
|
stream.props.stream_name)
|
||||||
provides.add(tempstr)
|
provides.add(tempstr)
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,17 +223,20 @@ def get_default_modules(directory):
|
||||||
for modname in idx.get_default_streams():
|
for modname in idx.get_default_streams():
|
||||||
mod = idx.get_module(modname)
|
mod = idx.get_module(modname)
|
||||||
# Get the default streams and loop through them.
|
# Get the default streams and loop through them.
|
||||||
|
# This is a sorted list with the latest in it. We could drop
|
||||||
|
# looking at later ones here in a future version. (aka lines
|
||||||
|
# 237 to later)
|
||||||
stream_set = mod.get_streams_by_stream_name(
|
stream_set = mod.get_streams_by_stream_name(
|
||||||
mod.get_defaults().get_default_stream())
|
mod.get_defaults().get_default_stream())
|
||||||
for stream in stream_set:
|
for stream in stream_set:
|
||||||
isprovided = True # a variable to say this can be added.
|
|
||||||
ourname = stream.get_NSVCA()
|
ourname = stream.get_NSVCA()
|
||||||
on_list = ourname.split(":")
|
tmp_name = "%s:%s" % (stream.props.module_name,
|
||||||
tmp_name = "%s:%s" % (on_list[0],on_list[1])
|
stream.props.stream_name)
|
||||||
# Get dependencies is a list of items. All of the modules
|
# Get dependencies is a list of items. All of the modules
|
||||||
# seem to only have 1 item in them, but we should loop
|
# seem to only have 1 item in them, but we should loop
|
||||||
# over the list anyway.
|
# over the list anyway.
|
||||||
for deps in stream.get_dependencies():
|
for deps in stream.get_dependencies():
|
||||||
|
isprovided = True # a variable to say this can be added.
|
||||||
for mod in deps.get_runtime_modules():
|
for mod in deps.get_runtime_modules():
|
||||||
tempstr=""
|
tempstr=""
|
||||||
# It does not seem easy to figure out what the
|
# It does not seem easy to figure out what the
|
||||||
|
@ -229,16 +245,27 @@ def get_default_modules(directory):
|
||||||
for stm in deps.get_runtime_streams(mod):
|
for stm in deps.get_runtime_streams(mod):
|
||||||
tempstr = "%s:%s" %(mod,stm)
|
tempstr = "%s:%s" %(mod,stm)
|
||||||
if tempstr not in provides:
|
if tempstr not in provides:
|
||||||
|
# print( "%s : %s not found." % (ourname,tempstr))
|
||||||
isprovided = False
|
isprovided = False
|
||||||
if isprovided:
|
if isprovided:
|
||||||
if tmp_name in tempdict:
|
if tmp_name in tempdict:
|
||||||
print("We found %s" % tmp_name)
|
# print("We found %s" % tmp_name)
|
||||||
|
# Get the stream version we are looking at
|
||||||
ts1=ourname.split(":")[2]
|
ts1=ourname.split(":")[2]
|
||||||
|
# Get the stream version we stored away
|
||||||
ts2=tempdict[tmp_name].split(":")[2]
|
ts2=tempdict[tmp_name].split(":")[2]
|
||||||
|
# See if we got a newer one. We probably
|
||||||
|
# don't as it is a sorted list but we
|
||||||
|
# could have multiple contexts which would
|
||||||
|
# change things.
|
||||||
if ( int(ts1) > int(ts2) ):
|
if ( int(ts1) > int(ts2) ):
|
||||||
|
# print ("%s > %s newer for %s", ts1,ts2,ourname)
|
||||||
tempdict[tmp_name] = ourname
|
tempdict[tmp_name] = ourname
|
||||||
else:
|
else:
|
||||||
|
# print("We did not find %s" % tmp_name)
|
||||||
tempdict[tmp_name] = ourname
|
tempdict[tmp_name] = ourname
|
||||||
|
# OK we finally got all our stream names we want to send back to
|
||||||
|
# our calling function. Read them out and add them to the set.
|
||||||
for indx in tempdict:
|
for indx in tempdict:
|
||||||
contents.add(tempdict[indx])
|
contents.add(tempdict[indx])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue