Commit Graph

6333 Commits

Author SHA1 Message Date
Travis Burtrum abb057844e Add per-repo PinnedPubKey option
This sets curl's CURLOPT_PINNEDPUBLICKEY option in the built-in
downloader, or replaces %p in XferCommand.  This pins public
keys to ensure your TLS connection is not man-in-the-middled
without relying on CAs etc.  Probably most useful currently
for very small or single groups of servers.

It would obviously be best as a per-mirror option, but such
a thing currently does not exist.

Signed-off-by: Travis Burtrum <travis.archlinux@burtrum.org>
2016-10-31 02:12:31 -04:00
Ivy Foster fa06951d90 Represent bitfields as ints, not enums
Many bitfield variables are declared to be enums, because they are
generated using bitwise operations on enums such. However, their
actual values aren't necessary members of their parent enum, so
declaring them 'int' is more accurate.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Ivy Foster a55adb81d0 Add ALPM_ERR_OK to _alpm_errno_t
This allows functions which return an _alpm_errno_t to always return a
genuine _alpm_errno_t for consistency, even in cases where there are
no errors. Since ALPM_ERR_OK = 0, their callers can still simply check
'err = some_fn(); if (!err) { ... }'.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Ivy Foster a79be86f57 doc/pacman.8.txt: improve description of -Qt
Though correct, the wording of the description of Query's
-t/--unrequired option was confusing. Closes FS#48144.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Ivy Foster e8c35bea2b makepkg: print files with refs to $srcdir/$pkgdir
Since rewriting build_references() anyway, tweaked quoting.
Implements FS#31558.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Allan McRae 4c4ce473d6 Remove pactree
This has been moved to the pacman-contrib project.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Allan McRae 577701250d Use coreutils binaries for checking/generating checksums
If pacman is build against a crypto library other than openssl, it makes no
sense to require makepkg to use it.

The only currently considered alternative to openssl is nettle, which has no
binary for base64 encode/decode. This means that we could replace the hashing
cacluations with nettle-hash, but would require base64 from coreutils.

Given makepkg already relies heavily on coreutils, we might as well use all
the coreutils hashing binaries too.

This patch also improves the checking of required binaries for hashing
operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Florian Weigelt 603f087cd7 Allow replacing libcrypto with libnettle in pacman
Add a --with-nettle configure option that directs pacman to use the libnettle
hashing functions. Only one of the --with-libssl and --with-nettle configure
options can be specified.

[Allan: rewrote configure check]
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Alad Wenter 1f8f0bd9ac makepkg: Move parseopts from library to libmakepkg
parseopts is used in makepkg and other scripts such as pacman-key as a
getopt replacement.

Instead of including it in those scripts via a macro, move it to
libmakepkg/util/parseopts.sh and have scripts source this file where
appropriate.

To keep the parseopts test, a new variable was introduced:
PM_LIBMAKEPKG_DIR

Signed-off-by: Alad Wenter <alad@archlinux.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:54 +10:00
Allan McRae dfc78129be Generalise makepkg-wrapper to handle any script using libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:29 +10:00
Alad Wenter aca153bfa6 libmakepkg: generate all scripts
In order for the scripts to be used in testsuites, it is easiest to generate
all of them so they are found in the build directory (which may be different
to the source directory).

Signed-off-by: Alad Wenter <alad@archlinux.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:28 +10:00
Martin Kühne 8c55c0096c Use f_bavail for diskspace calculations
This should make pacman's behavior consistent with GNU coreutils df,
as well as follow advice from affected filesystems' devs as well as
`man statvfs`.

This fixes FS#37402

Signed-off-by: Martin Kühne <mysatyre@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-12 19:48:29 +10:00
Allan McRae ad27aa30fb Ensure makepkg-wrapper is built after makepkg
makepkg-wrapper did not get rebuilt if makepkg was regenerated due to library
changes.  Ensure makepkg-wrapper is always generated and linked any time
makepkg changes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-11 15:43:25 +10:00
Christian Hesse e2b4e220bc lint_pkgbuild/pkgname: pkgname is not allowed to be empty
We checked for empty array elements, but did not catch empty array. Add
a check for that case as well.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:05 +10:00
Allan McRae 0c99eabd50 Remove contrib
The contrib directory takes too much of the pacman developer's limited time,
which could be better spent developing and reviewing patches for the primary
projects. The community can pick this up in a separate repository if wanted.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:05 +10:00
Allan McRae 2e76c184aa Move bash/zsh completion out of contrib
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:05 +10:00
Allan McRae d590a45795 Remove pacman-optimize
The people who believe that pacman-optimize is actually doing something
useful are the same people who are voting for Trump.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:05 +10:00
Levente Polyak 3190b87b65 fix --printsrcinfo unify arch and non-arch specific variables
This fixes the issue with --printsrcinfo that all arch specific variants
of a variable get merged into their non arch specific variant.

The .SRCINFO file ends up having $depends containing $depends_x86_64
and omitting the latter.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:04 +10:00
Allan McRae 87ee9693bd Remove SHA224 support
This was included due to use of PolarSSL's implementation for our internal
SHA2 support.  As our internal checksum calculations are now removed, we
can also remove this unused code path.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:04 +10:00
Allan McRae 05e1b8de1a Remove internal md5 and sha2 implementations
The internal implementations for md5 and sha256 checksums have not been merged
from upstream sources for a long time.  Instead of us carrying copies of code
from other projects, we should just support building against multiple libraries
that provide such functionality.

This patch removes the md5 and sha2 code (originally obtained from PolarSSL)
from our repository.  The configure script will now error unless at least one
library supporting checksum generation is present, with the only library
currently supported being openssl.  It will be relatively simple for other
such libraries (e.g. nettle) to be supported if anyone wishes to add them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:37:21 +10:00
Ivy Foster 0d2ba870c9 Do not #define _RESERVED_IDENTIFIERS
Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 18:04:57 +10:00
Gordian Edenhofer ae56a32273 bacman: add manual page
Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 5fcc054421 bacman: add option to alter the output directory
Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 130c0d5496 bacman: add option to print fewer status updates
Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 8f4a67bda9 bacman: quote pkg_pkger variable
Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer c7da5a6ef2 bacman: code structuring
Adding and clarifying comments.
Adding and removing some new lines.

Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 3a00bc31f2 bacman: rewrite usage function
Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 5c549b0e1d bacman: proper option handling
Switch to parseopts instead of merely checking the first argument.

Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 52ec8dfffe bacman: handle SIGHUP, SIGINT, SIGTERM signals
Trap SIGHUP, SIGINT, SIGTERM and remove working directories accordingly.

Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Gordian Edenhofer 7568928e71 bacman: allow for multiple packages as arguments
To enable the creation of multiple packages with one command move the
assembly process into its own function.

Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:41:10 +10:00
Alastair Hughes 45b6a3074a Add missing newline in paclog-pkglist help output
Add missing newline in paclog-pkglist help output

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:40:49 +10:00
Rikard Falkeborn 6a5156eedc Change type of count in be_sync
Making it size_t matches the return value of alpm_list_count() and
avoids the implicit cast to int.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:33:09 +10:00
Rikard Falkeborn 85171807c1 Return boolean from db_populate
Since the number of packages is not used anywhere, just return a
boolean to avoid the implicit cast from size_t to int in be_local.c.
Use 0 as success to be consistent with db_validate.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 17:32:20 +10:00
Rikard Falkeborn 34f3f1e7a6 Fix gcc strict-overflow error
Recent gcc (tested with 6.2.1) produces the following error when
compiling with both --enable-warningflags and --enable-debug.
In particular, it seems it is the combination of GCC_STACK_PROTECT_LIB
and -Wstrict-overflow=5 produces the error.

    be_local.c:609:4: error: assuming signed overflow does not occur
                             when simplifying conditional
                             [-Werror=strict-overflow]
    if(count > 0) {

Fix this by changing the type of count from int to size_t, which is
fine since count is never negative.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-20 22:48:00 +10:00
Fabio Castell 07d1e0441b repo-add: fix error in directories with a space in their name
Fixes FS#50285

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-09 15:40:20 +10:00
Ivy Foster 900a22b90c lib/libalpm/be_sync.c: Close memory leaks when mallocing while out of memory
Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-09 14:59:58 +10:00
Eli Schwartz 38e229e4db bash-completion: fix leaking "files" array into shell environment
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-03 20:38:13 +10:00
Allan McRae fac4831a09 Fix memory leak in remove_notify_needed_optdepends
Also add pactest which captures this leak when run under valgrind.

Reported-by: Sergey Petrenko
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-03 20:38:13 +10:00
Allan McRae d560a9aecd Fix typo in pacman-db-upgrade usage message
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-02 23:26:02 +10:00
Alastair Hughes 1dbfef7b1c Remove AC_FUNC_MALLOC check.
We weren't supplying the rpl_malloc function needed if this failed, and
didn't check for realloc, so just remove.

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-31 13:05:25 +10:00
Ivy Foster e28c5803bb Replace CURLOPT_PROGRESSFUNCTION with CURLOPT_XFERINFOFUNCTION
Curl 7.32.0 added CURLOPT_XFERINFOFUNCTION, which deprecates
CURLOPT_PROGRESSFUNCTION and means less casting doubles to size_ts for
alpm. This change has no user-facing nor frontend-facing effects.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-31 13:01:07 +10:00
Lukas Fleischer 1e2b398406 pacman.8: fix typo in the documentation of --asexplicit
Add a space between the option and its argument. Also, do not enclose
the argument in asterisk characters.

Fixes a typo introduced in aa4c61f (Document database checking options,
2014-12-28).

Reported-by: Luca Weiss <luca.emanuel.weiss@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 20:18:44 +10:00
Florian Pritz 406c9b66b4 Document contrib/verify-pacman-repo-db.pl
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2016-08-30 20:08:34 +10:00
Florian Pritz 6c15cc4d22 contrib: Add documentation Makefile
Makefile.am is mostly copied from ./doc/Makefile.am

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2016-08-30 20:08:34 +10:00
Florian Pritz 6d8e3d2a91 contrib: Add verify-pacman-repo-db.pl
From the documentation:

verify-pacman-repo-db looks at a pacman repo database and verifies its
content with the actual package files. The database is expected to be in
the same directory as the packages (or symlinks to the packages).

The following properties are verified for each package in the database:

    - existence of the package file
    - file size
    - MD5 and SHA256 checksum (--checksum)

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2016-08-30 20:08:33 +10:00
Allan McRae 1ec7fa89ad Fix file name in scripts potfile 2016-08-30 20:08:18 +10:00
Giulio Fidente 69aee3e391 Merge Giolio Fidente into "Pacman Development Team" contribution
As discussed on mailing list:
https://lists.archlinux.org/pipermail/pacman-dev/2016-July/021239.html

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Ivy Foster 58140dba74 Normalize alpm download callback's frontend cb arguments
When curl calls alpm's dlcb, alpm calls the frontend's cb with the
following (dlsize, totalsize) arguments:

0, -1: initialize
0, 0: no change since last call
x {x>0, x<y}, y {y>0}: data downloaded, total size known
x {x>0}, x: download finished

If total size is not known, do not call frontend cb (no change to
original behavior); alpm's callback shouldn't be called if there is a
download error.

See agregory's original spec here:
https://wiki.archlinux.org/index.php/User:Apg#download_callback

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Jack O'Connor 56de155296 libmakepkg: look for architecture-specific hashes in get_integlist
`makepkg -g` looks for existing checksums in the PKGBUILD file, so that
it can generate new sums of the same type. Previously it only checked
variables of the form "sha256sums", and not "sha256sums_x86_64". That
meant it would always fall back to MD5 for packages with only
architecture-specific sources. This change makes it look at
architecture-specific checksums too to determine the type.

Signed-off-by: Jack O'Connor <oconnor663@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae 5b839c58ee Add newline to the end of error messages for signature format issues
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00