Add new support to produce release images
The original release crawler doesn't work well anymore because
we are now hiding images on releases day until the announcement.
This means the images should be created using full URL's to
the hardware packs and RFS.
diff --git a/build_release.py b/build_release.py
new file mode 100755
index 0000000..121fa5a
--- /dev/null
+++ b/build_release.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# Copyright (C) 2012 Linaro
+#
+# Author: Andy Doan <andy.doan@linaro.org>
+#
+# This file is part of Linaro Daily Prebuilt Images.
+#
+# Linaro Daily Prebuilt Images is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# Linaro Daily Prebuilt Images is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Linaro Image Tools; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+from linaro_fetch_image import fetch_image
+
+from build_images import build_image
+
+import argparse
+import os
+import re
+
+def get_image_name(odir, hwpack_url, binary):
+ path = '%s/%s' % (odir, binary)
+ if not os.path.exists(path):
+ os.makedirs(path)
+ hwpack = re.search(r'hwpack_linaro-(.*)_armhf', hwpack_url).group(1)
+ return "%s/%s-%s.img" %(path,hwpack,binary)
+
+def url_to_hwpack(url):
+ ''' convert a URL like:
+ http://snapshots.linaro.org/precise/hwpacks/lt-panda/113/hwpack_linaro-lt-panda_20120426-113_armhf_supported.tar.gz
+ into lt-panda
+ '''
+ return re.search(r'hwpack_linaro-(.*)_\d+', url).group(1)
+
+def main():
+ p = argparse.ArgumentParser(description=
+ 'Builds a matrix of builds from the latest build on '
+ 'snapshots.linaro.org or release images on releases.linaro.org')
+
+ p.add_argument('-o', dest='out_dir', default='./out',
+ help='The out directory for downloaded and built files, default=./')
+ p.add_argument('-w', dest='hwpacks', action='append', required=True,
+ help='The hwpacks urls generate images for.')
+ p.add_argument('-b', dest='binary', required=True,
+ help='The URL of the RFS')
+ p.add_argument('-t', dest='binary_type', required=True,
+ help='The binary type, eg nano,ubuntu-desktop')
+
+ args = p.parse_args()
+
+ dm = fetch_image.DownloadManager(args.out_dir)
+
+ rfsf = dm.download(args.binary, None)
+
+ lmc = '%s/linaro-image-tools/linaro-media-create' % args.out_dir
+ odir = '%s/pre-built' % args.out_dir
+
+ for url in args.hwpacks:
+ hwpack = url_to_hwpack(url)
+ hwpf = dm.download(url, None)
+ imgfile = get_image_name(odir,url,args.binary_type)
+ build_image(lmc, imgfile, hwpack, hwpf, args.binary_type, rfsf)
+
+if __name__ == '__main__':
+ main()
+