[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#704571: live-build: Listing flavours in syslinux step does a wrong matching



Package: live-build
Version: 3.0.1-1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Build fails if you include a kernel in the flavours like the ones from
experimental that has a different name, for example on this case it
fails with a structure like this:

vmlinuz-3.2.0-4-486
vmlinuz-3.2.0-4-686-pae
vmlinuz-3.8-trunk-686-pae

Just like you can see in this paste with the error: http://paste.debian.net/236002/
You can see the error in the expansion on the line 28 which includes 2
times a vmlinuz file, as how SynrG told me in the chat the solution
should be:

<SynrG> step 1. remember which flavour is which sequence #
<SynrG> step 2. sort all flavours by length, longest 1st
<SynrG> step 3. iteratively match all flavours, removing them from the list of kernels to match whenever we have a match
<SynrG> step 4. rename all matched vmlinuz-* to vmlinuz#
<SynrG> if you can figure out how to do that in shell, be my guest :)

The attached patch should solve the problem, it was tested in a sandbox
(simulated) environment with the result included in the comments but not
in a real build since I was able to install the kernel 3.7 from
experimental but not the 3.8 one (broken dependencies), however I readed
the code and it should not conflict in the rest of the script behaviour

Thanks
Thanatermesis



- -- Package-specific info:

- -- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages live-build depends on:
ii  debootstrap  1.0.44

Versions of packages live-build recommends:
ii  cpio                            2.11+dfsg-0.1
ii  gnu-fdisk                       1.2.4-3.1
ii  live-boot-doc                   3.0.1-1
ii  live-config-doc                 3.0.21-1
ii  live-manual-html [live-manual]  1:3.0.1-1

Versions of packages live-build suggests:
ii  debian-keyring  2012.11.15
ii  dosfstools      3.0.13-1
ii  fakeroot        1.18.4-2
ii  git             1:1.7.10.4-1+wheezy1
ii  gpgv            1.4.12-7
pn  loadlin         <none>
ii  memtest86+      4.20-1.1
ii  mtools          4.0.17-1
ii  parted          2.3-12
ii  squashfs-tools  1:4.2-5
ii  sudo            1.8.5p2-1+nmu1
ii  syslinux        2:4.05+dfsg-6+deb7u1
ii  uuid-runtime    2.20.1-5.3
pn  win32-loader    <none>
ii  xorriso         1.2.2-2

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJRW48AAAoJEKLHmb/f+NfCTQsQAJD4Aw/o7MXmNKFZe1Bi4LBX
T1KHdmsOCsRU7d3spIkmDI2Fj/7DmmZG51GrpT7lwE4E2iR3TZA2O5QtMwzfR4Vr
ClG9zAFGLIoFxD8rXaFoOrIDpy3/8P5cDK9Ww0/H8mW2cKyIYkFx/zyIa2q/JCRH
mqY6cfD8PYiwdnU/oereNw5n4YGgkYan91A/prXIBSUE9d/a7IBdUYatSg/jjP+m
MOb/vtSRerYbVROMvMBLgz3c8eAZpUZANFQBgstnlDKWN8ijwnnhlftiuSBz6u5m
nXzfO4ei0/rQ8325ONrsZmVB5iZYwY2M0qbkXCnAkf1ccesbuiQ+ozxPYldHCHJi
wSbHJrFLR+vnorfFMRVokB3t94PvDRawTjz3f885lS3f8Hy/qCiVgjSxHiHuBCTw
FJlrItcLLdn2vxw/3KfcEekPeQ9WZT25amA3vDsA2e6HoYjXTuNmpteXOKX68OeG
6iPA1c21qXe1AWMZsdjfQXOzKlJG2P7oDrjya1ssST0o9xFllIESLiUcOZTXoTng
urusW4vmgcByqaf/qc3BYCOQsuixSEwV5nv+WBtpRG9zGqoZ0xRpISPG9FIg+i/U
DXA/ymAI6LG2JzoD3LQaQFfhb1Oru7chDnSN2cW3TPt7FjZ4zQcqgZtmu4w+8Gta
Z+GO2f+j843i2075YWJk
=uzlA
-----END PGP SIGNATURE-----
--- a/scripts/build/binary_syslinux
+++ b/scripts/build/binary_syslinux
@@ -185,12 +185,21 @@ then
 		*)
 			_NUMBER="0"
 
-			for _FLAVOUR in ${LB_LINUX_FLAVOURS}
+			# this "for" uses a sorting by lenght and adds an indexed order
+			# example:
+			# - if we have: "686-pae 486 3.8-trunk-686-pae", we got this list:
+			# 3.8-trunk-686-pae:3
+			# 686-pae:1
+			# 486:2
+
+			for _FLAVOUR_INDEXED in $( echo "$LB_LINUX_FLAVOURS" | tr ' ' '\n' | awk '{ printf "%d:%s:%d\n", length($0), $0, NR;}' | sort -rn | sed 's/^[0-9]*://' )
 			do
+				_FLAVOUR="$(echo "${_FLAVOUR_INDEXED}" | sed 's|:.*$||g' )"
+				_INDEX="$(echo "${_FLAVOUR_INDEXED}" | sed 's|^.*:||g' )"
 				_NUMBER="$((${_NUMBER} + 1))"
 
-				mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_NUMBER}
-				mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_NUMBER}.img
+				mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_INDEX}
+				mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_INDEX}.img
 
 				if [ "${_NUMBER}" -gt 1 ]
 				then
@@ -201,8 +210,8 @@ then
 				fi
 
 				sed -i -e "s|@FLAVOUR@|${_FLAVOUR}|g" \
-				       -e "s|@LINUX@|/live/vmlinuz${_NUMBER}|g" \
-				       -e "s|@INITRD@|/live/initrd${_NUMBER}.img|g" \
+				       -e "s|@LINUX@|/live/vmlinuz${_INDEX}|g" \
+				       -e "s|@INITRD@|/live/initrd${_INDEX}.img|g" \
 				       -e "s#@APPEND_LIVE@#${LB_BOOTAPPEND_LIVE}#g" \
 				       -e "s#@APPEND_LIVE_FAILSAFE@#${LB_BOOTAPPEND_LIVE_FAILSAFE}#g" \
 				"${_TARGET}/live.cfg"

Reply to: