tazwok rev 232
Fixed check_for_trball to repack source if tarball if it exist. Made the if statement for WGET_URL to be shorter since not all receipt uses WGET_URL to download/get tarball.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Mon Feb 07 21:48:52 2011 +0000 (2011-02-07) |
parents | ba5ba03929f9 |
children | 868dbcf6886d d02c2f20ca37 |
files | tazwok |
line diff
1.1 --- a/tazwok Sat Feb 05 16:07:26 2011 +0000 1.2 +++ b/tazwok Mon Feb 07 21:48:52 2011 +0000 1.3 @@ -461,92 +461,91 @@ 1.4 report end-step 1.5 return 1 1.6 fi 1.7 + fi 1.8 + fi 1.9 + report end-step 1.10 + 1.11 + if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ] && [ "$nounpack" ]; then 1.12 + return 1.13 + fi 1.14 + 1.15 + # Untaring source if necessary. We don't need to extract source if 1.16 + # the package is built with a wanted source package. 1.17 + if [ "$WANTED" ]; then 1.18 + return 1.19 + fi 1.20 + 1.21 + report step "Untaring source tarball" 1.22 + if [ "$target" ]; then 1.23 + src="$target" 1.24 + else 1.25 + set_src_path 1.26 + fi 1.27 + 1.28 + # Log process. 1.29 + echo "untaring source tarball" >> $LOG 1.30 1.31 + tmp_src=$WOK/$PACKAGE/tmp-src-$$ 1.32 + mkdir $tmp_src 1.33 + if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ]; then 1.34 + lzma d $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -so | \ 1.35 + tar xf - -C $tmp_src 1.36 + elif [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then 1.37 + case "$TARBALL" in 1.38 + *zip|*xpi) { cd $tmp_src; unzip -o $SOURCES_REPOSITORY/$TARBALL; };; 1.39 + *bz2) tar xjf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.40 + *tar) tar xf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.41 + *lzma) unlzma -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.42 + *xz) unxz -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.43 + *Z) uncompress -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.44 + *) tar xzf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.45 + esac || return 1 1.46 + 1.47 + # Check if uncompressed tarball is in a root dir or not. 1.48 + if [ "$(ls -A $tmp_src | wc -l)" -gt 1 ]; then 1.49 + if check_for_var_modification src _pkg; then 1.50 + mv $tmp_src $tmp_src-1 1.51 + mkdir $tmp_src 1.52 + mv $tmp_src-1 $tmp_src/$PACKAGE-$VERSION 1.53 + else 1.54 + mv $tmp_src/* $WOK/$PACKAGE 1.55 + repack_src=no 1.56 + rm -r $tmp_src 1.57 + fi 1.58 + fi 1.59 + 1.60 + if [ "$repack_src" = yes ]; then 1.61 + report step "Repacking sources in .tar.lzma format" 1.62 + cd $tmp_src 1.63 + tar -c * | lzma e $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -si 1.64 + rm $SOURCES_REPOSITORY/$TARBALL 1.65 + prev_VERSION=$(get_pkg_version $INCOMING_REPOSITORY) 1.66 + 1.67 + # Remove previous tarball if it's not used either by 1.68 + # incoming and legacy packages. 1.69 + [ "$prev_VERSION" != "$(get_pkg_version $PACKAGES_REPOSITORY)" ] && \ 1.70 + remove_previous_tarball 1.71 + fi 1.72 + fi 1.73 + if [ "$nounpack" ]; then 1.74 + [ -d "$tmp_src" ] && rm -r $tmp_src 1.75 + return 1.76 + fi 1.77 + 1.78 + if [ ! -d "$src" ]; then 1.79 + if [ -d "$tmp_src" ]; then 1.80 + if ! check_for_var_modification src _pkg; then 1.81 + src="${src%/*}/$(ls $tmp_src)" 1.82 + fi 1.83 + mv $(echo $tmp_src/*) "$src" 1.84 + rm -r $tmp_src 1.85 + 1.86 + # Permissions settings. 1.87 + chown -R root.root "$src" 1.88 fi 1.89 report end-step 1.90 - 1.91 - if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ] && [ "$nounpack" ]; then 1.92 - return 1.93 - fi 1.94 - 1.95 - # Untaring source if necessary. We don't need to extract source if 1.96 - # the package is built with a wanted source package. 1.97 - if [ "$WANTED" ]; then 1.98 - return 1.99 - fi 1.100 - 1.101 - report step "Untaring source tarball" 1.102 - if [ "$target" ]; then 1.103 - src="$target" 1.104 - else 1.105 - set_src_path 1.106 - fi 1.107 - 1.108 - # Log process. 1.109 - echo "untaring source tarball" >> $LOG 1.110 - 1.111 - tmp_src=$WOK/$PACKAGE/tmp-src-$$ 1.112 - mkdir $tmp_src 1.113 - if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ]; then 1.114 - lzma d $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -so | \ 1.115 - tar xf - -C $tmp_src 1.116 - else 1.117 - case "$TARBALL" in 1.118 - *zip|*xpi) { cd $tmp_src; unzip -o $SOURCES_REPOSITORY/$TARBALL; };; 1.119 - *bz2) tar xjf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.120 - *tar) tar xf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.121 - *lzma) unlzma -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.122 - *xz) unxz -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.123 - *Z) uncompress -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.124 - *) tar xzf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.125 - esac || return 1 1.126 - 1.127 - # Check if uncompressed tarball is in a root dir or not. 1.128 - if [ "$(ls -A $tmp_src | wc -l)" -gt 1 ]; then 1.129 - if check_for_var_modification src _pkg; then 1.130 - mv $tmp_src $tmp_src-1 1.131 - mkdir $tmp_src 1.132 - mv $tmp_src-1 $tmp_src/$PACKAGE-$VERSION 1.133 - else 1.134 - mv $tmp_src/* $WOK/$PACKAGE 1.135 - repack_src=no 1.136 - rm -r $tmp_src 1.137 - fi 1.138 - fi 1.139 - 1.140 - if [ "$repack_src" = yes ]; then 1.141 - report step "Repacking sources in .tar.lzma format" 1.142 - cd $tmp_src 1.143 - tar -c * | lzma e $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -si 1.144 - rm $SOURCES_REPOSITORY/$TARBALL 1.145 - prev_VERSION=$(get_pkg_version $INCOMING_REPOSITORY) 1.146 - 1.147 - # Remove previous tarball if it's not used either by 1.148 - # incoming and legacy packages. 1.149 - [ "$prev_VERSION" != "$(get_pkg_version $PACKAGES_REPOSITORY)" ] && \ 1.150 - remove_previous_tarball 1.151 - fi 1.152 - fi 1.153 - if [ "$nounpack" ]; then 1.154 - [ -d "$tmp_src" ] && rm -r $tmp_src 1.155 - return 1.156 - fi 1.157 - 1.158 - if [ ! -d "$src" ]; then 1.159 - if [ -d "$tmp_src" ]; then 1.160 - if ! check_for_var_modification src _pkg; then 1.161 - src="${src%/*}/$(ls $tmp_src)" 1.162 - fi 1.163 - mv $(echo $tmp_src/*) "$src" 1.164 - rm -r $tmp_src 1.165 - 1.166 - # Permissions settings. 1.167 - chown -R root.root "$src" 1.168 - fi 1.169 - else 1.170 - echo "There's already something at $src. Abord." >&2 1.171 - fi 1.172 - report end-step 1.173 + else 1.174 + echo "There's already something at $src. Abord." >&2 1.175 fi 1.176 } 1.177