Commit graph

1864 commits

Author SHA1 Message Date
Allan McRae
fe6e678e59 libmakepkg: remove pkglist linting
The ability to build only selected packages from a split package was
removed from makepkg, so this lint is no longer needed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-08-02 14:26:44 +10:00
Dominik
9fca328caf makepkg: provide a field for tracking generic metadata
The xdata field is an array of key=value entries that allow a packager to
include arbitrary metadata in the generated .PKGINFO.

Fixes #241.

Signed-off-by: Dominik Peteler <archlinux+gitlab@with-h.at>
2025-05-26 16:09:02 +10:00
Rudy
af54cd4ee1 libmakepkg/tidy: give scripts a priority order
This ensures (e.g.) that the "emptydirs" script runs last after
unneeded files have been deleted.

Fixes #184.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-17 13:20:16 +10:00
Aidan Epstein
4ddc642398 Add remove option for repo-remove to remove old package files.
Also update documentation.
2025-05-17 10:43:58 +10:00
Felix Yan
64299ccfbb makepkg.sh: skip checking buildtime deps when runtime check already failed
This could help locate the real failure (instead of scrolling through the whole possibly-successful buildtime dep installation section) and also saves time on the operation.
2025-05-09 08:55:42 +10:00
Samuel Dionne-Riel
2bcdbc6a87 makepkg: Use sorted inputs for source tarballs too 2025-05-07 13:46:18 +10:00
Samuel Dionne-Riel
46f7f6e9ac makepkg: Use SOURCE_DATE_EPOCH for more reproducible source tarballs 2025-05-07 13:46:07 +10:00
Patrick Northon
38394d54f0 repo-add: add --wait-for-lock option
Using the --wait-for-lock option will result in repo-add retrying to acquire the database lock file after 3 seconds. If the option is not set, exit with code 2 on lock failure.
2025-05-07 12:23:45 +10:00
Allan McRae
267a0cc912 makepkg: ensure OPTIONS is not directly altered
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-06 17:04:32 +10:00
Diego Viola
24fc50269d Fix typos 2025-05-04 21:42:34 +10:00
Allan McRae
f13d7d480c Update copyright years
./build-aux/update-copyright 2024 2025

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-04-02 11:35:34 +10:00
LevitatingBusinessMan (Rein Fernhout)
007261ade5 makepkg: do not fail if makepkg.conf.d is empty
fixes #230
2025-03-22 05:23:23 +00:00
Jan Alexander Steffens (heftig)
f07d547cf1
libmakepkg: Use only /etc/makepkg.d/gitconfig
Globally set `GIT_CONFIG_GLOBAL` and `GIT_CONFIG_SYSTEM` so that we're
only loading `/etc/makepkg.d/gitconfig` (if it exists) and no other Git
config files.

Allow injecting another value via `MAKEPKG_GIT_CONFIG`.

Fixes: https://gitlab.archlinux.org/pacman/pacman/-/issues/193
2025-03-19 21:15:55 +01:00
Allan McRae
0f6b4f4fab autodeps: parse LIB_DIRS with more specificity
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-31 15:56:51 +10:00
Allan McRae
bc7b8e2eb2 lint_pkgbuild/arch: always perform some checks
When using --ignorearch or options that imply it (e.g. --printsrcinfo),
all checks of the arch array were skipped. Instead, perform all checks
apart from confirming that the package can be built on that
architecture.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-30 01:17:40 +00:00
Allan McRae
faea473550 Add a .gdb_index section before splitting debug info
Using gdb-add-index to add a .gdb_index section before splitting
debug info (together with enabling "maintenance set debuginfod
download-sections" in GDB) can dramatically reduce the amount of
data GDB has to download.

Fixes #205.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-19 04:27:42 +00:00
Guoxin Pu
680169fb61 libmakepkg: set CCACHE_PREFIX to absolute path of distcc when using both
The current logic sets CCACHE_PREFIX to distcc when both distcc and
ccache are enabled. However, according to the source of ccache, it would
execute the command with execv, which would not look up arg0 from PATH,
unlike those exec functions with _p suffix.

This would result in the following error, when building a package with
both ccache and distcc enabled:
```
ccache: error: execute_noreturn of distcc failed: No such file or directory
```

This breaks package builds in different ways: packages that use make/cc
directly would yield the actual error which is the same as the above
line, packages that rely on other build systems wouldn't go through
compiler check and complain on a bad compiler.

To reproduce the problem, try to build a simple package:
```
git clone https://gitlab.archlinux.org/archlinux/packaging/packages/abc.git
cd abc
cp /etc/makepkg.conf .
echo 'BUILDENV=(distcc color ccache check !sign)' >> makepkg.conf
makepkg --config makepkg.conf
```

refs:
f887434d35/src/ccache/execute.cpp (L348)
https://man.archlinux.org/man/exec.3.en#v_-_execv(),_execvp(),_execvpe()

Signed-off-by: Guoxin Pu <pugokushin@gmail.com>
2025-01-18 05:08:44 +00:00
Allan McRae
e767cf9a54 Detect repeated values in the arch array
Repeated values in the arch array can result in architecture specific
fields being repeated when using --printsrcinfo.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-16 23:14:22 +00:00
Allan McRae
4908eed57d Remove executable permissions from source file
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 03:08:18 +00:00
Allan McRae
286e776eda lint_config: move PACKAGER check into its own function
The check for the format of the PACKAGER variable did not align with the
rest of the function where it was located.  Move to its own function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 03:06:37 +00:00
Allan McRae
cc87999d6d lint_config: ensure NPROC is set to something usable
We use NPROC for managing the number of parallel jobs to run, so it is
essentially that this is a valid number.  Add a lint pass, and move the
setting of the default value to this location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 03:06:37 +00:00
Allan McRae
5f4c7e3ddc libmakepkg: strip - disguard error messages when copying source files
Parallel processing of file stripping is causing a TOC/TOU race when copying
source files into the debug location resulting in error messages from cp.
While hiding this error is not the ideal solution, it is currently the only
one we have. Given this is a error of our own making, and we understand the
cause and have determined there is zero actual downside to ignoring the
error, we will accept this approach until something better is found.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Vasiliy Stelmachenok
02b35b9155 libmakepkg: strip - parallelize stripping of files
Perform file stripping in parallel where possible. Hardlinks remain
processed one at a time due to reproducibility issues.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Vasiliy Stelmachenok
dbde37aafb libmakepkg: strip - split handling of hardlinks
Handle singly and muptiply hard-linked files separately.  Also collect
information on hard linked files to avoid searching the entire package
to check for hard links.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Allan McRae
0c136ecc8a libmakepkg: strip - add "safe_" prefix to stripping functions
Add a "safe_" prefix to strip_file() and strip_lto() to indicate that
these functions are taking extra steps to ensure permissions remain
unchanged.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Allan McRae
5e2a763e4a libmakepkg: improve validity checking of arch array
Only a subset of checks were being performed on the overridden arch
arrays in package functions. Refactor checking such that all checks
are perform on all arch arrays.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-20 14:21:32 +10:00
Allan McRae
3e557af72f makepkg.conf: add NPROC configuration value
Useful for controlling (future) parallel jobs within makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:31:36 +00:00
Allan McRae
fa7a9f748d libmakepkg: remove python hashseed handling
The decision to set the PYTHONHASHSEED variable and its value is outside
the domain of makepkg and should be handled by a distribution.  Move this
file to the libalpm-dropins project.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:28:55 +00:00
Allan McRae
870eae26dc makepkg: move SOURCE_DATE_EPOCH handling to libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:27:28 +00:00
Jan Alexander Steffens (heftig)
9154600490 strip: Treat bare object files like static libs, not shared libs
Debug symbols should only be split from finally linked ELFs, not bare
object files. We're already excluding static libraries from splitting
for a similar reason.

The `.gnu_debuglink` sections are also mishandled by LLVM's LLD, which
copies them to its output. For example, this affects Arch Linux's
`/usr/lib/Scrt1.o`.

While we're here (and it changes the code less), also strip GNU LTO data
from bare objects, again for the same reason we're removing it from
static libraries, and apply static library stripping instead of shared
library stripping.

See: https://bugs.gentoo.org/787623
2024-11-27 19:50:57 +10:00
Jan Alexander Steffens (heftig)
e0162a6868 strip: Overwrite debuglink when it's already present
When objcopy encounters an already-present section, adding the new
debuglink will fail with a warning. Remove any existing `.gnu_debuglink`
section to work around this problem.

Arch Linux's `rust` package is affected by this. Apparently when LLVM's
LLD links in `/usr/lib/Scrt1.o` it will also copy the `.gnu_debuglink`
section.

See: https://bugs.gentoo.org/787623
2024-11-27 19:50:46 +10:00
Allan McRae
71afd4d88f libmakepkg - add wrapper function for objcopy
Using objcopy can result in file permission changes.  We work around this
by using "cat" to copy the temporary output file into the target. Extract
this code into a utility function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-11-27 19:46:48 +10:00
Allan McRae
c3aa1bc123 Fix typo in git source handling
Fixes #171

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-16 18:51:03 +10:00
Allan McRae
aa1c64b21a Update translations for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
9841f14f81 Prepare tranlsation strings for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Vasiliy Stelmachenok
5213a70b88 tidy/strip: Fix incorrect recognition of static binaries as relocatable ones 2024-07-06 09:09:37 +00:00
Filip Hejsek
9151c44658 libmakepkg: Use git -c safe.bareRepository=all in bare repositories
Git commands can fail in bare repositories when global git config contains safe.bareRepository=explicit.
Some users set this option for increased security.
To be compatible with this configuration, explicitly set safe.bareRepository=all when invoking git in a bare repository.
2024-07-06 08:57:20 +00:00
Allan McRae
8d14b22260 repo-add: unconditionally create the database if it is missing
In f91fa546 (repo-add: do not recreate the database if nothing was changed),
repo-add was made to skip database write-out if there were no changes to
the database. However, this breaks the usage of repo-add to create a new
empty database: `repo-add /path/to/mydb/mydb.db.tar.xz`.

Bring back support for this use-case by always writing the database if
it is missing.

Original-patch-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-27 22:04:28 +10:00
Allan McRae
3f1943c84d Only copy source files onces when creating debug packages
The Arch sharutils package was spewing messages about "Permission denied" when
copying source files into the debug package.  This is due to the source files
having 444 permissions and being used in multiple binaries.  Only copy each
source file into the debug package onces to avoid this error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-20 00:34:32 +00:00
Allan McRae
f0a7f85dbb libmakepkg: make configured BUILDENV readonly
PKGBUILDs should not be directly adjusting this variable

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-31 16:15:54 +00:00
Allan McRae
b013ca4221 makepkg: provide environment variable to disable PKGBUILD linting
On Windows based systems (e.g. msys), running PKGBUILD linting is very
slow due to time taken spawning bash subshells.  Additionally, some packages
have extreme amounts of (usually procedurally generated) splitting, which
also causes linting to be extremely slow.  Provide an environment variable
to disable PKGBUILD linting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-01 02:12:23 +10:00
Diego Viola
7bbfc17f3c Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-20 02:30:50 -03:00
Allan McRae
d74d7ec32c makepkg: remove GITFLAGS support
Supporting git source fragments (branch, commit, tag) is difficult in
conjunction with GITFLAGS usage - particularly with the most common
use cases that reduce the amount of data cloned from the upstream repo.

Leaving GITFLAGS in place an documenting that various git source features
are not supported when GITFLAGS are in used is not an ideal 'solution'.
Instead, remove GITFLAGS support.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-20 00:18:43 +00:00
Allan McRae
76e1cb1bf1 Revert "Prepare git src with git worktree"
This causes issues when repeatedly building a package using the same
git checkout.  There is also ambiguity of the default checkout when
trying to build from HEAD. See #142 and #143.

This reverts commit 85c421f1cb.
2024-05-20 10:15:33 +10:00
Allan McRae
e1df19ee6f makepkg: drop sudo permissions after use
Add the -k parameter to the sudo call to prevent caching of credientials.
This would (potentailly) stop a rogue sudo use within a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:30:06 +00:00
EnnoxHD
8aba032de4 makepkg: make 'not a clone of' visible with a new error code
Add a new error code to expose the 'not a clone of' error state of some source
providers (git and fossil). This allows other tools integrating further and
handle this specific error state.

One usecase evolves around frequently changing source locations in PKGBUILDs
of packages in the AUR.
2024-05-05 12:24:56 +10:00
Daan De Meyer
bcd4aad16c Stop redirecting stderr of bsdtar to /dev/null
It's extremely hard to figure out what's going from when bsdtar fails
here when we expect it to succeed. Stop tunneling stderr to /dev/null
to help users figure out what's going on when this fails.
2024-05-05 02:10:30 +00:00
Tom "Ravi" Hale
85c421f1cb Prepare git src with git worktree 2024-05-04 22:28:57 +10:00
Chih-Hsuan Yen
9548d6cc76 Fix unstable git checksums
Closes https://gitlab.archlinux.org/pacman/pacman/-/issues/131
2024-05-04 10:14:11 +00:00
Allan McRae
792df078fa libmakepkg: add fortran buildenv to meson sources array
Fixes #132.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-04 10:10:23 +00:00