tazwok rev 456
Add get-src option into tazwok.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri Mar 18 20:17:03 2011 +0000 (2011-03-18) |
parents | cf28e39ccafe |
children | e2d5b3583ee8 |
files | tazwok |
line diff
1.1 --- a/tazwok Wed Mar 16 09:58:08 2011 +0100 1.2 +++ b/tazwok Fri Mar 18 20:17:03 2011 +0000 1.3 @@ -49,6 +49,7 @@ 1.4 gen-cooklist Generate a sorted cooklist using packages or list. 1.5 sort-cooklist Sort the cooklist given in argument. 1.6 get-src Download the tarball of the package given in argument. 1.7 + gen-src Rebuild sources.list in $SOURCES_REPOSITORY folder. 1.8 clean Clean all generated files in the package tree. 1.9 new-tree Prepare a new package tree and receipt (--interactive). 1.10 gen-list (Re-)Generate a packages list for a repository. 1.11 @@ -584,6 +585,41 @@ 1.12 report end-step 1.13 } 1.14 1.15 +# help gen sources.list file from scranch 1.16 +gen_sources_list() 1.17 +{ 1.18 + local src_repository=$1 1.19 + [ -f $src_repository/sources.list ] && rm -f $src_repository/sources.list 1.20 + for i in $WOK/*; do 1.21 + unset PACKAGE SOURCE VERSION WGET_URL TARBALL WANTED 1.22 + [ -f $i/receipt ] && source $i/receipt 1.23 + [ "$WGET_URL" ] || continue 1.24 + if grep -q "^$PACKAGE | $VERSION" $PACKAGES_REPOSITORY/packages.desc; then 1.25 + main_version="$VERSION" 1.26 + if [ -f $src_repository/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma ]; then 1.27 + echo -e "$PACKAGE:main\t${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" >> $src_repository/sources.list 1.28 + elif [ -f "$src_repository/$TARBALL" ]; then 1.29 + echo -e "$PACKAGE:main\t$TARBALL" >> $src_repository/sources.list 1.30 + fi 1.31 + else 1.32 + # May not works if package use extraversion. 1.33 + main_version=$(grep -m1 -A1 -sh ^$PACKAGE$ $PACKAGES_REPOSITORY/packages.txt | tail -1 | sed 's/ *//') 1.34 + if [ -f $src_repository/${SOURCE:-$PACKAGE}-$main_version.tar.lzma ]; then 1.35 + echo -e "$PACKAGE:main\t${SOURCE:-$PACKAGE}-$main_version.tar.lzma" >> $src_repository/sources.list 1.36 + else 1.37 + unset main_version 1.38 + fi 1.39 + fi 1.40 + if [ ! "$main_version" ] || [ $(grep -q "^$PACKAGE | $VERSION" $INCOMING_REPOSITORY/packages.desc) ]; then 1.41 + if [ -f $src_repository/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma ]; then 1.42 + echo -e "$PACKAGE:incoming\t${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" >> $src_repository/sources.list 1.43 + elif [ -f "$src_repository/$TARBALL" ]; then 1.44 + echo -e "$PACKAGE:incoming\t$TARBALL" >> $src_repository/sources.list 1.45 + fi 1.46 + fi 1.47 + done 1.48 +} 1.49 + 1.50 # Log and execute compile_rules function if it exists, to configure and 1.51 # make the package if it exists. 1.52 check_for_compile_rules() 1.53 @@ -3072,6 +3108,21 @@ 1.54 echo "No tarball to check for $PACKAGE" 1.55 fi 1.56 ;; 1.57 + gen-src) 1.58 + get_tazwok_config 1.59 + if [ "$2" ]; then 1.60 + if [ -d "$2" ]; then 1.61 + src_repository=$2 1.62 + else 1.63 + echo -e "\nUnable to find directory : $2\n" >&2 1.64 + exit 1 1.65 + fi 1.66 + fi 1.67 + echo -n "Rebuilding sources.list file" 1.68 + [ $src_repository ] || src_repository="$SOURCES_REPOSITORY" 1.69 + gen_sources_list $src_repository 1.70 + status 1.71 + ;; 1.72 get-src) 1.73 check_root 1.74 get_options_list="target nounpack"