Commit graph

7133 commits

Author SHA1 Message Date
Charlie Sale
efb714b31c Order downloads by descending max_size
When downloading in parallel, sort by package size so that the larger
packages are queued first to fully leverage parallelism.
Addresses FS#70172

Signed-off-by: Charlie Sale <softwaresale01@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 10:34:00 +10:00
morganamilo
f951282bec pactest: add tests for downloading packages from a cdn
Test for downloads that redirect to some sort of cdn where the
redirected url does not relate to the original filename.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 10:34:00 +10:00
morganamilo
2ec6de96a6 only use effective url for urls containing .db or .pkg
Github and other sites redirect their downloads to a cdn. So the
download http://foo.org/myrepo.db may redirect to something like
https://cdn.foo.org/83749327439.

This then causes pacman to try and download the sig as
https://cdn.foo.org/83749327439.sig which is incorrect. In this case
pacman should append .sig to the original url.

However urls like https://archlinux.org/packages/community/x86_64/0ad/download/
Redirect to the mirror, so .sig has to appended after the redirects and
not before.

So we decide if we should append .sig on the original or effective url
based on if the effective url (minus the query part) has .db or .pkg in it.

Fixes FS#71148

---

v2: move variable decleration to start of block
v3: use dbext instead of db
2021-09-04 10:34:00 +10:00
morganamilo
c0026caab0 libalpm: Give -U downloads a random .part name if needed
archweb's download links all ended in /download. This cause all the temp
files to be named download.part. With parallel downloads this results in
multiple downloads to go to the same temp file and breaks the transaction.

Assign random temporary filenames to downloads from URLs that are either
missing a filename, or if the filename does not contain at least three
hyphens (as a well formed package filename does).

While this approach to determining when to use a temporary filename is
not 100% foolproof, it does keep nice looking download progress bar names
when a proper package filename is given. The only downside of not using
temporary files when provided with a filename  with three or more hyphens
is URLs created specifically to bypass temporary filename usage can not
be downloaded in parallel. We probably do not want to download packages
from such URLs anyway.

Fixes FS#71464

Modified-by: Allan McRae (do not use temporary files for realish URLs)
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 10:33:51 +10:00
Allan McRae
1c5a56884f libmakepkg: reproducibilty for python packages
Arch Linux has been setting PYTHONHASHSEED=0 to create deterministic
.pyc files.  After a thorough review by the Arch Security Team, setting
this variable was determined not to generated vulnerable .pyc files, as
when the loader loads the .pyc file and unmarshalls it, the internal
runtime will just populate the unordered data structures and use a new
runtime hash for them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-08-08 22:49:32 +10:00
Allan McRae
fc7986485c Gitlab CI: add bsdtar to Fedora install
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-08-04 23:19:12 +10:00
Eli Schwartz
2d198c1af9 libmakepkg: allow correctly sourcing when $LIBRARY is not set
We usually set this up to default to the build time configured install
location, but a couple of files crept in without this.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-08-04 21:59:32 +10:00
Andre Schröder
82aaee1a5c PKGBUILD.5: Fix typo
Signed-off-by: André Schröder <andre.schroedr@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-08-04 19:31:32 +10:00
Allan McRae
a193979cb6 makepkg: fix stripping of relocatable binaries with binutils>=2.37
Binutils commit 93df3340fd5ad32f784214fc125de71811da72ff enabled readelf
to report "Position-Independent Executable" files.  Fix stripping to
account for this change.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-08-04 18:52:08 +10:00
Jonas Witschel
b4383b8d00 doc: use localdate instead of pacman_date to improve reproducibility
pacman_date is set to the current date during build without respecting
SOURCE_DATE_EPOCH. As a result, a build cannot be fully reproduced on a later
date because the date embedded into the man pages does not match.

In contrast, the built-in asciidoc attribute "localdate" respects
SOURCE_DATE_EPOCH and has the desired ISO 8601 format, so simply use that
instead of the custom "pacman_date" attribute.

Fixes: FS#71154

Signed-off-by: Jonas Witschel <diabonas at archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-07-01 11:19:18 +10:00
morganamilo
0147de169a libalpm: always name signatures after original file
If the original download redirects to to a different url then alpm would
try to name the sig file after the url instead of <original_file>.sig.
Instead force this naming scheme regardless of url.

Fixes FS#71274

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-06-24 23:51:11 +10:00
David Passens
5163a319c9 PKGBUILD.5: Add fossil to list of supported VCSs
Since commit 08f4ae70, makepkg supports downloading from fossil.
However, the PKGBUILD man page was only partially updated to reflect
this change.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-06-24 20:48:05 +10:00
morganamilo
542910d684 libalpm: fix double free when importing key
Comit 5151de30 tried to fix leaking memory when importing a key. However
key_search_keyserver() writes to the key passed in, making the original
uid and fingerprint unreachable, causing the new uid and fingerprint to
double free.

Fixes FS#71107

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-06-07 14:14:19 +10:00
morganamilo
238109760d libalpm: call retry events for sig downlods
Around the same time retry events were added, there was a patch to pass
sig download events to the frontend. The retry code was not updated to
account for this.

Signed-off-by: morganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-06-07 14:14:19 +10:00
morganamilo
2e83a52205 pactest: add test case for servers returning 404 with body
Signed-off-by: morganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-06-07 14:14:08 +10:00
Allan McRae
3401f9e142 libalpm: prevent download error pages ending up in package files
Some servers respond with error pages (e.g. 404.html) when a package is
not present. These were getting written to packages before moving onto
the next server. Reset the download progress on 400+ error conditions
to avoid this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-06-03 09:30:10 +10:00
Christian Hesse
6f35ce1570 doc/pacman.conf: ParallelDownloads expects a value
This can not be specified on its own but requires a value.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-21 09:37:51 +10:00
Allan McRae
75eb3f4cd3 Release 6.0.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-20 13:35:27 +10:00
Allan McRae
b8dcb4b33c Pull translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-20 12:33:05 +10:00
Eli Schwartz
8d3735d86a update NEWS for 6.0.0 release
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-20 12:24:47 +10:00
Eli Schwartz
739183b8c5 update old NEWS entry with bugtracker ticket reference
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-20 11:35:24 +10:00
morganamilo
b44e82e479 libalpm: remove unused error value
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-20 11:34:00 +10:00
Eli Schwartz
e176b8ec19 makepkg: squelch readelf warnings from debug stripping
readelf --debug-dump sometimes reports inscrutable warnings which don't
actually affect our extraction of source filenames. For example:

readelf: Warning: There is a hole [0xd3d - 0xd89] in .debug_loc section.

Now gcc 11 seems to have dramatically increased the number of warnings:

readelf: Warning: Corrupt offset (0x0000008e) in range entry 9
[...]
readelf: Warning: Corrupt offset (0x000010f0) in range entry 250

The resulting debuginfo created by the very same toolchain works fine,
as does the list of source filenames. But the warnings are quite
noisy... send them to /dev/null since they are not actionable in the
context of getting source files

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-19 19:05:34 +10:00
Allan McRae
0e655dd492 Update README for pacman-6.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-18 21:00:03 +10:00
Allan McRae
7464062ad6 Update maintainers list
Update to relflect the current state of affairs. Add Morgan, drop Dave.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-17 20:13:48 +10:00
Allan McRae
58fde86668 Use attribute to declare case statement fallthroughs
Clang does not recognise the comment style notification of expected
case statement fallthrough.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-17 20:02:21 +10:00
Allan McRae
17ccc2f9c2 Silence new warning with gcc-11
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-17 17:09:18 +10:00
morganamilo
618fa4f675 libalpm: check for duplicate filenames
This partially fixes FS#67850

It fixes the case for -S'ing packages but not -U'ing urls.

pacman -S a/a b/b
resolving dependencies...
error: packages a and b have the same filename: a-1-1-any.pkg.tar.zst
error: failed to prepare transaction (duplicate filename)

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-10 07:58:44 +10:00
morganamilo
d6ffa7f561 fix formatting mistake
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-10 07:58:25 +10:00
morganamilo
8bf17b29a2 libalpm: fix download rates becoming negative
When a download fails on one mirror a new download is started on the
next mirror. This causes the ammount downloaded to reset, confusing the
rate math and making it display a negative rate.

This is further complicated by the fact that a download may be resumed
from where it is or started over.

To account for this we alert the frontend that the download was
restarted. Pacman then starts the progress bar over.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09 23:28:04 +10:00
morganamilo
4fead44e3c libalpm: clone data on alpm_db_set_servers
Every alpm_option_set function clones the input so lets be more
consistent. Also this fixes servers not being sanatized.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-05-09 22:54:20 +10:00
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