diff options
author | Luke T. Shumaker <lukeshu@parabola.nu> | 2024-02-21 14:47:05 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@parabola.nu> | 2024-02-21 14:47:05 -0700 |
commit | 3604bbd006d42233ac52113dfff7ac78dba9469d (patch) | |
tree | cd7cc3b7fd4348c78fe093e8f3660c4650389e18 /src | |
parent | 75ada381c3b1554d3daf9d6031f40018b5068423 (diff) | |
parent | 15aae08d0f4e2858611fcf73c361cd8641f0b4d3 (diff) |
Merge branch 'lukeshu/fixes'v20240221
Diffstat (limited to 'src')
-rwxr-xr-x | src/abslibre-tools/libredbdiff | 1 | ||||
-rwxr-xr-x | src/abslibre-tools/librerelease | 5 | ||||
-rwxr-xr-x | src/abslibre-tools/librestage | 1 | ||||
-rw-r--r-- | src/chroot-tools/hooks-distcc.sh | 10 | ||||
-rwxr-xr-x | src/chroot-tools/librechroot | 1 | ||||
-rwxr-xr-x | src/chroot-tools/libremakepkg | 23 | ||||
-rwxr-xr-x | src/lib/blacklist.sh | 33 | ||||
-rw-r--r-- | src/lib/conf.sh.in | 1 | ||||
-rwxr-xr-x | src/lib/librelib | 3 | ||||
-rw-r--r-- | src/lib/librelib.1.ronn | 6 | ||||
-rwxr-xr-x | src/librefetch/librefetch | 26 | ||||
-rw-r--r-- | src/librefetch/librefetch.8.ronn | 3 | ||||
-rw-r--r-- | src/librefetch/librefetchdir/Makefile | 4 | ||||
-rwxr-xr-x | src/librefetch/librefetchdir/makepkg.gen | 12 | ||||
-rwxr-xr-x | src/pkgbuild-check-nonfree | 40 |
15 files changed, 105 insertions, 64 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index 28031a2..b5e6331 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -3,6 +3,7 @@ # # Copyright (C) 2014 Esteban Carnevale <alfplayer@mailoo.org> # Copyright (C) 2014, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2018 Omar Vega Ramos <ovruni@gnu.org.pe> # # License: GNU GPLv3+ # diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index 8ebdc54..a887ce4 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -5,7 +5,8 @@ # Copyright (C) 2010-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com> # Copyright (C) 2010-2013 Nicolás Reynolds <fauno@parabola.nu> # Copyright (C) 2013 Michał Masłowski <mtjm@mtjm.eu> -# Copyright (C) 2013-2014, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2013-2014, 2017-2018, 2024 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2019 Bill Auger <mr.j.spam.me@gmail.com> # # For just the create_signature() function: # Copyright (C) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org> @@ -300,7 +301,7 @@ release_packages() { local packages=${file_list} # TODO: parse package names? - this is gonna be messy local login=${REPODEST_userinfo:-somebody} ; login=${login%%:*} ; ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" \ - "which pbot-say && pbot-say ${login} just published: ${packages}" + "if type pbot-say &>/dev/null-say; then pbot-say ${login} just published: ${packages}; fi" return $EXIT_SUCCESS } diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index c68b61b..7098aac 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -5,6 +5,7 @@ # Copyright (C) 2010-2012 Nicolás Reynolds <fauno@parabola.nu> # Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com> # Copyright (C) 2013-2014, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2020 Andreas Grapentin <andreas@grapentin.org> # # License: GNU GPLv3+ # diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh index b19c223..414696e 100644 --- a/src/chroot-tools/hooks-distcc.sh +++ b/src/chroot-tools/hooks-distcc.sh @@ -1,5 +1,5 @@ #!/hint/bash -euE -o pipefail -# Copyright (C) 2013, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2013, 2017-2018, 2024 Luke Shumaker <lukeshu@parabola.nu> # # License: GNU GPLv2+ # @@ -75,9 +75,11 @@ distcc_start_odaemon() { rewritten_DISTCC_HOSTS=$("$_distcc_tool" rewrite "${DISTCC_HOSTS:-}") install -Dm644 /dev/stdin "$home/.config/pacman/makepkg.conf" <<-eot - trap 'jobs -p | xargs -r kill --' EXIT - /bin/distcc-tool idaemon ${DISTCC_HOSTS@Q} </dev/null &>/dev/null & - DISTCC_HOSTS=${rewritten_DISTCC_HOSTS@Q} + if [[ \${INFAKEROOT:-} == 0 ]]; then + trap 'jobs -p | xargs -r kill --' EXIT + /bin/distcc-tool idaemon ${DISTCC_HOSTS@Q} </dev/null &>/dev/null & + DISTCC_HOSTS=${rewritten_DISTCC_HOSTS@Q} + fi eot install -Dm644 /dev/stdin "$home/.ssh/config" <<-'eot' diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 1c76661..e3c390a 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -7,6 +7,7 @@ set -euE # Copyright (C) 2012 Michał Masłowski <mtjm@mtjm.eu> # Copyright (C) 2012-2018 Luke Shumaker <lukeshu@parabola.nu> # Copyright (C) 2018 Andreas Grapentin <andreas@grapentin.org> +# Copyright (C) 2019 Bill Auger <mr.j.spam.me@gmail.com> # # License: GNU GPLv2+ # diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index a526ca2..d3dd160 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -5,7 +5,8 @@ set -euE # Copyright (C) 2010-2012 Nicolás Reynolds <fauno@parabola.nu> # Copyright (C) 2010-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com> # Copyright (C) 2012 Michał Masłowski <mtjm@mtjm.eu> -# Copyright (C) 2012-2015, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2012-2015, 2017-2018, 2024 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2019, 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> # # License: GNU GPLv2+ # @@ -36,6 +37,7 @@ umask 0022 readonly _indent="$(librelib chroot/indent)" readonly INCHROOT=$([[ -f /.arch-chroot ]] && echo true || echo false) NONET=true # can be changed with the -N flag +ROSTARTDIR=true # can be changed with the -W flag # {PKG,SRC,SRCPKG,LOG}DEST set at runtime by makepkg.conf # MAKEFLAGS, PACKAGER set at runtime by makepkg.conf # LIBREUSER, LIBREHOME are set by conf.sh @@ -124,11 +126,19 @@ build() ( local run_ynet=() local run_nnet=() if $INCHROOT; then - local _run=(sh -c "cd ${startdir@Q} && \$@" --) + if $ROSTARTDIR; then + local _run=(sh -c "mount --bind -o ro -- ${startdir@Q} ${startdir@Q} && cd ${startdir@Q} && \$@" --) + else + local _run=(sh -c "cd ${startdir@Q} && \$@" --) + fi run_ynet=(unshare --mount -- "${_run[@]}") run_nnet=(unshare --mount --net -- "${_run[@]}") else - librechroot_flags+=(-w "$startdir:/startdir") + if $ROSTARTDIR; then + librechroot_flags+=(-r "$startdir:/startdir") + else + librechroot_flags+=(-w "$startdir:/startdir") + fi run_ynet=(librechroot "${librechroot_flags[@]}" run) run_nnet=(librechroot "${librechroot_flags[@]}" -N run) fi @@ -181,6 +191,10 @@ usage() { build(), and package(). PLEASE don't use this unless you have a special reason, its use is a violation of Parabola policy." \ + '-W' "Don't make the startdir read-only. PLEASE + don't use this unless you have a special + reason, its use is a violation of Parabola + policy." \ '-R' 'Repackage contents of the package without rebuilding' \ "-S <$(_ SRCPKGFILE)>" 'Use an existing --allsource source-package' \ @@ -203,7 +217,7 @@ main() { local srcpkg='' # Parse command line options ########################################### - while getopts 'n:l:w:r:NRS:h' flag ; do + while getopts 'n:l:w:r:NWRS:h' flag ; do case "${flag}" in n) if $INCHROOT; then err_chflag "$flag"; else chroot=$OPTARG; fi;; @@ -212,6 +226,7 @@ main() { w|r) if $INCHROOT; then err_chflag "$flag"; else librechroot_flags+=(-$flag "$OPTARG"); fi;; N) NONET=false;; + W) ROSTARTDIR=false;; R) repack=true; makepkg_args+=(-R);; S) srcpkg=$OPTARG;; h) usage; exit $EXIT_SUCCESS;; diff --git a/src/lib/blacklist.sh b/src/lib/blacklist.sh index 84333e8..d36502e 100755 --- a/src/lib/blacklist.sh +++ b/src/lib/blacklist.sh @@ -99,24 +99,21 @@ blacklist-get-pkg() { # Usage: blacklist-cat | blacklist-get-rep # Prints only the replacement package field of the blacklist line(s) on stdin. blacklist-get-rep() { - local -a targets=($(blacklist-get-pkg)) - expac -Ss '%r/%n %n %P %R' | awk -v arr="${targets[*]}" ' - { - gsub("[=<>]+[^[:blank:]]*", "", $0) # discard versioning - # build pkg -> providers table from pkg -> provides - for (provided = 2; provided <= NF; ++provided) { - if (! seen[$1 " " $provided]++) { - providers[$provided] = providers[$provided] $1 " " - } - } - } - END { - split(arr, targets, " ") - for (pkg in targets) { - sub("[ \t]+$", "", providers[targets[pkg]]) - print providers[targets[pkg]] - } - }' + # TODO(lukeshu): I am confident that this could be done more + # efficiently with Python+pyalpm than with awk+expac. + blacklist-normalize | awk -F: ' + # trust blacklist.txt for packages re-packaged with the same name + # (otherwise there would be a bootstrapping problem). + $2 == $1 { + print $2 + } + # but otherwise, do not trust blacklist.txt to have an accurate + # state of the repos and what replacements exist. + $2 != $1 { + cmd="expac -S '\''%r/%n %P : %R '\'' | sed -E '\''s/[=<>]+\\S*//g'\'' | grep '\'' " $1 " .*:.* " $1 " '\'' | awk '\''{print $1}'\''" + cmd | getline rep + print rep + }' } # Usage: blacklist-cat | blacklist-get-url diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in index c7d3f53..bd9bde3 100644 --- a/src/lib/conf.sh.in +++ b/src/lib/conf.sh.in @@ -2,6 +2,7 @@ # This may be included with or without `set -euE` # Copyright (C) 2012-2015, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> # # License: GNU GPLv2+ # diff --git a/src/lib/librelib b/src/lib/librelib index b3fb9c2..27649f8 100755 --- a/src/lib/librelib +++ b/src/lib/librelib @@ -1,6 +1,7 @@ #!/usr/bin/env bash # Copyright (C) 2013-2014, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> -# +# Copyright (C) 2020 Andreas Grapentin <andreas@grapentin.org> + # License: GNU GPLv2+ # # This program is free software; you can redistribute it and/or modify diff --git a/src/lib/librelib.1.ronn b/src/lib/librelib.1.ronn index fe64e92..9d1fbc4 100644 --- a/src/lib/librelib.1.ronn +++ b/src/lib/librelib.1.ronn @@ -19,13 +19,13 @@ path: * The install path can change in the future without having to change programs that use them. * The install directory can be configured at runtime, by setting - `LIBRETOOLS_LIBDIR`, similar to `LD_PRELOAD` (this is used when - running the test suite). + `LIBRETOOLS_LIBRARY_PATH`, similar to `LD_PRELOAD` (this is used + when running the test suite). * The naming scheme of a library can change (such as between `libreNAME` and `NAME.sh` without changing programs that use it. By default, `librelib` looks in `/usr/lib/libretools`, but that can be -changed by setting the `LIBRETOOLS_LIBDIR` environmental variable to +changed by setting the `LIBRETOOLS_LIBRARY_PATH` environmental variable to the directory it should look in. When searching for a library, `librelib` first strips `libre` from the diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index c1ff548..9b04837 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -1,7 +1,8 @@ #!/usr/bin/env bash # librefetch # -# Copyright (C) 2013-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2013-2018, 2024 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2020 Bill Auger <mr.j.spam.me@gmail.com> # # For just the create_signature() function: # Copyright (C) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org> @@ -221,6 +222,7 @@ doit() { mv -f "$base_dst" "$dst" fi else + export PKGEXT=${base_dst##*/} # so the file uses the correct compression export PKGDEST=${dst%/*} export pkg_file=$dst @@ -321,23 +323,23 @@ modified_makepkg() { # a string to be appended pkgbuild_append=' +declare _librefetch_i + # do not do split packages -if [[ ${#pkgname[@]} -gt 1 ]]; then - if [[ -n $pkgbase ]]; then - pkgname=("$pkgbase") - else - pkgname=("$pkgname") - fi -fi +declare _librefetch_pkgname="${pkgbase:-$pkgname}" +for _librefetch_i in "${pkgname[@]}"; do + unset -f "package_${_librefetch_i}" +done +unset pkgname +pkgname=$_librefetch_pkgname # copy source variables source=("${mksource[@]}") ; unset "source_${CARCH}" noextract=("${mknoextract[@]}") -declare algo -for algo in "${known_hash_algos[@]}"; do - eval "${algo}sums=(\"\${mk${algo}sums[@]}\")" - unset "${algo}sums_${CARCH}" +for _librefetch_i in "${known_hash_algos[@]}"; do + eval "${_librefetch_i}sums=(\"\${mk${_librefetch_i}sums[@]}\")" + unset "${_librefetch_i}sums_${CARCH}" done depends=() ; unset "depends_${CARCH}" diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 27dfac0..63dfae9 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -179,7 +179,8 @@ Other changes: The following modifications are made to makepkg: * Allow us to manipulate the output file (<$pkg_file>) - * Do not include metadata in the output file (<${comp_files[@]}>) + * Do not include metadata in the output file (`.PKGINFO`, + `.BUILDINFO`, and `.MTREE`) * Force 'ustar' tar format, don't allow it to upgrade to 'pax' to store extended file attributes. * Don't symlink the resulting file into the current directory. diff --git a/src/librefetch/librefetchdir/Makefile b/src/librefetch/librefetchdir/Makefile index 4391efb..ed7b510 100644 --- a/src/librefetch/librefetchdir/Makefile +++ b/src/librefetch/librefetchdir/Makefile @@ -2,7 +2,7 @@ # note: This file is part of LibreFetch itself, not part of the # build-system. # -# Copyright (C) 2016 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2016, 2024 Luke Shumaker <lukeshu@parabola.nu> # # License: GNU GPLv3+ # @@ -31,7 +31,7 @@ new_makepkg = $(new)/makepkg new_library = $(new)/libmakepkg targets += $(new_makepkg) -targets += $(patsubst $(old_library)/%,$(new_library)/%,$(shell find $(old_library) -type f)) +targets += $(patsubst $(old_library)/%,$(new_library)/%,$(shell find $(old_library) -type f -not -name ext.sh)) targets += $(new_library)/tidy/~source_date_epoch.sh all: $(targets) diff --git a/src/librefetch/librefetchdir/makepkg.gen b/src/librefetch/librefetchdir/makepkg.gen index dfe68f5..31cdfe6 100755 --- a/src/librefetch/librefetchdir/makepkg.gen +++ b/src/librefetch/librefetchdir/makepkg.gen @@ -1,7 +1,7 @@ #!/usr/bin/sed -rf # librefetchdir/makepkg.gen # -# Copyright (C) 2013-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2013-2018, 2024 Luke Shumaker <lukeshu@parabola.nu> # # License: GNU GPLv3+ # @@ -22,12 +22,12 @@ /LIBRARY=/iexport LIBRARY="${0%/*}/libmakepkg" -/list_package_files\(\) \{/,/^\}$/ { - # Don't include dotfiles - s,\(.*; (.* \| LC_ALL=C sort)\),\1, -} - /create_package\(\) \{/,/^\}$/ { + # Don't generate metadata files + /PKGINFO/d + /BUILDINFO/d + /msg2.*MTREE/,/touch.*MTREE/d + # allow us to set pkg_file /pkg_file=/d } diff --git a/src/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree index ccc846b..6bec280 100755 --- a/src/pkgbuild-check-nonfree +++ b/src/pkgbuild-check-nonfree @@ -5,7 +5,7 @@ # Copyright (C) 2011 Joseph Graham (Xylon) <joe@t67.eu> # Copyright (C) 2010-2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com> # Copyright (C) 2010-2012 Nicolás Reynolds <fauno@parabola.nu> -# Copyright (C) 2012-2013, 2017 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2012-2013, 2017, 2024 Luke Shumaker <lukeshu@parabola.nu> # # License: GNU GPLv3+ # @@ -57,7 +57,11 @@ usage() { echo flag '-h' 'Show this message' } -# Make sure these match pkgbuild-summarize-nonfree + +# Make sure these match: +# - the usage() text above +# - pkgbuild-summarize-nonfree +# - pkgbuild-check-nonfree.bats declare -ri _E_OK=0 declare -ri _E_ERROR=1 declare -ri _E_LIC_UNKNOWN=2 @@ -217,15 +221,29 @@ check_dep() { # Checks for ${pkgname} in the blacklist check_pkg() { [[ $# == 1 ]] || panic 'malformed call to check_pkg' - check_dep "$@" - case $? in - $_E_OK) - return $_E_OK;; - $_E_DEP_NONFREE) - return $_E_PKG_NONFREE;; - *) - panic 'unexpected return code from check_dep';; - esac + local pkg=$1 + + local line rep + line="$(blacklist-cat|blacklist-lookup "$pkg")" + rep="$(blacklist-get-rep <<<"$line")" + if [[ -z $line ]]; then + # not mentioned in blacklist; free + info '%s: not blacklisted' "$pkg" + return $_E_OK + elif [[ -z $rep ]]; then + # non-free with no replacement + plain '%s: blacklisted' "$pkg" + return $_E_PKG_NONFREE + else + # non-free with free replacement + if [[ "$rep" == "$pkg" ]]; then + info '%s: repackaged with the same name' "$pkg" + return $_E_OK + else + info '%s: replaced by %s (update blacklist.txt first if you would like to repackage it with the same name)' "$pkg" "$rep" + return $_E_PKG_NONFREE + fi + fi panic 'code should never be reached' } |