forked from mirrors/pacman
Compare commits
14 Commits
andrew/pfo
...
allan/pkgd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1c7341a81 | ||
|
|
2c45e854ab | ||
|
|
a81ec016d7 | ||
|
|
55da1a01b6 | ||
|
|
5e94752434 | ||
|
|
262aa6c24e | ||
|
|
3323662ee0 | ||
|
|
6c913af95d | ||
|
|
71764b6d4c | ||
|
|
e0bbfb5682 | ||
|
|
09e82f01ea | ||
|
|
d35728f924 | ||
|
|
3f8029af92 | ||
|
|
6344aab3bd |
@@ -46,14 +46,14 @@ arch-clang:
|
|||||||
- ninja -C build
|
- ninja -C build
|
||||||
- fakechroot meson test -C build
|
- fakechroot meson test -C build
|
||||||
|
|
||||||
arch-valgrind:
|
#arch-valgrind:
|
||||||
extends: .arch-test
|
# extends: .arch-test
|
||||||
script:
|
# script:
|
||||||
- pacman -Syu --needed --noconfirm valgrind
|
# - pacman -Syu --needed --noconfirm valgrind
|
||||||
- pacman -U --noconfirm https://geo.mirror.pkgbuild.com/core-debug/os/x86_64/glibc-debug-$(pacman -S --print-format %v glibc)-x86_64.pkg.tar.zst
|
# - pacman -U --noconfirm https://geo.mirror.pkgbuild.com/core-debug/os/x86_64/glibc-debug-$(pacman -S --print-format %v glibc)-x86_64.pkg.tar.zst
|
||||||
- meson setup build
|
# - meson setup build
|
||||||
- ninja -C build
|
# - ninja -C build
|
||||||
- PACTEST_VALGRIND=1 fakechroot meson test -C build
|
# - PACTEST_VALGRIND=1 fakechroot meson test -C build
|
||||||
|
|
||||||
arch-nettle:
|
arch-nettle:
|
||||||
extends: .arch-test
|
extends: .arch-test
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ Options
|
|||||||
flags specified in LTOFLAGS to CFLAGS, CXXFLAGS and LDFLAGS (or
|
flags specified in LTOFLAGS to CFLAGS, CXXFLAGS and LDFLAGS (or
|
||||||
``-flto'' if LTOFLAGS is empty).
|
``-flto'' if LTOFLAGS is empty).
|
||||||
|
|
||||||
*autodep*;;
|
*autodeps*;;
|
||||||
Enable the automatic addition of libraries to the depends and
|
Enable the automatic addition of libraries to the depends and
|
||||||
provides arrays. Search library directories are controlled by
|
provides arrays. Search library directories are controlled by
|
||||||
the LIB_DIRS variable defined below.
|
the LIB_DIRS variable defined below.
|
||||||
@@ -236,7 +236,7 @@ Options
|
|||||||
|
|
||||||
**LIB_DIRS=(**lib:usr/lib ...**)**::
|
**LIB_DIRS=(**lib:usr/lib ...**)**::
|
||||||
If `autodeps` is specified in the `OPTIONS` array, this variable will
|
If `autodeps` is specified in the `OPTIONS` array, this variable will
|
||||||
instruct makepkg where to look to find librarys to add to the `provides`
|
instruct makepkg where to look to find libraries to add to the `provides`
|
||||||
array. The format is "prefix:path", where provides will be added for
|
array. The format is "prefix:path", where provides will be added for
|
||||||
libraries found in "path" with the specified prefix added.
|
libraries found in "path" with the specified prefix added.
|
||||||
|
|
||||||
|
|||||||
11
etc/makepkg.conf.d/rust.conf.in
Normal file
11
etc/makepkg.conf.d/rust.conf.in
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/hint/bash
|
||||||
|
#
|
||||||
|
# @sysconfdir@/makepkg.conf.d/rust.conf
|
||||||
|
#
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# RUST LANGUAGE SUPPORT
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
#RUSTFLAGS="-C opt-level=2"
|
||||||
|
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
||||||
@@ -42,13 +42,11 @@ CHOST="@CHOST@"
|
|||||||
#CXXFLAGS="-O2 -pipe"
|
#CXXFLAGS="-O2 -pipe"
|
||||||
#LDFLAGS=""
|
#LDFLAGS=""
|
||||||
#LTOFLAGS="-flto"
|
#LTOFLAGS="-flto"
|
||||||
#RUSTFLAGS="-C opt-level=2"
|
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
#-- Debugging flags
|
#-- Debugging flags
|
||||||
#DEBUG_CFLAGS="-g"
|
#DEBUG_CFLAGS="-g"
|
||||||
#DEBUG_CXXFLAGS="-g"
|
#DEBUG_CXXFLAGS="-g"
|
||||||
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# BUILD ENVIRONMENT
|
# BUILD ENVIRONMENT
|
||||||
@@ -111,7 +109,7 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
|||||||
#-- Directory to store source code in for debug packages
|
#-- Directory to store source code in for debug packages
|
||||||
DBGSRCDIR="/usr/src/debug"
|
DBGSRCDIR="/usr/src/debug"
|
||||||
#-- Prefix and directories for library autodeps
|
#-- Prefix and directories for library autodeps
|
||||||
LIB_DIRS=('lib:/usr/lib' 'lib32:/usr/lib32')
|
LIB_DIRS=('lib:usr/lib' 'lib32:usr/lib32')
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# PACKAGE OUTPUT
|
# PACKAGE OUTPUT
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ endif
|
|||||||
|
|
||||||
if get_option('debug')
|
if get_option('debug')
|
||||||
extra_cflags = [
|
extra_cflags = [
|
||||||
|
'-pedantic',
|
||||||
'-Wcast-align',
|
'-Wcast-align',
|
||||||
'-Wclobbered',
|
'-Wclobbered',
|
||||||
'-Wempty-body',
|
'-Wempty-body',
|
||||||
@@ -401,6 +402,12 @@ configure_file(
|
|||||||
configuration : substs,
|
configuration : substs,
|
||||||
install_dir : SYSCONFDIR)
|
install_dir : SYSCONFDIR)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input : 'etc/makepkg.conf.d/rust.conf.in',
|
||||||
|
output : 'rust.conf',
|
||||||
|
configuration : substs,
|
||||||
|
install_dir : join_paths(SYSCONFDIR, 'makepkg.conf.d/'))
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input : 'etc/pacman.conf.in',
|
input : 'etc/pacman.conf.in',
|
||||||
output : 'pacman.conf',
|
output : 'pacman.conf',
|
||||||
|
|||||||
@@ -586,38 +586,38 @@ _pacman_conf() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_key_shortopts=(
|
_pacman_key_shortopts=(
|
||||||
'-h[show help]'
|
'-h[show help]'
|
||||||
'-a[Add the specified keys (empty for stdin)]: :_files'
|
'-a[Add the specified keys (empty for stdin)]: :_files'
|
||||||
'-d[Remove the Specified keyids]:*: :_keys'
|
'-d[Remove the Specified keyids]:*: :_pacman_key_list'
|
||||||
'-e[Export the specified or all keyids]:*: :_keys'
|
'-e[Export the specified or all keyids]:*: :_pacman_key_list'
|
||||||
'-f[List fingerprint for specified or all keyids]:*: :_keys'
|
'-f[List fingerprint for specified or all keyids]:*: :_pacman_key_list'
|
||||||
'-l[List the specified or all keys]:*: :_keys'
|
'-l[List the specified or all keys]:*: :_pacman_key_list'
|
||||||
'-r[Fetch the specified keyids]:*: :_keys'
|
'-r[Fetch the specified keyids]:*: :_pacman_key_list'
|
||||||
'-u[Update the trustdb of pacman]'
|
'-u[Update the trustdb of pacman]'
|
||||||
'-v[Verify the file specified by the signature]: :_files -g "*.sig"'
|
'-v[Verify the file specified by the signature]: :_files -g "*.sig"'
|
||||||
'-V[Show program version]'
|
'-V[Show program version]'
|
||||||
)
|
)
|
||||||
|
|
||||||
_key_longopts=(
|
_pacman_key_longopts=(
|
||||||
'--help[show help]'
|
'--help[show help]'
|
||||||
'--add[Add the specified keys (empty for stdin)]: :_files'
|
'--add[Add the specified keys (empty for stdin)]: :_files'
|
||||||
'--delete[Remove the Specified keyids]:*: :_keys'
|
'--delete[Remove the Specified keyids]:*: :_pacman_key_list'
|
||||||
'--export[Export the specified or all keyids]:*: :_keys'
|
'--export[Export the specified or all keyids]:*: :_pacman_key_list'
|
||||||
'--finger[List fingerprint for specified or all keyids]:*: :_keys'
|
'--finger[List fingerprint for specified or all keyids]:*: :_pacman_key_list'
|
||||||
'--list-keys[List the specified or all keys]:*: :_keys'
|
'--list-keys[List the specified or all keys]:*: :_pacman_key_list'
|
||||||
'--recv-keys[Fetch the specified keyids]:*: :_keys'
|
'--recv-keys[Fetch the specified keyids]:*: :_pacman_key_list'
|
||||||
'--updatedb[Update the trustdb of pacman]'
|
'--updatedb[Update the trustdb of pacman]'
|
||||||
'--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
|
'--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
|
||||||
'--version[Show program version]'
|
'--version[Show program version]'
|
||||||
'--edit-key[Present a menu for key management task on keyids]:*: :_keys'
|
'--edit-key[Present a menu for key management task on keyids]:*: :_pacman_key_list'
|
||||||
'--import[Imports pubring.gpg from dir(s)]: :_files -g "*.gpg"'
|
'--import[Imports pubring.gpg from dir(s)]: :_files -g "*.gpg"'
|
||||||
'--import-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
|
'--import-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
|
||||||
'--init[Ensure the keyring is properly initialized]'
|
'--init[Ensure the keyring is properly initialized]'
|
||||||
'--list-sigs[List keys and their signatures]:*: :_keys'
|
'--list-sigs[List keys and their signatures]:*: :_pacman_key_list'
|
||||||
'--lsign-key[Locally sign the specified keyid]:*: :_keys'
|
'--lsign-key[Locally sign the specified keyid]:*: :_pacman_key_list'
|
||||||
'--populate[Reload the default keys from the (given) keyrings in '@keyringdir@']: :_path_files -W @keyringdir@'
|
'--populate[Reload the default keys from the (given) keyrings in '@keyringdir@']: :_path_files -W @keyringdir@'
|
||||||
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
|
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_pacman_key_list'
|
||||||
)
|
)
|
||||||
|
|
||||||
_pacman_key_options=(
|
_pacman_key_options=(
|
||||||
@@ -631,13 +631,13 @@ _pacman_key() {
|
|||||||
--*)
|
--*)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_key_options[@]" \
|
"$_pacman_key_options[@]" \
|
||||||
"$_key_longopts[@]"
|
"$_pacman_key_longopts[@]"
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_key_options[@]" \
|
"$_pacman_key_options[@]" \
|
||||||
"$_key_shortopts[@]" \
|
"$_pacman_key_shortopts[@]" \
|
||||||
"$_key_longopts[@]"
|
"$_pacman_key_longopts[@]"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
i=$#
|
i=$#
|
||||||
@@ -648,13 +648,13 @@ _pacman_key() {
|
|||||||
--*)
|
--*)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_key_options[@]" \
|
"$_pacman_key_options[@]" \
|
||||||
"$_key_longopts[@]"
|
"$_pacman_key_longopts[@]"
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
"$_pacman_key_options[@]" \
|
"$_pacman_key_options[@]" \
|
||||||
"$_key_shortopts[@]" \
|
"$_pacman_key_shortopts[@]" \
|
||||||
"$_key_longopts[@]"
|
"$_pacman_key_longopts[@]"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
@@ -664,7 +664,7 @@ _pacman_key() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_keys() {
|
_pacman_key_list() {
|
||||||
local keylist keys
|
local keylist keys
|
||||||
keylist=$(pacman-key --list-keys 2>/dev/null | awk '
|
keylist=$(pacman-key --list-keys 2>/dev/null | awk '
|
||||||
$1 == "pub" {
|
$1 == "pub" {
|
||||||
@@ -733,7 +733,7 @@ _makepkg_longopts=(
|
|||||||
'--check[Run check() function in the PKGBUILD]'
|
'--check[Run check() function in the PKGBUILD]'
|
||||||
'--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
|
'--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
|
||||||
'--holdver[Do not update VCS sources]'
|
'--holdver[Do not update VCS sources]'
|
||||||
'--key[Specify key to use for gpg signing instead of the default]: :_keys'
|
'--key[Specify key to use for gpg signing instead of the default]: :_pacman_key_list'
|
||||||
'--noarchive[Do not create package archive]'
|
'--noarchive[Do not create package archive]'
|
||||||
'--nocheck[Do not run the check() function in the PKGBUILD]'
|
'--nocheck[Do not run the check() function in the PKGBUILD]'
|
||||||
'--noprepare[Do not run the prepare() function in the PKGBUILD]'
|
'--noprepare[Do not run the prepare() function in the PKGBUILD]'
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ library_provides() {
|
|||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mapfile -t filenames < <(find "$pkgdir/$dir" -type f | LC_ALL=C sort)
|
mapfile -t filenames < <(find "$pkgdir/$dir" -maxdepth 1 -type f | LC_ALL=C sort)
|
||||||
|
|
||||||
for fn in "${filenames[@]}"; do
|
for fn in "${filenames[@]}"; do
|
||||||
# check we have a shared library
|
# check we have a shared library
|
||||||
@@ -44,7 +44,7 @@ library_provides() {
|
|||||||
local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
||||||
|
|
||||||
if [[ -z "$sofile" ]]; then
|
if [[ -z "$sofile" ]]; then
|
||||||
# the library is not versioned
|
# the library has no soname
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -25,18 +25,22 @@ LIBMAKEPKG_BUILDENV_SH=1
|
|||||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
declare -a buildenv_functions build_options
|
declare -a buildenv_functions build_options
|
||||||
|
buildenv_vars=('CPPFLAGS' 'CFLAGS' 'CXXFLAGS' 'LDFLAGS' 'MAKEFLAGS' 'CHOST')
|
||||||
|
|
||||||
for lib in "$LIBRARY/buildenv/"*.sh; do
|
for lib in "$LIBRARY/buildenv/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
readonly -a buildenv_functions build_options
|
readonly -a buildenv_functions buildenv_vars build_options
|
||||||
|
|
||||||
prepare_buildenv() {
|
prepare_buildenv() {
|
||||||
|
# ensure this function runs first
|
||||||
|
buildenv_buildflags
|
||||||
|
|
||||||
for func in ${buildenv_functions[@]}; do
|
for func in ${buildenv_functions[@]}; do
|
||||||
$func
|
$func
|
||||||
done
|
done
|
||||||
|
|
||||||
# ensure all necessary build variables are exported
|
# ensure all necessary build variables are exported
|
||||||
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST
|
export ${buildenv_vars[@]}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,9 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
|||||||
source "$LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
build_options+=('buildflags')
|
build_options+=('buildflags')
|
||||||
buildenv_functions+=('buildenv_buildflags')
|
|
||||||
|
|
||||||
buildenv_buildflags() {
|
buildenv_buildflags() {
|
||||||
if check_option "buildflags" "n"; then
|
if check_option "buildflags" "n"; then
|
||||||
unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS LTOFLAGS RUSTFLAGS DEBUG_RUSTFLAGS
|
unset ${buildenv_vars[@]}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ buildenv_debugflags() {
|
|||||||
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||||
DEBUG_CFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
DEBUG_CFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
DEBUG_CXXFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
DEBUG_CXXFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
|
||||||
CFLAGS+=" $DEBUG_CFLAGS"
|
CFLAGS+=" $DEBUG_CFLAGS"
|
||||||
CXXFLAGS+=" $DEBUG_CXXFLAGS"
|
CXXFLAGS+=" $DEBUG_CXXFLAGS"
|
||||||
RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ sources = [
|
|||||||
'debugflags.sh.in',
|
'debugflags.sh.in',
|
||||||
'lto.sh.in',
|
'lto.sh.in',
|
||||||
'makeflags.sh.in',
|
'makeflags.sh.in',
|
||||||
|
'rust.sh.in',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach src : sources
|
foreach src : sources
|
||||||
|
|||||||
36
scripts/libmakepkg/buildenv/rust.sh.in
Normal file
36
scripts/libmakepkg/buildenv/rust.sh.in
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
#
|
||||||
|
# rust.sh - Specify flags for building a package with rust
|
||||||
|
#
|
||||||
|
# Copyright (c) 2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
[[ -n "$LIBMAKEPKG_BUILDENV_RUST_SH" ]] && return
|
||||||
|
LIBMAKEPKG_BUILDENV_RUST_SH=1
|
||||||
|
|
||||||
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
|
buildenv_var+=('RUSTFLAGS' 'DEBUG_RUSTFLAGS')
|
||||||
|
buildenv_functions+=('buildenv_rust')
|
||||||
|
|
||||||
|
buildenv_rust() {
|
||||||
|
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||||
|
DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
|
RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -32,10 +32,10 @@ lint_config_variables() {
|
|||||||
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
||||||
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
||||||
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
||||||
local string=(CARCH CHOST CPPFLAGS CFLAGS CXXFLAGS RUSTFLAGS LDFLAGS LTOFLAGS
|
local string=(CARCH CHOST CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LTOFLAGS DEBUG_CFLAGS
|
||||||
DEBUG_CFLAGS DEBUG_CXXFLAGS DEBUG_RUSTFLAGS DISTCC_HOSTS BUILDDIR
|
DEBUG_CXXFLAGS DISTCC_HOSTS BUILDDIR STRIP_BINARIES STRIP_SHARED
|
||||||
STRIP_BINARIES STRIP_SHARED STRIP_STATIC PKGDEST SRCDEST SRCPKGDEST
|
STRIP_STATIC PKGDEST SRCDEST SRCPKGDEST LOGDEST PACKAGER GPGKEY
|
||||||
LOGDEST PACKAGER GPGKEY PKGEXT SRCEXT)
|
PKGEXT SRCEXT)
|
||||||
|
|
||||||
local i keys ret=0
|
local i keys ret=0
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ source_makepkg_config() {
|
|||||||
# Source the config file; fail if it is not found
|
# Source the config file; fail if it is not found
|
||||||
if [[ -r $MAKEPKG_CONF ]]; then
|
if [[ -r $MAKEPKG_CONF ]]; then
|
||||||
source_safe "$MAKEPKG_CONF"
|
source_safe "$MAKEPKG_CONF"
|
||||||
|
if [[ -d "$MAKEPKG_CONF.d" ]]; then
|
||||||
|
for c in "$MAKEPKG_CONF.d"/*.conf; do
|
||||||
|
source_safe $c
|
||||||
|
done
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
|
error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
|
||||||
plainerr "$(gettext "Aborting...")"
|
plainerr "$(gettext "Aborting...")"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ wrapped_scripts = [
|
|||||||
'makepkg.sh.in',
|
'makepkg.sh.in',
|
||||||
'pacman-db-upgrade.sh.in',
|
'pacman-db-upgrade.sh.in',
|
||||||
'pacman-key.sh.in',
|
'pacman-key.sh.in',
|
||||||
|
'pkgdiff.sh.in',
|
||||||
'repo-add.sh.in'
|
'repo-add.sh.in'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ populate_keyring() {
|
|||||||
key_count=$((key_count+1))
|
key_count=$((key_count+1))
|
||||||
done
|
done
|
||||||
if (( key_count )); then
|
if (( key_count )); then
|
||||||
msg2 "$(gettext "Disabled %s keys.")" "${key_count}"
|
msg2 "$(ngettext "Disabled %s key." "Disabled %s keys." "${key_count}")" "${key_count}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -506,7 +506,7 @@ lsign_keys() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if (( key_count )); then
|
if (( key_count )); then
|
||||||
msg2 "$(gettext "Locally signed %s keys.")" "${key_count}"
|
msg2 "$(ngettext "Locally signed %s key." "Locally signed %s keys." "${key_count}")" "${key_count}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,6 +612,16 @@ if ! type gettext &>/dev/null; then
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! type ngettext &>/dev/null; then
|
||||||
|
ngettext() {
|
||||||
|
if (( $3 == 1 )); then
|
||||||
|
echo "$1"
|
||||||
|
else
|
||||||
|
echo "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
OPT_SHORT="adefhlruvV"
|
OPT_SHORT="adefhlruvV"
|
||||||
OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
|
OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
|
||||||
'help' 'import' 'import-trustdb' 'init' 'keyserver:' 'list-keys' 'list-sigs'
|
'help' 'import' 'import-trustdb' 'init' 'keyserver:' 'list-keys' 'list-sigs'
|
||||||
|
|||||||
301
scripts/pkgdiff.sh.in
Executable file
301
scripts/pkgdiff.sh.in
Executable file
@@ -0,0 +1,301 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# pkgdiff - package differencing utility
|
||||||
|
#
|
||||||
|
# Copyright (c) 2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# gettext initialization
|
||||||
|
export TEXTDOMAIN='pacman-scripts'
|
||||||
|
export TEXTDOMAINDIR='@localedir@'
|
||||||
|
|
||||||
|
declare -r myver='@PACKAGE_VERSION@'
|
||||||
|
declare -r confdir='@sysconfdir@'
|
||||||
|
|
||||||
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
|
QUIET=0
|
||||||
|
USE_COLOR='y'
|
||||||
|
|
||||||
|
source "$LIBRARY"/util/compress.sh
|
||||||
|
source "$LIBRARY"/util/message.sh
|
||||||
|
source "$LIBRARY"/util/parseopts.sh
|
||||||
|
|
||||||
|
# minimal of package before a pkgdiff is generated (bytes)
|
||||||
|
min_pkg_size=$((1024*1024))
|
||||||
|
|
||||||
|
# percent of new package above which the pkgdiff will be discarded
|
||||||
|
max_diff_size=70
|
||||||
|
|
||||||
|
# ensure we have a sane umask set
|
||||||
|
umask 0022
|
||||||
|
|
||||||
|
# print usage instructions
|
||||||
|
usage() {
|
||||||
|
cmd=${0##*/}
|
||||||
|
printf "%s (pacman) %s\n\n" "$cmd" "$myver"
|
||||||
|
echo
|
||||||
|
printf -- $(gettext "Usage: pkgdiff <old> <new>\n")
|
||||||
|
echo
|
||||||
|
printf -- "$(gettext "\
|
||||||
|
pkgdiff will create a file providing the differences between two packages.\n
|
||||||
|
This file can then be added to a database using repo-add.\n")"
|
||||||
|
echo
|
||||||
|
printf -- "$(gettext "Example: pkgdiff pacman-6.0.0-1-x86_64.pkg.tar.gz pacman-6.0.1-1-x86_64.pkg.tar.gz")\n"
|
||||||
|
echo
|
||||||
|
printf -- "$(gettext "Options:\n")"
|
||||||
|
printf -- "$(gettext " -q, --quiet minimize output\n")"
|
||||||
|
printf -- "$(gettext " --nocolor remove color from output\n")"
|
||||||
|
printf -- "$(gettext " --min-pkg-size minimum package size before pkgdiffs are generated\n")"
|
||||||
|
printf -- "$(gettext " --max-diff-size percent of new package above which the pkgdiff will be discarded\n")"
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
cmd=${0##*/}
|
||||||
|
printf "%s (pacman) %s\n\n" "$cmd" "$myver"
|
||||||
|
printf -- "Copyright (c) 2022 Pacman Development Team <pacman-dev@lists.archlinux.org>.\n"
|
||||||
|
echo
|
||||||
|
printf -- "$(gettext "\
|
||||||
|
This is free software; see the source for copying conditions.\n\
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.\n")"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap_exit() {
|
||||||
|
# unhook all traps to avoid race conditions
|
||||||
|
trap '' EXIT TERM HUP QUIT INT ERR
|
||||||
|
|
||||||
|
echo
|
||||||
|
error "$@"
|
||||||
|
clean_up 1
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
local exit_code=${1:-$?}
|
||||||
|
|
||||||
|
# unhook all traps to avoid race conditions
|
||||||
|
trap '' EXIT TERM HUP QUIT INT ERR
|
||||||
|
|
||||||
|
[[ -d $tmpdir ]] && rm -rf "$tmpdir"
|
||||||
|
|
||||||
|
exit $exit_code
|
||||||
|
}
|
||||||
|
|
||||||
|
read_pkginfo() {
|
||||||
|
unset pkgver pkgname arch
|
||||||
|
while IFS='=' read -r field value; do
|
||||||
|
# skip comments and invalid lines
|
||||||
|
[[ $field = '#'* || -z $value ]] && continue
|
||||||
|
|
||||||
|
# skip lines which aren't fields we care about
|
||||||
|
[[ $field != @(pkgver|pkgname|arch) ]] || continue
|
||||||
|
|
||||||
|
declare -g "${field% }=${value# }"
|
||||||
|
|
||||||
|
[[ $pkgname && $pkgver && $arch ]] && return 0
|
||||||
|
done < <(bsdtar -xOqf "$1" .PKGINFO 2>/dev/null)
|
||||||
|
|
||||||
|
error "$(gettext "Invalid package file '%s'.")" "$1"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
create_pkgdiff() {
|
||||||
|
local oldfile=$1
|
||||||
|
local newfile=$2
|
||||||
|
local \
|
||||||
|
oldname oldver oldarch \
|
||||||
|
newname newver newarch \
|
||||||
|
diff_file
|
||||||
|
|
||||||
|
read_pkginfo "$oldfile" || return 1
|
||||||
|
oldname="$pkgname"
|
||||||
|
oldver="$pkgver"
|
||||||
|
oldarch="$arch"
|
||||||
|
|
||||||
|
read_pkginfo "$newfile" || return 1
|
||||||
|
newname="$pkgname"
|
||||||
|
newver="$pkgver"
|
||||||
|
newarch="$arch"
|
||||||
|
|
||||||
|
pkgsize=$(wc -c < "$newfile")
|
||||||
|
|
||||||
|
if ((pkgsize < min_pkg_size)); then
|
||||||
|
msg "$(gettext "Skipping pkgdiff creation for small package: %s - size %s")" "$newname" "$pkgsize"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $oldname != "$newname" ]]; then
|
||||||
|
error "$(gettext "The package names don't match : '%s' and '%s'")" "$oldname" "$newname"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $oldarch != "$newarch" ]]; then
|
||||||
|
error "$(gettext "The package architectures don't match : '%s' and '%s'")" "$oldarch" "$newarch"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $oldver == "$newver" ]]; then
|
||||||
|
error "$(gettext "Both packages have the same version : '%s'")" "$newver"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
### TODO: check oldver < newver with vercmp ###
|
||||||
|
|
||||||
|
declare -r startdir="$(pwd -P)"
|
||||||
|
|
||||||
|
if [[ ${oldfile::1} != "/" ]]; then
|
||||||
|
oldfile=${startdir}/${oldfile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${newfile::1} != "/" ]]; then
|
||||||
|
newfile=${startdir}/${newfile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/pkgdiff.XXXXXXXXXX")
|
||||||
|
pushd $tmpdir &>/dev/null
|
||||||
|
|
||||||
|
|
||||||
|
### TODO: almost everything below here is a quick hack... ###
|
||||||
|
|
||||||
|
bsdtar -xOf $oldfile .MTREE | zcat | awk '{for (i=1;i<=NF;i++){if ($i ~/^sha256/) {print $1 " " $i}}}' > ${oldver}.files
|
||||||
|
bsdtar -xOf $newfile .MTREE | zcat | awk '{for (i=1;i<=NF;i++){if ($i ~/^sha256/) {print $1 " " $i}}}' > ${newver}.files
|
||||||
|
|
||||||
|
files=($(diff -Naur ${oldver}.files ${newver}.files |
|
||||||
|
grep "^+\./" |
|
||||||
|
grep -v -e "\.BUILDINFO" -e "\.PKGINFO" |
|
||||||
|
cut -f1 -d' ' |
|
||||||
|
sed 's|+./||'))
|
||||||
|
|
||||||
|
mkdir $newname
|
||||||
|
tar -xf $newfile -C $newname
|
||||||
|
|
||||||
|
diffdir="${oldname}-${oldver}-to-${newname}-${newver}-${newarch}.pkgdiff"
|
||||||
|
mkdir $diffdir
|
||||||
|
|
||||||
|
for f in ${files[@]}; do
|
||||||
|
mkdir -p ${diffdir}/${f%/*}
|
||||||
|
cp ${newname}/$f ${diffdir}/$f
|
||||||
|
done
|
||||||
|
|
||||||
|
cp ${newname}/.{BUILD,PKG}INFO ${diffdir}
|
||||||
|
|
||||||
|
|
||||||
|
### TODO: this should use libmakepkg/compress - need PKGEXT from makepkg.conf ###
|
||||||
|
### TODO: collect files in same order as makepkg ###
|
||||||
|
|
||||||
|
tar -cf ${diffdir}.tar ${diffdir}
|
||||||
|
zstd -T0 --ultra -20 ${diffdir}.tar &> /dev/null
|
||||||
|
diff_file=${diffdir}.tar.zst
|
||||||
|
|
||||||
|
|
||||||
|
diffsize=$(wc -c < "$diff_file")
|
||||||
|
|
||||||
|
if ((max_diff_size * pkgsize / 100 < diffsize)); then
|
||||||
|
msg "$(gettext "pkgdiff larger than maximum size. Removing.")"
|
||||||
|
rm -f "$diff_file"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd &>/dev/null
|
||||||
|
|
||||||
|
mv ${tmpdir}/${diff_file} .
|
||||||
|
|
||||||
|
msg "$(gettext "Generated pkgdiff : '%s'")" "$diff_file"
|
||||||
|
(( QUIET )) && echo "$diff_file"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# PROGRAM START
|
||||||
|
|
||||||
|
# determine whether we have gettext; make it a no-op if we do not
|
||||||
|
if ! type gettext &>/dev/null; then
|
||||||
|
gettext() {
|
||||||
|
echo "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
-h|--help) usage; exit 0;;
|
||||||
|
-V|--version) version; exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
trap 'clean_up' EXIT
|
||||||
|
for signal in TERM HUP QUIT; do
|
||||||
|
trap "trap_exit \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
|
||||||
|
done
|
||||||
|
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
|
||||||
|
trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
|
||||||
|
|
||||||
|
|
||||||
|
OPT_SHORT='hqV'
|
||||||
|
OPT_LONG=('help' 'quiet' 'max-diff-size:' 'min-pkg-size:' 'nocolor' 'version')
|
||||||
|
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
set -- "${OPTRET[@]}"
|
||||||
|
unset OPT_SHORT OPT_LONG OPTRET
|
||||||
|
|
||||||
|
# parse options
|
||||||
|
while :; do
|
||||||
|
case $1 in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0 ;;
|
||||||
|
-V|--version)
|
||||||
|
version
|
||||||
|
exit 0 ;;
|
||||||
|
-q|--quiet)
|
||||||
|
QUIET=1;;
|
||||||
|
--nocolor)
|
||||||
|
USE_COLOR='n';;
|
||||||
|
--min-pkg-size)
|
||||||
|
### TODO ###
|
||||||
|
shift ;;
|
||||||
|
--max-delta-size)
|
||||||
|
### TODO ###
|
||||||
|
shift ;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# check if messages are to be printed using color
|
||||||
|
if [[ -t 2 && $USE_COLOR != "n" ]]; then
|
||||||
|
colorize
|
||||||
|
else
|
||||||
|
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if (( $# != 2 )); then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in "$@"; do
|
||||||
|
if [[ ! -f $i ]]; then
|
||||||
|
error "$(gettext "File '%s' does not exist")" "$i"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
### TODO: the creation of the pkgdiff should be done in fakeroot ###
|
||||||
|
|
||||||
|
create_pkgdiff "$@"
|
||||||
@@ -65,7 +65,7 @@ Use the "help" option to get the full list of parameters:
|
|||||||
When run with the `--valgrind' option, an additional rule will be added to all
|
When run with the `--valgrind' option, an additional rule will be added to all
|
||||||
tests to check for memory leaks. To use `--valgrind' when running the full
|
tests to check for memory leaks. To use `--valgrind' when running the full
|
||||||
test suite, run:
|
test suite, run:
|
||||||
make PY_LOG_FLAGS=--valgrind check
|
PACTEST_VALGRIND=1 ninja test
|
||||||
|
|
||||||
The following pieces of software are required to run the pactest suite:
|
The following pieces of software are required to run the pactest suite:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user