1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/usr/bin/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, compress_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/SERIE/hwpacks/HWPACK_NAME/HWPACK_BUILD_NUMBER/HWPACK_FILE_NAME
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)
compress_image(imgfile)
if __name__ == '__main__':
main()
|