forked from artix/artools
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8cc8b66e7f | |||
0ae8c16801 | |||
bb674109ed |
@@ -21,6 +21,8 @@ load_config "${USERCONFDIR}/artools/artools.conf" || load_config "${SYSCONFDIR}/
|
||||
|
||||
create_first=false
|
||||
rebuild=false
|
||||
no_check=false
|
||||
is_checkpkg=false
|
||||
|
||||
mkchrootpkg_args=(-c -n)
|
||||
|
||||
@@ -33,6 +35,8 @@ usage() {
|
||||
echo " -r <dir> Create chroots in this directory"
|
||||
echo ' -c Recreate the chroot before building'
|
||||
echo ' -m Major rebuild'
|
||||
echo ' -N Disable check() function'
|
||||
echo ' -C Run checkpkg after built'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
||||
@@ -42,13 +46,15 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='hcmr:'
|
||||
opts='hcCNmr:'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
r) CHROOTS_PKG="$OPTARG" ;;
|
||||
c) create_first=true ;;
|
||||
m) rebuild=true ;;
|
||||
C) is_checkpkg=true; mkchrootpkg_args+=(-C) ;;
|
||||
N) no_check=true; mkchrootpkg_args+=(-N) ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
||||
esac
|
||||
|
@@ -17,16 +17,22 @@
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
# Source makepkg.conf; fail if it is not found
|
||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
||||
source '/etc/makepkg.conf'
|
||||
# shellcheck source=makepkg-x86_64.conf
|
||||
source '/etc/makepkg.conf'
|
||||
else
|
||||
die '/etc/makepkg.conf not found!'
|
||||
die '/etc/makepkg.conf not found!'
|
||||
fi
|
||||
|
||||
load_user_info
|
||||
|
||||
load_vars "${USERCONFDIR}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||
load_vars /etc/makepkg.conf
|
||||
# Source user-specific makepkg.conf overrides
|
||||
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
|
||||
# shellcheck source=/dev/null
|
||||
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
|
||||
elif [[ -r "$HOME/.makepkg.conf" ]]; then
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.makepkg.conf"
|
||||
fi
|
||||
|
||||
usage() {
|
||||
cat <<- _EOF_
|
||||
@@ -60,17 +66,17 @@ while :; do
|
||||
case $1 in
|
||||
-r|--rmdir)
|
||||
RMDIR=1
|
||||
;;
|
||||
;;
|
||||
-w|--warn)
|
||||
WARN=1
|
||||
;;
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
;;
|
||||
--)
|
||||
shift; break
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -79,8 +85,9 @@ if [[ ! -f PKGBUILD ]]; then
|
||||
die 'This must be run in the directory of a built package.'
|
||||
fi
|
||||
|
||||
# shellcheck source=PKGBUILD.proto
|
||||
. ./PKGBUILD
|
||||
if [[ $arch == 'any' ]]; then
|
||||
if [[ ${arch[0]} == 'any' ]]; then
|
||||
CARCH='any'
|
||||
fi
|
||||
|
||||
@@ -91,7 +98,7 @@ TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||
for _pkgname in "${pkgname[@]}"; do
|
||||
comparepkg=$_pkgname
|
||||
pkgurl=
|
||||
target_pkgver=$(get_full_version)
|
||||
target_pkgver=$(get_full_version "$_pkgname")
|
||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||
fi
|
||||
@@ -142,7 +149,7 @@ for _pkgname in "${pkgname[@]}"; do
|
||||
(( WARN )) && warning "$message" || msg "$message"
|
||||
echo "$diff_output"
|
||||
else
|
||||
msg "No soname differences for %s" "$_pkgname."
|
||||
msg "No soname differences for %s." "$_pkgname"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@@ -65,7 +65,6 @@ update_repo2(){
|
||||
if ${add_pkg};then
|
||||
local action='add'
|
||||
packages+=("$name")
|
||||
# checkpkg "${pkgfile}" || return 2
|
||||
if ${sign_pkg};then
|
||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||
signfile ${pkgfile}
|
||||
@@ -109,7 +108,6 @@ update_repo(){
|
||||
if ${add_pkg};then
|
||||
local action='add'
|
||||
packages+=("$pkg")
|
||||
# checkpkg "${pkgfile}" || return 2
|
||||
if ${sign_pkg};then
|
||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||
signfile ${pkgfile}
|
||||
|
@@ -33,6 +33,7 @@ REPO_DB_PREFIX=
|
||||
REPO_DB_SUFFIX=
|
||||
LOCKFILE=
|
||||
CLEAN_LOCK=0
|
||||
PREVENT_DOWNGRADE=0
|
||||
|
||||
. @libdir@/artools/util-base.sh
|
||||
|
||||
@@ -52,6 +53,7 @@ Multiple packages to add can be specified on the command line.\n"
|
||||
printf -- "\n"
|
||||
printf -- "Options:\n"
|
||||
printf -- " -n, --new only add packages that are not already in the database\n"
|
||||
printf -- "$(gettext " -p, --prevent-downgrade do not add package to database if a newer version is already present\n")"
|
||||
elif [[ $cmd == "links-remove" ]] ; then
|
||||
printf -- "Usage: links-remove [options] <path-to-db> <packagename> ...\n"
|
||||
printf -- "\n"
|
||||
@@ -199,6 +201,18 @@ db_write_entry() {
|
||||
if (( ONLYADDNEW )); then
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
pkgentry=$(find_pkgentry "$pkgname")
|
||||
if [[ -n $pkgentry ]]; then
|
||||
|
||||
local version=$(sed -n '/^%VERSION%$/ {n;p;q}' "$pkgentry/desc")
|
||||
if (( $(vercmp "$version" "$pkgver") > 0 )); then
|
||||
warning "$(gettext "A newer version for '%s' is already present in database")" "$pkgname"
|
||||
if (( PREVENT_DOWNGRADE )); then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# remove an existing entry if it exists, ignore failures
|
||||
@@ -459,6 +473,7 @@ while (( $# )); do
|
||||
-s|--sign) SIGN=1 ;;
|
||||
-k|--key) KEY=1 ; shift; GPGKEY=$1 ;;
|
||||
-v|--verify) VERIFY=1 ;;
|
||||
-p|--prevent-downgrade) PREVENT_DOWNGRADE=1 ;;
|
||||
*) args+=("$1") ;;
|
||||
esac
|
||||
shift
|
||||
|
@@ -29,7 +29,9 @@ keepbuilddir=0
|
||||
update_first=0
|
||||
clean_first=0
|
||||
run_namcap=0
|
||||
run_checkpkg=0
|
||||
temp_chroot=0
|
||||
run_nocheck=0
|
||||
|
||||
bindmounts_ro=()
|
||||
bindmounts_rw=()
|
||||
@@ -73,6 +75,8 @@ usage() {
|
||||
echo ' Useful for maintaining multiple copies'
|
||||
echo " Default: $copy"
|
||||
echo '-n Run namcap on the package'
|
||||
echo '-C Run checkpkg on the package'
|
||||
echo '-N Disable check() function'
|
||||
echo '-T Build in a temporary directory'
|
||||
echo '-U Run makepkg as a specified user'
|
||||
exit 1
|
||||
@@ -80,37 +84,31 @@ usage() {
|
||||
|
||||
# {{{ functions
|
||||
|
||||
# Usage: sync_chroot $rootdir $copydir [$copy]
|
||||
# Usage: sync_chroot $chrootdir $copydir [$copy]
|
||||
sync_chroot() {
|
||||
local rootdir=$1
|
||||
local chrootdir=$1
|
||||
local copydir=$2
|
||||
local copy=${3:-$2}
|
||||
|
||||
if [[ "$rootdir" -ef "$copydir" ]]; then
|
||||
if [[ "$chrootdir/root" -ef "$copydir" ]]; then
|
||||
error 'Cannot sync copy with itself: %s' "$copydir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get a read lock on the root chroot to make
|
||||
# sure we don't clone a half-updated chroot
|
||||
slock 8 "$rootdir.lock" \
|
||||
"Locking clean chroot [%s]" "$rootdir"
|
||||
slock 8 "$chrootdir/root.lock" \
|
||||
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||
|
||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$rootdir" "$copy"
|
||||
if is_subvolume "$rootdir" && is_same_fs "$rootdir" "$(dirname -- "$copydir")" && ! mountpoint -q "$copydir"; then
|
||||
if is_subvolume "$copydir"; then
|
||||
subvolume_delete_recursive "$copydir" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
else
|
||||
# avoid change of filesystem in case of an umount failure
|
||||
rm --recursive --force --one-file-system "$copydir" ||
|
||||
die "Unable to delete %s" "$copydir"
|
||||
fi
|
||||
btrfs subvolume snapshot "$rootdir" "$copydir" >/dev/null ||
|
||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||
subvolume_delete_recursive "$copydir" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||
die "Unable to create subvolume %s" "$copydir"
|
||||
else
|
||||
mkdir -p "$copydir"
|
||||
rsync -a --delete -q -W -x "$rootdir/" "$copydir"
|
||||
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||
fi
|
||||
stat_done
|
||||
|
||||
@@ -249,9 +247,6 @@ download_sources() {
|
||||
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
||||
die "Could not download sources."
|
||||
|
||||
# Clean up garbage from verifysource
|
||||
# rm -rf "$builddir"
|
||||
}
|
||||
|
||||
move_products() {
|
||||
@@ -287,7 +282,7 @@ move_products() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='hcur:I:l:nTD:d:U:'
|
||||
opts='hcur:I:l:nNCTD:d:U:'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "$arg" in
|
||||
@@ -299,6 +294,8 @@ while getopts "${opts}" arg; do
|
||||
I) install_pkgs+=("$OPTARG") ;;
|
||||
l) copy="$OPTARG" ;;
|
||||
n) run_namcap=1; makepkg_args+=(--install) ;;
|
||||
N) run_nocheck=1; makepkg_args+=(--nocheck) ;;
|
||||
C) run_checkpkg=1 ;;
|
||||
T) temp_chroot=1; copy+="-$$" ;;
|
||||
U) makepkg_user="$OPTARG" ;;
|
||||
h|*) usage ;;
|
||||
@@ -352,7 +349,7 @@ load_vars /etc/makepkg.conf
|
||||
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||
|
||||
if [[ ! -d $copydir ]] || (( clean_first )); then
|
||||
sync_chroot "$chrootdir/root" "$copydir" "$copy"
|
||||
sync_chroot "$chrootdir" "$copydir" "$copy"
|
||||
fi
|
||||
|
||||
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
||||
@@ -385,6 +382,11 @@ if chroot-run \
|
||||
"$copydir" \
|
||||
/chrootbuild "${makepkg_args[@]}"
|
||||
then
|
||||
pkgnames=()
|
||||
for pkgfile in "$copydir"/pkgdest/*; do
|
||||
pkgfile=${pkgfile##*/};
|
||||
pkgnames+=("${pkgfile%-*-*-*}");
|
||||
done
|
||||
move_products
|
||||
else
|
||||
(( ret += 1 ))
|
||||
@@ -399,6 +401,15 @@ if (( ret != 0 )); then
|
||||
die "Build failed, check %s/build" "$copydir"
|
||||
fi
|
||||
else
|
||||
if (( run_checkpkg )); then
|
||||
msg "Running checkpkg"
|
||||
msg2 "Downloading current versions"
|
||||
if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then
|
||||
msg2 "Checking packages"
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||
else
|
||||
warning "Skipped checkpkg due to missing packages"
|
||||
fi
|
||||
fi
|
||||
true
|
||||
fi
|
||||
|
||||
|
@@ -193,6 +193,7 @@ configure_image(){
|
||||
configure_services "$fs"
|
||||
configure_calamares "$fs"
|
||||
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
||||
msg2 "Writing live.conf"
|
||||
write_live_session_conf > "$fs/etc/artools/live.conf"
|
||||
msg "Done configuring [%s]" "${fs##*/}"
|
||||
}
|
||||
|
@@ -69,7 +69,6 @@ load_profile(){
|
||||
}
|
||||
|
||||
write_live_session_conf(){
|
||||
msg2 "Writing live.conf"
|
||||
local conf=''
|
||||
conf+=$(printf '%s\n' '# live session configuration')
|
||||
conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}")
|
||||
|
Reference in New Issue
Block a user