Updating onos_stage.py to use ONOS_VERSION global
Also, fixing up the base directory for RC packaging.
Change-Id: Id3c80a75ec27bd887b01a04a3122a2660c8f281b
diff --git a/buck-tools/onos_stage.py b/buck-tools/onos_stage.py
index 2d9462f..0ed46a1 100755
--- a/buck-tools/onos_stage.py
+++ b/buck-tools/onos_stage.py
@@ -9,9 +9,6 @@
import time
from cStringIO import StringIO
-VERSION = '1.7.0' #FIXME version, and maybe git commit hash
-BASE = 'onos-%s/' % VERSION
-
written_files = set()
now = time.time()
@@ -37,7 +34,9 @@
file.close()
written_files.add(dest)
-def stageOnos(output, files=[]):
+def stageOnos(output, version, files=[]):
+ base = 'onos-%s/' % version
+
# Note this is not a compressed zip
with tarfile.open(output, 'w:gz') as output:
for file in files:
@@ -45,40 +44,41 @@
with ZipFile(file, 'r') as zip_part:
for f in zip_part.infolist():
dest = f.filename
- if BASE not in dest:
- dest = BASE + 'apache-karaf-3.0.5/system/' + f.filename
+ if base not in dest:
+ dest = base + 'apache-karaf-3.0.5/system/' + f.filename
addFile(output, dest, zip_part.open(f), f.file_size)
elif '.oar' in file:
with ZipFile(file, 'r') as oar:
app_xml = oar.open('app.xml').read()
app_name = re.search('name="([^"]+)"', app_xml).group(1)
- dest = BASE + 'apps/%(name)s/%(name)s.oar' % { 'name': app_name}
+ dest = base + 'apps/%(name)s/%(name)s.oar' % { 'name': app_name}
addFile(output, dest, open(file), os.stat(file).st_size)
- dest = BASE + 'apps/%s/app.xml' % app_name
+ dest = base + 'apps/%s/app.xml' % app_name
addString(output, dest, app_xml)
for f in oar.infolist():
filename = f.filename
if 'm2' in filename:
- dest = BASE + 'apache-karaf-3.0.5/system/' + filename[3:]
+ dest = base + 'apache-karaf-3.0.5/system/' + filename[3:]
if dest not in written_files:
addFile(output, dest, oar.open(f), f.file_size)
written_files.add(dest)
elif 'features.xml' in file:
- dest = BASE + 'apache-karaf-3.0.5/system/org/onosproject/onos-features/1.7.0-SNAPSHOT/'
- dest += 'onos-features-1.7.0-SNAPSHOT-features.xml'
+ dest = base + 'apache-karaf-3.0.5/system/org/onosproject/onos-features/%s/' % version
+ dest += 'onos-features-%s-features.xml' % version
with open(file) as f:
addFile(output, dest, f, os.stat(file).st_size)
- addString(output, BASE + 'apps/org.onosproject.drivers/active', '')
- addString(output, BASE + 'VERSION', VERSION)
+ addString(output, base + 'apps/org.onosproject.drivers/active', '')
+ addString(output, base + 'VERSION', version)
if __name__ == '__main__':
import sys
- if len(sys.argv) < 2:
- print 'USAGE'
+ if len(sys.argv) < 3:
+ print 'USAGE' #FIXME
sys.exit(1)
output = sys.argv[1]
- args = sys.argv[2:]
+ version = sys.argv[2]
+ args = sys.argv[3:]
- stageOnos(output, args)
+ stageOnos(output, version, args)
diff --git a/tools/package/onos-prep-karaf b/tools/package/onos-prep-karaf
index bbb6f0e..0dca061 100755
--- a/tools/package/onos-prep-karaf
+++ b/tools/package/onos-prep-karaf
@@ -12,7 +12,7 @@
#FIXME karaf version
KARAF_VERSION="3.0.5"
-PREFIX="onos-${ONOS_VERSION/-*/}"
+PREFIX="onos-${ONOS_VERSION/-SNAPSHOT/}"
# Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
tar xf $KARAF_TAR