cookutils rev 1116

cook, modules/precheck: provide CATEGORY="nopack"; modules/pack: improve variables handling; modules/postcheck: display badge "old" both with any other badges
:
CATEGORY="nopack" is useful in the case, for example, when receipt called "libappindicator" but we want to produce only two sub-packages: "libappindicator-gtk2" and "libappindicator-gtk3" and don't want to pack "libappindicator".
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Dec 17 01:16:27 2018 +0200 (2018-12-17)
parents 77272271e283
children 30e44d7bad1a
files cook lighttpd/index.cgi modules/pack modules/postcheck modules/precheck
line diff
     1.1 --- a/cook	Tue Dec 11 23:15:30 2018 +0200
     1.2 +++ b/cook	Mon Dec 17 01:16:27 2018 +0200
     1.3 @@ -361,6 +361,7 @@
     1.4  		version=$(awk -F$'\t' -vpkg="$i" '{
     1.5  			if ($1 == pkg) {print $2; exit}
     1.6  		}' "$PKGS/packages-$ARCH.info")
     1.7 +		[ -n "$version" ] || continue
     1.8  		fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}')
     1.9  		arch=$(awk -F$'\t' -vi="$i" '{if ($1 == i) print $2}' $pkgdir/.arch)
    1.10  		pkgname="$i-$version-$arch.tazpkg"
     2.1 --- a/lighttpd/index.cgi	Tue Dec 11 23:15:30 2018 +0200
     2.2 +++ b/lighttpd/index.cgi	Mon Dec 17 01:16:27 2018 +0200
     2.3 @@ -2502,7 +2502,7 @@
     2.4  					;;
     2.5  				man)
     2.6  					#export TEXTDOMAIN='man2html'
     2.7 -					echo "<div id='content2'>"
     2.8 +					echo "<div id='content2' class='manpage'>"
     2.9  
    2.10  					html=$(./man2html.bin "$tmp" | sed -e '1,/<header>/d' -e '/<footer>/,$d' \
    2.11  					-e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
     3.1 --- a/modules/pack	Tue Dec 11 23:15:30 2018 +0200
     3.2 +++ b/modules/pack	Mon Dec 17 01:16:27 2018 +0200
     3.3 @@ -458,7 +458,7 @@
     3.4  
     3.5  find_vars() {
     3.6  	# You can define variables in the root of the receipt describing
     3.7 -	# the dependencies (tags, config files, etc.) for each sub-package.
     3.8 +	# the dependencies (or tags, config files, etc.) for each sub-package.
     3.9  	# Example:
    3.10  	#   PACKAGE="cool"
    3.11  	#   SPLIT="$PACKAGE-extra libcool $PACKAGE-dev"
    3.12 @@ -470,14 +470,15 @@
    3.13  
    3.14  	local out
    3.15  	local var=$1
    3.16 -	local pkg=$(echo -n $2       | tr -c 'a-zA-Z0-9' '_')
    3.17 +	local pkg=$(echo -n $2             | tr -c 'a-zA-Z0-9' '_')
    3.18  	local end=$(echo -n ${2#$basepkg-} | tr -c 'a-zA-Z0-9' '_')
    3.19  	if [ "$2" == "$basepkg" ]; then
    3.20 -		eval out="\$${var}_$pkg"
    3.21 -		[ -n "$out" ] || eval out="\$${var}_std"
    3.22 +		eval out="\$${var}_$pkg"                  # DEPENDS_cool
    3.23 +		[ -n "$out" ] || eval out="\$${var}_std"  # DEPENDS_std
    3.24 +		[ -n "$out" ] || eval out="\$$var"        # DEPENDS
    3.25  	else
    3.26 -		eval out="\$${var}_$pkg"
    3.27 -		[ -n "$out" ] || eval out="\$${var}_$end"
    3.28 +		eval out="\$${var}_$pkg"                  # DEPENDS_cool_extra
    3.29 +		[ -n "$out" ] || eval out="\$${var}_$end" # DEPENDS_extra
    3.30  	fi
    3.31  	echo "$out"
    3.32  }
    3.33 @@ -522,33 +523,51 @@
    3.34  	# Execute genpkg_rules()
    3.35  	#
    3.36  
    3.37 +	require_copy='yes'
    3.38 +	[ "${COOKOPTS/empty-pkg/}" != "$COOKOPTS" ] && require_copy='no'
    3.39 +
    3.40  	if grep -q ^genpkg_rules $receipt; then
    3.41  		_ 'Executing: %s' 'genpkg_rules'
    3.42 -		set -e; cd $pkgdir; mkdir -p $fs
    3.43 -		genpkg_rules || (newline; _ 'ERROR: genpkg_rules failed'; newline) >> \
    3.44 -			$LOGS/$pkg.log
    3.45 +		set -e
    3.46 +		cd $pkgdir; mkdir -p $fs
    3.47 +		genpkg_rules || (newline; _ 'ERROR: genpkg_rules failed'; newline) >> $LOGS/$pkg.log
    3.48 +		require_copy='no'
    3.49  	else
    3.50 -		cd $pkgdir
    3.51 -		mkdir -p $fs
    3.52 +		cd $pkgdir; mkdir -p $fs
    3.53  		if [ "$CATEGORY" == 'meta' -a "$thispkg" == "$basepkg" ]; then
    3.54  			_ 'No packages rules: meta package'
    3.55 -		else
    3.56 -			# Auto-packing
    3.57 -			for i in DEPENDS SUGGESTED PROVIDE CONFIG_FILES TAGS CAT COPY; do
    3.58 -				eval $i="\$(find_vars $i $thispkg)"
    3.59 -			done
    3.60 +			require_copy='no'
    3.61 +		fi
    3.62 +	fi
    3.63  
    3.64 -			[ -n "$COPY" ] ||
    3.65 -			case "$thispkg" in
    3.66 -				$basepkg)    COPY='@std @rm';;
    3.67 -				*-dev)       COPY='@dev @rm';;
    3.68 -				lib$basepkg) COPY='*.so*';;
    3.69 -			esac
    3.70 -			[ -n "$COPY" ] || die "ERROR: COPY_$thispkg rules undefined"
    3.71 +	# Auto-packing
    3.72 +
    3.73 +	for i in DEPENDS SUGGESTED PROVIDE CONFIG_FILES TAGS CATEGORY CAT COPY; do
    3.74 +		eval $i="\$(find_vars $i $thispkg)"
    3.75 +	done
    3.76 +
    3.77 +	[ -n "$CAT" ] && CATEGORY=$(echo "$CAT" | cut -d'|' -f1)
    3.78 +
    3.79 +	if [ "$CATEGORY" != 'meta' -a "$CATEGORY" != 'nopack' ]; then
    3.80 +		[ -n "$COPY" ] ||
    3.81 +		case "$thispkg" in
    3.82 +			$basepkg)    COPY='@std @rm';;
    3.83 +			*-dev)       COPY='@dev @rm';;
    3.84 +			lib$basepkg) COPY='*.so*';;
    3.85 +		esac
    3.86 +		if [ -n "$COPY" ]; then
    3.87  			copy $COPY
    3.88 +		elif [ "$require_copy" == 'yes' ]; then
    3.89 +			var=$(echo -n COPY_$thispkg | tr -c 'a-zA-Z0-9' '_')
    3.90 +			die "ERROR: $var rules undefined"
    3.91  		fi
    3.92  	fi
    3.93  
    3.94 +	if [ "$CATEGORY" == 'nopack' ]; then
    3.95 +		echo "Skipping $thispkg"
    3.96 +		return
    3.97 +	fi
    3.98 +
    3.99  
   3.100  	#
   3.101  	# Check CONFIG_FILES
     4.1 --- a/modules/postcheck	Tue Dec 11 23:15:30 2018 +0200
     4.2 +++ b/modules/postcheck	Mon Dec 17 01:16:27 2018 +0200
     4.3 @@ -133,7 +133,7 @@
     4.4  				add 'libtool'
     4.5  			fi
     4.6  		else
     4.7 -			if grep -q '^fix.libtool$' $WOK/$1/.patch.done 2>/dev/null; then
     4.8 +			if grep -q '^\s*fix libtool' $WOK/$1/receipt 2>/dev/null; then
     4.9  				add 'nolibtool'
    4.10  			fi
    4.11  		fi
    4.12 @@ -269,9 +269,9 @@
    4.13  	if [ "$REPOLOGY" != '-' ]; then
    4.14  		action 'Querying Repology...'
    4.15  		repo_ver=$(repology_get ${REPOLOGY:-$PACKAGE})
    4.16 -		if [ "$repo_ver" != '-' -a ! -s $fail ]; then
    4.17 +		if [ "$repo_ver" != '-' ]; then
    4.18  			if echo " $repo_ver " | fgrep -q " $VERSION "; then
    4.19 -				add 'win'
    4.20 +				[ -s $fail ] || add 'win'
    4.21  			else
    4.22  				add 'old'
    4.23  			fi
     5.1 --- a/modules/precheck	Tue Dec 11 23:15:30 2018 +0200
     5.2 +++ b/modules/precheck	Mon Dec 17 01:16:27 2018 +0200
     5.3 @@ -22,7 +22,7 @@
     5.4  
     5.5  	case "$var" in
     5.6  		CATEGORY)
     5.7 -			valid="$(echo $PKGS_CATEGORIES)" # avoid newlines
     5.8 +			valid="$(echo $PKGS_CATEGORIES nopack)" # avoid newlines
     5.9  			if ! echo " $valid " | grep -q " $value "; then
    5.10  				newline
    5.11  				_ 'QA: unknown category "%s"' "$value"