makepkg: handle multiple install and changelog files

The presence of all install and changelog files (multiple files may
be used with package splitting) is checked for in check_sanity().

All install and changelog files are copied to the source location
when using --source.  The check for install and changelog file presence
is removed in create_srcpackage() as this is redundant to the checks
performed in check_sanity().

Moved install and changelog handling in create_srcpackage() to after
source array files, as this is more logical and readily allows for the
following.

A check is made when creating a source package that a symlink to an
install file has not already been added.  This can occur if the
install file is used multiple times or if it is listed in the source
array.

Fixes FS#18831, FS#18394 and partially fixes FS#16004

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2010-04-26 14:59:42 +10:00 committed by Dan McGee
parent 590606a5d7
commit 64c3255b0e

View file

@ -1068,24 +1068,6 @@ create_srcpackage() {
msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT" msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT"
ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}" ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}"
if [[ -n $install ]]; then
if [[ -f $install ]]; then
msg2 "$(gettext "Adding install script...")"
ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/"
else
error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
fi
fi
if [[ -n $changelog ]]; then
if [[ -f $changelog ]]; then
msg2 "$(gettext "Adding package changelog...")"
ln -s "${startdir}/$changelog" "${srclinks}/${pkgbase}/"
else
error "$(gettext "Changelog file (%s) does not exist.")" "$changelog"
fi
fi
local netfile local netfile
for netfile in "${source[@]}"; do for netfile in "${source[@]}"; do
local file=$(get_filename "$netfile") local file=$(get_filename "$netfile")
@ -1098,6 +1080,32 @@ create_srcpackage() {
fi fi
done done
local install_files=( $(grep "^[[:space:]]*install=" "$BUILDSCRIPT" | sed "s/install=//") )
if [[ -n $install_files ]]; then
local file
for file in ${install_files[@]}; do
# evaluate any bash variables used
eval file=${file}
if [[ ! -f "${srclinks}/${pkgbase}/$file" ]]; then
msg2 "$(gettext "Adding install script (%s)...")" "$file"
ln -s "${startdir}/$file" "${srclinks}/${pkgbase}/"
fi
done
fi
local changelog_files=( $(grep "^[[:space:]]*changelog=" "$BUILDSCRIPT" | sed "s/changelog=//") )
if [[ -n $changelog_files ]]; then
local file
for file in ${changelog_files[@]}; do
# evaluate any bash variables used
eval file=${file}
if [[ ! -f "${srclinks}/${pkgbase}/$file" ]]; then
msg2 "$(gettext "Adding package changelog (%s)...")" "$file"
ln -s "${startdir}/$file" "${srclinks}/${pkgbase}/"
fi
done
fi
local TAR_OPT local TAR_OPT
case "$SRCEXT" in case "$SRCEXT" in
*tar.gz) TAR_OPT="z" ;; *tar.gz) TAR_OPT="z" ;;
@ -1215,14 +1223,29 @@ check_sanity() {
fi fi
done done
if [[ $install && ! -f $install ]]; then local install_files=( $(grep "^[[:space:]]*install=" "$BUILDSCRIPT" | sed "s/install=//") )
error "$(gettext "Install scriptlet (%s) does not exist.")" "$install" if [[ -n $install_files ]]; then
return 1 local file
for file in ${install_files[@]}; do
# evaluate any bash variables used
eval file=${file}
if [[ ! -f $file ]]; then
error "$(gettext "Install scriptlet (%s) does not exist.")" "$file"
return 1
fi
done
fi fi
if [[ -n $changelog && ! -f $changelog ]]; then local changelog_files=( $(grep "^[[:space:]]*changelog=" "$BUILDSCRIPT" | sed "s/changelog=//") )
error "$(gettext "Changelog file (%s) does not exist.")" "$changelog" if [[ -n $changelog_files ]]; then
return 1 for file in ${changelog_files[@]}; do
# evaluate any bash variables used
eval file=${file}
if [[ ! -f $file ]]; then
error "$(gettext "Changelog file (%s) does not exist.")" "$file"
return 1
fi
done
fi fi
local valid_options=1 local valid_options=1