cookutils rev 428
cook: update cross-environement if pkg is installed like we do for native build
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun May 20 00:51:50 2012 +0200 (2012-05-20) |
parents | 0f79cede3518 |
children | 66d5b26f87dd |
files | cook |
line diff
1.1 --- a/cook Sun May 20 00:04:46 2012 +0200 1.2 +++ b/cook Sun May 20 00:51:50 2012 +0200 1.3 @@ -450,7 +450,7 @@ 1.4 # or SYSROOT when it will be support by cross (the final goal is 1.5 # to use only the sysroot method). 1.6 root=$CROSS_PREFIX 1.7 - arch=-${ARCH} ;; 1.8 + arch="-${ARCH}" ;; 1.9 esac 1.10 1.11 [ "$QA" ] && receipt_quality 1.12 @@ -647,10 +647,10 @@ 1.13 1.14 # Handle cross compilation 1.15 case "$ARCH" in 1.16 - arm|x86_64) VERSION="$VERSION-$ARCH" ;; 1.17 + arm|x86_64) arch="-$ARCH" ;; 1.18 esac 1.19 1.20 - echo "Pack: $PACKAGE $VERSION" 1.21 + echo "Pack: $PACKAGE ${VERSION}${arch}" 1.22 separator 1.23 1.24 if grep -q ^genpkg_rules $receipt; then 1.25 @@ -727,7 +727,7 @@ 1.26 # Compress. 1.27 gettext "Creating full cpio archive... " 1.28 find . -print | cpio -o -H newc --quiet > \ 1.29 - ../$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg 1.30 + ../$PACKAGE-${VERSION}${EXTRAVERSION}${arch}.tazpkg 1.31 status 1.32 gettext "Restoring original package tree... " 1.33 unlzma -c fs.cpio.lzma | cpio -idm --quiet 1.34 @@ -777,6 +777,38 @@ 1.35 sed '1!G;h;$!d' $1 1.36 } 1.37 1.38 +# Install package on --install or update the chroot. 1.39 +install_package() { 1.40 + case "$ARCH" in 1.41 + arm|x86_64) 1.42 + arch="-${ARCH}" 1.43 + root=$CROSS_PREFIX ;; 1.44 + esac 1.45 + # Install package if requested but skip install if target host doesn't 1.46 + # match build system or it will break the build chroot. 1.47 + build=$(echo $BUILD_SYSTEM | cut -d "-" -f 1) 1.48 + if [ "$inst" ] && [ "$build" == "$ARCH" ]; then 1.49 + if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then 1.50 + cd $PKGS && tazpkg install \ 1.51 + $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced 1.52 + else 1.53 + gettext -e "Unable to install package, build has failed.\n\n" 1.54 + exit 1 1.55 + fi 1.56 + fi 1.57 + 1.58 + # Install package if part of the chroot to keep env up-to-date. 1.59 + if [ -d "${root}$INSTALLED/$pkg" ]; then 1.60 + . /etc/slitaz/cook.conf 1.61 + . $WOK/$pkg/taz/$pkg-*/receipt 1.62 + echo "Updating $ARCH chroot environment..." 1.63 + echo "Updating chroot: $pkg (${VERSION}${EXTRAVERSION}${arch})" | log 1.64 + cd $PKGS && tazpkg install \ 1.65 + $pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg \ 1.66 + --forced --root=$root 1.67 + fi 1.68 +} 1.69 + 1.70 # Launch the cook command into a chroot jail protected by aufs. 1.71 # The current filesystems are used read-only and updates are 1.72 # stored in a separate branch. 1.73 @@ -818,29 +850,8 @@ 1.74 rm -rf ${base}rw 1.75 umount ${base}root 1.76 rmdir $base* 1.77 - 1.78 - # Install package if requested 1.79 - if [ "$inst" ]; then 1.80 - if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then 1.81 - cd $PKGS && tazpkg install \ 1.82 - $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced 1.83 - else 1.84 - gettext -e "Unable to install package, build has failed.\n\n" 1.85 - exit 1 1.86 - fi 1.87 - fi 1.88 - 1.89 - # Skip install if target host doesn't match build system. 1.90 - build=$(echo $BUILD_SYSTEM | cut -d "-" -f 1) 1.91 - # Install package if part of the chroot to keep env up-to-date. 1.92 - if [ -d "$INSTALLED/$pkg" ] && [ "$build" == "$ARCH" ]; then 1.93 - . /etc/slitaz/cook.conf 1.94 - . $WOK/$pkg/taz/$pkg-*/receipt 1.95 - echo "Updating $ARCH chroot environment..." 1.96 - echo "Updating chroot: $pkg (${VERSION}${EXTRAVERSION})" | log 1.97 - cd $PKGS && tazpkg install \ 1.98 - $pkg-${VERSION}${EXTRAVERSION}.tazpkg --forced 1.99 - fi 1.100 + # Dont install pkg twice... it's done after 1.101 + #install_package 1.102 exit $status 1.103 } 1.104 1.105 @@ -1312,31 +1323,11 @@ 1.106 summary | tee -a $LOGS/$pkg.log 1.107 newline 1.108 1.109 - # Install package if requested 1.110 - if [ "$inst" ]; then 1.111 - if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then 1.112 - cd $PKGS && tazpkg install \ 1.113 - $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced 1.114 - else 1.115 - gettext -e "Unable to install package, build has failed.\n\n" 1.116 - exit 1 1.117 - fi 1.118 - fi 1.119 - 1.120 - # Skip install if target host dont match build system. 1.121 - build=$(echo $BUILD_SYSTEM | cut -d "-" -f 1) 1.122 - # Install package if part of the chroot to keep env up-to-date. 1.123 - if [ -d "$INSTALLED/$PACKAGE" ] && [ -z "$AUFS_MOUNTS" ] && \ 1.124 - [ "$build" == "$ARCH" ]; then 1.125 - echo "Updating chroot environment..." 1.126 - echo "Updating chroot: $PACKAGE (${VERSION}${EXTRAVERSION})" | log 1.127 - cd $PKGS && tazpkg install \ 1.128 - $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced 1.129 - fi 1.130 + # We may want to install/update. 1.131 + install_package 1.132 1.133 # Finally we DONT WANT to build the *-dev or packages with WANTED="$pkg" 1.134 # You want automation: use the Cooker Build Bot. 1.135 - #[ -d "$WOK/$pkg-dev" ] && cook $pkg-dev 1.136 rm -f $command ;; 1.137 esac 1.138