2012-01-26 10:28:31 -05:00
|
|
|
#!/bin/bash
|
2006-12-21 19:11:22 +00:00
|
|
|
#
|
2009-08-18 22:10:56 +02:00
|
|
|
# makepkg - make packages compatible for use with pacman
|
2006-12-21 19:11:22 +00:00
|
|
|
#
|
2024-02-24 18:40:44 +10:00
|
|
|
# Copyright (c) 2006-2024 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
2009-07-01 02:08:33 -05:00
|
|
|
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2006-11-14 07:58:42 +00:00
|
|
|
# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
2006-10-19 15:15:20 +00:00
|
|
|
# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
2006-11-14 07:58:42 +00:00
|
|
|
# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
|
|
|
# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
|
|
|
|
# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org>
|
2006-12-21 19:11:22 +00:00
|
|
|
#
|
2005-03-15 01:51:43 +00:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
2006-12-21 19:11:22 +00:00
|
|
|
#
|
2005-03-15 01:51:43 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2006-12-21 19:11:22 +00:00
|
|
|
#
|
2005-03-15 01:51:43 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-12-10 22:55:22 -06:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-15 01:51:43 +00:00
|
|
|
#
|
|
|
|
|
2007-07-15 22:31:29 -04:00
|
|
|
# makepkg uses quite a few external programs during its execution. You
|
|
|
|
# need to have at least the following installed for makepkg to function:
|
2010-12-07 17:48:16 +10:00
|
|
|
# awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, file, find (findutils),
|
2016-10-11 23:04:25 +10:00
|
|
|
# gettext, gpg, grep, gzip, sed, tput (ncurses), xz
|
2007-07-15 22:31:29 -04:00
|
|
|
|
2007-03-31 20:07:37 -04:00
|
|
|
# gettext initialization
|
2011-06-23 21:21:51 -05:00
|
|
|
export TEXTDOMAIN='pacman-scripts'
|
2007-06-01 15:28:52 +01:00
|
|
|
export TEXTDOMAINDIR='@localedir@'
|
2007-03-31 20:07:37 -04:00
|
|
|
|
2008-05-28 03:23:56 +08:00
|
|
|
# file -i does not work on Mac OSX unless legacy mode is set
|
|
|
|
export COMMAND_MODE='legacy'
|
2012-02-14 10:11:43 -06:00
|
|
|
# Ensure CDPATH doesn't screw with our cd calls
|
|
|
|
unset CDPATH
|
2013-03-29 21:52:55 -04:00
|
|
|
# Ensure GREP_OPTIONS doesn't screw with our grep calls
|
|
|
|
unset GREP_OPTIONS
|
2008-05-28 03:23:56 +08:00
|
|
|
|
2012-07-15 15:46:29 +10:00
|
|
|
declare -r makepkg_version='@PACKAGE_VERSION@'
|
2011-12-06 22:29:33 +01:00
|
|
|
declare -r confdir='@sysconfdir@'
|
|
|
|
declare -r BUILDSCRIPT='@BUILDSCRIPT@'
|
2009-01-16 22:22:04 +10:00
|
|
|
|
2023-10-21 01:45:20 +01:00
|
|
|
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
2013-09-22 11:25:30 +01:00
|
|
|
|
2006-01-22 02:16:41 +00:00
|
|
|
# Options
|
2012-07-09 01:55:58 -04:00
|
|
|
ASDEPS=0
|
2013-10-09 13:28:23 +10:00
|
|
|
BUILDFUNC=0
|
2019-01-04 00:32:09 -05:00
|
|
|
BUILDPKG=1
|
2023-01-29 14:04:34 +00:00
|
|
|
CHDIR=''
|
2013-10-09 13:28:23 +10:00
|
|
|
CHECKFUNC=0
|
|
|
|
CLEANBUILD=0
|
2006-01-22 02:16:41 +00:00
|
|
|
CLEANUP=0
|
|
|
|
DEP_BIN=0
|
|
|
|
FORCE=0
|
2006-11-14 07:58:42 +00:00
|
|
|
GENINTEG=0
|
2012-07-16 00:16:25 +10:00
|
|
|
HOLDVER=0
|
2013-10-09 13:28:23 +10:00
|
|
|
IGNOREARCH=0
|
|
|
|
INFAKEROOT=0
|
2006-01-22 02:16:41 +00:00
|
|
|
INSTALL=0
|
2013-10-09 13:28:23 +10:00
|
|
|
LOGGING=0
|
|
|
|
NEEDED=0
|
2014-03-03 20:29:54 +01:00
|
|
|
NOARCHIVE=0
|
2006-01-22 02:16:41 +00:00
|
|
|
NOBUILD=0
|
|
|
|
NODEPS=0
|
|
|
|
NOEXTRACT=0
|
2009-01-17 16:41:01 +10:00
|
|
|
PKGFUNC=0
|
2013-10-09 13:28:23 +10:00
|
|
|
PKGVERFUNC=0
|
|
|
|
PREPAREFUNC=0
|
|
|
|
REPKG=0
|
2017-09-12 23:59:24 -04:00
|
|
|
REPRODUCIBLE=0
|
2013-10-09 13:28:23 +10:00
|
|
|
RMDEPS=0
|
|
|
|
SKIPCHECKSUMS=0
|
|
|
|
SKIPPGPCHECK=0
|
2011-03-26 12:06:06 +10:00
|
|
|
SIGNPKG=''
|
2013-10-09 13:28:23 +10:00
|
|
|
SPLITPKG=0
|
|
|
|
SOURCEONLY=0
|
|
|
|
VERIFYSOURCE=0
|
2006-01-22 02:16:41 +00:00
|
|
|
|
2024-05-20 20:50:43 +10:00
|
|
|
MAKEPKG_LINT_PKGBUILD=${MAKEPKG_LINT_PKGBUILD:-1}
|
|
|
|
|
2016-02-20 16:02:31 +10:00
|
|
|
PACMAN_OPTS=()
|
2006-02-16 22:57:25 +00:00
|
|
|
|
2011-09-03 22:24:27 -04:00
|
|
|
shopt -s extglob
|
|
|
|
|
2005-03-15 01:51:43 +00:00
|
|
|
### SUBROUTINES ###
|
|
|
|
|
2015-01-27 00:45:47 +10:00
|
|
|
# Import libmakepkg
|
2023-10-21 01:45:20 +01:00
|
|
|
for lib in "$MAKEPKG_LIBRARY"/*.sh; do
|
2015-01-27 00:45:47 +10:00
|
|
|
source "$lib"
|
|
|
|
done
|
2007-06-03 01:59:54 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# Special exit call for traps, Don't print any error messages when inside,
|
|
|
|
# the fakeroot call, the error message will be printed by the main call.
|
|
|
|
##
|
|
|
|
trap_exit() {
|
2012-03-02 19:25:15 -05:00
|
|
|
local signal=$1; shift
|
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( ! INFAKEROOT )); then
|
2007-06-03 01:59:54 +01:00
|
|
|
echo
|
|
|
|
error "$@"
|
|
|
|
fi
|
2009-12-02 19:05:39 +01:00
|
|
|
[[ -n $srclinks ]] && rm -rf "$srclinks"
|
2012-03-02 19:25:15 -05:00
|
|
|
|
2024-12-24 20:04:34 +10:00
|
|
|
# Kill all child processes so that they are not left orphaned upon exit.
|
|
|
|
[[ -n "$(jobs -p)" ]] && kill "$(jobs -p)" 2>/dev/null
|
|
|
|
|
2012-03-02 19:25:15 -05:00
|
|
|
# unset the trap for this signal, and then call the default handler
|
|
|
|
trap -- "$signal"
|
|
|
|
kill "-$signal" "$$"
|
2007-06-03 01:59:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# Clean up function. Called automatically when the script exits.
|
|
|
|
##
|
|
|
|
clean_up() {
|
|
|
|
local EXIT_CODE=$?
|
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( INFAKEROOT )); then
|
2007-06-03 01:59:54 +01:00
|
|
|
# Don't clean up when leaving fakeroot, we're not done yet.
|
makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.
In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-31 17:46:51 +02:00
|
|
|
return 0
|
2007-06-03 01:59:54 +01:00
|
|
|
fi
|
|
|
|
|
2019-08-27 16:14:07 +10:00
|
|
|
if [[ -p $logpipe ]]; then
|
|
|
|
rm "$logpipe"
|
|
|
|
fi
|
|
|
|
|
2019-10-28 11:37:39 -04:00
|
|
|
if (( (EXIT_CODE == E_OK || EXIT_CODE == E_INSTALL_FAILED) && BUILDPKG && CLEANUP )); then
|
2010-06-25 18:46:36 -04:30
|
|
|
local pkg file
|
|
|
|
|
2007-06-03 01:59:54 +01:00
|
|
|
# If it's a clean exit and -c/--clean has been passed...
|
|
|
|
msg "$(gettext "Cleaning up...")"
|
2013-02-02 12:13:41 +10:00
|
|
|
rm -rf "$pkgdirbase" "$srcdir"
|
2009-11-12 15:07:34 -05:00
|
|
|
if [[ -n $pkgbase ]]; then
|
2011-07-22 21:42:53 +10:00
|
|
|
local fullver=$(get_full_version)
|
2007-06-03 01:59:54 +01:00
|
|
|
# Can't do this unless the BUILDSCRIPT has been sourced.
|
2017-04-12 16:53:53 +02:00
|
|
|
if (( PKGVERFUNC )); then
|
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-pkgver.log"*
|
|
|
|
fi
|
2022-05-11 20:19:35 +02:00
|
|
|
if (( VERIFYFUNC )); then
|
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-verify.log"*
|
|
|
|
fi
|
2017-04-12 16:53:53 +02:00
|
|
|
if (( PREPAREFUNC )); then
|
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-prepare.log"*
|
|
|
|
fi
|
2009-10-27 12:56:13 +01:00
|
|
|
if (( BUILDFUNC )); then
|
2011-01-20 18:16:06 -06:00
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-build.log"*
|
2009-10-27 12:56:13 +01:00
|
|
|
fi
|
2010-12-16 00:06:43 +10:00
|
|
|
if (( CHECKFUNC )); then
|
2011-01-20 18:16:06 -06:00
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-check.log"*
|
2010-12-16 00:06:43 +10:00
|
|
|
fi
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( PKGFUNC )); then
|
2011-01-20 18:16:06 -06:00
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-package.log"*
|
2009-11-12 15:07:34 -05:00
|
|
|
elif (( SPLITPKG )); then
|
2009-03-26 01:29:15 +10:00
|
|
|
for pkg in ${pkgname[@]}; do
|
2011-01-20 18:16:06 -06:00
|
|
|
rm -f "${pkgbase}-${fullver}-${CARCH}-package_${pkg}.log"*
|
2009-03-26 01:29:15 +10:00
|
|
|
done
|
|
|
|
fi
|
2009-11-02 23:31:15 -05:00
|
|
|
|
|
|
|
# clean up dangling symlinks to packages
|
|
|
|
for pkg in ${pkgname[@]}; do
|
2012-03-09 21:09:35 +10:00
|
|
|
for file in ${pkg}-*-*-*{${PKGEXT},${SRCEXT}}; do
|
2009-11-02 23:31:15 -05:00
|
|
|
if [[ -h $file && ! -e $file ]]; then
|
2012-03-09 17:32:11 +10:00
|
|
|
rm -f "$file"
|
2009-11-02 23:31:15 -05:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2007-06-03 01:59:54 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-01-20 23:14:14 +01:00
|
|
|
if ! remove_deps && (( EXIT_CODE == E_OK )); then
|
|
|
|
exit $E_REMOVE_DEPS_FAILED
|
|
|
|
else
|
|
|
|
exit $EXIT_CODE
|
|
|
|
fi
|
2007-06-03 01:59:54 +01:00
|
|
|
}
|
|
|
|
|
2011-06-15 16:02:22 +10:00
|
|
|
enter_fakeroot() {
|
2011-06-18 12:40:14 +10:00
|
|
|
msg "$(gettext "Entering %s environment...")" "fakeroot"
|
2018-06-12 07:28:51 -04:00
|
|
|
fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
|
2011-06-15 16:02:22 +10:00
|
|
|
}
|
|
|
|
|
2012-06-05 13:30:08 +10:00
|
|
|
# Automatically update pkgver variable if a pkgver() function is provided
|
|
|
|
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
|
|
|
|
update_pkgver() {
|
2018-08-29 01:10:21 -04:00
|
|
|
msg "$(gettext "Starting %s()...")" "pkgver"
|
2012-06-05 13:30:08 +10:00
|
|
|
newpkgver=$(run_function_safe pkgver)
|
2018-08-13 21:20:58 -04:00
|
|
|
if (( $? != 0 )); then
|
|
|
|
error_function pkgver
|
|
|
|
fi
|
2015-05-12 23:46:36 +10:00
|
|
|
if ! check_pkgver "$newpkgver"; then
|
2013-10-14 09:13:28 -04:00
|
|
|
error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PKGBUILD_ERROR
|
2013-10-14 09:13:28 -04:00
|
|
|
fi
|
2012-06-05 13:30:08 +10:00
|
|
|
|
|
|
|
if [[ -n $newpkgver && $newpkgver != "$pkgver" ]]; then
|
2019-11-05 20:29:11 -05:00
|
|
|
if [[ -w $BUILDFILE ]]; then
|
|
|
|
mapfile -t buildfile < "$BUILDFILE"
|
|
|
|
buildfile=("${buildfile[@]/#pkgver=*([^ ])/pkgver=$newpkgver}")
|
|
|
|
buildfile=("${buildfile[@]/#pkgrel=*([^ ])/pkgrel=1}")
|
|
|
|
if ! printf '%s\n' "${buildfile[@]}" > "$BUILDFILE"; then
|
2013-10-14 09:13:28 -04:00
|
|
|
error "$(gettext "Failed to update %s from %s to %s")" \
|
|
|
|
"pkgver" "$pkgver" "$newpkgver"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PKGBUILD_ERROR
|
2013-10-14 09:13:28 -04:00
|
|
|
fi
|
2013-10-14 16:35:09 +10:00
|
|
|
source_safe "$BUILDFILE"
|
2012-12-13 09:56:11 -06:00
|
|
|
local fullver=$(get_full_version)
|
|
|
|
msg "$(gettext "Updated version: %s")" "$pkgbase $fullver"
|
2012-06-05 13:30:08 +10:00
|
|
|
else
|
|
|
|
warning "$(gettext "%s is not writeable -- pkgver will not be updated")" \
|
|
|
|
"$BUILDFILE"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-06-03 22:08:25 +10:00
|
|
|
# Print 'source not found' error message and exit makepkg
|
|
|
|
missing_source_file() {
|
|
|
|
error "$(gettext "Unable to find source file %s.")" "$(get_filename "$1")"
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_MISSING_FILE
|
2012-06-03 22:08:25 +10:00
|
|
|
}
|
|
|
|
|
2009-11-18 23:29:07 +01:00
|
|
|
run_pacman() {
|
2021-04-05 17:26:07 -04:00
|
|
|
local cmd cmdescape
|
2019-02-20 20:55:44 -05:00
|
|
|
if [[ $1 = -@(T|Q)*([[:alpha:]]) ]]; then
|
2012-11-13 13:04:21 +10:00
|
|
|
cmd=("$PACMAN_PATH" "$@")
|
2019-02-20 20:55:44 -05:00
|
|
|
else
|
|
|
|
cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
|
2021-04-05 17:26:07 -04:00
|
|
|
cmdescape="$(printf '%q ' "${cmd[@]}")"
|
|
|
|
if (( ${#PACMAN_AUTH[@]} )); then
|
|
|
|
if in_array '%c' "${PACMAN_AUTH[@]}"; then
|
|
|
|
cmd=("${PACMAN_AUTH[@]/\%c/$cmdescape}")
|
|
|
|
else
|
|
|
|
cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}")
|
|
|
|
fi
|
|
|
|
elif type -p sudo >/dev/null; then
|
2024-05-05 14:27:20 +10:00
|
|
|
cmd=(sudo -k "${cmd[@]}")
|
2010-03-04 21:57:46 -05:00
|
|
|
else
|
2021-04-05 17:26:07 -04:00
|
|
|
cmd=(su root -c "$cmdescape")
|
2010-03-04 21:57:46 -05:00
|
|
|
fi
|
2019-02-20 21:35:19 -05:00
|
|
|
local lockfile="$(pacman-conf DBPath)/db.lck"
|
|
|
|
while [[ -f $lockfile ]]; do
|
|
|
|
local timer=0
|
|
|
|
msg "$(gettext "Pacman is currently in use, please wait...")"
|
|
|
|
while [[ -f $lockfile ]] && (( timer < 10 )); do
|
|
|
|
(( ++timer ))
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
done
|
2009-11-18 23:29:07 +01:00
|
|
|
fi
|
2012-02-29 21:55:44 -05:00
|
|
|
"${cmd[@]}"
|
2009-11-18 23:29:07 +01:00
|
|
|
}
|
|
|
|
|
2007-06-02 13:39:47 -04:00
|
|
|
check_deps() {
|
2010-06-23 13:16:36 +10:00
|
|
|
(( $# > 0 )) || return 0
|
2006-01-26 23:48:28 +00:00
|
|
|
|
2009-11-18 23:29:07 +01:00
|
|
|
local ret=0
|
2010-06-25 18:46:36 -04:30
|
|
|
local pmout
|
2012-01-26 10:28:31 -05:00
|
|
|
pmout=$(run_pacman -T "$@")
|
|
|
|
ret=$?
|
2011-08-17 16:56:07 -05:00
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( ret == 127 )); then #unresolved deps
|
2012-03-09 16:39:01 +10:00
|
|
|
printf "%s\n" "$pmout"
|
2009-11-12 15:07:34 -05:00
|
|
|
elif (( ret )); then
|
2009-12-02 19:04:32 +01:00
|
|
|
error "$(gettext "'%s' returned a fatal error (%i): %s")" "$PACMAN" "$ret" "$pmout"
|
2010-06-25 18:46:37 -04:30
|
|
|
return "$ret"
|
2005-03-15 01:51:43 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-08-07 16:40:04 +10:00
|
|
|
handle_deps() {
|
2007-05-30 17:47:47 +01:00
|
|
|
local R_DEPS_SATISFIED=0
|
|
|
|
local R_DEPS_MISSING=1
|
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
(( $# == 0 )) && return $R_DEPS_SATISFIED
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2014-12-22 21:12:50 -05:00
|
|
|
local deplist=("$@")
|
2007-03-19 22:48:54 +00:00
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( ! DEP_BIN )); then
|
2007-05-30 17:47:47 +01:00
|
|
|
return $R_DEPS_MISSING
|
|
|
|
fi
|
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( DEP_BIN )); then
|
2007-05-30 17:47:47 +01:00
|
|
|
# install missing deps from binary packages (using pacman -S)
|
|
|
|
msg "$(gettext "Installing missing dependencies...")"
|
|
|
|
|
2014-12-22 21:12:50 -05:00
|
|
|
if ! run_pacman -S --asdeps "${deplist[@]}"; then
|
2009-12-02 19:04:32 +01:00
|
|
|
error "$(gettext "'%s' failed to install missing dependencies.")" "$PACMAN"
|
2019-06-25 21:56:58 +10:00
|
|
|
return $R_DEPS_MISSING
|
2007-05-30 17:47:47 +01:00
|
|
|
fi
|
2005-03-15 01:51:43 +00:00
|
|
|
fi
|
2006-12-21 17:42:58 +00:00
|
|
|
|
2008-07-24 11:37:36 +02:00
|
|
|
# we might need the new system environment
|
2012-03-31 17:26:39 +10:00
|
|
|
# save our shell options and turn off extglob
|
2018-05-02 14:24:44 -04:00
|
|
|
local shellopts=$(shopt -p extglob)
|
2012-03-31 17:26:39 +10:00
|
|
|
shopt -u extglob
|
2008-07-24 11:37:36 +02:00
|
|
|
source /etc/profile &>/dev/null
|
2012-03-31 17:26:39 +10:00
|
|
|
eval "$shellopts"
|
2006-11-14 07:58:42 +00:00
|
|
|
|
2018-02-26 00:10:51 +01:00
|
|
|
# umask might have been changed in /etc/profile
|
|
|
|
# ensure that sane default is set again
|
|
|
|
umask 0022
|
|
|
|
|
2007-05-30 17:47:47 +01:00
|
|
|
return $R_DEPS_SATISFIED
|
2005-03-15 01:51:43 +00:00
|
|
|
}
|
|
|
|
|
2007-06-02 13:39:47 -04:00
|
|
|
resolve_deps() {
|
2007-05-30 17:47:47 +01:00
|
|
|
local R_DEPS_SATISFIED=0
|
2007-06-02 17:41:15 +01:00
|
|
|
local R_DEPS_MISSING=1
|
2007-05-30 17:47:47 +01:00
|
|
|
|
2010-06-25 18:46:37 -04:30
|
|
|
# deplist cannot be declared like this: local deplist=$(foo)
|
|
|
|
# Otherwise, the return value will depend on the assignment.
|
|
|
|
local deplist
|
2017-09-22 13:01:09 -05:00
|
|
|
deplist=($(check_deps "$@")) || exit $E_INSTALL_DEPS_FAILED
|
2010-06-25 18:46:37 -04:30
|
|
|
[[ -z $deplist ]] && return $R_DEPS_SATISFIED
|
2007-05-30 17:47:47 +01:00
|
|
|
|
2014-12-22 21:12:50 -05:00
|
|
|
if handle_deps "${deplist[@]}"; then
|
2007-05-30 17:47:47 +01:00
|
|
|
# check deps again to make sure they were resolved
|
2019-06-25 21:56:58 +10:00
|
|
|
deplist=$(check_deps "$@")
|
2009-11-12 15:07:34 -05:00
|
|
|
[[ -z $deplist ]] && return $R_DEPS_SATISFIED
|
2007-02-14 05:52:49 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-17 14:03:58 +10:00
|
|
|
msg "$(gettext "Missing dependencies:")"
|
|
|
|
local dep
|
|
|
|
for dep in ${deplist[@]}; do
|
|
|
|
msg2 "$dep"
|
|
|
|
done
|
|
|
|
|
2007-05-30 17:47:47 +01:00
|
|
|
return $R_DEPS_MISSING
|
2007-02-14 05:52:49 +00:00
|
|
|
}
|
|
|
|
|
2007-06-02 13:39:47 -04:00
|
|
|
remove_deps() {
|
makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.
In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-31 17:46:51 +02:00
|
|
|
(( ! RMDEPS )) && return 0
|
2007-05-30 17:47:47 +01:00
|
|
|
|
2009-10-23 15:30:47 +10:00
|
|
|
# check for packages removed during dependency install (e.g. due to conflicts)
|
|
|
|
# removing all installed packages is risky in this case
|
2014-02-02 17:30:06 +10:00
|
|
|
if [[ -n $(grep -xvFf <(printf '%s\n' "${current_pkglist[@]}") \
|
2014-02-02 17:37:58 +10:00
|
|
|
<(printf '%s\n' "${original_pkglist[@]}")) ]]; then
|
2011-11-21 23:03:33 -05:00
|
|
|
warning "$(gettext "Failed to remove installed dependencies.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
return $E_REMOVE_DEPS_FAILED
|
2009-10-23 15:30:47 +10:00
|
|
|
fi
|
2007-03-20 01:34:16 +00:00
|
|
|
|
2011-11-21 23:03:33 -05:00
|
|
|
local deplist
|
2012-01-20 23:20:52 +10:00
|
|
|
deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
|
2014-02-02 17:37:58 +10:00
|
|
|
<(printf "%s\n" "${current_pkglist[@]}")))
|
2012-02-14 21:31:04 +01:00
|
|
|
if [[ -z $deplist ]]; then
|
2014-02-02 17:37:58 +10:00
|
|
|
return 0
|
2011-11-21 23:03:33 -05:00
|
|
|
fi
|
2008-04-03 01:07:25 +10:00
|
|
|
|
2009-10-23 15:30:47 +10:00
|
|
|
msg "Removing installed dependencies..."
|
2009-11-18 23:29:07 +01:00
|
|
|
# exit cleanly on failure to remove deps as package has been built successfully
|
2019-01-30 10:40:09 +10:00
|
|
|
if ! run_pacman -Rnu ${deplist[@]}; then
|
2008-04-03 01:07:25 +10:00
|
|
|
warning "$(gettext "Failed to remove installed dependencies.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
return $E_REMOVE_DEPS_FAILED
|
2007-01-17 04:54:55 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-08-25 00:19:20 +02:00
|
|
|
error_function() {
|
2009-08-23 17:16:21 +02:00
|
|
|
# first exit all subshells, then print the error
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( ! BASH_SUBSHELL )); then
|
2010-06-30 22:16:25 +10:00
|
|
|
error "$(gettext "A failure occurred in %s().")" "$1"
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2007-04-11 20:06:09 +01:00
|
|
|
fi
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_USER_FUNCTION_FAILED
|
2007-04-11 20:06:09 +01:00
|
|
|
}
|
|
|
|
|
PKGBUILD: handle arch specific attributes
This introduces support for architecture-specific conflicts, depends,
optdepends, makedepends, replaces, and conflicts by appending "_$CARCH"
to the array name. For example, in the global section:
arch=('i686' 'x86_64')
depends=('foo')
depends_x86_64=('bar')
This will generate depends of 'foo' and 'bar' on x86_64, but only 'foo'
on i686. Moreover, this is supported in the package functions with the
same heuristics as the generic names, e.g.
...
arch=('i686' 'x86_64')
depends=('foo')
...
package_somepkg() {
depends_x86_64=('bar')
...
}
Again, will cause x86_64 to have depends of 'foo' and 'bar', but only
'foo' for i686.
2014-07-25 14:01:48 -04:00
|
|
|
merge_arch_attrs() {
|
|
|
|
local attr supported_attrs=(
|
|
|
|
provides conflicts depends replaces optdepends
|
|
|
|
makedepends checkdepends)
|
|
|
|
|
|
|
|
for attr in "${supported_attrs[@]}"; do
|
|
|
|
eval "$attr+=(\"\${${attr}_$CARCH[@]}\")"
|
|
|
|
done
|
|
|
|
|
|
|
|
# ensure that calling this function is idempotent.
|
|
|
|
unset -v "${supported_attrs[@]/%/_$CARCH}"
|
|
|
|
}
|
|
|
|
|
|
|
|
source_buildfile() {
|
|
|
|
source_safe "$@"
|
|
|
|
}
|
|
|
|
|
2012-01-26 10:28:31 -05:00
|
|
|
run_function_safe() {
|
2018-08-13 21:20:56 -04:00
|
|
|
local restoretrap restoreshopt
|
2012-01-26 10:28:31 -05:00
|
|
|
|
2014-12-22 09:04:53 -05:00
|
|
|
# we don't set any special shopts of our own, but we don't want the user to
|
|
|
|
# muck with our environment.
|
|
|
|
restoreshopt=$(shopt -p)
|
|
|
|
|
2018-08-13 21:20:56 -04:00
|
|
|
# localize 'set' shell options to this function - this does not work for shopt
|
|
|
|
local -
|
2014-12-22 09:04:53 -05:00
|
|
|
shopt -o -s errexit errtrace
|
2012-01-26 10:28:31 -05:00
|
|
|
|
|
|
|
restoretrap=$(trap -p ERR)
|
2014-12-22 09:04:53 -05:00
|
|
|
trap "error_function '$1'" ERR
|
2012-01-26 10:28:31 -05:00
|
|
|
|
2022-05-11 20:19:35 +02:00
|
|
|
run_function "$1" "$2"
|
2012-01-26 10:28:31 -05:00
|
|
|
|
2018-05-31 18:24:54 +02:00
|
|
|
trap - ERR
|
2014-12-22 09:04:53 -05:00
|
|
|
eval "$restoretrap"
|
|
|
|
eval "$restoreshopt"
|
2012-01-26 10:28:31 -05:00
|
|
|
}
|
|
|
|
|
2009-08-25 00:19:20 +02:00
|
|
|
run_function() {
|
2009-11-12 15:07:34 -05:00
|
|
|
if [[ -z $1 ]]; then
|
2009-08-25 00:19:20 +02:00
|
|
|
return 1
|
2009-01-16 22:26:52 +10:00
|
|
|
fi
|
2010-06-25 18:46:36 -04:30
|
|
|
local pkgfunc="$1"
|
2022-05-11 20:19:35 +02:00
|
|
|
local workingdir="${2:-$srcdir}"
|
2009-01-16 22:26:52 +10:00
|
|
|
|
2018-08-29 01:10:21 -04:00
|
|
|
if (( ! BASH_SUBSHELL )); then
|
|
|
|
msg "$(gettext "Starting %s()...")" "$pkgfunc"
|
|
|
|
fi
|
2022-05-11 20:19:35 +02:00
|
|
|
cd_safe "$workingdir"
|
2009-01-16 22:20:05 +10:00
|
|
|
|
|
|
|
local ret=0
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( LOGGING )); then
|
2011-07-22 21:42:53 +10:00
|
|
|
local fullver=$(get_full_version)
|
2012-11-29 01:08:55 -06:00
|
|
|
local BUILDLOG="$LOGDEST/${pkgbase}-${fullver}-${CARCH}-$pkgfunc.log"
|
2009-11-12 15:07:34 -05:00
|
|
|
if [[ -f $BUILDLOG ]]; then
|
2009-01-16 22:20:05 +10:00
|
|
|
local i=1
|
|
|
|
while true; do
|
2009-11-12 15:07:34 -05:00
|
|
|
if [[ -f $BUILDLOG.$i ]]; then
|
2009-01-16 22:20:05 +10:00
|
|
|
i=$(($i +1))
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
mv "$BUILDLOG" "$BUILDLOG.$i"
|
|
|
|
fi
|
|
|
|
|
2009-08-18 22:10:56 +02:00
|
|
|
# ensure overridden package variables survive tee with split packages
|
2013-05-18 23:11:41 +10:00
|
|
|
logpipe=$(mktemp -u "$LOGDEST/logpipe.XXXXXXXX")
|
2010-10-11 22:16:49 +03:00
|
|
|
mkfifo "$logpipe"
|
2008-12-08 12:21:03 +10:00
|
|
|
tee "$BUILDLOG" < "$logpipe" &
|
2011-03-24 13:30:15 +01:00
|
|
|
local teepid=$!
|
|
|
|
|
|
|
|
$pkgfunc &>"$logpipe"
|
|
|
|
|
2019-10-07 16:22:52 +10:00
|
|
|
wait -f $teepid
|
2008-12-08 12:21:03 +10:00
|
|
|
rm "$logpipe"
|
2009-01-16 22:20:05 +10:00
|
|
|
else
|
2013-04-26 20:32:37 -04:00
|
|
|
"$pkgfunc"
|
2009-01-16 22:20:05 +10:00
|
|
|
fi
|
2009-08-25 00:19:20 +02:00
|
|
|
}
|
|
|
|
|
2022-05-11 20:19:35 +02:00
|
|
|
run_verify() {
|
2025-03-19 21:17:28 +01:00
|
|
|
run_function_safe "verify" "$SRCDEST"
|
2022-05-11 20:19:35 +02:00
|
|
|
}
|
|
|
|
|
2012-07-28 11:20:10 +02:00
|
|
|
run_prepare() {
|
|
|
|
run_function_safe "prepare"
|
|
|
|
}
|
|
|
|
|
2009-08-25 00:19:20 +02:00
|
|
|
run_build() {
|
2012-01-26 10:28:31 -05:00
|
|
|
run_function_safe "build"
|
2009-08-25 00:19:20 +02:00
|
|
|
}
|
|
|
|
|
2010-12-16 00:06:43 +10:00
|
|
|
run_check() {
|
2012-01-26 10:28:31 -05:00
|
|
|
run_function_safe "check"
|
2010-12-16 00:06:43 +10:00
|
|
|
}
|
|
|
|
|
2009-08-25 00:19:20 +02:00
|
|
|
run_package() {
|
2018-05-08 15:31:58 +02:00
|
|
|
run_function_safe "package${1:+_$1}"
|
2009-01-16 22:20:05 +10:00
|
|
|
}
|
|
|
|
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair() {
|
|
|
|
local key="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
for val in "$@"; do
|
|
|
|
if [[ $val = *$'\n'* ]]; then
|
|
|
|
error "$(gettext "Invalid value for %s: %s")" "$key" "$val"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PKGBUILD_ERROR
|
2016-11-05 18:08:15 -04:00
|
|
|
fi
|
|
|
|
printf "%s = %s\n" "$key" "$val"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2009-06-22 02:04:44 -04:00
|
|
|
write_pkginfo() {
|
2019-10-27 03:41:46 -04:00
|
|
|
local size=$(dirsize)
|
2007-04-11 20:05:23 +01:00
|
|
|
|
2015-01-09 14:57:37 -05:00
|
|
|
merge_arch_attrs
|
2021-12-12 14:41:01 +10:00
|
|
|
generate_autodeps
|
2015-01-09 14:57:37 -05:00
|
|
|
|
2013-01-15 22:45:42 -06:00
|
|
|
printf "# Generated by makepkg %s\n" "$makepkg_version"
|
2014-03-08 20:46:21 +10:00
|
|
|
printf "# using %s\n" "$(fakeroot -v)"
|
2013-11-01 21:34:34 +10:00
|
|
|
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "pkgname" "$pkgname"
|
2017-07-06 13:27:22 +10:00
|
|
|
write_kv_pair "pkgbase" "$pkgbase"
|
2022-03-12 09:36:06 -08:00
|
|
|
write_kv_pair "xdata" "pkgtype=$pkgtype"
|
2013-11-01 21:34:34 +10:00
|
|
|
|
|
|
|
local fullver=$(get_full_version)
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "pkgver" "$fullver"
|
2013-11-01 21:34:34 +10:00
|
|
|
|
2014-11-09 15:53:16 +10:00
|
|
|
# TODO: all fields should have this treatment
|
|
|
|
local spd="${pkgdesc//+([[:space:]])/ }"
|
|
|
|
spd=("${spd[@]#[[:space:]]}")
|
|
|
|
spd=("${spd[@]%[[:space:]]}")
|
|
|
|
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "pkgdesc" "$spd"
|
|
|
|
write_kv_pair "url" "$url"
|
2017-05-12 12:41:20 +02:00
|
|
|
write_kv_pair "builddate" "$SOURCE_DATE_EPOCH"
|
2017-07-06 13:34:31 +10:00
|
|
|
write_kv_pair "packager" "$PACKAGER"
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "size" "$size"
|
|
|
|
write_kv_pair "arch" "$pkgarch"
|
2007-04-11 20:05:23 +01:00
|
|
|
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "license" "${license[@]}"
|
|
|
|
write_kv_pair "replaces" "${replaces[@]}"
|
|
|
|
write_kv_pair "group" "${groups[@]}"
|
|
|
|
write_kv_pair "conflict" "${conflicts[@]}"
|
|
|
|
write_kv_pair "provides" "${provides[@]}"
|
|
|
|
write_kv_pair "backup" "${backup[@]}"
|
|
|
|
write_kv_pair "depend" "${depends[@]}"
|
|
|
|
write_kv_pair "optdepend" "${optdepends[@]//+([[:space:]])/ }"
|
|
|
|
write_kv_pair "makedepend" "${makedepends[@]}"
|
|
|
|
write_kv_pair "checkdepend" "${checkdepends[@]}"
|
2015-10-17 00:57:12 +00:00
|
|
|
}
|
2010-02-10 17:07:30 +01:00
|
|
|
|
2015-10-17 00:57:12 +00:00
|
|
|
write_buildinfo() {
|
2019-11-15 09:32:12 -05:00
|
|
|
write_kv_pair "format" "2"
|
2017-07-06 13:57:27 +10:00
|
|
|
|
|
|
|
write_kv_pair "pkgname" "$pkgname"
|
|
|
|
write_kv_pair "pkgbase" "$pkgbase"
|
|
|
|
|
|
|
|
local fullver=$(get_full_version)
|
|
|
|
write_kv_pair "pkgver" "$fullver"
|
2015-10-17 00:57:12 +00:00
|
|
|
|
2018-05-03 09:39:16 +02:00
|
|
|
write_kv_pair "pkgarch" "$pkgarch"
|
|
|
|
|
2016-10-11 23:04:25 +10:00
|
|
|
local sum="$(sha256sum "${BUILDFILE}")"
|
|
|
|
sum=${sum%% *}
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "pkgbuild_sha256sum" $sum
|
2015-10-17 00:57:12 +00:00
|
|
|
|
2017-07-06 13:57:27 +10:00
|
|
|
write_kv_pair "packager" "${PACKAGER}"
|
|
|
|
write_kv_pair "builddate" "${SOURCE_DATE_EPOCH}"
|
|
|
|
write_kv_pair "builddir" "${BUILDDIR}"
|
2019-11-15 09:32:12 -05:00
|
|
|
write_kv_pair "startdir" "${startdir}"
|
2021-04-22 21:46:56 +02:00
|
|
|
write_kv_pair "buildtool" "${BUILDTOOL:-makepkg}"
|
|
|
|
write_kv_pair "buildtoolver" "${BUILDTOOLVER:-$makepkg_version}"
|
2016-11-05 18:08:15 -04:00
|
|
|
write_kv_pair "buildenv" "${BUILDENV[@]}"
|
|
|
|
write_kv_pair "options" "${OPTIONS[@]}"
|
2015-10-17 00:57:12 +00:00
|
|
|
|
2018-06-13 10:34:32 -04:00
|
|
|
local pkginfos_parsed=($(LC_ALL=C run_pacman -Qi | awk -F': ' '\
|
|
|
|
/^Name .*/ {printf "%s", $2} \
|
|
|
|
/^Version .*/ {printf "-%s", $2} \
|
2018-05-03 09:27:03 +02:00
|
|
|
/^Architecture .*/ {print "-"$2} \
|
2018-06-13 10:34:32 -04:00
|
|
|
'))
|
2018-05-03 09:27:03 +02:00
|
|
|
|
|
|
|
write_kv_pair "installed" "${pkginfos_parsed[@]}"
|
2009-06-22 02:04:44 -04:00
|
|
|
}
|
|
|
|
|
2017-01-03 02:11:54 -05:00
|
|
|
# build a sorted NUL-separated list of the full contents of the current
|
|
|
|
# directory suitable for passing to `bsdtar --files-from`
|
|
|
|
# database files are placed at the beginning of the package regardless of
|
|
|
|
# sorting
|
|
|
|
list_package_files() {
|
2018-08-21 10:15:12 -04:00
|
|
|
(
|
|
|
|
export LC_COLLATE=C
|
|
|
|
shopt -s dotglob globstar
|
2019-04-10 01:50:31 -04:00
|
|
|
# bash 5.0 only works with combo directory + file globs
|
|
|
|
printf '%s\0' **/*
|
2018-08-21 10:15:12 -04:00
|
|
|
)
|
2017-01-03 02:11:54 -05:00
|
|
|
}
|
|
|
|
|
2009-06-22 02:04:44 -04:00
|
|
|
create_package() {
|
makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.
In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-31 17:46:51 +02:00
|
|
|
(( NOARCHIVE )) && return 0
|
2014-03-03 20:29:54 +01:00
|
|
|
|
2022-01-02 15:39:21 +01:00
|
|
|
pkgtype=${pkgtype:-pkg}
|
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if [[ ! -d $pkgdir ]]; then
|
2013-10-09 13:20:11 +10:00
|
|
|
error "$(gettext "Missing %s directory.")" "\$pkgdir/"
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_MISSING_PKGDIR
|
2009-06-22 02:04:44 -04:00
|
|
|
fi
|
|
|
|
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "$pkgdir"
|
2012-09-24 00:06:36 +10:00
|
|
|
msg "$(gettext "Creating package \"%s\"...")" "$pkgname"
|
2009-06-22 02:04:44 -04:00
|
|
|
|
2012-03-09 21:09:35 +10:00
|
|
|
pkgarch=$(get_pkg_arch)
|
2018-10-31 13:12:33 -04:00
|
|
|
msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
|
2012-09-24 00:06:36 +10:00
|
|
|
write_pkginfo > .PKGINFO
|
2018-10-31 13:12:33 -04:00
|
|
|
msg2 "$(gettext "Generating %s file...")" ".BUILDINFO"
|
2015-10-17 00:57:12 +00:00
|
|
|
write_buildinfo > .BUILDINFO
|
2009-06-22 02:04:44 -04:00
|
|
|
|
2010-06-25 18:46:40 -04:30
|
|
|
# check for changelog/install files
|
2011-03-29 20:35:48 -04:00
|
|
|
for i in 'changelog/.CHANGELOG' 'install/.INSTALL'; do
|
2011-06-28 22:35:44 -04:00
|
|
|
IFS='/' read -r orig dest < <(printf '%s\n' "$i")
|
2010-06-25 18:46:40 -04:30
|
|
|
|
2011-03-29 20:35:48 -04:00
|
|
|
if [[ -n ${!orig} ]]; then
|
|
|
|
msg2 "$(gettext "Adding %s file...")" "$orig"
|
2014-08-21 10:42:10 -04:00
|
|
|
if ! cp "$startdir/${!orig}" "$dest"; then
|
|
|
|
error "$(gettext "Failed to add %s file to package.")" "$orig"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_MISSING_FILE
|
2014-08-21 10:42:10 -04:00
|
|
|
fi
|
2010-06-25 18:46:40 -04:30
|
|
|
chmod 644 "$dest"
|
|
|
|
fi
|
|
|
|
done
|
2007-04-11 20:05:23 +01:00
|
|
|
|
|
|
|
# tar it up
|
2011-07-22 21:42:53 +10:00
|
|
|
local fullver=$(get_full_version)
|
2012-09-24 00:06:36 +10:00
|
|
|
local pkg_file="$PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT}"
|
2009-02-19 19:12:34 +01:00
|
|
|
local ret=0
|
2007-04-11 20:05:23 +01:00
|
|
|
|
2009-08-24 13:22:12 -05:00
|
|
|
[[ -f $pkg_file ]] && rm -f "$pkg_file"
|
|
|
|
[[ -f $pkg_file.sig ]] && rm -f "$pkg_file.sig"
|
|
|
|
|
2017-05-12 12:41:20 +02:00
|
|
|
# ensure all elements of the package have the same mtime
|
|
|
|
find . -exec touch -h -d @$SOURCE_DATE_EPOCH {} +
|
|
|
|
|
2012-04-30 16:15:47 +10:00
|
|
|
msg2 "$(gettext "Generating .MTREE file...")"
|
2017-05-12 12:41:20 +02:00
|
|
|
list_package_files | LANG=C bsdtar -cnf - --format=mtree \
|
2022-11-22 18:21:59 +10:00
|
|
|
--options='!all,use-set,type,uid,gid,mode,time,size,sha256,link' \
|
2017-05-12 12:41:20 +02:00
|
|
|
--null --files-from - --exclude .MTREE | gzip -c -f -n > .MTREE
|
|
|
|
touch -d @$SOURCE_DATE_EPOCH .MTREE
|
2012-04-30 16:15:47 +10:00
|
|
|
|
|
|
|
msg2 "$(gettext "Compressing package...")"
|
2010-08-27 18:23:32 +02:00
|
|
|
# TODO: Maybe this can be set globally for robustness
|
|
|
|
shopt -s -o pipefail
|
2022-03-10 16:38:42 +01:00
|
|
|
list_package_files | LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ -cnf - --null --files-from - |
|
2017-08-27 21:37:20 -04:00
|
|
|
compress_as "$PKGEXT" > "${pkg_file}" || ret=$?
|
2008-08-01 08:29:46 +02:00
|
|
|
|
2010-08-27 18:23:32 +02:00
|
|
|
shopt -u -o pipefail
|
2009-02-19 19:12:34 +01:00
|
|
|
|
2009-11-12 15:07:34 -05:00
|
|
|
if (( ret )); then
|
2007-04-11 20:05:23 +01:00
|
|
|
error "$(gettext "Failed to create package file.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PACKAGE_FAILED
|
2007-04-11 20:05:23 +01:00
|
|
|
fi
|
2007-05-30 11:48:18 +01:00
|
|
|
}
|
|
|
|
|
2012-09-24 00:30:46 +10:00
|
|
|
create_debug_package() {
|
|
|
|
# check if a debug package was requested
|
|
|
|
if ! check_option "debug" "y" || ! check_option "strip" "y"; then
|
makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.
In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-31 17:46:51 +02:00
|
|
|
return 0
|
2012-09-24 00:30:46 +10:00
|
|
|
fi
|
|
|
|
|
2019-01-04 13:13:16 +10:00
|
|
|
local pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
|
2012-09-24 00:30:46 +10:00
|
|
|
|
|
|
|
# check if we have any debug symbols to package
|
|
|
|
if dir_is_empty "$pkgdir/usr/lib/debug"; then
|
makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.
In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-31 17:46:51 +02:00
|
|
|
return 0
|
2012-09-24 00:30:46 +10:00
|
|
|
fi
|
|
|
|
|
2016-12-05 14:44:51 +10:00
|
|
|
unset groups depends optdepends provides conflicts replaces backup install changelog
|
|
|
|
|
|
|
|
local pkg
|
|
|
|
for pkg in ${pkgname[@]}; do
|
|
|
|
if [[ $pkg != $pkgbase ]]; then
|
|
|
|
provides+=("$pkg-@DEBUGSUFFIX@")
|
|
|
|
fi
|
|
|
|
done
|
2012-09-24 00:30:46 +10:00
|
|
|
|
2021-12-19 18:58:25 +01:00
|
|
|
pkgdesc="Detached debugging symbols for $pkgbase"
|
2016-12-05 14:44:51 +10:00
|
|
|
pkgname=$pkgbase-@DEBUGSUFFIX@
|
2022-01-02 15:39:21 +01:00
|
|
|
pkgtype=debug
|
2012-09-24 00:30:46 +10:00
|
|
|
|
|
|
|
create_package
|
|
|
|
}
|
|
|
|
|
2007-05-30 14:27:13 -04:00
|
|
|
create_srcpackage() {
|
2011-09-30 15:32:49 +08:00
|
|
|
local ret=0
|
2007-05-30 14:27:13 -04:00
|
|
|
msg "$(gettext "Creating source package...")"
|
2008-06-07 11:58:21 +10:00
|
|
|
local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)"
|
2009-03-06 18:28:47 +10:00
|
|
|
mkdir "${srclinks}"/${pkgbase}
|
2008-06-07 11:58:21 +10:00
|
|
|
|
2022-01-02 15:39:21 +01:00
|
|
|
pkgtype=src
|
|
|
|
|
2008-02-20 15:08:31 +01:00
|
|
|
msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT"
|
2009-07-12 17:10:11 +10:00
|
|
|
ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}"
|
2007-05-30 14:27:13 -04:00
|
|
|
|
makepkg: introduce .SRCINFO files for source packages
Similar to .PKGINFO, .SRCINFO provides structured metadata from the
PKGBUILD to be included with source packages.
The format is structured such that it contains a "pkgbase" and one to
many "pkgname" sections. Each "pkgname" section represents an "output
package", and inherits all of the attributes of the "pkgbase" section,
and then can define their own additive fields.
For example, a simple PKGBUILD:
pkgbase=ponies
pkgname=('applejack' 'pinkiepie')
pkgver=1.2.3
pkgrel=1
arch=('x86_64' 'i686')
depends=('friendship' 'magic')
build() { ...; }
package_applejack() {
provides=('courage')
...;
}
package_pinkiepie() {
provides=('laughter')
...;
}
Would yield the following .SRCINFO file:
pkgbase = ponies
pkgdesc = friendship is magic
pkgver = 1.2.3
pkgrel = 1
arch = x86_64
arch = i686
depends = friendship
depends = magic
pkgname = applejack
provides = courage
pkgname = pinkiepie
provides = laughter
The code to generate this new file is taken a project which I've been
incubating[0] under the guise of 'mkaurball', which creates .AURINFO
files for the AUR. AURINFO is the exactly same file as .SRCINFO, but
named as such to make it clear that this is specific to the AUR.
Because we're parsing shell in the packaging functions rather than
executing it, there *are* some limitations, but these only really crop
up in more "exotic" PKGBUILDs. Smoketesting[1] for accuracy in the Arch
repos yields 100% accuracy for [core] and [extra]. [community] clocks in
at ~98% accuracy (.3% difference per PKGBUILD), largely due to silly
haskell packages calling pacman from inside the PKGBUILD to determine
dependencies. [multilib] currently shows about 92% accuracy -- a
statistic which can be largely improved by utilizing the recently merged
arch-specific attribute work. This is also a smaller repo so the numbers
are somewhat inflated. In reality, this is only a .8% variance per
PKGBUILD.
Together, we can make PKGBUILD better.
[0] https://github.com/falconindy/pkgbuild-introspection
[1] https://github.com/falconindy/pkgbuild-introspection/blob/master/test/smoketest
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-08 23:06:43 -05:00
|
|
|
msg2 "$(gettext "Generating %s file...")" .SRCINFO
|
|
|
|
write_srcinfo > "$srclinks/$pkgbase"/.SRCINFO
|
|
|
|
|
2014-08-07 12:41:20 -04:00
|
|
|
local file all_sources
|
|
|
|
|
|
|
|
get_all_sources 'all_sources'
|
|
|
|
for file in "${all_sources[@]}"; do
|
2012-03-09 16:19:53 +10:00
|
|
|
if [[ "$file" = "$(get_filename "$file")" ]] || (( SOURCEONLY == 2 )); then
|
2012-01-08 21:48:04 +10:00
|
|
|
local absfile
|
|
|
|
absfile=$(get_filepath "$file") || missing_source_file "$file"
|
2010-06-03 17:32:50 +02:00
|
|
|
msg2 "$(gettext "Adding %s...")" "${absfile##*/}"
|
|
|
|
ln -s "$absfile" "$srclinks/$pkgbase"
|
2007-05-30 14:27:13 -04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-01-16 12:27:34 -05:00
|
|
|
# set pkgname the same way we do for running package(), this way we get
|
|
|
|
# the right value in extract_function_variable
|
|
|
|
local pkgname_backup=(${pkgname[@]})
|
|
|
|
local i pkgname
|
2010-05-25 16:32:07 -04:30
|
|
|
for i in 'changelog' 'install'; do
|
2014-08-02 20:28:05 -04:00
|
|
|
local file files
|
|
|
|
|
2014-12-14 12:35:01 -05:00
|
|
|
[[ ${!i} ]] && files+=("${!i}")
|
2020-01-16 12:27:34 -05:00
|
|
|
for pkgname in "${pkgname_backup[@]}"; do
|
|
|
|
if extract_function_variable "package_$pkgname" "$i" 0 file; then
|
2014-08-02 20:28:05 -04:00
|
|
|
files+=("$file")
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for file in "${files[@]}"; do
|
2011-11-10 06:05:11 -05:00
|
|
|
if [[ $file && ! -f "${srclinks}/${pkgbase}/$file" ]]; then
|
2010-06-09 13:45:22 +10:00
|
|
|
msg2 "$(gettext "Adding %s file (%s)...")" "$i" "${file}"
|
2010-04-26 14:59:42 +10:00
|
|
|
ln -s "${startdir}/$file" "${srclinks}/${pkgbase}/"
|
|
|
|
fi
|
2014-08-02 20:28:05 -04:00
|
|
|
done
|
2010-05-25 16:32:07 -04:30
|
|
|
done
|
2020-01-16 12:27:34 -05:00
|
|
|
pkgname=(${pkgname_backup[@]})
|
2010-04-26 14:59:42 +10:00
|
|
|
|
2024-05-20 02:15:37 -03:00
|
|
|
# add a copy of source PGP signing public keys if available in keys/pgp/<fingerprint>.asc
|
2022-05-31 19:32:12 +10:00
|
|
|
local key
|
|
|
|
for key in ${validpgpkeys[@]}; do
|
|
|
|
if [[ -f keys/pgp/$key.asc ]]; then
|
|
|
|
mkdir -p "${srclinks}/${pkgbase}/keys/pgp/"
|
|
|
|
ln -s "${startdir}/keys/pgp/$key.asc" "${srclinks}/${pkgbase}/keys/pgp/"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2011-07-22 21:42:53 +10:00
|
|
|
local fullver=$(get_full_version)
|
2011-01-20 18:16:06 -06:00
|
|
|
local pkg_file="$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
|
2007-05-30 14:27:13 -04:00
|
|
|
|
|
|
|
# tar it up
|
|
|
|
msg2 "$(gettext "Compressing source package...")"
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "${srclinks}"
|
2017-08-27 21:37:20 -04:00
|
|
|
|
|
|
|
# TODO: Maybe this can be set globally for robustness
|
|
|
|
shopt -s -o pipefail
|
2022-03-10 16:38:42 +01:00
|
|
|
LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$?
|
2017-08-27 21:37:20 -04:00
|
|
|
|
|
|
|
shopt -u -o pipefail
|
|
|
|
|
|
|
|
if (( ret )); then
|
2007-05-30 14:27:13 -04:00
|
|
|
error "$(gettext "Failed to create source package file.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PACKAGE_FAILED
|
2007-05-30 14:27:13 -04:00
|
|
|
fi
|
2010-06-23 01:35:56 -04:00
|
|
|
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "${startdir}"
|
2008-06-22 20:11:54 +10:00
|
|
|
rm -rf "${srclinks}"
|
2007-05-30 14:27:13 -04:00
|
|
|
}
|
|
|
|
|
2007-06-02 13:39:47 -04:00
|
|
|
install_package() {
|
makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.
In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-31 17:46:51 +02:00
|
|
|
(( ! INSTALL )) && return 0
|
2009-03-25 23:52:27 +10:00
|
|
|
|
2019-09-12 15:22:03 +02:00
|
|
|
remove_deps || return $?
|
|
|
|
RMDEPS=0
|
|
|
|
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( ! SPLITPKG )); then
|
2011-06-18 12:40:14 +10:00
|
|
|
msg "$(gettext "Installing package %s with %s...")" "$pkgname" "$PACMAN -U"
|
2009-03-25 23:52:27 +10:00
|
|
|
else
|
2011-06-18 12:40:14 +10:00
|
|
|
msg "$(gettext "Installing %s package group with %s...")" "$pkgbase" "$PACMAN -U"
|
2009-03-25 23:52:27 +10:00
|
|
|
fi
|
|
|
|
|
2012-03-09 21:09:35 +10:00
|
|
|
local fullver pkgarch pkg pkglist
|
2012-07-09 01:55:58 -04:00
|
|
|
(( ASDEPS )) && pkglist+=('--asdeps')
|
2013-02-09 12:57:39 -06:00
|
|
|
(( NEEDED )) && pkglist+=('--needed')
|
2012-07-09 01:55:58 -04:00
|
|
|
|
2009-03-25 23:52:27 +10:00
|
|
|
for pkg in ${pkgname[@]}; do
|
2014-08-04 08:48:05 -04:00
|
|
|
fullver=$(get_full_version)
|
2012-03-09 21:09:35 +10:00
|
|
|
pkgarch=$(get_pkg_arch $pkg)
|
2012-04-09 16:27:00 +10:00
|
|
|
pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}")
|
2012-09-29 16:54:19 +10:00
|
|
|
|
2015-10-22 02:27:09 +03:00
|
|
|
if [[ -f "$PKGDEST/${pkg}-@DEBUGSUFFIX@-${fullver}-${pkgarch}${PKGEXT}" ]]; then
|
|
|
|
pkglist+=("$PKGDEST/${pkg}-@DEBUGSUFFIX@-${fullver}-${pkgarch}${PKGEXT}")
|
2012-09-29 16:54:19 +10:00
|
|
|
fi
|
2009-03-25 23:52:27 +10:00
|
|
|
done
|
|
|
|
|
2013-06-19 22:38:57 +02:00
|
|
|
if ! run_pacman -U "${pkglist[@]}"; then
|
2009-03-29 16:49:57 +10:00
|
|
|
warning "$(gettext "Failed to install built package(s).")"
|
2017-09-22 13:01:09 -05:00
|
|
|
return $E_INSTALL_FAILED
|
2007-02-11 21:47:37 +00:00
|
|
|
fi
|
|
|
|
}
|
2007-01-17 04:54:55 +00:00
|
|
|
|
2012-07-16 22:25:24 +10:00
|
|
|
check_build_status() {
|
2020-10-11 22:22:05 -04:00
|
|
|
local fullver pkgarch allpkgbuilt somepkgbuilt
|
2012-07-16 22:25:24 +10:00
|
|
|
if (( ! SPLITPKG )); then
|
|
|
|
fullver=$(get_full_version)
|
|
|
|
pkgarch=$(get_pkg_arch)
|
|
|
|
if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]] \
|
2014-03-03 20:29:54 +01:00
|
|
|
&& ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
|
2012-07-16 22:25:24 +10:00
|
|
|
if (( INSTALL )); then
|
|
|
|
warning "$(gettext "A package has already been built, installing existing package...")"
|
2018-01-13 23:52:38 -05:00
|
|
|
install_package
|
|
|
|
exit $?
|
2012-07-16 22:25:24 +10:00
|
|
|
else
|
|
|
|
error "$(gettext "A package has already been built. (use %s to overwrite)")" "-f"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_ALREADY_BUILT
|
2012-07-16 22:25:24 +10:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
allpkgbuilt=1
|
|
|
|
somepkgbuilt=0
|
|
|
|
for pkg in ${pkgname[@]}; do
|
2014-08-04 08:48:05 -04:00
|
|
|
fullver=$(get_full_version)
|
2012-07-16 22:25:24 +10:00
|
|
|
pkgarch=$(get_pkg_arch $pkg)
|
|
|
|
if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then
|
|
|
|
somepkgbuilt=1
|
|
|
|
else
|
|
|
|
allpkgbuilt=0
|
|
|
|
fi
|
|
|
|
done
|
2014-03-03 20:29:54 +01:00
|
|
|
if ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
|
2012-07-16 22:25:24 +10:00
|
|
|
if (( allpkgbuilt )); then
|
|
|
|
if (( INSTALL )); then
|
|
|
|
warning "$(gettext "The package group has already been built, installing existing packages...")"
|
2018-01-13 23:52:38 -05:00
|
|
|
install_package
|
|
|
|
exit $?
|
2012-07-16 22:25:24 +10:00
|
|
|
else
|
|
|
|
error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_ALREADY_BUILT
|
2012-07-16 22:25:24 +10:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if (( somepkgbuilt && ! PKGVERFUNC )); then
|
|
|
|
error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_ALREADY_BUILT
|
2012-07-16 22:25:24 +10:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-01-16 22:22:04 +10:00
|
|
|
backup_package_variables() {
|
2010-06-25 18:46:36 -04:30
|
|
|
local var
|
2019-01-30 18:07:20 +00:00
|
|
|
for var in ${pkgbuild_schema_package_overrides[@]}; do
|
2018-06-19 21:08:28 +10:00
|
|
|
local indirect="${var}_backup"
|
|
|
|
eval "${indirect}=(\"\${$var[@]}\")"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
restore_package_variables() {
|
|
|
|
local var
|
2019-01-30 18:07:20 +00:00
|
|
|
for var in ${pkgbuild_schema_package_overrides[@]}; do
|
2018-06-19 21:08:28 +10:00
|
|
|
local indirect="${var}_backup"
|
|
|
|
if [[ -n ${!indirect} ]]; then
|
|
|
|
eval "${var}=(\"\${$indirect[@]}\")"
|
|
|
|
else
|
|
|
|
unset ${var}
|
|
|
|
fi
|
2009-01-16 22:22:04 +10:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-01-04 13:09:38 +10:00
|
|
|
run_single_packaging() {
|
2019-01-04 13:13:16 +10:00
|
|
|
local pkgdir="$pkgdirbase/$pkgname"
|
2019-01-04 13:09:38 +10:00
|
|
|
mkdir "$pkgdir"
|
|
|
|
if [[ -n $1 ]] || (( PKGFUNC )); then
|
|
|
|
run_package $1
|
|
|
|
fi
|
|
|
|
tidy_install
|
|
|
|
lint_package || exit $E_PACKAGE_FAILED
|
|
|
|
create_package
|
|
|
|
}
|
|
|
|
|
2010-06-17 08:14:49 -04:30
|
|
|
run_split_packaging() {
|
2015-10-27 16:22:57 -04:00
|
|
|
local pkgname_backup=("${pkgname[@]}")
|
2022-01-02 15:39:21 +01:00
|
|
|
# We might run this function when we only have package_pkgname
|
|
|
|
# and we don't want that marked as a split package
|
|
|
|
(( ${#pkgname[@]} > 1 )) && pkgtype=split
|
2019-01-04 12:57:22 +10:00
|
|
|
backup_package_variables
|
2010-12-25 13:14:55 +10:00
|
|
|
for pkgname in ${pkgname_backup[@]}; do
|
2019-01-04 13:09:38 +10:00
|
|
|
run_single_packaging $pkgname
|
2018-06-19 21:08:28 +10:00
|
|
|
restore_package_variables
|
2010-06-17 08:14:49 -04:30
|
|
|
done
|
2015-10-27 16:22:57 -04:00
|
|
|
pkgname=("${pkgname_backup[@]}")
|
2010-06-17 08:14:49 -04:30
|
|
|
}
|
|
|
|
|
2005-03-15 01:51:43 +00:00
|
|
|
usage() {
|
2012-07-15 15:46:29 +10:00
|
|
|
printf "makepkg (pacman) %s\n" "$makepkg_version"
|
2006-02-16 22:57:25 +00:00
|
|
|
echo
|
2013-11-08 02:53:33 -05:00
|
|
|
printf -- "$(gettext "Make packages compatible for use with pacman")\n"
|
|
|
|
echo
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext "Usage: %s [options]")\n" "$0"
|
2006-02-16 22:57:25 +00:00
|
|
|
echo
|
2012-02-03 15:22:44 +02:00
|
|
|
printf -- "$(gettext "Options:")\n"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
|
|
|
|
printf -- "$(gettext " -c, --clean Clean up work files after build")\n"
|
2013-11-08 00:44:40 -05:00
|
|
|
printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " -d, --nodeps Skip all dependency checks")\n"
|
2024-03-20 21:38:56 +10:00
|
|
|
printf -- "$(gettext " -D, --dir <dir> Change to directory <dir> before processing PKGBUILD")\n"
|
2013-10-03 13:38:40 +10:00
|
|
|
printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " -f, --force Overwrite existing package")\n"
|
|
|
|
printf -- "$(gettext " -g, --geninteg Generate integrity checks for source files")\n"
|
|
|
|
printf -- "$(gettext " -h, --help Show this help message and exit")\n"
|
|
|
|
printf -- "$(gettext " -i, --install Install package after successful build")\n"
|
|
|
|
printf -- "$(gettext " -L, --log Log package build process")\n"
|
|
|
|
printf -- "$(gettext " -m, --nocolor Disable colorized output messages")\n"
|
|
|
|
printf -- "$(gettext " -o, --nobuild Download and extract files only")\n"
|
|
|
|
printf -- "$(gettext " -p <file> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
|
|
|
|
printf -- "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")\n"
|
|
|
|
printf -- "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")\n"
|
|
|
|
printf -- "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman"
|
|
|
|
printf -- "$(gettext " -S, --source Generate a source-only tarball without downloaded sources")\n"
|
2013-04-28 21:49:01 -04:00
|
|
|
printf -- "$(gettext " -V, --version Show version information and exit")\n"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " --allsource Generate a source-only tarball including downloaded sources")\n"
|
|
|
|
printf -- "$(gettext " --check Run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
|
|
|
|
printf -- "$(gettext " --config <file> Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf"
|
2012-07-16 00:16:25 +10:00
|
|
|
printf -- "$(gettext " --holdver Do not update VCS sources")\n"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " --key <key> Specify a key to use for %s signing instead of the default")\n" "gpg"
|
2014-03-03 20:29:54 +01:00
|
|
|
printf -- "$(gettext " --noarchive Do not create package archive")\n"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " --nocheck Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
|
2013-04-28 22:42:22 -04:00
|
|
|
printf -- "$(gettext " --noprepare Do not run the %s function in the %s")\n" "prepare()" "$BUILDSCRIPT"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " --nosign Do not create a signature for the package")\n"
|
2018-05-29 13:05:18 -04:00
|
|
|
printf -- "$(gettext " --packagelist Only list package filepaths that would be produced")\n"
|
2015-05-25 23:46:37 +02:00
|
|
|
printf -- "$(gettext " --printsrcinfo Print the generated SRCINFO and exit")\n"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " --sign Sign the resulting package with %s")\n" "gpg"
|
|
|
|
printf -- "$(gettext " --skipchecksums Do not verify checksums of the source files")\n"
|
|
|
|
printf -- "$(gettext " --skipinteg Do not perform any verification checks on source files")\n"
|
|
|
|
printf -- "$(gettext " --skippgpcheck Do not verify source files with PGP signatures")\n"
|
2014-03-05 10:45:21 +01:00
|
|
|
printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\n"
|
2005-03-15 01:51:43 +00:00
|
|
|
echo
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext "These options can be passed to %s:")\n" "pacman"
|
2006-02-16 22:57:25 +00:00
|
|
|
echo
|
2012-07-09 01:55:58 -04:00
|
|
|
printf -- "$(gettext " --asdeps Install packages as non-explicitly installed")\n"
|
2012-11-19 18:51:06 -06:00
|
|
|
printf -- "$(gettext " --needed Do not reinstall the targets that are already up to date")\n"
|
2014-03-05 10:45:21 +01:00
|
|
|
printf -- "$(gettext " --noconfirm Do not ask for confirmation when resolving dependencies")\n"
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext " --noprogressbar Do not show a progress bar when downloading files")\n"
|
2006-02-16 22:57:25 +00:00
|
|
|
echo
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext "If %s is not specified, %s will look for '%s'")\n" "-p" "makepkg" "$BUILDSCRIPT"
|
2005-03-15 01:51:43 +00:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2007-05-29 16:53:15 -04:00
|
|
|
version() {
|
2012-07-15 15:46:29 +10:00
|
|
|
printf "makepkg (pacman) %s\n" "$makepkg_version"
|
2024-02-24 18:40:44 +10:00
|
|
|
printf -- "Copyright (c) 2006-2024 Pacman Development Team <pacman-dev@lists.archlinux.org>.\n"
|
2018-09-18 09:42:42 -04:00
|
|
|
printf -- "Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n"
|
|
|
|
printf '\n'
|
2012-01-23 17:14:25 -05:00
|
|
|
printf -- "$(gettext "\
|
2007-07-06 19:35:32 -04:00
|
|
|
This is free software; see the source for copying conditions.\n\
|
|
|
|
There is NO WARRANTY, to the extent permitted by law.\n")"
|
2007-05-29 16:53:15 -04:00
|
|
|
}
|
|
|
|
|
2008-02-17 21:15:06 -06:00
|
|
|
# PROGRAM START
|
|
|
|
|
2013-12-10 01:59:24 +01:00
|
|
|
# ensure we have a sane umask set
|
|
|
|
umask 0022
|
|
|
|
|
2008-02-17 21:15:06 -06:00
|
|
|
# determine whether we have gettext; make it a no-op if we do not
|
2010-05-27 10:36:08 -04:30
|
|
|
if ! type -p gettext >/dev/null; then
|
2008-02-17 21:15:06 -06:00
|
|
|
gettext() {
|
2012-03-09 16:39:01 +10:00
|
|
|
printf "%s\n" "$@"
|
2008-02-17 21:15:06 -06:00
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2009-10-22 14:25:24 +10:00
|
|
|
ARGLIST=("$@")
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2007-06-05 11:58:25 +01:00
|
|
|
# Parse Command Line Options.
|
2023-01-29 14:04:34 +00:00
|
|
|
OPT_SHORT="AcCdD:efFghiLmop:rRsSV"
|
|
|
|
OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'dir:' 'force' 'geninteg'
|
2014-03-03 20:29:54 +01:00
|
|
|
'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
|
2015-03-20 19:19:57 -05:00
|
|
|
'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist'
|
2016-02-16 12:08:07 +10:00
|
|
|
'printsrcinfo' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg'
|
2015-03-20 19:19:57 -05:00
|
|
|
'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
|
2011-07-16 22:42:32 +10:00
|
|
|
|
2007-06-05 11:58:25 +01:00
|
|
|
# Pacman Options
|
2012-11-19 18:51:06 -06:00
|
|
|
OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
|
2012-04-08 13:13:07 -04:00
|
|
|
|
|
|
|
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
2018-06-19 22:33:57 +02:00
|
|
|
exit $E_INVALID_OPTION
|
2007-06-05 11:58:25 +01:00
|
|
|
fi
|
2012-04-08 13:13:07 -04:00
|
|
|
set -- "${OPTRET[@]}"
|
|
|
|
unset OPT_SHORT OPT_LONG OPTRET
|
2007-06-05 11:58:25 +01:00
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
# Pacman Options
|
2012-07-09 01:55:58 -04:00
|
|
|
--asdeps) ASDEPS=1;;
|
2013-02-09 12:57:39 -06:00
|
|
|
--needed) NEEDED=1;;
|
2016-02-20 16:02:31 +10:00
|
|
|
--noconfirm) PACMAN_OPTS+=("--noconfirm") ;;
|
|
|
|
--noprogressbar) PACMAN_OPTS+=("--noprogressbar") ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
|
|
|
|
# Makepkg Options
|
2019-01-04 00:32:09 -05:00
|
|
|
--allsource) BUILDPKG=0 SOURCEONLY=2 ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-A|--ignorearch) IGNOREARCH=1 ;;
|
|
|
|
-c|--clean) CLEANUP=1 ;;
|
2013-10-04 15:57:08 +02:00
|
|
|
-C|--cleanbuild) CLEANBUILD=1 ;;
|
2010-12-16 00:06:43 +10:00
|
|
|
--check) RUN_CHECK='y' ;;
|
2008-08-07 17:08:33 +02:00
|
|
|
--config) shift; MAKEPKG_CONF=$1 ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-d|--nodeps) NODEPS=1 ;;
|
2023-01-29 14:04:34 +00:00
|
|
|
-D|--dir) shift; CHDIR=$1 ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-e|--noextract) NOEXTRACT=1 ;;
|
|
|
|
-f|--force) FORCE=1 ;;
|
2007-06-13 10:48:22 +01:00
|
|
|
-F) INFAKEROOT=1 ;;
|
2016-02-06 20:54:31 +13:00
|
|
|
# generating integrity checks does not depend on architecture
|
2019-01-04 00:32:09 -05:00
|
|
|
-g|--geninteg) BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;;
|
2012-07-16 00:16:25 +10:00
|
|
|
--holdver) HOLDVER=1 ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-i|--install) INSTALL=1 ;;
|
2011-04-17 22:38:35 +10:00
|
|
|
--key) shift; GPGKEY=$1 ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-L|--log) LOGGING=1 ;;
|
2018-06-03 01:31:17 -04:00
|
|
|
-m|--nocolor) USE_COLOR='n'; PACMAN_OPTS+=("--color" "never") ;;
|
2014-03-03 20:29:54 +01:00
|
|
|
--noarchive) NOARCHIVE=1 ;;
|
2010-12-16 00:06:43 +10:00
|
|
|
--nocheck) RUN_CHECK='n' ;;
|
2022-05-11 20:19:35 +02:00
|
|
|
--noverify) RUN_VERIFY='n' ;;
|
2013-04-28 22:42:22 -04:00
|
|
|
--noprepare) RUN_PREPARE='n' ;;
|
2011-03-26 12:06:06 +10:00
|
|
|
--nosign) SIGNPKG='n' ;;
|
2019-01-04 00:32:09 -05:00
|
|
|
-o|--nobuild) BUILDPKG=0 NOBUILD=1 ;;
|
2009-07-12 17:10:11 +10:00
|
|
|
-p) shift; BUILDFILE=$1 ;;
|
2019-01-04 00:32:09 -05:00
|
|
|
--packagelist) BUILDPKG=0 PACKAGELIST=1 IGNOREARCH=1;;
|
|
|
|
--printsrcinfo) BUILDPKG=0 PRINTSRCINFO=1 IGNOREARCH=1;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-r|--rmdeps) RMDEPS=1 ;;
|
|
|
|
-R|--repackage) REPKG=1 ;;
|
2014-03-05 10:45:21 +01:00
|
|
|
--sign) SIGNPKG='y' ;;
|
2011-07-16 22:42:32 +10:00
|
|
|
--skipchecksums) SKIPCHECKSUMS=1 ;;
|
|
|
|
--skipinteg) SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;;
|
2011-07-06 13:02:19 +02:00
|
|
|
--skippgpcheck) SKIPPGPCHECK=1;;
|
2007-06-05 11:58:25 +01:00
|
|
|
-s|--syncdeps) DEP_BIN=1 ;;
|
2019-01-04 00:32:09 -05:00
|
|
|
-S|--source) BUILDPKG=0 SOURCEONLY=1 ;;
|
|
|
|
--verifysource) BUILDPKG=0 VERIFYSOURCE=1 ;;
|
2007-06-02 18:39:48 +01:00
|
|
|
|
2017-09-22 13:01:09 -05:00
|
|
|
-h|--help) usage; exit $E_OK ;;
|
|
|
|
-V|--version) version; exit $E_OK ;;
|
2007-06-05 11:58:25 +01:00
|
|
|
|
2018-05-29 13:07:47 -04:00
|
|
|
--) shift; break ;;
|
2005-03-15 01:51:43 +00:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2013-08-05 18:04:37 -04:00
|
|
|
# attempt to consume any extra argv as environment variables. this supports
|
|
|
|
# overriding (e.g. CC=clang) as well as overriding (e.g. CFLAGS+=' -g').
|
|
|
|
extra_environment=()
|
|
|
|
while [[ $1 ]]; do
|
|
|
|
if [[ $1 = [_[:alpha:]]*([[:alnum:]_])?(+)=* ]]; then
|
|
|
|
extra_environment+=("$1")
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2023-10-20 22:33:57 +01:00
|
|
|
if (( ! INFAKEROOT )) && [[ -n $CHDIR ]]; then
|
2023-01-29 14:04:34 +00:00
|
|
|
cd_safe "$CHDIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
declare -r startdir="$(pwd -P)"
|
|
|
|
|
2011-10-13 17:26:17 -05:00
|
|
|
# setup signal traps
|
|
|
|
trap 'clean_up' 0
|
|
|
|
for signal in TERM HUP QUIT; do
|
2012-03-02 19:25:15 -05:00
|
|
|
trap "trap_exit $signal \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
|
2011-10-13 17:26:17 -05:00
|
|
|
done
|
2012-03-02 19:25:15 -05:00
|
|
|
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
|
|
|
|
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
|
2011-10-13 17:26:17 -05:00
|
|
|
|
2019-05-22 10:44:27 -04:00
|
|
|
load_makepkg_config
|
makepkg: reorganize the restoration of settings by precedence
The extra variables on the commandline were inconsistently applied. They
should override anything else, instead, most were overridden by
environment variables with the exception of BUILDDIR (and this was not
sanity-checked to see if it had write permissions).
e.g. given the commandline:
`PKGDEST="$(pwd)"` BUILDDIR="$(pwd)" makepkg PKGDEST=/doesnt/exist BUILDDIR=/doesnt/exist`
We would incorrectly use the current working directory for PKGDEST.
Meanwhile, we checked the wrong directory for BUILDDIR, and later
errored when we tried to create $srcdir inside the non-writable
directory "/doesnt/exist".
In order to fix this, use the preferred bash builtin for saving variable
definitions, similar to how we restore traps etc. rather than tediously
redefining each one by hand, and restore this immediately after
makepkg.conf is sourced. Finally, the `make`-style commandline overrides
are applied.
Also canonicalize_path is applied only on the final paths we try to use.
While it is unlikely the value in makepkg.conf will be a relative path,
since we now properly respect commandline overrides, they should be
canonicalized as well.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-10-30 14:03:28 -04:00
|
|
|
|
|
|
|
# override settings from extra variables on commandline, if any
|
|
|
|
if (( ${#extra_environment[*]} )); then
|
|
|
|
export "${extra_environment[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# canonicalize paths and provide defaults if anything is still undefined
|
|
|
|
for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR; do
|
2019-01-10 00:54:33 -05:00
|
|
|
printf -v "$var" '%s' "$(canonicalize_path "${!var:-$startdir}")"
|
makepkg: reorganize the restoration of settings by precedence
The extra variables on the commandline were inconsistently applied. They
should override anything else, instead, most were overridden by
environment variables with the exception of BUILDDIR (and this was not
sanity-checked to see if it had write permissions).
e.g. given the commandline:
`PKGDEST="$(pwd)"` BUILDDIR="$(pwd)" makepkg PKGDEST=/doesnt/exist BUILDDIR=/doesnt/exist`
We would incorrectly use the current working directory for PKGDEST.
Meanwhile, we checked the wrong directory for BUILDDIR, and later
errored when we tried to create $srcdir inside the non-writable
directory "/doesnt/exist".
In order to fix this, use the preferred bash builtin for saving variable
definitions, similar to how we restore traps etc. rather than tediously
redefining each one by hand, and restore this immediately after
makepkg.conf is sourced. Finally, the `make`-style commandline overrides
are applied.
Also canonicalize_path is applied only on the final paths we try to use.
While it is unlikely the value in makepkg.conf will be a relative path,
since we now properly respect commandline overrides, they should be
canonicalized as well.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-10-30 14:03:28 -04:00
|
|
|
done
|
|
|
|
unset var
|
|
|
|
PACKAGER=${PACKAGER:-"Unknown Packager"}
|
|
|
|
|
2009-12-02 19:04:32 +01:00
|
|
|
# set pacman command if not already defined
|
|
|
|
PACMAN=${PACMAN:-pacman}
|
2012-11-13 13:04:21 +10:00
|
|
|
# save full path to command as PATH may change when sourcing /etc/profile
|
2014-02-02 17:37:58 +10:00
|
|
|
PACMAN_PATH=$(type -P $PACMAN)
|
2009-12-02 19:04:32 +01:00
|
|
|
|
2009-03-14 23:51:58 +10:00
|
|
|
# check if messages are to be printed using color
|
2014-08-15 11:42:02 -04:00
|
|
|
if [[ -t 2 && $USE_COLOR != "n" ]] && check_buildenv "color" "y"; then
|
2015-07-20 14:50:52 +10:00
|
|
|
colorize
|
|
|
|
else
|
|
|
|
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
2009-03-14 23:51:58 +10:00
|
|
|
fi
|
2015-07-20 14:50:52 +10:00
|
|
|
|
2009-03-14 23:51:58 +10:00
|
|
|
|
2018-03-14 22:59:18 -04:00
|
|
|
# check makepkg.conf for some basic requirements
|
|
|
|
lint_config || exit $E_CONFIG_ERROR
|
|
|
|
|
|
|
|
|
2018-02-07 23:56:01 -05:00
|
|
|
# check that all settings directories are user-writable
|
|
|
|
if ! ensure_writable_dir "BUILDDIR" "$BUILDDIR"; then
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_FS_PERMISSIONS
|
2011-06-15 14:32:42 +10:00
|
|
|
fi
|
|
|
|
|
2018-02-07 23:56:01 -05:00
|
|
|
if (( ! (NOBUILD || GENINTEG) )) && ! ensure_writable_dir "PKGDEST" "$PKGDEST"; then
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_FS_PERMISSIONS
|
2010-03-07 17:31:26 +10:00
|
|
|
fi
|
|
|
|
|
2018-02-07 23:56:01 -05:00
|
|
|
if ! ensure_writable_dir "SRCDEST" "$SRCDEST" ; then
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_FS_PERMISSIONS
|
2010-03-07 17:31:26 +10:00
|
|
|
fi
|
|
|
|
|
2014-08-09 17:26:24 -04:00
|
|
|
if (( SOURCEONLY )); then
|
2018-02-07 23:56:01 -05:00
|
|
|
if ! ensure_writable_dir "SRCPKGDEST" "$SRCPKGDEST"; then
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_FS_PERMISSIONS
|
2014-08-09 17:26:24 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If we're only making a source tarball, then we need to ignore architecture-
|
|
|
|
# dependent behavior.
|
|
|
|
IGNOREARCH=1
|
2012-01-31 23:25:19 +10:00
|
|
|
fi
|
2008-08-07 17:08:33 +02:00
|
|
|
|
2018-02-07 23:56:01 -05:00
|
|
|
if (( LOGGING )) && ! ensure_writable_dir "LOGDEST" "$LOGDEST"; then
|
2020-06-02 17:50:24 -04:00
|
|
|
plainerr "$(gettext "Aborting...")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_FS_PERMISSIONS
|
2012-11-29 01:08:55 -06:00
|
|
|
fi
|
|
|
|
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( ! INFAKEROOT )); then
|
2014-03-08 20:31:46 +10:00
|
|
|
if (( EUID == 0 )); then
|
|
|
|
error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
|
2014-12-19 14:22:27 +01:00
|
|
|
catastrophic damage to your system.")" "makepkg"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_ROOT
|
2007-04-11 20:06:25 +01:00
|
|
|
fi
|
|
|
|
else
|
2009-11-12 15:09:05 -05:00
|
|
|
if [[ -z $FAKEROOTKEY ]]; then
|
2017-09-22 12:25:06 -05:00
|
|
|
error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_INVALID_OPTION
|
2007-04-11 20:06:25 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-07 20:39:40 -04:00
|
|
|
unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}"
|
|
|
|
unset "${known_hash_algos[@]/%/sums}"
|
2022-05-11 20:19:35 +02:00
|
|
|
unset -f pkgver verify prepare build check package "${!package_@}"
|
2014-12-25 13:11:54 -05:00
|
|
|
unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}"
|
|
|
|
unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}"
|
2020-01-23 12:14:14 +10:00
|
|
|
unset "${!cksums_@}" "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}"
|
|
|
|
unset "${!sha256sums_@}" "${!sha384sums_@}" "${!sha512sums_@}" "${!b2sums_@}"
|
2006-11-14 07:58:42 +00:00
|
|
|
|
2009-07-12 17:10:11 +10:00
|
|
|
BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
|
2009-11-12 15:09:05 -05:00
|
|
|
if [[ ! -f $BUILDFILE ]]; then
|
2013-05-18 22:47:35 +10:00
|
|
|
error "$(gettext "%s does not exist.")" "$BUILDFILE"
|
2019-01-10 00:58:44 -05:00
|
|
|
exit $E_PKGBUILD_ERROR
|
2017-09-22 13:01:09 -05:00
|
|
|
|
2008-12-06 23:32:34 -06:00
|
|
|
else
|
2013-03-24 15:09:18 -04:00
|
|
|
if [[ $(<"$BUILDFILE") = *$'\r'* ]]; then
|
2011-06-18 12:40:14 +10:00
|
|
|
error "$(gettext "%s contains %s characters and cannot be sourced.")" "$BUILDFILE" "CRLF"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PKGBUILD_ERROR
|
2008-12-06 23:32:34 -06:00
|
|
|
fi
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2014-07-25 14:09:06 -04:00
|
|
|
if [[ ! $BUILDFILE -ef $PWD/${BUILDFILE##*/} ]]; then
|
|
|
|
error "$(gettext "%s must be in the current working directory.")" "$BUILDFILE"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_PKGBUILD_ERROR
|
2014-05-25 13:53:19 +10:00
|
|
|
fi
|
|
|
|
|
2009-11-12 15:09:05 -05:00
|
|
|
if [[ ${BUILDFILE:0:1} != "/" ]]; then
|
2009-07-12 17:10:11 +10:00
|
|
|
BUILDFILE="$startdir/$BUILDFILE"
|
|
|
|
fi
|
PKGBUILD: handle arch specific attributes
This introduces support for architecture-specific conflicts, depends,
optdepends, makedepends, replaces, and conflicts by appending "_$CARCH"
to the array name. For example, in the global section:
arch=('i686' 'x86_64')
depends=('foo')
depends_x86_64=('bar')
This will generate depends of 'foo' and 'bar' on x86_64, but only 'foo'
on i686. Moreover, this is supported in the package functions with the
same heuristics as the generic names, e.g.
...
arch=('i686' 'x86_64')
depends=('foo')
...
package_somepkg() {
depends_x86_64=('bar')
...
}
Again, will cause x86_64 to have depends of 'foo' and 'bar', but only
'foo' for i686.
2014-07-25 14:01:48 -04:00
|
|
|
source_buildfile "$BUILDFILE"
|
2009-05-16 13:48:10 +10:00
|
|
|
fi
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2011-02-09 07:54:42 -06:00
|
|
|
pkgbase=${pkgbase:-${pkgname[0]}}
|
2015-11-13 13:33:23 +10:00
|
|
|
|
|
|
|
# check the PKGBUILD for some basic requirements
|
2024-05-20 20:50:43 +10:00
|
|
|
if (( MAKEPKG_LINT_PKGBUILD != 0 )); then
|
|
|
|
lint_pkgbuild || exit $E_PKGBUILD_ERROR
|
|
|
|
fi
|
2015-11-13 13:33:23 +10:00
|
|
|
|
2016-09-30 00:57:34 +02:00
|
|
|
if (( !SOURCEONLY && !PRINTSRCINFO )); then
|
2015-11-13 13:33:23 +10:00
|
|
|
merge_arch_attrs
|
|
|
|
fi
|
|
|
|
|
2013-11-01 21:34:34 +10:00
|
|
|
basever=$(get_full_version)
|
2011-02-09 07:54:42 -06:00
|
|
|
|
2018-06-04 09:31:19 -04:00
|
|
|
if [[ $BUILDDIR -ef "$startdir" ]]; then
|
2012-03-09 16:01:28 +10:00
|
|
|
srcdir="$BUILDDIR/src"
|
2013-02-02 12:13:41 +10:00
|
|
|
pkgdirbase="$BUILDDIR/pkg"
|
2012-03-09 16:01:28 +10:00
|
|
|
else
|
|
|
|
srcdir="$BUILDDIR/$pkgbase/src"
|
2013-02-02 12:13:41 +10:00
|
|
|
pkgdirbase="$BUILDDIR/$pkgbase/pkg"
|
|
|
|
|
2012-03-09 16:01:28 +10:00
|
|
|
fi
|
|
|
|
|
2013-02-02 12:13:41 +10:00
|
|
|
# set pkgdir to something "sensible" for (not recommended) use during build()
|
|
|
|
pkgdir="$pkgdirbase/$pkgbase"
|
|
|
|
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( GENINTEG )); then
|
2008-05-26 16:27:22 +10:00
|
|
|
mkdir -p "$srcdir"
|
2010-03-06 22:02:36 +10:00
|
|
|
chmod a-s "$srcdir"
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "$srcdir"
|
2022-05-31 18:37:51 +02:00
|
|
|
download_sources allarch >&2
|
2008-05-26 16:27:22 +10:00
|
|
|
generate_checksums
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2008-05-26 16:27:22 +10:00
|
|
|
fi
|
|
|
|
|
2013-05-18 23:43:27 +10:00
|
|
|
if have_function pkgver; then
|
2012-07-16 22:25:24 +10:00
|
|
|
PKGVERFUNC=1
|
|
|
|
fi
|
|
|
|
|
2018-05-31 18:24:47 +02:00
|
|
|
if (( ${#pkgname[@]} > 1 )) || have_function package_${pkgname}; then
|
2009-03-06 18:28:47 +10:00
|
|
|
SPLITPKG=1
|
|
|
|
fi
|
|
|
|
|
2009-10-27 12:56:13 +01:00
|
|
|
# test for available PKGBUILD functions
|
2022-05-11 20:19:35 +02:00
|
|
|
if have_function verify; then
|
|
|
|
# "Hide" verify() function if not going to be run
|
|
|
|
if [[ $RUN_VERIFY != "n" ]] && (( ! SKIPCHECKSUMS && ! SKIPPGPCHECK )); then
|
|
|
|
VERIFYFUNC=1
|
|
|
|
fi
|
|
|
|
fi
|
2013-05-18 23:43:27 +10:00
|
|
|
if have_function prepare; then
|
2013-04-28 22:42:22 -04:00
|
|
|
# "Hide" prepare() function if not going to be run
|
|
|
|
if [[ $RUN_PREPARE != "n" ]]; then
|
|
|
|
PREPAREFUNC=1
|
|
|
|
fi
|
2012-07-28 11:20:10 +02:00
|
|
|
fi
|
2013-05-18 23:43:27 +10:00
|
|
|
if have_function build; then
|
2009-10-27 12:56:13 +01:00
|
|
|
BUILDFUNC=1
|
|
|
|
fi
|
2013-05-18 23:43:27 +10:00
|
|
|
if have_function check; then
|
2010-12-16 00:06:43 +10:00
|
|
|
# "Hide" check() function if not going to be run
|
makepkg: remove subshelling from check_option and friends
Instead of creating a subshell for each of these checks (of which there
are many), pass in an expected value and make the check_* function do
the comparison for us, returning 0 (match), 1, (mismatch), or 127 (not
found).
For a measureable benefit, I tested this on a fairly simple package,
perl-term-readkey, and counted the number of clone(2) syscalls to try
and isolate those generated by makepkg itself, rather than the user
defined functions. Results as shown below:
336 before
180 after
So, roughly a 50% reduction, which makes sense given that a single
check_option() call could be up to 3 subprocesses in total.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 23:36:08 -04:00
|
|
|
if [[ $RUN_CHECK = 'y' ]] || { ! check_buildenv "check" "n" && [[ $RUN_CHECK != "n" ]]; }; then
|
2010-12-16 00:06:43 +10:00
|
|
|
CHECKFUNC=1
|
|
|
|
fi
|
|
|
|
fi
|
2013-05-18 23:43:27 +10:00
|
|
|
if have_function package; then
|
2009-10-25 14:33:47 +10:00
|
|
|
PKGFUNC=1
|
|
|
|
fi
|
|
|
|
|
2015-03-20 19:19:57 -05:00
|
|
|
if (( PACKAGELIST )); then
|
|
|
|
print_all_package_names
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2015-03-20 19:19:57 -05:00
|
|
|
fi
|
|
|
|
|
2015-05-25 23:46:37 +02:00
|
|
|
if (( PRINTSRCINFO )); then
|
2016-02-20 18:35:47 +01:00
|
|
|
write_srcinfo_content
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2015-05-25 23:46:37 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-16 22:25:24 +10:00
|
|
|
if (( ! PKGVERFUNC )); then
|
|
|
|
check_build_status
|
2005-03-15 01:51:43 +00:00
|
|
|
fi
|
|
|
|
|
2007-10-26 20:32:09 -06:00
|
|
|
# Run the bare minimum in fakeroot
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( INFAKEROOT )); then
|
2011-06-15 16:02:22 +10:00
|
|
|
if (( SOURCEONLY )); then
|
|
|
|
create_srcpackage
|
2011-06-18 12:40:14 +10:00
|
|
|
msg "$(gettext "Leaving %s environment.")" "fakeroot"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2011-06-15 16:02:22 +10:00
|
|
|
fi
|
|
|
|
|
2016-04-02 22:41:17 +10:00
|
|
|
prepare_buildenv
|
|
|
|
|
2013-02-02 12:13:41 +10:00
|
|
|
chmod 755 "$pkgdirbase"
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( ! SPLITPKG )); then
|
2019-01-04 13:09:38 +10:00
|
|
|
run_single_packaging
|
2009-01-16 22:32:05 +10:00
|
|
|
else
|
2010-06-17 08:14:49 -04:30
|
|
|
run_split_packaging
|
2005-03-15 01:51:43 +00:00
|
|
|
fi
|
2019-10-27 03:05:10 -04:00
|
|
|
|
2019-01-04 13:09:38 +10:00
|
|
|
create_debug_package
|
2007-04-11 20:06:25 +01:00
|
|
|
|
2011-06-18 12:40:14 +10:00
|
|
|
msg "$(gettext "Leaving %s environment.")" "fakeroot"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2005-03-15 01:51:43 +00:00
|
|
|
fi
|
|
|
|
|
2023-12-09 11:03:15 +10:00
|
|
|
# check we have the software required to process the PKGBUILD
|
|
|
|
check_software || exit $E_MISSING_MAKEPKG_DEPS
|
|
|
|
|
|
|
|
# check if gpg signature is to be created and if signing key is valid
|
|
|
|
if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; then
|
|
|
|
SIGNPKG='y'
|
|
|
|
if ! gpg --list-secret-key ${GPGKEY:+"$GPGKEY"} &>/dev/null; then
|
|
|
|
if [[ ! -z $GPGKEY ]]; then
|
|
|
|
error "$(gettext "The key %s does not exist in your keyring.")" "${GPGKEY}"
|
|
|
|
else
|
|
|
|
error "$(gettext "There is no key in your keyring.")"
|
|
|
|
fi
|
|
|
|
exit $E_PRETTY_BAD_PRIVACY
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-02-11 01:27:52 +08:00
|
|
|
msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))"
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2007-05-30 14:27:13 -04:00
|
|
|
# if we are creating a source-only package, go no further
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( SOURCEONLY )); then
|
2013-11-01 21:34:34 +10:00
|
|
|
if [[ -f $SRCPKGDEST/${pkgbase}-${basever}${SRCEXT} ]] \
|
2013-07-22 03:09:58 +02:00
|
|
|
&& (( ! FORCE )); then
|
2011-06-18 12:40:14 +10:00
|
|
|
error "$(gettext "A source package has already been built. (use %s to overwrite)")" "-f"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_ALREADY_BUILT
|
2007-05-30 14:27:13 -04:00
|
|
|
fi
|
2011-06-15 16:02:22 +10:00
|
|
|
|
|
|
|
# Get back to our src directory so we can begin with sources.
|
|
|
|
mkdir -p "$srcdir"
|
|
|
|
chmod a-s "$srcdir"
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "$srcdir"
|
2012-07-15 23:57:25 +10:00
|
|
|
if (( SOURCEONLY == 2 )); then
|
2014-08-07 12:41:20 -04:00
|
|
|
download_sources allarch
|
2012-07-15 23:57:25 +10:00
|
|
|
elif ( (( ! SKIPCHECKSUMS )) || \
|
|
|
|
( (( ! SKIPPGPCHECK )) && source_has_signatures ) ); then
|
2022-05-31 18:37:51 +02:00
|
|
|
download_sources allarch
|
2011-06-15 16:02:22 +10:00
|
|
|
fi
|
2014-08-07 12:41:20 -04:00
|
|
|
check_source_integrity all
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "$startdir"
|
2011-06-15 16:02:22 +10:00
|
|
|
|
2014-03-08 20:46:21 +10:00
|
|
|
enter_fakeroot
|
2011-06-15 16:02:22 +10:00
|
|
|
|
2017-11-12 12:26:56 -05:00
|
|
|
if [[ $SIGNPKG = 'y' ]]; then
|
|
|
|
msg "$(gettext "Signing package...")"
|
makepkg: fix signing of source packages
In commit c6b04c04653ba9933fe978829148312e412a9ea7 the signing stage was
moved out of fakeroot, and thus into the main control flow instead of
create_{,src}package
While the function for signing binary packages has logic to build
and gpg-sign multiple filenames, the source package never got this
special treatment. This would be fine, except it uses the standard
variables to set define the filename... like ${fullver}, which is
usually set beforehand, but in this case is not. We don't define fullver
globally as it's an internal implementation detail, except by sheer
coincidence if PKGVERFUNC is false due to improperly guarded code.
Result: source packages didn't end up signed. Instead, we raised a logic
error:
==> WARNING: Failed to sign package file somepackage-.src.tar.gz.
==> ERROR: An unknown error has occurred. Exiting...
Instead, let's just build the version inline, since we only use it once.
Reported-by: GaKu999 <g4ku999@gmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-10-11 22:22:04 -04:00
|
|
|
create_signature "$SRCPKGDEST/${pkgbase}-$(get_full_version)${SRCEXT}"
|
2017-11-12 12:26:56 -05:00
|
|
|
fi
|
2017-04-17 18:30:05 +10:00
|
|
|
|
2018-02-11 01:27:52 +08:00
|
|
|
msg "$(gettext "Source package created: %s")" "$pkgbase ($(date +%c))"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2007-05-30 14:27:13 -04:00
|
|
|
fi
|
|
|
|
|
2014-06-29 23:23:09 +10:00
|
|
|
if (( NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
|
2012-06-07 16:09:46 +10:00
|
|
|
if (( NODEPS )); then
|
2007-06-02 18:39:48 +01:00
|
|
|
warning "$(gettext "Skipping dependency checks.")"
|
2007-02-01 02:12:49 +00:00
|
|
|
fi
|
2012-11-13 13:04:21 +10:00
|
|
|
else
|
2012-02-04 09:07:02 -05:00
|
|
|
if (( RMDEPS && ! INSTALL )); then
|
2010-06-18 19:21:10 -04:30
|
|
|
original_pkglist=($(run_pacman -Qq)) # required by remove_dep
|
2009-10-23 15:30:47 +10:00
|
|
|
fi
|
2007-02-14 05:52:49 +00:00
|
|
|
deperr=0
|
|
|
|
|
2010-06-17 08:14:51 -04:30
|
|
|
msg "$(gettext "Checking runtime dependencies...")"
|
2007-06-02 17:41:15 +01:00
|
|
|
resolve_deps ${depends[@]} || deperr=1
|
2007-02-14 05:52:49 +00:00
|
|
|
|
2012-02-04 09:07:02 -05:00
|
|
|
if (( RMDEPS && INSTALL )); then
|
|
|
|
original_pkglist=($(run_pacman -Qq)) # required by remove_dep
|
|
|
|
fi
|
|
|
|
|
2010-06-17 08:14:51 -04:30
|
|
|
msg "$(gettext "Checking buildtime dependencies...")"
|
2010-12-16 00:06:43 +10:00
|
|
|
if (( CHECKFUNC )); then
|
2013-07-12 11:06:38 +01:00
|
|
|
resolve_deps "${makedepends[@]}" "${checkdepends[@]}" || deperr=1
|
|
|
|
else
|
|
|
|
resolve_deps "${makedepends[@]}" || deperr=1
|
2010-12-16 00:06:43 +10:00
|
|
|
fi
|
|
|
|
|
2009-10-23 15:30:47 +10:00
|
|
|
if (( RMDEPS )); then
|
2010-06-18 19:21:10 -04:30
|
|
|
current_pkglist=($(run_pacman -Qq)) # required by remove_deps
|
2009-10-23 15:30:47 +10:00
|
|
|
fi
|
|
|
|
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( deperr )); then
|
2007-06-02 18:39:48 +01:00
|
|
|
error "$(gettext "Could not resolve all dependencies.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_INSTALL_DEPS_FAILED
|
2005-03-15 01:51:43 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-10-20 14:11:20 +02:00
|
|
|
# ensure existence of our src directory so we can begin with sources
|
2007-06-03 03:33:17 +01:00
|
|
|
mkdir -p "$srcdir"
|
2010-03-06 22:02:36 +10:00
|
|
|
chmod a-s "$srcdir"
|
2007-04-04 22:30:05 -04:00
|
|
|
|
2016-01-25 15:23:16 +10:00
|
|
|
if (( !REPKG )); then
|
|
|
|
if (( NOEXTRACT && ! VERIFYSOURCE )); then
|
|
|
|
warning "$(gettext "Using existing %s tree")" "\$srcdir/"
|
|
|
|
else
|
|
|
|
download_sources
|
|
|
|
check_source_integrity
|
2017-09-22 13:01:09 -05:00
|
|
|
(( VERIFYSOURCE )) && exit $E_OK
|
2013-10-04 15:57:08 +02:00
|
|
|
|
2016-01-25 15:23:16 +10:00
|
|
|
if (( CLEANBUILD )); then
|
|
|
|
msg "$(gettext "Removing existing %s directory...")" "\$srcdir/"
|
2023-10-20 14:11:20 +02:00
|
|
|
rm -rf "$srcdir"
|
|
|
|
mkdir -p "$srcdir"
|
|
|
|
chmod a-s "$srcdir"
|
2016-01-25 15:23:16 +10:00
|
|
|
fi
|
2013-10-04 15:57:08 +02:00
|
|
|
|
2023-10-20 14:11:20 +02:00
|
|
|
cd_safe "$srcdir"
|
2016-01-25 15:23:16 +10:00
|
|
|
extract_sources
|
2016-02-17 09:11:38 +02:00
|
|
|
if (( PREPAREFUNC )); then
|
|
|
|
run_prepare
|
|
|
|
fi
|
2017-09-12 23:59:24 -04:00
|
|
|
if (( REPRODUCIBLE )); then
|
|
|
|
# We have activated reproducible builds, so unify source times before
|
|
|
|
# building
|
|
|
|
find "$srcdir" -exec touch -h -d @$SOURCE_DATE_EPOCH {} +
|
|
|
|
fi
|
2016-01-25 15:23:16 +10:00
|
|
|
fi
|
2015-12-14 23:53:53 +10:00
|
|
|
|
2016-01-25 15:23:16 +10:00
|
|
|
if (( PKGVERFUNC )); then
|
|
|
|
update_pkgver
|
|
|
|
basever=$(get_full_version)
|
|
|
|
check_build_status
|
|
|
|
fi
|
2006-12-21 19:11:22 +00:00
|
|
|
fi
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2009-11-12 15:09:05 -05:00
|
|
|
if (( NOBUILD )); then
|
2007-03-31 20:07:37 -04:00
|
|
|
msg "$(gettext "Sources are ready.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2006-12-21 19:11:22 +00:00
|
|
|
else
|
2016-02-12 21:09:47 +10:00
|
|
|
# clean existing pkg directory
|
2013-05-19 00:03:36 +10:00
|
|
|
if [[ -d $pkgdirbase ]]; then
|
2013-10-09 13:20:11 +10:00
|
|
|
msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
|
2016-02-12 21:09:47 +10:00
|
|
|
rm -rf "$pkgdirbase"
|
2006-12-21 17:42:58 +00:00
|
|
|
fi
|
2013-02-02 12:13:41 +10:00
|
|
|
mkdir -p "$pkgdirbase"
|
2015-07-19 09:50:40 -04:00
|
|
|
chmod a-srw "$pkgdirbase"
|
2012-03-09 17:43:47 +10:00
|
|
|
cd_safe "$startdir"
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2016-04-02 22:41:17 +10:00
|
|
|
prepare_buildenv
|
|
|
|
|
2014-03-08 20:46:21 +10:00
|
|
|
if (( ! REPKG )); then
|
|
|
|
(( BUILDFUNC )) && run_build
|
|
|
|
(( CHECKFUNC )) && run_check
|
|
|
|
cd_safe "$startdir"
|
2007-04-11 20:06:25 +01:00
|
|
|
fi
|
2014-03-08 20:46:21 +10:00
|
|
|
|
|
|
|
enter_fakeroot
|
2017-04-17 18:30:05 +10:00
|
|
|
|
2019-04-16 13:36:12 -04:00
|
|
|
create_package_signatures || exit $E_PRETTY_BAD_PRIVACY
|
2007-04-11 20:06:25 +01:00
|
|
|
fi
|
2006-12-05 07:43:42 +00:00
|
|
|
|
2014-03-03 20:29:54 +01:00
|
|
|
# if inhibiting archive creation, go no further
|
|
|
|
if (( NOARCHIVE )); then
|
2014-09-07 14:56:52 -04:00
|
|
|
msg "$(gettext "Package directory is ready.")"
|
2017-09-22 13:01:09 -05:00
|
|
|
exit $E_OK
|
2014-03-03 20:29:54 +01:00
|
|
|
fi
|
|
|
|
|
2018-02-11 01:27:52 +08:00
|
|
|
msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))"
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2017-09-22 13:01:09 -05:00
|
|
|
install_package && exit $E_OK || exit $E_INSTALL_FAILED
|