cookutils diff cook @ rev 894
cook: fix copy() -> cook_copy_folders() for repeated copying; web/cooker.cgi: manage packages with '+' in the name; web/style.css: get styles from mirror1.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Mar 24 17:29:16 2017 +0200 (2017-03-24) |
parents | 2cb347d1b668 |
children | ea11d3c96873 |
line diff
1.1 --- a/cook Fri Mar 17 00:44:10 2017 +0200 1.2 +++ b/cook Fri Mar 24 17:29:16 2017 +0200 1.3 @@ -403,10 +403,10 @@ 1.4 # A bit smarter function than the classic `cp` command 1.5 1.6 copy() { 1.7 - if [ "$(stat -c %h -- "$1")" -gt 1 ]; then 1.8 + if [ -d "$1" -o "$(stat -c %h -- "$1")" -eq 1 ]; then 1.9 + cp -a "$1" "$2" # copy folders and generic files 1.10 + else 1.11 cp -al "$1" "$2" # copy hardlinks 1.12 - else 1.13 - cp -a "$1" "$2" # copy generic files 1.14 fi 1.15 } 1.16 1.17 @@ -782,6 +782,68 @@ 1.18 } 1.19 1.20 1.21 +# Receipt used for cooking the package is redundant to be included into package. 1.22 +# This script will strip the original receipt to bare minimum: variables, 1.23 +# {pre,post}_{install,remove} functions. 1.24 + 1.25 +mk_pkg_receipt() { 1.26 + orig_receipt="$1" 1.27 + # $pkg is package name 1.28 + 1.29 + # Receipt's signature is important, although some receipts may miss it 1.30 + signature=$(head -n1 "$orig_receipt") 1.31 + [ "${signature:0:1}" == '#' ] || signature='# SliTaz package receipt.' 1.32 + 1.33 + . "$orig_receipt" 1.34 + 1.35 + # Is package splitted one? 1.36 + [ -n "$SPLIT" -a "${SPLIT/$pkg/}" != "$SPLIT" ]; splitted=$? 1.37 + 1.38 + # Manage splitted packages 1.39 + if $splitted; then 1.40 + # For packages with empty $DEPENDS 1.41 + [ -n "$DEPENDS" ] || DEPENDS="$PACKAGE" 1.42 + 1.43 + # Default $CAT 1.44 + [ -z "$CAT" ] && 1.45 + case $pkg in 1.46 + *-dev) CAT="development|development files" ;; 1.47 + esac 1.48 + 1.49 + # Manage $CAT 1.50 + CATEGORY="${CAT%|*}" 1.51 + SHORT_DESC="$SHORT_DESC (${CAT#*|})" 1.52 + fi 1.53 + 1.54 + # Mandatory variables 1.55 + cat <<EOF 1.56 +$signature 1.57 + 1.58 +PACKAGE="$PACKAGE" 1.59 +VERSION="$VERSION" 1.60 +CATEGORY="$CATEGORY" 1.61 +SHORT_DESC="$SHORT_DESC" 1.62 +MAINTAINER="$MAINTAINER" 1.63 +LICENSE="$LICENSE" 1.64 +WEB_SITE="$WEB_SITE" 1.65 +EOF 1.66 + 1.67 + # Optional variables 1.68 + [ -n "$TAGS" ] && echo "TAGS=\"$TAGS\"" 1.69 + [ -n "$DEPENDS" ] && echo "DEPENDS=\"$DEPENDS\"" 1.70 + 1.71 + # Extract {pre,post}_{install,remove} functions 1.72 + for i in pre post; do 1.73 + for j in install remove; do 1.74 + if grep -q "^${i}_$j()"; then 1.75 + echo 1.76 + sed "/^${i}_$j()/,/}/!d" "$orig_receipt" 1.77 + fi 1.78 + done 1.79 + done 1.80 +} 1.81 + 1.82 + 1.83 # Create the package. Wanted to use TazPkg to create a tazpkg package at first, 1.84 # but it doesn't handle EXTRAVERSION. 1.85