1
0
forked from mirrors/pacman

Compare commits

...

116 Commits

Author SHA1 Message Date
Allan McRae
f1c7341a81 WIP: First pass at adding a pkgdiff script
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-05-22 20:05:03 +10:00
Allan McRae
2c45e854ab Disable brittle valgrind test in CI
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-05-22 19:32:47 +10:00
Allan McRae
a81ec016d7 Update pactest README
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-05-22 19:25:23 +10:00
Allan McRae
55da1a01b6 makepkg.conf.in: strip leading slash from LIB_DIRS
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-05-22 18:55:23 +10:00
Allan McRae
5e94752434 makepkg.conf.5: correction option name
Also fix typo "librarys"

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-05-22 18:54:01 +10:00
Allan McRae
262aa6c24e Fix comment
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-02-13 12:09:11 +00:00
Allan McRae
3323662ee0 makepkg: do not recurse into LIB_DIRS when looking for library provides
We should only find library provides in the configured directories, and
not their subdirectories.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-02-13 12:09:11 +00:00
Allan McRae
6c913af95d Add the -pedantic' compiler flag back to our debug builds
This was lost in the transition from autotools to meson. No additional
warnings are given with current gcc and clang.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-02-13 22:07:32 +10:00
Allan McRae
71764b6d4c makepkg.conf: allow configuration additions via a subdirectory
Move rust related buildflags to their own configuration file to
provide an example of how other languages could be supported.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-01-17 10:26:07 +10:00
Allan McRae
e0bbfb5682 libmakepkg: ensure clearing of buildflags happens first
When 'options=('!buildflags') is used, we want to ensure our
buildflags are cleared first. Currently this happens due to luck
of alphabetical ordering, but this could change with libmakepkg
drop-ins.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-01-13 11:35:42 +10:00
Allan McRae
09e82f01ea libmakepkg: move rust buildenv handling to separate file
This serves as a demonstration for how other languages could drop
in support into libmakepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-01-13 11:35:35 +10:00
Stefan Weil
d35728f924 pacman-key: Fix shell syntax
Fixes: 3f8029af92 ("pacman-key: Use ngettext for plurals")
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2023-01-01 15:54:48 +01:00
Allan McRae
3f8029af92 pacman-key: Use ngettext for plurals
There are two strings that may be singular or plural in pacman-key.
Use ngettext to handle these strings correctly, and provide a fallback
function if it is not available.

Fixes FS#70556.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-01-01 13:41:52 +10:00
Allan McRae
6344aab3bd zsh: make names unique to avoid clashes
The function _keys is a bit generic and can result in clashes.  Change
other functions starting with _key_ to be _pacman_key_ as well.

Fixes FS#74507.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-24 00:55:30 +10:00
morganamilo
52eb094aa2 Fix repo-add
Commit 4f43ce3e4a broke repo-add by
switching to parseopts without accounting for the added "--". This caused
the dbname to always be read as "--".

Accounts for "--" and makes repo-add respect "--" as end of opts.
2022-12-19 10:08:57 +10:00
Allan McRae
a194197369 makepkg.conf: clarify PKGEXT and SRCEXT
Mention valid suffixes should start with .pkg or .src

Fixes FS#64749.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-19 09:56:29 +10:00
Ziemowit Laski
f4f66fcca7 Bump required GPGME version to 1.12.0
GPGME_KEYLIST_MODE_LOCATE was introduced in 1.12.0

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 11:46:18 +10:00
Allan McRae
bb035eba4c gitlab CI: use "meson setup" everywhere
Avoids a warning from meson.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
fcb1d4f87e makepkg: package debug source files with options 'debug' and '!strip'
When package software with debug symbols without stripping, we should
still process the files with debugedit and include the needed source
files in the package.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
471a030466 Avoid NULL deference in curl_check_finished_download
We have not set handle in the function at this stage, so we can not
assign an error to it.  Pass the handle to the function to avoid
waiting until the payload is retrieved.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
775d511f42 load_packages: fix memory leak on error
The memory assigned in _alpm_pkg_load_internal was not freed on
error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
19a8587459 _alpm_pkg_load_internal: prevent double closing file descriptor
Move closing of the file descriptor until the end of the function, as
any following error will lead to a "goto error" that attempts to close
it again.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
ea83fd3927 Catch possible error in archive_entry_pathname when extracting files
Prevents a null deference on error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
0fe764a253 Fix memory leak when setting up download bars
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
3436bc6c3e Finish comparing all pairs of filenames for duplicates before erroring
This also prevents a use-after-free issue where we free the list we
are interating over and the do i->next.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-13 10:00:13 +10:00
Allan McRae
0e938f1886 libmakepkg: fix compatibility with bash-5.2 patsub_replacement
Bash-5.2 introduced the patsub_replacement shell option, which is enabled
by default.  Apparently is it supposed to handle a sed-like idiom, but
what it does achieve is making any substitution involving a "&" requiring
special care.

For makepkg's DLAGENTS, we replace "%o" and "%u" if present.  Any "&" in
the replacement fields triggers patsub_replacement unless quoted.  This is
particularly important for the URL field.

Add relevant quotes to avoid issues.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-12 18:37:59 +10:00
Allan McRae
1327ce7bd8 makepkg: remove md5sums from generated mtree file
md5sums are cryptographically broken and we supply sha256sums to verify
files on a users system have not been modified from the packaged version.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-04 20:15:33 +10:00
Allan McRae
310bf878fc repo-add: do not add md5sums to the repo dbs
Keeping md5sums in the repo databases no longer serves a real purpose.
md5sums are no longer considered  secure, and we already have sha256sums
in the repos (along with PGP verification).

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-04 20:15:33 +10:00
Allan McRae
4f43ce3e4a repo-add: use parseopts from libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-04 20:14:32 +10:00
Allan McRae
e7806a43e0 pacman.conf.in: adjust example custom repo path for consistency
The example makepkg.conf.in suggests using "PKGDEST=/home/packages". It makes
sense to use the same path for the custom repo example in pacman.conf.in.

Fixes FS#48497.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-12-04 20:11:43 +10:00
Allan McRae
23aa82812e Fix typo in comment
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-11-08 14:20:36 +10:00
Allan McRae
05e52ef796 Document alpm_pkg_xdata_t type and accessor
Also more definitions to more relevant areas in alpm.h.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-11-08 14:19:35 +10:00
Allan McRae
83e5326ac9 Remove obsolete Doxyfile declarations
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-11-08 11:49:31 +10:00
Allan McRae
b2c9543ea9 Use modern openssl interfaces for calculating MD5 and SHA256 checksum
The currently used openssl interfaces for calculating checksums have been
deprecated in openssl-3.0.  Move to the modern interfaces to avoid build
warnings.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-11-07 16:58:29 +10:00
Morten Linderud
3ed08f97ec executable/meson.build: include debugedit.sh.in
Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-11-07 01:02:12 +01:00
Andrew Gregory
da68447ec6 set bash env variables before running scripts
Bash sources user configuration files under a number of conditions that
can cause issues with scripts when bash is used as the scriptlet shell.

Bash assumes it's being run under rsh/ssh if stdin is connected to a
socket and sources the user bashrc unless the environment variable
$SHLVL is >= 2.  Commit 6a4c6a02de
switched from pipes to sockets when communicating with child processes
to work around SIGPIPE issues.  Normally $SHLVL would be inherited from
the shell running pacman, but operations involving scriptlets are
generally run with sudo which does not let the $SHLVL variable through
unless specifically configured to.

Similarly $BASH_ENV can cause bash to source user-specified configuration
files if set.

https://lists.gnu.org/archive/html/help-bash/2022-02/msg00082.html

Note: the list discussion and bash source all reference SHLVL >= 2, this
is the SHLVL value *after* bash has incremented it on startup.  Setting
it to 1 in pacman is sufficient to disable the unwanted behavior.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2022-10-15 10:40:59 -07:00
Allan McRae
86981383a2 Fix missing if
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-10-09 13:43:31 +10:00
Frederik Schwan
de11824527 strip: Include .o files in strip operation
`.o` objects used to be omitted by strip.sh due to a missing match in
the `Relocatable file` section. This patch fixes the issue by handling
`.o` objects similar to kernel modules.

fixes FS#74941

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-10-09 11:01:12 +10:00
Morten Linderud
478af273df strip: fix unique source paths
`${pkgbase}` was added to the wrong invocation. This ensures we are
producing correct debug packages.

Example from the package:

    /usr/src/debug/pacman/pacman-6.0.2/src/pacman/callback.c
    /usr/src/debug/pacman/pacman-6.0.2/src/pacman/callback.h
    /usr/src/debug/pacman/pacman-6.0.2/src/pacman/check.c
    /usr/src/debug/pacman/pacman-6.0.2/src/pacman/check.h

Fixes: 776b7c1e75 ("debugflags: Ensure we have unique source paths")
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-10-09 10:57:26 +10:00
Allan McRae
efd0c24c07 Always create directories outputted from debugedit in debug packages
The debugedit call to list all source files may include things like
build/<...>.  We have been filtering out these <> files, but they can
point to the build directory which is important to be available for
relative source paths stored in the .debug files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-10-08 21:07:45 +10:00
Allan McRae
a6b06a5b17 libmakepkg: fix compatibility with bash-5.2 globskipdots
Bash 5.2 has a new globskipdots option, which is enabled by default. The
check_dotfiles lint fails with globskipdots due to the assumption that
at least the "." and ".." paths will match. Disabling globskipdots would
be the usual solution, but that fails on bash<5.2.  Instead, enable
nullglob for this check.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-10-02 11:40:52 +10:00
Allan McRae
546433b4fd Update Transifex client usage instructions
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-09-26 21:10:54 +10:00
Allan McRae
e10751a1e0 Update Transifex config
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-09-26 20:53:48 +10:00
Kristian Klausen
673ce1ab10 pacman-key: Don't check gpg's trustdb after each key revocation
The trustdb is marked as dirty when a key is revoked[1] and GPG will
recheck it the next time. Checking the trustdb can take 300-500ms which
with 52 revoked keys (and counting) adds up.

This is very noticeable when initializing and populating pacman's
keyring like archiso is doing[2]. It is also unnecessary as the trustdb
is always checked as the last step when populating the keyring.

[1] https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=g10/keyedit.c;h=1cb62de8a87a823e06b2ed74efdc9e7a4cd99e2b;hb=refs/heads/STABLE-BRANCH-2-2#l6509
[2] https://gitlab.archlinux.org/archlinux/archiso/-/issues/191
2022-09-26 20:22:11 +10:00
Allan McRae
53dd3e844a makepkg.8: add missing fullstop
Fixes FS#75838

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-09-07 23:14:12 +10:00
Ben Westover
656abdb256 doc: Create documentation for pacman-db-upgrade and testpkg
There are two "binaries" that are currently missing documentation,
pacman-db-upgrade and testpkg. This patch adds that documentation.

Signed-off-by: Ben Westover <kwestover.kw@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-08-04 22:29:27 +10:00
Ben Westover
064e556c4e doc: Fix grammar in pacman.8.asciidoc
Signed-off-by: Ben Westover <kwestover.kw@gmail.com>
2022-08-02 23:04:22 +10:00
soloturn
184f593168 libmakepkg: Fix git clone command
Commit e017a5975c introduced the GITFLAGS
environmental variable. While ensuring the default of "--mirror" was
kept, there was a capitalisation mistake made. Handle the default for
GITFLAGS directly in the git clone command.
2022-08-02 13:07:09 +10:00
soloturn
e017a5975c makepkg: Add GITFLAGS environmental variable to customise checkout
The default flag used to clone a git repository when using makepkg
is "--mirror". However, when working with huge repositories, the use
of different flags during cloning can allow an faster checkout. For
example, using "--filter=blob:none" allows for small checkouts, at
the expense of requiring downloads during the build stage if anything
but the HEAD commit is used for the build. In addition, this example
would serve as a replacement for the often requested (but broken)
addition of --depth=1.

Add support for the environment variable GITFLAG to pass flags for
the git clone command. Note that this overrides the default rather
than adding to it in order to prevent incompatibilities.
2022-07-29 11:00:01 +10:00
Daan De Meyer
79bd512181 Add --keyringdir meson option to configure the keyring directory
On Debian, keyrings are stored in /usr/share/keyrings. To support
this, let's add a new --keyringdir option that allows configuring
the directory under datarootdir where the keyrings should be
imported from. We default to 'pacman/keyrings' for backwards
compatibility.
2022-07-29 10:17:52 +10:00
Alexander F. Rødseth
51b2e1c973 pacman: let the progress bar "C"/"c" move up and down at a more regular rate
For some terminal widths, the "C"/"c" character does not alternate at
regular intervals, but may look like it is stuck at either lowercase or
uppercase.

The previous behavior toggled based on the character position, while this
new behavior toggles the chomp alternation based on the progress percentage value.

This leads to slightly improved chomping.

Signed-off-by: Alexander F. Rødseth <xyproto@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-29 09:44:04 +10:00
Alexander F. Rødseth
5abe1455f2 pacman: remove redundant argument
The fill_progress function is called from two locations,
and both locations pass in the same percentage value twice.

This patch modifies the function signature to to receive the
percentage value just once.

Signed-off-by: Alexander F. Rødseth <xyproto@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-29 09:42:38 +10:00
Joe Baldino
daa2db6a23 meson: replace deprecated get_pkgconfig_variable()
Apparently that function was deprecated in 0.56, so use the generic
getter introduced in 0.51 instead. This squashes a warning.

Signed-off-by: Joe Baldino <pedanticdm@gmx.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-29 09:41:47 +10:00
Chris Down
ff7c6c8e57 util: Flush cursor state to stdout before removing signal handler
It's possible that the cursor does not reappear after pressing ^C during
shutdown. In my case, I noticed this when pressing ^C after getting
results from `pacman -F` -- this can reasonably reliably be triggered by
issuing a file query and pressing ^C shortly after results are shown.

There are two reasons for this issue:

1. The graceful SIGINT handler is removed at the start of cleanup(), but
   the window from entering cleanup() to reaching exit() is non trivial.
   The main offender is FREELIST(pm_targets), which on my T14s takes
   >0.1s to execute. This means that if you are unlucky enough to press
   ^C while there, the cursor isn't coming back, because we haven't
   issued any command to show the cursor again yet, and the userspace
   signal handler is already blown away.
2. Moving console_cursor_show() to earlier in cleanup() only half solves
   the issue. While it's fine not to flush after _hiding_ the cursor,
   since it will at least make itself apparent before any other text
   reaches the screen, _showing_ the cursor must be followed by flushing
   stdout, because once the graceful SIGINT handler is gone, if you
   press ^C, no flush will be triggered (and thus there will be no
   cursor).

This fixes the issue by always starting out by showing the cursor again
at cleanup() time. This means that no matter where we get caught at ^C,
we will not end up leaving the terminal without its beloved ensign.

Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-22 10:20:55 +10:00
Chris Down
015eb31c3a dload: Remove unused ABORT_SIGINT
The last user of ABORT_SIGINT was removed in commit 84723cab5d
("Cleanup the old sequential download code"), and this isn't exported as
part of the public API.

Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-21 20:00:44 +10:00
Jelle van der Waa
cb9776a07b util.c: extend --print-format with %C, %D, %M
Extend print-format with checkdepends, depends and makedepends.

Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-21 19:58:20 +10:00
Jelle van der Waa
00bc386d5a util.c: extend --print-format with %b for builddate
Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-21 19:56:18 +10:00
Allan McRae
7bcc2d9b23 Correctly handle failure in getting build or install dates
alpm_pkg_get_builddate() and alpm_pkg_get_installdate() both return -1 on
error. Correctly handle the error condition in pacman.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-21 19:50:10 +10:00
Jelle van der Waa
819a0c2986 util.c: extend --print-format with expac options
Extend --print-format with all expac format strings which can be easily
added without conversions and through a simple C macro.

Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-07-21 19:09:59 +10:00
Andrew Gregory
6dcd4b5383 makepkg: store pkgtype in xdata
Package type is not relevant to alpm or even exposed to front-ends in
any way.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2022-07-21 19:01:45 +10:00
Andrew Gregory
fe028c7f6a query: print extended data when extra info is requested
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2022-07-21 19:01:38 +10:00
Andrew Gregory
3405709b46 add extended data field for arbitrary package data
This adds a mechanism for package builders to add arbitrary data to
packages that is not necessarily relevant enough to the package
installation process to gain first-class support in alpm.  Currently
these fields have to be added to parsers with a "not actually used"
comment and can't be retrieved through the API.

Extended data is stored in "name=value" format in the xdata field
(%XDATA% in desc files):

xdata = pkgtype=debug

or

%XDATA%
pkgtype=debug

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2022-07-21 19:01:27 +10:00
Allan McRae
2bf67416c1 Fix remaining email list address
One instance was missed in b0a2fd75b2.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-06-25 22:59:20 +10:00
Jean Raby
6daeb37fe8 pacman: silence "info" msg when using --print
This allows for parsing the output of:
    pacman --upgrade --print-format '<format>' pkg.zst

without having to remove info messages from it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-06-25 22:45:00 +10:00
Morten Linderud
776b7c1e75 debugflags: Ensure we have unique source paths
In some cases packages are built outside of a directory which contains
pkgname-pkgver, this results in source listing in debug packages having
a conflicting path like `/usr/src/debug/build/` which is not ideal.

This patch ensures we always include the pkgbase to ensure the paths are
unique.

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-06-25 10:45:04 +10:00
Levente Polyak
0031cd1e46 doc/BUILDINFO.5: document buildtool and buildtoolver properties
The feature has been introduced in commit a33cdac10b
The buildinfo version has been bumped in commit 0428f6213b

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-06-25 10:25:36 +10:00
Allan McRae
d1e95c4e54 Gitlab CI: Install glibc-debug valgrind test
Currently our gitlab CI is failing due to valgrind breakage. With
Arch stripping glibc, valgrind now requires debuginfod to be active.
However the gitlab CI system combined without our testsuite does not
retrieve these symbols, even when the appropriate environmental
variable is set.

Work around this by installing the glibc-debug package directly
using a slight kludge...  All blame for this approach is assigned
to foutrelis!

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-06-16 09:00:18 +10:00
Allan McRae
84dc662d65 makepkg: add source signing PGP keys to source package if available
Arch Linux is adding source signing PGP keys to their package source
tree alongside PKGBUILDs in the form keys/pgp/$fingerprint.asc. As the
PGP keyserver infrastructure is a mess, this helps other people validate
sources in a PKGBUILD.

Add the keys to source packages if found alongside the PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-05-31 20:13:14 +10:00
Allan McRae
fdf04cdac5 doc/PKGBUILD: remove Arch Linux specific advise
The documentation for the license array was specific to Arch Linux.
Remove it and some minor other Arch Linux specific references.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-05-18 22:06:07 +10:00
Allan McRae
18152a211a libmakepkg: Do not "strip" files when the format is not recognised
We use a multi step process during stripping to ensure permissions do
not get changed.  However, if the initial objcopy fails, the subsequent cat
results in a blank file.  Abandon early if objcopy fails.

Fixes FS#74486

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-05-12 09:45:12 +10:00
Jonas Witschel
f5f9e0f4ea makepkg: use bsdtar --no-read-sparse for archive creation if available
bsdtar uses the "pax" TAR archive format by default, which has support for
storing sparse file information in the archive. Unfortunately this is a source
of unreproducibility because the sparse encoding is taken from the file system
and different file systems handle sparse files differently: some file systems
have no support for sparsely encoded files at all, and even file systems with
sparse file support can report different file information for identical files
due to differing implementations.

As a real world example where this happens, consider the Arch Linux package
"brotli-testdata 1.0.9-7", which contains a sparsely encoded all-zeros file
"usr/share/brotli/testdata/zeros". Building this package on a btrfs file system
yields a different package than building it on tmpfs or ext4 solely due to
different sparse file information that gets recorded in the package tarball.

To improve the reproducibility of archives containing sparsely encoded files,
libarchive version 3.6.0 introduces a new --no-read-sparse option. This skips
reading sparse file information from disk entirely and therefore stores files
"expanded" in the archive, which is the only way to make them reliably
reproducible across file systems.

makepkg will use this option if libarchive is recent enough to support it,
which is detected at build time.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-11 09:43:59 +10:00
morganamilo
bddfcc3f40 libalpm: add getter for handle on db and pkg
db and pkg store a pointer to the handle for internal use but don't
actually provide a way for a user to get it.

Making this accessible is more convenient for front ends and FFI
wrappers.

For example, in other languages it's common to return the error value
directly. To achieve this the python and rust wrappers also store their
own pointer to the handle inside their own pkg/db wrappers.

Exposing this would allow the wrappers to forgo the extra pointer and
just return `pkg.get_handle().last_error()`.
2022-03-08 09:56:53 +10:00
Andrew Gregory
221905b5ae query: allow querying extra info for package files
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-07 20:37:45 +10:00
Andrew Gregory
293762ea8b query: only strip leading local/ for db packages
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-07 20:37:01 +10:00
Allan McRae
40583ebe89 Avoid information leakage with badly formed download header
Parsing of Content-Disposition relies on well formed headers.
A malformed header such as:

Content-Disposition="";

will result in a strnduppayload->content_disp_name, -1, ptr),
which will copy memory until it hits a \0.

Prevent this by only copying the value if it exists.

Fixes FS#73704.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 21:49:56 +10:00
Allan McRae
632eb9739d Do not use WKD to import keys for package installs from a file
In order to use WKD in pacman -U/--upgrade operations, we need to
get the packager information from the .PKGINFO within the package.
That has obvious security implications. e.g. something like this
could convince a user to download a different key to what they
expect:

packager = foo bar <>^[[2K^[[0G:: Import PGP key DEADBEEF, "foo <bar>

While downloading an untrusted key has little impact due to the
web-of-trust model used by pacman, this could be bad in combination
with an exploit that allowed trust of keys in the keyring to be
altered.

To be safe, do not use WKD when installing using -U.

Fixes FS#73703.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 21:25:30 +10:00
Allan McRae
6b37d99431 Fix segfault when failing to import keys
Avoid a segfault when a search of the keyserver returns that the
key is found but returns no primary IDs.  We are then likely going
to fail the import, but attempt anyway because no-one know what
a keyserver will do!

Fixes FS#73534.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 20:36:59 +10:00
Allan McRae
e1246baddd Ensure WKD key lookup returns the correct key
Looking up a key using WKD just ensures you have a key with the
same email address, it does not ensure that a key with the correct
fingerprint has been downloaded.

Check a key with the relevant fingerprint is available after a
WKD import.
2022-03-06 19:57:09 +10:00
morganamilo
7340fb9b2e libalpm: mark filelist_contains as taking a const filelist
This is useful for bindings as it guarantees the value will not be
changed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 17:32:23 +10:00
Allan McRae
7ba2c276db Fix typo/omission in man pages
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 17:25:42 +10:00
Allan McRae
c89f42f17b meson: do not use meson.source_root() and meson.build_root()
Using meson.source_root() and meson.build_root() are deprectated in
meson-0.56.  Using current_source_dir() or current_build_dir() (which
have been available in all Meson versions) would require manually
adding "../" in some places.  Instead, use project_source_root() and
project_build_root() and require meson-0.56.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 16:26:34 +10:00
Allan McRae
3a39eff15e meson.build: change ExternalProgram.path to full_path
Removes "Future-deprecated features used", but reuires meson-0.55

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:55:17 +10:00
Allan McRae
6cdb2030c6 Update Doxygen configuration to silence warnings
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:32:34 +10:00
Allan McRae
ad918bcb75 Remove reference to internal type in docs
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:32:27 +10:00
Allan McRae
569bcd9d26 Add missing parameter names to silence doxygen
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:24:19 +10:00
Allan McRae
5bbda937f1 Silence meson warning about extract_all_objects
Upstream is changing the default from false to true.  This makes
no difference to us, so just set as the future default.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 15:07:57 +10:00
Allan McRae
0a792843f9 Silence meson run_command warning
Upsteam is warning about future change in the run_command check
argument. Ref: https://github.com/mesonbuild/meson/issues/9300

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 14:53:42 +10:00
Evangelos Foutras
e1ce2351f5 Make link time optimization flags configurable
We want to use -flto=auto in Arch Linux to speed up building, but we
can't hardcode it in buildenv/lto.sh because other downstreams might
have clang < 13.0.0 which did not recognize -flto=auto as equivalent
to -flto=full.

Introducing an LTOFLAGS variable to makepkg.conf seems the way to go.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-03-06 14:45:36 +10:00
Allan McRae
49b08fa9d1 libmakepkg/autodep: fix module name
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-13 13:45:42 +10:00
Morten Linderud
241c29f0cc makepkg: Implement pkgtype in .PKGINFO
This implements pkgtype into .PKGINFO. This is useful to ensure tools
parsing packages do not miss important context on the creation of the
package.

For instance discovering if a given .pkg.tar is a debug package, one
would have to do heuristics on the pkgdesc and "${pkgbase}-debug".
However both of these values are controlled by the packager.

Similarly, the heuristic for discovering split packages is if pkgbase
and pkgname differ, which can happen in any package as both values are
packager controlled.

This should ensure we don't need to rely on heuristics and instead
include the context of how the package was created.

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-09 14:03:16 +10:00
Morten Linderud
ae2f506ddf strip: Use debugedit instead of AWK to parse source files
This moves us from the fairly ugly AWK parsing line to debugedit which
originally comes out of the rpm project.

The original code has issues parsing anything that was not straight
C/C++ and languages like Rust or Go would return invalid source code
files. debugedit handles all these cases better.

Fixes FS#66755
Fixes FS#66888
Fixes FS#65677

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-09 13:58:12 +10:00
Allan McRae
42fe4864a0 libmakepkg: add extra buildflags only when buildflags is not disabled
This means options=('!buildflags') will disable the addition of CFLAG
etc for LTO and debug building.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-09 12:45:58 +10:00
Jonathan Sköld
a8d9fb8d9c Print the target arch when using the %a format specifier
Adds the %a format specifier to allow printing of a target's arch
when using --print-format.

Signed-off-by: Jonathan Sköld <arch@skold.dev>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 21:39:10 +10:00
Sefa Eyeoglu
446972b404 pacman: simplify chomp mouth logic
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 20:57:42 +10:00
Sefa Eyeoglu
e654aa8ac6 pacman: support multiple chomps at the same time
When two progressbars are present, one of them always had c while the
other always had C as the mouth

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 20:55:11 +10:00
Morten Linderud
2fe1ba5d81 makepkg: Use pkgbase in pkgdesc for debug packages
When trying to identify debug packages among other packages we
discovered that it's pkgname used in pkgdesc. Since pkgname can
sometimes be an array when building debug packages for a split package,
this could potentially include a pkgname that might not make sense
depending on the order of the array.

This patch simply uses pkgbase as it seems more correct.

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 18:15:11 +10:00
Allan McRae
0be1d4e5d0 Remove parsing of long removed files in .PKGINFO
These fields have not existed for many years.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 18:06:15 +10:00
Xiretza
e37f7d8b6b makepkg: use -ffile-prefix-map instead of -fdebug-prefix-map
>From gcc(1):

-ffile-prefix-map=old=new
	[...] Specifying this option is equivalent to specifying all the
	individual -f*-prefix-map options. This can be used to make reproducible
	builds that are location independent.

Specifically, this additionally enables -fmacro-prefix-map=, which causes
prefix mapping to be applied to expansions of __FILE__ and similar macros.

Without this option, if source files are compiled by passing the
absolute file path to the compiler (as done by e.g. cmake), any
expansions of __FILE__ (e.g. from uses of assert()) will contain
$srcdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 17:42:43 +10:00
Allan McRae
90df85e9cf Update copyright years
./build-aux/update-copyright 2021 2022

Signed-off-by: Allan McRae <allan@archlinux.org>
2022-01-02 13:34:52 +10:00
Oskar Roesler (bionade24) via pacman-dev
9f23654722 pacman: print additional error information to stderr
Prints extra information provided by file conflict or corrupt package messages
to stderr instead of stdout

Signed-off-by: Oskar Roesler (bionade24) <o.roesler@oscloud.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-29 17:53:51 +10:00
morganamilo
58c81fa213 alpm: return -1 for error in find_dl_candidates
This is the error value generally used and the calling function
explicitly checks for -1, later causing the error to be missed
and the transaction to continue.

> pacman -S xterm
warning: xterm-369-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Package (1)  Old Version  New Version  Net Change  Download Size

extra/xterm  369-1        369-1          0.00 MiB       0.42 MiB

Total Download Size:   0.42 MiB
Total Installed Size:  1.05 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n]
error: no servers configured for repository: extra
(1/1) checking keys in keyring                                                                 [--------------------------------------------------------] 100%
(1/1) checking package integrity                                                               [--------------------------------------------------------] 100%
error: failed to commit transaction (wrong or NULL argument passed)
Errors occurred, no packages were upgraded.
2021-12-29 16:16:18 +10:00
morganamilo
3a112668b5 pacman: improve backup printing
The current backup printing does not fit in with the rest of the info at
all. Change to be more consistant.

Old:

Backup Files    :
MODIFIED	/etc/pacman.conf
UNMODIFIED	/etc/makepkg.conf

New:

Backup Files    : /etc/pacman.conf [modified]
                  /etc/makepkg.conf [unmodified]

Signed-off-by: morganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-29 15:49:35 +10:00
Allan McRae
9b766badd2 libmakepkg: automatically add library dependencies
Add linked libraries to a packages dependency list. This is the partner
to automatically generated library provides, and thus depends take the
same format. To help with bootstrapping, library dependencies are only
added if the relevant provide exists.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-29 15:20:05 +10:00
Allan McRae
b234280083 libmakepkg: automatically add library sonames to provides
When the option "autodeps" is enabled, makepkg will add provides
entries for libraries found in the directories specified in LIB_DIRS
in makepkg.conf.  The entries LIB_DIRS array have the format
"prefix:directory".  For example, the entry "lib:usr/lib" will search
$pkgdir/usr/lib for library sonames and add "lib:libfoo.so.1" to the
provides array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-29 15:20:05 +10:00
Allan McRae
060ab4a289 libmakepkg: add framework for autodeps
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-29 15:20:05 +10:00
Allan McRae
354a300cd2 makepkg: remove libdepends and libprovides
This will be replaced by a better system

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-29 15:20:05 +10:00
Allan McRae
26ee6ff6ad LTO: Add -flto to LDFLAGS for clang
GCC automatically detects when it is linking LTO objects, but clang does
not.  Add -flto to LDFLAGS to make this work for clang too.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-12-24 17:59:32 +10:00
Allan McRae
3710960090 Fix file permissions 2021-12-12 14:34:53 +10:00
Allan McRae
d21fb58da3 Gitlab CI: add --werror to debug build
Catch build warnings in the CI.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-11-21 09:54:56 -08:00
Allan McRae
5352367022 Prevent translation of curl
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-11-20 12:39:42 -08:00
morganamilo
5287cc7251 alpm: fix wrong access() being used
When removing files we check _alpm_access() to see if we can write
(delete) the file. If not, we check if the file exists because if the
file does not exist then we don't actually need to remove it so there's
no issue.

However the second call uses acess() instead of _alpm_access() which
does not the rootdir into account.
2021-11-20 12:39:22 -08:00
Evangelos Foutras
fed522775d makepkg.conf: Pass -q as the first option to curl
As per curl(1), the -q (--disable) option must be first on the command
line to disable reading the curlrc config file. Without being first it
does not appear to have any effect.

Signed-off-by: Evangelos Foutras <evangelos@foutrelis.com>
2021-11-20 12:38:57 -08:00
morganamilo
b0a2fd75b2 Update mailing list url
change pacman-dev@archlinux.org to pacmandev@lists.archlinux.org

Most of this is copyright notices but this also fixes FS#72129 by
updating the address in docs/index.asciidoc.
2021-11-20 12:38:25 -08:00
Carlo Teubner
806ccd90ed "pacman -Q --changelog": fix writing uninit'd mem
Previously, when printing a package changelog to stdout, we would write
chunks of data that were not necessarily nul-terminated to stdout using
a function (fputs) which requires the input string to be nul-terminated.

On my system, this would result in occasional garbage characters showing
up in the "pacman -Qc" output.

Fix this by never nul-terminating the chunk, and using the fwrite()
function which takes an explicit input size and does not require a
nul-terminated string.

Signed-off-by: Carlo Teubner <carlo@cteubner.net>
2021-11-20 12:36:59 -08:00
Vladimir Panteleev
b242f5f24c libalpm: Log URLs when retrying
Allow finding which mirror was used to fetch a file.

This makes it a bit easier to debug situations in which mirrors serve
bad files with HTTP 200.

Signed-off-by: Vladimir Panteleev <archlinux@cy.md>
2021-11-20 12:36:29 -08:00
Andrew Gregory
529e208f39 remove YouCompleteMe config
Added, seemingly by accident, with meson in
51db84750e

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-11-20 12:22:06 -08:00
225 changed files with 1510 additions and 868 deletions

View File

@@ -20,14 +20,14 @@ default:
arch:
extends: .arch-test
script:
- meson build
- meson setup build
- ninja -C build
- fakechroot meson test -C build
arch-debug:
extends: .arch-test
script:
- meson --buildtype=debug build
- meson setup --buildtype=debug --werror build
- ninja -C build
- fakechroot meson test -C build
@@ -35,50 +35,51 @@ arch-docs:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm asciidoc
- meson -Ddoc=enabled build
- meson setup -Ddoc=enabled build
- ninja -C build
arch-clang:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm clang
- CC=clang meson build
- CC=clang meson setup build
- ninja -C build
- fakechroot meson test -C build
arch-valgrind:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm valgrind
- meson build
- ninja -C build
- PACTEST_VALGRIND=1 fakechroot meson test -C build
#arch-valgrind:
# extends: .arch-test
# script:
# - 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
# - meson setup build
# - ninja -C build
# - PACTEST_VALGRIND=1 fakechroot meson test -C build
arch-nettle:
extends: .arch-test
script:
- meson -Dcrypto=nettle --buildtype=debug build
- meson setup -Dcrypto=nettle --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-gpg:
extends: .arch-test
script:
- meson -Dgpgme=disabled --buildtype=debug build
- meson setup -Dgpgme=disabled --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-curl:
extends: .arch-test
script:
- meson -Dcurl=disabled --buildtype=debug build
- meson setup -Dcurl=disabled --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-nls:
extends: .arch-test
script:
- meson -Di18n=false --buildtype=debug build
- meson setup -Di18n=false --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
@@ -93,7 +94,7 @@ debian:
gettext python3 python3-setuptools dash gawk ca-certificates
fakeroot fakechroot
script:
- meson --buildtype=debug build
- meson setup --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
@@ -109,6 +110,6 @@ fedora:
fakeroot fakechroot
perl-Module-Load-Conditional
script:
- meson --buildtype=debug build
- meson setup --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build

View File

@@ -1,17 +1,17 @@
[main]
host = https://www.transifex.com
[archlinux-pacman.libalpm-pot]
[o:toofishes:p:archlinux-pacman:r:libalpm-pot]
file_filter = lib/libalpm/po/<lang>.po
source_file = lib/libalpm/po/libalpm.pot
source_lang = en
[archlinux-pacman.pacman-pot]
[o:toofishes:p:archlinux-pacman:r:pacman-pot]
file_filter = src/pacman/po/<lang>.po
source_file = src/pacman/po/pacman.pot
source_lang = en
[archlinux-pacman.pacman-scripts-pot]
[o:toofishes:p:archlinux-pacman:r:pacman-scripts-pot]
file_filter = scripts/po/<lang>.po
source_file = scripts/po/pacman-scripts.pot
source_lang = en

View File

@@ -1,250 +0,0 @@
#!/usr/bin/env python
# SPDX-License-Identifier: Unlicense
#
# Based on the template file provided by the 'YCM-Generator' project authored by
# Reuben D'Netto.
# Jiahui Xie has re-reformatted and expanded the original script in accordance
# to the requirements of the PEP 8 style guide and 'systemd' project,
# respectively.
#
# The original license is preserved as it is.
#
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
"""
YouCompleteMe configuration file tailored to support the 'meson' build system
used by the 'systemd' project.
"""
import glob
import os
import ycm_core
SOURCE_EXTENSIONS = (".C", ".cpp", ".cxx", ".cc", ".c", ".m", ".mm")
HEADER_EXTENSIONS = (".H", ".h", ".hxx", ".hpp", ".hh")
def DirectoryOfThisScript():
"""
Return the absolute path of the parent directory containing this
script.
"""
return os.path.dirname(os.path.abspath(__file__))
def GuessBuildDirectory():
"""
Guess the build directory using the following heuristics:
1. Returns the current directory of this script plus 'build'
subdirectory in absolute path if this subdirectory exists.
2. Otherwise, probes whether there exists any directory
containing '.ninja_log' file two levels above the current directory;
returns this single directory only if there is one candidate.
"""
result = os.path.join(DirectoryOfThisScript(), "build")
if os.path.exists(result):
return result
result = glob.glob(os.path.join(DirectoryOfThisScript(),
"..", "..", "*", ".ninja_log"))
if not result:
return ""
if 1 != len(result):
return ""
return os.path.split(result[0])[0]
def TraverseByDepth(root, include_extensions):
"""
Return a set of child directories of the 'root' containing file
extensions specified in 'include_extensions'.
NOTE:
1. The 'root' directory itself is excluded from the result set.
2. No subdirectories would be excluded if 'include_extensions' is left
to 'None'.
3. Each entry in 'include_extensions' must begin with string '.'.
"""
is_root = True
result = set()
# Perform a depth first top down traverse of the given directory tree.
for root_dir, subdirs, file_list in os.walk(root):
if not is_root:
# print("Relative Root: ", root_dir)
# print(subdirs)
if include_extensions:
get_ext = os.path.splitext
subdir_extensions = {
get_ext(f)[-1] for f in file_list if get_ext(f)[-1]
}
if subdir_extensions & include_extensions:
result.add(root_dir)
else:
result.add(root_dir)
else:
is_root = False
return result
_project_src_dir = os.path.join(DirectoryOfThisScript(), "src")
_include_dirs_set = TraverseByDepth(_project_src_dir, frozenset({".h"}))
flags = [
"-x",
"c"
# The following flags are partially redundant due to the existence of
# 'compile_commands.json'.
# '-Wall',
# '-Wextra',
# '-Wfloat-equal',
# '-Wpointer-arith',
# '-Wshadow',
# '-std=gnu99',
]
for include_dir in _include_dirs_set:
flags.append("-I" + include_dir)
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = GuessBuildDirectory()
if os.path.exists(compilation_database_folder):
database = ycm_core.CompilationDatabase(compilation_database_folder)
else:
database = None
def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
"""
Iterate through 'flags' and replace the relative paths prefixed by
'-isystem', '-I', '-iquote', '--sysroot=' with absolute paths
start with 'working_directory'.
"""
if not working_directory:
return list(flags)
new_flags = []
make_next_absolute = False
path_flags = ["-isystem", "-I", "-iquote", "--sysroot="]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith("/"):
new_flag = os.path.join(working_directory, flag)
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith(path_flag):
path = flag[len(path_flag):]
new_flag = path_flag + os.path.join(working_directory, path)
break
if new_flag:
new_flags.append(new_flag)
return new_flags
def IsHeaderFile(filename):
"""
Check whether 'filename' is considered as a header file.
"""
extension = os.path.splitext(filename)[1]
return extension in HEADER_EXTENSIONS
def GetCompilationInfoForFile(filename):
"""
Helper function to look up compilation info of 'filename' in the 'database'.
"""
# The compilation_commands.json file generated by CMake does not have
# entries for header files. So we do our best by asking the db for flags for
# a corresponding source file, if any. If one exists, the flags for that
# file should be good enough.
if not database:
return None
if IsHeaderFile(filename):
basename = os.path.splitext(filename)[0]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists(replacement_file):
compilation_info = \
database.GetCompilationInfoForFile(replacement_file)
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile(filename)
def FlagsForFile(filename, **kwargs):
"""
Callback function to be invoked by YouCompleteMe in order to get the
information necessary to compile 'filename'.
It returns a dictionary with a single element 'flags'. This element is a
list of compiler flags to pass to libclang for the file 'filename'.
"""
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile(filename)
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_)
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)
return {
"flags": final_flags,
"do_cache": True
}

View File

@@ -14,7 +14,7 @@ The following checklist should be used for making a pacman release.
- Update pacman website
Transifex updates are handled using the transifex client. The basic process is:
- Pull updates from transifex ("tx pull -a -f --minimum-perc 75")
- Pull updates from transifex ("tx pull -f --minimum-perc 75")
- Update po files ("./build-aux/update-po")
- Fix all translation errors found
- Add any new locales to the relevant LINGUAS file

View File

@@ -11,6 +11,7 @@ sed \
-e "s|@localstatedir[@]|@localstatedir@|g" \
-e "s|@libmakepkgdir[@]|@LIBMAKEPKGDIR@|g" \
-e "s|@pkgdatadir[@]|@PKGDATADIR@|g" \
-e "s|@keyringdir[@]|@KEYRINGDIR@|g" \
-e "s|@prefix[@]|@PREFIX@|g" \
-e "1s|#!/bin/bash|#!@BASH@|g" \
-e "s|@PACKAGE_VERSION[@]|@PACKAGE_VERSION@|g" \
@@ -20,6 +21,7 @@ sed \
-e "s|@DEBUGSUFFIX[@]|@DEBUGSUFFIX@|g" \
-e "s|@INODECMD[@]|@INODECMD@|g" \
-e "s|@FILECMD[@]|@FILECMD@|g" \
-e "s|@BSDTAR_NO_READ_SPARSE[@]|@BSDTAR_NO_READ_SPARSE@|g" \
"$input" >"$output"
if [[ $mode ]]; then

View File

@@ -18,7 +18,7 @@ value.
Description
-----------
This is a description of the contents of version '1' of the
This is a description of the contents of version '2' of the
BUILDINFO file format.
*format*::
@@ -53,6 +53,15 @@ BUILDINFO file format.
*startdir*::
The directory from which makepkg was executed.
*buildtool*::
The name of the tool ecosystem used to set up the build environment. Used
for defining a spec for reproducible builds, e.g. the source of the
linkman:makepkg.conf[5] used.
*buildtoolver*::
The full version of the 'buildtool', for example:
"$pkgver-$pkgrel-$pkgarch".
*buildenv (array)*::
The build environment specified in makepkg.conf.

View File

@@ -1,4 +1,4 @@
# Doxyfile 1.8.20
# Doxyfile 1.9.3
#---------------------------------------------------------------------------
# Project related configuration options
@@ -12,7 +12,6 @@ OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
OUTPUT_TEXT_DIRECTION = None
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
@@ -73,6 +72,7 @@ EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
@@ -81,6 +81,7 @@ INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
@@ -110,6 +111,7 @@ QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
@@ -152,7 +154,6 @@ VERBATIM_HEADERS = YES
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -174,6 +175,7 @@ HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
@@ -196,14 +198,16 @@ GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
MATHJAX_EXTENSIONS =
@@ -234,7 +238,6 @@ PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
@@ -247,7 +250,6 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@@ -268,7 +270,9 @@ XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
@@ -304,19 +308,18 @@ EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
@@ -324,6 +327,7 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
@@ -335,7 +339,6 @@ PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 3
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES

View File

@@ -3,7 +3,7 @@ PKGBUILD(5)
Name
----
PKGBUILD - Arch Linux package build description file
PKGBUILD - Package build description file
Synopsis
@@ -84,14 +84,7 @@ systems (see below).
*license (array)*::
This field specifies the license(s) that apply to the package.
Commonly used licenses can be found in '/usr/share/licenses/common'. If you
see the package's license there, simply reference it in the license
field (e.g., `license=('GPL')`). If the package provides a license not
available in '/usr/share/licenses/common', then you should include it
in the package itself and set `license=('custom')` or
`license=('custom:LicenseName')`. The license should be placed in
'$pkgdir/usr/share/licenses/$pkgname/' when building the package. If
multiple licenses are applicable, list all of them:
If multiple licenses are applicable, list all of them:
`license=('GPL' 'FDL')`.
*install*::
@@ -187,11 +180,6 @@ contain whitespace characters.
than or equal to), `<=` (less than or equal to), `=` (equal to), `>`
(greater than), or `<` (less than).
+
If the dependency name appears to be a library (ends with .so), makepkg will
try to find a binary that depends on the library in the built package and
append the version needed by the binary. Appending the version yourself
disables automatic detection.
+
Additional architecture-specific depends can be added by appending an
underscore and the architecture name e.g., 'depends_x86_64=()'.
@@ -245,10 +233,6 @@ example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0' dependency of
other packages. Provisions involving the `>` and `<` operators are invalid as
only specific versions of a package may be provided.
+
If the provision name appears to be a library (ends with .so), makepkg will
try to find the library in the built package and append the correct
version. Appending the version yourself disables automatic detection.
+
Additional architecture-specific provides can be added by appending an
underscore and the architecture name e.g., 'provides_x86_64=()'.
@@ -524,8 +508,7 @@ The source URL is divided into four components:
Example
-------
The following is an example PKGBUILD for the 'patch' package. For more
examples, look through the build files of your distribution's packages. For
those using Arch Linux, consult the Arch Build System (ABS) tree.
examples, look through the build files of your distribution's packages.
[source,sh]
-------------------------------

View File

@@ -240,7 +240,7 @@ link:translation-help.html[translation-help].
Bugs
----
If you find bugs (which is quite likely), please email them to the pacman-dev
mailing last at mailto:pacman-dev@archlinux.org[] with specific information
mailing last at mailto:pacman-dev@lists.archlinux.org[] with specific information
such as your command-line, the nature of the bug, and even the package database
if it helps.
@@ -250,7 +250,7 @@ bugs under the Pacman project.
Copyright
---------
pacman is Copyright (C) 2006-2021 Pacman Development Team
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
pacman is Copyright (C) 2006-2022 Pacman Development Team
<pacman-dev@lists.archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
version 2 or later.

View File

@@ -75,7 +75,7 @@ Options
For each source file in the source array of PKGBUILD, download the file
if required and generate integrity checks. The integrity checks generated
are determined by the checks present in the PKGBUILD, falling back to the
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent.
This output can be redirected into your PKGBUILD for source validation
using "`makepkg -g >> PKGBUILD`".
@@ -287,6 +287,10 @@ Environment Variables
**BUILDTOOLVER=**"<version>"::
The version of the '$BUILDTOOL' used.
**GITFLAGS**::
The options to pass when checking out git sources, replacing the default
"--mirror".
Configuration
-------------
See linkman:makepkg.conf[5] for more details on configuring makepkg using the

View File

@@ -81,6 +81,11 @@ Options
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
available linker flags.
**LTOFLAGS=**"ltoflags"::
Additional compiler and linker flags appended to `CFLAGS`, `CXXFLAGS`
and `LDFLAGS` when building with link time optimization. If empty,
``-flto'' is used.
**MAKEFLAGS=**"makeflags"::
This is often used to set the number of jobs used; for example, `-j2`.
Other flags that make accepts can also be passed.
@@ -190,8 +195,14 @@ Options
package containing the debug symbols when used with `strip'.
*lto*;;
Enable building packages using link time optimization. Adds '-flto'
to both CFLAGS and CXXFLAGS.
Enable building packages using link time optimization. Adds the
flags specified in LTOFLAGS to CFLAGS, CXXFLAGS and LDFLAGS (or
``-flto'' if LTOFLAGS is empty).
*autodeps*;;
Enable the automatic addition of libraries to the depends and
provides arrays. Search library directories are controlled by
the LIB_DIRS variable defined below.
**INTEGRITY_CHECK=(**check1 ...**)**::
File integrity checks to use. Multiple checks may be specified; this
@@ -223,6 +234,12 @@ Options
that are located in opt/, you may need to add the directory to this
array. *NOTE:* Do not add the leading slash to the directory name.
**LIB_DIRS=(**lib:usr/lib ...**)**::
If `autodeps` is specified in the `OPTIONS` array, this variable will
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
libraries found in "path" with the specified prefix added.
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
If `purge` is specified in the `OPTIONS` array, this variable will
instruct makepkg which files to remove from the package. This is
@@ -274,9 +291,10 @@ Options
**PKGEXT=**"{pkgext}", **SRCEXT=**"{srcext}"::
Sets the compression used when making compiled or source packages.
Valid suffixes are `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`,
`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, `.tar.lz` and `.tar.Z`, or
simply `.tar` to disable compression entirely.
Valid suffixes are `.pkg` or `.src` (for PKGEXT and SRCEXT resepectively)
followed by one of `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`, `.tar.lzo`,
`.tar.lrz`, `.tar.lz4`, `.tar.lz` and `.tar.Z`, or simply `.tar` to
disable compression entirely.
**PACMAN_AUTH=()**::
Specify a command prefix for running pacman as root. If unset, makepkg will

View File

@@ -5,7 +5,9 @@ manpages = [
{ 'name': 'makepkg-template.1' },
{ 'name': 'repo-add.8' },
{ 'name': 'vercmp.8' },
{ 'name': 'testpkg.8' },
{ 'name': 'pacman-key.8' },
{ 'name': 'pacman-db-upgrade.8' },
{ 'name': 'PKGBUILD.5', 'extra_depends' : [ 'PKGBUILD-example.txt' ] },
{ 'name': 'makepkg.conf.5' },
{ 'name': 'pacman.conf.5' },
@@ -28,6 +30,7 @@ asciidoc_opts = [
'-a', 'srcext=@0@'.format(get_option('src-ext')),
'-a', 'pkgext=@0@'.format(get_option('pkg-ext')),
'-a', 'pkgdatadir=@0@'.format(PKGDATADIR),
'-a', 'keyringdir=@0@'.format(KEYRINGDIR),
'-a', 'localstatedir=@0@'.format(LOCALSTATEDIR),
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),

View File

@@ -34,7 +34,7 @@ Options
*-R, \--rootdir* <path>::
Specify an alternate installation root (default is `/`).
*-r, \--repo* <remote>::
*-r, \--repo* <repository>::
Query options for a specific repository.
*-v, \--verbose*::

View File

@@ -0,0 +1,36 @@
pacman-db-upgrade(8)
====================
Name
----
pacman-db-upgrade - upgrade the local pacman database to a newer format
Synopsis
--------
'pacman-db-upgrade' [options]
Description
-----------
'pacman-db-upgrade' is a script that upgrades the local database used
by linkman:pacman[8] to a newer format.
Options
--------------
*-h, \--help*::
Show the built-in help message and exit.
*-V, \--version*::
Show version information and exit.
*-d, \--dbpath* <path>::
Set an alternate database location.
*-r, \--root* <path>::
Set an alternate installation root.
*\--config* <path>::
Set an alternate configuration file.
*\--nocolor*::
Remove color from output.
See Also
--------
linkman:pacman[8]
include::footer.asciidoc[]

View File

@@ -86,7 +86,7 @@ Operations
*\--populate*::
Reload the default keys from the (optionally provided) keyrings in
+{pkgdatadir}/keyrings+. For more information, see
+{keyringdir}+. For more information, see
<<PK,Providing a Keyring for Import>> below.
*-u, \--updatedb*::
@@ -129,7 +129,7 @@ A distribution or other repository provided may want to provide a set of
PGP keys used in the signing of its packages and repository databases that can
be readily imported into the pacman keyring. This is achieved by providing a
PGP keyring file `foo.gpg` that contains the keys for the foo keyring in the
directory +{pkgdatadir}/keyrings+.
directory +{keyringdir}+.
Optionally, the file `foo-trusted` can be provided containing a list of trusted
key IDs for that keyring. This is a file in a format compatible with 'gpg

View File

@@ -212,7 +212,7 @@ Transaction Options (apply to '-S', '-R' and '-U')
*\--assume-installed* <package=version>::
Add a virtual package "package" with version "version" to the transaction
to satisfy dependencies. This allows to disable specific dependency checks
to satisfy dependencies. This allows disabling the specific dependency checks
without affecting all dependency checks. To disable all dependency
checking, see the '\--nodeps' option.
@@ -235,8 +235,13 @@ Transaction Options (apply to '-S', '-R' and '-U')
*\--print-format* <format>::
Specify a printf-like format to control the output of the '\--print'
operation. The possible attributes are: "%n" for pkgname, "%v" for pkgver,
"%l" for location, "%r" for repository, and "%s" for size. Implies '\--print'.
operation. The possible attributes are: "%a" for arch, "%b" for
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%n" for
pkgname, "%p" for packager, "%v" for pkgver, "%l" for location, "%r"
for repository, "%s" for size, "%C" for checkdepends, "%D" for depends
and "%M" for makedepends.
Implies '\--print'.
Upgrade Options (apply to '-S' and '-U')[[UO]]

View File

@@ -121,7 +121,7 @@ Options
architecture 'any' can always be installed, as they are meant to be
architecture independent.
*XferCommand =* /path/to/command %u::
*XferCommand =* /path/to/command %u [%o]::
If set, an external program will be used to download all remote files.
All instances of `%u` will be replaced with the download URL. If present,
instances of `%o` will be replaced with the local filename, plus a

20
doc/testpkg.8.asciidoc Normal file
View File

@@ -0,0 +1,20 @@
testpkg(8)
==========
Name
----
testpkg - test a pacman package for validity
Synopsis
--------
'testpkg' <package file>
Description
-----------
'testpkg' is a script used to make sure that a pacman package is valid.
See Also
--------
linkman:pacman[8]
include::footer.asciidoc[]

View File

@@ -55,7 +55,7 @@ Pre-release Updates
~~~~~~~~~~~~~~~~~~~
A week or two before each release, the codebase will go into a string freeze
and an email will be sent to the mailto:pacman-dev@archlinux.org[pacman-dev]
and an email will be sent to the mailto:pacman-dev@lists.archlinux.org[pacman-dev]
mailing list asking for translations. This email will have a prefix of
*[translation]* for anyone looking to set up an email filter.
@@ -150,4 +150,4 @@ There are currently no efforts underway to include translated manual pages in
the pacman codebase. However, this is not to say translations are unwelcome. If
someone has experience with i18n man pages and how to best include them with our
source, please contact the pacman-dev mailing list at
mailto:pacman-dev@archlinux.org[].
mailto:pacman-dev@lists.archlinux.org[].

View 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"

View File

@@ -9,10 +9,10 @@
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')
@@ -41,13 +41,12 @@ CHOST="@CHOST@"
#CFLAGS="-O2 -pipe"
#CXXFLAGS="-O2 -pipe"
#LDFLAGS=""
#RUSTFLAGS="-C opt-level=2"
#LTOFLAGS="-flto"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
#DEBUG_CFLAGS="-g"
#DEBUG_CXXFLAGS="-g"
#DEBUG_RUSTFLAGS="-C debuginfo=2"
#########################################################################
# BUILD ENVIRONMENT
@@ -76,7 +75,8 @@ BUILDENV=(!distcc color !ccache check !sign)
# These are default values for the options=() settings
#########################################################################
#
# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto)
# Makepkg defaults:
# OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto !autodeps)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
@@ -88,8 +88,9 @@ BUILDENV=(!distcc color !ccache check !sign)
#-- purge: Remove files specified by PURGE_TARGETS
#-- debug: Add debugging flags as specified in DEBUG_* variables
#-- lto: Add compile flags for building with link time optimization
#-- autodeps: Automatically add depends/provides
#
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto)
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto !autodeps)
#-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(ck)
@@ -107,6 +108,8 @@ DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"
#-- Prefix and directories for library autodeps
LIB_DIRS=('lib:usr/lib' 'lib32:usr/lib32')
#########################################################################
# PACKAGE OUTPUT

View File

@@ -74,4 +74,4 @@ ParallelDownloads = 5
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
#Server = file:///home/packages

View File

@@ -1,7 +1,7 @@
/*
* add.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* add.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* alpm.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>

View File

@@ -1,7 +1,7 @@
/*
* alpm.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -107,12 +107,20 @@ typedef struct _alpm_db_t alpm_db_t;
* Packages from databases are automatically freed when the database is unregistered. Packages loaded
* from a file must be freed manually.
*
* Packages can then be queried for metadata or added to a \link alpm_trans_t transaction \endlink
* Packages can then be queried for metadata or added to a transaction
* to be added or removed from the system.
* @ingroup libalpm_packages
*/
typedef struct _alpm_pkg_t alpm_pkg_t;
/** The extended data type used to store non-standard package data fields
* @ingroup libalpm_packages
*/
typedef struct _alpm_pkg_xdata_t {
char *name;
char *value;
} alpm_pkg_xdata_t;
/** The time type used by libalpm. Represents a unix time stamp
* @ingroup libalpm_misc */
typedef int64_t alpm_time_t;
@@ -156,7 +164,7 @@ typedef struct _alpm_backup_t {
* @param path the path to search for in the package
* @return a pointer to the matching file or NULL if not found
*/
alpm_file_t *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path);
alpm_file_t *alpm_filelist_contains(const alpm_filelist_t *filelist, const char *path);
/* End of libalpm_files */
/** @} */
@@ -967,7 +975,7 @@ typedef union _alpm_event_t {
* Called when an event occurs
* @param ctx user-provided context
* @param event the event that occurred */
typedef void (*alpm_cb_event)(void *ctx, alpm_event_t *);
typedef void (*alpm_cb_event)(void *ctx, alpm_event_t *event);
/**
* Type of question.
@@ -1114,7 +1122,7 @@ typedef union _alpm_question_t {
* @param ctx user-provided context
* @param question the question being asked.
*/
typedef void (*alpm_cb_question)(void *ctx, alpm_question_t *);
typedef void (*alpm_cb_question)(void *ctx, alpm_question_t *question);
/** An enum over different kinds of progress alerts. */
typedef enum _alpm_progress_t {
@@ -1281,6 +1289,12 @@ int alpm_unregister_all_syncdbs(alpm_handle_t *handle);
*/
int alpm_db_unregister(alpm_db_t *db);
/** Get the handle of a package database.
* @param db pointer to the package database
* @return the alpm handle that the package database belongs to
*/
alpm_handle_t *alpm_db_get_handle(alpm_db_t *db);
/** Get the name of a package database.
* @param db pointer to the package database
* @return the name of the package database, NULL on error
@@ -1830,7 +1844,7 @@ const char *alpm_option_get_gpgdir(alpm_handle_t *handle);
* @param gpgdir the gpgdir to set
*/
int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir);
/* End of gpdir accessors */
/* End of gpgdir accessors */
/** @} */
@@ -2386,6 +2400,12 @@ int alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
* @{
*/
/** Gets the handle of a package
* @param pkg a pointer to package
* @return the alpm handle that the package belongs to
*/
alpm_handle_t *alpm_pkg_get_handle(alpm_pkg_t *pkg);
/** Gets the name of the file from which the package was loaded.
* @param pkg a pointer to package
* @return a reference to an internal string
@@ -2586,6 +2606,12 @@ int alpm_pkg_get_sig(alpm_pkg_t *pkg, unsigned char **sig, size_t *sig_len);
*/
int alpm_pkg_get_validation(alpm_pkg_t *pkg);
/** Gets the extended data field of a package.
* @param pkg a pointer to package
* @return a reference to a list of alpm_pkg_xdata_t objects
*/
alpm_list_t *alpm_pkg_get_xdata(alpm_pkg_t *pkg);
/** Returns whether the package has an install scriptlet.
* @return 0 if FALSE, TRUE otherwise
*/

View File

@@ -1,7 +1,7 @@
/*
* alpm_list.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* alpm_list.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* backup.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>

View File

@@ -1,7 +1,7 @@
/*
* backup.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* be_local.c : backend for the local database
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -195,6 +195,12 @@ static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg)
return pkg->backup;
}
static alpm_list_t *_cache_get_xdata(alpm_pkg_t *pkg)
{
LAZY_LOAD(INFRQ_DESC);
return pkg->xdata;
}
/**
* Open a package changelog for reading. Similar to fopen in functionality,
* except that the returned 'file stream' is from the database.
@@ -349,6 +355,7 @@ static const struct pkg_operations local_pkg_ops = {
.get_replaces = _cache_get_replaces,
.get_files = _cache_get_files,
.get_backup = _cache_get_backup,
.get_xdata = _cache_get_xdata,
.changelog_open = _cache_changelog_open,
.changelog_read = _cache_changelog_read,
@@ -804,6 +811,18 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
READ_AND_SPLITDEP(info->conflicts);
} else if(strcmp(line, "%PROVIDES%") == 0) {
READ_AND_SPLITDEP(info->provides);
} else if(strcmp(line, "%XDATA%") == 0) {
alpm_list_t *i, *lines = NULL;
READ_AND_STORE_ALL(lines);
for(i = lines; i; i = i->next) {
alpm_pkg_xdata_t *pd = _alpm_pkg_parse_xdata(i->data);
if(pd == NULL || !alpm_list_append(&info->xdata, pd)) {
_alpm_pkg_xdata_free(pd);
FREELIST(lines);
goto error;
}
}
FREELIST(lines);
}
}
fclose(fp);
@@ -1040,6 +1059,15 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq)
write_deps(fp, "%CONFLICTS%", info->conflicts);
write_deps(fp, "%PROVIDES%", info->provides);
if(info->xdata) {
fputs("%XDATA%\n", fp);
for(lp = info->xdata; lp; lp = lp->next) {
alpm_pkg_xdata_t *pd = lp->data;
fprintf(fp, "%s=%s\n", pd->name, pd->value);
}
fputc('\n', fp);
}
fclose(fp);
fp = NULL;
}

View File

@@ -1,7 +1,7 @@
/*
* be_package.c : backend for packages
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -244,10 +244,12 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
STRDUP(backup->name, ptr, FREE(backup); return -1);
newpkg->backup = alpm_list_add(newpkg->backup, backup);
} else if(strcmp(key, "force") == 0) {
/* deprecated, skip it */
} else if(strcmp(key, "makepkgopt") == 0) {
/* not used atm */
} else if(strcmp(key, "xdata") == 0) {
alpm_pkg_xdata_t *pd = _alpm_pkg_parse_xdata(ptr);
if(pd == NULL || !alpm_list_append(&newpkg->xdata, pd)) {
_alpm_pkg_xdata_free(pd);
return -1;
}
} else {
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
newpkg->name ? newpkg->name : "error", key, linenum);
@@ -651,7 +653,6 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
}
_alpm_archive_read_free(archive);
close(fd);
/* internal fields for package struct */
newpkg->origin = ALPM_PKG_FROM_FILE;
@@ -674,6 +675,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
newpkg->infolevel |= INFRQ_FILES;
}
close(fd);
return newpkg;
pkg_invalid:
@@ -723,7 +725,6 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
int validation = 0;
char *sigpath;
alpm_pkg_t *pkg_temp;
char *packager;
CHECK_HANDLE(handle, return -1);
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
@@ -749,13 +750,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
char *key = k->data;
if(_alpm_key_in_keychain(handle, key) == 0) {
pkg_temp = _alpm_pkg_load_internal(handle, filename, full);
if(pkg_temp) {
packager = pkg_temp->packager;
} else {
packager = NULL;
}
if(_alpm_key_import(handle, packager, key) == -1) {
if(_alpm_key_import(handle, NULL, key) == -1) {
fail = 1;
}
_alpm_pkg_free(pkg_temp);

View File

@@ -1,7 +1,7 @@
/*
* be_sync.c : backend for sync databases
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -666,6 +666,18 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
pkg->files.count = files_count;
pkg->files.files = files;
_alpm_filelist_sort(&pkg->files);
} else if(strcmp(line, "%DATA%") == 0) {
alpm_list_t *i, *lines = NULL;
READ_AND_STORE_ALL(lines);
for(i = lines; i; i = i->next) {
alpm_pkg_xdata_t *pd = _alpm_pkg_parse_xdata(i->data);
if(pd == NULL || !alpm_list_append(&pkg->xdata, pd)) {
_alpm_pkg_xdata_free(pd);
FREELIST(lines);
goto error;
}
}
FREELIST(lines);
}
}
if(ret != ARCHIVE_EOF) {

View File

@@ -1,7 +1,7 @@
/*
* conflict.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>

View File

@@ -1,7 +1,7 @@
/*
* conflict.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* db.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -212,6 +212,12 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
return ret;
}
alpm_handle_t SYMEXPORT *alpm_db_get_handle(alpm_db_t *db)
{
ASSERT(db != NULL, return NULL);
return db->handle;
}
const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
{
ASSERT(db != NULL, return NULL);

View File

@@ -1,7 +1,7 @@
/*
* db.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>

View File

@@ -1,7 +1,7 @@
/*
* deps.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>

View File

@@ -1,7 +1,7 @@
/*
* deps.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>

View File

@@ -1,7 +1,7 @@
/*
* diskspace.c
*
* Copyright (c) 2010-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2010-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

View File

@@ -1,7 +1,7 @@
/*
* diskspace.h
*
* Copyright (c) 2010-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2010-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

View File

@@ -1,7 +1,7 @@
/*
* dload.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -153,8 +153,7 @@ static char *get_fullpath(const char *path, const char *filename,
}
enum {
ABORT_SIGINT = 1,
ABORT_OVER_MAXFILESIZE
ABORT_OVER_MAXFILESIZE = 1,
};
static int dload_interrupted;
@@ -295,8 +294,11 @@ static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *u
endptr--;
}
STRNDUP(payload->content_disp_name, fptr, endptr - fptr + 1,
RET_ERR(payload->handle, ALPM_ERR_MEMORY, realsize));
/* avoid information leakage with badly formed headers */
if(endptr > fptr) {
STRNDUP(payload->content_disp_name, fptr, endptr - fptr + 1,
RET_ERR(payload->handle, ALPM_ERR_MEMORY, realsize));
}
}
}
@@ -427,6 +429,9 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
len = strlen(server) + strlen(payload->filepath) + 2;
MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath);
_alpm_log(handle, ALPM_LOG_DEBUG,
"%s: retrying from %s\n",
payload->remote_name, payload->fileurl);
fflush(payload->localf);
@@ -468,10 +473,9 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
* Returns -1 if an error happened for a required file
* Returns -2 if an error happened for an optional file
*/
static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CURLMsg *msg,
const char *localpath, int *active_downloads_num)
{
alpm_handle_t *handle = NULL;
struct dload_payload *payload = NULL;
CURL *curl = msg->easy_handle;
CURLcode curlerr;
@@ -486,12 +490,11 @@ static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
curlerr = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &payload);
ASSERT(curlerr == CURLE_OK, RET_ERR(handle, ALPM_ERR_LIBCURL, -1));
handle = payload->handle;
curl_gethost(payload->fileurl, hostname, sizeof(hostname));
curlerr = msg->data.result;
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: curl returned result %d from transfer\n",
payload->remote_name, curlerr);
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: %s returned result %d from transfer\n",
payload->remote_name, "curl", curlerr);
/* was it a success? */
switch(curlerr) {
@@ -914,7 +917,7 @@ static int curl_download_internal(alpm_handle_t *handle,
break;
}
if(msg->msg == CURLMSG_DONE) {
int ret = curl_check_finished_download(curlm, msg,
int ret = curl_check_finished_download(handle, curlm, msg,
localpath, &active_downloads_num);
if(ret == -1) {
/* if current payload failed to download then stop adding new payloads but wait for the

View File

@@ -1,7 +1,7 @@
/*
* dload.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* error.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* filelist.c
*
* Copyright (c) 2012-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2012-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
@@ -118,7 +118,7 @@ static int _alpm_files_cmp(const void *f1, const void *f2)
return strcmp(file1->name, file2->name);
}
alpm_file_t SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
alpm_file_t SYMEXPORT *alpm_filelist_contains(const alpm_filelist_t *filelist,
const char *path)
{
alpm_file_t key;

View File

@@ -1,7 +1,7 @@
/*
* filelist.h
*
* Copyright (c) 2012-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2012-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

View File

@@ -1,7 +1,7 @@
/*
* graph.c - helpful graph structure and setup/teardown methods
*
* Copyright (c) 2007-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2007-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

View File

@@ -1,7 +1,7 @@
/*
* graph.h - helpful graph structure and setup/teardown methods
*
* Copyright (c) 2007-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2007-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

View File

@@ -1,7 +1,7 @@
/*
* group.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* group.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* handle.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>

View File

@@ -1,7 +1,7 @@
/*
* handle.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* hook.c
*
* Copyright (c) 2015-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2015-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

View File

@@ -1,7 +1,7 @@
/*
* hook.h
*
* Copyright (c) 2015-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2015-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

View File

@@ -4,7 +4,7 @@
/*
* libarchive-compat.h
*
* Copyright (c) 2013-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2013-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

View File

@@ -1,7 +1,7 @@
/*
* log.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* log.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* package.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
@@ -98,6 +98,7 @@ static alpm_list_t *_pkg_get_provides(alpm_pkg_t *pkg) { return pkg->provides;
static alpm_list_t *_pkg_get_replaces(alpm_pkg_t *pkg) { return pkg->replaces; }
static alpm_filelist_t *_pkg_get_files(alpm_pkg_t *pkg) { return &(pkg->files); }
static alpm_list_t *_pkg_get_backup(alpm_pkg_t *pkg) { return pkg->backup; }
static alpm_list_t *_pkg_get_xdata(alpm_pkg_t *pkg) { return pkg->xdata; }
static void *_pkg_changelog_open(alpm_pkg_t UNUSED *pkg)
{
@@ -162,6 +163,7 @@ const struct pkg_operations default_pkg_ops = {
.get_replaces = _pkg_get_replaces,
.get_files = _pkg_get_files,
.get_backup = _pkg_get_backup,
.get_xdata = _pkg_get_xdata,
.changelog_open = _pkg_changelog_open,
.changelog_read = _pkg_changelog_read,
@@ -191,6 +193,12 @@ const char SYMEXPORT *alpm_pkg_get_base(alpm_pkg_t *pkg)
return pkg->ops->get_base(pkg);
}
alpm_handle_t SYMEXPORT *alpm_pkg_get_handle(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
return pkg->handle;
}
const char SYMEXPORT *alpm_pkg_get_name(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
@@ -479,6 +487,13 @@ int SYMEXPORT alpm_pkg_has_scriptlet(alpm_pkg_t *pkg)
return pkg->ops->has_scriptlet(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_xdata(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
pkg->handle->pm_errno = ALPM_ERR_OK;
return pkg->ops->get_xdata(pkg);
}
static void find_requiredby(alpm_pkg_t *pkg, alpm_db_t *db, alpm_list_t **reqs,
int optional)
{
@@ -671,6 +686,30 @@ static void free_deplist(alpm_list_t *deps)
alpm_list_free(deps);
}
alpm_pkg_xdata_t *_alpm_pkg_parse_xdata(const char *string)
{
alpm_pkg_xdata_t *pd;
const char *sep;
if(string == NULL || (sep = strchr(string, '=')) == NULL) {
return NULL;
}
CALLOC(pd, 1, sizeof(alpm_pkg_xdata_t), return NULL);
STRNDUP(pd->name, string, sep - string, FREE(pd); return NULL);
STRDUP(pd->value, sep + 1, FREE(pd->name); FREE(pd); return NULL);
return pd;
}
void _alpm_pkg_xdata_free(alpm_pkg_xdata_t *pd)
{
if(pd) {
free(pd->name);
free(pd->value);
free(pd);
}
}
void _alpm_pkg_free(alpm_pkg_t *pkg)
{
if(pkg == NULL) {
@@ -701,6 +740,8 @@ void _alpm_pkg_free(alpm_pkg_t *pkg)
}
alpm_list_free_inner(pkg->backup, (alpm_list_fn_free)_alpm_backup_free);
alpm_list_free(pkg->backup);
alpm_list_free_inner(pkg->xdata, (alpm_list_fn_free)_alpm_pkg_xdata_free);
alpm_list_free(pkg->xdata);
free_deplist(pkg->depends);
free_deplist(pkg->optdepends);
free_deplist(pkg->checkdepends);

View File

@@ -1,7 +1,7 @@
/*
* package.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
@@ -67,6 +67,8 @@ struct pkg_operations {
alpm_filelist_t *(*get_files) (alpm_pkg_t *);
alpm_list_t *(*get_backup) (alpm_pkg_t *);
alpm_list_t *(*get_xdata) (alpm_pkg_t *);
void *(*changelog_open) (alpm_pkg_t *);
size_t (*changelog_read) (void *, size_t, const alpm_pkg_t *, void *);
int (*changelog_close) (const alpm_pkg_t *, void *);
@@ -136,6 +138,8 @@ struct _alpm_pkg_t {
alpm_pkgreason_t reason;
int scriptlet;
alpm_list_t *xdata;
/* Bitfield from alpm_dbinfrq_t */
int infolevel;
/* Bitfield from alpm_pkgvalidation_t */
@@ -158,4 +162,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
int _alpm_pkg_cmp(const void *p1, const void *p2);
int _alpm_pkg_compare_versions(alpm_pkg_t *local_pkg, alpm_pkg_t *pkg);
alpm_pkg_xdata_t *_alpm_pkg_parse_xdata(const char *string);
void _alpm_pkg_xdata_free(alpm_pkg_xdata_t *pd);
#endif /* ALPM_PACKAGE_H */

View File

@@ -1,7 +1,7 @@
/*
* pkghash.c
*
* Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2011-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

View File

@@ -1,7 +1,7 @@
/*
* pkghash.h
*
* Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2011-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

View File

@@ -15,7 +15,7 @@ XGETTEXT_OPTIONS = \
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package.
COPYRIGHT_HOLDER = Pacman Development Team <pacman-dev@archlinux.org>
COPYRIGHT_HOLDER = Pacman Development Team <pacman-dev@lists.archlinux.org>
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings.

View File

@@ -1,7 +1,7 @@
/*
* remove.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -332,7 +332,7 @@ static int can_remove_file(alpm_handle_t *handle, const alpm_file_t *file)
/* If we fail write permissions due to a read-only filesystem, abort.
* Assume all other possible failures are covered somewhere else */
if(_alpm_access(handle, NULL, filepath, W_OK) == -1) {
if(errno != EACCES && errno != ETXTBSY && access(filepath, F_OK) == 0) {
if(errno != EACCES && errno != ETXTBSY && _alpm_access(handle, NULL, filepath, F_OK) == 0) {
/* only return failure if the file ACTUALLY exists and we can't write to
* it - ignore "chmod -w" simple permission failures */
_alpm_log(handle, ALPM_LOG_ERROR, _("cannot remove file '%s': %s\n"),

View File

@@ -1,7 +1,7 @@
/*
* remove.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* signing.c
*
* Copyright (c) 2008-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2008-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
@@ -253,9 +253,10 @@ error:
* This requires GPGME to call the gpg binary.
* @param handle the context handle
* @param email the email address of the key to import
* @param fpr the fingerprint key ID to look up (or NULL)
* @return 0 on success, -1 on error
*/
static int key_import_wkd(alpm_handle_t *handle, const char *email)
static int key_import_wkd(alpm_handle_t *handle, const char *email, const char *fpr)
{
gpgme_error_t gpg_err;
gpgme_ctx_t ctx = {0};
@@ -274,7 +275,12 @@ static int key_import_wkd(alpm_handle_t *handle, const char *email)
_alpm_log(handle, ALPM_LOG_DEBUG, _("looking up key %s using WKD\n"), email);
gpg_err = gpgme_get_key(ctx, email, &key, 0);
if(gpg_err_code(gpg_err) == GPG_ERR_NO_ERROR) {
ret = 0;
/* check if correct key was imported via WKD */
if(fpr && _alpm_key_in_keychain(handle, fpr)) {
ret = 0;
} else {
_alpm_log(handle, ALPM_LOG_DEBUG, "key lookup failed: WKD imported wrong fingerprint\n");
}
}
gpgme_key_unref(key);
@@ -353,14 +359,18 @@ static int key_search_keyserver(alpm_handle_t *handle, const char *fpr,
} else {
pgpkey->fingerprint = key->subkeys->keyid;
}
pgpkey->uid = key->uids->uid;
pgpkey->name = key->uids->name;
pgpkey->email = key->uids->email;
/* we are probably going to fail importing, but continue anyway... */
if(key->uids != NULL) {
pgpkey->uid = key->uids->uid;
pgpkey->name = key->uids->name;
pgpkey->email = key->uids->email;
}
pgpkey->created = key->subkeys->timestamp;
pgpkey->expires = key->subkeys->expires;
pgpkey->length = key->subkeys->length;
pgpkey->revoked = key->subkeys->revoked;
/* Initialize with '?', this is overwritten unless public key
* algorithm is unknown. */
pgpkey->pubkey_algo = '?';
@@ -516,7 +526,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
if(question.import) {
/* Try to import the key from a WKD first */
if(email_from_uid(uid, &email) == 0) {
ret = key_import_wkd(handle, email);
ret = key_import_wkd(handle, email, fpr);
free(email);
}
@@ -529,7 +539,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
ret = 0;
} else {
_alpm_log(handle, ALPM_LOG_ERROR,
_("key \"%s\" could not be imported\n"), fetch_key.uid);
_("key \"%s\" could not be imported\n"), fpr);
}
} else {
_alpm_log(handle, ALPM_LOG_ERROR,

View File

@@ -1,7 +1,7 @@
/*
* signing.h
*
* Copyright (c) 2008-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2008-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

View File

@@ -1,7 +1,7 @@
/*
* sync.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -470,7 +470,6 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
for(j = i->next; j; j = j->next) {
alpm_pkg_t *pkg2 = j->data;
if(strcmp(pkg1->filename, pkg2->filename) == 0) {
alpm_list_free(resolved);
ret = -1;
handle->pm_errno = ALPM_ERR_TRANS_DUP_FILENAME;
_alpm_log(handle, ALPM_LOG_ERROR, _("packages %s and %s have the same filename: %s\n"),
@@ -480,6 +479,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
}
if(ret != 0) {
alpm_list_free(resolved);
goto cleanup;
}
@@ -732,7 +732,7 @@ static int find_dl_candidates(alpm_handle_t *handle, alpm_list_t **files)
handle->pm_errno = ALPM_ERR_SERVER_NONE;
_alpm_log(handle, ALPM_LOG_ERROR, "%s: %s\n",
alpm_strerror(handle->pm_errno), repo->treename);
return 1;
return -1;
}
ASSERT(spkg->filename != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1));
@@ -1109,6 +1109,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
errors++;
*data = alpm_list_add(*data, strdup(spkg->filename));
free(filepath);
_alpm_pkg_free(pkgfile);
continue;
}
free(filepath);

View File

@@ -1,7 +1,7 @@
/*
* sync.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>

View File

@@ -1,7 +1,7 @@
/*
* trans.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>

View File

@@ -1,7 +1,7 @@
/*
* trans.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>

View File

@@ -1,7 +1,7 @@
/*
* util.c
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -40,8 +40,7 @@
#include <archive_entry.h>
#ifdef HAVE_LIBSSL
#include <openssl/md5.h>
#include <openssl/sha.h>
#include <openssl/evp.h>
#endif
#ifdef HAVE_LIBNETTLE
@@ -349,6 +348,11 @@ int _alpm_unpack(alpm_handle_t *handle, const char *path, const char *prefix,
entryname = archive_entry_pathname(entry);
if(entryname == NULL) {
ret = 1;
goto cleanup;
}
/* If specific files were requested, skip entries that don't match. */
if(list) {
char *entry_prefix = NULL;
@@ -659,6 +663,13 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
"/", strerror(errno));
exit(1);
}
/* bash assumes it's being run under rsh/ssh if stdin is a socket and
* sources ~/.bashrc if it thinks it's the top-level shell.
* set SHLVL before running to indicate that it's a child shell and
* disable this behavior */
setenv("SHLVL", "1", 0);
/* bash sources $BASH_ENV when run non-interactively */
unsetenv("BASH_ENV");
umask(0022);
_alpm_reset_signals();
execv(cmd, argv);
@@ -916,7 +927,8 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
static int md5_file(const char *path, unsigned char output[16])
{
#if HAVE_LIBSSL
MD5_CTX ctx;
EVP_MD_CTX *ctx;
const EVP_MD *md = EVP_get_digestbyname("MD5");
#else /* HAVE_LIBNETTLE */
struct md5_ctx ctx;
#endif
@@ -933,7 +945,8 @@ static int md5_file(const char *path, unsigned char output[16])
}
#if HAVE_LIBSSL
MD5_Init(&ctx);
ctx = EVP_MD_CTX_create();
EVP_DigestInit_ex(ctx, md, NULL);
#else /* HAVE_LIBNETTLE */
md5_init(&ctx);
#endif
@@ -943,7 +956,7 @@ static int md5_file(const char *path, unsigned char output[16])
continue;
}
#if HAVE_LIBSSL
MD5_Update(&ctx, buf, n);
EVP_DigestUpdate(ctx, buf, n);
#else /* HAVE_LIBNETTLE */
md5_update(&ctx, n, buf);
#endif
@@ -957,7 +970,8 @@ static int md5_file(const char *path, unsigned char output[16])
}
#if HAVE_LIBSSL
MD5_Final(output, &ctx);
EVP_DigestFinal_ex(ctx, output, NULL);
EVP_MD_CTX_destroy(ctx);
#else /* HAVE_LIBNETTLE */
md5_digest(&ctx, MD5_DIGEST_SIZE, output);
#endif
@@ -972,7 +986,8 @@ static int md5_file(const char *path, unsigned char output[16])
static int sha256_file(const char *path, unsigned char output[32])
{
#if HAVE_LIBSSL
SHA256_CTX ctx;
EVP_MD_CTX *ctx;
const EVP_MD *md = EVP_get_digestbyname("SHA256");
#else /* HAVE_LIBNETTLE */
struct sha256_ctx ctx;
#endif
@@ -989,7 +1004,8 @@ static int sha256_file(const char *path, unsigned char output[32])
}
#if HAVE_LIBSSL
SHA256_Init(&ctx);
ctx = EVP_MD_CTX_create();
EVP_DigestInit_ex(ctx, md, NULL);
#else /* HAVE_LIBNETTLE */
sha256_init(&ctx);
#endif
@@ -999,7 +1015,7 @@ static int sha256_file(const char *path, unsigned char output[32])
continue;
}
#if HAVE_LIBSSL
SHA256_Update(&ctx, buf, n);
EVP_DigestUpdate(ctx, buf, n);
#else /* HAVE_LIBNETTLE */
sha256_update(&ctx, n, buf);
#endif
@@ -1013,7 +1029,8 @@ static int sha256_file(const char *path, unsigned char output[32])
}
#if HAVE_LIBSSL
SHA256_Final(output, &ctx);
EVP_DigestFinal_ex(ctx, output, NULL);
EVP_MD_CTX_destroy(ctx);
#else /* HAVE_LIBNETTLE */
sha256_digest(&ctx, SHA256_DIGEST_SIZE, output);
#endif

View File

@@ -1,7 +1,7 @@
/*
* util.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-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

View File

@@ -8,7 +8,7 @@ project('pacman',
'sysconfdir=/etc',
'localstatedir=/var',
],
meson_version : '>= 0.51')
meson_version : '>= 0.56')
libalpm_version = '13.0.1'
@@ -26,14 +26,15 @@ MANDIR = join_paths(PREFIX, get_option('mandir'))
BUILDSCRIPT = get_option('buildscript')
LIBMAKEPKGDIR = join_paths(PREFIX, DATAROOTDIR, 'makepkg')
PKGDATADIR = join_paths(PREFIX, DATAROOTDIR, meson.project_name())
KEYRINGDIR = join_paths(PREFIX, DATAROOTDIR, get_option('keyringdir'))
PYTHON = import('python').find_installation('python3')
LDCONFIG = get_option('ldconfig')
MESON_MAKE_SYMLINK = join_paths(meson.source_root(), 'build-aux/meson-make-symlink.sh')
MESON_MAKE_SYMLINK = join_paths(meson.project_source_root(), 'build-aux/meson-make-symlink.sh')
BASH = find_program('bash4', 'bash')
if BASH.found()
bash_version = run_command(BASH, '-c', 'IFS=.; echo "${BASH_VERSINFO[*]:0:3}"').stdout()
bash_version = run_command(BASH, '-c', 'IFS=.; echo "${BASH_VERSINFO[*]:0:3}"', check: true).stdout()
have_bash = bash_version.version_compare('>= 4.4.0')
endif
@@ -43,7 +44,7 @@ endif
bashcompletion = dependency('bash-completion', required : false)
if bashcompletion.found()
BASHCOMPDIR = bashcompletion.get_pkgconfig_variable('completionsdir')
BASHCOMPDIR = bashcompletion.get_variable(pkgconfig: 'completionsdir')
else
BASHCOMPDIR = join_paths(DATAROOTDIR, 'bash-completion/completions')
endif
@@ -53,7 +54,8 @@ if get_option('use-git-version')
find_program('git'),
'describe',
'--abbrev=4',
'--dirty').stdout().strip().strip('v')
'--dirty',
check: true).stdout().strip().strip('v')
else
PACKAGE_VERSION = meson.project_version()
endif
@@ -90,6 +92,11 @@ endif
libarchive = dependency('libarchive',
version : '>=3.0.0',
static : get_option('buildstatic'))
if libarchive.version().version_compare('>=3.6.0')
bsdtar_no_read_sparse = '--no-read-sparse'
else
bsdtar_no_read_sparse = ''
endif
libcurl = dependency('libcurl',
version : '>=7.55.0',
@@ -97,7 +104,7 @@ libcurl = dependency('libcurl',
static : get_option('buildstatic'))
conf.set('HAVE_LIBCURL', libcurl.found())
needed_gpgme_version = '>=1.3.0'
needed_gpgme_version = '>=1.12.0'
gpgme = dependency('gpgme',
version : needed_gpgme_version,
required : get_option('gpgme'),
@@ -183,6 +190,7 @@ endif
if get_option('debug')
extra_cflags = [
'-pedantic',
'-Wcast-align',
'-Wclobbered',
'-Wempty-body',
@@ -230,7 +238,7 @@ strip_static = '--strip-debug'
file_seccomp = get_option('file-seccomp')
# meson-git has find_program('file', required: false, version: '>=5.38')
filever = run_command('sh', '-c', 'file --version | sed -n "s/^file-\(.*\)/\\1/p"').stdout()
filever = run_command('sh', '-c', 'file --version | sed -n "s/^file-\(.*\)/\\1/p"', check: true).stdout()
if file_seccomp.enabled() or ( file_seccomp.auto() and filever.version_compare('>= 5.38') )
filecmd = 'file -S'
endif
@@ -245,7 +253,7 @@ elif os.contains('bsd') or os == 'dragonfly'
inodecmd = 'stat -f \'%i %N\''
endif
chost = run_command(cc, '-dumpmachine').stdout().strip()
chost = run_command(cc, '-dumpmachine', check: true).stdout().strip()
carch = chost.split('-')[0]
# annoyingly, we have to maintain two sets of configuration_data which is
@@ -260,8 +268,9 @@ substs.set('LOCALEDIR', LOCALEDIR)
substs.set('sysconfdir', SYSCONFDIR)
substs.set('localstatedir', LOCALSTATEDIR)
substs.set('PKGDATADIR', PKGDATADIR)
substs.set('KEYRINGDIR', KEYRINGDIR)
substs.set('PREFIX', PREFIX)
substs.set('BASH', BASH.path())
substs.set('BASH', BASH.full_path())
substs.set('PACKAGE_VERSION', PACKAGE_VERSION)
substs.set('PACKAGE_NAME', meson.project_name())
substs.set('BUILDSCRIPT', BUILDSCRIPT)
@@ -273,6 +282,7 @@ substs.set('LIBMAKEPKGDIR', LIBMAKEPKGDIR)
substs.set('STRIP_BINARIES', strip_binaries)
substs.set('STRIP_SHARED', strip_shared)
substs.set('STRIP_STATIC', strip_static)
substs.set('BSDTAR_NO_READ_SPARSE', bsdtar_no_read_sparse)
subdir('lib/libalpm')
subdir('src/common')
@@ -311,7 +321,7 @@ libalpm_a = static_library(
'alpm_objlib',
libalpm_sources,
# https://github.com/mesonbuild/meson/issues/3937
objects : libcommon.extract_all_objects(),
objects : libcommon.extract_all_objects(recursive: true),
include_directories : includes,
gnu_symbol_visibility : 'hidden',
dependencies : alpm_deps)
@@ -373,7 +383,7 @@ executable(
foreach wrapper : script_wrappers
cdata = configuration_data()
cdata.set_quoted('BASH', BASH.path())
cdata.set_quoted('BASH', BASH.full_path())
cdata.set_quoted('BUILDDIR', wrapper[2])
cdata.set_quoted('REAL_PROGPATH', wrapper[1].full_path())
@@ -381,7 +391,7 @@ foreach wrapper : script_wrappers
# directory. Use configure_file instead of a custom_target to ensure that
# permissions on the input script wrapper are preserved.
configure_file(
input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
input : join_paths(meson.project_source_root(), 'build-aux', 'script-wrapper.sh.in'),
output : wrapper[0],
configuration : cdata)
endforeach
@@ -392,6 +402,12 @@ configure_file(
configuration : substs,
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(
input : 'etc/pacman.conf.in',
output : 'pacman.conf',
@@ -415,10 +431,10 @@ foreach path : [
endforeach
TEST_ENV = environment()
TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.source_root(), 'scripts/library/'))
TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.build_root(), 'scripts/libmakepkg/'))
TEST_ENV.set('PMTEST_UTIL_DIR', meson.build_root() + '/')
TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.build_root(), 'scripts/'))
TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.project_source_root(), 'scripts/library/'))
TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.project_build_root(), 'scripts/libmakepkg/'))
TEST_ENV.set('PMTEST_UTIL_DIR', meson.project_build_root() + '/')
TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.project_build_root(), 'scripts/'))
subdir('test/pacman')
subdir('test/scripts')
@@ -433,6 +449,7 @@ message('\n '.join([
' localstatedir : @0@'.format(LOCALSTATEDIR),
' database dir : @0@'.format(join_paths(LOCALSTATEDIR, 'lib/pacman/')),
' cache dir : @0@'.format(join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/')),
' keyringdir : @0@'.format(KEYRINGDIR),
' compiler : @0@ @1@'.format(cc.get_id(), cc.version()),
'',
' Architecture : @0@'.format(carch),

View File

@@ -26,6 +26,9 @@ option('buildscript', type : 'string', value : 'PKGBUILD',
option('datarootdir', type : 'string', value : 'share',
description : 'FIXME')
option('keyringdir', type : 'string', value: 'pacman/keyrings',
description : 'Where to look for keyring files under datarootdir')
option('makepkg-template-dir', type : 'string', value : '/usr/share/makepkg-template',
description : 'template dir used by makepkg-template')

View File

@@ -586,38 +586,38 @@ _pacman_conf() {
esac
}
_key_shortopts=(
_pacman_key_shortopts=(
'-h[show help]'
'-a[Add the specified keys (empty for stdin)]: :_files'
'-d[Remove the Specified keyids]:*: :_keys'
'-e[Export the specified or all keyids]:*: :_keys'
'-f[List fingerprint for specified or all keyids]:*: :_keys'
'-l[List the specified or all keys]:*: :_keys'
'-r[Fetch the specified keyids]:*: :_keys'
'-d[Remove the Specified keyids]:*: :_pacman_key_list'
'-e[Export the specified or all keyids]:*: :_pacman_key_list'
'-f[List fingerprint for specified or all keyids]:*: :_pacman_key_list'
'-l[List the specified or all keys]:*: :_pacman_key_list'
'-r[Fetch the specified keyids]:*: :_pacman_key_list'
'-u[Update the trustdb of pacman]'
'-v[Verify the file specified by the signature]: :_files -g "*.sig"'
'-V[Show program version]'
)
_key_longopts=(
_pacman_key_longopts=(
'--help[show help]'
'--add[Add the specified keys (empty for stdin)]: :_files'
'--delete[Remove the Specified keyids]:*: :_keys'
'--export[Export the specified or all keyids]:*: :_keys'
'--finger[List fingerprint for specified or all keyids]:*: :_keys'
'--list-keys[List the specified or all keys]:*: :_keys'
'--recv-keys[Fetch the specified keyids]:*: :_keys'
'--delete[Remove the Specified keyids]:*: :_pacman_key_list'
'--export[Export the specified or all keyids]:*: :_pacman_key_list'
'--finger[List fingerprint for specified or all keyids]:*: :_pacman_key_list'
'--list-keys[List the specified or all keys]:*: :_pacman_key_list'
'--recv-keys[Fetch the specified keyids]:*: :_pacman_key_list'
'--updatedb[Update the trustdb of pacman]'
'--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
'--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-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
'--init[Ensure the keyring is properly initialized]'
'--list-sigs[List keys and their signatures]:*: :_keys'
'--lsign-key[Locally sign the specified keyid]:*: :_keys'
'--populate[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings'
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
'--list-sigs[List keys and their signatures]:*: :_pacman_key_list'
'--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@'
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_pacman_key_list'
)
_pacman_key_options=(
@@ -631,13 +631,13 @@ _pacman_key() {
--*)
_arguments -s : \
"$_pacman_key_options[@]" \
"$_key_longopts[@]"
"$_pacman_key_longopts[@]"
;;
-*)
_arguments -s : \
"$_pacman_key_options[@]" \
"$_key_shortopts[@]" \
"$_key_longopts[@]"
"$_pacman_key_shortopts[@]" \
"$_pacman_key_longopts[@]"
;;
*)
i=$#
@@ -648,13 +648,13 @@ _pacman_key() {
--*)
_arguments -s : \
"$_pacman_key_options[@]" \
"$_key_longopts[@]"
"$_pacman_key_longopts[@]"
;;
-*)
_arguments -s : \
"$_pacman_key_options[@]" \
"$_key_shortopts[@]" \
"$_key_longopts[@]"
"$_pacman_key_shortopts[@]" \
"$_pacman_key_longopts[@]"
;;
*)
return 1
@@ -664,7 +664,7 @@ _pacman_key() {
esac
}
_keys() {
_pacman_key_list() {
local keylist keys
keylist=$(pacman-key --list-keys 2>/dev/null | awk '
$1 == "pub" {
@@ -733,7 +733,7 @@ _makepkg_longopts=(
'--check[Run check() function in the PKGBUILD]'
'--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
'--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]'
'--nocheck[Do not run the check() function in the PKGBUILD]'
'--noprepare[Do not run the prepare() function in the PKGBUILD]'

View File

@@ -0,0 +1,38 @@
#!/bin/bash
#
# autodep.sh - functions for automatically adding depends/provides
#
# Copyright (c) 2021-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_AUTODEP_SH" ]] && return
LIBMAKEPKG_AUTODEP_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
declare -a autodep_functions
for lib in "$LIBRARY/autodep/"*.sh; do
source "$lib"
done
readonly -a autodep_functions
generate_autodeps() {
for func in ${autodep_functions[@]}; do
$func
done
}

View File

@@ -0,0 +1,75 @@
#!/bin/bash
#
# library_depends.sh - Automatically add library requirements to depends
#
# Copyright (c) 2021-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_AUTODEP_LIBRARY_DEPENDS_SH" ]] && return
LIBMAKEPKG_AUTODEP_LIBRARY_DEPENDS_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
autodep_functions+=('library_depends')
library_depends() {
if check_option "autodeps" "y"; then
local dep filename libdeps libdir libpath prefix sofile
declare -a libdeps
while IFS= read -rd '' filename; do
for sofile in $(LC_ALL=C readelf -d $filename 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
# get the full path of the library
libpath=$(ldd $filename | sed -nr "s/.$sofile => (.*) \(.*\)/\1/p")
# if ldd can not find the library, it is likely part of the package and not in filesystem
if [[ -z $libpath ]]; then
continue
fi
# skip if the library is part of the package
if [[ -e "$pkgdir/$libpath" ]]; then
continue
fi
# find the prefix for the dependency
libpath=${libpath#/}
libpath=${libpath%/*}
unset prefix
for libdir in ${LIB_DIRS[@]}; do
if [[ ${libdir/*:} == ${libpath} ]]; then
prefix=${libdir/:*}
fi
done
if [[ -z ${prefix} ]]; then
continue
fi
# only add library dependency if it exists - this helps bootstraping dependencies
if [[ $(run_pacman -T "$prefix:$sofile") ]]; then
continue
fi
libdeps+=("$prefix:$sofile")
done
done < <(find "$pkgdir" -type f -perm -u+x -print0)
depends+=($(printf '%s\n' "${libdeps[@]}" | LC_ALL=C sort -u))
fi
}

View File

@@ -0,0 +1,56 @@
#!/bin/bash
#
# library_provides.sh - Automatically add a packages libraries to provides
#
# Copyright (c) 2021-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_AUTODEP_LIBRARY_PROVIDES_SH" ]] && return
LIBMAKEPKG_AUTODEP_LIBRARY_PROVIDES_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
autodep_functions+=('library_provides')
library_provides() {
if check_option "autodeps" "y"; then
for lib in ${LIB_DIRS[@]}; do
dir=${lib/*:}
prefix=${lib/:*}
if [[ ! -d "$pkgdir/$dir" ]]; then
continue;
fi
mapfile -t filenames < <(find "$pkgdir/$dir" -maxdepth 1 -type f | LC_ALL=C sort)
for fn in "${filenames[@]}"; do
# check we have a shared library
if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
# extract library soname
local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
if [[ -z "$sofile" ]]; then
# the library has no soname
continue
fi
provides+=("$prefix:$sofile")
fi
done
done
fi
}

View File

@@ -0,0 +1,18 @@
libmakepkg_module = 'autodep'
sources = [
'library_depends.sh.in',
'library_provides.sh.in',
]
foreach src : sources
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
custom_target(
libmakepkg_module + '_' + src.underscorify(),
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
input : src,
output : '@BASENAME@',
install : true,
install_dir : output_dir)
endforeach

View File

@@ -3,7 +3,7 @@
# buildenv.sh - functions for altering the build environment before
# compilation
#
# Copyright (c) 2015-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2015-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
@@ -25,18 +25,22 @@ LIBMAKEPKG_BUILDENV_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
declare -a buildenv_functions build_options
buildenv_vars=('CPPFLAGS' 'CFLAGS' 'CXXFLAGS' 'LDFLAGS' 'MAKEFLAGS' 'CHOST')
for lib in "$LIBRARY/buildenv/"*.sh; do
source "$lib"
done
readonly -a buildenv_functions build_options
readonly -a buildenv_functions buildenv_vars build_options
prepare_buildenv() {
# ensure this function runs first
buildenv_buildflags
for func in ${buildenv_functions[@]}; do
$func
done
# ensure all necessary build variables are exported
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST
export ${buildenv_vars[@]}
}

View File

@@ -2,7 +2,7 @@
#
# buildflags.sh - Clear user-specified buildflags if requested
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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
@@ -26,10 +26,9 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/option.sh"
build_options+=('buildflags')
buildenv_functions+=('buildenv_buildflags')
buildenv_buildflags() {
if check_option "buildflags" "n"; then
unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS
unset ${buildenv_vars[@]}
fi
}

View File

@@ -4,7 +4,7 @@
# ccache - Cache compilations and reuse them to save time on repetitions
# distcc - Distribute compilation of C and C++ across machines
#
# Copyright (c) 2007-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2007-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

View File

@@ -3,7 +3,7 @@
# debugflags.sh - Specify flags for building a package with debugging
# symbols
#
# Copyright (c) 2012-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2012-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
@@ -29,12 +29,10 @@ source "$LIBRARY/util/option.sh"
buildenv_functions+=('buildenv_debugflags')
buildenv_debugflags() {
if check_option "debug" "y"; then
DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
DEBUG_CFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
DEBUG_CXXFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
CFLAGS+=" $DEBUG_CFLAGS"
CXXFLAGS+=" $DEBUG_CXXFLAGS"
RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
fi
}

View File

@@ -3,7 +3,7 @@
# lto.sh - Specify flags for building a package with link-time
# optimisation
#
# Copyright (c) 2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2021-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
@@ -30,8 +30,9 @@ build_options+=('lto')
buildenv_functions+=('buildenv_lto')
buildenv_lto() {
if check_option "lto" "y"; then
CFLAGS+=" -flto"
CXXFLAGS+=" -flto"
if check_option "lto" "y" && ! check_option "buildflags" "n"; then
CFLAGS+=" ${LTOFLAGS:--flto}"
CXXFLAGS+=" ${LTOFLAGS:--flto}"
LDFLAGS+=" ${LTOFLAGS:--flto}"
fi
}

View File

@@ -2,7 +2,7 @@
#
# makeflags.sh - Clear user-specified makeflags if requested
#
# Copyright (c) 2007-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2007-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

View File

@@ -6,6 +6,7 @@ sources = [
'debugflags.sh.in',
'lto.sh.in',
'makeflags.sh.in',
'rust.sh.in',
]
foreach src : sources

View 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
}

View File

@@ -2,7 +2,7 @@
#
# executable.sh - confirm presence of dependent executables
#
# Copyright (c) 2018-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2018-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

View File

@@ -2,7 +2,7 @@
#
# ccache.sh - Confirm presence of ccache binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

View File

@@ -2,7 +2,7 @@
#
# checksum.sh - Confirm presence of binaries for checksum operations
#
# Copyright (c) 2016-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2016-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

View File

@@ -0,0 +1,38 @@
#!/usr/bin/bash
#
# debugedit.sh - Confirm presence of debugedit binary
#
# 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_EXECUTABLE_DEBUGEDIT_SH" ]] && return
LIBMAKEPKG_EXECUTABLE_DEBUGEDIT_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
source "$LIBRARY/util/option.sh"
executable_functions+=('executable_debugedit')
executable_debugedit() {
if check_option "debug" "y"; then
if ! type -p debugedit >/dev/null; then
error "$(gettext "Cannot find the %s binary required for including source files in debug packages.")" "debugedit"
return 1
fi
fi
}

View File

@@ -2,7 +2,7 @@
#
# distcc.sh - Confirm presence of distcc binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

View File

@@ -2,7 +2,7 @@
#
# fakeroot.sh - Confirm presence of fakeroot binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

View File

@@ -2,7 +2,7 @@
#
# gpg.sh - Confirm presence of gpg binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

View File

@@ -2,7 +2,7 @@
#
# gzip.sh - Confirm presence of gzip binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

View File

@@ -5,6 +5,7 @@ sources = [
'checksum.sh.in',
'distcc.sh.in',
'fakeroot.sh.in',
'debugedit.sh.in',
'gpg.sh.in',
'gzip.sh.in',
'pacman.sh.in',

View File

@@ -2,7 +2,7 @@
#
# pacman.sh - Confirm presence of pacman binary
#
# Copyright (c) 2012-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2012-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

View File

@@ -2,7 +2,7 @@
#
# strip.sh - Confirm presence of strip binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

View File

@@ -2,7 +2,7 @@
#
# sudo.sh - Confirm presence of sudo binary
#
# Copyright (c) 2011-2021 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011-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

Some files were not shown because too many files have changed in this diff Show More