Commit graph

7102 commits

Author SHA1 Message Date
morganamilo
15be417c17 remove unused variable in meson.build
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09 22:05:33 +10:00
morganamilo
31c42c338b Match initial download message with progress message
When initially downloading a package, pacman will display a message
like:
	wine-6.6-1-x86_64.pkg.tar.zst downloading...

Then when the download progresses the message will change to:
	wine-6.6-1-x86_64.pkg.tar.zst

So instead lets match the progress message so there's no sudden change.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09 22:01:30 +10:00
morganamilo
ef14c3380d libalpm: fix error when installing cached packages without signatures
With a repo using "SigLevel = Optional" and a package already downloaded
into the cache, download_files() returns 1 (via _alpm_download) to indicate
no files were downloaded.  This causes installation of the package to
fail.

Explicitly check that download_files() returns -1 (error) rather than
non-zero.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-03 12:49:35 +10:00
Andrew Gregory
72238aa046 call download progress callback for signatures
pacman may not care about them, but other front-ends do.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01 12:08:14 +10:00
Andrew Gregory
eb1a63a516 alpm_db_update: indicate if dbs were up to date
Restore the prior indicator whether or not databases were up to date.
0 is used to indicate if *any* db was actually updated as callers are
more likely to care about that than if *all* dbs were updated.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01 12:08:14 +10:00
Andrew Gregory
0ff94ae85d fix downloading multiple urls with XferCommand
An extra break causes _alpm_download to break out of the payload loop as
soon as it sees a successful url download with XferCommand.

Fixes: FS#70608 - -U fails to download all files with XferCommand

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01 12:08:14 +10:00
Andrew Gregory
8faf749fd1 pmserve: allow serving byte objects directly
Useful for serving in-memory package files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01 12:08:14 +10:00
Andrew Gregory
ab622b4881 pmpkg: add makepkg_bytes
Builds the package file in memory.  Useful with the built-in server.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01 12:08:14 +10:00
Andrew Gregory
e7fa35baa2 add front-end provided context to callbacks
Our callbacks require front-ends to maintain state in order to provide
reasonable output.  The new download callback in particular requires
much more complex state information to be saved.  Without the ability to
provide context, state must be saved globally, which may not be possible
for all front-ends.  Scripting language bindings in particular have no
way to register per-handle callbacks without some form of context.

Implements: FS#12721

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2021-05-01 12:08:14 +10:00
Eli Schwartz
523c393e9e makepkg: document BUILDTOOL and BUILDTOOLVER environmental variables
These were added without documentation in commit
a33cdac10b

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-01 12:08:01 +10:00
Allan McRae
558d08d821 Prepare translations for next release
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23 10:44:27 +10:00
Andrew Gregory
15270d4a34 update NEWS for 5.2.2
Signed-off-by: Andrew Gregory <andrew@archlinux.org>
2021-04-23 10:27:36 +10:00
Eli Schwartz
8fe5520709 meson: make our symlinking script more portable
We do not need the --relative case as it is dead code (we only ever link
a filename without directory components).

For the rest, GNU-specific ln -T does two things:

- if the link name is an existing directory, ln fails instead of
  creating a surprising link inside the directory
- if the link name is a symlink to a directory, ln treats it as a file,
  and due to -f, unlinks it

The second case can be portably solved by ln -n, and both cases can be
solved by doing what the original autotools Makefile did: rm -f && ln -s

If the file exists, it will be removed. If it cannot be removed, it must
be an ordinary directory, and the script aborts with an error.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23 09:48:08 +10:00
morganamilo
079b9d44e2 Only enable total progress when downloads > 1
Otherwise the total progress will just match the one package and be
pretty useless.
2021-04-23 09:45:27 +10:00
morganamilo
41f9c50abf Always enable TotalDownload
Previously TotalDownload would switch the % download from per package to
overall. Meaning you had a choice of which information to dispplay.

Now with parallel downloads TotalDownload adds an extra progress bar.
There's no reason to have this an off by default feature. Let's just
make it always on.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23 09:43:30 +10:00
morganamilo
63ad8b8b76 pacman: fix total bar leaking
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23 09:40:38 +10:00
Levente Polyak
a33cdac10b makepkg: add tool details to buildinfo to aid determining flags
If a makepkg consumer uses a build wrapper to override compiler
flags this may lead to unreproducible packages as there is no way to
know which exact files were used for tooling that tries to reproduce
said package.

Instead of vendoring the whole used makepkg.conf file into buildinfo,
this patch adds two new properties to the .BUILDINFO file named
BUILDTOOL and BUILDTOOLVER which by default are simply makepkg's own
values. Downstream consumers may override those values: For example in
Arch Linux the devtools package can set those values and allow
reproducible builds tooling to fetch the appropriate makepkg.conf.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-23 09:07:40 +10:00
Dan McGee
3179db108a Add support for multiple 'Architecture' values
This allows architecture to be multivalued. On x86-64 machines, this
could be something like:
    Architecture = x86-64-v3 x86-64

We use the first specified Architecture value in mirrorlist $arch
variable replacement, as this is backwards-compatible and sane.

Original-patch-by: Dan McGee <dan@archlinux.org>
Patch-updated-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-22 00:15:21 +10:00
morganamilo
abdb4d7fa6 pacman: stop eta timer breaking allignment
When the download estimate is over an hour the format displayed changes
from mm:ss to hh:mm:ss. This causes everything to be out of alignment
due to the extra characters.

So instead lets just go back to --:-- when the download => 100 minutes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 23:53:42 +10:00
Eli Schwartz
0699321b3c meson: make -uninstalled.pc correct
This pkg-config file is automatically created in the meson-uninstalled/
directory of the build tree, and points to the built artifacts there. If
this directory is added to PKG_CONFIG_PATH, it will be preferred over an
installed copy.

Making this work properly means it becomes trivially possible to build a
private copy of libalpm, and then compile other projects using it rather
than the system copy.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 17:51:44 +10:00
Mark Weiman
288cd1c74a Fix build error when SIGPOLL is not available
On Linux, SIGPOLL is a valid signal, but on systems like FreeBSD, it is
not. This patch does a preprocessor check to see if SIGPOLL is available
or not.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 17:29:24 +10:00
Mark Weiman
3688c947f8 Add an include for signal.h when needed
On Linux, signal.h is not required to have access to the signal
constants. On FreeBSD, this is not the case and requires signal.h to be
explicitly included.

This patch adds an include for signal.h in any source file that uses it.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 17:11:47 +10:00
Mark Weiman
207f0439ee meson.build: Fix detection of symbols
This patch changes the behavior of meson to define configuration options
*only* when the symbol checked is present. Currently, it defines all of
them in config.h whether the symbol exists or not and the code that
looks for it doesn't check the macro's value, but whether it's defined.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-19 17:08:40 +10:00
Jelle van der Waa
c294b7cb4c Update urls to not use www. for archlinux.org
www.archlinux.org now redirects to archlinux.org.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-08 10:14:33 +10:00
Jelle van der Waa
f09047f0b0 test: update mailing list url
The Arch Linux mailing lists are these days served from the lists
subdomain.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-08 10:14:30 +10:00
Eli Schwartz
2535611d6c makepkg: add PACMAN_AUTH configurable setting for sudo elevation
If specified, this will be used no matter what. If not, then we check if
sudo exists and use that, or else fall back on su.

Implements FS#32621

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-07 22:41:54 +10:00
Eli Schwartz
d6f8659443 ensure tests are parsed as TAP since they are, in fact, TAP
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-07 22:38:52 +10:00
Eli Schwartz
8aa2a48fc3 makepkg: fix the use of spaces in the localname:: component of sources
Broken via refactoring in commit aa6fe1160b
but for obvious reasons only one person in the last 9 years has ever
actually tried to do this. Still, it's technically correct to allow it.

Fixes FS#70254

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-07 22:38:34 +10:00
Andrew Gregory
9060058393 include retries and signatures in download count
Fixes: FS#69881

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-07 22:34:29 +10:00
Andrew Gregory
4bf7aa119d skip servers with too many errors
Keep track of errors from servers so that bad ones can be skipped once
a threshold is reached.  Key the error tracking off the hostname because
hosts may serve multiple repos under different url's and errors are
likely to be host-wide.

Implements: FS#29293.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-04-07 22:33:52 +10:00
Allan McRae
bdf6aa3fb7 libmakepkg: fix detection of source file names for debug packages
The current gcc build from git master give different output from
readelf:

gcc-10.2.0
$ readelf "hello" --debug-dump | grep hello
<11> DW_AT_name : (indirect string, offset: 0xbfc): hello.cpp

gcc-git
$ readelf "hello" --debug-dump | grep hello
<12> DW_AT_name : (indirect line string, offset: 0x0): hello.cpp

This causes the awk statement extracting the file name to fail as it
relied on the information being in the 8th field. Instead, extract
the information from the final field.

Fixes FS#70168

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-27 09:22:15 +10:00
Anatol Pomozov
1e60a5f006 Remove "total download" callback in favor of generic event callback
Total download callback called right before packages start downloaded.
But we already have an event for such event (ALPM_EVENT_PKG_RETRIEVE_START)
and it is naturally to use the event to pass information about expected
download size.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-25 11:39:03 +10:00
Eli Schwartz
9bf3d6a760 remove sed command lookup and hardcoding in edit-script.sh
We should not need to hardcode the path to sed as we simply don't care.
We don't check what kind of sed we found, and we're using the same one
we initially found on the PATH, which is surely still on the PATH.

At one point we did care to find the system copy of sed and hardcode it
in makepkg, because we also passed non-portable -i options to it and
makepkg needed to continue working on macOS even if some incompatible
GNU sed got installed afterward, elsewhere on the PATH. But this was
never relevant to the in-tree buildsystem script running sed.

In commit 3a814ee6bc we removed even that,
so we don't need to look it up at all.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-25 11:38:58 +10:00
Eli Schwartz
ede73f4d89 fix syntax error when running pacman-key --help
In commit 0f75ab3224 some unbalanced
quotes were added by the committer while editing an error message.

Fixes FS#69865

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-06 12:01:26 +10:00
Allan McRae
c118a61f62 Strip LTO symbols from distributed .a/.o files
GCC's LTO implementation emits bytecodes into .o files it generates.
These bytecodes are _not_ considered stable from one release of GCC
to the next. There we need to strip the LTO bytecode out of any .o
(and .a) file that gets installed into the package.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-03 14:35:52 +10:00
Allan McRae
4a0891f49d Add link time optimization support to makepkg
Add the 'lto' option to enable building with link time optimization
by adding '-flto' to both CFLAGS and CXXFLAGS.  The 'lto' option can
be specificed both in the PKGBUILD or by setting the default in
makepkg.conf.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-03 14:35:45 +10:00
Allan McRae
17f9911ffc Update copyright year
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-03-01 12:22:20 +10:00
Morten Linderud
0f75ab3224 pacman-key: --refresh-keys queries WKD before keyserver
With the recent outages of the keyservers there is a possibility of
`--refresh-keys` failing to fetch new keys. A lot of current key
distribution is done over WKD these days, and `pacman-key` has the
ability to use it for `--recv-key`.

There was a hope `gpg` would end up supporting WKD for the refresh
functionality, but this seems to be limited to expired keys fetched
through WKD. Since this functionality isn't yet available it makes sense
to stuff it into `pacman-key`.

The current implementation looks over all available keyids in the
keyring, attempts to fetch over WKD and then fall backs to keyservers if
no email has a valid WKD available. The downside of this approach is
that it takes a bit longer to refresh the keys, but it should be more
robust as the distribution should be providing their own WKDs.

Co-authored-by: Jonas Witschel <diabonas@archlinux.org>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-24 23:05:48 +10:00
Morten Linderud
7587153a44 libmakepkg: Support zstd decompression for sources
This enables us to extract files in the source array and ensures that we
can decompress files if the uncompressed signature is served.

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-24 22:51:14 +10:00
Emil Velikov
17d3da4777 Revert "ci: cache packages"
This reverts commit e348ba3881.

With the above commit we started caching the downloaded packages. Based
on some testing and, it saves ~30s in the "step_script" stage while
adding 18s for "Restoring/Saving cache". A net saving of ~10s.

With earlier commit, we no longer use an ancient image which also pulls
base-devel - thus the packages we have to download is minimal.

Now comparing the uncached "step_script", vs the cached one - it is
slowed by 2-3 seconds (1:01 -> 1:03), while we eliminate the 18s (and
growing) caching.

Tl:Dr: With up-to date image, package caching in not worth it - be that
time, disk or network wise.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-08 14:28:34 +10:00
Emil Velikov
cc1d23d333 ci: use official image
The archlinux/base have been deprecated. Since we depend on base-devel
simply use archlinux:base-devel

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-08 14:25:53 +10:00
Matti Niemenmaa
9e425cd1ea makepkg: Don't double-layer distcc on ccache
buildenv is set once for build() and a second time for package(). When
using both distcc and ccache, this lead to CCACHE_PREFIX="distcc distcc"
in package(), which breaks PKGBUILDs that execute the compiler in
package() because distcc complains:

    distcc[383041] (main) CRITICAL! distcc seems to have invoked itself
    recursively!

Avoid causing this error by only adding "distcc" to CCACHE_PREFIX if
it's not yet there.

Signed-off-by: Matti Niemenmaa <matti.niemenmaa+git@iki.fi>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-08 14:24:49 +10:00
Eli Schwartz
2b8d00b799 doxygen: fix missing parameter name
This was raising a warning during the build.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-08 14:24:18 +10:00
Eli Schwartz
3a23abb2ec support xattr when extracting packages
This permits storing the result of setcap during package() and applying
the resulting capabilities to the installed program. Formerly, it was
necessary to edit the binary after the fact (and thus dirty the file
according to -Qkk) by using an install scriptlet.

One problem that needs to be solved before this is useful, is preventing
the strip routine from destroying xattrs. This is taken care of in the
previous patch.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-08 14:23:45 +10:00
Eli Schwartz
88d054093c makepkg: don't let the strip routine mess up file attributes
It updates the stripped/objcopied file by creating a temp file,
chown/chmodding it, and replacing the original file. But upstream
binutils has CVE-worthy issues with this if running strip as root, and
some recent versions of strip don't play nicely with fakeroot.

Also, this has always destroyed xattrs. :/

Sidestep the issue by telling strip/objcopy to write to a temporary
file, and manually dump the contents of that back into the original
binary. Since the original binary is intact, albeit with different
contents, it retains its correct attributes in fakeroot.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-02-08 14:22:55 +10:00
morganamilo
ab549c8467 libalpm: fix total download reporting wrong total
When a package does not need to be downloaded but a signature does,
total download didn't count that towards the total.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:20:48 +10:00
Andrew Gregory
b40c5553b4 add --upgrade download tests
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:19:26 +10:00
Andrew Gregory
b82a975e76 pmtest: add ability to spawn simple http servers
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:19:16 +10:00
Andrew Gregory
ad84a572aa pmdb: add option to skip populating file:// server
Populating a file:// Server prevents any manually registered HTTP
servers from ever being used.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:19:01 +10:00
Andrew Gregory
743e041dbc add CACHE_FEXISTS and CACHE_FCONTENTS test rules
The existing CACHE_EXISTS rule takes a package, which is not suitable
for -U tests that need to be able to check for specific files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:18:37 +10:00