cookutils diff modules/pack @ 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".
:
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 | e027dbdf061e |
children | f87179115961 |
line diff
1.1 --- a/modules/pack Sun Dec 09 23:24:05 2018 +0200 1.2 +++ b/modules/pack Mon Dec 17 01:16:27 2018 +0200 1.3 @@ -458,7 +458,7 @@ 1.4 1.5 find_vars() { 1.6 # You can define variables in the root of the receipt describing 1.7 - # the dependencies (tags, config files, etc.) for each sub-package. 1.8 + # the dependencies (or tags, config files, etc.) for each sub-package. 1.9 # Example: 1.10 # PACKAGE="cool" 1.11 # SPLIT="$PACKAGE-extra libcool $PACKAGE-dev" 1.12 @@ -470,14 +470,15 @@ 1.13 1.14 local out 1.15 local var=$1 1.16 - local pkg=$(echo -n $2 | tr -c 'a-zA-Z0-9' '_') 1.17 + local pkg=$(echo -n $2 | tr -c 'a-zA-Z0-9' '_') 1.18 local end=$(echo -n ${2#$basepkg-} | tr -c 'a-zA-Z0-9' '_') 1.19 if [ "$2" == "$basepkg" ]; then 1.20 - eval out="\$${var}_$pkg" 1.21 - [ -n "$out" ] || eval out="\$${var}_std" 1.22 + eval out="\$${var}_$pkg" # DEPENDS_cool 1.23 + [ -n "$out" ] || eval out="\$${var}_std" # DEPENDS_std 1.24 + [ -n "$out" ] || eval out="\$$var" # DEPENDS 1.25 else 1.26 - eval out="\$${var}_$pkg" 1.27 - [ -n "$out" ] || eval out="\$${var}_$end" 1.28 + eval out="\$${var}_$pkg" # DEPENDS_cool_extra 1.29 + [ -n "$out" ] || eval out="\$${var}_$end" # DEPENDS_extra 1.30 fi 1.31 echo "$out" 1.32 } 1.33 @@ -522,33 +523,51 @@ 1.34 # Execute genpkg_rules() 1.35 # 1.36 1.37 + require_copy='yes' 1.38 + [ "${COOKOPTS/empty-pkg/}" != "$COOKOPTS" ] && require_copy='no' 1.39 + 1.40 if grep -q ^genpkg_rules $receipt; then 1.41 _ 'Executing: %s' 'genpkg_rules' 1.42 - set -e; cd $pkgdir; mkdir -p $fs 1.43 - genpkg_rules || (newline; _ 'ERROR: genpkg_rules failed'; newline) >> \ 1.44 - $LOGS/$pkg.log 1.45 + set -e 1.46 + cd $pkgdir; mkdir -p $fs 1.47 + genpkg_rules || (newline; _ 'ERROR: genpkg_rules failed'; newline) >> $LOGS/$pkg.log 1.48 + require_copy='no' 1.49 else 1.50 - cd $pkgdir 1.51 - mkdir -p $fs 1.52 + cd $pkgdir; mkdir -p $fs 1.53 if [ "$CATEGORY" == 'meta' -a "$thispkg" == "$basepkg" ]; then 1.54 _ 'No packages rules: meta package' 1.55 - else 1.56 - # Auto-packing 1.57 - for i in DEPENDS SUGGESTED PROVIDE CONFIG_FILES TAGS CAT COPY; do 1.58 - eval $i="\$(find_vars $i $thispkg)" 1.59 - done 1.60 + require_copy='no' 1.61 + fi 1.62 + fi 1.63 1.64 - [ -n "$COPY" ] || 1.65 - case "$thispkg" in 1.66 - $basepkg) COPY='@std @rm';; 1.67 - *-dev) COPY='@dev @rm';; 1.68 - lib$basepkg) COPY='*.so*';; 1.69 - esac 1.70 - [ -n "$COPY" ] || die "ERROR: COPY_$thispkg rules undefined" 1.71 + # Auto-packing 1.72 + 1.73 + for i in DEPENDS SUGGESTED PROVIDE CONFIG_FILES TAGS CATEGORY CAT COPY; do 1.74 + eval $i="\$(find_vars $i $thispkg)" 1.75 + done 1.76 + 1.77 + [ -n "$CAT" ] && CATEGORY=$(echo "$CAT" | cut -d'|' -f1) 1.78 + 1.79 + if [ "$CATEGORY" != 'meta' -a "$CATEGORY" != 'nopack' ]; then 1.80 + [ -n "$COPY" ] || 1.81 + case "$thispkg" in 1.82 + $basepkg) COPY='@std @rm';; 1.83 + *-dev) COPY='@dev @rm';; 1.84 + lib$basepkg) COPY='*.so*';; 1.85 + esac 1.86 + if [ -n "$COPY" ]; then 1.87 copy $COPY 1.88 + elif [ "$require_copy" == 'yes' ]; then 1.89 + var=$(echo -n COPY_$thispkg | tr -c 'a-zA-Z0-9' '_') 1.90 + die "ERROR: $var rules undefined" 1.91 fi 1.92 fi 1.93 1.94 + if [ "$CATEGORY" == 'nopack' ]; then 1.95 + echo "Skipping $thispkg" 1.96 + return 1.97 + fi 1.98 + 1.99 1.100 # 1.101 # Check CONFIG_FILES