cookutils rev 549 slitaz-tank

libcookorder.sh: Add comments to explain lots of functions. More to come.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue Oct 16 15:02:10 2012 +0000 (2012-10-16)
parents 48d59c7cd0b6
children f78d194e7f13
files cook lib/libcookorder.sh
line diff
     1.1 --- a/cook	Tue Oct 16 00:14:04 2012 +0000
     1.2 +++ b/cook	Tue Oct 16 15:02:10 2012 +0000
     1.3 @@ -71,6 +71,7 @@
     1.4  		-e s'|\[0;39m \]||' $LOGS/$pkg.log
     1.5  }
     1.6  
     1.7 +# check if $value is empty
     1.8  if_empty_value() {
     1.9  	if [ -z "$value" ]; then
    1.10  		gettext "QA: empty variable:"; echo -e " ${var}=\"\"\n"
     2.1 --- a/lib/libcookorder.sh	Tue Oct 16 00:14:04 2012 +0000
     2.2 +++ b/lib/libcookorder.sh	Tue Oct 16 15:02:10 2012 +0000
     2.3 @@ -57,6 +57,7 @@
     2.4  	echo -e " $pkg\n" && exit 1
     2.5  }
     2.6  
     2.7 +# rsync wok-hg with wok
     2.8  rsync_wok() {
     2.9  	if [ -d "$WOKHG" ]; then
    2.10  		echo "Updating build wok"
    2.11 @@ -97,6 +98,7 @@
    2.12  	done
    2.13  }
    2.14  
    2.15 +# gen_wan_db is to make the wanted.txt
    2.16  gen_wan_db()
    2.17  {
    2.18  	local receipt
    2.19 @@ -113,6 +115,7 @@
    2.20  	fi
    2.21  }
    2.22  
    2.23 +# gen_dep_db is to make the depends.txt
    2.24  gen_dep_db()
    2.25  {
    2.26  	local pkg receipt
    2.27 @@ -130,6 +133,8 @@
    2.28  	fi
    2.29  }
    2.30  
    2.31 +# gen_wok_db is to create the wok cooklist database
    2.32 +# This helps create the wanted.txt, depends.txt and fullco.txt
    2.33  gen_wok_db()
    2.34  {
    2.35  	echo "Generating wok database"
    2.36 @@ -145,39 +150,46 @@
    2.37  	sort_db
    2.38  }
    2.39  
    2.40 +# look for $PACKAGE in $dep_db
    2.41  look_for_dep()
    2.42  {
    2.43  	grep -m1 ^$PACKAGE$'\t' $dep_db | \
    2.44  		cut -f 2
    2.45  }
    2.46  
    2.47 +# look for all $PACKAGE depends and build depends in $dep_db
    2.48  look_for_all()
    2.49  {
    2.50  	grep -m1 ^$PACKAGE$'\t' $dep_db | \
    2.51  			cut -f 2,3 | sed 's/ 	 / /'
    2.52  }
    2.53  
    2.54 +# same as look_for_all function
    2.55  look_for_bdep()
    2.56  {
    2.57  	look_for_all
    2.58  }
    2.59  
    2.60 +# reverse depend look up
    2.61  look_for_rdep()
    2.62  {
    2.63  	fgrep ' '$PACKAGE' ' $dep_db | cut -f 1
    2.64  }
    2.65  
    2.66 +# reverse build depend look up
    2.67  look_for_rbdep()
    2.68  {
    2.69  	fgrep ' '$PACKAGE' ' $dep_db | \
    2.70  		cut -f 1,3 | fgrep ' '$PACKAGE' ' | cut -f 1
    2.71  }
    2.72  
    2.73 +# look for wanted $PACKAGE in wanted.txt
    2.74  look_for_wanted()
    2.75  {
    2.76  	grep -m1 ^$PACKAGE$'\t' $wan_db | cut -f 2
    2.77  }
    2.78  
    2.79 +# look for reverse wanted $PACKAGE in wanted.txt
    2.80  look_for_rwanted()
    2.81  {
    2.82  	for rwanted in $(grep $'\t'$PACKAGE$ $wan_db | cut -f 1); do
    2.83 @@ -187,6 +199,7 @@
    2.84  	done
    2.85  }
    2.86  
    2.87 +# look for -dev $WANTED packages in wanted.txt
    2.88  look_for_dev()
    2.89  {
    2.90  	WANTED=$(look_for_wanted)
    2.91 @@ -196,6 +209,7 @@
    2.92  	[ -f "$WOK/$PACKAGE-dev/receipt" ] && echo $PACKAGE-dev
    2.93  }
    2.94  
    2.95 +# make list with $PACKAGE and $PACKAGE-dev
    2.96  with_dev()
    2.97  {
    2.98  	for PACKAGE in $(cat); do
    2.99 @@ -204,6 +218,7 @@
   2.100  	done
   2.101  }
   2.102  
   2.103 +# make list with $PACKAGE and all its wanted receipt
   2.104  with_wanted()
   2.105  {
   2.106  	for PACKAGE in $(cat); do
   2.107 @@ -253,6 +268,7 @@
   2.108  	fi
   2.109  }
   2.110  
   2.111 +# add changed md5sum receipts to $commits
   2.112  set_commited()
   2.113  {
   2.114  	grep -q ^$PACKAGE$ $commits || echo $PACKAGE >> $commits
   2.115 @@ -260,6 +276,7 @@
   2.116  	update_dep_db
   2.117  }
   2.118  
   2.119 +# gen md5 files for receipt and stuff files
   2.120  gen_cookmd5()
   2.121  {
   2.122  	# md5sum of cooking stuff make tazwok able to check for changes
   2.123 @@ -448,12 +465,14 @@
   2.124  	unset wanted_list
   2.125  }
   2.126  
   2.127 +# update depends.txt file
   2.128  update_dep_db()
   2.129  {
   2.130  	sed "/^$PACKAGE\t/d" -i $dep_db
   2.131  	echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ' >> $dep_db
   2.132  }
   2.133  
   2.134 +# create sorted fullco.txt file
   2.135  sort_db()
   2.136  {
   2.137  	#echo "Generating full cookorder (fullco)"
   2.138 @@ -535,6 +554,7 @@
   2.139  	grep -m1 -A1 -sh ^$PACKAGE$ $1/packages.txt | tail -1 | sed 's/ *//'
   2.140  }
   2.141  
   2.142 +# remove previous package
   2.143  remove_previous_package()
   2.144  {
   2.145  	if [ "$prev_VERSION" ] && [ "$VERSION$EXTRAVERSION" != "$prev_VERSION" ]; then
   2.146 @@ -543,6 +563,7 @@
   2.147  	return 0
   2.148  }
   2.149  
   2.150 +# create cook list
   2.151  gen_cook_list()
   2.152  {
   2.153  	#echo "Scanning wok"
   2.154 @@ -577,6 +598,7 @@
   2.155  	sort_cooklist
   2.156  }
   2.157  
   2.158 +# sort cooklist
   2.159  sort_cooklist()
   2.160  {
   2.161  	if [ "$(sed 1!d $fullco)" = "#PlanSort" ]; then
   2.162 @@ -652,6 +674,7 @@
   2.163  	return 1
   2.164  }
   2.165  
   2.166 +# check $INCOMING packages into $PKGS
   2.167  check_for_incoming()
   2.168  {
   2.169  	echo "Checking that all packages were cooked OK"
   2.170 @@ -757,6 +780,7 @@
   2.171  	done
   2.172  }
   2.173  
   2.174 +# get package files for building libraries.txt, files.list.lzma, and packages.desc
   2.175  get_pkg_files()
   2.176  {
   2.177  	pkg_files_dir=/tmp/cook/$(basename ${1%.tazpkg})
   2.178 @@ -767,6 +791,7 @@
   2.179  		cpio --quiet -idm library.list < $1 2>/dev/null
   2.180  }
   2.181  
   2.182 +# check .so files
   2.183  check_so_files()
   2.184  {
   2.185  	pwd=$(pwd)