Commit graph

7483 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
morganamilo
48a784dde8 libalpm: fix -U when pkg exists but not sig 2025-06-21 23:39:57 +10:00
morganamilo
67e3a7be36
libalpm: fix regression in downloader
Fixes failure to finalize download path if the package file already
exists but the .sig file does not.

This patch also moves .sig.part files which should be done for
completeness although it's probably rare/inconsequential for them to
exist.

Hopefully this is now the right approach now. The logic is as follows:

  Check if dest_name or temp_name exists and try to move whichever
  does.

  If neither exist assume we're just downloading sig files and don't
  error.

  Figure out the .sig base filename.

  Try to move the .sig file if one was needed and if that fails try
  move the .sig.part file.

The patch leaves the logging as is. Maybe we should check if moves fail
for reasons other than non existence and log it properly. Though this is
probably rare and pacman will error out later anyway.

Fixes #256
2025-05-30 14:48:14 +01:00
morganamilo
45c4eef61d libalpm: move tempdir cleanup into _alpm_download
this ensures the dir still gets cleaned up even if killed by a signal
2025-05-26 16:13:06 +10:00
morganamilo
5c451cd976 libalpm: propagate signal from child to parent
If we ^C while downloading the parent should propagate so pacman can
exit as it did before the sandboxing.
2025-05-26 16:13:06 +10:00
morganamilo
d87dd153fc libalpm: finalize tempfile if destfile doesn't exist
On setup we move the termfile into the temp download dir to resume
downloads. We don't move these back losing any tempfiles we already had.
2025-05-26 16:13:06 +10:00
morganamilo
6fcecbd08d libalpm: set errno if child exited via signal 2025-05-26 16:13:06 +10:00
Diego Viola
528709131f Fix whitespace in README
Also ensure consistent style in API section
2025-05-26 16:11:13 +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
morganamilo
e392f01a94 libalpm: move sig files when download is unnamed 2025-05-17 12:03:42 +10:00
morganamilo
f722b86990 libalpm: return final final temp path in pkgurl
When downloading unnamed files via alpm_fetch_pkgurl the returned path
would point to the temp pkgcache instead of the final download location.
2025-05-17 12:03:42 +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
Allan McRae
53b1db84ef Fix memory leak in download payload
The file stream associated with downloads without a filename is not
being freed when downloading using the sandbox user.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-17 10:40:09 +10:00
Allan McRae
571c13236f pacman.8: document interaction between --cachedir and DownloadUser
Note that the user provided in the DownloadUser configuration option (if
set) needs to be able to access the directory specified with the --cachedir
argument.

Fixes #216.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-17 10:37:30 +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
Allan McRae
692f7a2cfe Do not overwrite default download user when option is unset
Commit 7ccf316c provided "root" (or the user name for UID 0) as a
default download user.  However, when DownloadUser is unset in pacman.conf,
pacman was overwriting the default with null. Rectify this.

Fixes #248

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-08 21:49:56 +10:00
morganamilo
b104b95423 log and set errno when failing to rename download 2025-05-07 18:22:55 +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
Allan McRae
d0c10a795e Free memory on failure to create temporary directory
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-06 17:02:35 +10:00
Allan McRae
0d37c1daa0 Initialise callback event fields
While the event is already globally initialised, initialising the fields
prevents a valgrind warning (since the gcc-15 update).

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-06 17:00:06 +10:00
Diego Viola
24fc50269d Fix typos 2025-05-04 21:42:34 +10:00
Rafael Fontenelle
08070e9abe Update and improve translation-help.asciidoc 2025-05-04 20:13:44 +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)
bbe3f614b2 Update my .mailmap entry 2025-03-22 05:21:36 +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
Christian Heusel
34f09204fa
repo-add.8: Mention missing compression algorithms
The manpage was lacking the database endings for various compression
algorithms that one can validly use, therefore we add these to the list.

Signed-off-by: Christian Heusel <christian@heusel.eu>
2025-03-02 14:55:57 +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
e65b7d421c Add accessor for handle->disable_dl_timeout
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-10 04:36:49 +00:00
Allan McRae
e6b3eb2570 Add accessor for handle->disable_sandbox
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-10 04:36:49 +00:00
Allan McRae
7ccf316ceb Provide a default sandboxuser
If sandboxuser is not set, pacman/libalpm does not handle moving
incomplete download files out of the temporary download directories
and into the cache. This leave download_XXXXXX directories in the
cache that cause warnings on -Sc operations.

Initialise the sandboxuser with the username of UID 0 (root on most
systems).

Fixes #209.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-09 12:14:25 +10:00
Allan McRae
ae603e35d7 pacman.conf.5: replace {sysconfdir} with /etc in code block
Variable replacements are not performed on code blocks leaving the
example Include usage with '{sysconfdir}/pacman.d/mirrorlist'.
Replace this with '/etc' consistent with other example blocks in the
man page.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 14:25:09 +10: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
Johan Förberg
425ff046ed doc/BUILDINFO: Fix description of arrays
Signed-off-by: Johan Förberg <johan@forberg.se>
2025-01-03 16:12:30 +01: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
Diego Viola
62d3192126 makepkg.conf.5: fix typo 2024-12-18 05:24:40 +00:00