summaryrefslogtreecommitdiffstats
path: root/scripts/makeupdates
diff options
context:
space:
mode:
authorJoel Granados Moreno <jgranado@redhat.com>2009-08-17 17:58:37 +0200
committerJoel Granados Moreno <jgranado@redhat.com>2009-08-19 10:46:05 +0200
commitbb47fbd2c2bd9b23af40cb22de0d17c9755fa7f5 (patch)
tree4ddd49652d7374c6b2c5188135014dc5918c06a7 /scripts/makeupdates
parentfec4b1fcd1824445fce6684ce6f0a17b9d6828d5 (diff)
downloadanaconda-bb47fbd2c2bd9b23af40cb22de0d17c9755fa7f5.tar.gz
anaconda-bb47fbd2c2bd9b23af40cb22de0d17c9755fa7f5.tar.xz
anaconda-bb47fbd2c2bd9b23af40cb22de0d17c9755fa7f5.zip
Allow creation of an updates image from a tag offset.
* scripts/makeupdates (getArchiveTagOffset): New function to calculate the tag based on an offset. (main): Add the offset option to the arguments.
Diffstat (limited to 'scripts/makeupdates')
-rwxr-xr-xscripts/makeupdates42
1 files changed, 39 insertions, 3 deletions
diff --git a/scripts/makeupdates b/scripts/makeupdates
index 338e44fb3..659d6c716 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -55,6 +55,34 @@ def getArchiveTag(configure, spec):
return tag
+def getArchiveTagOffset(configure, spec, offset):
+ tag = getArchiveTag(configure, spec)
+
+ if not tag.count("-") >= 2:
+ return tag
+ ldash = tag.rfind("-")
+ bldash = tag[:ldash].rfind("-")
+ ver = tag[bldash+1:ldash]
+
+ if not ver.count(".") >= 1:
+ return tag
+ ver = ver[:ver.rfind(".")]
+
+ if not len(ver) > 0:
+ return tag
+ globstr = "refs/tags/" + tag[:bldash+1] + ver + ".*"
+ proc = subprocess.Popen(['git', 'for-each-ref', '--sort=taggerdate',
+ '--format=%(tag)', globstr],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
+ lines = proc[0].strip("\n").split('\n')
+ lines.reverse()
+
+ try:
+ return lines[offset]
+ except IndexError:
+ return tag
+
def doGitDiff(tag, args=[]):
proc = subprocess.Popen(['git', 'diff', '--stat', tag] + args,
stdout=subprocess.PIPE,
@@ -167,10 +195,12 @@ def main(argv):
updates = cwd + '/updates'
keep, compile, help, unknown = False, False, False, False
tag = None
+ offset = 0
try:
- opts, args = getopt.getopt(sys.argv[1:], 't:kc?',
- ['tag=', 'keep', 'compile', 'help'])
+ opts, args = getopt.getopt(sys.argv[1:], 't:o:kc?',
+ ['tag=', 'offset=',
+ 'keep', 'compile', 'help'])
except getopt.GetoptError:
help = True
@@ -183,6 +213,8 @@ def main(argv):
help = True
elif o in ('-t', '--tag'):
tag = a
+ elif o in ('-o', '--offset'):
+ offset = int(a)
else:
unknown = True
@@ -199,7 +231,11 @@ def main(argv):
sys.exit(1)
if not tag:
- tag = getArchiveTag(configure, spec)
+ if offset < 1:
+ tag = getArchiveTag(configure, spec)
+ else:
+ tag = getArchiveTagOffset(configure, spec, offset)
+ sys.stdout.write("Using tag: %s\n" % tag)
if not os.path.isdir(updates):
os.makedirs(updates)