tazwok rev 229
Fixed nounpack.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri Feb 04 22:42:04 2011 +0000 (2011-02-04) |
parents | 6d2d15fde9ce |
children | eb670d752922 |
files | tazwok |
line diff
1.1 --- a/tazwok Fri Feb 04 19:18:39 2011 +0000 1.2 +++ b/tazwok Fri Feb 04 22:42:04 2011 +0000 1.3 @@ -424,7 +424,7 @@ 1.4 check_for_tarball() 1.5 { 1.6 if [ "$SRC_WANTED" ]; then 1.7 - tazwok get-src "$SRC_WANTED" --target=$WOK/$PACKAGE/$PACKAGE-$VERSION || return 1 1.8 + tazwok get-src "$SRC_WANTED" --target=$WOK/$PACKAGE/$PACKAGE-$VERSION ${nounpack:+--nounpack} || return 1 1.9 return 1.10 fi 1.11 if [ "$WGET_URL" ]; then 1.12 @@ -458,6 +458,10 @@ 1.13 fi 1.14 report end-step 1.15 1.16 + if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ] && [ "$nounpack" ]; then 1.17 + return 1.18 + fi 1.19 + 1.20 # Untaring source if necessary. We don't need to extract source if 1.21 # the package is built with a wanted source package. 1.22 if [ "$WANTED" ]; then 1.23 @@ -470,58 +474,58 @@ 1.24 else 1.25 set_src_path 1.26 fi 1.27 - if [ ! -d "$src" ]; then 1.28 + 1.29 + # Log process. 1.30 + echo "untaring source tarball" >> $LOG 1.31 1.32 - # Log process. 1.33 - echo "untaring source tarball" >> $LOG 1.34 + tmp_src=$WOK/$PACKAGE/tmp-src-$$ 1.35 + mkdir $tmp_src 1.36 + if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ]; then 1.37 + lzma d $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -so | \ 1.38 + tar xf - -C $tmp_src 1.39 + else 1.40 + case "$TARBALL" in 1.41 + *zip|*xpi) { cd $tmp_src; unzip -o $SOURCES_REPOSITORY/$TARBALL; };; 1.42 + *bz2) tar xjf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.43 + *tar) tar xf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.44 + *lzma) unlzma -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.45 + *xz) unxz -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.46 + *Z) uncompress -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.47 + *) tar xzf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.48 + esac || return 1 1.49 1.50 - tmp_src=$WOK/$PACKAGE/tmp-src-$$ 1.51 - mkdir $tmp_src 1.52 - if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ]; then 1.53 - lzma d $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -so | \ 1.54 - tar xf - -C $tmp_src 1.55 - else 1.56 - case "$TARBALL" in 1.57 - *zip|*xpi) { cd $tmp_src; unzip -o $SOURCES_REPOSITORY/$TARBALL; };; 1.58 - *bz2) tar xjf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.59 - *tar) tar xf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.60 - *lzma) unlzma -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.61 - *xz) unxz -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.62 - *Z) uncompress -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;; 1.63 - *) tar xzf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;; 1.64 - esac || return 1 1.65 - 1.66 - # Check if uncompressed tarball is in a root dir or not. 1.67 - if [ "$(ls -A $tmp_src | wc -l)" -gt 1 ]; then 1.68 - if check_for_var_modification src _pkg; then 1.69 - mv $tmp_src $tmp_src-1 1.70 - mkdir $tmp_src 1.71 - mv $tmp_src-1 $tmp_src/$PACKAGE-$VERSION 1.72 - else 1.73 - mv $tmp_src/* $WOK/$PACKAGE 1.74 - repack_src=no 1.75 - rm -r $tmp_src 1.76 - fi 1.77 - fi 1.78 - 1.79 - if [ "$repack_src" = yes ]; then 1.80 - report step "Repacking sources in .tar.lzma format" 1.81 - cd $tmp_src 1.82 - tar -c * | lzma e $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -si 1.83 - rm $SOURCES_REPOSITORY/$TARBALL 1.84 - prev_VERSION=$(get_pkg_version $INCOMING_REPOSITORY) 1.85 - 1.86 - # Remove previous tarball if it's not used either by 1.87 - # incoming and legacy packages. 1.88 - [ "$prev_VERSION" != "$(get_pkg_version $PACKAGES_REPOSITORY)" ] && \ 1.89 - remove_previous_tarball 1.90 - 1.91 + # Check if uncompressed tarball is in a root dir or not. 1.92 + if [ "$(ls -A $tmp_src | wc -l)" -gt 1 ]; then 1.93 + if check_for_var_modification src _pkg; then 1.94 + mv $tmp_src $tmp_src-1 1.95 + mkdir $tmp_src 1.96 + mv $tmp_src-1 $tmp_src/$PACKAGE-$VERSION 1.97 + else 1.98 + mv $tmp_src/* $WOK/$PACKAGE 1.99 + repack_src=no 1.100 + rm -r $tmp_src 1.101 fi 1.102 fi 1.103 - if [ "$nounpack" ]; then 1.104 - [ -d "$tmp_src" ] && rm -r $tmp_src 1.105 - return 1.106 + 1.107 + if [ "$repack_src" = yes ]; then 1.108 + report step "Repacking sources in .tar.lzma format" 1.109 + cd $tmp_src 1.110 + tar -c * | lzma e $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma -si 1.111 + rm $SOURCES_REPOSITORY/$TARBALL 1.112 + prev_VERSION=$(get_pkg_version $INCOMING_REPOSITORY) 1.113 + 1.114 + # Remove previous tarball if it's not used either by 1.115 + # incoming and legacy packages. 1.116 + [ "$prev_VERSION" != "$(get_pkg_version $PACKAGES_REPOSITORY)" ] && \ 1.117 + remove_previous_tarball 1.118 fi 1.119 + fi 1.120 + if [ "$nounpack" ]; then 1.121 + [ -d "$tmp_src" ] && rm -r $tmp_src 1.122 + return 1.123 + fi 1.124 + 1.125 + if [ ! -d "$src" ]; then 1.126 if [ -d "$tmp_src" ]; then 1.127 if ! check_for_var_modification src _pkg; then 1.128 src="${src%/*}/$(ls $tmp_src)"