Merge lp:~oem-solutions-releng/live-build/lb-sg-2.x-add-support-for-xz-and-bzip2-compression into lp:~ce-infrastructure/live-build/lb-sg-2.x

Proposed by Timothy R. Chavez
Status: Merged
Approved by: Kevin McDermott
Approved revision: 1607
Merged at revision: 1604
Proposed branch: lp:~oem-solutions-releng/live-build/lb-sg-2.x-add-support-for-xz-and-bzip2-compression
Merge into: lp:~ce-infrastructure/live-build/lb-sg-2.x
Diff against target: 160 lines (+68/-8)
5 files modified
debian/changelog (+11/-0)
functions/defaults.sh (+7/-0)
scripts/build/lb_binary_tar (+18/-2)
scripts/build/lb_config (+10/-0)
scripts/build/lb_source_tar (+22/-6)
To merge this branch: bzr merge lp:~oem-solutions-releng/live-build/lb-sg-2.x-add-support-for-xz-and-bzip2-compression
Reviewer Review Type Date Requested Status
Kevin McDermott (community) Approve
Review via email: mp+143373@code.launchpad.net

Description of the change

Add support for compressing tar images (binary and source) with 'xz' or 'bzip2'. This work adds the LB_COMPRESSION variable (which is compatible with live-build 3.x) as a way to specify which compression type is desired. If LB_COMPRESSION is not specified, it will default to 'gzip', which is the default compression type used today. Functional verification testing has been done for the following scenarios:

 - Default (not specifying LB_COMPRESSION)
 - LB_COMPRESSION="xz"
 - LB_COMPRESSION="bzip2"

Premium team confirmed that one of their images compress with xz could be decompressed and flashed to a system successfully.

To post a comment you must log in.
1607. By Timothy R. Chavez

Remove the bit of changelog that is no longer relevant, since the functionality was removed.

Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Looks ok to me, bash syntax notwithstanding :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-12-04 07:41:01 +0000
3+++ debian/changelog 2013-01-15 18:13:28 +0000
4@@ -1,3 +1,14 @@
5+live-build (2.0.12-2cesg12) lucid; urgency=low
6+
7+ * functions/defaults.sh,
8+ scripts/build/lb_binary_tar,
9+ scripts/build/lb_config,
10+ scripts/build/lb_source_tar
11+ - Backport LB_COMPRESSION from live-build-3.0~b5-1 to support bzip2 and xz
12+ compression
13+
14+ -- Timothy Chavez <timothy.chavez@canonical.com> Thu, 10 Jan 2013 09:36:13 -0600
15+
16 live-build (2.0.12-2cesg11) lucid; urgency=low
17
18 * scripts/build/lb_config: Avoid GENISOIMAGE_OPTIONS_EXTRA being erased when
19
20=== modified file 'functions/defaults.sh'
21--- functions/defaults.sh 2012-11-15 15:34:57 +0000
22+++ functions/defaults.sh 2013-01-15 18:13:28 +0000
23@@ -72,6 +72,8 @@
24 APT_OPTIONS="${APT_OPTIONS:---yes}"
25 APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
26
27+ BZIP2_OPTIONS="${BZIP2_OPTIONS:--6}"
28+
29 GZIP_OPTIONS="${GZIP_OPTIONS:---fast}"
30
31 if gzip --help | grep -qs "\-\-rsyncable"
32@@ -79,6 +81,8 @@
33 GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||') --rsyncable"
34 fi
35
36+ XZ_OPTIONS="${XZ_OPTIONS:--6}"
37+
38 # Setting apt recommends
39 case "${LB_MODE}" in
40 debian|debian-release|ubuntu)
41@@ -870,6 +874,9 @@
42 # Setting checksums
43 LB_CHECKSUMS="${LB_CHECKSUMS:-md5}"
44
45+ # Setting compression type
46+ LB_COMPRESSION="${LB_COMPRESSION:-gzip}"
47+
48 # Setting chroot option
49 LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
50
51
52=== modified file 'scripts/build/lb_binary_tar'
53--- scripts/build/lb_binary_tar 2011-03-09 18:17:33 +0000
54+++ scripts/build/lb_binary_tar 2013-01-15 18:13:28 +0000
55@@ -44,10 +44,26 @@
56 Create_lockfile .lock
57
58 # Remove old binary
59-rm -f binary.tar.gz
60+rm -f binary.tar.bz2 binary.tar.gz binary.tar.xz binary.tar
61
62 tar cf binary-tar.tar binary
63-gzip ${GZIP_OPTIONS} binary-tar.tar
64+
65+case "${LB_COMPRESSION}" in
66+ bzip2)
67+ bzip2 ${BZIP2_OPTIONS} binary-tar.tar
68+ ;;
69+
70+ gzip)
71+ gzip ${GZIP_OPTIONS} binary-tar.tar
72+ ;;
73+
74+ xz)
75+ xz ${XZ_OPTIONS} binary-tar.tar
76+ ;;
77+
78+ none)
79+ ;;
80+esac
81
82 # Creating stage file
83 Create_stagefile .stage/binary_tar
84
85=== modified file 'scripts/build/lb_config'
86--- scripts/build/lb_config 2012-12-04 07:41:01 +0000
87+++ scripts/build/lb_config 2013-01-15 18:13:28 +0000
88@@ -54,6 +54,7 @@
89 \t [--cache-packages true|false]\n\
90 \t [--cache-stages STAGE|\"STAGES\"]\n\
91 \t [--checksums md5|sha1|sha256|none]\n\
92+\t [--compression bzip2|gzip|xz|none]\n\
93 \t [--build-with-chroot true|false]\n\
94 \t [--chroot-filesystem ext2|ext3|squashfs|plain|jffs2]\n\
95 \t [--clean]\n\
96@@ -573,6 +574,11 @@
97 shift 2
98 ;;
99
100+ --compression)
101+ LB_COMPRESSION="${2}"
102+ shift 2
103+ ;;
104+
105 --build-with-chroot)
106 LB_BUILD_WITH_CHROOT="${2}"
107 shift 2
108@@ -1185,6 +1191,10 @@
109 # (Default: ${LB_CHECKSUMS})
110 LB_CHECKSUMS="${LB_CHECKSUMS}"
111
112+# \$LB_COMPRESSION: set compression
113+# (Default: ${LB_COMPRESSION})
114+LB_COMPRESSION="${LB_COMPRESSION}"
115+
116 # \${LB_BUILD_WITH_CHROOT: control if we build binary images chrooted
117 # (Default: ${LB_BUILD_WITH_CHROOT})
118 # DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false.
119
120=== modified file 'scripts/build/lb_source_tar'
121--- scripts/build/lb_source_tar 2011-03-09 18:17:33 +0000
122+++ scripts/build/lb_source_tar 2013-01-15 18:13:28 +0000
123@@ -50,15 +50,31 @@
124 Create_lockfile .lock
125
126 # Remove old source
127-rm -f source.debian.tar.gz
128-rm -f source.debian-live.tar.gz
129+rm -f source.debian.tar.bz2 source.debian.tar.gz source.debian.tar.xz source.debian.tar
130+rm -f source.debian-live.tar.bz2 source.debian-live.tar.gz source.debian-live.tar.xz source.debian-live.tar
131
132-# Create tarballs
133 tar cf source.debian.tar source/debian
134-gzip ${GZIP_OPTIONS} source.debian.tar
135-
136 tar cf source.debian-live.tar source/debian-live
137-gzip ${GZIP_OPTIONS} source.debian-live.tar
138+
139+case "${LB_COMPRESSION}" in
140+ bzip2)
141+ bzip2 ${BZIP2_OPTIONS} source.debian.tar
142+ bzip2 ${BZIP2_OPTIONS} source.debian-live.tar
143+ ;;
144+
145+ gzip)
146+ gzip ${GZIP_OPTIONS} source.debian.tar
147+ gzip ${GZIP_OPTIONS} source.debian-live.tar
148+ ;;
149+
150+ xz)
151+ xz ${XZ_OPTIONS} source.debian.tar
152+ xz ${XZ_OPTIONS} source.debian-live.tar
153+ ;;
154+
155+ none)
156+ ;;
157+esac
158
159 # Creating stage file
160 Create_stagefile .stage/source_tar

Subscribers

People subscribed via source and target branches