Compare commits

..

6 Commits

Author SHA1 Message Date
Vekhir
6dd555ed1f fix(pkgbuild.sh): Use grep -Fx to check for pkgrel and pkgver declaration
In order to automatically replace pkgrel and pkgver, we must first check
that they are declared in the usual way as a key-value pair.
If pkgrel or pkgver contain special characters like +, they are currently
interpreted as regex. Use --fixed-strings to instead signify that they should
be literal patterns. Since the declaration must be on its own line and anchors
can't be in literal patterns, also specify --line-regexp to only consider
whole line matches.

Using sed with --extended-regexp fails for a similar reason in that the +
is treated as a special character. As it's only use was to save some
typing (not repeating pkgver= and pkgrel=), remove the option.
2025-08-20 14:55:32 +02:00
Levente Polyak
4926d9d8c5 chore(release): version v1.3.2 2025-02-25 22:05:15 +01:00
Levente Polyak
7165e0d73e chore(conf): add whitespace to RUSTFLAGS option for unified style 2025-02-25 21:51:37 +01:00
Levente Polyak
8776dd39e8 chore(makerepropkg): unify indention style of the file 2025-02-25 21:32:14 +01:00
Levente Polyak
fb4bf96d24 feat(makerepropkg): support conf.d makepkg config files from buildtool
Previously we have only copied the passed makepkg.conf file into the
chroot, which misses build flags for additional language specific files
that makepkg supports. Fix this by extracting all conf.d makepkg config
files from the detected devtools archive.

Component: makerepropkg
Co-authored-by: Christian Heusel <christian@heusel.eu>
2025-02-25 21:32:06 +01:00
Levente Polyak
96eff02801 feat(arch-nspawn): support conf.d makepkg config files
Previously we have only copied the passed makepkg.conf file into the
chroot, which misses build flags for additional language specific files
that makepkg supports. Fix this by also copying all config files that
match the `<file>.d/*.conf` glob.

Fixes #244

Component: arch-nspawn
Suggested-by: Rein Fernhout (Levitating) <me@levitati.ng>
Co-authored-by: Christian Heusel <christian@heusel.eu>
2025-02-25 21:20:31 +01:00
9 changed files with 45 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
SHELL=/bin/bash -o pipefail SHELL=/bin/bash -o pipefail
V=1.3.1 V=1.3.2
BUILDTOOLVER ?= $(V) BUILDTOOLVER ?= $(V)
PREFIX = /usr/local PREFIX = /usr/local

View File

@@ -11,7 +11,7 @@
# Flags used for the Rust compiler, similar in spirit to CFLAGS. Read # Flags used for the Rust compiler, similar in spirit to CFLAGS. Read
# linkman:rustc[1] for more details on the available flags. # linkman:rustc[1] for more details on the available flags.
RUSTFLAGS="-Cforce-frame-pointers=yes" RUSTFLAGS="-C force-frame-pointers=yes"
# Additional compiler flags appended to `RUSTFLAGS` for use in debugging. # Additional compiler flags appended to `RUSTFLAGS` for use in debugging.
# Usually this would include: ``-C debuginfo=2''. Read linkman:rustc[1] for # Usually this would include: ``-C debuginfo=2''. Read linkman:rustc[1] for

View File

@@ -23,7 +23,8 @@ Options
Location of a pacman config file Location of a pacman config file
*-M* <file>:: *-M* <file>::
Location of a makepkg config file Location of a makepkg config file. Specific additions (e.g. build flags for
additional languages) can be placed in '<file>.d/*.conf'.
*-c* <dir>:: *-c* <dir>::
Set pacman cache, if no directory is specified the passed pacman.conf's cachedir is used with a fallback to '/etc/pacman.conf' Set pacman cache, if no directory is specified the passed pacman.conf's cachedir is used with a fallback to '/etc/pacman.conf'

View File

@@ -49,7 +49,8 @@ Options
Set the pacman cache directory. Set the pacman cache directory.
*-M* <file>:: *-M* <file>::
Location of a makepkg config file. Location of a makepkg config file. Specific additions (e.g. build flags for
additional languages) can be placed in '<file>.d/*.conf'.
*-l* <chroot>:: *-l* <chroot>::
The directory name to use as the chroot namespace The directory name to use as the chroot namespace

View File

@@ -112,7 +112,13 @@ copy_hostconf () {
[[ -n $host_cachemirrors ]] && printf 'CacheServer = %s\n' "${host_cachemirrors[@]}" >>"$working_dir/etc/pacman.d/mirrorlist" [[ -n $host_cachemirrors ]] && printf 'CacheServer = %s\n' "${host_cachemirrors[@]}" >>"$working_dir/etc/pacman.d/mirrorlist"
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf" [[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf" if [[ -n $makepkg_conf ]]; then
cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"
if [[ -d "${makepkg_conf}.d" ]] && is_globfile "${makepkg_conf}.d"/*.conf; then
mkdir --parents "$working_dir/etc/makepkg.conf.d/"
cp "${makepkg_conf}.d/"*.conf "$working_dir/etc/makepkg.conf.d/"
fi
fi
local file local file
for file in "${files[@]}"; do for file in "${files[@]}"; do

View File

@@ -26,10 +26,10 @@ pkgbuild_set_pkgver() {
warning 'setting pkgver variable has no effect if the PKGBUILD has a pkgver() function' warning 'setting pkgver variable has no effect if the PKGBUILD has a pkgver() function'
fi fi
if ! grep --extended-regexp --quiet --max-count=1 "^pkgver=${pkgver}$" PKGBUILD; then if ! grep --fixed-strings --line-regexp --quiet --max-count=1 "pkgver=${pkgver}" PKGBUILD; then
die "Non-standard pkgver declaration" die "Non-standard pkgver declaration"
fi fi
sed --regexp-extended "s|^(pkgver=)${pkgver}$|\1${new_pkgver}|g" --in-place PKGBUILD sed "s|^pkgver=${pkgver}$|pkgver=${new_pkgver}|g" --in-place PKGBUILD
} }
# set the pkgrel variable in a PKGBUILD # set the pkgrel variable in a PKGBUILD
@@ -38,10 +38,10 @@ pkgbuild_set_pkgrel() {
local new_pkgrel=$1 local new_pkgrel=$1
local pkgrel=${pkgrel} local pkgrel=${pkgrel}
if ! grep --extended-regexp --quiet --max-count=1 "^pkgrel=${pkgrel}$" PKGBUILD; then if ! grep --fixed-strings --line-regexp --quiet --max-count=1 "pkgrel=${pkgrel}" PKGBUILD; then
die "Non-standard pkgrel declaration" die "Non-standard pkgrel declaration"
fi fi
sed --regexp-extended "s|^(pkgrel=)${pkgrel}$|\1${new_pkgrel}|g" --in-place PKGBUILD sed "s|^pkgrel=${pkgrel}$|pkgrel=${new_pkgrel}|g" --in-place PKGBUILD
} }
pkgbuild_update_checksums() { pkgbuild_update_checksums() {

View File

@@ -93,14 +93,36 @@ get_makepkg_conf() {
local fname=${1} local fname=${1}
local arch="${2}" local arch="${2}"
local makepkg_conf="${3}" local makepkg_conf="${3}"
if ! buildtool_file=$(get_pkgfile "${fname}"); then if ! buildtool_file=$(get_pkgfile "${fname}"); then
error "failed to retrieve ${fname}" error "failed to retrieve ${fname}"
return 1
fi
buildtool_file="${buildtool_file/file:\/\//}"
msg "using makepkg.conf from ${fname}"
# try to handle config of legacy devtools
if bsdtar --list --file "${buildtool_file}" "usr/share/devtools/makepkg-${arch}.conf" &>/dev/null; then
bsdtar --extract --to-stdout --fast-read --file "${buildtool_file}" "usr/share/devtools/makepkg-${arch}.conf" > "${makepkg_conf}"
return $?
fi
msg2 "extracting ${arch}.conf from devtools archive"
if ! bsdtar --extract --to-stdout --fast-read --file "${buildtool_file}" "usr/share/devtools/makepkg.conf.d/${arch}.conf" > "${makepkg_conf}"; then
error "failed to extract 'usr/share/devtools/makepkg.conf.d/${arch}.conf' from devtools archive"
return 1 return 1
fi fi
msg2 "using makepkg.conf from ${fname}"
if ! bsdtar xOqf "${buildtool_file/file:\/\//}" "usr/share/devtools/makepkg.conf.d/${arch}.conf" > "${makepkg_conf}"; then mkdir --parents "${makepkg_conf}.d"
bsdtar xOqf "${buildtool_file/file:\/\//}" "usr/share/devtools/makepkg-${arch}.conf" > "${makepkg_conf}" if bsdtar --list --file "${buildtool_file}" "usr/share/devtools/makepkg.conf.d/conf.d" &>/dev/null; then
fi msg2 "extracting conf.d from devtools archive"
bsdtar --extract --file "${buildtool_file}" --cd "${makepkg_conf}.d" --strip-components 4 "usr/share/devtools/makepkg.conf.d/conf.d"
fi
if bsdtar --list --file "${buildtool_file}" "usr/share/devtools/makepkg.conf.d/${arch}.conf.d" &>/dev/null; then
msg2 "extracting ${arch}.conf.d from devtools archive"
bsdtar --extract --file "${buildtool_file}" --cd "${makepkg_conf}.d" --strip-components 4 "usr/share/devtools/makepkg.conf.d/${arch}.conf.d"
fi
return 0 return 0
} }
@@ -186,7 +208,7 @@ for f in "${splitpkgs[@]}"; do
done done
if (( ${#cache_dirs[@]} == 0 )); then if (( ${#cache_dirs[@]} == 0 )); then
mapfile -t cache_dirs < <(pacman-conf CacheDir) mapfile -t cache_dirs < <(pacman-conf CacheDir)
fi fi
ORIG_HOME=${HOME} ORIG_HOME=${HOME}

View File

@@ -1,4 +0,0 @@
install:
rm -rf src/devtools-local
makepkg -f
sudo pacman --noconfirm -U $(makepkg --packagelist | head -1)

View File

@@ -1,67 +0,0 @@
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>
pkgname=devtools
branch=master
pkgver=1.3.1.r4.g79c3162
pkgrel=1
pkgdesc='Tools for Arch Linux package maintainers'
arch=('any')
license=('GPL')
url='https://gitlab.archlinux.org/archlinux/devtools'
depends=(
arch-install-scripts
awk
bash
binutils
coreutils
diffutils
fakeroot
findutils
grep
jq
openssh
parallel
rsync
sed
util-linux
bzr
git
mercurial
subversion
)
makedepends=(
asciidoc
shellcheck
)
optdepends=('btrfs-progs: btrfs support')
source=(devtools-local::"git+file://$PWD/../.git#branch=${branch}")
validpgpkeys=(
'4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC' # Pierre Schmitz <pierre@archlinux.org>
'86CFFCA918CF3AF47147588051E8B148A9999C34' # Evangelos Foutras <foutrelis@archlinux.org>
'8FC15A064950A99DD1BD14DD39E4B877E62EB915' # Sven-Hendrik Haase <svenstaro@archlinux.org>
'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig) <heftig@archlinux.org>
'B81B051F2D7FC867AAFF35A58DBD63B82072D77A' # Sébastien Luttringer <seblu@archlinux.org>
'6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD' # Allan McRae (Developer) <allan@archlinux.org>
'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak <anthraxx@archlinux.org>
)
sha256sums=('SKIP')
b2sums=('SKIP')
pkgver() {
cd ${pkgname}-local
git describe --long --tags | sed -E 's,^[^0-9]*,,;s,([^-]*-g),r\1,;s,-,.,g'
}
build() {
cd ${pkgname}-local
make BUILDTOOLVER="${epoch}:${pkgver}-${pkgrel}-${arch}" PREFIX=/usr
}
package() {
cd ${pkgname}-local
make PREFIX=/usr DESTDIR="${pkgdir}" install
}
# vim: ts=2 sw=2 et: