The spec generator only supports Requires, Conflicts and Provides from the [pkg.requires.*], [pkg.conflicts.*] and [pkg.provides.*] sections of make/project.conf. A package that works without but is better with another package, like jw-amavis-run without jw-clamav-run, must hard-require it, so the dependency is pulled in on every install and cannot be removed without dragging the depending package along. This commit adds Recommends support to the spec generation chain: - CmdPkgRecommends: new pkg-recommends command that reads the [pkg.recommends.<flavour>] sections, same base as pkg-requires - pkg-dist.mk: compute PKG_RECOMMENDS_RUN and pass it to pkg.sh via a new -E option - pkg.sh: accept -E and forward it to the mkspec wrapper - mkspec-wrapper.sh: accept -E and export RECOMMENDS_RUN - create-mkspec.sh: emit a Recommends: line when RECOMMENDS_<subpkg> is set - create-mkdebian.sh: emit a Recommends: field in the debian control file Projects without a [pkg.recommends.*] section generate unchanged specs: every new line is guarded by a non-empty test. zypper follows Recommends by default, so existing OpenSUSE installations are unaffected; a recommended package can be removed without dragging the depending package along. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1 Signed-off-by: Jan Lindemann <jan@janware.com>
135 lines
2.3 KiB
Shell
135 lines
2.3 KiB
Shell
#!/bin/bash
|
|
|
|
usage()
|
|
{
|
|
echo usage: $MYNAME /path/to/mkspec.sh -h [-N name] [-T topdir] [-V version] [-S source] [-R requires] [-E recommends] [-P project] >&2
|
|
[ "$1" ] && exit $1
|
|
}
|
|
|
|
append()
|
|
{
|
|
local var=$1
|
|
shift
|
|
local tmp=`eval echo \"\\$$var $*\" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'`
|
|
eval $var=\"$tmp\"
|
|
}
|
|
|
|
# -- here we go
|
|
|
|
#set -x
|
|
|
|
MYNAME=`basename $0`
|
|
eval set -- `getopt -l "provides-run:" -l "provides-devel:" -o "P:T:V:S:N:hR:D:X:Y:E:d:" -- "$@"`
|
|
|
|
while [ "$1" != -- ]; do
|
|
echo checking "$1=$2" >&2
|
|
case $1 in
|
|
-h)
|
|
usage 0;;
|
|
-T)
|
|
TOPDIR="$2"
|
|
shift;;
|
|
-V)
|
|
V="$2"
|
|
shift;;
|
|
-S)
|
|
SOURCE="$2"
|
|
shift;;
|
|
-N)
|
|
NAME="$2"
|
|
shift;;
|
|
-R)
|
|
append REQUIRES_RUN "$2"
|
|
shift
|
|
;;
|
|
-E)
|
|
append RECOMMENDS_RUN "$2"
|
|
shift
|
|
;;
|
|
-X)
|
|
append CONFLICTS_RUN "$2"
|
|
shift
|
|
;;
|
|
-D)
|
|
append REQUIRES_DEVEL "$2"
|
|
shift
|
|
;;
|
|
-Y)
|
|
append CONFLICTS_DEVEL "$2"
|
|
shift
|
|
;;
|
|
--provides-run)
|
|
append PROVIDES_RUN "$2"
|
|
shift
|
|
;;
|
|
--provides-devel)
|
|
append PROVIDES_DEVEL "$2"
|
|
shift
|
|
;;
|
|
-P)
|
|
PROJECT="$2"
|
|
shift;;
|
|
-d)
|
|
DISTRIBUTION="$2"
|
|
shift;;
|
|
*)
|
|
usage 1;;
|
|
esac
|
|
shift
|
|
done
|
|
shift
|
|
|
|
os=$(sed '/^ID=/ !d; s/^ID=//; s/"//g' /etc/os-release)
|
|
[ ! "$INSTALL_LOG" ] && INSTALL_LOG=/tmp/pkg-build-$ID-$(id -un)-$os/install.log
|
|
|
|
MKSPEC_SH="$1"
|
|
shift
|
|
|
|
[ -z "$TOPDIR" ] && TOPDIR=.
|
|
|
|
if [ -z "$V" ]; then
|
|
if [ -f $TOPDIR/VERSION ]; then
|
|
VERSION="`cat $TOPDIR/VERSION | cut -d- -f1`"
|
|
RELEASE="`cat $TOPDIR/VERSION | cut -d- -f2- | sed 's/[-_].*//'`"
|
|
else
|
|
VERSION=noversion
|
|
RELEASE=norelease
|
|
fi
|
|
else
|
|
VERSION="`echo $V | cut -d- -f1`"
|
|
RELEASE="`cat $TOPDIR/VERSION | cut -d- -f2- | sed 's/[-_].*//'`"
|
|
fi
|
|
|
|
if [ -z "$NAME" ]; then
|
|
NAME=`pwd | xargs basename`
|
|
fi
|
|
|
|
REQUIRES="$REQUIRES_RUN $REQUIRES_DEVEL"
|
|
CONFLICTS="$CONFLICTS_RUN $CONFLICTS_DEVEL"
|
|
#if [ -n "$REQUIRES" ]; then
|
|
# REQUIRES_RUN=`echo $REQUIRES |
|
|
# sed -e '
|
|
# s/\([a-zA-Z-]\+\) *\([<>=]*\) *\([a-zA-Z0-9\.-]*\)/\1-run \2 \3,/g
|
|
# s/,$//
|
|
# s/-run-run/-run/
|
|
# '`
|
|
# REQUIRES_DEVEL="$REQUIRES_RUN, $NAME-run = $VERSION-$RELEASE, `echo $REQUIRES_RUN | sed -e 's/-run/-devel/g'`"
|
|
#fi
|
|
|
|
#echo "REQUIRES_RUN=\"$REQUIRES_RUN\""
|
|
#exit
|
|
|
|
export \
|
|
REQUIRES REQUIRES_RUN REQUIRES_DEVEL \
|
|
RECOMMENDS_RUN \
|
|
CONFLICTS CONFLICTS_RUN CONFLICTS_DEVEL \
|
|
PROVIDES PROVIDES_RUN PROVIDES_DEVEL \
|
|
TOPDIR \
|
|
PROJECT NAME \
|
|
SOURCE \
|
|
VERSION RELEASE V \
|
|
INSTALL_LOG \
|
|
DISTRIBUTION
|
|
|
|
bash $MKSPEC_SH
|
|
|