Compare commits

...

4448 commits

Author SHA1 Message Date
Allan McRae
fe6e678e59 libmakepkg: remove pkglist linting
The ability to build only selected packages from a split package was
removed from makepkg, so this lint is no longer needed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-08-02 14:26:44 +10:00
morganamilo
48a784dde8 libalpm: fix -U when pkg exists but not sig 2025-06-21 23:39:57 +10:00
morganamilo
67e3a7be36
libalpm: fix regression in downloader
Fixes failure to finalize download path if the package file already
exists but the .sig file does not.

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

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

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

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

  Figure out the .sig base filename.

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

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

Fixes #256
2025-05-30 14:48:14 +01:00
morganamilo
45c4eef61d libalpm: move tempdir cleanup into _alpm_download
this ensures the dir still gets cleaned up even if killed by a signal
2025-05-26 16:13:06 +10:00
morganamilo
5c451cd976 libalpm: propagate signal from child to parent
If we ^C while downloading the parent should propagate so pacman can
exit as it did before the sandboxing.
2025-05-26 16:13:06 +10:00
morganamilo
d87dd153fc libalpm: finalize tempfile if destfile doesn't exist
On setup we move the termfile into the temp download dir to resume
downloads. We don't move these back losing any tempfiles we already had.
2025-05-26 16:13:06 +10:00
morganamilo
6fcecbd08d libalpm: set errno if child exited via signal 2025-05-26 16:13:06 +10:00
Diego Viola
528709131f Fix whitespace in README
Also ensure consistent style in API section
2025-05-26 16:11:13 +10:00
Dominik
9fca328caf makepkg: provide a field for tracking generic metadata
The xdata field is an array of key=value entries that allow a packager to
include arbitrary metadata in the generated .PKGINFO.

Fixes #241.

Signed-off-by: Dominik Peteler <archlinux+gitlab@with-h.at>
2025-05-26 16:09:02 +10:00
Rudy
af54cd4ee1 libmakepkg/tidy: give scripts a priority order
This ensures (e.g.) that the "emptydirs" script runs last after
unneeded files have been deleted.

Fixes #184.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-17 13:20:16 +10:00
morganamilo
e392f01a94 libalpm: move sig files when download is unnamed 2025-05-17 12:03:42 +10:00
morganamilo
f722b86990 libalpm: return final final temp path in pkgurl
When downloading unnamed files via alpm_fetch_pkgurl the returned path
would point to the temp pkgcache instead of the final download location.
2025-05-17 12:03:42 +10:00
Aidan Epstein
4ddc642398 Add remove option for repo-remove to remove old package files.
Also update documentation.
2025-05-17 10:43:58 +10:00
Allan McRae
53b1db84ef Fix memory leak in download payload
The file stream associated with downloads without a filename is not
being freed when downloading using the sandbox user.

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

Fixes #216.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-17 10:37:30 +10:00
Felix Yan
64299ccfbb makepkg.sh: skip checking buildtime deps when runtime check already failed
This could help locate the real failure (instead of scrolling through the whole possibly-successful buildtime dep installation section) and also saves time on the operation.
2025-05-09 08:55:42 +10:00
Allan McRae
692f7a2cfe Do not overwrite default download user when option is unset
Commit 7ccf316c provided "root" (or the user name for UID 0) as a
default download user.  However, when DownloadUser is unset in pacman.conf,
pacman was overwriting the default with null. Rectify this.

Fixes #248

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-08 21:49:56 +10:00
morganamilo
b104b95423 log and set errno when failing to rename download 2025-05-07 18:22:55 +10:00
Samuel Dionne-Riel
2bcdbc6a87 makepkg: Use sorted inputs for source tarballs too 2025-05-07 13:46:18 +10:00
Samuel Dionne-Riel
46f7f6e9ac makepkg: Use SOURCE_DATE_EPOCH for more reproducible source tarballs 2025-05-07 13:46:07 +10:00
Patrick Northon
38394d54f0 repo-add: add --wait-for-lock option
Using the --wait-for-lock option will result in repo-add retrying to acquire the database lock file after 3 seconds. If the option is not set, exit with code 2 on lock failure.
2025-05-07 12:23:45 +10:00
Allan McRae
267a0cc912 makepkg: ensure OPTIONS is not directly altered
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-06 17:04:32 +10:00
Allan McRae
d0c10a795e Free memory on failure to create temporary directory
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-06 17:02:35 +10:00
Allan McRae
0d37c1daa0 Initialise callback event fields
While the event is already globally initialised, initialising the fields
prevents a valgrind warning (since the gcc-15 update).

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-05-06 17:00:06 +10:00
Diego Viola
24fc50269d Fix typos 2025-05-04 21:42:34 +10:00
Rafael Fontenelle
08070e9abe Update and improve translation-help.asciidoc 2025-05-04 20:13:44 +10:00
Allan McRae
f13d7d480c Update copyright years
./build-aux/update-copyright 2024 2025

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-04-02 11:35:34 +10:00
LevitatingBusinessMan (Rein Fernhout)
007261ade5 makepkg: do not fail if makepkg.conf.d is empty
fixes #230
2025-03-22 05:23:23 +00:00
Jan Alexander Steffens (heftig)
bbe3f614b2 Update my .mailmap entry 2025-03-22 05:21:36 +00:00
Jan Alexander Steffens (heftig)
f07d547cf1
libmakepkg: Use only /etc/makepkg.d/gitconfig
Globally set `GIT_CONFIG_GLOBAL` and `GIT_CONFIG_SYSTEM` so that we're
only loading `/etc/makepkg.d/gitconfig` (if it exists) and no other Git
config files.

Allow injecting another value via `MAKEPKG_GIT_CONFIG`.

Fixes: https://gitlab.archlinux.org/pacman/pacman/-/issues/193
2025-03-19 21:15:55 +01:00
Christian Heusel
34f09204fa
repo-add.8: Mention missing compression algorithms
The manpage was lacking the database endings for various compression
algorithms that one can validly use, therefore we add these to the list.

Signed-off-by: Christian Heusel <christian@heusel.eu>
2025-03-02 14:55:57 +01:00
Allan McRae
0f6b4f4fab autodeps: parse LIB_DIRS with more specificity
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-31 15:56:51 +10:00
Allan McRae
bc7b8e2eb2 lint_pkgbuild/arch: always perform some checks
When using --ignorearch or options that imply it (e.g. --printsrcinfo),
all checks of the arch array were skipped. Instead, perform all checks
apart from confirming that the package can be built on that
architecture.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-30 01:17:40 +00:00
Allan McRae
faea473550 Add a .gdb_index section before splitting debug info
Using gdb-add-index to add a .gdb_index section before splitting
debug info (together with enabling "maintenance set debuginfod
download-sections" in GDB) can dramatically reduce the amount of
data GDB has to download.

Fixes #205.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-19 04:27:42 +00:00
Guoxin Pu
680169fb61 libmakepkg: set CCACHE_PREFIX to absolute path of distcc when using both
The current logic sets CCACHE_PREFIX to distcc when both distcc and
ccache are enabled. However, according to the source of ccache, it would
execute the command with execv, which would not look up arg0 from PATH,
unlike those exec functions with _p suffix.

This would result in the following error, when building a package with
both ccache and distcc enabled:
```
ccache: error: execute_noreturn of distcc failed: No such file or directory
```

This breaks package builds in different ways: packages that use make/cc
directly would yield the actual error which is the same as the above
line, packages that rely on other build systems wouldn't go through
compiler check and complain on a bad compiler.

To reproduce the problem, try to build a simple package:
```
git clone https://gitlab.archlinux.org/archlinux/packaging/packages/abc.git
cd abc
cp /etc/makepkg.conf .
echo 'BUILDENV=(distcc color ccache check !sign)' >> makepkg.conf
makepkg --config makepkg.conf
```

refs:
f887434d35/src/ccache/execute.cpp (L348)
https://man.archlinux.org/man/exec.3.en#v_-_execv(),_execvp(),_execvpe()

Signed-off-by: Guoxin Pu <pugokushin@gmail.com>
2025-01-18 05:08:44 +00:00
Allan McRae
e767cf9a54 Detect repeated values in the arch array
Repeated values in the arch array can result in architecture specific
fields being repeated when using --printsrcinfo.

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

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

Fixes #209.

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

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 14:25:09 +10:00
Allan McRae
4908eed57d Remove executable permissions from source file
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 03:08:18 +00:00
Allan McRae
286e776eda lint_config: move PACKAGER check into its own function
The check for the format of the PACKAGER variable did not align with the
rest of the function where it was located.  Move to its own function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 03:06:37 +00:00
Allan McRae
cc87999d6d lint_config: ensure NPROC is set to something usable
We use NPROC for managing the number of parallel jobs to run, so it is
essentially that this is a valid number.  Add a lint pass, and move the
setting of the default value to this location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-01-08 03:06:37 +00:00
Johan Förberg
425ff046ed doc/BUILDINFO: Fix description of arrays
Signed-off-by: Johan Förberg <johan@forberg.se>
2025-01-03 16:12:30 +01:00
Allan McRae
5f4c7e3ddc libmakepkg: strip - disguard error messages when copying source files
Parallel processing of file stripping is causing a TOC/TOU race when copying
source files into the debug location resulting in error messages from cp.
While hiding this error is not the ideal solution, it is currently the only
one we have. Given this is a error of our own making, and we understand the
cause and have determined there is zero actual downside to ignoring the
error, we will accept this approach until something better is found.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Vasiliy Stelmachenok
02b35b9155 libmakepkg: strip - parallelize stripping of files
Perform file stripping in parallel where possible. Hardlinks remain
processed one at a time due to reproducibility issues.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Vasiliy Stelmachenok
dbde37aafb libmakepkg: strip - split handling of hardlinks
Handle singly and muptiply hard-linked files separately.  Also collect
information on hard linked files to avoid searching the entire package
to check for hard links.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Allan McRae
0c136ecc8a libmakepkg: strip - add "safe_" prefix to stripping functions
Add a "safe_" prefix to strip_file() and strip_lto() to indicate that
these functions are taking extra steps to ensure permissions remain
unchanged.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-28 13:54:27 +00:00
Allan McRae
5e2a763e4a libmakepkg: improve validity checking of arch array
Only a subset of checks were being performed on the overridden arch
arrays in package functions. Refactor checking such that all checks
are perform on all arch arrays.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-20 14:21:32 +10:00
Diego Viola
62d3192126 makepkg.conf.5: fix typo 2024-12-18 05:24:40 +00:00
Allan McRae
3e557af72f makepkg.conf: add NPROC configuration value
Useful for controlling (future) parallel jobs within makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:31:36 +00:00
Allan McRae
fa7a9f748d libmakepkg: remove python hashseed handling
The decision to set the PYTHONHASHSEED variable and its value is outside
the domain of makepkg and should be handled by a distribution.  Move this
file to the libalpm-dropins project.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:28:55 +00:00
Allan McRae
870eae26dc makepkg: move SOURCE_DATE_EPOCH handling to libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:27:28 +00:00
Integral
cb940620bc
fix: make dependency cycle a debug message 2024-12-10 21:10:35 +08:00
Integral
dd55afad68 refactor: use c99 struct initializers to enhance readability 2024-12-10 10:18:40 +00:00
Allan McRae
775db50538 Remove pubkey_algo from alpm_pgpkey_t
This field is no longer used and requires updating with gpgme changes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-07 22:13:49 +10:00
Allan McRae
95a7d416ce Do not identify the public key algorithm
When the import key message was pushed to the pacman frontend, we no longer
displayed the length or algorithm used for the key, sticking to just the
user ID and the key ID.

Remove this code given this field is no longer used, and the code requires
updating for any now algorithm added.

Note: removal of the field from the alpm_pgpkey_t will happen in a separate
commit so that this commit can be readily backported.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-07 22:07:29 +10:00
Jan Alexander Steffens (heftig)
9154600490 strip: Treat bare object files like static libs, not shared libs
Debug symbols should only be split from finally linked ELFs, not bare
object files. We're already excluding static libraries from splitting
for a similar reason.

The `.gnu_debuglink` sections are also mishandled by LLVM's LLD, which
copies them to its output. For example, this affects Arch Linux's
`/usr/lib/Scrt1.o`.

While we're here (and it changes the code less), also strip GNU LTO data
from bare objects, again for the same reason we're removing it from
static libraries, and apply static library stripping instead of shared
library stripping.

See: https://bugs.gentoo.org/787623
2024-11-27 19:50:57 +10:00
Jan Alexander Steffens (heftig)
e0162a6868 strip: Overwrite debuglink when it's already present
When objcopy encounters an already-present section, adding the new
debuglink will fail with a warning. Remove any existing `.gnu_debuglink`
section to work around this problem.

Arch Linux's `rust` package is affected by this. Apparently when LLVM's
LLD links in `/usr/lib/Scrt1.o` it will also copy the `.gnu_debuglink`
section.

See: https://bugs.gentoo.org/787623
2024-11-27 19:50:46 +10:00
Allan McRae
71afd4d88f libmakepkg - add wrapper function for objcopy
Using objcopy can result in file permission changes.  We work around this
by using "cat" to copy the temporary output file into the target. Extract
this code into a utility function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-11-27 19:46:48 +10:00
Guillaume
a2d029388c fix a segfault in sandbox.c if handle->dlcb is null 2024-09-28 08:10:46 +00:00
Jelle van der Waa
8a60361949 pactest: drop trailing spaces from README 2024-09-28 01:44:17 +00:00
Chih-Hsuan Yen
e80569f5da Correctly configure landlock for older ABIs
For example, with landlock ABI < 3, LANDLOCK_ACCESS_FS_TRUNCATE is not
set in ruleset_attr.handled_access_fs, so it should not be set in
path_beneath.allowed_access either. Otherwise, landlock_add_rule fails
with -EINVAL, and pacman complains:

> error: restricting filesystem access failed because the landlock rule for the temporary download directory could not be added!

The change is tested on Debian Bookworm kernel
linux-image-6.1.0-25-cloud-amd64 6.1.106-3.
2024-09-28 00:35:10 +00:00
Rafael Fontenelle
60ec268458 Add double colon for newline after MAKEPKG_LINT_PKGBUILD in makepkg.8.asciidoc 2024-09-25 15:11:51 -03:00
Allan McRae
7bc5d55b56 libalpm: only chown downloaded files when running as root
Some libaplm utilities sync databases as a non-root user for use in
actvities other than system updates.  The ability to download as a
non-root user was broken as part of the download sandboxing.

Applying a minimial fix by preventing the chown of the downloaded file
if the user is non-root.  A larger change increasing the robustness
and error checking of this path is warranted in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-09-08 11:49:21 +10:00
KaranveerB
6ba5c20e76
pactest: add test for empty replacements strings 2024-08-03 16:29:26 -07:00
KaranveerB
4c18204938
pacman/util.c: fix segfault when replace in strreplace is NULL 2024-08-03 16:29:11 -07:00
Remi Gacogne
cf473bcfbd Ensure that the download process cannot get new privileges
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-08-02 00:39:45 +00:00
Remi Gacogne
f142df92c7 Restrict syscalls for the download process whenever possible
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-08-02 00:39:45 +00:00
Allan McRae
c3aa1bc123 Fix typo in git source handling
Fixes #171

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-16 18:51:03 +10:00
Allan McRae
138cbae584 Update meson versions for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
dd20586baf Update index.asciidoc for release
Also, rebalance columns in release version table.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
aa1c64b21a Update translations for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
3223d6206b Update NEWS for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Allan McRae
7299aadd7b Update README for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Allan McRae
9841f14f81 Prepare tranlsation strings for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Allan McRae
95e71ce52b Tidy up landlock check
This test was flagged as ambiguous by clang.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:03:23 +10:00
Allan McRae
cc0292a1ad Revert "_alpm_archive_fgets(): bail early if reached end of block"
This reverts commit 4dc21b965b.

Causes a segfault when reading some repos (gz compressed?)

Fixes #166.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-13 22:06:10 +10:00
Andrew Gregory
16a098a44e do not sort passed list
Sorting modifies the list in place, causing any existing pointers to the
list to point to a random element.

Fixes #165

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-07-11 01:27:06 -04:00
Vasiliy Stelmachenok
5213a70b88 tidy/strip: Fix incorrect recognition of static binaries as relocatable ones 2024-07-06 09:09:37 +00:00
Filip Hejsek
9151c44658 libmakepkg: Use git -c safe.bareRepository=all in bare repositories
Git commands can fail in bare repositories when global git config contains safe.bareRepository=explicit.
Some users set this option for increased security.
To be compatible with this configuration, explicitly set safe.bareRepository=all when invoking git in a bare repository.
2024-07-06 08:57:20 +00:00
Allan McRae
8d22f991f9 Add download sandbox related options to example config file
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-05 09:53:52 +10:00
Diego Viola
50bdd3d9bc Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-06-30 02:28:13 -03:00
Allan McRae
8d14b22260 repo-add: unconditionally create the database if it is missing
In f91fa546 (repo-add: do not recreate the database if nothing was changed),
repo-add was made to skip database write-out if there were no changes to
the database. However, this breaks the usage of repo-add to create a new
empty database: `repo-add /path/to/mydb/mydb.db.tar.xz`.

Bring back support for this use-case by always writing the database if
it is missing.

Original-patch-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-27 22:04:28 +10:00
Allan McRae
3f1943c84d Only copy source files onces when creating debug packages
The Arch sharutils package was spewing messages about "Permission denied" when
copying source files into the debug package.  This is due to the source files
having 444 permissions and being used in multiple binaries.  Only copy each
source file into the debug package onces to avoid this error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-20 00:34:32 +00:00
Allan McRae
c9acfc2b50 Fix error when downloading signature file for an existing package file
If a package was already downloaded but its signature file was not,
pacman would download the signature then error out despite all files
being present.

Also fixes a similar error when some, but not all, package databases
were updated with -Sy.

Fixes #156

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-19 17:38:07 +10:00
Allan McRae
b60b779fc8 Fix calculation of space needed for download package
The calculation used the size of the package rather than the amount
remaining to download for partially downloaded packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-19 17:33:36 +10:00
Allan McRae
479f4d574a Prevent buffer overflow when using a scriptlet shell with a long path
Observed in Nixpkgs.  Fixes #157.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-19 07:41:11 +10:00
Remi Gacogne
9f8f94c056 Add --disable-sandbox and DisableSandbox
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-06-17 11:01:42 +10:00
Remi Gacogne
eacadbcc41
Restrict filesystem access to the download process whenever possible
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-06-14 09:30:20 +02:00
Remi Gacogne
24304c6df0 Fix up-to-date repo databases being redownloaded when sandboxed
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-10 19:48:20 +10:00
Allan McRae
f0a7f85dbb libmakepkg: make configured BUILDENV readonly
PKGBUILDs should not be directly adjusting this variable

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-31 16:15:54 +00:00
Allan McRae
b013ca4221 makepkg: provide environment variable to disable PKGBUILD linting
On Windows based systems (e.g. msys), running PKGBUILD linting is very
slow due to time taken spawning bash subshells.  Additionally, some packages
have extreme amounts of (usually procedurally generated) splitting, which
also causes linting to be extremely slow.  Provide an environment variable
to disable PKGBUILD linting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-01 02:12:23 +10:00
Diego Viola
44b9a53b2d Fix spelling of environment 2024-05-31 16:11:07 +00:00
Diego Viola
24455cc5b2 editorconfig: update url
Use https and lowercase characters.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-27 02:31:30 -03:00
Diego Viola
7bbfc17f3c Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-20 02:30:50 -03:00
Allan McRae
d74d7ec32c makepkg: remove GITFLAGS support
Supporting git source fragments (branch, commit, tag) is difficult in
conjunction with GITFLAGS usage - particularly with the most common
use cases that reduce the amount of data cloned from the upstream repo.

Leaving GITFLAGS in place an documenting that various git source features
are not supported when GITFLAGS are in used is not an ideal 'solution'.
Instead, remove GITFLAGS support.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-20 00:18:43 +00:00
Allan McRae
76e1cb1bf1 Revert "Prepare git src with git worktree"
This causes issues when repeatedly building a package using the same
git checkout.  There is also ambiguity of the default checkout when
trying to build from HEAD. See #142 and #143.

This reverts commit 85c421f1cb.
2024-05-20 10:15:33 +10:00
Allan McRae
0f2417f919 doc/makepkg.8: Improve --cleanbuild documentation
Fixes #45.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:33:01 +00:00
Allan McRae
e1df19ee6f makepkg: drop sudo permissions after use
Add the -k parameter to the sudo call to prevent caching of credientials.
This would (potentailly) stop a rogue sudo use within a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:30:06 +00:00
Allan McRae
6d85d9ae08 Document makepkg.conf.d/ drop-in configuration
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:25:42 +00:00
EnnoxHD
8aba032de4 makepkg: make 'not a clone of' visible with a new error code
Add a new error code to expose the 'not a clone of' error state of some source
providers (git and fossil). This allows other tools integrating further and
handle this specific error state.

One usecase evolves around frequently changing source locations in PKGBUILDs
of packages in the AUR.
2024-05-05 12:24:56 +10:00
Daan De Meyer
bcd4aad16c Stop redirecting stderr of bsdtar to /dev/null
It's extremely hard to figure out what's going from when bsdtar fails
here when we expect it to succeed. Stop tunneling stderr to /dev/null
to help users figure out what's going on when this fails.
2024-05-05 02:10:30 +00:00
Tom "Ravi" Hale
85c421f1cb Prepare git src with git worktree 2024-05-04 22:28:57 +10:00
Allan McRae
9f78628f6c Update RELEASE documentation for website deployment via gitlab CI
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-04 11:21:26 +00:00
Allan McRae
60d517107b Deploy website using gitlab pages
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-04 11:21:26 +00:00
Wiktor Kwapisiewicz
7fc080c582 Remove --use-agent from the manpages of makepkg and repo-add 2024-05-04 21:19:56 +10:00
Christoph Reiter
15a2338656 meson: use the custom meson provided intl dependency
Let meson deal with the system differences instead of handling
it manually.

The custom dependency was added in meson 0.59, then gained
static support with 0.60, and static support for cygwin with 0.61,
which is why the meson requirement is bumped to 0.61.

Debian bullseye ships meson 0.56, so switch to bookworm which
has 1.0.1
2024-05-04 21:05:48 +10:00
Chih-Hsuan Yen
9548d6cc76 Fix unstable git checksums
Closes https://gitlab.archlinux.org/pacman/pacman/-/issues/131
2024-05-04 10:14:11 +00:00
Allan McRae
792df078fa libmakepkg: add fortran buildenv to meson sources array
Fixes #132.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-04 10:10:23 +00:00
lilydjwg
8e30cd4e38 makepkg: fix git checksumming depends on user config 2024-04-22 04:48:19 +00:00
Allan McRae
03d884d7ff repo-add: handle lack of newline at end of .PKGINFO
Work around the final line not being parsed in .PKGINFO if there was a lack
of newline at the end of the file.  This could occur due to utilising a tool
other than makepkg to create packages.

The missed line created a difference in the parsing of .PKGINFO between
repo-add and pacman, causing packages to be seen as invalidwith pacman-6.1.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-22 04:46:30 +00:00
Allan McRae
7dcf9a2b49 libmakepkg: do not unset CHOST with !buildflags
Also ensure CHOST and MAKEFLAGS are exported.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-20 11:37:54 +10:00
Allan McRae
4dc21b965b _alpm_archive_fgets(): bail early if reached end of block
Bailing early when there are 0 blocks remaining means that we do not call
memchr on a NULL string (although with a 0 size parameter).  Fixes issues
reported using -fsanitise=address,undefined

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-08 10:34:10 +00:00
Allan McRae
936eff63bf Add guidelines for managing release branches
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-05 12:02:40 +10:00
Allan McRae
f86c15e780 unlink_file: restore trailing slash on directory before checking mountpoint
The dir_is_mountpoint() function has the explicit requirement that the
trailing slash of the directory is present.  We strip the trailing slash
in unlink_file() to handle directories replaced with symlinks, but that
then affects the dir_is_mountpoint() check.

Add the trailing slash when we have established we are dealing with a
directory. Note this may fail in the case of a file managed by pacmane
with name length of PATH_MAX that has been replaced by a directory on the
file system. Bail on this unlikely scenario.

In addtion, be less fancy with adjusting length of the file char array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-05 00:51:13 +00:00
Allan McRae
49ebd856ec pacman-key: fix permission checks for non-root operations
Removing lock-never from the default gpg.conf file exposed a couple of bugs
in the permission checks in pacman-key.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-05 00:47:45 +00:00
Allan McRae
027ecbc7b8 libmakepkg: remove MAKEFLAGS from buildenv_vars
MAKEFLAGS should not be cleared by options=(!buildenv).

Regression introduced in commit 09e82f01ea

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-05 00:43:57 +00:00
Allan McRae
f763ff774a Fix leak in total progress bar
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-05 00:39:29 +00:00
Allan McRae
0ccb584262 Do not pass NULL paramenter to bsearch with empty filelist
A filelist can be non-NULL but empty (particularly with a lot of
NoExtract entries). Handle this in alpm_filelist_contains()

Identified using the undefined behaviour sanitizer.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-05 00:35:08 +00:00
Allan McRae
27eba85594 Fix typo in cb_progress
Introduced in 74deada511.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-02 23:18:34 +10:00
Remi Gacogne
cfa68f7b26 Restore partially downloaded files to the temporary directory
This allows downloads to be continued.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
e1a7b83e8e Download to a temporary directory owned by the Download user
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Andrew Gregory
11c8eca9a6 pactest: test database downloads with optional signatures
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Andrew Gregory
0b6df551b5 pactest: Add basic sandboxed download tests
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
5e9bff6216 Stop trusting the Content-Disposition HTTP header 2024-04-01 20:52:55 +00:00
Allan McRae
26b7b35307 Remove random_partfile from payload struct
It is not used any more due to filling the payload structure earlier.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Allan McRae
04d04381bc libalpm: fill in more payload information before passing to downloader
Filling in more of the payload fields before passing to the downloader ensures
that the these fields do not get lost during sandboxed operations.

It also fixes the use of -U with XferCommand, but testsuite still fails due to
"404" page being downloaded for the signature. Given we can not identify this
as being a non-signature download with the XferCommand, we can just turn off
signature checking in this test.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
49d512267e Document DownloadUser
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
cf359b0da4 Add support for DownloadUser with XferCommand
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
93a796aa27 Add sandboxed download for the internal downloader
If the SandboxUser configure option is set, the internal downloader
will fork of a child process and drop to the specified user to download
the files.

Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Allan McRae
9667bc6b12 Expose _alpm_reset_signals() to library
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
62c6874689 Add callbacks for sandboxed operations
Add log and download callbacks to use within a sandbox.  These are
designed to be passed from the sandbox to the parent through a file
descriptor and then processed into alpm callbacks to be passed to the
frontend.

Note, only callbacks used in libalpm are added. Other callbacks should
be set to NULL in the child process.
2024-04-01 20:52:55 +00:00
Remi Gacogne
ce83cf6361 Provide function for switching user in child processes
Add alpm_sandbox_child() function that will be used for switching to a
less priviledged user to run child processes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Remi Gacogne
56eb87287e Add DownloadUser configuration option
The DownloadUser option will be used to drop privledges to the
specified user when downloading files.

The intention is for this to be extended in the future  to a more
general sandbox configuration to cover operating on package and
database files prior to verification.

Add this option to pacman configuration and the various accessors into
the libalpm backend.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-04-01 20:52:55 +00:00
Vladislav Nepogodin
01e64e8b6a use snprintf instead of sprintf
sprintf does not check for buffer overflows (CWE-120)

	modified:   src/pacman/callback.c
2024-03-25 13:24:41 +10:00
Allan McRae
b2bb2e2482 makepkg: Fix missing end of line in -D documentaiton
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-20 21:39:41 +10:00
bartus
082094a1d8 Limit scope of name and a variable to avoid conflict with PKGBUILD scripts. 2024-03-19 12:43:00 +00:00
Allan McRae
b59d68a209 Update bug report URL in tranlsation configuration files
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-19 12:02:44 +10:00
Allan McRae
92102f477e makepkg: document -D in --help text
Fixes #110.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-19 01:47:42 +00:00
Demi Obenour
eb5bf69138 Fetch signature and database from the same URL
Previously, the for loops on lines 1035 and 1037 would advance to the
next element in the server list, even if downloading the URL succeeded.
If there are no more servers in the list, `s` would be NULL, causing
a NULL pointer dereference on line 1046.  If there were servers left
in the list, the signature would be downloaded from a wrong URL.

1. Fetching of database signatures is enabled.
2. There is only one enabled remote repository URL, or fetching from
   all but the last one fails and fetching from the last one succeeds.
3. An XferCommand is used.

Qubes OS Arch templates satisfy all of these conditions and trigger the bug.
2024-03-19 11:44:38 +10:00
Allan McRae
478af5d1c8 Fix read-after-free issue parsing config files
We were indirectly adjusting a pointer to a parameter that was declared
as a const.  This resulted in a use-after-free when using --debug:

[11:09:18] debug: config: finished parsing ��A�8_

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-19 00:40:09 +00:00
Dale young
942bbe2d2d Fix deadlink to the old bug tracker in footer
The bug tracker had been updated in doc/index.asciidoc, but the one in
doc/footer.asciidoc was still the old one, which is a deadlink now.

I udpated it just by copying the sentense in doc/index.asciidoc

Signed-off-by: Dale young <daleyoung4242@gmail.com>
2024-03-18 17:15:07 +08:00
Morten Linderud
bae9594ac1
debugedit: only check for debugedit if we build a package
We only really need debugedit while building the package, while this
check would run if you tried something like `makepkg --verifysource`.
Use the same checks as we have for fakeroot to wrap debugedit so we
don't beg for dependencies we don't need.

Fixes: 3ed08f97ec

Signed-off-by: Morten Linderud <morten@linderud.pw>
2024-03-14 23:07:08 +01:00
Allan McRae
111eed0251 Fix unused result warnings
Not actually a fix, as the pacman output will still be weird and
we will not gracefully exit, but it does print an error message...

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-14 01:50:05 +00:00
Christian Heusel
0571ee82bf repo-add: fix parseopts missing arg to -k/--key
The current code treats -k/--key as a binary option which later makes it
fail parsing the argument as then the end of arguments '--' is treated
as the GPGKEY. We fix this by adding the appropriate specifier to the
long and shortopt.

Closes https://gitlab.archlinux.org/pacman/pacman/-/issues/105

Fixes: 4f43ce3e ("repo-add: use parseopts from libmakepkg")
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-03-14 01:20:53 +00:00
Ivan Shapovalov
5e0496260b make_aligned_titles: pass the correct buffer length
The third parameter to wcstombs() is the length of the output buffer
(first parameter) in bytes. Take the correct sizeof() here.

This is not a problem in practice, but prevents _FORTIFY_SOURCE=3 from
detecting a possible output buffer overflow (as the source buffer is
bigger than the destination).

Fixes #104.

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
2024-03-13 04:32:42 +01:00
Allan McRae
95f148c222 Update website to reflect gitlab usage
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-06 10:23:33 +00:00
Allan McRae
d7f3ce1217 Manage releases through gitlab
Also provide an example for how to check for errors in translations

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-06 10:23:33 +00:00
Allan McRae
6bb95c8856 Fix error messages for unknown key in databases
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-05 07:25:11 +10:00
Allan McRae
e3dc296ba3 Pull translations for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 13:07:58 +10:00
Allan McRae
23151a8811 Update web index for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Allan McRae
4b25bb63c1 Update meson.build for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Allan McRae
1c536abef6 Update NEWS for 6.1 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Allan McRae
90f5ca42cc Update README for 6.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Andrew Gregory
9f6c081771 conf: do not default sysroot to /
Setting sysroot to / is not the same as having no sysroot, because the
sysroot is prepended to ALL config paths including relative ones:

$ cd /etc
$ pacman --config=pacman.conf
error: config file /pacman.conf could not be read: No such file or directory

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-03-04 01:33:51 +00:00
Andrew Gregory
cddad6fccd conf: make prepend_dir and globdir NULL aware
Allows sysroot to be left NULL.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-03-04 01:33:51 +00:00
Levente Polyak
016fd2633e
libmakepkg/srcinfo.sh: fix missing extglob in srcinfo_write_attr
We use an extended glob here, but were relying on having it globally set
in makepkg. This causes it to fail when used in scripts.

Since scripts using libmakepkg may not want extglob to be set, save and
restore the environment while explicitly setting extglob only where we
need it.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-28 21:30:22 +01:00
Allan McRae
f343db5b8e Do not segfault with badly formed URL
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-28 07:38:56 +10:00
Allan McRae
4a115b4dca Fix bug introduced to string_length
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 13:59:18 +10:00
Allan McRae
74deada511 pacman/callback.c: handle empty pkgname
In pacman's progress callback, pkgname being null may result in a
segfault, due to undefined printf behaviour.  libalpm always passes
at least an empty string for pkgname, so this situation is largely
avoided.

However, the callback mostly checked for pkgname's being non-null
and not empty.  This means a additional space was being added to
the output messages (although with zero actual effect on the output).

Be a bit more robust here by treating null and empty pkgname the
same and fixing the invisible output issue...

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:42:53 +00:00
Allan McRae
b30dac6a5b Improve robustness of parsing the --ask argument
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 13:14:23 +10:00
Allan McRae
5121108542 Improve robustness of parsing the --debug argument
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:10:35 +00:00
Allan McRae
c9c56be396 pacman/util.c: fix potential buffer overflow in string_length
A potential buffer overflow could occur if a detected terminal escape
sequence was not for a terminal colour (i.e. did not contain an "m").

Fix the potential buffer overflow while explicitly detecting only
terminal colour escape sequences.  Any other escape sequence is
unexpected, and just gets pushed to the terminal.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:07:08 +00:00
Allan McRae
1d1bb6fa1a pacman-key: remove lock-never from keyring configuration
I'm not sure why this was originally included, but it has now become
a problem with multiple processes updating the keyring (e.g. the
systemd timer for WKD updates from Arch Linux).

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:04:05 +00:00
loqs
dba383f092 makepkg: Add support for Fortran build flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-25 09:33:29 +10:00
Allan McRae
2a0dd9ec09 makepkg: move rust related documentation into the configuration file
Adding more and more languages will make the man page become increasingly
difficult to navigate.  Move documentation into the configuration file
where variables are defined.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-25 09:32:57 +10:00
Allan McRae
d55b47e551 Update copyright years
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-24 18:40:44 +10:00
Allan McRae
c8afb0aa1a Prepare translations
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-19 11:27:21 +10:00
Allan McRae
c7c4c2a7d2 verify_signature: wait as long as possible before bailing
Bailing early caused problems with makepkg failing on verify but expired
signatures.  As this is often out of the packagers control, and it is
better to verify a signature than not, we try bailing as late as possible
and let makepkg warn about the expired signature.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-19 09:24:13 +10:00
Andrew Gregory
7016adcb70 manually apply --sysroot to configuration
The previous chroot-based sysroot often broke due to glibc's delayed
loading for much of its functionality when the sysroot did not contain
compatible copies of the necessary libraries.

This approach instead manually prepends the sysroot to all configuration
paths.

BREAKING CHANGE: targets to -U are no longer interpreted relative to
sysroot

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-19 09:20:16 +10:00
Masato TOYOSHIMA
2180e4d127 libalpm: download signatures with the external downloader
Ensure relevant signature files are downloaded when using the fetch
callback.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-16 19:27:09 +10:00
Allan McRae
48729f8ecc libmakepkg: skip stripping guile-2.2 files
Guile 2.2 uses ELF format for its byte-compiled files.  These are not
normal executables, and are not strippable in the normal sense.

Given these are ELF files and detected by "file" as non-stripped binaries,
it is only possible to skip these using the file path.

Fixes #73

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-15 23:34:05 +00:00
Allan McRae
fface9001a Update "submitting-patches.asciidoc" for the move to gitlab
Also include a section encouraging discussion of large changes as there have
been a number of case of rejected features being reinvented.

Fixes #34

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-15 23:19:20 +00:00
Allan McRae
f74daa39e8 makepkg.conf.5: Add ellipsis to OPTIONS array description
We have added more options to makepkg, but adding them to the man
page entry would result in line wrapping on a standard width
terminal.  Instead, trucate and add ellipsis to indicate more
members (as described in the section below).

Fixes #91

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-15 23:14:28 +00:00
Allan McRae
22c043d4c3 Fix format string
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-16 09:09:45 +10:00
morganamilo
abc6dd7411 libalpm: check calloc in alpm_list_cmp_unsorted 2024-02-15 23:02:15 +00:00
morganamilo
7a43c6fee0 Speedup comparing lists if they happen to be in the same order 2024-02-15 23:02:15 +00:00
morganamilo
62095d916b Prompt to delete invalid package 2024-02-15 23:02:15 +00:00
morganamilo
386125fc89 Validate extra data when comparing dbpkg to pkgfile 2024-02-15 23:02:15 +00:00
morganamilo
196de7e94a Add function to check if lists are equal 2024-02-15 23:02:15 +00:00
morganamilo
e1dc609939 libalpm: print warnings for unknown keys in databases/packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-10 11:31:12 +10:00
Allan McRae
0649a66ee5 Add ALPM_PKG_REASON_UNKNOWN type
Return ALPM_PKG_REASON_UNKNOWN when parsing of %REASON% in the local
database fails.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-09 11:14:38 +10:00
morganamilo
6e6d3f18e3 libalpm: don't use atio for pkgreason
atio's behaviour is undefined if the input is not valid. Also it does
all sorts of whitespace and prefix handling which we don't need for
pkgreason.

Instead of going into UB on invalid input we now return EXPLICIT as the
fallback and print an error. However we don't actually error out as the
DB parsing tries to be error tolerant.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-09 11:14:38 +10:00
Andrew Gregory
0a394144b2 validate package metadata after loading
alpm has certain requirements for package metadata necessary for proper
functioning, name and version in particular.  These requirements are
already enforced in makepkg, but nowhere in alpm.

Exceptions are treated as errors for non-local packages because they
cannot be installed without potentially resulting in undefined behavior.
Exceptions for local packages are treated as warnings because they are
already installed, so any damage has already been done, and the user
would otherwise have no way to uninstall them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Andrew Gregory
fde59b99e8 be_package: delay freeing archive resource
The error path uconditinally tries to free the archive, leading to a
double-free segmentation fault if the error path is triggered after
already freeing it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Andrew Gregory
edd57c8b96 perform cleanup on sync db parsing errors
Cleanup was only being performed when libarchive failed to actually read
the file.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Andrew Gregory
5c75a55c7d allow freeing partial db package cache
The free function was checking DB_STATUS_PKGCACHE, which is only set
once the package cache has been fully built.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Allan McRae
56f1eeef4b Remove obsolete Doxyfile directives
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-06 20:03:08 +10:00
David Runge
f8c2e59ec5
pacman-key: Make signature verification more robust by checking pipes
To ensure we are not dropping the return code of the `gpg` call due to
piping into `grep`, we make use of `PIPESTATUS` to check the return code
of each command separately.

Additionally, we can now distinguish between two states: The signature
does not verify (e.g. due to technical reasons) and the signature is
not trusted.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:43 +01:00
David Runge
16a064701a
makepkg: Move check for signature metadata to central location
Move the check for the `NEWSIG` metadata keyword contained in the
GnuPG based statusfile to `parse_gpg_statusfile()` so that it is also
run when creating the statusfile in `verify_file_signature()` and not
only when running `verify_git_signature()`.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:42 +01:00
David Runge
86ec26b2d3
makepkg: Improve robustness of signature verification by limiting terms
The output of
`gpg --quiet --batch --status-fd /dev/stdout --verify <signature_file> <file> 2> /dev/null`
or
`git verify-commit --raw <commit> 2>&1`
may contain binary data, if the signature has been created with an
OpenPGP implementation, that e.g. makes use of notations.
If the notation string (see `NOTATION_DATA` in /usr/share/doc/gnupg/
DETAILS) contains a trailing binary char, this will break signature
verification, as any following entry (e.g. `VALIDSIG`) will be offset.

As we are only making use of a narrow set of terms from the statusfile
(namely `NEWSIG`, `GOODSIG`, `EXPSIG`, `EXPKEYSIG`, `REVKEYSIG`,
`BADSIG`, `ERRSIG`, `VALIDSIG`, `TRUST_UNDEFINED`, `TRUST_NEVER`,
`TRUST_MARGINAL`, `TRUST_FULLY`, `TRUST_ULTIMATE`), we are applying a
filter, so that only understood terms are written to the file.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:42 +01:00
David Runge
3aa096a74f
makepkg: Emit early error if signature verification fails
Emit an early error message if tag or commit verification with git or
detached signature verification with gpg fails.
Make `verify_file_signature()` and `verify_git_signature()` return
non-zero in this case and set errors to `1`, so that later checks
in `check_pgpsigs()`, although still run, can not lead to a positive
result.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:40 +01:00
morganamilo
bf76b5e89f libalpm: correctly log curl_download_internal return value
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 10:23:34 +10:00
Allan McRae
ce528a2654 libalpm/discspace.c: ensure mount points provide directories
In the very unlikely situtation where getmntent() and friends return
non-null, but the mount directory is NULL, a null dereference could
occur. It is unclear what the best course of action is in this case,
so just move on to the next mount point.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 09:02:36 +10:00
Allan McRae
f996f30163 libalpm/remove.c: prevent undefined behaviour in shift_pacsave error path
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 09:02:36 +10:00
Daniel M. Capella
2ba08e622b Update maintainers list
Signed-off-by: Daniel M. Capella <polyzen@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:58:33 +10:00
Allan McRae
4856fb53ac Add -Wunused_result to debug build compiler flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:53:44 +10:00
Allan McRae
a6b2524762 Ensure paths fit in PATH_MAX when cleaning cache
If a path length exceeds the PATH_MAX value, then it gets truncated
when building the path of the file to delete. This could (in a very
unlikely case...) result in the wrong file being deleted.  Check the
path fittedin the buffer before removing files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:44:24 +10:00
Allan McRae
2079f6866a alpm_list_reverse: restore original list on failure
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:56:00 +10:00
Allan McRae
845dadf183 _cache_mtree_open: remove unused variable
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:56:00 +10:00
Allan McRae
dfee773364 clean_filename: use strdup instead of malloc and memcpy
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:56:00 +10:00
Allan McRae
c64f898c48 _alpm_pkg_load_internal: remove unneeded if statement
This statement is always true due to an earlier test.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:56:00 +10:00
Allan McRae
16a2a79728 libalpm/signing.c: prevent underflow in length_check
The length_check function could underflow if the provided buffer index
is greater than the signature buffer length, leading to an out of
bounds read.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:54:12 +10:00
Allan McRae
6711d10f96 pacman/conf.c: fix leak on error in setdefaults()
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:49:08 +10:00
Allan McRae
36fcff6e13 pacman/util.c: fix user after free in print_packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-01-26 18:13:11 +10:00
Allan McRae
3c28c30133 Fix typo in exporting RUSTFLAGS
Fixes #77

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-01-14 08:50:29 +10:00
Ronan Pigott
4c93e63ddf add.c: drop newline in permission and ownership log messages
These are the only log messages produced by pacman that include an
embedded newline, and it looks very incongruous in a typical pacman.log.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-01-10 08:52:35 +10:00
Allan McRae
f69d9b4475 makepkg: only check software once
Move the checks for software and gpg signing ability to after the
fakeroot section so that it is only executed once. This also fixes
gpg (lack of) interaction under fakeroot.

Fixes #69

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-01-09 22:42:45 +00:00
Andrew Gregory
42fa74e91a free handle resources before running scripts
The primary purpose of this is to allow cleanup of file descriptors
allocated by curl that were left open in the child.  I am not aware of
any issues caused by the open file descriptors, but think it better to
not leave random open fd's lying around.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-01-09 22:39:14 +00:00
Andrew Gregory
929bad61c0 _alpm_handle_free: free all in-memory resources
Freeing handle resources was previously split awkwardly between
_alpm_handle_free and alpm_release.  This consolidates the freeing of
all in-memory resources to _alpm_handle_free, leaving alpm_release as a
thin wrapper that provides safety checks and frees any external
resources, e.g. removing lock files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-01-09 22:39:14 +00:00
Morten Linderud
00d2b1f902
strip: don't create debug packages from .a files
.a files are not valid ELF files so we can't run objcopy nor debugedit
on them.

Rename STRIPLTO to STATICLIB to be more descriptive.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-12-17 16:04:45 +01:00
Morten Linderud
7a4fff3310
strip: split off file stripping and debug package creation
Some projects might duplicate the file in multiple locations for one
reason or another. When debug packages are enabled, `makepkg` will only
strip the first occurrence of the binary and abort early on all the
other binaries.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-12-17 16:04:45 +01:00
morganamilo
8d38746586
libalpm: fix check_pgp_signature docs
The function did have these return values a long time ago but now only
return 0 or -1.
2023-12-04 15:34:49 +00:00
Andrew Gregory
0df44c2e20 db.c: set pm_errno for server list modifications
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-12-02 04:56:25 +00:00
Andrew Gregory
dc91476555 pacman: add cache server support
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-12-02 04:56:25 +00:00
Andrew Gregory
bad3e13eaa conf.c: remove unnecessary _add_mirror function
It does very little, is only used in one place, and can't easily be
reused for other server types due to the inclusion of an error message.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-12-02 04:56:25 +00:00
Andrew Gregory
45e94e2dae pmtest: return pkg from addpkg2db
Allows more compact syntax:

p1 = self.addpkg2db('sync', pmpkg("foo"))

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-12-02 04:56:25 +00:00
Andrew Gregory
3aa1975c1d alpm: add cache server support
Cache servers differ from regular servers in that they do not produce
warnings and are not removed from the server pool for "soft errors"
(i.e. the server was reachable, but the download failed) and they are
not used for databases.  If a host is used for both a cache server and a
regular server, it may still be removed from the server pool for soft
errors that occur when used as cache server and removal from the server
pool for soft errors will not affect future attempted use as a cache
server.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-12-02 04:56:25 +00:00
Andrew Gregory
56626816b6 dload: differentiate between hard and soft errors
Set error count to -1 to indicate a hard error to allow them to be
treated differently.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-12-02 04:56:25 +00:00
Allan McRae
0f512ae46e Do not increment on every database error to avoid overflow
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-12-02 04:55:29 +00:00
Allan McRae
d56e9ed083 Increment error count on filelist conflicts in local database
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-12-02 04:55:29 +00:00
Andrew Gregory
2d190d5a33 meson.build: add _FILE_OFFSET_BITS to pkgconfig
Meson automatically sets _FILE_OFFSET_BITS but that value was not
getting carried through to the libalpm pkgconfig file, breaking
downstream projects that relied on it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-11-25 13:05:00 -08:00
Andrew Gregory
2e23126e2a remove unused pkgconfig template
libalpm uses meson's pkgconfig module which does not use the template
file.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2023-11-25 13:04:56 -08:00
Levente Polyak
18e49f2c97
debugflags: ensure to only append debug flags once when building
During a package build we call prepare_buildenv in multiple stages of
the process. For debug packages, one of the hooks is buildenv_debugflags
which populates the debug flags to the according variables.

The issue is that the behavior of the current implementation of
buildenv_debugflags is not idempotent, so consecutive calls will append
the same flags again. In certain cases this isn't an issue, however
for context aware build frontends like cargo any change of the build
inputs leads to a fresh build. This means that any invocation of such
a build ecosystem inside the package() function will trigger a full
rebuild, which is not desired.

To fix this issue, this commit makes buildenv_debugflags idempotent
by only appending flags once to the target variables.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-11-17 18:56:44 +01:00
Patrick Northon
0108e2c64e Omit trailing .git from url when comparing git remote urls. 2023-11-04 10:09:59 +10:00
Diego Viola
94d9c2affe doc/PKGBUILD: fix typo
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-11-04 00:03:23 +00:00
morganamilo
6e9ab43451 Document MAKEPKG_LIBRARY in makepkg(8) 2023-11-04 00:02:17 +00:00
morganamilo
9af4033cad Rename LIBRARY to MAKEPKG_LIBRARY
Implements #59.
2023-11-04 00:02:17 +00:00
Vekhir
31ffbc94ca Delete entire $srcdir upon clean build
Currently, the file glob used to clean the $srcdir misses dotfiles.

This commit instead removes the directory entirely and recreates it.
Since the directory has to exist prior to deletion, the creation commands
are duplicated. Perhaps they could be moved to a function later on.

The directory cannot be removed while inside it, so the directory change
is moved down the line. One important insight here is that almost all functions
after it are actually independent of $pwd, allowing the optimization of just
not changing directory. They do however depend on the existence of $srcdir, so
it has to be recreated.
The only exception to this is `extract_sources` which depends on $pwd being $srcdir.

An alternative proposal wanted to extend the file matching for deletion, but it
was deemed impractical.
2023-11-04 00:01:22 +00:00
Jack Rosenthal
e9b385a636 alpm: Don't chroot() to "/"
chroot() requires CAP_SYS_CHROOT.  If the caller has put us in the
right root directory already, don't call chroot().  This allows
running pacman in a containerized environment without CAP_SYS_CHROOT.
2023-10-23 12:13:10 +00:00
morganamilo
917b67f5d1 Fix -D in package()
When entering fakeroot makepkg calls itself with it's original args
causing it to cd again and error
2023-10-20 22:40:44 +01:00
Morten Linderud
331b277eea makepkg: Implement the verify function
This patch implements a new verify function in makepkg. It allows us to
do arbitrary authentication on sources before extraction.

There are several new signing and validation methods being implemented
and it would be hard to have `makepkg` implement support for things such
as sequoia, cosign or minisign. This would allow us to distribute
generic validation functions.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-10-02 05:12:12 +00:00
Felix Yan
30f9a2e263 Correct typos in zsh_completion.in 2023-10-02 04:34:24 +00:00
morganamilo
aff12189d8 libalpm: check filecache_find return and log errors
Some user had erros while updating their system.

:: Proceed with installation? [Y/n]
:: Retrieving packages...
checking keyring...
checking package integrity...
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.

The issue was filecache_find returning null and alpm passing that null
path to check validity. How this happened I have no idea. It may be
something to do with the user's cachedir being a network drive.

Also warn when the file exists but it is not a regular file or can not
be opened.
2023-09-30 13:28:31 +00:00
Allan McRae
332d2a1922 repo-add: clarify exit messages
Clarify if repo-add does not create a new database due to failures
or due to there being nothing to do.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-30 23:27:04 +10:00
Ivan Shapovalov
f91fa546f6 repo-add: do not recreate the database if nothing was changed
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-30 23:18:41 +10:00
morganamilo
b4f11d5496 alpm: test access of symlinks not where they point
On platforms that have AT_SYMLINK_NOFOLLOW

Fixes FS#69720
2023-09-26 03:37:49 +00:00
morganamilo
015cdb21bd
Fix unused variable warning 2023-09-20 04:32:21 +01:00
Xiretza
05f283b5ad tests: fix order of fakechroot + fakeroot nesting
As noted in the fakechroot(1) man page, fakeroot and fakechroot
might wrap the same C library functions. Arch Linux hit this
recently with calls to stat(). It is important to start the fake
environment in proper order - fakeroot should be started inside
fakechroot.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-19 17:55:24 +10:00
Finlay Maroney
34611a6643 Avoid double slash when explicitly passing --root or --rootdir
Passing a path with a trailing slash to --root or --rootdir can lead to a
double slash at the start of paths.  e.g.

$ pacman --root / -v 2>1  | grep " //"
Log File  : //var/log/pacman.log

In MSYS2, paths starting with // will hit the network and fail.

Avoid this be explicitly stripping the trailing / from paths passed to these
flags.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-12 14:22:36 +10:00
Robin Candau
76b140c72a Replace the bzr package by breezy for the bzr protocol in makepkg.conf 2023-09-11 19:11:40 +02:00
Matthew Sexton
5f43ac85f6 specify which files are updated by --refresh option
Ref: FS#77697

Signed-off-by: Matthew Sexton <mssxtn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-11 22:59:53 +10:00
morganamilo
0dfe5c96ae makepkg: add -D flag to change directory before building
This is similar to -C in git/make/nina. Sadly -C is already taken for
us.

This is useful for scripts where you for loop over packages, as well as
when I'm testing makepkg builds and I'm too lazy to cd.
2023-09-09 11:52:11 +10:00
InsanePrawn
36d70a93e2 pacman-key: allow overriding KEYRING_IMPORT_DIR with --populate-from
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-07 00:12:41 +10:00
Allan McRae
717e5e9157 Add PRINT_FORMAT_LIST define to remove repetitive code
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Allan McRae
e7d7433b4b Rename macro for print-format handling of strings
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Jelle van der Waa
e210634982 util.c: extend --print-format with "%m"
Add md5sum as printable format string.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Jelle van der Waa
6968f77026 util.c: extend --print-format with "%G"
Add a new print attribute "%G" which prints groups.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Jelle van der Waa
06db927a1a util.c: extend --print-format with "%H"
Add a new print attribute "%H" which shows conflicts.

Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
2023-09-06 17:56:55 +10:00
Jelle van der Waa
909f2e86c3 util.c: add "%O" to --print-format
Add the option to print optional depends with "%O".

Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
2023-09-06 17:56:55 +10:00
Jelle van der Waa
5bd0b98b42 util.c: extend --print-format with %R and %P
Add provides "%P" and replaces "%R" as format attribute.

Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Jelle van der Waa
c1d4a6198c Extend --print-format with %L
Add format attribute for licenses.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Allan McRae
f5af66f130 Remove unnecessary check
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Allan McRae
5473c9fd3f squash
Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 17:56:55 +10:00
Allan McRae
e58d799c47 Generalise concat_alpm_depends for any list
Replace concat_alpm_depends() with concat_list() which takes an
additional parameter to handle the formatting of non-string
data types.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 14:39:00 +10:00
Matthias Kurz
366b527757 libmakepkg: make sure git cloned repo's remote is named origin
makepkg assumes that the remote git repo is named "origin" at several
places in its handling of git sources. It is possible to set the remote
repo name since git v2.30.0 (with bug fix for bare checkouts in v2.30.2).

Add "--origin=origin" to all git clone commands.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-09-06 13:51:32 +10:00
morganamilo
e83e53f3f9 makepkg: lint empty arrays
While depend arrays are already linted, many array kinds are still
not. An empty string is never a valid array value so check all
arrays for it.
2023-09-06 12:14:55 +10:00
morganamilo
2348dcab22 pacman+libalpm: print version names for conflicting packages
When ever pacman prints a conflict, it now prints pkgname-version,
instead of just pkgname.

alpm_conflict_t now carries *alpm_pkg_ts instead of just the
names of each package.

Fixes FS#12536 (point 2)
2023-09-05 01:57:01 +00:00
morganamilo
f9d8beef45
Add meson log to artifacts 2023-09-04 22:00:51 +02:00
morganamilo
85ab0307d7
Fix compile on some platforms
Controlling the type of getmntinfo's param was decided by
whether or not we had the statvfs type avaliable. But getmntinfo uses
statfs regardless of this except on netbsd where it uses statvfs.

Add a check to detect which type our version of the function uses.
2023-09-04 22:00:48 +02:00
Nicolas Rolans
ffde12cebd repo-add: fix exit on mktemp failure 2023-08-28 12:43:56 +00:00
Jouke Witteveen
37dae721d3 Replace md5sums with sha256sums in documentation
As noted in !24, md5sums are outdated.
2023-08-28 12:27:28 +00:00
Ben Westover
aa3a1bc3b5 proto: Change the default checksum from md5 to sha256
MD5 isn't a very good checksum, and the PKGBUILD page on the Arch Wiki
states that it should not be used, instead recommending sha256 or b2.
This patch changes the default from md5 to sha256 because that seems to
be the most commonly used checksum today.

Signed-off-by: Ben Westover <kwestover.kw@gmail.com>
2023-08-28 22:25:10 +10:00
Allan McRae
298755c905 pacman: do not check file md5sums
The file md5sums are removed from the .MTREE file, so pacman should
not attempt to check them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2023-08-28 22:17:51 +10:00
Levente Polyak
ee933acf84 makepkg: immutable bzr by hashing the checkout content
This feature makes bzr VCS build inputs immutable by adding support for
pinning a bzr checkout by a hash of its content using the deterministic
export functionality `bzr export`.

This feature allows to preserve security implications of immutable build inputs
using a trusted cryptographic hash function of the content.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-08-28 22:15:03 +10:00
Levente Polyak
ca3c873d48 makepkg: immutable mercurial sources by hashing the checkout content
This feature makes Mercurial VCS build inputs immutable by adding
support for pinning a Mercurial checkout by a hash of its content using
the deterministic export functionality `hg archive`.

This feature aids packagers by allowing them to use simple and
convenient refnames (instead of full commit hashes) in the `PKGBUILD`
while still preserving security implications of immutable build inputs
using a trusted cryptographic hash function of the content.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-08-28 22:15:03 +10:00
Levente Polyak
2fc2ab6cf0 makepkg: immutable git sources by hashing the checkout content
This feature makes Git VCS build inputs immutable by adding support for
pinning a Git checkout by a hash of its content using the deterministic
export functionality `git archive`.

This feature aids packagers by allowing them to use simple and
convenient refnames (instead of full commit hashes) in the `PKGBUILD`
while still preserving security implications of immutable build inputs
using a trusted cryptographic hash function of the content.

Previously VCS source downloads have been skipped for `--geninteg` and
`--source` as both options did not need a checkout. This commit changes
this behavior by forcing the download of all sources as integrity checks
and generation requires to have an up to date state.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-08-28 22:15:03 +10:00
kpcyrd
843bf21e79 libmakepkg: Fix non-reproducible binaries by processing debuginfo in order 2023-08-27 13:03:40 +02: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
Allan McRae
39c3cbdf56 _alpm_key_import: Initialise fetch_key
Prevents build warning.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-05 09:58:18 +10:00
morganamilo
165e492485 pacman: don't run hooks when using --dbonly
--dbonly is meant to only touch the database and not the actual system.
However hooks still run which can leave files in place or run commands
you may not want.

The hooks being run also means `fakeroot pacman -S --dbpath test/ foo --dbonly`
fails because alpm tries to chroot for hooks which requires real root.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 20:46:57 +10:00
morganamilo
be76f8bf06 libalpm: add ALPM_TRANS_FLAG_NOHOOKS
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 20:46:47 +10:00
morganamilo
625f3d645b libalpm: don't use alpm_pgpkey_t in import question
When constructing an import question we never really used a proper gpg
key. We just zero initialize the key, set the uid and fingerprint, and
sent that to the front end.

Instead lets just give the import question a uid and fingerprint field.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 20:43:16 +10:00
morganamilo
e187aa9b48 libalpm: use else when setting fingerprint
The docs [1] say keyid will always be there, so no need to check if it
exists.

[1] https://www.gnupg.org/documentation/manuals/gpgme/Key-objects.html

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:52:23 +10:00
morganamilo
c5c6633dd1 libalpm: rename __foo tyes to _foo
__foo is reserved in c and should not be used.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:52:23 +10:00
morganamilo
2109de613a libalpm: take alpm_trans_t out of the public API
this type is only used internally by alpm

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:52:23 +10:00
Allan McRae
fbb29b5047 repo-add: add --include-sigs option
Pacman now downloads the signature files for all packages when present in a
repository.  That makes distributing signatures within repository databases
redundant and costly.

Do not distribute the package signature files within the repo databases by
default and add an --include-sigs to revert to the old behaviour.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:52:23 +10:00
Allan McRae
0a6fecd072 Release pacman-6.0.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:36:22 +10:00
Allan McRae
d5e2c0a551 Update NEWS for pacman-6.0.1 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 19:36:20 +10:00
Allan McRae
70d0b2c4b9 Include az_AZ translation files
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 18:02:39 +10:00
Allan McRae
4c3c0e06e5 Update translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 16:16:20 +10:00
Daan De Meyer
c7e4f45922 pacman-key: Reduce gpg trustdb checks
Every time we modify gpg's state by signing or revoking a key, gpg
marks the trustdb as stale and rechecks it the next time key_is_lsigned()
or key_is_revoked() is called.

Currently, we alternate calls signing of keys and calling key_is_lsigned()
(idem for revoking) which means that for each key we sign (or revoke), gpg
will check the trustdb once.

To avoid checking the trustb so many times, we can simply do all the
key_is_lsigned() and key_is_revoked() checks upfront. Inbetween read
operations the trustdb is not marked stale and inbetween write operations
the trustdb is also not marked stale. This reduces the amount of trustdb
checks from 50 to 1.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 13:43:26 +10:00
Daan De Meyer
160f5bec8c pacman-key: Add --quiet to a few more gpg invocations
Currently, when running pacman-key --populate, gpg prints the
trustdb check output once for each locally signed and revoked key.
When bootstrapping a new container image, about 50 keys get signed
and revoked which leads to a huge amount of output when running
pacman-key which is repeated 50x.

To avoid overloading the user with gpg output, we add --quiet to the gpg
calls generating the trustdb checking output to silence those calls which
gets rid of the trustdb check output on the terminal.

Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 13:34:58 +10:00
Hugo Osvaldo Barrera
5da4af2b5d Delete the "Other Utilities" section
Signed-off-by: Hugo Osvaldo Barrera <hugo@barrera.io>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 10:34:00 +10:00
Hugo Osvaldo Barrera
cf923e734b Update broken links pointing to git.archlinux.org
All of these links are broken since the recent move to
gitlab.archlinux.org.

A few projects are, apparently, only available on GitHub, so I've linked
to that source (hopefully that's only temporary).

For git-clone URLs, I've opted for the https URLs since those can be
used by anyone -- whereas the ssh URLs require the user to be registered
on the gitlab instance which is not open to the public yet.

Signed-off-by: Hugo Osvaldo Barrera <hugo@barrera.io>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-09-04 10:34:00 +10:00
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
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
Andrew Gregory
1fdf8c0076 gitlab-ci: print output and logs for failed tests
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:18:24 +10:00
Andrew Gregory
f9bc6c2b09 pactest.py: read options from PACTEST_OPTS
Makes it easier to pass options when not running pactest directly.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:18:14 +10:00
Andrew Gregory
84f9cb021e pacman: add -w to -U
Mostly for testing.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:18:04 +10:00
Pascal Ernster
05aefb8f82 pacman: correct length of ".files.sig" string
Running "pacman -Sc" deletes /var/lib/pacman/sync/*.files.sig due to a
wrong string length being used when checking filename suffixes in that
directory. In turn, these missing signature files cause both the
corresponding "*.files" files and their signatures being forcibly
re-downloaded again when "pacman -Sy" is executed.

Since official Arch Linux repos don't use signed database files yet, this
only affects people who use custom repos with signed database files, for
which they have set the "SigLevel" directive to "Required" or
"DatabaseRequired" in /etc/pacman.conf.

Fixes FS#66472

Signed-off-by: Pascal Ernster <pacman-dev@hardfalcon.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-21 17:17:37 +10:00
Andrew Gregory
1c4e079899 do not try to download an empty db list
Starting the download process, even if there is nothing to actually
download, causes an error when pacman is built without curl and has no
XferCommand defined (like our test suite).

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:39:37 +10:00
Andrew Gregory
79227dabe0 make alpm download config accessible without curl
Download-related config options are currently limited to builds with
curl.  This causes compilation errors when those options are used
without an appropriate guard which often goes unnoticed because we all
use curl.  Front-ends providing their own download callback may also
want to use these settings.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:39:10 +10:00
Andrew Gregory
8ed98023b4 sighandler: initialize sigaction fields
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:38:57 +10:00
Andrew Gregory
a493170420 fully free error list in check_keyring
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:38:34 +10:00
Andrew Gregory
5151de3011 plug memory leaks in _alpm_key_import
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:38:02 +10:00
Andrew Gregory
5d21b2d44c pacman-conf: free rootdir before replacing
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:37:24 +10:00
Andrew Gregory
4311cc3648 pacman: indicate --overwrite takes a glob
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-19 12:03:08 +10:00
Morten Linderud
8566cd9be9 pacman-key: Close msg string in generate_master_key
In 19980a61e9 there was a msg added which
didn't get the string closed.

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11 11:11:06 +10:00
Allan McRae
57a75dedb1 mailmap addition
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11 11:11:06 +10:00
morganamilo
e9cc95f372 Read targets from stdin before chrooting
Operations involving --sysroot and reading targets from stdin were
failing due to attempting to read targets after chrooting.  Move the
chroot to happen after targets are read.

Fixes FS#68630

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11 11:11:06 +10:00
Emil Velikov
8f7415c41b pacman: add file checksum validation against mtree
With libarchive v3.5.0 we have API to fetch the digest from the mtree.
Use that to validate if the installed files are modified or not.

As always, a modified backup file will trigger a warning but will not
result in an actual failure.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11 11:11:06 +10:00
Allan McRae
3f5125e47c doc: move missed sections from alpm_ to libalpm_
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-11 11:10:55 +10:00
Allan McRae
4cdbbcfc34 doc: reference all libalpm sections within libalpm man page
Also, fix minor typo.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 09:19:50 +10:00
Allan McRae
c1d23c0ff2 doc: rename libalpm-list man page for consistency
All other libalpm man pages are in the form libalpm_<name>.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 09:19:03 +10:00
morganamilo
8fda300e06 doc: change group names to libalpm_*
Also change the group's title to point to the group's man page.

This makes generated man pages be named libalpm_* which is more
consistent with what library man pages are usually called.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:15:18 +10:00
Emil Velikov
45a648961b libalpm: const annotate struct db_operations
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:15:14 +10:00
Emil Velikov
1d2dd9a128 libalpm: const annotate struct pkg_operations
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:15:04 +10:00
Allan McRae
f8614d8c5b get_file_pkg_ops: update comment 2021-01-09 00:14:58 +10:00
Emil Velikov
027d76b9f5 libalpm: introduce get_sync_pkg_ops() helper
Currently default_pkg_ops is accessed in two different ways.

There is get_file_pkg_ops (in be_package.c) creating a local once-off
'tweaked' copy. As well as load_pkg_for_entry (be_sync.c) which modifies
in-place and uses default_pkg_ops.

This seems rather misleading and fragile approach. Introduce a helper
for the second use-case so that default_pkg_ops is handled consistently
and essentially remains unchanged throughout.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:56 +10:00
morganamilo
4472ce55d7 pacman: total download show how many packages have been download
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:52 +10:00
Emil Velikov
b9ab7790d5 Remove unused SYMHIDDEN macros
The macro hasn't been used since 2007 with commit
7f7da2b5fc. Although it was still copied
over into alpm_list.c an year or so later with commit ca1a1871 ("More
cleanup to alpm_list")

Just remove all instances of it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:50 +10:00
Emil Velikov
67a42b9549 meson: use hidden symbol visiblity by default
All the required public API is annotated with SYMEXPORT, so we can just
add the meson notation, to hide all the symbols by default.

Thus we no longer spill all the internal API into the global namespace.

This is effectively a regression from the autotools build, which used
hidden and internal for DARWIN and others respectively.

The use of hidden is considered sufficient, considering:
 - internal was introduced with commit 920b0d20 ("Update usage of gcc
   __attribute__ flags"), referencing the GCC manual and potential
   optimisations, although
 - the details about the optimisations or respective benefits are close
   to non-existent,
 - the code/data size of the binaries is identical across hidden and
   internal. While the latter produces slightly larger overall binaries.
 - Internal is not widely supported - missing on Darwin, the CMake build
   system lacks a wrapper (unlike for hidden)
 - Internal is not widely used in projects.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:42 +10:00
Emil Velikov
d53ba019f5 meson: pacman-conf add missing libcommon link
Currently, we are erroneously exporting all the symbols via the
libalpm.so. As such, the libcommon dependency is resolved.

The libalpm.so exports are about to be resolved shortly, yet that
exposed that pacman-conf is missing a link against libcommon.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:14:33 +10:00
morganamilo
793e2097a6 libalpm: pass the number of packages being downloaded in totaldlcb
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:12:32 +10:00
morganamilo
f5b373788f libalpm: don't use curl's deprecated functions
This bumps the minimun curl version from 7.32.0 to 7.55.0.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:12:19 +10:00
morganamilo
bc1591a0b8 pacman: clean filename for downlaods
The progress bar already did this. But the init event and up to date
message printed the full file name.  Unify these for consistency.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:12:08 +10:00
morganamilo
7cc8e0181f libalpm: remove useless if
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09 00:11:44 +10:00
morganamilo
8e291e6f4b doc: fix typos
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-03 11:24:24 +10:00
Allan McRae
19980a61e9 pacman-key: warn about time taken for master key generation
Generating the pacman master key can take some time on systems
without enough entropy. Warn the user that the generation may
take some time.

Fixes FS#30286.

Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-03 11:19:21 +10:00
Eli Schwartz
a023565ed3 doc: make doxygen build from any directory
In the autotools build, it only built in-tree, from cwd = doc/ and
resolving doc/../lib/libalpm

In the meson build, this accidentally worked if cwd =
pacman/builddir/ and resolved to builddir/../lib/libalpm/

But... this should always have been configured with the actual path to
the inputs. So, we will now proceed to do so.

Fixes building man3 if your out of tree builddir doesn't happen to be a
direct subdirectory of the source root.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-29 13:15:40 +10:00
Emil Velikov
ccdd1e3fd9 Move hex_representation() to src/common
We'll reuse the function in pacman with a later commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-29 12:38:23 +10:00
Emil Velikov
831fc568fc Remove pre libarchive 3.0 code
Pacman has required libarchive 3.0 or later for quite some time mow.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-29 12:37:45 +10:00
morganamilo
95ffdd68b2 doc: remove old libalpm man file
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:03:51 +10:00
morganamilo
e67c306f91 doc: add extra documentation to the man page
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
ea975c328d doc: rename alpm_api group to alpm
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
50c9c338fb doc: update doxyfile
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
6ed82820fe doc: configure doxygen
- only document public alpm items (alpm_*)
- hide typedef'd structs (_alpm_pkg_t shows as alpm_pkg_t)
- enable inline struct definitions (this stops having a man page for
  every single struct)

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
1e8816f13d doc: move top level items into groups
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
2a16434bfd doc: move alpm_api group to top of file
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
4613527738 doc: document options
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:58 +10:00
morganamilo
7b06b5407b doc: document alpm_list
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 12:01:57 +10:00
morganamilo
50d2171ef0 doc: document misc
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:46 +10:00
morganamilo
a321e1f8a5 doc: document transactions
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:46 +10:00
morganamilo
3d60a829e1 doc: document files and groups
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:45 +10:00
morganamilo
5901ac9cb2 doc: document packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:45 +10:00
morganamilo
af7a1e834f doc: document logging
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:45 +10:00
morganamilo
55efa43f23 doc: document databases
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:45 +10:00
morganamilo
e9ac13776e doc: document callbacks
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:45 +10:00
morganamilo
bf26b6bbf7 doc: document depends
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:55:44 +10:00
morganamilo
5e9635317b doc: document signatures
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:51:07 +10:00
morganamilo
ab431f6810 doc: document handle
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:51:07 +10:00
morganamilo
49e33aad7c doc: document error
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:51:06 +10:00
morganamilo
48c8869339 doc: add doc header to alpm.h
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:49:33 +10:00
morganamilo
48865e7dac doc: remove stray doxygen comment
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-21 11:33:42 +10:00
Anatol Pomozov
11e09a23be Implement TotalDownload functionality
With the recent 'multibar' interface changes TotalDownload has been disabled.
Now we have a new UI and we need to find another way to display this
information.

When 'TotalDownload' config option is enabled we are going to have an extra
progress bar at the bottom of the screen that shows how much of the entire
download has been completed.

Closes FS#68202

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-09 10:28:10 +10:00
Colin Woodbury
a4240a55e4 Restore usage line for -Fh
Unlike the other main commands, -F was missing its top-level usage line in its
help output.

Signed-off-by: Colin Woodbury <colin@fosskers.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-03 21:37:30 +10:00
Allan McRae
20f2ae56eb Modify "pacman -h" output for files operations
pacman -F can take both a file(s) or a package(s) as arguments.  Passing a
file is more common, so adjust to show that in the help.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-03 21:34:01 +10:00
morganamilo
5c24f7dd11 libalpm: set ret in download files
download_files never set ret on failiure, so even when downloading
fails, the transaction goes on to commit and error out.

:: Retrieving packages...
 python-packaging-20.4-4-any.pkg.tar.zst failed to download
error: failed retrieving file 'python-packaging-20.4-4-any.pkg.tar.zst' from mirror.oldsql.cc : The requested URL returned error: 404
warning: failed to retrieve some files
(1/1) checking keys in keyring
(1/1) checking package integrity
error: failed to commit transaction (wrong or NULL argument passed)
Errors occurred, no packages were upgraded.

Also make the ret checking more consistent.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-12-03 21:31:34 +10:00
Ivy Foster
08f4ae709c Add fossil scm support to makepkg
Signed-off-by: Ivy Foster <escondida@iff.ink>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 21:58:40 +10:00
morganamilo
73e0d7dedc libalpm: add alpm_option_get_parallel_downloads
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 21:10:16 +10:00
morganamilo
66f9f315cf libalpm: set errno when setting parallel downloads with an invalid number
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 21:08:13 +10:00
morganamilo
75cfce9468 libalpm: clarify alpm_download_event_completed_t status
The comment makes it seem that the result itself is an error code. But
all it does is simply return -1 to indicate an error occured;

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 21:07:48 +10:00
morganamilo
4b8c274f7f libalpm: don't call dlcb when not set
Fixes FS#68728:

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 16:31:27 +10:00
morganamilo
9dc29ebf5f libalpm: set parallel_downloads to 1 when creating the handle
Fixes FS#68729

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 16:19:24 +10:00
Anatol Pomozov
db4092e33d Move cursor to the end of the screen at the SIGINT
It requires exposing 'move cursor to the end' function in a pacman
header file. We use it as a chance to make naming of the cursor management
functions more consistent.

Note that there is still possibility of a race condition in the cursor
update logic. 'update cursor index variable' and 'send ASCII control
symbols to console' is not an atomic operation. So if an SIGINT is
received between these two action then cursor position is going to be
screwed.

Fixes FS#67973

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 16:10:26 +10:00
Anatol Pomozov
2859a6eefc Go to the end of screen if 'printonly' mode enabled
At the end of download operation our code makes sure the cursor is moved
to the end of the drawing area. But 'printonly' mode has its own if() branch
that skips this cursor alignment. Add cursor_goto_end() to the 'printonly'
codepath to make sure it does not clobber previous output.

Fixes FS#68355

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 15:47:47 +10:00
Michael Straube
94ac3330dd libmakepkg: compress: fix tar extension
With commit 74aacf4495 creating uncompressed .tar
packages fails.

  -> Compressing package...
/usr/share/makepkg/util/compress.sh: line 70: COMPRESS.TAR[@]: invalid variable name
bsdtar: Write error

Empty the '$ext' variable for the '.tar' extension in get_compress_command() to
fix this. We would fallback to cat for 'tar' anyways.

Signed-off-by: Michael Straube <michael.straubej@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-11-26 15:45:29 +10:00
Michael Straube
4d8f58d3b9 makepkg: emptydirs: fix typo
Fix typo in a comment in tidy_emptydirs().

Signed-off-by: Michael Straube <michael.straubej@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-10-21 11:19:01 +10:00
Eli Schwartz
c99a3cc867 makepkg: properly localize some internal function variables
We leaked fullver and pkgarch all over the place, and only conditionally
unset the other variables. Marking them local is a more proactive
solution.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-10-21 11:18:32 +10:00
Eli Schwartz
f76bd2c6c1 makepkg: fix signing of source packages
In commit c6b04c0465 the signing stage was
moved out of fakeroot, and thus into the main control flow instead of
create_{,src}package

While the function for signing binary packages has logic to build
and gpg-sign multiple filenames, the source package never got this
special treatment. This would be fine, except it uses the standard
variables to set define the filename... like ${fullver}, which is
usually set beforehand, but in this case is not. We don't define fullver
globally as it's an internal implementation detail, except by sheer
coincidence if PKGVERFUNC is false due to improperly guarded code.

Result: source packages didn't end up signed. Instead, we raised a logic
error:

==> WARNING: Failed to sign package file somepackage-.src.tar.gz.

==> ERROR: An unknown error has occurred. Exiting...

Instead, let's just build the version inline, since we only use it once.

Reported-by: GaKu999 <g4ku999@gmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-10-21 11:17:14 +10:00
Eli Schwartz
406a37206f makepkg: libprovides: don't provide both versioned and unversioned sonames
If multiple files match the pattern libfoo.so*, we want to check each of
them and see if they are shared libraries, and if so, if they have
versions attached.

But some packages can have both shared libraries and random files which
match the filename pattern. This is true at least for files in
/usr/share/gdb/auto-load/, which must match the filename they are paired
with, followed by "-gdb.py" (or some other gdb scripting ext), but
definitely don't contain a shared library. In this case, we don't want
to double-report the library in the generated provides.

It's also possible (probably) for a package to provide a versioned as
well as an unversioned shared library, but in such cases a single
provides entry is sufficient to cover both cases (and the libdepends
for the depending package would contain an unversioned dependency).

Solve this by keeping track of whether we have added a versioned soname
provides already, and then only adding a maximum of one unversioned
provides *iff* there isn't a versioned one yet.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-23 17:12:01 +10:00
Chih-Hsuan Yen
4533c6a8e0 util.c: table_print_line: properly align texts involving CJK
For printf in C, width is counted as bytes rather than Unicode width. [1]

> If the precision is specified, no more than that many bytes are written.

[1] Section 7.21.6, N2176, final draft for ISO/IEC 9899:2017 (C18)

Thanks Andrew Gregory for suggesting a simpler approach.

Fixes FS#59229

Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-23 17:12:01 +10:00
Anatol Pomozov
ff7ff3c58d FS#66472: Remove *.sig file if package corrupted
In case if a package corrupted (e.g. signature or hash is invalid)
pacman tries to remove the package file to redownload it anew the next time.
Remove *.sig file as well to make sure no data is left for the invalid
package.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-23 17:12:01 +10:00
Ronan Pigott
d85d9c8c60 Add pacman-conf zsh completions
Signed-off-by: Ronan Pigott <rpigott@berkeley.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-03 12:55:34 +10:00
Eli Schwartz
04b69957c8 remove more autotools files
We forgot to remove m4/ in commit 454ea02438
and now it's tragically reminding me of autotools!

Also take this opportunity to drop some symlinks in lib/libalpm/ for
libcommon source files. In autotools these were built specifically for
libalpm and needed to be available in that directory, but the meson
setup just has libalpm depend on libcommon. So these pseudo source files
aren't needed anymore.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-03 12:49:13 +10:00
Allan McRae
f235cea733 makepkg.conf: Reword "Defaults"
FS#61661 notes that we have a comment "Defaults" value for BUILDENV and OPTIONS
but that does not necessarily correspond to what the example makepkg.conf sets.

Change the comment to "Makepkg defaults" to indicate this is what makepkg will
do unless told otherwise.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-09-03 12:44:24 +10:00
Anatol Pomozov
f53ac85ff6 Enable sha256/md5 hash verification if detached signatures are used
Pacman has multiple ways to verify package content integrity:
 - gpg signature
 - sha256
 - md5

These verification mechanisms overlap each other. gpg signatures already contain
hash value of the package content. So if a package signature is present then
pacman ignored the other 2 hash values. This worked well with signtures
embedded into pacman database.

Recently pacman got an ability to handle detached signatures (*.sig files
located next to the package files). If pacman verifies detached signature only
then one can replace pkg+sig files with some other content and pacman still
processes it as a valid package. To prevent it we need to verify
database<->package integrity using hash values stored in the database.

This commit fixes FS#67232

The new debug output is:
  checking package integrity...
  debug: found cached pkg: /var/cache/pacman/pkg/ruby-2.7.1-2-x86_64.pkg.tar.zst
  debug: sha256sum: 77baf61c62c5570b3a37cf0c3b16c5d9a97dde6fedd1a3528bf0cc5f96dd5e52
  debug: checking sha256sum for /var/cache/pacman/pkg/ruby-2.7.1-2-x86_64.pkg.tar.zst
  debug: sig data: <from .sig>
  debug: checking signature for /var/cache/pacman/pkg/ruby-2.7.1-2-x86_64.pkg.tar.zst
  debug: 1 signatures returned
  debug: fingerprint: B5971F2C5C10A9A08C60030F786C63F330D7CB92

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-08-10 19:25:59 +10:00
Anatol Pomozov
62246b9355 Fix error during keyring checking
With current master version the 'keyring checking' step produces an error:
  debug: returning error 6 from alpm_pkg_get_sig (../lib/libalpm/package.c: 274) : wrong or NULL argument passed

The package signature is still checked later at the integrity verification step though.

This commit fixes keyring checking and now the debug log looks like this:
  debug: found cached pkg: /var/cache/pacman/pkg/ruby-2.7.1-2-x86_64.pkg.tar.zst
  debug: found detached signature /var/cache/pacman/pkg/ruby-2.7.1-2-x86_64.pkg.tar.zst.sig with size 566
  debug: found signature key: 786C63F330D7CB92
  debug: looking up key 786C63F330D7CB92 locally
  debug: key lookup success, key exists

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-08-10 10:02:02 +10:00
Eli Schwartz
2403fc9732 repo-add: use more libmakepkg to handle common compression routines
Currently the list of supported formats for an archive, is maintained in
two places. And repo-add does not actually get updated. :(

In the process, remove some of the logical duplication when calling
bsdtar/compress_as.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-08-10 09:57:37 +10:00
Eli Schwartz
74aacf4495 libmakepkg: extend compress.sh to also permit checking validity
get_compression_command() can now be used to do upfront checks for
whether a given extension is known to do something successfully. This is
useful when writing tools in which an unknown compression type is a
fatal error.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-08-10 09:57:32 +10:00
Morten Linderud
2a352dc059 doc/makepkg.8: Added punctuations.
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-14 23:44:16 +10:00
Anatol Pomozov
14c0e53eed Check that destfile_name exists before using it
In some cases (when trust_remote_name is used for a URL without a filename and
no Content-Disposition is provided by the server) destfile_name will be
NULL. In this case payload data will be stored in tempfile_name and no
destfile_name is set.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-14 23:43:10 +10:00
Anatol Pomozov
1fd95939db Do not free payload fields in the middle of this structure use
At the end of payload use it calls _alpm_dload_payload_reset()
that will free() these and other fields anyway.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-14 23:41:45 +10:00
Anatol Pomozov
a8bdc2e10a Build signature remote name based on the main payload name
The main payload final name might be affected by url redirects or
Content-Disposition HTTP header value.

We want to make sure that accompanion *.sig filename always matches the
package filename. So ignore finalname/Content-Disposition for the *.sig file.

It also helps to fix a corner case when the download URL does not contain
a filename and server provides Content-Disposition for the main payload
but not for the signature payload.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-14 23:39:37 +10:00
Anatol Pomozov
b01bcc7d3d Fallback to detached signatures during keyring check
Pacman has a 'key in keyring' verification step that makes sure the signatures
have a valid keyid. Currently pacman parses embedded package signatures only.

Add a fallback to detached signatures. If embedded signature is missing then it
tries to read corresponding *.sig file and get keyid from there.

Verification:
  debug: found cached pkg: /var/cache/pacman/pkg/glib-networking-2.64.3-1-x86_64.pkg.tar.zst
  debug: found detached signature /var/cache/pacman/pkg/glib-networking-2.64.3-1-x86_64.pkg.tar.zst.sig with size 310
  debug: found signature key: A5E9288C4FA415FA
  debug: looking up key A5E9288C4FA415FA locally
  debug: key lookup success, key exists

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-07 21:38:13 +10:00
Anatol Pomozov
f3dfba73d2 FS#33992: force download *.sig file if it does not exist in the cache
In case if *.pkg exists but *.sig file does not we still have to pass
the pkg to multi_download API.

To avoid redownloading *.pkg file we use CURLOPT_TIMECONDITION curl option.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-07 21:38:00 +10:00
Anatol Pomozov
78d6dcec6c Add a utility function to check whether a file exists in the cache
It is similar to _alpm_filecache_find() but does not return a
dynamically allocated memory to user. Thus the user does not need to
free this resource.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-07 21:36:56 +10:00
Anatol Pomozov
34ba8d984d Do not use counter for error tracking
Current code uses an incrementing counter to check whether a function
returned error:

  errors += some_function();
  if(errors) { goto finish }

Replace with a more standard variable
  errors = some_function();
  if(errors) { goto finish }

Rename 'errors' variable to a more typical 'ret'.

Avoid reporting both ALPM_EVENT_PKG_RETRIEVE_FAILED and
ALPM_EVENT_PKG_RETRIEVE_DONE in the error path.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-07 21:35:39 +10:00
Anatol Pomozov
f078c2d3bc Move signature payload creation to download engine
Until now callee of ALPM download functionality has been in charge of
payload creation both for the main file (e.g. *.pkg) and for the accompanied
*.sig file. One advantage of such solution is that all payloads are
independent and can be fetched in parallel thus exploiting the maximum
level of download parallelism.

To build *.sig file url we've been using a simple string concatenation:
$requested_url + ".sig". Unfortunately there are cases when it does not
work. For example an archlinux.org "Download From Mirror" link looks like
this https://www.archlinux.org/packages/core/x86_64/bash/download/ and
it gets redirected to some mirror. But if we append ".sig" to the end of
the link url and try to download it then archlinux.org returns 404 error.

To overcome this issue we need to follow redirects for the main payload
first, find the final url and only then append '.sig' suffix.
This implies 2 things:
 - the signature payload initialization need to be moved to dload.c
 as it is the place where we have access to the resolved url
 - *.sig is downloaded serially with the main payload and this reduces
 level of parallelism

Move *.sig payload creation to dload.c. Once the main payload is fetched
successfully we check if the callee asked to download the accompanied
signature. If yes - create a new payload and add it to mcurl.

*.sig payload does not use server list of the main payload and thus does
not support mirror failover. *.sig file comes from the same server as
the main payload.

Refactor event loop in curl_multi_download_internal() a bit. Instead of
relying on curl_multi_check_finished_download() to return number of new
payloads we simply rerun the loop iteration one more time to check if
there are any active downloads left.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-07-07 21:35:35 +10:00
Denton Liu
6b9c1b4d54 srcinfo.sh: remove trailing newline
When a .SRCINFO file is generated via `makepkg --printsrcinfo`, each
section is concluded with an empty line. This means that at the end of
the file, an empty line remains. This is considered a trailing
whitespace error. In fact, `git diff --check` will warn about this,
saying "new blank line at EOF."

Instead of closing each section off with an empty line, use the empty
line to separate sections, omitting the empty line at the end of the
file.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-26 16:00:26 +10:00
Anatol Pomozov
84723cab5d Cleanup the old sequential download code
All users of _alpm_download() have been refactored to the new API.
It is time to remove the old _alpm_download() functionality now.

This change also removes obsolete SIGPIPE signal handler functionality
(this is a leftover from libfetch days).

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
2020-06-26 15:59:16 +10:00
Anatol Pomozov
16d98d6577 Convert '-U pkg1 pkg2' codepath to parallel download
Installing remote packages using its URL is an interesting case for ALPM
API. Unlike package sync ('pacman -S pkg1 pkg2') '-U' does not deal with
server mirror list. Thus _alpm_multi_download() should be able to
handle file download for payloads that either have 'fileurl' field
or pair of fields ('servers' and 'filepath') set.

Signature for alpm_fetch_pkgurl() has changed and it accepts an
output list that is populated with filepaths to fetched packages.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
2020-06-26 15:59:08 +10:00
Eli Schwartz
59e751f72d doc/pacman.8: fix typo
Fixes FS#67000

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-19 15:38:24 +10:00
Allan McRae
7ba8e5f376 pacman-key: change signing key to RSA4096
RSA2048 may have been fine when this was written many moons ago, but time
this has a bump.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-15 19:17:41 +10:00
Eli Schwartz
02ae97b0da makepkg/repo-add: do not accept public-only keys for signing
If it's not listed by --list-secret-key we don't care if it has been
imported into your keyring, it's unusable. And you might not have a
private key at all in the no-keyid-specified case.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:57:59 +10:00
Eli Schwartz
899d39b635 makepkg/repo-add: handle GPGKEY with spaces
We pass this to gpg -u and this gpg option can accept a number of
different formats, not just the historical hexadecimal fingerprint we
assumed. We should not barf hard if a format is used which happens to
contain spaces.

This also fixes a validation bug. When we initially check if the desired
key is available, we don't quote spaces, so gpg goes ahead and treats
each space-separated string as a *different key* to search for,
returning partial matches, and returning success if at least one key is
found. But gpg --detach-sign -u will certainly not accept multiple keys!

Fixes FS#66949

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:56:30 +10:00
Eli Schwartz
bf458cced7 libmakepkg: fix regression in sending plain() output to stderr
In commit 882e707e40 we changed message
output to go to stdout by default, unless it was an error. The plain()
function doesn't *look* like an error function, but in practice it was
-- it's used to continue multiline messages, and all in-tree uses were
for warning/error.

This is a problem both because we're sending output to the wrong place,
and because in some cases, we were performing error logging from a
function which would otherwise return a value to be captured in a
variable using command substution.

Fix this and straighten out the API by providing two functions: one for
continuing msg output, and one which wraps this by sending output to
stderr, for continuing error output.

Change all callers to use the second function.
2020-06-11 10:54:54 +10:00
Eli Schwartz
381e113755 makepkg: correctly handle missing download clients
This was broken in commit 882e707e40,
which changed 'plain()' messages to go to stdout, which was then
captured as the download client in question: cmdline=("Aborting...").

The result was a very confusing error message e.g.

/usr/share/makepkg/source/file.sh: line 72: $'\E[1m': command not found

or with makepkg --nocolor:

/usr/share/makepkg/source/file.sh: line 72: Aborting...: command not found

The problem here is that we checked to see if an asynchronous subshell,
in our case <(...), failed, by checking if its captured stdout is
non-empty. Which is terrible, and also a limitation of old bash. But
bash 4.4 can use wait $! to retrieve the return value of an asynchronous
subshell. Now we target that as our minimum, we can sanely handle errors
in such functions.

Losing error messages on stdout by capturing them in a variable instead
of printing them, continues to be a problem, but this will be fixed
systematically in a later commit.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:53:24 +10:00
Eli Schwartz
817f9fb715 makepkg: guard against undefined git pinned sources
If something like source=(..."#commit=") is used, e.g. due to failed
variable expansion, we try to check out an empty refspec as nothing at
all, and end up just running "git checkout". This happens because we
fail at variable expansion too -- so let's quote our variables properly
and make sure git sees this as an empty refspec, so it can error out.

Also make sure it is interpreted as a ref instead of a path.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:50:52 +10:00
Eli Schwartz
3bd88821bb build: add libintl dependency to meson and the .pc file
In order to use gettext on systems where it is not part of libc, the
correct linker flags are needed in libalpm.pc (for static compilation).
This has never been the case.

The new meson build system currently only checks for ngettext in libc,
but does not fall back to searching for the existence of -lintl; add it
to the libalpm dependencies.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:47:14 +10:00
Filipe Laíns
e348ba3881 ci: cache packages
Results in ~40s saved in each job.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-06-11 10:30:15 +10:00
Allan McRae
40bbaead44 Revert "makepkg: drop duplicate reporting of missing dependencies"
This removed all information on dependency failures if the --syncdeps
flag was not used.  A better approach is needed.

This reverts commit 4246a4cc4f.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-11 10:27:54 +10:00
Allan McRae
5f6ef895b1 libalpm/signing.c: Fix calculation of packet size in parse_subpacket
Given RFC 4880 provides the code to do this calculation, I am not sure
how I managed to stuff that up!  This bug was only exposed when a
signature made with "include-key-block" was added to the Arch repos,
which provided a subpacket with the required size to hit this issue.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-01 10:59:08 +10:00
Dave Reisner
23b50d60e3 Avoid depending on side effects in assert(...) expressions
When building with -DNDEBUG, assert statements are compiled out to
no-ops. Thus, we can't depend on assignments or other computations
occurring inside the assert().

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-01 10:59:08 +10:00
Eli Schwartz
3674144a74 libmakepkg/strip: don't re-add the same debug source multiple times
It's either a waste of work, or triggers edge cases in some packages
(like coreutils-8.31) where the source file is readonly and cp gets a
permission denied error trying to overwrite it with an identical copy of
itself.

Also while we are at it, make the variable names be something readable,
because I could barely tell what this was doing while editing it.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-06-01 10:59:08 +10:00
Allan McRae
454ea02438 Remove autotools support
This removes support for autotools in favour of meson.
2020-06-01 10:59:08 +10:00
Levente Polyak
8ce142a255 makepkg: deterministic PKGINFO libprovides for multiple library versions
While iterating over the provides array, the find call for locating a
shared library may result in listing multiple entries which by itself
does not produce a stable deterministic order and may vary depending on
the underlying filesystem.
To provide a stable listing and a reproducible .PKGINFO file the result
of find is piped to sort with a static LC_ALL=C localisation.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-11 12:19:40 +10:00
Eli Schwartz
8e769ddb8a Log invalid conf settings as an error
This is not a warning, _parse_options() returns failure without even
parsing further lines and the attempted pacman/pacman-conf program
execution immediately aborts. Warnings are for when e.g. later on if we
don't recognize a setting at all, we skip over it and have enough
confidence in this to continue executing the program.

The current implementation results in pacman-conf aborting with:

warning: config file /etc/pacman.conf, line 60: invalid value for 'ParallelDownloads' : '2.5'
error parsing '/etc/pacman.conf'

or pacman -Syu aborting with the entirely more cryptic:

warning: config file /etc/pacman.conf, line 59: invalid value for 'ParallelDownloads' : '2.5'

and this isn't just a problem for the newly added ParallelDownloads
setting, either, you could get the same problem if you specified a
broken XferCommand, but that's harder as it's more accepting of input
and you probably don't hit this except with unbalanced quotes.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-11 12:19:40 +10:00
Eli Schwartz
7423b16604 pacman-conf: fix incomplete support for ILoveCandy
This was only partially implemented in the original implementation.
`pacman-conf | grep ILoveCandy` would tell you if it was set, but
querying directly by name would not.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-11 12:19:40 +10:00
Eli Schwartz
559590256c pacman-conf: add support for new ParallelDownloads config option
This was forgotten in the initial implementation, so it was impossible
to figure out the value from a script, or correctly roundtrip the
config file.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-11 12:19:40 +10:00
Anatol Pomozov
22a58f5420 Swap alpm_db_update() implementation to multiplexed version
Now when all callers of the old alpm_db_update() function are gone we can
remove this implementation. And then rename alpm_dbs_update() function to
alpm_db_update().

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:39 +10:00
Anatol Pomozov
557845bc97 Convert downloading databases to the new multiplexed API
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:39 +10:00
Anatol Pomozov
0346e0eef2 Convert download packages logic to multiplexed API
Create a list of dload_payloads and pass it to the new _alpm_multi_*
interface.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:39 +10:00
Anatol Pomozov
b96e0df4dc Implement multibar UI
Multiplexed download requires ability to draw UI for multiple active progress
bars. To implement it we use ANSI codes to move cursor up/down and then
redraw the required progress bar.
`pacman_multibar_ui.active_downloads` field represents the list of active
downloads that correspond to progress bars.
`struct pacman_progress_bar` is a data structure for a progress bar.

In some cases (e.g. database downloads) we want to keep progress bars in order.
In some other cases (package downloads) we want to move completed items to the
top of the screen. Function `multibar_move_completed_up` allows to configure
such behavior.

Per discussion in the maillist we do not want to show download progress for
signature files.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:39 +10:00
Anatol Pomozov
c78eb48d91 Extend download callback interface with start/complete events
With the previous download interface the callback uses the first progress
event as 'download has started' signal. Unfortunately it does not work with
up-to-date files that never receive 'download progress' events.
Up-to-date database messages are currently handled in sync_syncdbs()
after the sequential download is completed and a result from ALPM is
received. But this is not going to work with multiplexed download
interface that returns the result only after all files are completed.

Another problem with 'first progress event is the beginning of the
download' is that such events time are unpredictable. Thus the UI progress
bar order might differ from what has been passed by client to
alpm_dbs_update() function. We actually want to keep the dbs progress bars
in a strict order.

To help to solve the given problems extend the download callback to
allow 2 more events - download started and completed. 'Download started'
events appear in the same order as in the list given by a client.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
64c4669f57 Introduce event types for start/end database list download
Multiplexed database/files downloads will use multiple progress bars.
The UI logic is quite complicated and printing error messages while
handling multiple progress bars is going to be challenging.

Instead we are going to save all ALPM error messages to a list and flush
it at the end of the download process. Use on_progress variable that
blocks error messages printing.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
6a331af27f Implement multiplexed download using mCURL
curl_multi_download_internal() is the main loop that creates up to
'ParallelDownloads' easy curl handles, adds them to mcurl and then
performs curl execution. This is when the paralled downloads happens.
Once any of the downloads complete the function checks its result.
In case if the download fails it initiates retry with the next server
from payload->servers list. At the download completion all the payload
resources are cleaned up.

curl_multi_check_finished_download() is essentially refactored version of
curl_download_internal() adopted for multi_curl. Once mcurl porting is
complete curl_download_internal() will be removed.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
1d42a8f954 Implement _alpm_multi_download
It is an equivalent of _alpm_download but accepts a list of payloads.

curl_multi_download_internal() is a stub at this moment and will be
implemented in the later commits of this patch series.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
fa68c33fa8 Inline dload_payload->curlerr field into a local variable
dload_payload->curlerr is a field that is used inside
curl_download_internal() function only. It can be converted to a local
variable.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
dc98d0ea09 Add multi_curl handle to ALPM global context
To be able to run multiple download in parallel efficiently we need to
use curl_multi interface [1]. It introduces a set of APIs over new type
of handler 'CURLM'.

Create CURLM object at the application start and set it to global ALPM
context.

The 'single-download' CURL handle moves to payload struct. A new CURL
handle is created for each payload with intention to be processed by CURLM.

Note that curl_download_internal() is not ported to CURLM interface due
to the fact that the function will go away soon.

[1] https://curl.haxx.se/libcurl/c/libcurl-multi.html

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
a8a1a1bb3e Introduce alpm_dbs_update() function for parallel db updates
This is an equivalent of alpm_db_update but for multiplexed (parallel)
download. The difference is that this function accepts list of
databases to update. And then ALPM internals download it in parallel if
possible.

Add a stub for _alpm_multi_download the function that will do parallel
payloads downloads in the future.

Introduce dload_payload->filepath field that contains url path to the
file we download. It is like fileurl field but does not contain
protocol/server part. The rationale for having this field is that with
the curl multidownload the server retry logic is going to move to a curl
callback. And the callback needs to be able to reconstruct the 'next'
fileurl. One will be able to do it by getting the next server url from
'servers' list and then concat with filepath. Once the 'parallel download'
refactoring is over 'fileurl' field will go away.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Anatol Pomozov
fe8e13341b Add config option to specify amount of parallel download streams
It includes pacman.conf new 'ParallelDownloads' option that
specifies how many concurrent downloads cURL starts in parallel.

Add alpm_option_set_parallel_downloads() ALPM function that
allows to set this config option programmatically.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Eli Schwartz
cffda331ad doc: remove vim modelines from BUILDINFO(5)
We (thought we) removed all modelines from the project in commit
860e4c4943, but apparently this one
sneaked in by virtue of this manpage being added to the project after
the "remove all the modelines" patch was submitted, but before it was
applied.

I must have failed to update the patch to remove it from this file also.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-09 11:58:21 +10:00
Eli Schwartz
411b12d09d editorconfig: set meson indentation style
meson.build gets two-space indents, but our global tabbed default was
overriding this.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-06 13:48:15 +10:00
Eli Schwartz
3a6c9220ff meson: use better check for debug builds
meson 0.48 added the 'debug' and 'optimization' builtin options, which
bidirectionally map to the buildtype, but in some cases where debug is
enabled, the builtype may be custom. Checking the 'debug' option lets us
detect every case currently detected, plus a few more, and does so in a
shorter and more concise manner.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-06 13:48:07 +10:00
Allan McRae
df30f10672 Convert gitlab valgrind runner to meson
Turns out environmental variables do get passed through fakechroot!

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-06 13:48:00 +10:00
Dave Reisner
cebda6d0ee meson: handle XFAIL tests outside of TAP
This change causes expected fail tests to actually fail by eliding the
'# TODO' from the test plan. In turn, we can now properly use
'should_fail' in the meson test() rule and see these expected fail
tests in the output:

Before:
  ...
  320/332 upgrade077.py                   OK 0.12679290771484375 s
  321/332 upgrade078.py                   OK 0.12620115280151367 s
  322/332 upgrade080.py                   OK 0.1252129077911377 s
  ...

  Ok:                 332
  Expected Fail:      0
  Fail:               0
  Unexpected Pass:    0
  Skipped:            0
  Timeout:            0

After:
  ...
  320/332 upgrade077.py                   OK 0.12679290771484375 s
  321/332 upgrade078.py                   EXPECTEDFAIL0.12620115280151367 s
  322/332 upgrade080.py                   OK 0.1252129077911377 s
  ...

  Ok:                 326
  Expected Fail:      6
  Fail:               0
  Unexpected Pass:    0
  Skipped:            0
  Timeout:            0

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-05 09:14:32 +10:00
Allan McRae
0b81fb64d3 Add Gitlab Runner configuration
Arch Linux is setting up a Gitlab instance.  This adds CI for the pacman
project, testing a range of configurations on Arch and basic builds on
Fedora and Debian.

Note that asciidoc is specifically not installed on the Debian run because
it is all sorts of broken...  Also, the defaults have been set to meson, with
two autotools tests that will soon be removed.

Original-file from: Andrew Gregory <andrew.gregory.8@gmail.com>
Altered-to-run-on-Arch-Gitlab by: Sven-Hendrik Haase <svenstaro@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-05-05 09:14:23 +10:00
Ivy Foster
969e1ab996 Add NoProgressbar to pacman.conf options
This is useful for dumb terminals that do not support escape
sequences.

Signed-off-by: Ivy Foster <escondida@iff.ink>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-29 13:57:53 +10:00
Rikard Falkeborn
2439222375 Constify some input pointers
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-29 13:57:45 +10:00
Allan McRae
3ea7fdd96c pacman.8: Fix typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-15 11:05:55 +10:00
Carson Black
b323528491 Dull version colour numbers in summary
Version colour numbers are dulled in the non-verbose transaction summary
when colours are enabled.

To prevent a regression, this patch also adds handling of strings with
ANSI codes to string_length as to not break the transaction summary's
output functions when colour codes are in the package name strings.

Signed-off-by: Carson Black <uhhadd@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-15 11:05:55 +10:00
Allan McRae
6ba250e400 Use GOTO_ERR throughout
The GOTO_ERR define was added in commit 80ae8014 for use in future commits.
There are plenty of places in the code base it can be used, so convert them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13 23:44:46 +10:00
Allan McRae
0eda92c5d4 Use STRDUP for error checking in more places
Use STRDUP() over strdup() to catch memory allocation errors.

There are still some instances of strdup left, but these are in functions
that currently have no error path and would require a larger rework.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13 23:44:46 +10:00
Rikard Falkeborn
1b32897453 Add REALLOC macro to simplify realloc error handling
realloc can fail just like the other memory allocation functions. Add a
macro to simplify handling of realloc failures, similar to the already
existing MALLOC, CALLOC, etc.

Replace the existing realloc uses with the new macro, allowing us to
move tedious error handling to the macro. Also, in be_package and
be_sync, this fixes hypothetical memory leaks (and thereafter null
pointer dereferences) in case realloc fails to shrink the allocated
memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13 23:44:46 +10:00
Earnestly
1d39557aa0 Use noextract with pacman-conf NoExtract
Current code accidently uses noupgrade for the NoExtract directive.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13 23:44:46 +10:00
Anatol Pomozov
87b74fcd82 Hide cursor while pacman is running
Use ASCII control codes to hide cursor at the pacman start and then
show the cursor when pacman finishes.

It helps to avoid annoying blinking when progress bars are re-drawn.

Cursor is reenabled if pacman expects user's input.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-03-13 11:24:01 +10:00
Allan McRae
ddd5b0a462 Add file and line number to RET_ERR{,_VOID}
Following the example of the recently added GOTO_ERR, adding the file and
line number in addition to the function name in our debug messages is
potentially useful.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-03-13 11:23:36 +10:00
Anatol Pomozov
80ae80149a Add GOTO_ERR() macro to set error and then goto a label
This is a macro similar to RET_ERR but useful in the case when we need
to record an error and then jump to some cleanup section.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-03-09 16:34:17 +10:00
Allan McRae
0deff63efa Remove unneeded goto cleanup
Since commit 2ee7a8d8, there is no cleanup needed in this function. Just
return instead of jumping to the cleanup label.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-03-09 14:51:38 +10:00
Anatol Pomozov
e578903b60 Move flushing 'output' list into separate function
'output' is a list of messages that pacman received but delayed printing
to avoid messing with UI.

Such functionality is useful for the upcoming multi-line progress bar
UI. Let's move it to a separate function.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-03-06 09:28:13 +10:00
Anatol Pomozov
aff69f43b1 Do not download files if find_dl_candidates() fails
One reason why the function returns an error is some repo
does not have any servers.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-03-05 16:15:44 +10:00
Anatol Pomozov
130db5cc9e Simplify construction of payloads in download_files
Currently, download_files() creates payloads for all packages then
iterates over them, calling download_single_file.  This can be
simplified by looping over packages and constructing the payload as needed.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-02-24 11:27:23 +10:00
Dave Reisner
4246a4cc4f makepkg: drop duplicate reporting of missing dependencies
When pacman fails to satisfy deps, we might see output like the
following:

==> Making package: spiderfoot 3.0-1 (Thu 06 Feb 2020 12:45:10 PM CET)
==> Checking runtime dependencies...
==> Installing missing dependencies...
error: target not found: python-pygexf
==> ERROR: 'pacman' failed to install missing dependencies.
==> Missing dependencies:
  -> python-dnspython
  -> python-exifread
  -> python-cherrypy
  -> python-beautifulsoup4
  -> python-netaddr
  -> python-pysocks
  -> python-ipwhois
  -> python-ipaddress
  -> python-phonenumbers
  -> python-pypdf2
  -> python-stem
  -> python-whois
  -> python-future
  -> python-pyopenssl
  -> python-docx
  -> python-pptx
  -> python-networkx
  -> python-cryptography
  -> python-secure
  -> python-pygexf
  -> python-adblockparser
==> Checking buildtime dependencies...
==> ERROR: Could not resolve all dependencies.

This is misleading -- the only truly missing package is python-pygexf,
but we fail to remove sync-able deps from our deplist and report
everything as if it were missing. Simply drop this extra reporting
because pacman already tells us exactly what couldn't be resolved.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-02-12 18:37:44 +10:00
Allan McRae
e76ec94083 build-aux/update-copyright 2019 2020
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-02-10 10:46:03 +10:00
Allan McRae
033405c963 Add pacman-hooks.5 man page symlink
Improve discoverability of the alpm-hooks man page by adding a pacman-hooks
symlink.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-02-10 10:38:38 +10:00
Anatol Pomozov
886a6677a8 Eliminate extra loop over dbs_sync
Current flow looks like
  loop dbs_sync {
    loop pkgs {
      if pkg.db == db then process(pkg, db)
    }
  }

Package sync transaction always has a counterpart in the dbs_sync list
(I cannot come up with a use-case when it is not true). So the loop can
be simplified to:

  loop pkgs {
    process(pkg, pkg.db)
  }

Tested: 'ninja test' & manually by using pacman with this patch for a
week
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-31 00:38:36 +10:00
morganamilo
d0c487d4dc Docs docs docs
libalpm: move docs from .c files into alpm.h And fix/expand some
along the way.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-28 10:46:27 +10:00
morganamilo
0a25548cd0 libalpm: fix alpm_option_set_assumeinstalled
It looks like this function has never actually worked. The current list
is never set to NULL after being freed. So the new deps were just
appended to the already freed list, leading to a segfault.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-28 10:46:27 +10:00
Allan McRae
21af798604 makepkg: add CRC checksums and set these to be the default
Checksums arrays should be filled with values provided by upstream.  We
currently have md5 set as an unsecure default, and are constantly asked to
change it to sha2.  However, just changing the default to a stronger checksum
gives the user the impression that "makepkg -g" checksums are perfect.

Instead, change the default checksum to a CRC, to make it clear that any
checksum generated purely by "makepkg -g" is not ideal.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-28 10:46:26 +10:00
Allan McRae
c3852ff425 Note that checksums from "makepkg -g" are not ideal
Generating checksums with "makepkg -g" only determines that the user of a
PKGBUILD has the same file as the packager (assuming no collision).  This
means an upstream source could be maliciously changed and passed on as valid
by a PKGBUILD.  To avoid this, it is essential that any checksums used in
a PKGBUILD are as provided by upstream.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-28 10:45:42 +10:00
Allan McRae
e54617c7d5 Fix "pacman -U <url>" operations
Commit e6a6d307 detected complete part files by comparing a payload's
max_size to initial_size.  However, these values are also equal when we
use pacman -U on a URL as max_size is set to 0 in that case.  Add a further
condition to avoid that.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-27 17:53:50 +10:00
Eli Schwartz
d626a17ef9 makepkg: make per-package files containing '$pkgname' consistently work
Extracting function variables containing arbitrarily scoped variables of
arbitrary nature is a disaster, but let's at least cover the common case
of using the actual '$pkgname' in an install/changelog file. It's the
odd case of actually being basically justified use of disambiguating
between the same variable used in multiple different split packages...
and also, --printsrcinfo already uses and overwrites the variable
'pkgname' in pkgbuild_extract_to_srcinfo, so this "works" in .SRCINFO
but doesn't work in .src.tar.gz

It doesn't work in lint_pkgbuild either, but in that case the problem is
being too permissive, not too restrictive -- we might end up checking
the same file twice, and printing that it is missing twice.

Fixes FS#64932

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-27 17:53:50 +10:00
Allan McRae
2856a7dea3 Increase maximum database size
We previously has the maximum database size as 25MB.  This was set in the days
before repos had as many packages as they do now, and before we started
distributing files databases.  Increase this limit to 128MB.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-27 17:53:50 +10:00
Allan McRae
2e32d51a26 Remove unneeded ltmain patch
Many moons ago, libtool was bad - I mean worse than today!  It gobbled all
--as-needed and we ended up with an overlinked libalpm.  This was annoying,
particularly when dealing with soname bumps in libraries pacman/libalpm had
no business linking to. Luckily we had a fix, stolen from GNOME I believe.
And with that fix, we lived in harmony with libtool for many years.  Until one
day, unbeknownst to us, libtool was "fixed".  We kept applying our patch,
because it still applied, but it did worse than nothing.  It gobbled up our
other LDFLAGS, and our libalpm started missing out on RELRO and BIND_NOW.
This made the Arch Security Team unhappy. We will make them happy again by
stopping the patch.

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-27 17:53:50 +10:00
Allan McRae
75bf8e887c Increase meson test timeout
Running the testsuite using "PACTEST_VALGRIND=1 ninja test -C build", I ran
into the following failure:

161/332 smoke001.py                             TIMEOUT 30.02 s

I figure an i7 @ 3.10GHz should be enough to run our testsuite... so boost
the meson test timeout to 120 seconds (which should be enough time for
anyone...).

Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-27 17:53:50 +10:00
Allan McRae
0965023fc5 tests: Fix typo in test description 2020-01-27 17:53:50 +10:00
Eli Schwartz
acaed30e24 doc: reformat intro to VCS sources to distinguish the grammar
It's difficult to find it embedded inside a prose paragraph.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-07 11:40:32 +10:00
Eli Schwartz
ee8b4e9283 doc: clarify the format of a PKGBUILD source fragment
Currently, it could be misread to say that a fragment is literally
'commit', rather than 'commit=somehash'. Anecdotally this does not seem
to be obvious to everyone, and rewording it certainly doesn't hurt.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-07 11:40:32 +10:00
Eli Schwartz
435f5fc204 autotools: emit error message when autoconf-archive is missing
Forbid the AX_COMPARE_VERSION macro from being found in the output
configure script. If autoconf-archive is not installed when autoreconf
is run, the following error message is emitted:

configure.ac:231: error: possibly undefined macro: AX_COMPARE_VERSION
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-07 11:40:32 +10:00
Dave Reisner
9883015be2 Use c99 struct initialization to avoid memset calls
This is guaranteed less error prone than calling memset and hoping the
human gets the argument order correct.
2020-01-07 11:40:32 +10:00
Dave Reisner
ffb69c700a Ensure regex object is always initialized
This avoids a crash in filetarget_free() when regex support isn't
requested in files_search().
2020-01-07 11:40:32 +10:00
Ethan Sommer
56e0763c6d libmakepkg: use readelf instead of file for finding ELF file types
Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-12-11 11:02:15 +10:00
morganamilo
b7f61aa557 pacman: print error when -Fx is given invalid regex
When processing the targets for -Fx, compile all the regex ahead of
time, printing an error for each that failed to compile. Then, if they all
compiled successfully, continue with printing files.

Signed-off-by: morganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-12-02 13:56:11 +10:00
Eli Schwartz
0428f6213b makepkg: add the $startdir to package .BUILDINFO
This value is needed for reproducible builds. The reason is because
$BUILDDIR changes its behavior depending on whether it is the same as
$startdir, and the result is that we cannot know whether $srcdir (the
path that is potentially embedded into the final package) is actually
"$BUILDDIR/src" or "$BUILDDIR/$pkgbase/src".

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-26 11:49:24 +10:00
Allan McRae
1e23b45851 Fix documentation of alpm_mtree_next and remove libarchive exposure
The documentation of the return types of alpm_mtree_next was incorrect.
This extended into the relevant function in be_local.c.

Also, return explicit integer values, rather than the ARCHIVE_xxx values,
to avoid unnecessarily exposing frontends to libarchive internals (even
though it makes no functional difference).

Original-work-by: morganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-26 11:37:32 +10:00
Eli Schwartz
3073752bcd pactest: add environment option to run tests with valgrind
In autotools, if we wanted to run tests with valgrind, we used some Make
magic which passed arguments to pactest.py, but that doesn't work in
meson, because all arguments are encoded at configure time. Instead,
let's short-circuit the build runner logic entirely, and teach pactest
to default to running valgrind, when it detects an environment variable
set independent of the build system.

To run the tests with valgrind, we can now use:

PACTEST_VALGRIND=1 meson test -C builddir/

or

PACTEST_VALGRIND=1 make check

It is also possible, but confusing/inconsistent, to use

make check PY_LOG_FLAGS=--valgrind

We *could* add a meson option -Dvalgrind=true, but that is annoying to
reconfigure between test runs, and overall the consensus is it seems
simpler to opt in each time we want to run valgrind, as was already the
case.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-26 11:05:44 +10:00
Eli Schwartz
49a8e90bc7 meson: make non-symlink scripts install for real, and use a better wrapper
We now generate the scripts using their real name, install them using
meson's builtin facility instead of an install_script, and generate the
wrapper scripts in the root of the build directory, instead of a
subdirectory.

This gets us closer to resolving FS#64394.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-26 10:49:57 +10:00
Eli Schwartz
349c22d043 makepkg: fix regression that broke extraction of file:// sources
In commit 9c817b6549 we made these sources
extendable, and heuristically determined the correct extraction
functions to use. But our fallback for protos that didn't have an exact
extract_* function didn't take into account that 'extract_file' matches
an actual proto... so we passed the netfile in while the function
expected a file.

Solution: the function should expect a netfile too, thereby allowing us
to delay an attempted resolution of netfile -> file, to the one case
where it is actually used. This makes us slightly more efficient in the
non-file case, makes our functions a bit more consistent, and makes
file:// extraction work again.

Fixes FS#64648

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-26 10:22:16 +10:00
Allan McRae
55233b69c7 Improved documentation for alpm_db_search() parameters
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-22 09:35:31 +10:00
Allan McRae
8846574eda Fix leak in _alpm_db_search on error condition 2019-11-21 22:42:23 +10:00
Daniel T. Borelli
eaa2770c80 Dereference double pointer before assigning NULL
Daniel T. Borelli <danieltborelli@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-16 15:14:30 +10:00
Allan McRae
6fb233d0ee Add Eli to current maintainers
Also retire Dan into past major contributors.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-16 00:14:34 +10:00
Allan McRae
e6a6d30793 Handle .part files that are the size of the correct package
In rare cases, likely due to a well timed Ctrl+C, but possibly due to a
broken mirror, a ".part" file may have size at least that of the correct
package size.

When encountering this issue, currently pacman fails in different ways
depending on where the package falls in the list to download.  If last,
"wrong or NULL argument passed" error is reported, or a "invalid or
corrupt package" issue if not.

Capture these .part files, and remove the extension. This lets pacman
either use the package if valid, or offer to remove it if it fails checksum
or signature verification.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-15 23:29:20 +10:00
Allan McRae
b9faf65273 pactest: set package tar format to GNU_FORMAT
python-3.8 changed the default tar format to PAX_FORMAT. This caused
issues in our testsuite with package extraction of files with UTF-8
characters as we run the tests under the C locale.

sycn600.py:
error: error while reading package /tmp/pactest-xuhri4xa/var/cache/pacman/pkg/unicodechars-2.0-1.pkg.tar.gz: Pathname can't be converted from UTF-8 to current locale.

Set format back to GNU_FORMAT.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-12 16:14:57 +10:00
Allan McRae
540b19164b libalpm/sync.c: Do not download missing keys multiple times
We now store key structs of our missing key info, so can not search the list
for string matches. This caused missing keys to be downloaded once for every
package they signed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-12 07:29:52 +10:00
morganamilo
27f354a787 pacman+libalpm: handle search errors
Previously, pacman treated no matches and an error during search the
same.

To fix this, alpm_db_search now returns its status as an int and
instead takes the to be returned list as a param. Allowing front ends to
easily differentiate between errors and no matches.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-08 16:32:55 +10:00
morganamilo
94982d0061 pacman: make exact_file an int
We only ever use it as a bool, no need to pass a char* around.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-07 21:43:15 +10:00
Ethan Sommer
1df22d3242 repo-add: use wc -c on stdin instead of file to avoid use of cut
Redirect file to stdin so wc -c doesn't print a file name that needs to
be stripped.

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-07 21:40:44 +10:00
Eli Schwartz
7b73c4a75f build: remove use of handcrafted m4 in configuring scripts
Now that library/ is fully gone, we don't need this anymore.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 16:11:53 +10:00
Eli Schwartz
8c7043390f scripts/library: remove human_to_size
pkgdelta was the last user, and it is gone now.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 15:52:21 +10:00
Allan McRae
2dd7725f2a Remove "Generated from ...; do not edit by hand" from scripts
This is a useless piece of information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 15:46:59 +10:00
Ethan Sommer
3a814ee6bc makepkg: replaces sed in-place with built in substitution
Reads PKGBUILD into an array and replaces the pkgver and pkgrel with
bash parameter substitution, then uses shell redirection to write to to
the file. Because shell redirection follows symlinks, this accomplishes
the same thing as the previous default of using the GNU-specific
--follow-symlinks sed flag.

Removes SEDPATH and SEDINPLACEFLAGS from the build systems as they are
not used elsewhere.

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 12:03:38 +10:00
morganamilo
424129e8d1 pacman: clarify error when alpm fails to init
Currently pacman is hard coded to print the dbpath, then the error alpm
returned. Even though the error could really be caused by anything.

So instead just print the arugemnts given to alpm and not assume the
resulting error message is releated to either path.

Fixes FS#59595

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-06 10:54:54 +10:00
Allan McRae
27955a0fee Move update-copyright into build-aux
This is a useful function to update all our copyright years. Move
it into build-aux so that it is not lost in the switch to meson.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 15:25:52 +10:00
Ethan Sommer
1bfae7d14a libmakepkg: fix empty arguments in parseopts
Previously parseopts checked if there was an argument by checking
that the string was non-empty, resulting in empty arguments being
incorrectly considered non-existent. This change makes parseopts check
if arguments exist at all, rather than checking that they are non-empty

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 14:47:15 +10:00
Matthew Sexton
091b244d0f pacman-key: ignore already lsigned/deleted keys
Added two new functions, key_is_lsigned() and key_is_revoked()
that check whether a key has been locally signed or revoked
respectively during --populate. If the key is already signed
or revoked, it is quietly ignored.

Suggested-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Matthew Sexton <wsdmatty@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 14:16:31 +10:00
Matthew Sexton
e1f5f21983 pacman-key: hide lsign and revoke output behind --verbose
To cut down on spam during --populate, both locally signing and
revoking keys now hide the specific keys being signed or revoked,
but can be shown with --verbose. A count was added, to show the
number of keys signed/revoked during the process.

Partially Implements:
FS#64142 - pacman-key: make populate less noisy

Signed-off-by: Matthew Sexton <wsdmatty@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 14:13:10 +10:00
Ethan Sommer
7be7552329 libmakepkg: add optional argument support to parseopts
Adds a "?" suffix that can be used to indicate that an option's argument is
optional.

This allows options to have a default behaviour when the user doesn't
specify one, e.g.: --color=[when] being able to behave like --color=auto
when only --color is passed

Options with optional arguments given on the command line will be returned
in the form "--opt=optarg" and "-o=optarg". Despite that not being the
syntax for passing an argument with a shortopt (trying to pass -o=foo
would make -o's argument "=foo"), this is done to allow the caller to split
the option and its optarg easily

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Reviewed-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-04 10:55:23 +10:00
Allan McRae
f6564377a2 Release 5.2.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 10:57:09 +10:00
Allan McRae
c9613f3a0a Pull latest translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 10:54:12 +10:00
Allan McRae
fca2f7e598 Update NEWS for pacman-5.2.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 09:26:54 +10:00
Allan McRae
4d76cf6f07 Comma fail 2019-10-30 14:26:07 +10:00
Eli Schwartz
866a5cd431 autotools: be more templated when getting list of doc dist files
Distribute asciidoc sources for all manpages instead of remembering to
add files to both variables. Fixes regression in
377d47142f which broke building the
website from a dist tarball:

make: *** No rule to make target 'pacman-conf.8.html', needed by 'html'.  Stop.

(Technically this regression is already fixed by commit
942b909829, but this is just going to keep
happening, I suspect, so we should fix the root cause.)

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 10:05:28 +10:00
Eli Schwartz
5c2059db28 makepkg: only run --clean actions if we built a package
Fixes issue where users were allowed to run cleanup while running
--geninteg or --printsrcinfo or --packagelist, thus mixing invalid
responses into stdout.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 10:04:17 +10:00
Eli Schwartz
0272fca993 makepkg: do not count hard links multiple times when calculating pkg size
Exclude files with hardlinks when cat'ing all the files, and do a second
run to look at each file with hardlinks, keep track of the ones we've
already operated on, and only cat each inode once. Then use "wc -c" to get
the size of all (deduplicated) files the same way we were already doing.

Original-patch-by: Ronan Pigott <rpigott@berkeley.edu>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 10:03:46 +10:00
Eli Schwartz
a745d97c17 makepkg: protect against unexpected whitespace in filenames
zipman:

read -r protects against those evil manpages whose filenames contain
backslash escapes, (muahahaha?)

IFS= read protects against filenames with:

- leading whitespace (but no one is actually stupid enough to configure
  their MAN_DIRS=() in makepkg.conf with such silly directories, *right*?)

- trailing whitespace (but likewise, no one should be stupid enough to
  write an uncompressed manpage for section '1 ' or something)

Also fix several other cases where we read filenames without protecting
against surrounding whitespace, or without using null-delimited
filenames when we could trivially do so.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 09:47:28 +10:00
Eli Schwartz
99639dc27c meson: fix inodecmd for darwin/bsd
The BSD stat command uses %N, not %n, and was incorrectly ported to
meson.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 09:34:51 +10:00
Allan McRae
ae5cf26b5b Fix segfault importing PGP key for pacman -U operations
Use after free.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-27 19:05:27 +10:00
Evangelos Foutras
dc55701132 Add pacman-conf(8) to the documentation index
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-24 17:18:28 +10:00
Allan McRae
f37a3752b3 Update copyright years
make update-copyright OLD=2018 NEW=2019

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23 22:06:54 +10:00
Allan McRae
a9835a38a3 Remove --force from completion
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23 22:06:54 +10:00
Allan McRae
cd4f8f7530 Update completion for -F changes
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23 22:06:45 +10:00
morganamilo
c58bf862b4 makepkg: don't warn when PACKAGER is unset
makepkg now complains when PACKAGER is not in the format
"name <email>".

Hide this warning when PACKAGER is unset but still warn if it is set to
something out of format.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-22 23:18:48 +10:00
Nick Cao
7df70e7fff Fix compression of package databases with zstd
Commit 7afe51171 attempted to add zstd compression support to repo-add,
but failed...

FS#64213

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-22 17:27:15 +10:00
Allan McRae
942b909829 Fix distribution of meson files
Also caught the source of a man page not being distributed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-22 09:25:49 +10:00
Allan McRae
8ce20d3754 Release v5.2.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-21 17:56:25 +10:00
Allan McRae
de24f644f4 Final translation updates for pacman-5.2.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-21 17:25:29 +10:00
Eli Schwartz
9ddd0be027
document changes between 5.1 and 5.2
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2019-10-17 11:51:30 -04:00
Allan McRae
b05a3c10bf Update README for pacman 5.2.0 release
This is the first major release without any additions to the libalpm API!

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-15 21:29:22 +10:00
morganamilo
719efe19c7 libalpm: set errno in signing dummy functions
This allows pacman to print the correct error message when checking keys
and libalpm has been compiled without gpgme support.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-15 19:56:40 +10:00
morganamilo
54b6d689e5 libalpm: fix segfault when -Qip'ing a package
The dummy checksigs function never sets count to 0, leaving it
unitialized. This caused the siglist cleanup to try and free the empty
list.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-15 19:56:00 +10:00
Allan McRae
27ccd68976 Translation updates
Pull all translations with >75% completion.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-14 09:43:35 +10:00
Andrew Gregory
5e11d86cc5 remove: improve broken dependency error message
This message was clarified for sync operations in
2b1b7b7075.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-14 09:31:43 +10:00
morganamilo
d4e667ee5e pacman: return 1 when -F <target> has no results
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-13 12:37:34 +10:00
Andrew Gregory
808a4f15ce run XferCommand via exec
system() runs the provided command via a shell, which is subject to
command injection.  Even though pacman already provides a mechanism to
sign and verify the databases containing the urls, certain distributions
have yet to get their act together and start signing databases, leaving
them vulnerable to MITM attacks.  Replacing the system call with an
almost equivalent exec call removes the possibility of a shell-injection
attack for those users.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2019-10-12 07:04:20 -07:00
Andrew Gregory
a82b0028e4 add arg_to_string helper
Converts an argc/argv pair to a string for presentation to the user.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2019-10-11 20:14:29 -07:00
Andrew Gregory
a2c4ad4675 move wordsplit into common for sharing
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2019-10-11 18:49:38 -07:00
Eli Schwartz
a897599fa5 makepkg: do not save fflags when creating packages
Saving fflages breaks reproducible builds due to encoding information
specific to the filesystem that was used to build the package. This
information is not needed for packaging purposes anyway.

Including fflags also means that attempting to extract a package file as
root (or fakeroot) might result in angry warnings being printed to the
console by bsdtar, followed by a non-zero exit code, unless the user
remembers to use --no-fflags during extraction. This is unpleasant UI, even
if pacman itself won't care about these.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-09 15:39:48 +10:00
Christian Hesse
e8d4228614 signing: handle unknown uid in key import
With unknown uid pacman crashed. Return with error from email_from_uid()
if uid is NULL.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-09 15:39:35 +10:00
Christian Hesse
379f715105 signing: modify question text with unknwon uid
If the key's uid is unknown (for example with db signatures) the
question was:

:: Import PGP key 02FD1C7A934E614545849F19A6234074498E9CEE, "(null)"? [Y/n]

Let's display a modified question for unknown uid.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-09 15:39:22 +10:00
Jonas Witschel
d5c3ed129c pacman-key: receive keys from WKD with -r/--recv-keys
If an email address is specified, we use --locate-key to look up the key
using WKD and keyserver as a fallback. If the key is specified as a key
ID, this doesn't work, so we use the normal keyserver-based --recv-keys.

Note that --refresh-keys still uses the keyservers exclusively for
refreshing, though the situation might potentially be improved in a new
version of GnuPG:
https://lists.gnupg.org/pipermail/gnupg-users/2019-July/062169.html

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 21:40:54 +10:00
Allan McRae
5d2e48d17f Pull and push translation changes in preparation for 5.2
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 18:12:24 +10:00
Alad Wenter
7e79cf73fa makepkg: propagate E_REMOVE_BUILD_DEPS
remove_deps is called once, at the end of clean_up() before makepkg
exit. If remove_deps returns >0 (e.g. when pressing "n" in the resulting
prompt), the error is caught by the ERR signal handler. This in turns
sends SIGUSR1 to the process group, with resulting exit code 138.

In case remove_deps fails, this patch exits makepkg with E_REMOVE_DEPS
if there was no previous error (that is, EXIT_CODE equals E_OK).
Otherwise, makepkg exits with EXIT_CODE.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 17:09:23 +10:00
Erich Eckner
095d6332be makepkg: remove makedepends before installing built package
When running `makepkg -i` it may be necessary to first remove make- and
checkdepends before installing the built package - for example if they
conflict each other. This is the case for wireguard-arch which
makedepends and conflicts wireguard-dkms.

Signed-off-by: Erich Eckner <git@eckner.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 16:44:42 +10:00
Allan McRae
8e7d425627 makepkg: wait for process to finish
Without the -f option to wait, we might move on and try to delete the
logpipe before the process is completed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 16:22:52 +10:00
Austin Lund
e581068c77 makepkg: Delete logpipe when exiting
The logpipe fifo can remain when exiting on a non-error condition such
as recieving signals INT and USR1.  This can be seen by doing either a
manual CTRL-C to interrupt the build or by sending a signal such as:

$ makepkg & sleep 5 ; kill -USR1 $!

Remove the fifo in all cases on script exit if it still exists.

Signed-off-by: Austin Lund <austin.lund@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 16:21:24 +10:00
morganamilo
8f89e509d2 pacman: speed up deptest
Try and find an exact match via pkgcache before iterating the entire
localdb.

Gives a noticeable speed up for exact matches e.g. `pacman -T zlib`

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:27:09 +10:00
morganamilo
f2442bc2e9 libalpm: short circuit alpm_find_dbs_satisfier
when a satisfying package is already installed, we always pick it
instead of prompting the user. So we can return that package as soon as
we find it, instead of waiting until we've iterated through all the
databases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:21:08 +10:00
morganamilo
0a295f3f39 libalpm: fix incorrect documentation
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:19:54 +10:00
Eli Schwartz
0e3a4bd1fb meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.

Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.

We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.

One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:

meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:09:34 +10:00
Eli Schwartz
facd9533b0 meson: fix incorrect libalpm version
LIB_VERSION is supposed to be something like 11.0.1, not simply
reiterate the project version. As a result, we ended up with this:

$ pacman -V
[...]
Pacman v5.1.0 - libalpm v5.1.0
[...]

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:09:21 +10:00
Eli Schwartz
c0da1ba13a meson: fix libcommon being publicly exposed as a static link dependency
libcommon isn't even installed, so that means libalpm.a (if installed)
is fatally broken as it misses objects. The problem is that meson
doesn't handle this case correctly:

https://github.com/mesonbuild/meson/issues/3934
https://github.com/mesonbuild/meson/issues/3937
https://github.com/mesonbuild/meson/pull/3939

Work around this by manually extracting libcommon's .o files into the
list of objects used to create libalpm.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:08:57 +10:00
Eli Schwartz
de6249ce22 Support file with seccomp enabled
Not all compression types can be detected in the seccomp sandbox, so we
need to disable it. This requires either configuring makepkg to know the
sandbox is available, or checking for file >= 5.38 in which the sandbox
option is a no-op even when seccomp is disabled.

- Requires autoconf-archive for autotools version compare macro.
- meson version comparison could be made a lot simpler using meson-git.

Fixes FS#58626

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 13:43:37 +10:00
Eli Schwartz
2a792ac7bb pacman-key: clean keys on import to remove unknown signatures
There is no good reason to bloat the keyring by importing tons of
signatures we cannot use; drop any signatures that don't validate
against another available key (probably the master keys).

If any desired signatures get cleaned, the key can be refreshed after
importing the new signing public key.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 13:23:22 +10:00
Eli Schwartz
f492339035 pacman-key: make sure we actually use the Web of Trust, which GnuPG doesn't.
By default, the latest versions of GnuPG disable the Web of Trust and
refuse to import signatures from public keyservers. This is to prevent
denial of service attacks, because refusing to import signatures only if
the key size is too big, is apparently too silly to consider.

Either way, pacman needs the WoT. If pacman imports a key at all, it
means everything failed and we are in fallback mode, trying to overcome
a shortcoming in the availability of keys in the keyring package.
(This commonly means the user needs to acquire a new key during the same
transaction that updates archlinux-keyring.)
In order for that new key to be usable, it *must* also import signatures
from the Master Keys.

I don't give credence to this supposed DoS, since the worst case
scenario is nothing happening and needing to CTRL+C in order to exit the
program. In the case of pacman, this is better than being unable to
install anything at all (which is gnupg doing a much more harmful DoS to
pacman), and in the already unusual case where something like
--refresh-keys is being used directly instead of depending on the
keyring package itself, gnupg supports WKD out of the box and will
prefer that for people whose keys are marketed as being non-DOSable.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 13:23:11 +10:00
Eli Schwartz
45e01e55c9 pacman-key: when refreshing gpg.conf, don't truncate option checking
If an option is a two-part option, we print both (separated by IFS=' '),
but when grepping to see if it already exists, we only checked the first
component. This means that something like keyserver-options could only
check if there were existing keyserver options of any sort, but not
which ones.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 13:16:07 +10:00
Matthew Sexton
6d99a15f0b pacman/pacman-conf, testpkg: Added translatable strings
Added gettext macro to warnings, helps, and errors for translation.

Signed-off-by: Matthew Sexton <wsdmatty@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 12:15:06 +10:00
Matthew Sexton
a6ae5f0a04 pacman: pacman-conf: removed hputs macro for usage display
Using the macro got in the way of _() macro for translation
All the macro did was make it so the writer didn't have to type
\n", stream); at the end of every line.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 12:15:02 +10:00
morganamilo
b4e4b74ace libalpm: resolvedep(): don't compare names twice
If we failed to get the pkg from pkgcache then we know no satisfying
package exists by name. So only compare provides.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 12:12:04 +10:00
Eli Schwartz
bcacb00fc8 makepkg: add rust support for *FLAGS and debug-prefix-map
The rust language supports $RUSTFLAGS to be used automatically in all
rustc invocations. Allow setting this in makepkg.conf (e.g. for
optimization or debuginfo support), and teach debug+strip to pass the
rustc command line argument necessary to rewrite source file paths in
the debugging symbols.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 11:48:41 +10:00
Jonas Witschel
48752f1b4b signing: add ability to import keys using a WKD
Currently pacman relies on the SKS keyserver network to fetch unknown
PGP keys. These keyservers are vulnerable to signature spamming attacks,
potentionally making it impossible to import the required keys. An
alternative to keyservers is a so-called Web Key Directory (WKD), a
well-known, trusted location on a server from where the keys can be
fetched.

This commit adds the ability to retrieve keys from a WKD. Due to the
mentioned vulnerabilities, the WKD is tried first, falling back to the
keyservers only if no appropriate key is found there.

In contrast to keyservers, keys in a WKD are not looked up using their
fingerprint, but by email address. Since the email address of the
signing key is usually not included in the signature, we will use the
packager email address to perform the lookup.

Also see FS#63171.

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 11:21:46 +10:00
Jonas Witschel
80e2e1c7c9 signing: move key import confirmation before key_search
Ask the user whether they want to import a missing key before even doing
a search on the keyserver. This will be useful for getting Web Key
Directory support in place: for a WKD, looking up and importing a key
are a single action, so the current key_search -> QUESTION -> key_import
workflow does not apply.

Since only the ID of the package signing key is available before
key_search, we display the packager variable in addition to the key ID
for user convenience.

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 11:07:39 +10:00
Dave Reisner
0c4a8ae24b dload: never return NULL from get_filename
Downloads with a Content-Disposition header will typically not include
slashes. When they do, we should most certainly only take the basename,
but when they don't, we should treat the header value as the filename.

Crash introduced in d197d8ab82 when we started using get_filename
in order to rightfully avoid an arbitrary file overwrite vulnerability.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 10:55:49 +10:00
Allan McRae
5dd2b3776d makepkg.conf.5: Document PACKAGER format requirements
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-04 12:07:04 +10:00
Jonas Witschel
fd70c1c7bb libmakepkg: check if PACKAGER has the expected format for WKD lookup
pacman should be able to extract an email address from PACKAGER for WKD
lookup, so issue a warning if it is not of the form
"Example Name <email@address.invalid>". Neither the name nor the email
address must contain additional angle brackets.

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-04 11:48:51 +10:00
morganamilo
6f3810793f libmakepkg: fix typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-04 11:26:44 +10:00
Eli Schwartz
bcb44891ef autotools: distribute meson files
If we use make dist to create the official, signed release tarballs,
those will not have meson build files by default since autotools doesn't
know what they are.

Also distribute all src/common/ files. We never strictly needed any of
them to be distributed with autotools, because the dist tarball
dereferences the symlinks (???), but only some of them were being
distributed, and meson needs them to be in the right location as we only
build libcommon from the primary files.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-04 11:25:48 +10:00
Allan McRae
024fde9748 Prepare translations for next release
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-12 11:42:10 +10:00
László Várady
f9f22fded2 pacman/callback: fix buffer over-read
Commit 11ab9aa9f5 replaced a strcpy() call
with memcpy(), without copying the terminating null character.

Since fname is allocated with malloc(), subsequent strstr() calls will
overrun the buffer's boundary.

Signed-off-by: László Várady <laszlo.varady93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-12 10:19:09 +10:00
Dave Reisner
18a6440061 meson: remove tap-driver.py, use meson's TAP protocol
This includes a patch from Andrew to fix pactest's TAP output for
subtests. Original TAP support in meson was added in 0.50, but 0.51
contains a bugfix that ensures the test still work with the --verbose
flag passed to meson test, so let's depend on that.
2019-08-12 10:03:17 +10:00
Austin Lund
75837a2717 makepkg: Ignore "<artificial>" source files
An artificial symbol can be produced when requesting debugging symbols
and the compiler has inlined a function.  These symbols will give
spurious results when listing source files for inclusion in debug
packages.  This will ignore these symbols and avoid an error that can be
generated when creating a debug package.

Signed-off-by: Austin Lund <austin.lund@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 20:28:09 +10:00
Dave Reisner
0318e84546 build-aux: detect build dir based on build.ninja
.ninja.log is only present after building (successful or otherwise) the
project, but build.ninja is output as soon as the build dir is setup.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:26:21 +10:00
Dave Reisner
72dae345e4 meson: port over checks for types used from sys/types.h
These are defined by a POSIX standard, and we should assert that we have
them, or define sane fallbacks (as per sys_types.h(0P)).

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:21:17 +10:00
Dave Reisner
b3dd02236c meson: drop checks for things we don't use
This was ported over from the AC_CHECK_{FUNCS,HEADERS} lists in
configure.ac, but I never actually checked if the resulting CPP defines
are used. Turns out, lots of symbols, not a lot of define usage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:21:12 +10:00
Andrew Gregory
4e5254dbf3 create coredump on segfault
Overriding the segfault handler prevents the creation of core dumps by
the default handler, which makes debugging segfaults difficult.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:19:04 +10:00
Andrew Gregory
e7156e78b8 sighandler: block signals while handling SIGSEGV
If we get SIGSEGV we need to bail out quickly, leaving other signals
unblocked could lead to other signal handlers getting triggered.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-08-05 18:10:31 +10:00
morganamilo
0e67ee55bd Correctly report a download failiure for 404s
Currently when caling alpm_trans_commit, if fetching a package restults
in a 404 (or other non 400 response code), the function returns -1 but
errno is never set.

This patch sets errno to ALPM_ERR_RETRIEVE.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 13:39:48 +10:00
Eli Schwartz
796c02af4c meson: use dependency('gpgme') exclusively
This works everywhere that gpgme >= 1.13.0 because it is a pkg-config
dependency, and meson 0.51 adds a fallback config-tool dependency
provider that detects older versions of gpgme seamlessly via
gpgme-config.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 10:20:58 +10:00
Eli Schwartz
e7a2b2764a meson: use not_found_message when dependencies are not found
The default state of `dependency()` is `required: true`, which means if
a dependency is not found, meson immediately aborts and does not log our
`error()` messages. meson 0.50 has builtin support for dependencies with
custom error messages.

The alternative would be to specify `required: false` everywhere, and
only then to key off of `dep.found()`.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 10:20:53 +10:00
Eli Schwartz
83f428d974 meson: bump the minimum supported version of meson to 0.51
We haven't reached our first public release of the meson build backend
yet, so we have lots of flexibility for this... and build dependencies
are easier to upgrade than runtime dependencies anyway.

Updating meson allows us to make use of a bunch of new features that
rewquire the latest version of meson.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-28 10:20:49 +10:00
Eli Schwartz
cd475331f4 bash-completion: use POSIX character classes in regular expressions
bash uses POSIX extended regular expressions via regex(3), which does
not guarantee support for shorthand character classes. Although glibc
supports it, msys2-runtime does not.

Make sure the completion script works (hopefully) everywhere by being
more portable.

Fixes: https://github.com/msys2/MSYS2-packages/pull/1549

Original-patch-by: plotasse <platos@protonmail.ch>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-26 10:15:47 +10:00
Allan McRae
d917109432 makepkg: do not exit immediately on dependency install failures
Fixes FS#63000

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-25 21:56:58 +10:00
Andrew Gregory
30acc87b7d use consistent time notation for the log
%X is locale-dependent, making it impossible to reliably parse and
potentially overflowing the buffer.  %T is consistent across locales.

Also fixes some adjacent whitespace.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-20 17:00:53 +10:00
morganamilo
686a9ee8e7 pacman: correctly free lists
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-20 16:56:57 +10:00
Allan McRae
4ca5f5949b Fix compiler warnings with gcc-9.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-20 16:28:44 +10:00
Dave Reisner
1a343d378a free makedepends/checkdepends when freeing packages
Credit to Andrew for identifying source of the leak.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-20 14:45:58 +10:00
morganamilo
80321b21ae pacman: fix error during -Fy
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-07 09:33:26 +10:00
Andrew Gregory
39c20ad4f1 hooks: rename type File to Path
Make it clearer that the targets are matched against both directories
and regular files and free up File to potentially refer specifically to
regular files in the future.  File is retained as a deprecated alias for
Path for the time being to avoid breaking existing hooks and will be
removed in a future release.

See FS#53136.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-06 10:38:31 +10:00
Andrew Gregory
55a65aaf90 makepkg: restrict pkgname and pkgver to ascii
pkgname and pkgver are used as directory names within database files.
libarchive does not provide a reliable locale-independent method for
reading archive file names, causing errors when archive paths include
non-ascii characters.

This is a first step toward dealing with FS#49342, by hopefully reducing
the number of packages with non-ascii data in the wild before updating
libalpm to reject them outright.

See https://github.com/libarchive/libarchive/wiki/Filenames
and https://github.com/libarchive/libarchive/issues/587

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-06 10:34:23 +10:00
morganamilo
ff1ae94c10 pacman: rework the UI of -F
Reworks the UI of -F according to FS#47949

In short -F replaces both -Fs and -Fo.

Searching for an exact path (target contains "/"), causes the output to
switch to the old -Fo output. Otherwise the old -Fs output is used.

Also strip the leading "/" from targets like how -Qo does.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-06 10:30:04 +10:00
morganamilo
eb92bcb089 pacman: refactor file match printing to their own functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-06-06 10:29:39 +10:00
Eli Schwartz
27e80ca7f6 makepkg: also move restore_envvars handling into libmakepkg
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-28 12:46:44 +10:00
Eli Schwartz
a00615bfda makepkg: move config loading into libmakepkg
When scripting/automating around makepkg, it is sometimes desirable to
know how makepkg will be configured to operate. One example is the
archlinux devtools, which must forward select makepkg.conf variables
into a build chroot (for example PACKAGER) or use those variables itself
(for example {SRC,PKG,LOG}DEST).

The configuration file can be in up to 3 places, and should be capable
of being overridden via environment variables. It is sufficiently
complex to represent distinct functionality, and sufficiently useful to
merit easy accessibility in other scripts, therefore, let us move it
into a publicly exposed utility library.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-28 11:28:30 +10:00
Eli Schwartz
5caf45cdbb doc: update SRCEXT/PKGEXT to reduce needlessly scary warnings
Currently this tells people that the settings should not be touched, but
we should just rely on the description of what it should be set to, and
leave it up to the user.  With the previous patch, makepkg aborts if an
invalid value is set, greatly reducing the danger of it being badly
configured.

Also make this clearer by indicating when it would be useful to change
the settings -- i.e. disable compression -- and ensure their described
defaults are based on the ones established during ./configure or meson
setup.

Reported-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-28 11:18:04 +10:00
Eli Schwartz
4c38f4b991 libmakepkg: add lint_config to validate SRCEXT/PKGEXT
These variables must begin with .src.tar / .pkg.tar respectively, so
fail early if those expectations are not matched. This prevents makepkg
from creating e.g. package files literally named "./pacman-5.1.3-1-x86_64"
which are actually uncompressed tarballs.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-28 11:13:40 +10:00
ekardnam
c8062d753c repo-add: Add --prevent-downgrade option
Implements FS#17752

Signed-off-by: Luca Bertozzi <ekarndam@autistici.org>
2019-05-28 11:08:21 +10:00
Kevin Mihelich
99c5809bbf Support application/gzip MIME type in extraction
file 5.37 changed the gzip MIME type from application/x-gzip to
application/gzip, so support this when checking to extract source files.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-28 10:48:42 +10:00
Eli Schwartz
0bc687e2e0 makepkg: propagate error codes when package failed to sign correctly
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 13:08:47 +10:00
Eli Schwartz
9375f49865 libmakepkg: install pkg-config file
Since makepkg exports a public library of functions, other projects may
wish to use these functions. Highlights include parseopts or our
messaging functions.

Install a pkg-config file in order to let downstream users detect where
they can source the libmakepkg functionality. This is useful e.g. to
gracefully handle the case where a thirdparty project is configured and
installed into a different datarootdir from pacman, but still wants to
use the installed pacman's version of libmakepkg.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 12:46:33 +10:00
Eli Schwartz
614ef781eb libmakepkg: fix missing or inaccurate interdependencies
When the executable checking was refactored into libmakepkg, it carried
with it, usage of $E_* error codes, which need to be declared from
error.sh but are only available when the parent program already sources
error.sh; additionally, message.sh was only loaded in a parent
library, but not where it was needed, and option.sh was often loaded
when it wasn't needed at all.

util.sh, meanwhile, has always depended on message.sh functions.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 12:45:34 +10:00
Eli Schwartz
b93dfa935f scripts: protect against unintended glob matching in [[ ]] RHS
The right-hand side of the [[ ... = ... ]] keyword is an exception to
the general rule that quoting is unnecessary with [[

This is usually not a problem, e.g. in libmakepkg, lint_one_pkgname will
already fail if pkgname has an asterisk, but it certainly doesn't hurt
to be "more proper" and go with the spec; it is more dangerous in
repo-add, which can get caught in an infinite loop instead of safely
asserting there is no package named 'foo*'.

Reported-by: Rafael Ascensão <rafa.almas@gmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 12:45:26 +10:00
Eli Schwartz
a0f4429e95 makepkg: use more schema.sh to clean the environment of special variables
Fixes "arch" and "checkdepends" never having been unset, fixes b2sums
(but not ${!b2sums_@}) being recently left out.
The "build" function used to be unset as well, explicitly unset it as a
function and do the same for other official functions as well.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 12:45:26 +10:00
Eli Schwartz
583f3122ce meson: fix build of executables with nonstandard libarchive path
The libarchive header is used in alpm.h, and several binaries include
this header. This is noticeably a problem when using e.g. the musl-gcc
compiler which does not include /usr/include by default, and thus the
build system reports:

...../lib/libalpm/alpm.h:35:10: fatal error: archive.h: No such file or directory

More commonly, this will result in compiling against potentially the
wrong headers, if the libarchive installation picked up by pkg-config is
different from the one with headers in /usr/include, and /usr/include is
in the -isystem path.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 10:15:52 +10:00
Eli Schwartz
6911904a03 makepkg: fix bash 5 compatibility when packaging symlinks to a directory
In commit b5191ea140 we moved to using
shell globbing to print package files for a couple of reasons including
reproducible packaging of .METADATA files.

Unfortunately, this only works reliably when the glob pattern does not
resolve to a symlinked directory due to a change in the bash 5.0
release. Note that the previous, desired behavior was rather to merely
refuse to recurse into symlinked directories, but due to an unrelated
issue, the symlink handling for globstar was reworked in a way that had
this side effect.
See https://lists.gnu.org/archive/html/bug-bash/2019-04/msg00015.html
for discussion; this may be fixed at some point, but bash 5.0 is broken
either way.

The appropriate way of handling this seems to be to use **/* to match
instead; this produces the same results on both bash 4 and bash 5, as
the ** matches any leading directory component (or none), and the *
matches any file, directory, or symlink to either one.

Fixes FS#62278

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 10:14:32 +10:00
Rikard Falkeborn
f2a7fb2b96 Fix clang 8 string-plus-int warnings
Clang 8 warns that adding a string to an integer does not append to
string. Indeed it doesn't, but that was not the intentetion. Use array
indexing as suggested by the compiler to silence the warning. There
should be no functional change.

Example of warning message:

    alpm.c:71:54: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
            sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1);
                                                     ~~~~~~~~~~~^~~
    alpm.c:71:54: note: use array indexing to silence this warning
            sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1);
                                                                ^
                                                     &          [  ]
    1 warning generated.
2019-05-08 10:12:14 +10:00
Eli Schwartz
a8b3d1a62a makepkg: correctly handle hg sources with updates on a non-default branch
The "tip" ref actually signifies the most recently updated branch. hg
does not support a default branch named anything other than "default",
except by creating a "@" bookmark. The correct way to explicitly update
to the default clone ref, is therefore to use one of these, rather than
"tip".

Fixes FS#62092

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 10:10:57 +10:00
Eli Schwartz
915ac9ff9b libmakepkg: fix migration to schema.sh for integsums
One of the callers was changed to use known_hash_algos, one was not.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-05-08 10:05:23 +10:00
Eli Schwartz
d37e6d40a1 bash-completion: support file redirection completions
The current completions don't properly handle redirection operators, and
attempt to complete command completions rather than completing filenames
to redirect to.

bash-completion provides both _get_comp_words_by_ref and a higher-level
wrapper _init_completion, but the latter provides handling of redirection
operators, so switch to using that.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-25 11:15:26 +10:00
Allan McRae
7a598d0845 Use bug tracker to track bugs
The mailing list requires subscription.  So does the bug tracker,
but that is more obvious.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-20 09:58:16 +10:00
Eli Schwartz
9f5412d809 doc: generalize description of the bash nature of PKGBUILD functions
Currently this is scoped to the build() function, which is simply wrong
as it equally applies to any function. Simply moving the paragraphs up
to the main manpage section makes this clear.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 14:33:50 +10:00
Que Quotion
7b15918b65 Clarify that build_options only apply during build()
Signed-off-by: Que Quotion <quequotion@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 14:24:18 +10:00
Eli Schwartz
ee5f24e50c libmakepkg: fix reporting of invalid archive extensions in compress.sh
In commit 1825bd6716 this was split out
from makepkg, but the warning was not properly migrated; $ext did not
ever exist.

As a result, no matter what you did, the only possible warning was:

==> WARNING: '' is not a valid archive extension.

Fix to filter based on the presence of .tar in the argument, and
building the $ext variable for all checking and messaging purposes
within the function.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 14:12:44 +10:00
Eli Schwartz
35a0d5e744 makepkg: use "shared" git clones when checking out sources
In order to cache sources offline, makepkg creates *two* copies of every
git repo. This is a useful tradeoff for network time, but comes at the
cost of increased disk space.

Normally, git can smooth this over automagically. Whenever possible, git
objects are hardlinked to save space, but this does not work when
SRCDEST and BUILDDIR are on separate filesystems.

When the repo in question is both very large (linux.git for example is
2.2 GB) and crosses filesystem boundaries, this results in a lot of
extra disk space being used; the most likely scenario is where BUILDDIR
is a tmpfs for bonus ouch.

git(1) has a builtin feature which serves this case handily: the
--shared flag will create the info/alternates file instructing git to
not copy or hardlink or create objects/packs at all, but merely look for
them in an external location (that being the source of the clone).

The downside of using shared clones, is that if you modify and drop
commits from the original repo, or simply delete the whole repo
altogether, you break the copy. But we don't care about that here,
because

1) the BUILDDIR copy is meant to be a temporary copy strictly derived
   via PKGBUILD syntax from the SRCDEST, and must be able to be
   recreated at any time,
2) if the SRCDEST disappears, makepkg will redownload it, thus restoring
   the objects needed by the BUILDDIR clone,
3) if the user does non-default things like hacking on the BUILDDIR copy
   then deleting and re-cloning the SRCDEST may result in momentary
   breakage, but ultimately should be fine -- the unique objects they
   created will be stored in the BUILDDIR copy.

While it's theoretically possible that upstream will force-push to
overwrite the base tree from which makepkg is building (which they
should not do), *and* the user deleted their SRCDEST which they should
not do, *and* they saved work in makepkg's working directory which they
should not do either...
... this is an unlikely chain of events for which we should not care.

Using --shared is therefore helpful in immediately useful ways and IMHO
has no actual downsides; we should use it.

An alternative implementation would be to use worktrees. I've rejected
this since it is essentially the same as shared clones, except adding
additional restrictions on the branch namespace, and could potentially
break existing use cases such as manually handling the SRCDEST in order
to share repositories with normal working copies.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 14:09:00 +10:00
Eli Schwartz
0a72874734 build: check for gpgme with pkg-config before gpgme-config
gpgme in git master now supports pkg-config and with the next release we
can and should prefer its use. However, retain the legacy code that
enables building with older versions of gpgme, as a fallback.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 14:05:53 +10:00
Santiago Torres
226d2c1248 drop DU* config variables
Since DUFLAGS and DUPATH are not needed anymore remove them from the
source

Signed-off-by: Santiago Torres <santiago@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 12:07:15 +10:00
Eli Schwartz
bbfb75fd29 build: remove references to variable replacements from pacman-optimize
MODECMD and OWNERCMD are not used by pacman itself, so we don't need to
check for and replace them now that pacman-optimize is removed.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 12:04:51 +10:00
Santiago Torres
f26cb61cb6 Make makepkg compute sizes properly
Makepkg used to use du --apparent-size to compute the size of the
package. Unfortunately, this would result in different sizes depending
on the filesystem used (e.g., btrfs vs ext4), which would affect
reproducible builds. Use a wc-based approach to compute sizes

Signed-off-by: Santiago Torres <santiago@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 11:54:50 +10:00
Florian Wehner
c61cd050f9 Reformatting log timestamp to include time-zone
The time logged is currently given as localtime without any timezone
information. This is confusing in various scenarios.

Examples:
* If one is travelling across time-zones and the timestamps in the log
appear out of order.
* Comparing dates with `datediff` gives an offset by the time-zone

This patch would reformat the time-stamp to a full ISO-8601 version.
It includes the 'T' separating date and time including seconds.

Old: [2019-03-04 16:15]
New: [2019-03-04T16:15:45-05:00]

Signed-off-by: Florian Wehner <florian@whnr.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-19 11:53:30 +10:00
Allan McRae
c0e9be7973 Remove support for deltas from libalpm
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Allan McRae
e7bb0f8824 Make pacman forget deltas exist
Dummy callbacks are still present to prevent compiler warnings until
libalpm is delta free.

Also remove Delta parsing from pacman.conf.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Allan McRae
40391c564a Remove cleanupdelta
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Allan McRae
2883b869c7 Remove pkgdelta
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Allan McRae
9adb0d5b37 Remove delta support from repo-add
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Jelle van der Waa
377d47142f doc: add man page for pacman-conf
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Jelle van der Waa
298bcf7986 doc: set rootdir correctly in man pages
If an alternative rootdir is specified in either meson or configure it's
not respected in the generated man pages.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Eli Schwartz
e03752e6ad makepkg: add new checksum algorithm via coreutils b2sum
coreutils 8.26 in December 2016 added this new hashing method which is
compatible with the existing md5sum and sha*sum tool usage, while using
the blake2 hash algorithm.

makepkg uses coreutils to provide source file integrity checks via
${integ}sum binaries and it makes sense to offer this as an additional
option.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
morganamilo
0113214db9 pacman: fix segfault when Usage is specified without a value
And extract all the common code to a macro.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-07 11:12:12 +10:00
Andrew Gregory
d197d8ab82 Sanitize file name received from Content-Disposition header
When installing a remote package with "pacman -U <url>", pacman renames
the downloaded package file to match the name given in the
Content-Disposition header. However, pacman does not sanitize this name,
which may contain slashes, before calling rename(). A malicious server (or
a network MitM if downloading over HTTP) can send a content-disposition
header to make pacman place the file anywhere in the filesystem,
potentially leading to arbitrary root code execution. Notably, this
bypasses pacman's package signature checking.

For example, a malicious package-hosting server (or a network
man-in-the-middle, if downloading over HTTP) could serve the following
header:

Content-Disposition: filename=../../../../../../usr/share/libalpm/hooks/evil.hook

and pacman would move the downloaded file to
/usr/share/libalpm/hooks/evil.hook. This invocation of "pacman -U" would
later fail, unable to find the downloaded package in the cache directory,
but the hook file would remain in place. The commands in the malicious
hook would then be run (as root) the next time any package is installed.

Discovered-by: Adam Suhl <asuhl@mit.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-03-01 11:23:20 +10:00
Sever Oraz
adb961a88e Use standard, consistent units in the download progress.
Rather than use M/s which can be either MB or MiB, specify that it uses
MiB (consistent with the displayed total size).

Fixes FS#59201

Signed-off-by: Sever Oraz <severoraz@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-21 14:55:49 +10:00
Eli Schwartz
ba7a41031c meson: fix static/shared split again
shared_library does not generate a sane pkg-config file because it
assumes we don't want dependencies.

Additionally, since we key off of buildstatic, when *not* using
buildstatic but attempting to build libalpm on its own as static using
-Ddefault_library=static, we are building and linking to a shared
libalpm anyway.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-21 14:34:02 +10:00
Eli Schwartz
3c774252ef libmakepkg: migrate to schema.sh for integsums
We cannot use most of the arrays defined in schema.sh as srcinfo is dependent
on the order, but migrate the hashes for now.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-21 14:26:59 +10:00
Eli Schwartz
656e851f0a makepkg: simplify run_pacman logic
We don't need to check the options twice, since it is the same check
both times. Instead, merge the conditionals.

As far as I can tell, the only reason the checks for:

- PACMAN_OPTS and
- whether to use sudo

were ever separated is due to the historic existence of --asroot, since
the second check included a check for (( ! ASROOT )) until it was
cleaned up in commit 61ba5c961e.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-21 14:18:25 +10:00
Eli Schwartz
4b83bcfcee makepkg: implement locking for pacman commands
When pacman is run as root to do -S, -U, or -R, it would immediately
abort if pacman is not ready for use. Instead, poll the lockfile and
wait until it becomes available.

Implements FS#28840

Original-patch-by: Georges Dubus <georges.dubus@compiletoi.net>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-21 14:16:16 +10:00
Eli Schwartz
477a66cd0e build: link vercmp with a static copy of libalpm
This has historically been the case in autotools since we want vercmp to
not break mid-transaction in an install script.

For convenience, we create libalpm.a and use this to optionally generate
libalpm.so (when not configured with -Dbuildstatic=true) as well as to
link any binary which explicitly wishes to be built statically "with
libalpm", but does not care where a function is defined. meson then
treats this correctly: it builds the object file only once for both
libraries, and the compiler strips out unused functionality from the
final static binary.

Currently the only binary which requires this is vercmp.

Fixes FS#61719

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-12 21:58:19 +10:00
Allan McRae
86004227d1 Add implicit fall through warning
Requires modification to our comment about fall through to match compilers
expectations.  Works for GCC and Clang.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-12 11:29:13 +10:00
Mark Ulrich
db102c67ef libalpm: prevent 301 redirect loop from hanging the process
If a mirror responds with a 301 redirect to itself, it will create an
infinite redirect loop. This will cause pacman to hang, unresponsive to
even a SIGINT. The result is pacman being unable to sync or
download any package from a particular repo if its current mirror
is stuck in a redirect loop. Setting libcurl's MAXREDIRS option
effectively prevents a redirect loop from hanging the process.

Signed-off-by: Mark Ulrich <mark.ulrich.86@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-07 09:51:01 +10:00
Allan McRae
714a1b4e4e I blame everyone but me for this
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-07 09:50:49 +10:00
morganamilo
04e77591d6 fix various typos
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-02-04 10:17:30 +10:00
morganamilo
11bc315cdb libmakepkg: lint disallowed architecture specific variables
Variables such as 'pkgdesc_x86_64' are invalid, instead of ignoring them
raise an error.

This also disallows using 'any' as an architecture specific variable

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-31 15:03:28 +10:00
morganamilo
14755df06f libmakepkg: lint disallowed variables in package()
makepkg will now error if disallowed variables are set inside of
the package function.

Disallowed variables are variables that do exist, like 'makedepends'
and 'pkgver' but can not be set inside of a package function.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-31 15:03:25 +10:00
morganamilo
75aae126c4 libmakepkg: centralise random arrays of pkgbuild variables
Refactor many of the different arrays of pkgbuild variables
into scripts/libmakepkg/util/schema.sh.in.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-31 10:02:37 +10:00
Allan McRae
6cf0548128 makepkg: use --unneeded for pacman call in remove_deps()
This patch was inspired by FS#32723 which asks makepkg to install makedepends
before depends.  The use case is to build a package depending on a virtual
package that is only provided by other packages (e.g. java-runtime in Arch
Linux), but wanting to build against a specific version.  Installing makedepends
first (but not at the same time as depends) would allow specifying the version
to build against, instead of pacman resolving to the default version when
installing depends.

It turns out, we can already achieve installing makedepends first by specifying
dependencies only in the package function (and making sure makedepends includes
everything needed). The only issue is that if we use makepkg to install the
built package with the --install flag and along with the --rmdeps flag, we will
try to remove any installed dependencies that are specified in the depends
array in the package function.  To counter this, we need to use the --unneeded
flag for the pacman call.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-30 13:39:35 +10:00
Chloe Kudryavtsev
776fbe1cde libmakepkg: Add lzip ext support
lzip is a lossless data compressor designed to replace gzip and bzip2 as
the standard general-purpose compressed format.
- add .lz (lzip) support to libmakepkg/util/compress.sh:compress_as
- add COMPRESSLZ to makepkg.conf.in
- document COMPRESSLZ
- document PKGEXT with `.tar.lz`

Signed-off-by: Chloe Kudryavtsev <toast@toastin.space>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-30 10:06:55 +10:00
morganamilo
5bd54fa0c6 libmakepkg: move checkdepends to the correct array
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-22 11:06:11 +10:00
Eli Schwartz
1e040153bc libmakepkg: Implement extendable signature verification
Lookup the existence of matching functions for each protocol, and
fallback on the generic file handler. New verification protocols can
then be added via thirdparty libmakepkg drop-ins without requiring
modifications to verify_signature.sh

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-22 09:42:38 +10:00
Eli Schwartz
9c817b6549 libmakepkg: implement extendable source protocols
Lookup the existence of matching functions for each protocol, and
fallback on the generic file handler. New source protocols can then be
added via thirdparty libmakepkg drop-ins without requiring modifications
to source.sh

Fixes FS#49076

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-22 09:38:31 +10:00
Eli Schwartz
ac0e21a6df libmakepkg: optimize get_protocol to always return proto, not proto+uri
e.g. git+https:// is commonly used for git repositories cloned over
HTTPS, but we assume a proto with a plus in it is actually a protocol
followed by some URI handler. So we might as well simplify the return
value and not have to always add glob matching everywhere when checking
the proto in use.

This is required in order to use the proto directly in function calls,
which will be used in a followup patch.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-22 09:38:21 +10:00
Eli Schwartz
1b9e358f1d libmakepkg: make gettext replacements more templated
Making the undescore be translated is probably not something we need
translators to think about.

Additionally, a number of places which use the same text differ only by
the variable being referenced, so simplifying the string means we can
drop a redundant translation.

Bonus: we save a few bytes here and there. \o/
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-22 07:32:41 +10:00
morganamilo
4d1d857ef0 libalpm: fix minor typo in _alpm_db_usage_
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-21 13:47:23 +10:00
Allan McRae
ff8c96fa7d Fix typo in pacman man page
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-21 13:20:47 +10:00
morganamilo
c15f7ae606 libmakepkg: disallow using 'any' with other arches
Error if the arch array contains any and any other values. This also
fixes a bug where the check for `$arch == 'any'` which only evaluated
the first value in the array, meaning the rest of the values would not
be linted.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-16 11:23:17 +10:00
Eli Schwartz
a5090217f9 meson: fix website target
A number of pages don't actually exist as html inside the source tree,
and need to be generated even though they are manpages.

This caused the website.tar.gz target to only work inside a dirty tree
initially created by autotools.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-16 11:22:48 +10:00
Eli Schwartz
10bcf66db8 update a bunch of links for https and to adapt to changing domains
projects.archlinux.org and mailman.archlinux.org are both migrated to
new domains.

Transifex supports https, so encourage its use by default.

Take advantage of the opportunity when updating these links, to also
delist some projects that are dead.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-14 13:35:47 +10:00
Eli Schwartz
02598521b1 doc: add a couple missing manpages from the html index
The index embeds the names of all doc subpages, and these were never
updated.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-14 13:19:05 +10:00
Eli Schwartz
a769fbfd40 doc: keep manpages and html pages in sync
We forgot to add BUILDINFO to the list of html docs. Instead of always
updating things in two places, just derive the one from the other.

meson did not have this problem as it already derives both lists from
one template.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-14 13:15:11 +10:00
Eli Schwartz
b76dbb1159 meson: fix regression that broke building libmakepkg
In commit f7efa6a93d we added a new file,
and also wired it up to the build systems, but it got added under the
wrong name in meson.build

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-14 13:12:33 +10:00
Eli Schwartz
ce040514c4 makepkg: return E_PKGBUILD_ERROR for nonexistent PKGBUILD
This is not really an error with a "user function".

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 17:07:23 +10:00
Eli Schwartz
5d2f7ee6c3 libmakepkg: simplify splitting command output into array
Use mapfile instead of hacking around read -a with the $IFS.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 17:03:04 +10:00
Eli Schwartz
031611ff40 libmakepkg: add routine for linting $SOURCE_DATE_EPOCH
This can only ever be an int, and the specification states that a
malformed timestamp should be considered a fatal error.

https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 17:01:30 +10:00
Eli Schwartz
10fe71e5f3 makepkg: fix unguarded use of printf
paths can contain printf-unsafe chars, and printf -v is not somehow immune to this

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 17:00:05 +10:00
Luke Shumaker
aa284c97f1 makepkg: check_pkgrel: Don't say "decimal" in the error message
If you have a malformed pkgrel, the error message says that it must be a
"decimal".  That isn't quite true, as that would mean that `1.1 == 1.10`.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 17:00:05 +10:00
Luke Shumaker
f7efa6a93d makepkg: Better error messages for versions in (check, make, opt)depends/provides/conflicts
Given the depends

    depends=('foo>=1.2-1.par2')

and the error message

    ==> ERROR: pkgver in depends is not allowed to contain colons, forward slashes, hyphens or whitespace.

One would be lead to believe that the problem is that they gave a pkgrel in
depends at all, not that the pkgrel contains letters.

Each of the (check,make,opt)depends, conflicts, and provides linters use a
glob to trim off properly formed epoch an rel from the full version string,
and pass the remainder to check_pkgver().  This does a good job of
accepting/rejecting full versions, but doesn't do a good job of generating
good error messages when rejecting if it's because of the epoch or rel.

1. Factor out check_epoch() and check_pkgrel() from lint_epoch() and
   lint_pkgrel(), similarly to check_pkgver().
2. Add a check_fullpkgver() that takes a full [epoch:]ver[-rel] string and
   splits it in to epoch/ver/rel, and calls the appropriate check_ function
   on each.
3. Use check_fullpkgver() in the {,check,make,opt}depends, conflicts, and
   provides linters.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 17:00:03 +10:00
Eli Schwartz
30e3e21e87 libmakepkg/lint_pkgbuild: check for invalid variables even if they're empty
Checking the length of the variable to be non-zero before considering it
an error is inconsistent; license=() and depends='' and `declare arch`
should be considered just as wrong.

In fact the current check detects depends='' as non-zero and returns an
error, but happily considers the others to be perfectly okay.

A more reliable check is to simply see if the name has been declared
(whether it is set or not), and then enforce that it's been declared to
the right type.

As an added benefit, avoiding the creation of proxy-evaled variables to
count the number of indexes results in simpler code.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 15:21:13 +10:00
Allan McRae
03d85763e0 Add [ignored] to -Qu output for packages in repos that are not Usage = Upgrade
List all available updates in -Qu output, but include [ignored] beside
those that will not be updated in a -Su operation due to thier repo Usage
value (in addition to those that are Ignored).

Fixes FS#59854.

The following people provided initial patches to print [ignored] on -Qu
operations, which highlighted a larger problem to be fixed first:

With-thanks-to: morganamilo <morganamilo@gmail.com>
With-thanks-to: Michael Straube <michael.straube@posteo.de>

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 14:14:04 +10:00
Allan McRae
e9d91a688d libalpm/sync.c: change alpm_sync_newversion() to alpm_sync_get_new_version()
The behaviour of "pacman -Qu" was very strange...  It would only consider
packages from repos with Usage = Search (or All), and ignore those with
Usage = Sync, Install or Upgrade.

This is because the function alpm_sync_newversion() used ALPM_DB_USAGE_SEARCH
for its filtering. Given this function is documented (at least in the source)
to "Check for new version of pkg in sync repos", I would expect that to look at
all repos. However, just changing this parameter, would result in a fairly
silent change in behaviour of this function. Instead, rename the function
and remove this filtering altogether.  Users of this function can filter
the dbs passed to this function to achieve their desired output.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 14:14:04 +10:00
Allan McRae
9b2a90cfb1 Add -fstack-clash-protection to CFLAGS in debug builds if available
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 14:14:04 +10:00
Allan McRae
9b637cc27a be_local.c: remove aligment in local_pkg_ops
The alignment was not overly helpful and caused unnecessary churn when a new
value with longer name was added.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 14:10:55 +10:00
morganamilo
f9eb2aacb4 libalpm: parse {check, make}depends when reading database
Commit 0994893b0e added the
alpm_pkg_get_{make,check}depends functions but forgot to include
logic for parsing these fields from the database. As a result these
functions will always return an empty list.

This commit adds the parsing logic.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 14:04:59 +10:00
Eli Schwartz
238fa4af45 makepkg: fix broken check for the fakeroot binary
In commit d8ee8d0c99 we made use of
fakeroot absolutely mandatory, and disabled a lot of the code which
checked to see if this now-defunct BUILDENV option was set, before
setting up the environment to use fakeroot. Unfortunately, we missed one
spot.

The check_software routine still checked to see if fakeroot was
enabled, but due to the option being removed, thought that it was in
fact disabled, and as a result this check would never run.

Fix by checking to see if we are trying to build either a package or a
source package, and if so, checking for fakeroot. These are the only two
situations where fakeroot is needed.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 13:25:12 +10:00
Eli Schwartz
268b0255fa makepkg: add internal variable to track when we're building a package
There are state variables for everything else, and we use them to do
conditional checks on things, but it's currently a bit difficult to test
whether a package is being built, as it's the default action if *no*
options are specified.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10 13:25:12 +10:00
Jan Alexander Steffens (heftig)
c5c7fc7f4a makepkg: Make pkgdir a local
Causes it to be reset (to $pkgdirbase/$pkgbase) between subpackages.
This shouldn't be visible.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 15:43:41 +10:00
Jan Alexander Steffens (heftig)
2f15921230 makepkg: Create a single-package packaging function
Merge the similar code handling unsplit PKGBUILDs and individual
packages in a split PKGBUILD and make it a new function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 15:43:41 +10:00
Jan Alexander Steffens (heftig)
7c5958e0eb makepkg: Only backup package variables once
We don't need to re-backup the variables we restored on the previous
iteration.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 15:43:41 +10:00
Michael Straube
e1fc2f901e libalpm/add.c: move assignment into conditional in alpm_add_pkg
While at it and for consistency move the assignment of the variable
'local' into the subsequent conditional.

Signed-off-by: Michael Straube <michael.straube@posteo.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:32:49 +10:00
Michael Straube
3a5a0d53bc Move skipping of duplicate sync/remove targets into libalpm
sync:
As pointed out by Andrew Gregory there could be an error when adding
duplicates if they are two separate packages with the same name. Add a
check in alpm_add_pkg() to test whether the duplicate is actually the
same package, and if so, log a debug message and return success to skip
the package. If the duplicate is a different package return
ALPM_ERR_TRANS_DUP_TARGET and treat that error just like any other error
in pacman.

remove:
Change alpm_remove_pkg() to just log a debug message and return success
to skip duplicates. Remove the handling of ALPM_ERR_TRANS_DUP_TARGET in
pacman.

Also fixes FS#49377.

Suggested-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Michael Straube <michael.straube@posteo.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:31:55 +10:00
Eli Schwartz
984492b92f repo-add: don't break if delta package sources contain epoch
Our sed parser for xdelta3 headers will greedily match on ":" which
coincidentally is also the character we use to define a version with an
epoch.

While we are at it, simply use sed for the whole pipeline, rather than
using both grep and sed.

Fixes FS#61195

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:15:16 +10:00
Eli Schwartz
4778f13188 repo-remove: fix removing packages with deltas
We have code in order to remove deltas when removing a package, but it
is never run, since we try to remove the wrong file.

This was broken in commit cb0f2bd038 which
modified the internal layout we use to modify the db, changing "tree" to
"db", but did not update all locations where it was used.

This worked swimmingly well as long as only repo-add updates were
handling the backup and restore of the delta file, as the delta file
therefore got backed up to the correct location (db) in the shared
db_remove_entry() function.

But later on in the repo-remove logic, we tried removing a different
file that will never exist (tree).

Fixes FS#53041

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:14:52 +10:00
Andrew Gregory
2d403709d9 allow tests for disabled features to be skipped
Previously, pacman's test suite would fail when compiled without
signature support.

Adds a require_capability method to pmtest objects.  Currently
recognized values are 'gpg', 'curl', and 'nls'; although only gpg is
used presently.  Missing features are indicated by running pactest with
one of the --without-<feature> options.

This modifies pmenv to run each case as independent tests.  Previously,
a single pmenv could run multiple tests, combining there output into
a single TAP stream but making it impossible to properly skip an entire
test case.  This change does not affect running pactest.py with a single
test (as both autotools and meson do), but will affect anybody manually
running pactest.py with multiple tests at once.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:10:47 +10:00
Andrew Gregory
ecac357c1a tap.py: add skip_all function
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:10:37 +10:00
Andrew Gregory
d150b97190 remove unused test summary code
Unused since 12e00af531

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:09:48 +10:00
Andrew Gregory
33a8ced334 silence warning when built without curl
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-04 11:08:54 +10:00
Andrew Gregory
6b541404cc update NEWS for v5.1.2
Signed-off-by: Andrew Gregory <andrew@archlinux.org>
(cherry picked from commit f8c73464c9)
2018-12-25 01:58:33 -08:00
Andrew Gregory
281cdb2e1c update NEWS for v5.0.2
Signed-off-by: Andrew Gregory <andrew@archlinux.org>
(cherry picked from commit fdf53393bc)
2018-12-25 01:57:01 -08:00
Eli Schwartz
b109d7096b meson: add trailing slashes to directory components in configuration defines
This matches what we currently do in the autotools build configuration,
and ensures that the default pacman-conf definitions for unspecified
values consistently end with the trailing directory slashes.

This has ramifications for thirdparty tools that up to now, have relied
on this slash being there. Those tools should be fixed to prevent
breaking when custom locations are set, but this is no reason not to fix
it on our end as well. An extra trailng slash should never cause harm.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-12 10:13:26 +10:00
Eli Schwartz
77b8ca7032 meson: install the directories needed for successful pacman operation
This was neglected in the initial meson port. We need these directories
to exist in order to bootstrap a new installation.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-12 10:13:08 +10:00
Eli Schwartz
d73fed4e13 meson: remove useless mkdir -p
directories are created by install_dir within the subdir custom_target
installation targets.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-12 10:12:41 +10:00
Dave Reisner
b67ec90520 Enable additional debug flags/logging with debugoptimized builds
This lets developers run a local build with optimizations but also the
added debug logging that comes with PACMAN_DEBUG being defined.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-10 11:20:02 +10:00
Michael Straube
36a5069a59 scripts/library: fix typo in README
Simply fix a typo: in written -> is written

Signed-off-by: Michael Straube <michael.straube@posteo.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-10 11:12:27 +10:00
Andrew Gregory
f28ddd9d93 check localdb before upgrading package
Commit 2ee7a8d89a replaced a manual check
for a local package with a check for the "oldpkg" member, which gets set
at the beginning of the transaction.  If the package was also in the
remove list, such as when a package gets replaced, it would no longer be
in the local db and pacman would try to remove it twice, resulting in
superfluous error messages.

Fixes: FS#50875, FS#55534

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-10 11:12:06 +10:00
Eli Schwartz
9f1b735d76 libmakepkg/executable: don't rely on scoped value of $ret to flag outcomes
Elsewhere, we return 1 if a library dropin fails, and when running
functions in a loop, we use `|| ret=1` to preserve scope. This ensures
the return value of the function remains useful in isolation. Do the
same thing here as well.

Drop trivial function which wraps a dropin that also uses $ret, since
it's no longer needed.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-04 17:22:27 +10:00
Eli Schwartz
65e09705d3 Make make distcheck work when bash-completion is installed.
bash-completion uses pkg-config to determine the best installation
directory, but this does not take --prefix into account (although it
works fine with DESTDIR). The fallback value does attempt to set this
based on --prefix.

The distcheck uses --prefix, though, which means when attempting to
install the results and bash-completion support for pkg-config was
detected, it errors out on trying to write to, usually, /usr/share.

Tell distcheck to use the prefix-based fallback location instead, as the
PKG_CHECK_* override.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-12-04 17:20:57 +10:00
Allan McRae
f615f7bd5a configure.ac: use $datarootdir instead of $prefix/share
Even worse, makepkg-template ignored $prefix completely.
2018-12-03 15:18:27 +10:00
Eli Schwartz
5fc3056e6a scripts: make repo-add utilize a wrapper as well
Now that repo-add uses libmakepkg, it needs to have $LIBRARY set before
testing it in-tree.

[Allan: fix "make distcheck"]
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 11:06:12 +10:00
Eli Schwartz
e1b9dc6bea autotools: be more accurate in comments when generating processed scripts
Instead of assuming all scripts are .sh.in and leaving a comment to that
effect, just take the input file directly.

This depends on the first dependency for the target being the source of
the script.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 11:02:19 +10:00
Eli Schwartz
71f837e45e scripts: fix some inaccurate Makefile targets, and be more templated
All of our scripts depend on the same pattern .sh.in, and since commit
b5d62d2c91, they also all (not just
makepkg itself) depend on libmakepkg.

There's no real reason to include separate targets for them just to
establish dependency rules.

While we are at it, fix a longstanding bug where generated wrapper
scripts did not depend on wrapper.sh.in (which due to moving to .lib,
requires we regenerate the script too), by making the shared target
pattern depend on it. All our generated scripts now require the wrapper,
even repo-add which now uses libmakepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 11:02:19 +10:00
Eli Schwartz
83a16d3041 scripts: fix repo-remove/elephant Makefile targets
repo-remove and repo-elephant don't care whether repo-add.sh.in is
updated... but they do require the repo-add target to be up to date, so
use that instead. As a bonus, use the same rule for both of them.
2018-11-28 10:50:02 +10:00
Eli Schwartz
363664e47d meson: be more accurate in comments when generating processed scripts
Instead of assuming all scripts are .sh.in and leaving a comment to that
effect, just take the input file directly.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 10:48:57 +10:00
Eli Schwartz
fbc6d8b428 build-aux: rm annoying and useless file
tap-driver.sh is added to the build tree by autoreconf, and contains
upstream modifications as such. This results in dirty working trees.

It was originally added in commit 403c175dbc
which made the testsuite use automake, but as far as I can tell, never
served any purpose.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 10:48:41 +10:00
Andrew Gregory
6e819c819a add missing tests to meson.build
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 10:24:28 +10:00
Andrew Gregory
b95ba13df1 common/ini: remove unnecessary alpm include
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-28 10:24:00 +10:00
Andrew Gregory
44cfc09511 require actual siglevel for default
ALPM_SIG_USE_DEFAULT does not refer to an actual siglevel, rather it
indicates that the global default should be used in place of the
operation-specific one.  Setting this value for the global default
itself makes no sense.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Andrew Gregory
61fe738043 always allow explicit empty siglevel for sync dbs
An empty siglevel does not do any signature verification which is
exactly what we want when compiled without gpg support.  This is already
allowed in other parts of the codebase and required for the test suite
to pass when compiled without gpg support.

Fixes: FS#60880

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Andrew Gregory
3726693612 add specific error for missing gpg support
"wrong or NULL argument passed" is a useless error for end users.

Fixes FS#60880.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Que Quotion
508b4e3ec0 Split prepare_buildenv() to libmakepkg
This opens the door for third parties to provide libmakepkg
extentions for the purpose of altering the build environment.

Signed-off-by: Que Quotion <quequotion@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Que Quotion
0bb04fa16a Split check_software() to libmakepkg
This opens the door for third parties who provide extensions to
libmakepkg to supply scripts that confirm the presence of their
dependant executables.

Signed-off-by: Que Quotion <quequotion@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Dave Reisner
d81b5cc2a5 scripts/meson: ensure wrapper scripts are executable 2018-11-27 22:48:43 +10:00
Eli Schwartz
1aaf95089a makepkg: if "!buildflags" and "debug" coincide, unset the debug buildflags too
If a user has a makepkg.conf policy to enable debug builds, but a
PKGBUILD has disabled buildflags, we would unset the *FLAGS but then
later append the debug *FLAGS anyway, which would result in some *FLAGS
being used, against the wishes of the PKGBUILD author.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Dave Reisner
926eb345c2 buildsys: remove size_to_human
This was only ever used by paccache, and paccache has since been moved
to pacman-contrib.
2018-11-27 22:48:43 +10:00
Dave Reisner
c41222837d meson: separate out wrapped from non-wrapped scripts
makepkg-template is a perl script and doesn't get wrapped by our shell
wrapper. It (wrongly) reads from the host machine rather than the build
root, but this is working as implemented.
2018-11-27 22:48:43 +10:00
Allan McRae
0dd1492442 Remove Doxyfile from EXTRA_DIST
We generate this now, so no need to distribute. Fixes "make dist".

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-27 22:48:43 +10:00
Eli Schwartz
de915c4f14 repo-add: print the name of the database when extracting
Currently this prints the following message:
==> Extracting database to a temporary location...
==> Extracting database to a temporary location...

This redundancy is potentially confusing and may cause people to think
something is wrong. Historically, this message came from a time when we
only extracted one database, but repo-add was changed to always create
the files database in commit cb0f2bd038
and whole code block with message intact was moved into a for loop and
run (and printed) twice.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-03 21:57:03 +10:00
Eli Schwartz
3dfec574a3 makepkg: fix .PKGINFO/.BUILDINFO files swallowing status printing
The respective write_* functions are low-level and shouldn't be
outputting statuses; move these to the logic flow where they are used.
This ensures the functions can be used in the future wherever, and also
solves an issue where, as fallout from the message.sh retrofitting in
commit 882e707e40, the statuses got
redirected to the actual files.

The resulting package was technically correct, except that it contained
useless lines which pacman ignored, and repo-add also ignored but at the
same time generated an error message:

/usr/bin/repo-add: line 335: declare: `=-> Generating .PKGINFO file...': not a valid identifier

Thirdparty package tools with stricter parsers may abort with errors,
and "repose" is known to do so.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-03 21:56:40 +10:00
Eli Schwartz
635a9c911c pacman-key: just accept one file to verify, and enforce detached sigs
Simply pass options on to gpg the same way gpg uses them -- no looping
through and checking lots of signatures.

This prevents a situation where the signature file to be verified is
manipulated to contain an embedded signature which is valid, but not a
detached signature for the file you are actually trying to verify.

gpg does not offer an option to verify many files at once by naming each
signature/file pair, and there's no reason for us to do so either, since
it would be quite tiresome to do so.

In the event that there is no signature/file pair specified to
pacman-key itself,

- preserve gpg's behavior, *if* the matching file does not exist, by
 - assuming the signature is an embedded signature
- deviate from gpg's behavior, by
 - offering a security warning about which one is happening
 - when there is an embedded signature *and* a matching detached file,
   assume the latter is desired

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-11-03 21:56:09 +10:00
Dave Reisner
d230ec6f17 meson: add a wrapper to bootstrap scripts from within build dir
This doesn't do quite as good of a job of "hiding away" the real script
as we did with autotools, but it satisfies the need for being able to
run scripts which depend on libmakepkg with the local copy within the
repo. We do, however, improve upon the autotools script by ensuring that
the bash path used in configuring pacman is the interpreter used to run
the underlying script.
2018-11-02 03:16:34 -04:00
Dave Reisner
51db84750e Add meson.build files to build with meson
Provide both build systems in parallel for now, to ensure that we work
out all the differences between the two. Some time from now, we'll give
up on autotools.

Meson tends to be faster and probably easier to read/maintain. On my
machine, the full meson configure+build+install takes a little under
half as long as a similar autotools-based invocation.

Building with meson is a two step process. First, configure the build:

  meson build

Then, compile the project:

  ninja -C build

There's some mild differences in functionality between meson and
autotools.  specifically:

1) No singular update-po target. meson only generates individual
update-po targets for each textdomain (of which we have 3).  To make
this easier, there's a build-aux/update-po script which finds all
update-po targets and runs them.

2) No 'make dist' equivalent. Just run 'git archive' to generate a
suitable tarball for distribution.
2018-11-02 03:16:34 -04:00
Dave Reisner
dab45f0808 Dynamically generate Doxyfile from input
This isn't super interesting for the autotools side, but it's necessary
in order to make things sane for other build systems which we might
introduce in the future.
2018-10-23 12:13:18 -04:00
Eli Schwartz
b5d62d2c91 Port scripts to use libmakepkg's messaging code.
Remove all remnants of library/{output_format,term_colors}.sh

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 20:22:19 +10:00
Eli Schwartz
3561c872ca message.sh: add modifications from output_format.sh
In the spirit of making libmakepkg more useful as a library, and,
critically, *using* that library for additional pacman scripts, we
should include all of output_format.sh and term_colors.sh directly in
libmakepkg and hopefully stop having to embed additional copies in e.g.
repo-add via m4 macros.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 20:20:45 +10:00
Eli Schwartz
882e707e40 makepkg: send messages to stdout rather than stderr
This behavior is confusing, since it means absolutely everything goes to
stderr and makepkg itself is a quiet program that produces no expected
output???

The only situation where messages should go to stderr rather than
stdout, is with --geninteg which is meant to return the checksums on
stdout (but we don't want to totally get rid of status messages when
redirecting the results elsewhere, or, worse, redirect status messages
to a PKGBUILD). For this specific case, redirect message output to
stderr in the --geninteg callers directly.

Implements FS#17173

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 20:20:17 +10:00
Eli Schwartz
b5191ea140 makepkg: use builtin globbing to print files in package
- it comes with free collation when moving the LC_ALL declaration up a bit;
  this fixes a bug where the .FILES were not being properly sorted and
  their order depended on directory creation order, which broke
  reproducible builds in the wild.
- it handles sorting null-delimited output everywhere, without sort -z;
  this lets us get rid of sed hacks
- it is faster than invoking multiple find subprocesses
- dotfiles can be automatically printed *and the C locale sorts them first*
  with a single ** glob

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 20:09:04 +10:00
Eli Schwartz
e12d032174 makepkg: use bash 4.4 to localize set without explicitly saving/restoring
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 20:03:41 +10:00
Eli Schwartz
ea877c596b bash-completion: disable completions for pacman --search operations
We don't need exact package name completions for something that expects a
regular expression *search*, which is what we currently do. If you want
a package name completion for a search, you don't need the search.

This change is consistent with the current state of zsh completions.

Fixes FS#59965

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 19:33:57 +10:00
Eli Schwartz
c887d2cf00 bash-completion: don't complete filenames when they're not wanted
Filename completion should only be generated for makepkg, when using the
options -p or --config... which means we should offer option completions
by default.

Filename completion for pacman, should not be generated when using -Qu,
or -F without -o.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 19:33:07 +10:00
Andrew Gregory
ac959bb9c6 handle EINTR while polling scripts/hooks
If poll() is interrupted by a signal, alpm was closing the socket it
uses for listening to script/hook output.  This would drop script output
at the least and kill the script at the worst.

Fixes FS#60396

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 19:19:48 +10:00
Andrew Gregory
9886566abb reset signal handlers before running scripts/hooks
Front-ends or libraries may set signals to be ignored, which gets
inherited across fork and exec.  This can cause scripts to malfunction
if they expect the signal.  To make matters worse, scripts written in
bash can't reset signals that were ignored when bash was started.

Fixes FS#56756

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 19:18:29 +10:00
morganamilo
2c91d08e62 libmakepkg: fix linting arrays of empty strings
[[ ${array[@]} ]] will resolve to false if array only contains empty
strings. This means that values such as "depends=('')" can be inserted
into a pkgbuild and bypass the linting.

This causes makepkg to successfully build the package while pacman
refuses to install it because of the unmet dependency on ''.

Instead check the length of the array.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-10-21 19:08:03 +10:00
Dave Reisner
79a528735e Drop vestiges of SIZECMD
SIZECMD was replaced in 1af766987f with a POSIX solution, and this token
is no longer used/needed.
2018-10-20 13:22:05 -07:00
morganamilo
02255fd97e libalpm: process needed before group selection
When --needed is used, up to date packages are now filtered out
before showing the group select.

Fixes FS#22870.

Signed-off-by: morganamilo <morganamilo@gmail.com>
2018-10-20 12:08:27 -07:00
morganamilo
8c9046e604 pacman: don't error when a group exists but all packages are ignored
Currently when attempting to sync a group where all packages are
ignored, either by ignorepkg, ignoregroup or --needed, pacman
will error with "target not found".

Instead, if a group has no packages check if the group exists
before throwing an error.

Signed-off-by: morganamilo <morganamilo@gmail.com>
2018-10-20 12:07:48 -07:00
Dave Reisner
afb9c0140f Port pactest to python3
Use BytesIO instead of StringIO, and ensure that we unicode-encode data
where needed.
2018-10-18 18:05:19 -07:00
Olivier Brunel
ffde85aadf alpm: Fix SIGINT handling re: aborting download
Upon receiving SIGINT a flag is set to abort the (curl) download.
However, since it was never reset/initialized, if a front-end doesn't
actually exit on SIGINT, and later tries any operation that needs to
perform a new download, said download would always get aborted right
away due to the flag not having been reset.
2018-10-17 17:28:32 -07:00
Olivier Brunel
d96d0ffe7c alpm: Do not raise SIGINT when filesize goes over limit
Variable dload_interrupted is used both to abort a download because
SIGINT was caught, and when a file limit is reached. But raising SIGINT
is only meant to happen in the first case.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
2018-10-17 17:28:32 -07:00
Eli Schwartz
7afe51171f repo-add: add support for the zst format
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 18:15:50 +10:00
Eli Schwartz
bae74c8e9e makepkg: add support for the zst format
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 18:15:29 +10:00
Luke Shumaker
cd7b2d6e07 makepkg: lint_pkgver: Run even if PKGVERFUNC
lint_pkgver returns 0 if PKGVERFUNC, since it's likely that update_pkgver()
will change the value of pkgver anyway, and there's no point in linting the
old value.  update_pkgver() will call check_pkgver() itself to validate the
new value.

However, that "optimization" only holds if we're definitely going to call
update_pkgver() later; and that's way more complicated than

    if (( PKGVERFUNC )); then

it's more like:

    if (( !GENINTEG && !PACKAGELIST && !PRINTSRCINFO && !SOURCEONLY && !REPKG && PKGVERFUNC )); then

Which is to say: If I have a PKGBUILD with pkgver():

 * if I run `makepkg -g` I expect it to lint pkgver, but it won't
 * if I run `makepkg -R` I expect it to lint pkgver, but it won't
 * ...

So let's fix that.

Rather than try to keep a huge list of conditions in sync with the flow of
makepkg.sh.in, let's just drop it.  As far as I can tell, the only thing
that skipping lint_pkgver() really enables is letting the PKGBUILD author
write `pkgver=` in the initial version, and letting pkgver() fill it in.
They can just start writing `pkgver=0` for that workflow.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 18:01:23 +10:00
David Phillips
192d6166e9 User-visible log when validity check fails due to access
Currently, if checking the validity of packages fails due to an access
error on one or more packages, the user must sift through debug output
in order to find the culprit package(s). This patch adds a call to
_alpm_log in such a case to make the culprits more easily visible.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 17:04:45 +10:00
David Phillips
b54b33d816 Change if-else chain to switch
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 17:04:38 +10:00
Eli Schwartz
3d5a056452 makepkg: reject PKGBUILDs with both split and non-split package functions
We accept package_foo() in non-split packages, because it's easier to
switch to/from a split package just by removing a pkgname element. But
it makes no sense to have both in one PKGBUILD.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 11:10:04 +10:00
morganamilo
961ef1a4c8 Show group status during file search
When doing "pacman -Fs", show the "(groupname)"
message just like "pacman -Ss".

And refactor group printing to its own function.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 11:06:55 +10:00
Eli Schwartz
2bec380e10 libmakepkg/lint_config: fix lint_variable actually running the PKGBUILD lint
Due to a copy-paste error when initially implementing this, it actually
uses a duplicate function name, usually resulting in lint_pkgbuild
overwriting the function definition.

Then the PKGBUILD lint gets run twice, one time before the PKGBUILD is
even sourced -- to potentially surprising results, like erroring out on
a pre-existing shell definition that doesn't match our expectations.

Seen in the wild with lint_config triggering an error for
'declare -x arch="foo"'

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 10:54:26 +10:00
Eli Schwartz
3318039e3b pacman: check versioned optdepends in -Qi operation
Fixes FS#60106

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 10:48:22 +10:00
Rikard Falkeborn
ba2984db3e doc: Remove double spaces
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 00:52:48 +10:00
Eli Schwartz
58c76daf5e scripts: deduplicate localized copyright messages
We don't need to translate the "Copyright YEAR AUTHOR" part, no part of
it should probably be translated and it definitely shouldn't turn every
single license terms notice into a separate translation just because the
author/year is different.

Fixes FS#58452
Also consistently add a blank line after the copyright and before the
license terms.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-19 00:13:29 +10:00
Eli Schwartz
d03409ccde Revert "makepkg: add whirlpool to the list of hashing algorithms"
This reverts commit 9cdfd18739.

We've never documented whirlpoolsums support in the manpage and no one
really seems to have realized we support it, let alone use it -- except
for a few parabola packages, being the contributor's motivation for
adding support.

The problem is that for two years the code has been broken. In commit
577701250d we moved to coreutils to
provide checksum commands, rather than openssl, but there is no
whirlpoolsums binary.

Properly fixing this would require re-adding a dependency on openssl,
independent of the libalpm crypto backend -- which defeats the purpose
of moving to coreutils in the general case. nettle-hash does not provide
a whirlpool algorithm any more than it does base64 (the original reason
for moving to coreutils).

Therefore, we should just drop support for this again.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-18 21:53:21 +10:00
morganamilo
62eef5bbdb pacman-conf: add missing DisableDownloadTimeout
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-09-18 10:38:23 +10:00
Eli Schwartz
5b2ff51c39 makepkg: don't print status for run_function when in a subshell
It's most likely a case where output is being captured, so we shouldn't
be interleaving status messages with function output regardless. Setting
the pkgver() status message (the one time we use it in a subshell)
separately also makes it safe to change whether message.sh functions write
to stdout or stderr.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 16:00:01 +10:00
Eli Schwartz
16f6aae330 makepkg: fix pkgver() function not aborting on errors
`run_function_safe pkgver` is evaluated in a subshell and therefore does
not abort when it should. Explicitly check the return outside of the
subshell and abort if necessary.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:58:32 +10:00
Eli Schwartz
48c8f9f2a2 makepkg: don't save the same shopts twice
Both run_function and run_function_safe will save and restore `shopt -p`
but the former is only called from the latter. It makes sense to save
this as part of a "safe" runner, so let's just do it in one place, there
where we save and restore everything else too.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:56:20 +10:00
morganamilo
0696307a3b Show install status during file search
When doing "pacman -Fs", show the "[installed: version]"
message just like "pacman -Ss".

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:32:46 +10:00
Dave Reisner
3370c08a29 pacman/conf: Remove unused include
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:14:29 +10:00
Dave Reisner
3e9a62e721 doc: use more implicit rules to build manpages
Use implicit dependency rules to translate asciidoc inputs to HTML and
manpage outputs. We should only have to declare explicit dependencies
for odd cases, e.g. the PKGBUILD documentation has an additional include
file and isn't a 1:1 conversion.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:05:03 +10:00
Dave Reisner
9fde55c0c7 Remove unused checks for strcoll and mktime
We don't use these.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:04:45 +10:00
Dave Reisner
8b2f3323b8 common/ini: Depend on util-common, not util
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-29 14:02:58 +10:00
Eli Schwartz
2d8d8af915 scripts: pass on options such as set -x to child processes
When re-running makepkg for fakeroot, if `bash -x makepkg` was used this
is lost. Fix by encoding the current set of options explicitly in the
invocation, both for makepkg and for the wrapper used to test scripts
inside the source tree.

Also change to use ${BASH_SOURCE[0]} instead of $0 as the latter can be
anything the parent process wants, while the former is explicitly set by
bash itself to the filepath of the script.

See http://mywiki.wooledge.org/BashFAQ/028

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 15:20:40 +10:00
Allan McRae
7d05ffceaf Remove the last traces of the pacman --force option
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:38:03 +10:00
Jan Alexander Steffens (heftig)
e4be26b732 scripts: Remove trailing semicolons
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:20 +10:00
Jan Alexander Steffens (heftig)
4e83abaae5 libmakepkg/util/option: Refactor checking to reduce code duplication
Pull out the expected=y/n check into a separate function and make use of
the fact we can just prepend the fallback arrays to get the same result.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:20 +10:00
Eli Schwartz
92bc0a4740 libmakepkg/util: use parameter transformation when checking variable type
Now that we require bash 4.4 this is "more correct" than analyzing the
output of declare -p to see if it compares favorably with -a.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:20 +10:00
Eli Schwartz
b0a8f44f10 configure: bump the minimum version of bash to 4.4
This is required in order to use declare -g and ${var@a}

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:20 +10:00
Eli Schwartz
885bbb504a makepkg: when signing packages, report package filename on failure
In commit c6b04c0465 the signing function
was moved out of fakeroot, and thus out of the create_package loop. This
meant that if package signing failed, it was no longer possible to tell
which package it failed on by checking which package creation is
currently running. Successful signing attempts do not have this problem
as we already printed the name of the signature file.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:20 +10:00
Michael Straube
9e960d9d5a libalpm/dload.c: add case for CURLE_COULDNT_RESOLVE_HOST
Add a case for curl error 'Could not resolve host'.
An attempt to fix FS#48285.

Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
Jouke Witteveen
7f1f1355bb libalpm: ignore .hook suffix when sorting hooks
It is desirable to have 'a-post.hook' ordered after 'a.hook'. For this,
it is needed to ignore the suffix when sorting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
morganamilo
0937d322ba libmakepkg: add pkgbase to linted variables
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
Jan Alexander Steffens (heftig)
7edbbd9a63 makepkg: Simplify run_package
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
Jan Alexander Steffens (heftig)
f2788244d3 makepkg: Simplify SPLITPKG check
This causes package_$pkgname() to be preferred over package() in the
non-split case, but the behavior if both functions exist was
undocumented anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
Alex Butler
0cbb128818 Add lz4 compression support to makepkg
Adds opt-in lz4 compression of *pkg.tar files with makepkg.
This is nice to have as an option for very fast compression
and is already installed with libarchive.

Signed-off-by: Alex Butler<alexheretic@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
Eli Schwartz
fd16da2ed6 scripts/completion: derive the bash completion directory from pkg-config
Default to the standard completionsdir, which is lazy-loaded, rather
than hardcoding the compatdir which is not.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10 12:37:19 +10:00
Allan McRae
7e081d2adf Release v5.1.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 11:43:39 +10:00
Eli Schwartz
1a5f308d52 makepkg: optimize and fix BUILDINFO generation's use of awk
The biggest issue is directly supplying the data within the format
string which can result in misinterpreting formatter sequences if a
printed variable contains an "%" in it. This character is currently
permitted in the pkgver field, though not in the pkgname. Also
pacman/libalpm itself has much looser limitations and this can appear
anywhere at all if a package was created by some other program.

For the package "iambroke-1%s-1-any.pkg.tar.xz", installed in the build
environment, the result is:

  -> Generating .BUILDINFO file...
awk: cmd. line:3: (FILENAME=- FNR=1085) fatal: not enough arguments to satisfy format string
	`-1%s-1'
	   ^ ran out for this one

Followed by a .BUILDINFO which contains an LC_ALL=C sorted list of
$pkgname-${epoch:+$epoch:}$pkgver-$pkgrel-$arch ending in:

installed = iambroke

Which is cut short, then fails to list the succeeding packages. The
package itself successfully builds.

It's also unnecessary to save the output of pacman -Qq in order to get the
information for pacman -Qi, since the latter will, just like the former,
return information for all installed packages if not given a package
name(s).

While I am at it, pipe this directly to awk rather than keeping a copy
in an unnecessary local variable. This is slightly more efficient in
addition to preventing the <<< herestring from re-interpreting the
content of "$pkginfos" in ways that don't really matter for our usage.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 11:43:39 +10:00
Jouke Witteveen
2d8a751943 alpm-hooks.5: include more information on hook files
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 11:04:02 +10:00
Allan McRae
13fb2430e8 Pull updated translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 10:38:57 +10:00
Allan McRae
0827aff85e Handle root prefix in overwrite operations
The pacman --overwrite operation currently expects a path without
the root prefix specified.  This is unexpected, particularly
given our conflict error message reports the path with the root
prefix included.

This patch allows libalpm to overwrite files with the root prefix
specified.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 10:24:57 +10:00
Eli Schwartz
316b031b7c makepkg: reduce strictness of pkgver in depends linting
This change was introduced to prevent entries like depends=('foo>').
However, it had the unintended side effect of causing a number of
working PKGBUILDs to fail to build. This happened when a PKGBUILD
defined one variable through calling a "complex" statement within the
PKGBUILD's package function (e.g. a function or evaluating in a
subshell), then used it to define the package metadata variable.

extract_function_variable() cannot execute the package function in order
to retrieve this information, so it performs a simple grep + eval instead
and in the process misses the contextual awareness of running within the
package function.

While not catching these "issues" can result in incorrect SRCINFO, the
resulting packages are fine. Stop aborting on the common case where the
pkgver of a dependency is dynamically set during the package function
until the large number of broken PKGBUILDs are fixed, and the
restrictions of the PKGBUILD format are documented.

"Fixes" FS#58776

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 10:21:58 +10:00
Michael Straube
757e85b21d makepkg.conf: add missing sha224 sums
Add missing sha224 sums to makepkg.conf and it's man page.

Signed-off-by: Michael Straube <michael.straube@posteo.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 10:21:58 +10:00
Eli Schwartz
41cbea29b4 doc: declare what type of comments we support in pacman.conf
Ini-style configuration formats are all over the place. So are we, for
that matter, as we switched how we treated middle-of-line comments in
commit 8a19c4a782 -- namely, they're not
comments anymore. This is surprising to users, who report bugs because
it used to work, but what's more surprising is that the only
"documentation" for the type of comments users can be expected to use,
is by guessing from our example pacman.conf and maybe discovering
unreliable easter eggs.

Fixes FS#58809

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-25 09:50:26 +10:00
Allan McRae
0adb36346c Revert "Deprecate --root in favour of --sysroot"
The use of --sysroot in the real world has flagged some issues that need
addressing.  Undeprecate --root for now.

This reverts commit a278356f75.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-25 09:50:26 +10:00
Allan McRae
acef70c103 libmakepkg: remove accidentally added file
A blank file slipped into libmakepkg in commit 2c94118d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-19 12:23:57 +10:00
Eli Schwartz
8b4be66a30 libmakepkg/tidy: fix debug sources not being properly detected sometimes
DW_AT_comp_dir is meant to contain the directory in which the compiler
was run

DW_AT_name contains the source file the compiler was told to use.

In the event that DW_AT_name is an absolute path, it is (obviously) not
meant to be computed relative to DW_AT_comp_dir. However, we did not
handle this correctly, and as a result tried to copy source files using
doubled-up filepaths.

The correct approach should be to use DW_AT_name on its own, in the
event that it is an absolute path.

See http://wiki.dwarfstd.org/index.php?title=Best_Practices.

This fixes debug package generation for many packages that use absolute
paths in their build systems... like CMake.

Reported-by: Jagannathan Tiruvallur Eachambadi <jagannathante@gmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-19 12:23:57 +10:00
Allan McRae
9a8c7154b1 Revert "makepkg: use the declare builtin when backing up variables to eval"
This reverts commit 9e52a36794.

The change to use declare for the split package metadata backup/restore
resulted in variables being declared at a local scope. When these variables
were unset (mostly noticed with debug packaging) this left the variable at
global scope defined. Revert back to the known good state.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-19 12:23:25 +10:00
Allan McRae
4fe9adf418 PKGBUILD(5): Remove reference to ChangeLog prototype inclusion
We do not distribute a ChangeLog prototype, so should not reference
it in the man page.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-19 20:44:14 +10:00
Eli Schwartz
0d6e82d374 makepkg: don't print per-pkgname debug packages
In commit 9a4d616220 debug packages were
merged into one exclusive pkgbase-debug, but the print_all_package_names
function did not get updated to match this logic.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 16:54:37 +10:00
Allan McRae
d750c854bc Fix signing of debug packages
Commit 9c8d7a80 broke the signing of debug packages by merging code up but
not changing the test condition.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 16:50:58 +10:00
Michael Straube
72263e22bd libalpm/dload.c: fix filename in license header
The filename in the license header did not match the actual filename
as in the other files. Hopefully this is not too nit-picky.

Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 16:28:04 +10:00
Dave Reisner
a92a36070a makepkg: fix initialization when extracting arrays
Assuming that everything is a string leads to code which is effectively:

  a=
  a+=('bar')

This creates an array with 2 elements instead of one. Using proper array
initialization fixes this.

https://lists.archlinux.org/pipermail/pacman-dev/2018-June/022591.html
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
morganamilo
5cf6f614eb Add missing sha224 sums in man page and linting
Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
793202344b makepkg: fix erroneous $BUILDDIR when $startdir is not an absolute path
When comparing the $BUILDDIR to the $startdir, we used string equality
instead of testing whether they are the same location, and ended up
appending $pkgbase even though there's no reason to use it here.

In some cases, this could result in makepkg erroring when trying to
create $srcdir/$pkgdir, if a file with the same name as the $pkgbase
exists. This is expected behavior if a file "src" or "pkg" exists, but
decidedly less so for $pkgbase.

This could be fixed either by setting $startdir to an absolute path, or
by ensuring the test checks this directly; I've chosen to do both, since
the test should really be correctly checking the thing it actually cares
about, but since we ensure absolute paths are used everywhere else, this
might bite us elsewhere someday. It's also more consistent.

Fixes FS#58865

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Allan McRae
e6dbe82c0c PKGBUILD.5: document restriction on pkgrel
The format of pkgrel was much more retrictive than described in the
man page. Update the documentation to reflect this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Jan Alexander Steffens (heftig)
05a3641c76 makepkg: Don't use parameterless return
It's especially dangerous in trap handlers since the return value of the
function becomes the return value of the last command before the trap,
not the last command in the current function. This applies to any
function executed in a trap handler, nested functions included.

In one case, install_packages failed (via return 14), which was inside a
conditional that then ran exit 14, which triggered the EXIT handler,
which called clean_up, which called remove_deps, which had !RMDEPS and
thus returned. The return value of remove_deps became the return value
of install_packages, triggering the ERR handler, which (due to another
problem) was still the user function handler, which then printed a
misleading error message and overrode the exit code with 4.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
ab1e92860b makepkg: fix the --nocolor option being broken when passed to pacman -U
In commit 8ff03868a3 PACMAN_OPTS was
turned into an array. Unfortunately, that array was generated by
treating the "--color never" option as one string, instead of an
array of two strings...

Fixes FS#58820

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Luke Shumaker
b37a6063d0 pacman.conf: Fixup the XferCommand example for curl
1. Without `-L`, curl doesn't follow redirects.  This is different than
    both the default behavior of pacman, and from the wget example.  So add
    `-L`.

 2. It uses `-C -` to supposedly allow resuming partial downloads; but that
    doesn't work if we use `> %o` to direct the output to the file.
    Instead, use `-o %o` so that `-C -` actually works.

Signed-off-by: Luke Shumaker <lukeshu@parabola.nu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Jan Alexander Steffens (heftig)
f78914cc6e makepkg: Clear ERR trap before trying to restore it
$restoretrap is empty if the trap was not set. This caused the trap
handler to remain and override later exit codes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
de8c5e78bb libmakepkg/lint_pkgbuild: squelch syntax error when a pkgname is empty
We fail with an error, but then we also fail with:

==> ERROR: depends is not allowed to be empty.
/usr/share/makepkg/lint_pkgbuild/pkgname.sh: line 39: continue: only meaningful in a `for', `while', or `until' loop

During the refactor to provide enhanced pkgname=pkgver linting, this was
moved out of the ${pkgname[@]} loop to a distinct function, at which
time it should have been modified to return rather than continue.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
737596f038 makepkg: do not chmod $BUILDDIR itself after checking for its existence
In commit d8717a6a96 the write permission
checks were refactored. Initially we intended to drop this chmod in the
process, but due to some confusion about whether it was needed, I ended
up submitting patches both to preserve and to remove it... but it's not
needed after all. We do it on the individual $srcdir/$pkgdir, later on.

Then, we used the wrong version, which causes unnecessary restrictions.

See FS#58790

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
870d4c8fdd libmakepkg/lint_pkgbuild: permit versioned optdepends
pacman accepts these, and there is no good reason to be more restrictive
ourselves; we should follow the example of "depends" here.

Update the documentation to actually state that this is supported.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
c37a06fe1d libmakepkg: when checking for write permissions, handle pre-existing dirs
Simplifies the function a bit, but mostly, mkdir -p will never fail if
the directory exists, and therefore makepkg never checks to see if it is
actually writable. On the other hand, it's unnecessary to check if the
directory exists once we know mkdir -p succeeded...

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
9eb3695a3f makepkg: remove unused variable forgotten when moving to parseopts
Reported-by: Rafael Ascensão <rafa.almas@gmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Eli Schwartz
3a66b93be0 makepkg: update help text to describe --packagelist's new behavior
In commit d8591dd341 when teaching
--packagelist to print the full filepath for built arches only, I forgot
to update the helptext at the same time as I updated the manpage.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18 13:15:51 +10:00
Allan McRae
930d501947 pacman-conf: fix detection of repo usage
pacman-conf returned All for any repo Usage query because it was
checking if any repo options were enabled rather than if all options
were enabled.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-04 21:32:43 +10:00
Allan McRae
716d776936 Apparently we live in the future!
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 13:47:36 +10:00
Allan McRae
be4c491ceb Release v.5.1.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 09:38:29 +10:00
Allan McRae
ca128f2eff Pull updated translations from Transifex
Also remove any translations that are less than 75% complete.  These will
be readded once translation completion passes our minimum threshold.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 09:25:04 +10:00
Allan McRae
3b2e09740c Translations need to be 75% completed to be included
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 09:14:45 +10:00
Allan McRae
eeb228c32e Update README for pacman-5.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 08:47:27 +10:00
Eli Schwartz
64e3a462c6 Update NEWS for pacman-5.1 release
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 08:47:27 +10:00
Eli Schwartz
ab6d8614d5 fix typo in editorconfig resulting in ignored options
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-28 08:47:27 +10:00
Eli Schwartz
6341e5ce23 Fix using run_pacman to invoke -Qi with sudo
In commit 5698d7b66d a new non-root use of
pacman was added -- previously we used -T or -Qq, and run_pacman did not
know how to special-case -Qi to skip being prepended with sudo.

The result is:

  -> Generating .BUILDINFO file...
ERROR: ld.so: object 'libfakeroot.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
[sudo] password for eschwartz:
  -> Adding changelog file...

Fix this by using a more generic glob since neither -Q nor -T will ever
need sudo or PACMAN_OPTS

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-16 14:44:16 +10:00
Allan McRae
652438772e Pull translations from Transifex and regenerate
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-15 11:03:42 +10:00
Eli Schwartz
1e7a191136 Add http://EditorConfig.org configuration
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14 09:59:20 +10:00
Eli Schwartz
076b6184de Ensure better text editor automatic filetype detection
Since we no longer use vim-specific modelines, use the .asciidoc file
extension which is, well, reserved for asciidoc formatted files. This
should presumably work everywhere without needing editor-specific
workarounds and configuration.

Also add a shebang to makepkg.conf to indicate it contains bash content.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14 09:59:17 +10:00
Eli Schwartz
860e4c4943 Remove all modelines from the project
Many of these are pointless (e.g. there is no need to explicitly turn on
spellchecking and language dictionaries for the manpages by default).

The only useful modelines are the ones enforcing the project coding
standards for indentation style (and "maybe" filetype/syntax, but
everything except the asciidoc manpages and makepkg.conf is already
autodetected), and indent style can be applied more easily with
.editorconfig

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14 09:59:15 +10:00
Eli Schwartz
9aec7c3c72 makepkg.conf: add default protocol handler for file:// urls.
This is a common URI scheme (in general if not in makepg) and we should
provide a handler for it. We already allow its use for locally sourced
git repositories, so it makes sense to not leave files out.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14 09:58:16 +10:00
Jan Alexander Steffens (heftig)
03272ad571 libmakepkg: Support file 5.33's application/x-pie-executable
file 5.33 introduces a new MIME type "application/x-pie-executable",
which is used for relocatable binaries. makepkg ignored these binaries
and did not attempt to strip them.

Handle the new MIME type like the old "application/x-sharedlib".
Stripping the binaries with --strip-unneeded to keep relocation
information should be the correct thing to do.

file 5.33 also misidentifies actual libraries as PIE executables, so we
didn't strip any shared libraries, either. We now work around this bug.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 22:57:47 +10:00
Andrew Gregory
40937b381a util/pkgbuild: fix broken indentation
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 22:22:54 +10:00
Eli Schwartz
af6125fbcc Fix gcc8 warnings.
Attempting to compile pacman with gcc8 results in several warnings like:

remove.c: In function ‘unlink_file.isra.4’:
remove.c:407:34: warning: ‘.pacsave.’ directive output may be truncated writing 9 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]

Fix by adding checks to error out if snprintf tries to reserve a
truncated filename. Because the return values are checked, gcc delegates
the truncation response to our code instead of throwing warnings.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:36:35 +10:00
Eli Schwartz
0d356c27c1 Fix regression that broke repo-add aborting on failures
In commit cb0f2bd038 the changes from
commit 81d233b793 seem to have been
inadvertently backed out.

Right now the current check doesn't do anything, since "fail" is always
nothing and therefore successful.

Fixes FS#58505

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:34:54 +10:00
Eli Schwartz
1741bdaf81 libmakepkg/integrity: determine what is a signature preferring local filename
Checking the file extension to determine if something is a signature is
currently done in three places:
- verify_file_signature: uses $file to print status, reuses it for
  comparison
- source_has_signatures: uses $netfile, but removes url component if
  filename component exists
- generate_one_checksum: uses $netfile and fails to detect renamed files

This leads to inconsistent behavior when trying to use a signature of
the form "foo-1.0.tar.gz.asc::https://example.com/foo-1.0.tar.gz.pgp"

Fix this by treating the third case like the second case.

Reported-by: Giancarlo Razzolini <grazzolini@archlinux.org>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:30:51 +10:00
Simon Linden
828f305023 bash_completion.in - consider option "-n --native" in operation "-Q --query"
Signed-off-by: Simon Linden <xhi2018@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:29:12 +10:00
Robin Broda
5698d7b66d Append architecture information to 'installed' elements in .BUILDINFO
Adding the architecture to the 'installed' elements of the .BUILDINFO
file makes it easier to retrieve the packages needed to reconstruct
the build environment.

Signed-off-by: Robin Broda <robin@broda.me>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:25:51 +10:00
Robin Broda
f173f6d0da Add pkgarch to .BUILDINFO
Architecture information is required for repro tooling

This is a revised version of https://patchwork.archlinux.org/patch/475/

Signed-off-by: Robin Broda <robin@broda.me>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:22:46 +10:00
Eli Schwartz
2b4c996b86 libmakepkg: don't save/set/restore extglob in bash [[ tests
Since bash 4.1 extglobs can be used within [[ ... ]] regardless of
whether the shopt is set. Our configure.ac requires bash 4.1.0 at a
minimum for pacman scripts.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:16:03 +10:00
Eli Schwartz
542c3cf812 libmakepkg: only save the shellopts we need
micro-optimization: We only care about temporarily enforcing extglob, so
that is the only one we need to explicitly restore.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:11:52 +10:00
Eli Schwartz
2c94118dc1 libmakepkg/lint_pkgbuild: fix regression in linting depends=(foo=$epoch:$pkgver-$pkgrel)
In commit 91b72cc386 support was added for
linting depends/etc. to ensure they contain only valid dependency
specifiers. However it did not properly take into account the
possibility of dependencies linked to a specific pkgrel or epoch, which
promptly failed to build because "-" and ":" is not allowed in a pkgver.

pkgrel is something supported by pacman and useful for e.g. split packages
which cannot be mismatched even if the pkgver is the same. Fix by
removing an optional suffixed "-$decimal" when checking for a valid
pkgver.

epoch is kind of difficult to do without :D so likewise fix by removing
an optional prefixed "$integer:"

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:10:44 +10:00
Rafael Ascensão
fa8b99189e remove unneeded break argument from option parsing
Some scripts are using `break 2` to break out of the option parsing
loop.

Since a single `break` is sufficient in these cases, remove the extra
argument.

Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12 21:09:37 +10:00
Allan McRae
77986af9b7 makepkg: Fix listing of uninstalled deps
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-30 00:46:02 +10:00
Allan McRae
c3402ab44e add missing newline to error message
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-30 00:43:06 +10:00
Allan McRae
4d1e27957d Initial translation preparation for pacman-5.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29 23:56:07 +10:00
Allan McRae
254a8e2e05 Import updated translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29 23:43:07 +10:00
Allan McRae
6018063ef6 Update POTFILES.in
Add all files to the relevant POTFILES.in.  This avoids missing
translations added to old files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29 22:44:46 +10:00
Eli Schwartz
ab7393c53e libalpm.pc: migrate to Requires.private
pkg-config has built-in dependency handling, but we currently insert the
raw $LIBS into libalpm's own linker flags and fail to handle Cflags at
all.

For dependencies which support pkg-config, simply use that instead.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29 21:57:17 +10:00
Eli Schwartz
91b72cc386 libmakepkg/lint_pkgbuild: lint depends/etc. as if they are pkgname
depends, provides, conflicts, replaces, and other variables that are
meant to contain package names, are now checked to ensure

1) the name component contains only characters that would equate to
   a valid pkgname.
2) the version component contains only characters that would equate
   to a valid pkgver.
3) comparison operator is a valid comparison operator (e.g. provides
   only allows exact = while optdepends doesn't allow anything)

This also refactors pkgname into a shared utility function, wires up
pkgbase optdepends and provides to use it, and gives pkgver a touchup
to allow referencing where it was called from.

Fixes FS#57833 and a bit of extra.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29 21:49:05 +10:00
Eli Schwartz
bcaf1b84ff libmakepkg/util/pkgbuild.sh: fix missing extglob
We use an extended glob here, but were relying on having it globally set
in makepkg. This causes it to fail when used in scripts.

Since scripts using libmakepkg may not want extglob to be set, save and
restore the environment while explicitly setting extglob only where we
need it.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29 21:34:43 +10:00
Christian Hesse
27f64e3789 pacman.conf.5: use consistent presentation for paths
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-18 12:48:10 +10:00
Eli Schwartz
9ca88575e6 makepkg --packagelist: fix listing debug packages with makepkg.conf
print_all_package_names used in_opt_array to check whether or not the
PKGBUILD itself has options=('debug' 'split') -- while checking to see
if it was enabled per split package which doesn't make sense as these
options apply globally. This prevented debug packages from being listed
if enabled via makepkg.conf rather than per PKGBUILD.

Instead, use check_option to determine whether makepkg actually thinks
it is meant to try creating a split debug package.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-18 12:47:44 +10:00
Eli Schwartz
9e52a36794 makepkg: use the declare builtin when backing up variables to eval
Rather than manually crafting foo_backup in a loop and eval'ing them
with a complicated escape pattern, store every splitpkg_overrides
element into a single variable via the eval-friendly `declare` builtin.

An alternative to eval would be using `printf -v` but this does not work
for arrays.

This has the additional benefit of reducing the number of
variables/arrays floating around in the environment.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-15 14:39:31 +10:00
Eli Schwartz
f054351e52 libmakepkg: Add basic rules to lint makepkg.conf variables
Currently the only things we check are:

- Things that should be arrays, are not strings, and vice versa (this
  was mostly copy-pasted from the similar code in lint_pkgbuild).
- Variables that are meant to contain pathname components cannot contain
  a newline character, because newline characters in pathnames are weird
  and also don't play well with future changes intended for the
  --packagelist option.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-15 14:34:13 +10:00
Eli Schwartz
9c8d7a8093 libmakepkg/integrity: fix regression that broke --install
In commit c6b04c0465 package signing was
moved out of fakeroot, and as part of this process, the global pkgname
variable was modified in order to extract the built package names.

However, if a debug package was not available and added to the list of
packages, the function was aborted early, before the pkgname array was
restored, thereby corrupting the later stages of makepkg and
specifically the install_package function which needs to know which
pkgnames to install.

Fix this by inlining the debug package signing inside the `if` check,
and as added security switch to using `for pkg in "${pkgname[@]}"` as is
done in many other parts of makepkg, since package signing does not
depend on the value of pkgname for anything.

Additionally, since debug packages may not actually exist, check if the
package file exists first.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-15 11:30:20 +10:00
Eli Schwartz
c54621d819 makepkg: avoid false "Signing package(s)" msg when signing is disabled
Followup on c6b04c0465 which refactored
the signing function to run outside of fakeroot, and in the process
moved the status message to outside the $SIGNPKG check.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-15 11:16:00 +10:00
Eli Schwartz
d8717a6a96 makepkg: refactor checking for write permissions into a utility function
Additionally provide a separate error for failure to create the
directory vs lack of write permissions on a pre-existing directory.

This also means we now consistently try to create any nonexistent *DEST
directories as needed before aborting with E_FS_PERMISSIONS. Previously
only $BUILDDIR received that kindness.

Fixes FS#43537

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 17:47:51 +10:00
Eric Renfro via pacman-dev
0565cebfc3 Added gpg-agent.conf to disable the gnupg scdaemon
This fixes an issue where smartcards, such a Yubikey, would cause the
keyring to fail locally signing, thus also failing to verify signed
packages.

Signed-off-by: Eric Renfro <psi-jack@linux-help.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 17:45:08 +10:00
Allan McRae
3e619ccffe make_aligned_titles: initialise wbuf
This prevents a valgrind warning from deep inside wcstombs.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 15:08:36 +10:00
Rikard Falkeborn
1b288bae1f PKGBUILD.5: Mention valid characters for arch
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 14:54:57 +10:00
Allan McRae
b6bb8cb7dc Update coyrights for 2018
make update-copyright OLD=2017 NEW=201

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 13:31:31 +10:00
Stefan Klinger
d884a791b9 hooks: Complain if hook parameters are overwritten. Fixed 2 space leaks.
Signed-off-by: Stefan Klinger <git@stefan-klinger.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:53:52 +10:00
Felix Glaser
a5dd5d4141 makepkg: set umask 0022 again after syncing deps
makepkg configures the umask 0022 as a sane default for building
packages. After installing dependencies, it sources `/etc/profile`
again. If the user configured a umask other than Arch's default of
0022 (or 022) in `/etc/profile`, this sane default is now gone and
needs to be set again.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:52:09 +10:00
Rikard Falkeborn
5c1853124d Fix linting of whitespace in pkgver
In order to detect if pkgver contains whitespace, we need to quote it.
Previously, only the characters up to the first whitespace was checked.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:45:13 +10:00
Rikard Falkeborn
55092d0fa7 PKGBUILD.5: Mention that pkgver can't contain whitespace
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:44:31 +10:00
Yen Chi Hsuan
e4e0add629 makepkg: use localized date strings
Before this change, LC_TIME=zh_TW.UTF-8 makepkg has the following line:

==> Making package: foobar 1-1 (日  2月 11 01:13:42 CST 2018)

With this patch, this line becomes:

==> Making package: foobar 1-1 (西元2018年02月11日 (週日) 01時13分57秒)

The latter is more natural for a Chinese native speaker.

Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:29:40 +10:00
Huáng Jùnliàng
03ce7cc4eb autoconf: bump AC_PREREQ to 2.64
The acinclude.m4 uses AS_VAR_APPEND macro. This marco is introduced in 2.64[1], hence we bump AC_PREREQ to 2.64 to avoid undefined marco on 2.63 autoconf.

[1] https://lists.gnu.org/archive/html/autoconf/2009-07/msg00079.html

Signed-off-by: Huáng Jùnliàng <i@jhuang.me>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:29:14 +10:00
Huáng Jùnliàng
b3a1f89611 configure: bump libarchive requirements
bump libarchive requirement to >= 3.0.0 as we use `archive_write_free` available from 3.0.0

Signed-off-by: Huáng Jùnliàng <i@jhuang.me>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:28:46 +10:00
Ivy Foster
df0a8f7406 doc/.gitignore: ignore all manpages
They're all generated during make.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:17:08 +10:00
Ivy Foster
c968e625e8 pacman-conf.c: exit if cannot set rootdir or parse config file
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:16:58 +10:00
Ivy Foster
0e260f9335 pacman-conf.c: exit if cannot create config data structure
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:16:58 +10:00
Ivy Foster
2dd8b88d5c pacman-conf.c: add short options
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:16:58 +10:00
Eli Schwartz
d8591dd341 makepkg --packagelist: just list the built package files we will build
Currently this seems to be only theoretically useful. The most likely
reason for wanting a packagelist is in order to script makepkg and
derive the filenames for the packages we want to install or repo-add,
but in the current implementation this requires a lot of additional
post-processing which must be duplicated in every utility to wrap
makepkg.

- It is of minimal use to know what packages might get created on some
  other device utilizing a different CPU/OS architecture, so don't list
  them.
- It is non-trivial to reimplement makepkg's logic for sourcing any of
  several makepkg.conf configuration files, then applying environment
  overrides in order to get the PKGDEST and PKGEXT, so include them
  directly in the returned filenames.
- Output is delimited by newlines, for readability. For maximum
  parsing reliability, libmakepkg needs to learn how to lint the PKGDEST
  and PKGEXT variables to ensure they do not contain newlines, which
  will be submitted in a separate patch.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14 12:16:58 +10:00
Ivy Foster
a100cd6bca src/pacman/query.c: do not exit -Qo with error if file does not exist
Query operations act on the local db, not the filesystem. Also, a
valid use case for -Qo is to discover what package owns a deleted file
so it can be reinstalled.

Closes FS#55856.

Signed-off-by: Ivy Foster <iff@escondida.tk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-02-06 11:16:17 +10:00
Ivy Foster
640c2462bb pacman/query.c: in query_fileowner, make is_dir an int
S_ISDIR is int and "returns non-zero" if the file is a directory.

Signed-off-by: Ivy Foster <iff@escondida.tk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-02-06 11:11:44 +10:00
Allan McRae
a278356f75 Deprecate --root in favour of --sysroot
The --root option was widely misunderstood, and is now replaced by
--sysroot.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 21:47:26 +10:00
Jelle van der Waa
a7dbe4635b Add BUILDINFO man page
Add a new man page which describes the structure of a BUILDINFO file
included in a package produced by makepkg.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:10:17 +10:00
Eli Schwartz
9058d7fe9a pacman-key: do not set a default keyserver
Recent versions of GnuPG are perfectly capable of using sane defaults,
and the default SKS keyserver over hkps:// is better than hardcoding the
same keyserver over hkp:// anyway.

Fixes FS#55278

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:05:58 +10:00
Eli Schwartz
d911438352 vercmp: fail when the wrong number of arguments are provided
Fixes FS#49093

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:05:39 +10:00
Eli Schwartz
19dabcc19a Fix usage of install_package
In commit ab2be5794d return codes were
implemented, and the output of install_package was improperly assigned
to a variable when the return code was wanted.

All we need to do is restore the previous exit handling, but return $?
instead of hardcoding "0".

Reported-by: xftroxgpx <xftroxgpx@protonmail.com>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:05:18 +10:00
Joel Teichroeb
b2e088e42c use pacman-conf in bash completion
Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:04:45 +10:00
Andrew Gregory
d9eda13fc6 use pacman-conf in scripts
Because parsing pacman.conf is so difficult that even we can't do it
right.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:02:11 +10:00
Andrew Gregory
170bb80a1f add pacman-conf utility
Parsing pacman's configuration file is non-trivial and extremely
difficult to do correctly from scripts; even our own do it incorrectly.
pacman-conf is a dedicated tool specifically to allow scripts to parse
config files, getting the same value that pacman itself would use.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19 12:02:07 +10:00
Andrew Gregory
fa745fb467 extract default settings to separate function
Default values for configuration settings were being set during alpm
setup and in some cases were never saved back to the original config
struct.  Refactoring all default settings into a separate function and
saving them onto the original config struct will allow pacman-conf to
resolve the defaults without having to setup alpm.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-18 13:43:08 +10:00
Andrew Gregory
0bbf9ddf9d extract raw config file parser
To allow pacman-conf to parse the configuration file without having to
also setup alpm.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-18 13:42:57 +10:00
Allan McRae
e8462a4f88 Support new OpenPGP format packets lengths
RFC 4880 defines two packet formats for OpenPGP.  Pacman aborted its key
in keyring check with an error message if it encountered the new format.
This was fine until some annoying Arch Trusted User generated a key
using the new format!

Implement the new format.  This also required parsing the hashed sub
packets. requiring the parsing code to moved to its own function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-11 15:58:05 +10:00
Allan McRae
653d2dc86d Fix moving source files into debug packages
Commit 8bec63bf92 attempted to switch to
using -fdebug-prefix-map to set file locations in debug packages.  It
make a few mistakes...

1) Adding debug C{,XX}FLAGS only worked if DBGSRCDIR was defined in
makepkg.conf.  Fix this by falling back to the default value.

2) Using -fdebug-prefix-map altered a lot of assumptions about file
locations when copying source files into debug packages. This resulted
in lots of messages of failed cp in packaging output.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-10 10:53:15 +10:00
Andrew Gregory
4d80d87f90 add missing newline to debug message
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-10 10:53:15 +10:00
Andrew Gregory
2bda849bf9 detect pkghash allocation failure
If rehash ever failed with a full hash it would return the old hash
that is already full.  get_hash_position would then loop forever
because it would never find an empty bucket.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-10 10:52:26 +10:00
Allan McRae
59b6fdeee1 Do not continuously try to open an invalid database
If you manage to download a bad database (e.g. an html file when
behind a proxy or with a badly configured webserver), pacman makes
sure you know about it.  Here is some example output:

error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format
error: could not open file /var/lib/pacman/sync/extra.db: Unrecognized archive format

I don't know how many times that gets printed because it goes beyond my scrollback
buffer.

Flag a database that we can "open" and "fstat" but not read from as invalid to avoid
this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-10 09:53:40 +10:00
Allan McRae
24ab8717d4 Handle empty string passed to query_owner
Passing an empty string to pacman -Qo results in:
error: No package owns <first directory in $PATH>

Catch empty strings and report an error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-09 20:48:35 +10:00
Andrew Gregory
3a9a510ca8 do not rely on name hashes for matching
6cfc4757b9 was overzealous in attempting
to optimize away a call to strcmp based on a comparison of hashes.  The
call can be skipped if the hashes are different, but different strings
could have the same hash.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 13:35:48 +10:00
Eli Schwartz
8bf972824a vercmp: fix incorrect info in the manpage
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 13:23:54 +10:00
Eli Schwartz
eba623b443 vercmp: remove --usage variant of the -help option
I think two ways to ask for this are enough for everyone, and we have
never documented this anyway.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 13:23:05 +10:00
Andrew Gregory
59bb21fce3 dload: ensure callback is always initialized once
Frontends rely on an initialization call for setup between downloads.
Checking for intialization after checking for a completed download can
skip initialization in cases where files are small enough to be
downloaded all at once (FS#56408).  Relying on previous download size
can result in multiple initializations if there are multiple
non-transfer events prior to the download starting (fS#56468).

Introduce a new cb_initialized variable to the payload struct and use it
to ensure that the callback is initialized exactly once prior to any
actual events.

Fixes FS#56408, FS#56468

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 12:59:32 +10:00
Andrew Gregory
d0981d4c5b avoid printing NULL string
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 12:56:54 +10:00
Eli Schwartz
3d4e95e526 libmakepkg/integrity: fix git signatures not seen with multiple files
In eaa82b4d07 source_has_signature() was
modified to check if git repositories are marked as signed. However, due
to a typo the unused variable $netfile was checked. This worked as long
as the last source element was marked as signed, due to $netfile being
mistakenly set as a global in check_vcs_software(), but usually failed
with multiple sources.

Break this more consistently by properly declaring $netfile as a local
variable in check_vcs_software() which it should be regardless. Fix it
again by completely moving over to $netfile in source_has_signature()
as netfile is more descriptive of the current state.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 12:40:07 +10:00
Eli Schwartz
135f4397c2 libmakepkg/integrity: fix regression that broke invalid file sigs
In 42e7020281 creating the gpg statusfile
for a source file was split into a separate function, which used the
return code to indicate unsigned files and proto-specific errors.
However, the fallback return code was set by the final gpg invocation,
which would be 1 if the signature was somehow broken (for example, the
key was not available in the gpg keyring). As a result makepkg thought
that file did not have a signature and skipped over it rather than
erroring out.

Fix this by explicitly setting the return code for all
verify_*_signature() functions.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-06 12:38:05 +10:00
Eli Schwartz
8bec63bf92 makepkg: tell the compiler to record debugging info for debug packages
In commit 8b0d59b83a support was added for
storing the source files of binaries in debug packages. This made use of
the debugedit program which is part of the RPM package manager, which is
not very standalone.

The same effect can be achieved using -fdebug-prefix-map, an option
accepted by both the gcc and clang compilers which modifies how the
compiler itself stores the references to the source files rather than
requiring us to later edit the produced binaries. This also removes the
dependency on external programs like debugedit.

As a result of this change, source files will only be effectively added
for programs which actually use the exported CFLAGS. This is a reasonable
tradeoff as we expect our CFLAGS to be used rather than ignored. Upstream
software which do not produce useful debug packages are expected to fix
their build systems to respect the environment CFLAGS.

As a result of this change, the routine for extracting source filenames
from binaries had to be modified to derive the source file from the
final debug location, rather than the other way around.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 15:54:16 +10:00
Eli Schwartz
259d521e37 makepkg: Add a config option to specify the location of debug sources
In commit 8b0d59b83a support was added for
storing the source files of binaries in debug packages. Allow the user
to specify where those source files should be stored via makepkg.conf

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 15:52:39 +10:00
Eli Schwartz
1825bd6716 makepkg: refactor archive compression for reusability
This allows for more easily extending the list of allowed compression
methods, as it has to be modified in only one place.

Also allow the user to specify their own preferred command + options for
source packages in addition to compiled packages. Currently,
makepkg.conf(5) erroneously claims this is already possible.
2017-12-07 15:46:04 +10:00
Eli Schwartz
2fb8081d05 libmakepkg: fix .gitignore to simply ignore all generated .sh files
Prior to commit aca153bfa6 some .sh files
were not generated and simply included directly, and it was necessary to
explicitly iterate all ignored files to prevent git from ignoring the
directly-included files. However, now all .sh files are in fact
generated so it makes no sense to list each one separately in the
.gitignore file.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 15:37:20 +10:00
Eli Schwartz
c50ce453dc makepkg: reorganize the restoration of settings by precedence
The extra variables on the commandline were inconsistently applied. They
should override anything else, instead, most were overridden by
environment variables with the exception of BUILDDIR (and this was not
sanity-checked to see if it had write permissions).

e.g. given the commandline:
`PKGDEST="$(pwd)"` BUILDDIR="$(pwd)" makepkg PKGDEST=/doesnt/exist BUILDDIR=/doesnt/exist`

We would incorrectly use the current working directory for PKGDEST.
Meanwhile, we checked the wrong directory for BUILDDIR, and later
errored when we tried to create $srcdir inside the non-writable
directory "/doesnt/exist".

In order to fix this, use the preferred bash builtin for saving variable
definitions, similar to how we restore traps etc. rather than tediously
redefining each one by hand, and restore this immediately after
makepkg.conf is sourced. Finally, the `make`-style commandline overrides
are applied.

Also canonicalize_path is applied only on the final paths we try to use.
While it is unlikely the value in makepkg.conf will be a relative path,
since we now properly respect commandline overrides, they should be
canonicalized as well.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 15:06:10 +10:00
Nils Freydank
ad0517d371 Fix CVE-2016-5434 (DoS/loop and out of boundary read)
This is a rewrite of Tobias Stoeckmann’s patch from June 2016[1] using
functions instead of macros. (Thanks to Tobias for explanations of his patch.)
A short question on Freenode IRC showed that macros are generally discouraged
and functions should be used.

The patch introduces a static size_t length_check() in libalpm/signing.c.

[1] Original patch:
https://lists.archlinux.org/pipermail/pacman-dev/2016-June/021148.html
CVE request (and assignment):
http://seclists.org/oss-sec/2016/q2/526

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 14:59:26 +10:00
Eli Schwartz
44f3a15798 makepkg.conf: correct the documentation on the default options
The documentation for OPTIONS and BUILDENV listed some incorrect
defaults for undefined options. The defaults are implementation-defined
in the source code for makepkg itself (e.g. it depends whether we use
`check_option "opt" "y"` or `check_option "opt" "n"`) but were
erroneously declared to be "whatever we *define* in the default
makepkg.conf".

Fixes FS#55754

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 14:58:53 +10:00
Ivy Foster
ab2be5794d makepkg: implement error codes
For your convenience, makepkg now has 16 distinct ways to fail.
Also closes FS#54204.

Signed-off-by: Ivy Foster <iff@escondida.tk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 14:55:35 +10:00
Ivy Foster
67ce123457 makepkg: clarify error when user passes -F
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 14:29:03 +10:00
Allan McRae
e4f13e62cf libmakepkg: only output package file names when checking for build references
The leading directory is distraction from identifying the files containing
build references.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-10-17 20:31:06 +10:00
Alastair Hughes
62bfba53db Make the flags used for sed -i configurable
Not all sed implementations on linux accept the --follow-symlinks
argument, so let the user configure the arguments passed to sed if
required.

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>

[Allan: fixed configure summary output]
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-09-14 13:03:44 +10:00
Allan McRae
2ddbc6964b libmakepkg: grammar fix
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-09-14 09:45:53 +10:00
Eli Schwartz
4dae3fde17 makepkg: respect $SOURCE_DATE_EPOCH to activate reproducible builds
If SOURCE_DATE_EPOCH is set, `touch` all source files between the (optional)
prepare() and build() functions to unify the modification times. This works
around build systems and compilers that embed the file modification times
into the file contents of release artifacts.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-09-13 14:21:34 +10:00
Eli Schwartz
39319c1860 libmakepkg: check for invalid tags in git
As per https://lists.archlinux.org/pipermail/arch-general/2017-July/043876.html
git doesn't check that the tag name matches what an annotated tag object
*thinks* it should be called. This is a bit of a theoretical attack and
some would argue that we should always use commits since upstream can
legitimately change a tag, but nevertheless this can result in a
downgrade attack if the git download transport was manipulated or the
upstream repository hacked.

So, check the tag blob to make sure the tag actually matches the name we
used for `git checkout`.

This really should be fixed in git itself, rather than forcing all
downstream users of git verify-tag to implement their own checks, but
the git developers disagree, see the discussion surrounding
https://public-inbox.org/git/xmqqk2hzldx8.fsf@gitster.mtv.corp.google.com/

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-09-13 14:20:35 +10:00
Michael Straube
64b7edd2fe Fix brace coding style issues
- Add missing braces to one-line if blocks
- Move opening brace to line end

Signed-off-by: Michael Straube <straubem@gmx.de>
2017-07-28 12:34:03 +10:00
Michael Straube
064e7280cb Fix coding style issue in pacman/util.c
Add missing braces to some one-line if blocks.

Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-28 12:33:24 +10:00
Michael Straube
b4a197a615 test/pacman: fix spelling of distribution name and another typo
Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-11 11:37:23 +10:00
Andrew Gregory
2b1b7b7075 clarify broken dependency error messages
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-11 11:36:16 +10:00
Andrew Gregory
fa8419a0b5 provide command for downloading missing databases
This is primarily to help users who are not aware that -F operations use
a separate set of databases that need to be separately downloaded.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-11 11:35:57 +10:00
Andrew Gregory
bcc9c417ae alpm_list: abort on memory allocation failure
This makes it possible to detect a failure in several alpm_list
functions.  Previously these functions would continue after a failure,
returning partial results and potentially leaking memory.
Unfortunately, NULL is a valid return value for the affected functions
if the input list is empty, so they still do not have a dedicated error
value.  Callers can at least detect an error by checking if the input
list was empty.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 14:48:03 +10:00
Levente Polyak
c44c649a52 makepkg: add more information to .BUILDINFO
The .BUILDINFO file should retain all the information needed to reproducibly
build a package.  Add some extra information to the file and also provide a
version number to keep track of future changes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 13:57:27 +10:00
Allan McRae
9ab44178f4 makepkg: set default value for PACKAGER
In write_pkginfo, we checked if $PACKAGER was undefined, and gave a default
value if not.  Just do this upfront to simplify this function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 13:34:31 +10:00
Allan McRae
1c8b3f2562 makepkg: always write pkgbase
There is little savings in only writing pkgbase when different to pkgname, and
it makes determining the pkgbase by parsing .PKGINFO slightly easier. Lets just
write it...

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 13:27:22 +10:00
Allan McRae
d170c4580c makepkg: do not write basever
Since 8a02abcf19, this attribute will never exist.  Remove check to write it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 13:26:04 +10:00
Eli Schwartz
b14ff66038 libmakepkg: Fix improperly spelled local variable declaration
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 13:21:42 +10:00
Eli Schwartz
d4193d43cf libmakepkg/integrity: Fix error message not sent to stderr
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 12:55:45 +10:00
Eli Schwartz
9c604af0a0 libmakepkg: fix unsanitized source filenames
There were a couple places where filenames beginning with "-" were not
properly guarded against by passing them after "--". Some PKGBUILD
authors are crazy, but we still take those into account.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 12:55:25 +10:00
Christian Hesse
3c433abb54 fix typo in libalpm comment
contatenate -> concatenate

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-07-06 12:54:34 +10:00
Allan McRae
d30878763c makepkg: introduce SOURCE_DATE_EPOCH
This patch introduces the SOURCE_DATE_EPOCH environmental variable.  All files
in a package are adjusted to have their modification dates set to the value
of SOURCE_DATE_EPOCH, which defaults to "date +%s".

Setting this variable allows a package that is built twice in the same
environment to be (potentially) reproducible in that the checksum of the
generated package file will be the same.

Also adjust the compression of the mtree file to avoid gzip embedding a
timestamp.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2017-05-16 12:54:01 +10:00
Allan McRae
5f38128686 makepkg: remove build date from .PKGINFO header
This information is duplicated (in less friendly format) in the "builddate"
entry and removing it improves reproducible packaging.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2017-05-16 12:47:01 +10:00
Andrew Gregory
5a1bf3d803 remove unused byte from user agent buffer
snprintf prints at most n bytes including the terminating '\0'.  The
extra reserved byte was never being used.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16 12:44:08 +10:00
Andrew Gregory
63087c31b5 check for overflow when setting HTTP_USER_AGENT
gcc7 issues a warning about a potential overflow if left unchecked.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16 12:43:17 +10:00
Andrew Gregory
a2b776f6c9 query_fileowner: avoid buffer overflow
Copying a string into a buffer that  has just been determined to not be
able to hold it is obviously incorrect.  The actual error handling
appears to have been unintentionally removed in
47762ab687.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16 12:39:39 +10:00
Andrew Gregory
1bc79cb9a5 alpm_unlock: check handle before dereferencing
Prevents SIGSEGV if we catch SIGINT or SIGHUP before initializing alpm.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16 12:38:58 +10:00
Michael Straube
f4e2009e9b pacman.8: fix typo in query options
Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-08 18:53:55 +10:00
Andrew Gregory
bf468c0956 free memory for --overwrite lists
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-08 18:53:55 +10:00
Andrew Gregory
12f74fd895 add send_fakem to valgrind.supp
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-08 18:53:54 +10:00
Andrew Gregory
bf23f85d4a be_sync: error out if a db cannot be parsed
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-08 18:53:54 +10:00
Allan McRae
c6b04c0465 makepkg: create signature files outside of fakeroot
With recent version of gpg, signing within fakeroot works on the first
invocation, but fails on later runs.  Sign all packages outside of fakeroot
to avoid this issue.

Fixes FS#49946.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-08 18:53:53 +10:00
Allan McRae
c0a5884b18 makepkg: do not create symlinks in build directory
Setting PKGDEST and friends enables us to keep all built packages in a single
location.  Symlinking these files into the build directory creates unnecessary
clutter and requires clean-up in multiple places when removing old version.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-17 18:33:52 +10:00
Michael Straube
4f2fea240d makepkg: clean up pkgver and prepare log files
Delete log files for the pkgver and prepare functions if -c,--clean is
passed.

Fixes FS#51039 and FS#51075

Includes patch submitted by Christian Braun.

Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-17 10:50:41 +10:00
Andrew Gregory
3c013f68ac run_chroot: label pipe endpoints for readability
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 19:41:35 -04:00
Andrew Gregory
fae33a1faf add --sysroot option
--root is not sufficient to properly operate on a mounted guest system.
Using --root still uses the host system's configuration and there is no
way to correctly use the guest configuration without manually modifying
any Include directives.  --sysroot provides an easier way to operate on
a guest system by chrooting immediately after option parsing before
configuration parsing or performing any operations.  It is currently
limited to the root user, but that's enough for restoring a guest system
to a working state, which is the primary intended use case.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 19:41:35 -04:00
Andrew Gregory
6a4c6a02de use sockets for scriptlet/hook communication
If a scriptlet/hook dies at the wrong moment it can trigger SIGPIPE,
terminating the process.  For pipes, there is no way to prevent SIGPIPE
other than ignoring it process-wide.  This can have unintended
consequences in a multi-threaded process.  Using send(2) with sockets,
however, allows ignoring SIGPIPE on a per-call basis, leaving other
threads able to make use of SIGPIPE.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 19:41:35 -04:00
Andrew Gregory
6d1dcf7937 conflict: include owner for filesystem conflicts
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 19:41:35 -04:00
Andrew Gregory
16b91f798f unlink_file: strip trailing slashes
If the user replaces a directory with a symlink, libalpm would get
confused because the trailing slash causes system calls to resolve the
symlink.  This leads to errors and a misleading message during upgrades.
Even though libalpm does not support this, it should not be giving
misleading errors.

Also adds an overflow check.

Fixes FS#51377

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 19:41:35 -04:00
Andrew Gregory
f9de3b22ad sortbydeps: rename vptr -> i
vptr is a simple list iterator, which are typically named i.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 08:29:55 -04:00
Andrew Gregory
a8670304c9 sortbydeps: rename found -> switched_to_child
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 08:29:55 -04:00
Andrew Gregory
098e114f58 sortbydeps: factor out dep cycle warning
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 08:29:55 -04:00
Andrew Gregory
1550938ce1 graph.h: rename childptr -> iterator
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 08:29:54 -04:00
Andrew Gregory
9c763a0d1b graph.h: replace hardcoded values with an enum
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-16 08:26:13 -04:00
Andrew Gregory
13ec13c85e deprecate --force in favor of --overwrite
--force is widely misunderstood and the same effect can now be achieved
with --overwrite, which is better named and can be used more safely.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-12 11:47:44 +10:00
Andrew Gregory
04d211effa add --overwrite option to ignore file conflicts
Allows for safer, more fine-grained control for overwriting files than
--force's all-or-nothing approach.

Implements FS#31549.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-12 11:47:33 +10:00
Armin K
86f5c74694 libalpm: Use archive_read_extract2
archive_read_extract() forces resolution of uid/gid to names
when extracting the tarball. This can lead to wrong file
ownership when using pacman with -r option and when uid/gid
differ in the host and in the chroot.

archive_read_extract2() uses uid's and gid's only. See also:

https://lists.archlinux.org/pipermail/pacman-dev/2017-March/021912.html

Signed-off-by: Armin K <krejzi@email.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-12 11:44:56 +10:00
Drew DeVault
1af766987f Replace @SIZECMD@ with POSIX-compatible command
Now uses wc -c $file | cut -d' ' -f1, which works using only POSIX
commands and removes the need for any platform-specific usages.

Signed-off-by: Drew DeVault <sir@cmpwn.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04 12:21:20 +10:00
Andrew Gregory
d9908fc1f2 parse stdin as newline-separated
Newline-separated input is more reliable because most of the arguments
we accept over stdin can validly contain spaces but not newlines.

Resolves FS#52992

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04 12:04:16 +10:00
Andrew Gregory
a138db3c07 add alpm_list_append_strdup
Makes error detection and handling easier for a common operation.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04 12:03:22 +10:00
Andrew Gregory
a202959a19 pactest: add --review option
Opens the test file(s), test output, and any log files in the test
environment in an editor after the tests run for review.  Simplifies
debugging tests by avoiding the need to use --keep-root and manually
opening the relevant files.  The editor used can be set with --editor or
$EDITOR, falling back to vim.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04 11:55:31 +10:00
Michael Straube
5678298f7d Ignore comments in INSTALL files (FS#51916)
If a comment in an INSTALL file contains the name of a valid
INSTALL file function but the function itself is not present,
pacman tries to execute that function. That leads to an error.

Ignore comments in the grep function in libalpm/trans.c to
avoid such errors.

Signed-off-by: Michael Straube <straubem@gmx.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04 11:54:36 +10:00
Christian Hesse
c635f185ba Introduce a 'disable-download-timeout' option
Add command line option ('--disable-download-timeout') and config file
option ('DisableDownloadTimeout') to disable defaults for low speed
limit and timeout on downloads. Use this if you have issues downloading
files with proxy and/or security gateway.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-13 12:52:50 +10:00
Allan McRae
64bd242863 alpm_fetch_pkgurl: fix memory leak
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 15:32:14 +10:00
Allan McRae
008fe7b24f Fix memory leak in alpm_pkg_checkmd5sum
Also remove redundant additional return path.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 15:24:23 +10:00
Rikard Falkeborn
9ad7cda9d8 Suppress valgrind error in fakechroot
This was spotted on Arch Linux, most likely it was introduced
when fakechroot was updated to 2.19-1.

Valgrind suggests to add the following suppression, which can be
tweaked to fit an already existing one.

  {
     <insert_a_suppression_name_here>
     Memcheck:Leak
     match-leak-kinds: reachable
     fun:calloc
     obj:/usr/lib/libdl-2.24.so
     fun:dlsym
     obj:/usr/lib/libfakeroot/fakechroot/libfakechroot.so
     fun:bindtextdomain
     obj:/usr/lib/libgpg-error.so.0.20.0
     fun:call_init.part.0
     fun:_dl_init
     obj:/usr/lib/ld-2.24.so
     obj:*
     obj:*
     obj:*
  }

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 14:49:35 +10:00
Allan McRae
8b0d59b83a Provide source files for useful debug packages
Debug packages are fairly useless currently because the soucre files needed
for stepping through code etc are not packaged with them. This patch adds the
needed source files to the debug package and adjusts the debug info to look at
the /usr/src/debug/ directory for them rather than the build location.  This
requires using the "debugedit" program which is provided as part of the RPM
sources.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 14:02:28 +10:00
Eli Schwartz
37a89e2fac Document the new query parameter for VCS sources
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Eli Schwartz
eaa82b4d07 makepkg: Verify git signatures
A git repository is marked as signed if it contains the query "signed"
as defined by https://tools.ietf.org/html/rfc3986

Adds two utility functions in util/source.sh.in to extract fragments and
queries, and modifies source/git.sh.in to use them.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Eli Schwartz
42e7020281 libmakepkg/integrity: Verify file signatures in a separate function
This makes it easier to add signature verification for new protos.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Mark Weiman
0994893b0e Add alpm_pkg_get_makedepends and alpm_pkg_get_checkdepends
makepkg adds makedepends and checkdepends to a package's .PKGINFO file.
Add functions that allow use of these from libalpm.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
aa44824788 filelist_sort: check if filelist is presorted
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
6444ccbaf0 add _alpm_filelist_sort
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
585bd89803 repo-add: sort file list entries
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
01a6502169 makepkg: sort package contents
By passing a NUL-separated filelist, this also fixes a bug where files
that look like bsdtar options in the package root could break the
package ("-C" was particularly troublesome because bsdtar interprets it
as an option anywhere in the file list, even following "--").

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
9c3bf2988f find_fileconflicts: rename tmpfiles -> newfiles
The files belong to the new version of a package being installed, they
are not temporary in any way.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
b6753eeb7e conflict: skip dir children when replacing a file
When replacing a file with a directory, any files under that directory
do not need to be checked for conflicts.  This prevents possible
false-positive conflicts where the file being replaced is a symlink.

We were already skipping the directory children when the file was owned
by the previous version of a package being upgraded.  This extends that
to other packages being removed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Andrew Gregory
8a19c4a782 ini: only recognize comments at beginning of line
Allows the hash sign to be used in values in config files and hooks.

Fixes #48702

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:15 +10:00
Dave Reisner
67602c4cf7 dload: s/CURLOPT_WRITEHEADER/CURLOPT_HEADERDATA/
The former is really old, and should be avoided.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Dave Reisner
d8367162e8 pacman: ensure linkage against libarchive
Fixes build on ubuntu/debian platforms.

Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Dave Reisner
d0a5766e24 configure.ac: Use POSIX compatible equality checks
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Andrew Gregory
36eb35cacd makepkg: warn about dotfiles in package root
libalpm reserves paths starting with '.' for its own use and will not
extract any other than those it recognizes.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Andrew Gregory
2c4511bdbe extract db files with dbonly
Some database files (install, mtree, and changelog) are extracted
directly from the package, but DBONLY was skipping extraction
altogether, causing those files to be missing after the transaction.

Fixes #52052

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Allan McRae
1a2d5bee3b Update copyright years
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Allan McRae
3a4623b10a Fix documentation of -Dq
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Steef Hegeman
5dfa3c8f6a makepkg: Disallow forward slashes in pkgver
scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in now raises an error when
pkgver contains forward slashes.

pkgver containing a forward slash results in a package filename
containing a forward slash, which isn't a valid filename.

Signed-off-by: Steef Hegeman <steefhegeman@hotmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04 13:59:14 +10:00
Allan McRae
9a4d616220 Build a single debug package for all packages from a PKGBUILD
We want to provide source files with debug symbol packages to allow easy
stepping through the program.  This becomes difficult with split packages due
to the binaries in many of these sharing source files across packages.

There are (at least) two solutions to this problem. #1: ensure common source
files are located in the debug package for the package lowest in the dependency
chain and add dependencies to the debug packages so all require source files
are present, or #2: create one debug package for all split packages in a
PKGBUILD.  The second is a more robust approach despite potentially creating
very large debug packages.

This patch creates a single $pkgbase-debug package and adds provides such that
installing $pkgname-debug will always work.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:23:44 +10:00
Andrew Gregory
c40ee73bc4 be_local: remove unused error return
LAZY_LOAD has completely ignored the errret value since commit
307a6de17a in 2011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:09 +10:00
Christian Hesse
fc756c3c70 add generated scripts to gitignore
These files are generated at build time. Ignore in git.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:09 +10:00
Alastair Hughes
36f456ccae Make DUFLAGS be overrideable during configure
Not all du implementations on linux accept --apparent-size, so let the
user configure the arguments passed to du if required.

This fixes FS#47943.

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Allan McRae
97459e9eb7 Suppress more output messages on successful -D options with -q
Suppress output on successful use of --asdeps and --asexplicit.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Patrick Eigensatz
46324d9b26 Give a "success!" message on database check
'pacman -Dk' prints a "success!" message if there were no errors.
It is possible to suppress the output using the '-q / --quiet' flag.

This implements the feature discussed at https://bugs.archlinux.org/task/50087

Signed-off-by: Patrick Eigensatz <patrick.eigensatz@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Martin Kühne
e83e868a77 Parametrise the different ways in which the payload is reset
In FS#43434, Downloads which fail and are restarted on a different server
will resume and may display a negative download speed. The payload's progress
in libalpm was not properly reset which ultimately caused terminal noise
because the line width calculation assumes positive download speeds.

This patch fixes the incomplete reset of the payload by mimicing what
be_sync.c:alpm_db_update() does over in sync.c:download_single_file().
The new dload.c:_alpm_dload_payload_reset_for_retry() extends beyond the
current behavior by updating initial_size and prevprogress for this case.
This makes pacman reset the progress properly in the next invocation of the
callback and display positive download speeds.

Fixes FS#43434.

Signed-off-by: Martin Kühne <mysatyre@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Christian Hesse
c3b954e7b9 libalpm/signing: support EDDSA from gpgme 1.7.0
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Andrew Gregory
e3e9cc14a5 makepkg: reject packages with newlines in paths
libalpm's local database format does not support paths with newlines.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Andrew Gregory
5dd764eb47 makepkg: abort on lint_package errors
Allows lint_package to prevent makepkg from creating an invalid package.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Andrew Gregory
46101bea1c makepkg: reject package data with newlines
The PKGINFO format cannot handle values that contain newlines.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Andrew Gregory
d3dc200263 makepkg: fix find_lib{depends, provides} results
Neither function was checking for the existence of actual results before
calling printf, resulting in them returning a list with a single empty
value if there were no depends/provides.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Dave Reisner
7114ca6208 dload: use curl's keepalive mechanism
This does exactly the same thing as it code it replaces, but punt to
curl to do it for brevity. Requires curl 7.25.0, which we already cover.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Dave Reisner
263e65dbb3 makepkg: unset potentially architecture-specific vars
I'm not convinced this is a worthwhile goal, but let's follow suit.
Since we can't know the names of all the vars that might exist, unset
them by pattern.
2016-12-05 15:20:08 +10:00
Dave Reisner
0b30edacd4 makepkg: fix quoting in calls to dependency checking 2016-12-05 15:20:08 +10:00
Dave Reisner
90f1dd1657 makepkg: fix quoting in calls to check_deps
The inside needs quoting, and this is separate from the declartion,
which does not (in these cases).
2016-12-05 15:20:08 +10:00
Dave Reisner
9ce2c9b187 makepkg: make run_function_safe more robust
Use shopt to set/reset errexit and errtrace, which lets us:

1) be more vigilant, resetting anything the user might do to us in
PKGBUILD functions.
2) use human-readable words (errexit vs. -e)

On top of this, introduce a new save/restore for the shell's other
shopts. A user should not have any expectations that what happens in
one function is available in another function, if it isn't explicitly
defined in the PKGBUILD. While this change does not make that
assertion, it gets us closer.

We also replace a variable which comes from out of nowhere (pkgfunc)
with the positional parameter containing the same value. Quoting is
adjusted to make the expansion happen at the time the trap is set,
rather than later on.
2016-12-05 15:20:08 +10:00
Dave Reisner
cef0d726b4 makepkg: remove vestiges of global errexit
These 'set +E' diversions haven't been needed since global errexit was
disabled in dca10b062f (January 2012).
2016-12-05 15:20:08 +10:00
Dave Reisner
e7fc560866 makepkg.conf: add -g to default curl options
This disables globbing, which should never be used in source URL
specifications as it would lead to mismatches in the checksum mapping
and un-checked sources.
2016-12-05 15:20:08 +10:00
Johannes Löthberg
37b73fe4fb Make sure all proper scripts are installed instead of the wrappers
After 1f8f0bd9ac all scripts that were
changed to using the wrapper for in-tree use have the wrappers installed
to the system instead of the actual script, so change the install
command to support all wrapped scripts instead of just makepkg.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Allan McRae
0dbc55a357 Remove pacsort
Moved to the pacman-contrib project

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05 15:20:08 +10:00
Allan McRae
5fbb361261 Revert "[RFC] Provide source files for useful debug packages"
This reverts commit a79c0038ae.

I merged the wrong branch into master...
2016-12-05 15:12:03 +10:00
Allan McRae
a79c0038ae [RFC] Provide source files for useful debug packages
Debug packages are fairly useless currently because the soucre files
needed for stepping through code etc are not packaged with them. This
patch adds the needed source files to the debug package and adjusts
the debug info to look at the /usr/src/debug/ directory for them rather
than the build location.  This requires using the "debugedit" program
which is provided as part of the RPM sources.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-11-02 15:03:57 +10: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
Olivier Brunel
56ae960376 configure.ac: Fix handling --with-libcurl
It was reported being --with-libcurl in the help (and the check for libcurl
being installed used $with_libcurl accordingly), but the option handling was set
using $with_curl and, therefore, expected option --with-curl.

In the end, --with-libcurl wasn't recognized, and --with-curl had no effect.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Andrew Gregory
be1ffedaf6 hook.c: replace fstatat with stat
macOS < 10.10 do not provide fstatat.  We were constructing the full
path to the hook file for all other operations anyway, so there was no
real benefit to using fstatat.

Fixes FS#49771

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Andrew Gregory
c981f5ad76 hook.c: replace readdir_r with readdir
glibc 2.24 deprecates readdir_r.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Tobias Stoeckmann
af83a58574 Handle all POSIX compliant systems in mbscasecmp.
The width of wchar_t is allowed to be of the same width as long,
according to standards. The return type of mbscasecmp is int though.

On amd64 with a 32 bit int, this means that mbscasecmp can return
zero (indicating that strings are equal) even though the input
strings differ.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Tobias Stoeckmann
5fcd60e264 Reject files larger than 16384 bytes in read_sigfile.
If signature files are larger than SIZE_MAX, not enough memory could
be allocated for this file. The script repo-add rejects files which
are larger than 16384 bytes, therefore handle these as errors here,
too.

While at it, I also rearranged the code to avoid a quite harmless
TOCTOU race condition between stat() and fopen().

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Tobias Stoeckmann
681509fd44 Release resources on error paths.
Some resources (memory or file descriptors) are not released on all
error paths.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae
1291c04961 pacman-key: reject armored signatures
pacman expects an unarmored signature.  makepkg forces the generation of
unarmored signatures, and repo-add will reject any armored signature.
For consistency pacman-key should also reject armored signatures.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Tobias Stoeckmann
80d97fcf75 Always use proper error code in alpm_initialize.
In out of memory conditions, an undefined error value is written
into *err, because myerr is never explicitly set in these cases.

I have also converted a calloc into a MALLOC call, because the memory
will be properly filled by the snprintf call right after it.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae
0f0b192d8a Remove obsolete TODO
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Andrew Gregory
6ac2ee21b3 recursedeps: include cyclic dependencies
Cyclic dependencies (A depends on B, B depends on A) were not selected
because neither package could be removed individually, so
can_remove_package would always return false for both.  By preselecting
all dependencies then filtering back out any dependencies still required
by any packages that will not be uninstalled, groups of unneeded cyclic
dependencies can be found.

Fixes FS#41031

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae
7a9d8b7001 Turn off colours once finished using them
The colour of the package version could leak onto the next line in both
-Qo and -Fo.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Christian Hesse
839417e8c6 pacman.8: add link to alpm-hooks(5) in see also
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Christian Hesse
f018317f48 libalpm.3: add link to alpm-hooks(5) in see also
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Ashley Whetter
4f114f3817 libmakepkg: extract functions for integrity checking
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Leonid Isaev
892a1076c0 Use a more generic regexp when parsing output of gpg(1) in signature verification.
The current way of extracting key trust from output of gpg --verify is not very
robust against changes in the format of said output. As a result, pacman-key
can return an error even if the signature is actuall good.

This change relaxes the regexp when parsing output of gpg.

Signed-off-by: Leonid Isaev <leonid.isaev@jila.colorado.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Alastair Hughes
87082e3f44 makepkg: ignore the architecture for --printsrcinfo
Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:55 +10:00
Allan McRae
7bebe4deff Report local file URL for -Sp operations if package is in cache
When using "pacman -Sp" operation to get URLs of packages to download, it is
useful to know which packages are already in the file cache and do not need
downloaded.  Print packages in the cache with a file:// prefix.

e.g
$ pacman -Sp glibc
file:///var/cache/pacman/glibc-2.23-1-x86_64.pkg.tar.xz

Also use package locations in case statements rather than opersations. This
allows the ALPM_PKG_SYNCDB to fall thorough to just printing the package name
for weird serverless repo setups.

Fixes FS#15868

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:55 +10:00
Allan McRae
02a0bf550a makepkg: move build enviroment set-up to function
This is a requirement to split the preparation of the build environment
into libmakepkg, which will allow dropping in extensions (e.g. to allow PGO).

After this patch, disabling buildflags or makeflags and enabling debug
CFLAGS will only effect the build(), check() and package() functions.  The
relevant variables are no longer exported for the prepare() function.  This
should have zero impact for the prepare() function of a properly written
PKGBUILD, as no building/linking is done there...

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:07 +10:00
Allan McRae
3729ef7a9a Avoid logical OR duplication warning from gcc-6
The value EAGAIN is allowed by POSIX to be the same as EWOULDBLOCK, but this is
not guaranteed. Thus on some systems (e.g. glibc Linux), we get a warning that
the logical OR is being performed on two expressions of the same type. We can
not get rid of this test in case any system defines these as unique values.

Suggested-by: Dave Reisner
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Ashley Whetter
b012da645e Add -m/--nocolor options to updpkgsums
Fixes FS#43346

Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Ashley Whetter
6c96ad36e0 pacsort help clearly states that files contain inputs to be sorted
Fixes FS#44121

Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
5b9bc6024c Prevent wrapping of enum items
GCC-6 points out that the value we use for the sentinal in enums is actually
too large for the integer type. Reduce the bitshift by one to fix this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Eric Engestrom
2694d17ad9 fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Xavion
0088a7ab1c Add colour to the output of the "-{F, Q}o" operations.
Matching output for -s operations, the repository is coloured 'magenta', the
package name is 'bold', and the version is outputted in 'green'.

Signed-off-by: Xavion <Xavion (dot) 0 (at) Gmail (dot) com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Xavion
7e7c64f513 Add colour to group selection dialog
Colour the group name in 'blue' and the repository names in 'magenta'.

Signed-off-by: Xavion <Xavion (dot) 0 (at) Gmail (dot) com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
7d1ea0b814 Handle provides with -Q
It is useful to be able to use "pacman -Qi" on any dependency, even if that
dependency is a provide.  For example, on Arch Linux systems, "sh" is provided
by the "bash" package, and many packages depend on "sh". Querying the
package that provides the "sh" dependency currently requires first searching
for "sh".

This patch allows the use of "pacman -Qi" on a provide.

Fixes FS#20650.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
502e0d1db0 pacman_query: move error messages into relevant if statements
This ensures any additions to these test do not have to rely on the correct
error condition being set by libalpm.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Christian Hesse
a194fb434e pacman.8: add actual operation to captions for easy searching
I caught myself searching for operations when in need for an option.
However this made me find transaction and update options only. So add
the actual operations to captions for easy searching.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
ee960048b2 Remove notification of system upgrade when only printing URLs
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
3ed57be450 Print replacements when using -Sup
When printing a list of URLs of packages to be updated, pacman was ignoring any
replacements that would be made in the update process.

Fixes FS#35812

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Alastair Hughes
4960be7764 Changed documentation to use 'the default' instead of 'a typical default'
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 17:17:17 +10:00
Allan McRae
5901038610 PKGBUILD.5: document that the pkgver() function runs after prepare()
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 17:17:17 +10:00
Allan McRae
2ee1706a72 Do not add root prefix twice when checking database files
When checking .INSTALL and .CHANGELOG files in the mtree file, we need to find
the path they are stored in the local database. This was appending the root
prefix twice as alpm_option_get_dbpath already returns the absolute path to
the database.

While fixing that issue I added checks that the paths for the database files
were not longer than PATH_MAX.

Fixes FS#48563.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 17:16:27 +10:00
Ashley Whetter
4cad2423a3 libmakepkg: extract functions for writing .SRCINFO files
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 16:26:12 +10:00
Allan McRae
baf1ff64e6 libmakepkg: ensure emptydir find command acts on individual directories
Using "-exec command {} +" systax exits on any error.  Such errors occur when
running rmdir on a non-empty directory.  Switch to "{} ;" syntax instead which
avoids exiting before the find command is completed.

Fixes FS#48515.

Note, we can not use "-empty" in the find command because it is not supported
by Busybox find, and the "--ignore-fail-on-non-empty" flag for rmdir is not
available on BSD rmdir variants.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-21 13:14:56 +10:00
Andrew Gregory
02731189f1 use multi-byte character matching for user input
Fixes FS#47992

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:52:25 +10:00
Allan McRae
1a94c00e36 Add release instructions
This serves as a release checklist for anyone making a pacman release.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:20:02 +10:00
Allan McRae
f363cf7857 repo-add: do not alter the database if only verifying signature
Fixes FS#48085.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:44 +10:00
Allan McRae
af5d69d59d Failed database downloads cause transaction to stop
Previously, we errored only if all databases failed to download. If any
database downloads fail, we are unable to determine whether an update is
still considered safe. So now if any database download fails, the transaction
is aborted (after attempting all database downloads).

Fixes FS#47599.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
3da06c3519 Use versions specified in optdepends
Checking install status and if a package is optionally required on removal
now considers the version of the optdepend.

Fixes FS#44957.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
59112e186b Consider provides when warning about optdepnd removal
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
76a7d2293c Consider provides when labelling optdepends status as pending install
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Xyne
8ff03868a3 makepkg: Turn PACMAN_OPTS into an array
Avoid potential word expansion with future inclusions

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
1a29744d0d makepkg: Remove upx and optipng support
These options were added before libmakepkg allowed passes like this to be
dropped in.  I prefer only real core packaging tasks to be included in
makepkg and additional things like this to be dropped in by a user or
distribution that wants to support them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
d4f499f563 libmakepkg: fix is_array function
This happened to work for the majority of cases because the only calling
function used a variable named "i" that was related to the variable being
passed to the function.

Fixes FS#48340.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
df5dc0c9de Update NEWS for pacman-5.0.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
f38de43eb6 Release 5.0.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 13:46:25 +10:00
Allan McRae
9375715ae4 Regenerate translations for 5.0.1 2016-02-23 13:09:39 +10:00
Allan McRae
e2ca25623b Manually fix space before ellipses in translations
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 13:05:02 +10:00
Stefan Tatschner
cd4a3d03a0 Fix inconsistent status messages
This patch fixes an inconsistency in the status messages.

    :: Proceed with installation? [Y/n]
    :: Retrieving packages ...         <--- Space before "...".
     blas-3.6.0-4-x86_64
     cblas-3.6.0-4-x86_64
     lapack-3.6.0-4-x86_64
    (3/3) checking keys in keyring
    (3/3) checking package integrity
    (3/3) loading package files
    (3/3) checking for file conflicts
    (3/3) checking available disk space
    :: Processing package changes...  <--- No space before "..."
    (1/3) upgrading blas
    (2/3) upgrading cblas
    (3/3) upgrading lapack

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:56:52 +10:00
Allan McRae
5c136d85db Pull translation updates from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:56:40 +10:00
Evangelos Foutras
c034a3322b makepkg: do not run prepare() with --noextract
This is partial revert of 8454daa7fe (makepkg: run pkgver() and
prepare() with --noextract).

Reasoning for the reversion (copied from FS#43498):

    Running prepare() when --noextract is used no longer allows running
    'makepkg -o && makepkg -e' with any PKGBUILD that applies patches in
    prepare(). [1]

    Sure there's --noprepare which restores the old behavior, but that's
    a lot of extra typing for what I believe is a much more common use
    of --noextract.

    For OP's use case of doing git bisects, you can specify the commit
    in the source array and thus skip --noextract since makepkg will
    checkout the correct commit each time.

    [1] I often extract the sources using 'makepkg -o', manually edit
    some source files, and then use 'makepkg -e' to package it (while
    possibly repeating the edit/package steps).

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:50:04 +10:00
Andrew Gregory
a724235b61 make alpm_unlock and trans_interrupt async safe
RET_ERR calls _alpm_log which includes calls that are not safe for use
in asynchronous signal handlers (see signal(7)).  Replace it in
functions called from our signal handlers with a new macro
RET_ERR_ASYNC_SAFE which is identical except that it lacks the call to
_alpm_log.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2016-02-23 12:41:36 +10:00
Andrew Gregory
1d6583a58d alpm_run_chroot: always connect parent2child pipe
Commit e374e6829c closed stdin before
running scripts/hooks.  This left the exec'd process with no file
descriptor 0.  If the process subsequently opened a file it would be
assigned fd 0, and could potentially be confused for stdin.  Connecting
and immediately closing the parent2child pipe ensures that the child has
an fd 0 and that it is empty.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:33:04 +10:00
Andrew Gregory
ce1f453b74 ensure gpgdir has a trailing slash
init_gpgme checks for various paths under gpgdir by concatenating them
directly, giving warning messages incorrectly if gpgdir does not end
with '/'.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:32:54 +10:00
Andrew Gregory
2ee7a8d89a do not rely on localdb for hook matching
Relying on localdb to determine which trigger operations should match is
completely broken for PostTransaction hooks because the localdb has
already been updated.  Store a copy of the old version of any packages
being updated to use instead.

Fixes FS#47996

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:15:43 +10:00
Dominik Fischer
f63854fa96 only include .SRCINFO comments in source tarball
This avoids introducing unnecessary changes to the time stamp into
package repositories that regularly use --printsrcinfo to update the
.SRCINFO file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-21 17:10:11 +10:00
Allan McRae
83c7dc80cb alpm-hooks.5: document hook running order
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-21 17:10:11 +10:00
Andrew Gregory
fd936c9e73 only remove pacnew file if it is new
Check if we overwrote an exiting pacnew file before unlinking it.
Otherwise, updating to a version with an unchanged file would delete
existing pacnew files.

FS#47993

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-21 17:10:11 +10:00
Allan McRae
169287e494 makepkg: remove pkg from OPT_LONG array
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Allan McRae
7624101e18 Revert "makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD"
This reverts commit f9423cfa5d.

This created issue when building packages with debug info multiple times.
It could be fixed, but it confirmed my initial opinion that keeping other
directories in $pkgdirbase was wrong. Use different BUILDDIRs if you want
to build different things from a single PKGBUILD.
2016-02-20 14:01:53 +10:00
Olivier Brunel
a1a8d067e0 Log to file when running hooks
Useful if there's some output (to know where it comes from), or in case of
failure.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Allan McRae
7cf5e1aebf doc/alpm-hooks: mention that hooks must have a ".hooks" suffix.
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Alastair Hughes
c72ca3d539 Make "makepkg -g" ignore the current architecture.
Commit 663c74150a
(makepkg: merge arch dependent variables after PKGBUILD linting) broke
"makepkg -g" on a PKGBUILD which did not include the current architecture, by
moving the lint_pkgbuild call before GENINTEG was processed.
Fix that by setting IGNOREARCH for the "-g" option.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Allan McRae
3cb1669e07 libmakepkg: increase robustness of the detection of array variables
Extract array detection into its own utility function that ensures
extglob is enabled.

Suggested-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Allan McRae
0fa695d0e3 repo-remove: fix checking for non-existent .db database
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Alastair Hughes
50a2db4834 Add the missing limits.h include to hook.c
PATH_MAX is only defined in limits.h in musl libc, so ensure that it is
included. Presumably this is also required on other platforms.

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Andrew Gregory
fb72eede20 doc/index.txt: update for pacman 5.0
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:52 +10:00
Andrew Gregory
c1bb41a037 dump_pkg_info: fix wide character title alignment
The padding added to the end of the title was based on the return value
of mbstowcs which is the number of characters.  This caused alignment
issues for languages with characters that span multiple columns.
Instead, base the padding on the number of columns needed by the
translated string as returned by wcswidth.

Fixes #47980

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:52 +10:00
Doug Newgard
252183b409 Bring makepkg zsh completions up to date
Signed-off-by: Doug Newgard <scimmia@archlinux.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:52 +10:00
Allan McRae
fea9abc8db Release 5.0.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-30 10:16:36 +10:00
Allan McRae
e910d45ac0 Update translations
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-30 10:13:55 +10:00
Daniel Wallace
9604570add Update zsh completion for pacman 5
also include updates from pacman 4.2

https://bugs.archlinux.org/task/47559

Original-patch-by: Boris Staletic <bstaletic@archlinux.net>
Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-29 09:50:11 +10:00
Allan McRae
6ea97963b3 Create makepkg-template and system hook directories upon install
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-29 09:50:11 +10:00
Allan McRae
5343ec7661 Add HookDir to example pacman.conf
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-29 09:50:11 +10:00
Allan McRae
43a09d1663 bash_completion: update pacman completion
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-29 09:50:09 +10:00
Allan McRae
b65c7afc17 bash_completion: update makepkg completion
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-27 12:40:15 +10:00
Allan McRae
c781a85387 pacman.conf.5: document system hook directory
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-27 12:40:13 +10:00
Allan McRae
a5a9080219 pacman.8: document --hookdir
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-27 12:39:22 +10:00
Allan McRae
18d00097a2 makepkg.conf.5: document option arguments in DLAGENTS need spaces escaped
Fixes FS#43304.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-26 18:41:56 +10:00
Allan McRae
599520e489 PKGBUILD.5: document split package depends are not used during packaging
makepkg only considers global {make,}depends when checking require packages
are installed before building.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-26 18:34:33 +10:00
Allan McRae
4291500c82 Remove spacing when outputting package sizes
This spacing appears to have been added to align sizes.  It sometimes worked...

$ pacman -Si glibc | grep Size
Download Size   :   8.03 MiB
Installed Size  :  35.08 MiB

And it sometimes failed...

$ pacman -Si pacman | grep Size
Download Size   : 662.82 KiB
Installed Size  : 4045.00 KiB

Remove the spaces for a consistent output.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-25 15:30:56 +10:00
Allan McRae
47ea63ff3b makepkg: do not run prepare() and pkgver() with --repackage
Bug introduced with commit 8454daa7.

Reported-by: Zuyi Hu <hzy068808@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-25 15:23:16 +10:00
Zuyi Hu
765e29b67c Fix testing of arrays status for arch specific variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-25 12:36:50 +10:00
Allan McRae
ad65462a05 Pull translations updates from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-17 13:39:02 +10:00
Johannes Löthberg
9ff29545e5 doc: alpm-hooks.5: Remove extra space in alpm-hooks man page
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15 15:01:31 +10:00
Allan McRae
8d9890d3f4 Cast events to void* before passing to callback
Silence warnings from clang about typecasting alignment.

Reported-by: Rikard Falkeborn
Original-patch-by: Olivier Brunel
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15 14:52:05 +10:00
Andrew Gregory
ab50864a75 add alpm_list_append
alpm_list_add always returns the provided list making it impossible for
callers to check whether or not the operation actually succeeded without
manually comparing the list length before and after.  alpm_list_append
instead returns a pointer to the newly created list item so that success
can be checked.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15 14:47:36 +10:00
Dominik Fischer
9813107c33 test version range restrictions corner case
The test introduced herein illustrates a behavior that may be unexpected
to package writers.

It creates a package "pkg3" that is configured to depend on a
"dependency" which version is between 3 and 4, inclusive. Two other
packages are already present, providing "dependency" in version 2 and 5,
respectively. So, the situation looks roughly like this:

                 pkg1               pkg3                pkg2
               provides          depends on           provides
                  |            <------------>            |
version __________2____________3____________4____________5___________...

This seems to be enough to satisfy pacman when installing "pkg3". From
an iterative standpoint, this is completely logical: First, the
requirement "dependency>=3" is checked. There is a package that
satisfies this restriction, it is called "pkg2". Afterwards,
"dependency<=4" is covered in the same way by "pkg1".

Nonetheless, what a package writer intends when specifying

   depends=('dependency>=3' 'dependency<=4')

is most probably that pacman should only allow this package to be
installed when there indeed is a package present that provides a version
of "dependency" that lies _between_ 3 and 5.

Signed-off-by: Dominik Fischer <d dot f dot fischer at web dot de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15 14:47:36 +10:00
Rikard Falkeborn
00c0329531 Add pacsort tests with invalid input
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 14:05:31 +10:00
Rikard Falkeborn
88f348f2b1 pacsort, introduce define for escape_char error code
The signedness of char is implementation defined. On systems where
char is unsigned, comparing a variable of type char with -1 is never
true, due to integer promotion rules. To avoid this, introduce a
define for invalid field separators where -1 is cast to char. This will
ensure that the return value check works for both unsigned and signed char.

Fixes one warning [-Wtype-limits] for comparissons with -1 when compiling
with -funsigned-char.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 14:05:28 +10:00
Rikard Falkeborn
875c017e4d Make alpm_graph state signedness explicit
The signedness of char is implementation defined. Since the
alpm_graph state is clearly meant to be signed, make the
signedness explicit.

This fixes bugs on systems where char is unsigned, in comparissons
of the following type:

  if(v.state == -1)

which, if state is unsigned, will never be true due to integer
promotion rules.

Fixes failing test/pacman/tests/sync012.py when compiling with -funsigned-char.

Fixes two warnings [-Wtype-limits] for comparissons with -1 when compiling
with -funsigned-char.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:59:19 +10:00
Allan McRae
2a0d188d6b Update NEWS for pacman-5.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Allan McRae
fa72c2cdc2 Update README for pacman-5.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Allan McRae
4742f5929d Update copyright years for 2016
make update-copyright OLD=2015 NEW=2016

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Daniel Hahler
8ca96447dd zsh_completion: add -q/--quiet for -Q/-S
This should also be added for "-Fh", but that is missing completely in
zsh_completion.

1: https://lists.archlinux.org/pipermail/pacman-dev/2015-November/020538.html

Signed-off-by: Daniel Hahler <git@thequod.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Alastair Hughes
6aee32102f Replace mktemp's --tmpdir option with shell code.
bacman and updpkgsums used GNU mktemp's --tmpdir option, which is not
supported by some other implementations (including busybox). Replace that with
shell code.

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Allan McRae
774c7eb24d Do not warn about missing files in NoExtract
The CheckSpace option checks the size of all files in a package being replaced
and gives a warning when it can not read the file.  However, files in NoExtract
are expected to be missing and should not be warned about.

Fixes FS#47470.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Florian Pritz
a671fa497c makepkg: Output full URL in case of download failure
Most entries in $sources contain variables so finding out why a URL
fails to download is hard because one has to manually replace the
variables when looking at the PKGBUILD. Simply output the full URL here
so that it can be easily seen what is wrong.

Old:
==> ERROR: Failure while downloading example-1.2.4.tar.gz

New:
==> ERROR: Failure while downloading http://example.org/releases/1.1/example-1.2.4.tar.gz

With the new format it is much more obvious that the directory name is
the culprint (1.1 vs 1.2) while the old one would not display that
information.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:34:30 +10:00
Olivier Brunel
eadf389607 alpm: Abort ASAP on failure in pre-transaction hooks
There is no need to run any/remaining pre-transaction hooks as soon as a failure
has occured, which will lead to aborting the transaction.

So if an error occured during the first phase (reading directories/parsing
files), or as soon as a hook flagged abort_on_fail does fail, we stop processing
them and return.

(For post-transaction hooks, all hooks are run regardless since there's no
aborting.)

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:33:26 +10:00
Allan McRae
8454daa7fe makepkg: run pkgver() and prepare() with --noextract
Modifications made to the source before running with --noextract may alter
the version string returned by pkgver(). Always run this function if present
and check build status before proceeding.  Fixes FS#46800.

Also run prepare() when --noextract is used (unless --noprepare is specified).

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:28:48 +10:00
Allan McRae
686fae6d74 Give error message when --files will do nothing
Point people towards the help when using "pacman -F" or "pacman -F foo".

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:15:04 +10:00
Allan McRae
d721bae443 alpm-hooks: add Description field
The "Description" field allows a hook to provide a some text for frontends
to use in describing what the hook is doing.  For example:

Description = updating info page directory

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:15:02 +10:00
Allan McRae
760bea5432 Show progress processing hooks
Introduces the ALPM_EVENT_HOOK_RUN_{START,DONE} events that are triggered
at the start and end of running an individual hook.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:12:23 +10:00
Allan McRae
8d3bd4ec13 Add ALPM_EVENT_TRANSACTION_{START,DONE} events
This provides a way to detect when the processing of package changes starts,
allowing pacman to delineate hook output and package installation/removal
output.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 15:12:32 +10:00
Olivier Brunel
132ec4c3b9 Add events ALPM_EVENT_HOOK_{START,DONE}
Add events to let frontends know when hooks are being processed (and when it's
done), as that might be useful to update the UI.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
2015-12-15 15:09:28 +10:00
Allan McRae
3802cab563 Collect all triggered hooks before running them
Having a first pass that checks which hooks are triggered followed by a
second pass of the triggered hooks allows us to only provide output when
a hook is actually triggered.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 15:03:14 +10:00
Allan McRae
f98541400b Pull translations from Transifex and prepare for next release
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-09 16:11:58 +10:00
Andrew Gregory
2015f0d1d9 alpm_run_chroot: remove dead code
Removes a leftover error message from when fdopen and fgets were used to
read from the pipe.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 10:34:31 +10:00
Allan McRae
137ea39fa1 makepkg: record build information in .BUILDINFO
This information can be used to reproduce build conditions, which can then be
used to determine if a package builds reproducibly.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 10:20:53 +10:00
Luke
9cdfd18739 makepkg: add whirlpool to the list of hashing algorithms
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 10:11:33 +10:00
David Macek
71f9de64c6 alpm_initialize: Fix double slash in sys hook dir path
The path of the default system hook directory was created
by concatenating `myhandle->root` (usually "/"), and
SYSHOOKDIR (usually "/usr/share/libalpm/hooks/"), resulting
in "//usr/share/libalpm/hooks/". Fix this by skipping the
initial slash from SYSHOOKDIR.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 00:22:40 +10:00
Andrew Gregory
8ee084dbb3 db_update: always clear db flags after update
Signature downloading and DB validation was being based on the most
recent download status for the DB.  If a DB successfully downloaded but
a signature did not, db_update would move to the next server.  If the
next server tried does not have a more recent copy of the DB, db_update
would not download the DB again and would forget that the DB had
previously been updated.  In this case it would skip validation
entirely, leaving an updated DB with the original validation status.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 00:15:35 +10:00
Alastair Hughes
d069d9714a Updated the documentation for makepkg's -L option.
At some point back in 2009, logging was expanded to cover all of the packaging
functions, but the man page was not updated to reflect that. Fix that!

Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 00:04:49 +10:00
Andrew Gregory
a8e2578feb remove soft interrupt handler before cleanup
The soft interrupt handler dereferences config, causing a segfault if
it is called during cleanup.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:10:43 +10:00
Andrew Gregory
b8a7277061 extract soft interrupt handlers
Delays handler setup until after config is set to a valid
value to avoid a segmentation fault.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:10:23 +10:00
Andrew Gregory
8089081ef9 extract SIGSEGV handler
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:10:06 +10:00
Andrew Gregory
c74495a3b2 extract SIGWINCH handler
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:09:53 +10:00
Andrew Gregory
4d2317dafb move signal handlers to sighandler.[ch]
Signals are special because they run asynchronously, making them
non-trivial to handle correctly.  Move the handlers a separate file to
offset them from the normal code and make them easier to separate into
individual functions without further cluttering pacman.c

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:09:39 +10:00
Andrew Gregory
220a3ce2b8 avoid unsafe functions in signal handler
signal(7) lists a set of functions that can safely be called from within
a signal handler.  Even fileno and strlen are not guaranteed to be safe.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:08:43 +10:00
Andrew Gregory
8d11aa3cdf remove SIG_IGN check when setting signal handler
Our signal handler provides a way to gracefully interrupt a transaction
and should always be set.

The check appears to have originally been copied directly from the glibc
manual.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:08:05 +10:00
Andrew Gregory
85508b478e do not catch SIGTERM
On SIGTERM pacman was exiting immediately, even in the middle of
a transaction.  In this case we should leave the lock file in place as
an indication that the database may not be in a consistent state.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 18:07:24 +10:00
Andrew Gregory
7fb8a299c2 pacman: exit without memory cleanup on signals
Memory allocation/deallocation functions are not safe to call from
signal handlers.  Just remove the lock file if there is one and exit
immediately.

Fixes: FS#46375, FS#45995, FS#47011

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:57:49 +10:00
Andrew Gregory
7b6f7bbe09 add and expose alpm_unlock
alpm_unlock is a limited version of alpm_release that does nothing but
the actual unlinking of the lock file and is therefore safe to call from
signal handlers.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:53:37 +10:00
Andrew Gregory
16623a7ea5 handle_unlock: return 0 if lockfile == NULL
Returning -1 is useless since we don't provide any way
to determine why it failed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:52:16 +10:00
Andrew Gregory
4838d250e5 skip conflicts resolved by file replacement
When replacing a file with a directory, any files inside the new
directory cannot possibly exist on the filesystem and can be skipped.
This allows cross-package symlink-to-directory transitions when there
are files with the same name under both the symlinked directory and the
new directory.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:46:22 +10:00
Andrew Gregory
bb5e6c3b76 always unlink files before extraction
libarchive will not extract a directory over an existing directory
symlink, making it impossible to replace a symlink with a directory
across packages.  Adding the ARCHIVE_EXTRACT_UNLINK and
ARCHIVE_EXTRACT_SECURE_SYMLINKS causes libarchive to unlink the existing
symlink and prevents it from extracting any paths that contain
a symlink, which we should not be doing anyway.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:46:12 +10:00
Allan McRae
8a373096f5 Detect potential conflict when symlink to directory is changing to directory
When a symlink to a directory is changing to a directory, any package file
inside the new directory can create an unexpected conflict with the filesystem.

Reported by Neofytos and Luca from Chakra.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05 17:46:11 +10:00
Allan McRae
088649534e Add large file support CFLAGS to pkgconfig file
Large file support is enabled by our configure script as required.  If anything
linking to libalpm does not also define large file support, there will be
differences in the size of off_t which are not caught until runtime.

Add the required CFLAGS to the pkg-config file so that users of libalpm know
what flags are required.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-04 11:06:49 +10:00
Andrew Gregory
dfa4dcb16d run_chroot: always clear script output buffer
If the script output does not end in a newline there could still be data
in the buffer after the poll loop.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-29 08:12:44 +10:00
Evangelos Foutras
34bbe4cf7b pacdiff: do not require DIFFPROG for -o/--output
Signed-off-by: Evangelos Foutras <evangelos@foutrelis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 22:57:24 +10:00
Andrew Gregory
5312e683fc hooks: pass matched targets to hooks
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 22:53:24 +10:00
Andrew Gregory
8ad893732d allow specifying input to scriptlets
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 22:52:11 +10:00
Andrew Gregory
b42d0852f3 allow arguments in hook Exec fields
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 16:26:51 +10:00
Andrew Gregory
e0607f6ae2 tap.py: replace newlines with escape sequence
Newlines clutter tap output and can potentially confuse TAP parsers.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 16:23:56 +10:00
Andrew Gregory
e03fa67445 pmrule.py: add FILE_CONTENTS rule
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28 16:23:08 +10:00
Allan McRae
23f128ad5e lint_pkgbuild/variable: increase robustness
Approach the detection of variables of the wrong type using an approach
similar to that used for construction of .SRCINFO files. While doing silly
things in bash could still result in false negatives, this approach should
be very robust to generatinf false positives results.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 16:03:33 +10:00
Allan McRae
663c74150a makepkg: merge arch dependent variables after PKGBUILD linting
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 16:02:32 +10:00
Allan McRae
ef1fb0ef81 makepkg: remove obsolete comment
Behaviour changed in commit dce82f9d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 11:13:39 +10:00
Allan McRae
c26e5b81e5 lint_pkgbuild: explicitly return value
Set the return value to be local and always explictly returns it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 11:13:39 +10:00
Silvan Jegen
947dfda515 Refactor strtrim function
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11 14:03:49 +10:00
Rikard Falkeborn
9e22e75fa1 Use correct format specifiers
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11 13:47:08 +10:00
Aaron Campbell
bf0e8e6b43 Refactor lint_source to work with earlier versions of Bash
Negative subscripts to indexed arrays are not supported before 4.2.  However,
since substring expansion works on arrays, we can specify an offset of -1 to
be taken relative to one greater than the maximum index of the specified
array (see Parameter Expansion section of the bash man page).  This works with
both Bash 4.1 and 4.2, and 4.1 is already the oldest supported by pacman.

Signed-off-by: Aaron Campbell <aaron@monkey.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-05 11:55:17 +10:00
Andrew Gregory
8fa02036c3 files_search: reset found for each target
Otherwise any invalid targets following a successful match will not get
an error message.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 15:06:21 +10:00
Andrew Gregory
726712aa08 files_search: free compiled regex
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 15:06:08 +10:00
Andrew Gregory
978b197120 files: do not unnecessarily strdup targets
Targets are never modified so we can just use the original copy.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 15:05:52 +10:00
Andrew Gregory
0d877ec429 files.c: add vim modeline
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 14:51:49 +10:00
Andrew Gregory
08b0b6de96 add detail to broken dependency errors
The difference between a sync target having an unmet dependency and
breaking a dependency for an installed package is a common source of
confusion.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 14:50:57 +10:00
Andrew Gregory
556c56d4d5 add --quiet to -Fh
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04 14:50:57 +10:00
Andrew Gregory
6eac7258cd ensure realloc has a positive size
If given size 0 POSIX allows realloc to return a pointer that is not
suitable for use.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 21:45:09 +10:00
Mohammad Alsaleh
0fd6d354a6 zsh_completion: Handle --ignore/--ignoregroup correctly
Completion now works as expected with a comma-separated sequence.

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 15:07:11 +10:00
Pierre Neidhardt
d5b0f0c26f package.c: Fix incorrect buffersize and constant-folding
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 14:41:25 +10:00
Florian Pritz
906dc0ce24 Add -F --machinereadable option
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 14:36:59 +10:00
Florian Pritz
697377aae3 Document pacman -F
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03 14:36:53 +10:00
Allan McRae
d8621b981e scripts/po: fix translated file name
This file was renamed during review and its entry in POTFILES.in was not
updated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 17:04:08 +10:00
Andrew Gregory
dcc1b22cb3 _alpm_hook_run: check path length before copying
If a hook path equals or exceeds PATH_MAX characters the path will be
left unterminated.  Pre-calculating the path length also allows us to
use the more efficient memcpy over strncpy.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 14:22:09 +10:00
Benjamin Yates
1142a32c7f makepkg: fix $pkgname element duplication
run_split_packaging did not preserve the $pkgname array correctly, and
would create duplicate entries in the list during restore.

After restoring the backup (a b c) would become (a b c b c).

This probably went unnoticed because during --install, pacman would
reconcile the duplicates.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 13:26:25 +10:00
Allan McRae
960b64553d libmakepkg: fix pkgver checking
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 20:44:57 +10:00
Andrew Gregory
6fdc589fc6 add alpm-hooks man page
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 19:39:22 +10:00
Andrew Gregory
5b6526a2ad hook.c: print invalid option name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 19:38:57 +10:00
Andrew Gregory
b46bdeea14 order hooks by file name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 19:38:32 +10:00
Pierre Neidhardt
3c67127018 Align titles automatically in information display
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 18:52:05 +10:00
Rikard Falkeborn
0c5dbdbfec Alpm, check for NULL in free-functions
Also, use FREE() instead of free() in _alpm_backup_free()
to set the pointers to NULL.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 14:22:30 +10:00
Mohammad Alsaleh
4c5bf09eec zsh_completion: Add --asdeps/--asexplicit to -U options
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 14:03:15 +10:00
Pierre Neidhardt
456ebe8f8e Use ARRAYSIZE macro for non-string array size computation
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 13:53:18 +10:00
Mohammad Alsaleh
9809102237 makepkg: Fix hard-coded debug suffix
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-22 09:40:37 +10:00
Rikard Falkeborn
e28aff4d87 pacsort: clean up if error
* free memory
* close open file

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 15:12:25 +10:00
Rikard Falkeborn
aa8a674b6b pacsort: don't overwrite memory if realloc fails
That makes it impossible to free it later.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 15:11:27 +10:00
Rikard Falkeborn
19d373c9b9 pacsort: handle failing list_add
Since it can fail, check the return value.
If it fails, we need to free the memory of the object we wanted
to add to the list.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 15:06:25 +10:00
Pierre Neidhardt
4b3df10d5d HACKING: Allow the use of 'sizeof' on values
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-21 14:50:56 +10:00
Jan Alexander Steffens (heftig)
2c72c8b822 makepkg: Set CCACHE_BASEDIR to make paths in $srcdir relative
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:33:30 +10:00
Jan Alexander Steffens (heftig)
2627b423ff makepkg: Correctly layer distcc and ccache
ccache expects further compiler wrappers to be specified via
CCACHE_PREFIX. Otherwise, ccache will hash the wrapper executable
instead of the real one.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:33:17 +10:00
Jan Alexander Steffens (heftig)
70e6875ad9 libmakepkg: Add check_buildoption for distcc and ccache
makepkg used to check OPTIONS too, which could override
BUILDENV. Implement a new function that handles these
options more like OPTIONS.

This also reduces code duplication a bit.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:32:59 +10:00
Allan McRae
5d4a3f101c makepkg: separate "sourcefile" into two words
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:25:35 +10:00
Allan McRae
5301d3fe8f Remove space before ellipses
Makes all use of ellipses consistent...

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00
Allan McRae
29d4dcf767 Pluralize malloc failure string
Not particularly useful in English (will always be plural), but useful in
languages that have multiple plural forms.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00
Allan McRae
501242a35b Ignore cov-int directory for Coverity scan
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00
Allan McRae
0ee1beca12 contrib/checkupdates: separate fakeroot call and command
Separating the fakeroot command and the pacman call with "--" prevents weird
interactions with some locales.  See FS#46405.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 11:27:56 +10:00
Pierre Neidhardt
c99ebca83e package.c: Comment style
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 11:24:31 +10:00
Allan McRae
002acb4674 Do not print any root prefix in files database operations
Combining with the --root flag and outputing a consistent root prefix leads
to many situations that make no sense.  Instead, do not print any prefix for
any --files operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 11:16:44 +10:00
Pierre Neidhardt
cbb7e180c7 package.c: Remove obsolete param from doc
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:24 +10:00
Andrew Gregory
a5759cb0d7 add hook tests
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:24 +10:00
Andrew Gregory
b76409609c pactest: add hook/script support
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:24 +10:00
Andrew Gregory
4ceb1c5bf9 util.py: return the created path
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Andrew Gregory
60ebee7a6e pactest: use pacman --hookdir option
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Andrew Gregory
7000bf9198 pacman: add user hook directories
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Andrew Gregory
e8e872c8f9 validate hooks after parsing
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Andrew Gregory
16718a216e run hooks during trans_commit
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Andrew Gregory
568a89d580 add hook data types and parser
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Andrew Gregory
c261210ccf handle: add hookdirs option
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Pierre Neidhardt
46a1ac6429 PKGBUILD.5: post_*() are functions, not scripts
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18 10:59:23 +10:00
Allan McRae
e8deba3b87 makepkg: remove ability to build individual packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-23 01:02:23 +10:00
Allan McRae
0adb74b293 libmakepkg: remove declaration of unused local variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 16:11:32 +10:00
Allan McRae
dd3fe853b3 libmakepkg: return 1 on error in arch array
The return value was being assigned when an error was found in a PKGBUILD's
arch array but it never was returned.

Also remove error message explaining about adding the arch array to a PKGBUILD.
That was added a long time ago when the arch array first became compulsory.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 16:06:29 +10:00
Allan McRae
19e61a9e07 libmakepkg: update .gitignore
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 15:11:52 +10:00
Allan McRae
be503c6eac makepkg: remove FORCE_VER variable
This variable is no longer in VCS building.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 14:54:03 +10:00
Andrew Gregory
6946d7d1b7 check fileconflicts and diskspace outside commit
This is necessary in order to be able to run PreTransaction hooks as
close to the actual commit as possible so that we don't prematurely run
hooks for a transaction that ultimately never happens.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-20 17:36:53 +10:00
Andrew Gregory
af747ef34a move ini parser into common
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-20 17:36:53 +10:00
Andrew Gregory
edbe6c2bdc move strtrim to util-common
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-20 17:36:27 +10:00
Andrew Gregory
75fe6ef104 sortbydeps: skip local packages being updated
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-19 15:12:35 +10:00
Allan McRae
486643083c libmakepkg: check if PKGBUILD variables are arrays or not as appropriate
When extracting variables from PKGBUILD (e.g. for .SRCINFO creation) we make
assumptions about whether variables are arrays or not.  This adds a check to
the PKGBUILD linter to ensure variables are arrays or not as appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-07 11:22:00 +10:00
Allan McRae
1586b23080 libmakepkg: util/pkgbuild.sh needs processing on build
pkgbuild.sh contained @DEBUGSUFFIX@ and so needs to be run through the sed
command on build.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-07 11:21:59 +10:00
Allan McRae
ec50ec8a15 pacman.8: Consistently refer to the package database
We use "package database" everywhere apart from in the description of "-y".

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-07 11:21:58 +10:00
Sebastian Lackner
5780350751 libalpm: Force update when database is marked as corrupted.
When a database and its signature is updated non-atomically on a server,
there is a window where a user may update the database but grab the old
signature.  The database is marked as invalid by libalpm, which can be
fixed by forcing a refresh (assuming the server has caught up and the
user realizes what has happened) or with a future update of the repo.
Work around this by forcing a repository refresh whenever a database is
invalid.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:45:09 +10:00
Andrew Gregory
ae97082e98 fill in name_hash for assumeinstalled options
alpm_depend_t is an exposed data type.  Front-ends may opt for alloc'ing
one and filling the fields manually, but alpm's _alpm_hash_sdbm is not
exposed, making it impossible for them to fill in the name_hash field.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:42:26 +10:00
Andrew Gregory
48f4efd9a1 copy assumeinstalled options
All other option setters copy their input.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:41:14 +10:00
Andrew Gregory
ccd3a3eb9f check assumeinstalled for meaningful mod
assumeinstalled options are used as provisions for which MOD_EQ and
MOD_ANY are the only meaningful settings.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:40:00 +10:00
Andrew Gregory
1ee2032b7f check dep versions before calling strcmp
Fixes a segfault when trying to remove an assumeinstalled
option without a version.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:39:15 +10:00
Rikard Falkeborn
2d0e2bf255 pacman/util.c: Fix memory leak if realloc fails
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:36:21 +10:00
Allan McRae
b8c9385b8b Remove ko_KR translation
The "ko_KR" locale is the same as the "ko" locale.  Remove the "ko_KR" variant
as it is incomplete and has been superseded by "ko" on transifex.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08 10:36:03 +10:00
Allan McRae
877578762c libmakepkg: move color settings to function
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 14:56:12 +10:00
Allan McRae
8566034866 pacman/files.c: fix memory leak on regex error
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 13:41:36 +10:00
Levente Polyak
deac973188 ensure matching database and package version
While loading each package ensure that the internal version matches the
expected database version to avoid the possibility to circumvent the
version check.
This issue can be used by an attacker to trick the software into
installing an older version. The behavior can be  exploited by a
man-in-the-middle attack through specially crafted  database tarball
containing a higher version, yet actually delivering an  older and
vulnerable version, which was previously shipped.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 12:50:39 +10:00
Dave Reisner
445aa3b52c dont remove x bit when marking pkgdir RO
f170a94c13 potentially causes $pkgdirbase/$pkg to be undeleteable
with -R or -C if a previous build was interrupted. We simply can't
traverse to this directory, and rm blows up.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 12:50:25 +10:00
Allan McRae
bbab90836b libmakepkg: lint_package requires cd_safe
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 11:43:27 +10:00
Allan McRae
3c41030964 Handle repo/pkg style arguments to sync repo file listing
Passing "-Fl pkg" will print the filelist for the first occurance of "pkg"
in the sync repos. Other version of the package can be printed using
"-Fl repo/pkg".

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:31 +10:00
Allan McRae
fd9ff672b0 Add regex search option to sync database file searching
e.g. pacman -Fsx kcm.*print.*\.so

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:31 +10:00
Allan McRae
acf95f6b3b Implement searching for a file in the sync databases
Locates all packages that contain the listed file
e.g. pacman -Fs libpng.so

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:31 +10:00
Allan McRae
137a4086de Implement listing files from sync packages
Does the equivalent of the -Ql option for local packages

e.g. pacman -Fl glibc

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae
488ca24265 Implement locating file owner in sync files database
Equivalent to -Qo but for packages in the sync database
e.g.  pacman -Fo /usr/bin/pacman

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae
5782b8356c Prototype pacman files database operations
Add the -F/--files operations, -s/--sync support and nd provide dummy
functions for -s/--search, -l/-list and -o/--owns.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae
e49abc9860 pacman: move database syncing to util.c
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae
b0dac754d2 Add pacman support for .files databases
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae
289fdf0d1d Read file lists from databases
If a sync database contains a "files" file, the file list will be read.

Currently, there is no known demand for the file list to be lazy loaded by
any libalpm frontend, so these files are read whenever present. Lazy loading
can be implemented when a demand exists.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae
f6c55b3c3f Allow frontends to specify the sync database extension
This allows frontends to select between the .db and .files databases
currently supplied by repo-add or any other compatible database.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:29 +10:00
Allan McRae
1ada16f017 Fix formatting in parsearg_upgrade
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14 20:46:03 +10:00
Allan McRae
2d7a41539b Simplify sync_cleandb
1) Remove checks for removing pre-tardb files
2) Remove the long redundant keep_used parameter
3) Fix pacman error due to removing .sig file along with database

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14 20:45:55 +10:00
Allan McRae
94204d1089 Do not warn about packages that optionally require a removal when ignoring deps
If a transaction is removing a package while ignoring all dependencies, there
should not be any warning about other packages optionally requiring it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14 17:15:33 +10:00
Allan McRae
ff487212a2 Do not warn about downgrades when only downloading package
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-12 16:23:25 +10:00
Andrew Gregory
2e5e496eb0 Fix overflow warnings
Fix new warnings generated by gcc-5 about potential overflows.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-12 16:23:18 +10:00
Lukas Fleischer
a187fa4562 Match providers when showing optdep install status
Use alpm_find_satisfier() instead of alpm_db_get_pkg() when retrieving
the install status of a package to make sure we spot providers as well.

Fixes FS#36412

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Johannes Löthberg
4b0bc2cf97 repo-add: Reject armored signatures
Pacman cannot handle armored signatures, so make repo-add error out if
one is detected.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Johannes Löthberg
aa9aa343cb makepkg: Add flag for printing SRCINFO to stdout
This commit adds a makepkg option to generate and print the SRCINFO file
for a PKGBUILD, required by the new AUR, to stdout.

AUR 4.0 will use Git instead of source tarballs for uploading packages,
so making makepkg capable of printing the SRCINFO would simplify package
management, instead of having to extract it from a source tarball.

It is also useful for scripting other things, so that instead of having
to parse PKGBUILDs, one can make makepkg generate the SRCINFO and then
you can parse that instead, which is much simpler and less error-prone.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Johannes Löthberg
2bed2090fb repo-add: Generate unarmored DB signature
Pacman cannot handle armored signatures, so use gpg's --no-armor flag to
force an unarmored signature.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Johannes Löthberg
53d9633449 util.c: table_display: Fix incorrect docstring
Commit 7b8f8753 removed the title parameter but forgot to remove it
from the docstring.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Wieland Hoffmann
0f302df5ed makepkg-template.1: Clarify which file version-less markers use
The old text could be interpreted such that makepkg-template compares
the version numbers of the templates to find the most recent
one. Rephrase this to make it explicit that "$template_name.template" is
used.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-06-20 17:32:56 +10:00
Allan McRae
3d4529335c libmakepkg: extract functions for source download and extraction
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
1a17249159 libmakepkg: extract functions for handling source URLs
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
366adc3bb0 libmakepkg: fix test style
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
23e3c48526 libmakepkg: move more functions for extracting information from PKGBIULDs
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
15b6cecdd5 libmakepkg: extract more utility functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
8ab106eb9b libmakepkg: extract get_full_version and get_pkg_arch
These functions group in with other functions that extract PKGBUILD
information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
61dd7e03be Simplify libmakepkg .gitignore 2015-05-16 14:10:42 +10:00
Allan McRae
dbbe76b83d makepkg: put further restrictions on pkgbase
pkgbase should be subject to the same restrictions as pkgname

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
9302593cfb makepkg: merge validate_pkgver into check_pkgver
The check that pkgver is non-empty done in check_pkgver should also be
performed after running the pkgver() function.  Merge validate_pkgver
into check_pkgver and run check_pkgver after updating pkgver.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
c9a7b7e0bf libmakepkg: extract PKGBUILD linting functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
d38c098787 libmakepkg: extract in_array 2015-05-16 14:10:42 +10:00
Allan McRae
83b734a103 libmakepkg: move functions for extracting pkgbuild attributes
Also rename some functions for clarity:
funcgrep -> grep_function
extract_global_var -> extract_global_variable
extract_function_var -> extract_function_variable
pkgbuild_get_attribute -> get_pkgbuild_attribute

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
David Macek
d5536d3eb3 libalpm: Do a sanity check before manipulating final DB URL
The change in commit 9d96bed9d6 causes download errors for the .db.sig file
in case the final URL for the .db file contains query strings or other
unexpected stuff. This commit isn't intended to be a total solution, but it
should eliminate the problem in the most obvious cases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
David Macek
d568a4335b Fix comment in alpm_db_update
Fix comment to better explain the magic constant used when allocating a buffer
for ".db.sig" URL.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Allan McRae
99c7b1b088 libmakepkg: fix test bracket style
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Andrew Gregory
9a9e0203de alpm_logaction: implement documented return value
"return 0 on success, -1 on error (pm_errno is set accordingly)"

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Andrew Gregory
1545a04253 alpm_logaction: allow falling back to syslog
Even if opening the log file fails, if a user has enabled syslog we may
still be able to log to that.  Set the error return value and continue
instead of bailing out.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
e4af5e3c97 alpm_logaction: check logfile before opening
valgrind does not like calling open(NULL, ...).  This also makes the
return value 0 if logfile has not been set.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
ae7067440c merge _alpm_logaction into alpm_logaction
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
David Macek
f9423cfa5d makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD
Currently makepkg clears the whole $pkgbasedir which is needless. Moreover,
in the obscure case of multiple makepkg runs (with different $pkgname) that
share a $pkgdirbase, only $pkgdir's from the last run will remain. Since
I consider the contents of $pkgdir an important artifact, this commit restricts
the deletion to individual $pkgdir's.

When CLEANUP is set, the behavior is unchanged.

Discussed in:
https://lists.archlinux.org/pipermail/pacman-dev/2015-February/019939.html

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Charles Duffy
1040ad4e71 Fix compilation if libarchive headers are not in standard location
With commit 097d5a478b, including alpm.h also drags in archive.h.
Ensure the tools we build that depend on ALPM also include the necessary
flags to find libarchive headers if they are not installed in a standard
location.

[Dan: Add commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Dominik Fischer
b0ae59724e makepkg-template: support multiple --template-dirs
Especially when maintaining local templates in addition to the ones
stored in /usr/share/makepkg-template, it can be useful to include
templates stored in multiple different locations into one PKGBUILD. This
patch makes this possible by allowing --template-dir to be specified
multiple times.

This also introduces a dedicated error message when a template cannot be
found, in contrast to the already existing "Couldn't detect version for
template '%s'".

If a template of the same name is present in more than one of the given
directories, the last one always takes precedence.

Neither the default behaviour without the option given, nor the handling
of a single template dir is changed.

Signed-off-by: Dominik Fischer <d.f.fischer@web.de>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
d4e5de4bf6 pacsort: fix warning about signed overflow potential during comparison.
Some crazy person assumed we would have fewer than INT_MAX columns.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
54067c390f Silence warning from clang
clang is wrong - dbfile is always used initialized in that function.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
4dbac804a3 Pluralize callback string
In English, this string only has it plural form. However, we need to use the
pluralized translation as some languages can have multiple plural formats.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
4e6848dbea Update source URL
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
e374e6829c close stdin before running install scripts
libalpm does not guarantee that script output will be presented to the
user or that stdin will be connected to a terminal.  Close stdin so that
scripts do not attempt to use it for user interaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:14 +10:00
Andrew Gregory
721b785e73 be_package: fallback to standard filelist loading
In order to work properly, loading the filelist from an mtree file
requires a libarchive patch that has not yet been included in an
official release.[1]  Under certain circumstances, an unpatched
libarchive may refuse to read the mtree file due to inconsistencies
between it and the user's file system.  In order to allow alpm to
recover in this situation, read the mtree data into a temporary filelist
that is only copied over to the package if the entire read is
successful.

[1] 661684170b

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:13 +10:00
Andrew Gregory
edeafcc988 add_entry_to_files_list: pass filelist directly
Allows entries to be added to arbitrary filelists not connected to
a package.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:13 +10:00
Ivy Foster
bf3aec8c32 Add makepkg option --packagelist
makepkg --packagelist prints the name of each package that would
normally be produced, minus $PKGEXT, and exits.

Implements FS#42150

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:10 +10:00
Allan McRae
b520c6312f repo-add: merge desc and depends files
There is little point in these two files being separated as the whole sync db
is parsed at once.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
2408d46c1b makepkg: write validpgpkeys to .SRCINFO
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
eb5da52c0e PKGBUILD.5: have epoch directly following pkgver/pkgrel
These three fields should be grouped together.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
b630f455d2 update repo-add documentation for removal of -f flag
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
cb0f2bd038 Always create files database
Both the "db" and "files" databases are created in one call to repo-add.
Only the "foo.db.tar.xz" name is passed to repo-add.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
30c9dbcdeb repo-add: remove duplication finding old package details
The information needed to create a delta entry and remove the old package from
the filesystem are the same.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
6aef45ee1a repo-add: check early for xdelta if it is needed
The check for xdelta3 was done as needed (and not in all cases).  Do this
check early so that repo-add does not abort part way through.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
81d233b793 repo-add: only update database if entire command succeeded
It is not hard to think of situations where the repo database should not
be updated unless the whole operation succeeds.  Error out before a partial
database update occurs.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
d2cb52de12 repo-add: move database creation into its own function
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
f3fc9af2b7 repo-add: move database rotation into its own function
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
e7e0c13762 Merge branch 'maint' 2015-03-26 14:43:13 +10:00
Ivy Foster
b543c055b9 Make get_pkg_arch treat arch as an array
We use the get_pkg_arch function with the package name parameter in two places:
1) checking if the package is already built
2) installing build packages

Currently this failed when a package override for "arch" was an array, despite
all our documentation stating that it is indeed an array.  This change makes
these two places fail if there is package override for arch that is not an
array - i.e. of the form arch='i686'.

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:42:22 +10:00
Allan McRae
b8f2d713e0 Update PKGBUILD-split.proto allowed overrides
Commit 8a02abcf19 disallowed overridding pkgver/pkgrel/epoch.  Update the
split package prototype to refelct this change.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:42:10 +10:00
Christian Hesse
eb21e9eb93 fix source package signing with SRCPKGDIR set
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:41:26 +10:00
Charles Pigott
f34e48a988 Actually return the error value of check_db_local
Signed-off-by: Charles Pigott <charlespigott@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Allan McRae
f9cb4f3b9c libmakepkg: move helper functions into tidy/strip
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Johannes Löthberg
22a5128985 PKGBUILD.5.txt: Clarify note about variables available
Reported-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Johannes Löthberg
0aded7487f PKGBUILD.5.txt: Add note about functions starting in $srcdir
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Andrew Gregory
156d41a186 remove: use strcmp for files in skip_remove
Paths from noupgrade, the transaction skip_remove, and package backup
lists were combined into a single list matched using fnmatch causing
paths with glob characters to match unrelated files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Andrew Gregory
ba532bda6b sync_prepare: exclude removals from resolvedeps
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
David Macek
ff8de12151 Allow UPX compression for DOS/Win executables
Hi. This change allows makepkg to UPX-compress executables on Windows, but will probably affect some Linux packages as well (I'm guessing gdbserver, wine, mingw-w64).

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Will Miles
965539adbf common: Avoid errors on systems that define strnlen but not strndup
Add a configure test for a system library supplied strnlen, and disable
the embedded version in common if one is found.

Signed-off-by: Will Miles <wmiles@sgl.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Will Miles
bb94729c09 util: Use util-common for strndup in pacsort and pactree
This small refactor reduces the number of replications of the local
imeplementation of strndup.

Signed-off-by: Will Miles <wmiles@sgl.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
8f92fe47a7 calculate_removed_size: ensure llstat succeeds
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
578ceb29fa sync_cleandb: ensure stat call succeeds
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
9f1c5f0251 pacsort: test string is not NULL before strlen
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
d9b5cb238d Abort of failure to add version file to empty local database
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
fc5be14dac parse_descfile: fix memory leak in error case
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
2108d95526 Fix memory leaks in dump_pkg_full
Leaks when using -Sii with package signatures

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
008bd33e38 Merge branch 'maint' 2015-03-03 14:47:50 +10:00
Allan McRae
92b8c09000 Update release history
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-02 01:36:33 +10:00
Allan McRae
7879a5b3e5 Merge branch 'maint' 2015-02-20 10:36:18 +10:00
Allan McRae
068f8cec42 Release 4.2.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-20 10:25:41 +10:00
Allan McRae
e0f889e2ea Update translations from Transifex 2015-02-20 10:21:15 +10:00
Allan McRae
5baec6d5e9 Update translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-14 11:18:49 +10:00
Allan McRae
97fb8ada30 Update NEWS for 4.2.1 release
0002-valgrind.supp-remove-library-version-from-suppressio.patch
2015-02-14 11:18:20 +10:00
Renato Silva
0927206fc4 Fix Bazaar cloning in makepkg.
There was some manual check to know if the local repository was really a clone
of the one specified in PKGBUILD. This check has been removed because it is
buggy and not necessary.

It is buggy because this check needs to be semantic, not a simple string
comparison. For example, I was blocked from building a PKGBUILD because Bazaar
was returning two different strings for the same location (for HTTP one was
url-encoded while the other was not, and for local paths one was absolute while
the other was relative). While this may be a bug in Bazaar, the check is
unreliable since the comparison is not semantic (http://foo.com/%2Bplus and
http://foo.com/+plus obviously refer to the same location for example).

Specially, it is useless because the intention is updating the existing local
clone. However, if the local clone is not a real clone of the repository
specified in PKGBUILD (which was what this buggy check tried to tell), next step
which is a pull operation will fail anyway. This is because bzr pull does not
perform merges, it just makes one branch into a mirror of another.

There was a reason provided when this manual check was added for Git, but no
reason provided for copying such check when Bazaar support was added, see
commits below. In fact, Mercurial lacks such manual check.

* c926c39b04
* 3b02f80dcb

Fixes FS#43448.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-14 11:18:20 +10:00
Allan McRae
adc6ca1f2c libmakepkg: make package checking functions extendable
To add a new package check, drop a file in libmakepkg/lint and add the
function to the "lint_functions" array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 14:00:57 +10:00
Allan McRae
00da25a5ea libmakepkg: make package tidy functions extendable
To add a new packaging option, drop a file into libmakepkg/tidy that contains
a 'packaging_options+=('<option>') and a function that implements that
option. The function needs added to the 'tidy_remove' array if it removes
files or the 'tidy_modify' array otherwise.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 14:00:57 +10:00
Allan McRae
bfe9b56e1f libmakepkg: move package checking out of tidy_install
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 14:00:55 +10:00
Maxim Andersson
68602f4931 paccache: added --quiet option
Less output, although errors and warnings will still be printed
(scripts/library/output_format.sh).

Cleaner to have -q,--quiet than >/dev/null in cron.

Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:45:03 +10:00
Allan McRae
dff6982c83 repo-add: improve delta file detection on removal
This allows use to remove a package with the name "foo.delta" from the
repos.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:35:48 +10:00
Allan McRae
660bd1caa1 repo-add: only backup database signature if database was backed up
Ensures the backed update database and its signature are always consistent.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:35:31 +10:00
Allan McRae
3c46420367 repo-add: unify checking gpg keys
Move the PGP key checking into the check_gpg function.  This also results in
error messages being in colour.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:35:19 +10:00
Allan McRae
cf3d5e4830 repo-add: clarify invalid repo extension message
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:35:09 +10:00
Allan McRae
b5b2f0b1bf repo-add: improve removing old packages
The -R/--remove option left the old package in place when delta packages
were to be generated.  It was also removed before we ensure the generation
of the entry for the new package was generated without error.

Remove the old package at the end of database entry and delta generation. Also
improve the help message to clarify it is the old package that is removed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:35:01 +10:00
Allan McRae
27e3125c8d Merge branch 'maint' 2015-02-12 13:33:20 +10:00
Allan McRae
ba869597fb Disable directory ownership warnings
There was a lot of confusion regarding these warnings, particularly for
packages that create users post_install and then chown the directories.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:25:44 +10:00
Andrew Gregory
0c9f4329f8 set package origin when adding to db cache
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:22:40 +10:00
Allan McRae
43413894d4 valgrind.supp: remove library version from suppression
glibc installs the library /usr/lib/ld-?.??.so with its version.  Wildcard
this so the suppresses the warning for all glibc versions.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:22:32 +10:00
Andrew Gregory
c3161925c2 sync200.py.in: remove unused substitution
LIBCURL was never set in the Makefile so XferCommand was always being
set in the test file.  This removes the only substitution in our test
files which will prevent the TESTS file from being rebuilt every time
configure is run.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:22:24 +10:00
Allan McRae
295a3491ad makepkg: split package tidying into libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00
Allan McRae
33466000d6 makepkg: split PKGBUILD/makepkg.conf option checking to libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00
Allan McRae
c8574baa7c makepkg: rename other_options to build_options
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00
Allan McRae
7885931c96 makepkg: split message functions into libmakepkg
This performs all the needed work for libmakepkg to be included in
tarballs, installed into the correct place, and read into makepkg.

Also change the install root for libmakepkg to an architecture independant
location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00
Christian Hesse
9917930ae1 add option to optimize PNG images with optipng
This can decrease package size by optimizing PNG image size. Images are
just stored with better compression and/or filter options. The actual
image content is not altered.

Additionally this can automatically fix broken PNG images which caused
some trouble lately.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:04 +10:00
Christian Hesse
bd2e95b00b remove globbing for upx and make UPXFLAGS an array variable
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:04 +10:00
Allan McRae
2e48101999 Update copyright notices for 2015
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:04 +10:00
Allan McRae
325be32acd pmenv.py: Fix typo in copyright assignment
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:04 +10:00
Allan McRae
bbac318d7a Add make rule to update copyright years
Usage: make update-copyright OLD=2014 NEW=2015

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:03 +10:00
Allan McRae
54c630f6ec Merge branch 'maint' 2015-02-01 21:18:31 +10:00
Allan McRae
10fc538c70 makepkg: refix removing static libraries when shared uses absolute symlinks
Commit 9e5e86aa was supposed to fix this.  Instead I picked another [[ -f ]]
statement in the same region and added the hardlink test to it instead, thus
not fixing the bug.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:17:14 +10:00
Andrew Gregory
841e531c51 trans_commit: restore pm_errno after updating log
If the call to alpm_logaction failed it would overwrite pm_errno,
leading to error messages unrelated to the actual reason the transaction
failed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:13:11 +10:00
Allan McRae
3b22183a4d contrib: remove fakeroot option from PKGBUILD.vim
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:12:45 +10:00
Lukáš Jirkovský
8391716b8a makepkg: Set the working copy destination explicitly when cloning in extract_git
This fixes the issue where if the user explicitly set the name of the cloned source
to eg. foo.git, the directory name in $SRCDEST would be foo.git as expected, but the
clone in $srcdir would be stripped of the .git suffix.

Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:11:25 +10:00
Jeffrey Tolar
aa12a773b8 Add --noarchive to makepkg's zsh completion
Signed-off-by: Jeffrey Tolar <tolar.jeffrey@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:11:15 +10:00
Jeffrey Tolar
50de87e0e6 Remove --asroot from makepkg's completions
Signed-off-by: Jeffrey Tolar <tolar.jeffrey@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:11:06 +10:00
Andrew Gregory
5167160c0c extract_single_file: consolidate extraction logic
Also adds checks that the filename does not exceed PATH_MAX.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
ba0d225d93 extract_single_file: use .pacnew for check files
Prevents the need to rename the file if we end up keeping it and ensures
that pacnew files always reflect the most recent version by overwriting
stale copies.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
926280cfc7 remove support for .pacorig files
Leave user files in place and save new config files with a .pacnew
extension.  This reduces the complexity of file extraction and respects
the principle that pacman shouldn't modify files it didn't create.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
a82a5cf3f7 extract_single_file: use full path in messages
If an error occurs the actual path being extracted is more useful than
the original path from the package file list.  The original path is
still used for checks that use it directly.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
4ba0561fe7 extract_single_file: factor out db file extraction
alpm's database files (.INSTALL, .MTREE, etc.) should be extracted no
matter what; skip mtree/needbackup/noextract/noupgrade checks for them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
f917a4a55a extract_single_file: reduce indentation
Puts all of the conflict cases at the same level.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
63660afbc7 extract_single_file: consolidate needbackup checks
We need to know if a file needs to be backed up for all extracted files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
3b20561748 ini.c: move error output into conf.c
Move the remaining output into conf.c by notifying the callback of read
errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
ea96b56722 ini.c: remove useless key check
key points to a statically allocated string so it can't be NULL and
empty keys are rejected by the callback.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
e7d8e2b5ac ini.c: remove empty section name restriction
alpm will reject empty database names already.  Reduces error handling
in the ini parser.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory
4ccafc484d ini.c: remove unnecessary helper function
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory
09cfe2a4c0 ini.c: move Include parsing to conf.c
Reduces the number of errors the ini parser must handle to make it more
suitable for sharing with the backend.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory
9eb07a81fa ini.c: remove final callback call
Storing repo information removes the need for the final callback.  This
allows the call signature to be re-purposed for indicating read errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory
7ed0d60a0d conf.c: parse config in a single pass
Fixes FS#28255

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory
95121cc4f1 conf.c: use masks for siglevel inheritance
This will allow pacman to parse its config file in a single pass and
removes the need for the *_SET siglevels in alpm that were only required
for pacman's siglevel inheritance.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory
2aa85c3bfd conf.c: store repo settings in dedicated struct
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Allan McRae
92febc847c Merge branch 'maint' 2015-01-21 14:27:25 +10:00
Daniel Micay
c6263da168 fix geometric growth in _alpm_greedy_grow
It was allocating the required size rather than the calculated new size,
resulting in pathological incremental reallocations.

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-21 14:27:04 +10:00
Daniel Micay
21281e9b69 be_local: fix _alpm_greedy_grow usage
The files_size variable contains the current capacity (in bytes) and
should not be used to calculate the next length increment. It only works
because _alpm_greedy_grow currently results in incremental growth.

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-21 14:26:54 +10:00
Allan McRae
018fa2b48c Merge branch 'maint' 2015-01-12 15:23:30 +10:00
Allan McRae
a31426d3ea makepkg: clear destination array in array_build
If an already used array is passed array_build, some entries from the old
array could be carried over if the old array was longer than the new one.
Clear the destination array before adding elements to it to prevent this
issue.

Fixes: https://bugs.archlinux.org/task/43387

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-12 15:23:01 +10:00
Florian Pritz
0108884952 test makepkg-template: Add update-version-with-newest-option
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:25 +10:00
Florian Pritz
d5f703729f test makepkg-template: Add template-without-version
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:25 +10:00
Florian Pritz
bd2473797e test makepkg-template: Add name-charset-valid
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:25 +10:00
Florian Pritz
6201f6e5ac test makepkg-template: Add name-charset-invalid
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
4dd9ccbc78 test makepkg-template: Add missing-template-symlink
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
17ad845c41 test makepkg-template: Add missing-template-file
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
287f7a575e test makepkg-template: Add keep-old-version
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
dfacd8473e test makepkg-template: Add invalid-template-line-unknown-marker
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
107eabdfb3 test makepkg-template: Add invalid-template-line-missing-name
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
207ba1e05f test makepkg-template: Add invalid-key
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
ca5af32b99 Add testrunner for makepkg-template
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Florian Pritz
f617b6acd4 makepkg-template: Remove linenumber/file from errors
die prints "at $scriptname line $linenumber." if the string does not
end with "\n". This information is not of much use for us and it makes
testing harder because we'd to remove it there.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2015-01-11 18:58:24 +10:00
Allan McRae
77ca6e4062 Merge branch 'maint' 2015-01-11 18:57:54 +10:00
Dario Giovannetti
e8d757b6ba paccache: exit in case of pacman error when -u flag is used
Fixes https://bugs.archlinux.org/task/43286

Signed-off-by: Dario Giovannetti <dariogiova@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-11 18:57:19 +10:00
Dave Reisner
fb9db2df5d makepkg: restore attr merging for write_pkginfo
acc639adf2 removed this, but shouldn't have.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-11 18:57:06 +10:00
Dave Reisner
83d5512bf1 makepkg: avoid nested quoting in string replacement
I suspect this is just wrong -- you never need to quote the replacement
side of a PE. In bash 4.3, this is essentially a no-op, but because of
a bug in bash 4.2, we get embedded quotes as a result of this
replacement. The relevant changelog item in bash is:

  Fixed a bug that caused single quotes that resulted from $'...' quoting
  in the replacement portion of a double-quoted ${word/pat/rep} expansion
  to be treated as quote characters.

But this doesn't apply to us. Let's just drop the excessive quoting...

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-11 18:56:57 +10:00
Allan McRae
9e5e86aa14 makepkg: fix removing static libraries when shared use absolute symlinks
When a shared library uses an absolute symlink for its its .so file, the check
if the shared version of a static library exists fails.  Test for the presence
of a broken symlink too.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-11 18:56:44 +10:00
Mohammad Alsaleh
95da285f56 pkgdelta: Use high compression options offered by xdelta3
* Add -9 which is the highest compression level.
 * Use lzma for secondary compression.

 Decompression speed is largely unaffected as most cycles are consumed
 by xz for re-compression.

 Some numbers:

 clang x86_64 [3.5.0-2.1 to 3.5.0-3]
 17.21MiB      default      (0.73)
 15.67MiB      -9           (0.67)
 13.59MiB      -9 -S djw    (0.58)
 12.01MiB      -9 -S lzma   (0.51)

 inkscape x86_64 [0.48.5-3 to 0.48.5-4]
 02.69MiB      default      (0.21)
 01.64MiB      -9           (0.13)
 01.30MiB      -9 -S djw    (0.10)
 01.01MiB      -9 -S lzma   (0.08)

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:48:59 +10:00
Andrew Gregory
8da9be0955 initialize pointers passed to _alpm_pkg_dup
_alpm_pkg_dup leaves the destination pointer unaltered in case of fatal
errors, so when commits 2f0ca00e and be4198b3 freed the pointer, they
fixed a memory leak on non-fatal errors by replacing it with
a segmentation fault on fatal errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:48:59 +10:00
Andrew Gregory
4060c5c77f be_package.c: fix style violation
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:48:59 +10:00
Allan McRae
0acd794226 add alpm_pkg_get_base() to README
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:59 +10:00
Allan McRae
62d5a71fba Remove testdb
Replaced by pacman -Dk / -Dkk

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:59 +10:00
Allan McRae
aa4c61f999 Document database checking options
The required adding a Database Option section to the pacman man page
and adding more complete documentation for --asdeps and --asexplicit
as well.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:58 +10:00
Allan McRae
e8a3e3d81a Integrate testdb into pacman
The functionality of testdb is now available in pacman. pacman -Dk will
check the local database for consistency, and pacman -Dkk will check the
sync databases.

Note that unlike testdb, you can not specify individual sync databases to
check as sync databases act as a whole and not individually. A single database
can be checked using an alternative pacman.conf file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:58 +10:00
Allan McRae
194dea2de1 Split install reason changing into its own function
Prepare for other functions to be added to the --database option.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:58 +10:00
Allan McRae
fafcbdeb8c Merge branch 'maint' 2015-01-02 21:43:56 +10:00
Jason St. John
89b9e9d1dc Fix typo in a comment in makepkg.conf
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:43:28 +10:00
Dave Reisner
80e6d8a6fe makepkg: avoid expansion of var in arithmetic context
This bombs out when "$trusted" expands to the empty string. We're
better off passing the var by name and letting bash default to "0" when
the var is empty

Fixes: https://bugs.archlinux.org/task/43269

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:43:28 +10:00
Dave Reisner
ca5a2771ae updpkgsums: retain permissions on rewritten PKGBUILD
This could have been easy with something like chown's --reference flag,
but this is GNU specific. Instead, just truncate and rewrite the file.
Our exit trap cleans up after us.

Fixes: https://bugs.archlinux.org/task/43272

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:43:28 +10:00
Allan McRae
39fe2d0e39 Remove outdated fakeroot information from PKGBUILD man page
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:43:28 +10:00
Andrew Gregory
f1e010a5a7 add tap_ prefix to test helper functions
Allows tap.sh to show the line number where the helper function was
called on failures.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-28 13:06:39 +10:00
Andrew Gregory
29c0d8233b use tap.sh for bash tests
tap.sh is a reusable TAP library that handles test counting and provides
useful diagnostic messages on test failures.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-28 13:06:28 +10:00
Allan McRae
4c4890dd1c Clarify "assume installed" error message
The error message on failing to add an "assume installed" entry to the backend
was not clear.  Clarify by making "assume-installed" none translatable and
adding a hyphen to match calling flag.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-28 13:06:15 +10:00
Allan McRae
2759858e8c Merge branch 'maint' 2014-12-28 13:06:04 +10:00
Allan McRae
acc639adf2 Fix .SRCINFO output with architecture specific fields
Do not merge the architecture specific fields when creating a .SRCINFO file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-28 13:05:41 +10:00
Dave Reisner
6356567ae0 makepkg: print the name of the source array being checked
I don't see an easy fix to avoid printing this more than once, so let's
at least differentiate the messaging so that it's more clear what's
going on.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:33 +10:00
Dave Reisner
7c0ff7f4b7 makepkg: call out the source array(s) missing checksums
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:33 +10:00
Allan McRae
763fb3d9e7 Remove logically dead code in _alpm_local_db_write
We can only get to cleanup: through fp being NULL due to fopen failing or
normal execution when fclose is called.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
804688ab6a _alpm_run_chroot: only close working directory if it was opened
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
2f0ca00e55 _alpm_db_add_pkgincache: free potential memory leak
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
60d958c78b Initialize memory to prevent issues when freeing on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
be4198b34e _alpm_recursedeps: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
32413213cb apply_deltas: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
d5e93e895b pacsort: fix memory leak
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
25b492aab6 Merge branch 'maint' 2014-12-27 17:07:04 +10:00
Allan McRae
5221440b6b fix duplication of package sha256sum
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:04:53 +10:00
Dave Reisner
286dc83451 makepkg: fix typo in dep array name
We fixed this up to check architecture specific sources in ec679e09b2,
but fudged the array name in the in_array call.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:04:29 +10:00
Johannes Löthberg
1f1e53c208 libalpm: Add accessors for the base field
This commit adds the necessary accessor functions to get the PKGBASE of
a package, forcing the desc file to be parsed.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Johannes Löthberg
9f527d2de4 libalpm: Parse and write PKGBASEs
This commit adds support to libalpm to parse the pkgbase present in
packages .PKGINFO files, writing the PKGBASE to the %BASE% section of
the local DBs desc files and for parsing it again when loading the local
DB

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Andrew Gregory
fda599df37 add vim modeline to test files
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
21faf1682e mount_point_list: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
2114ef1874 conflict_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
9cf1b2c004 _alpm_runscriptlet: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
88eedef6c6 add_fileconflict: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
52d2ff648d create_tempfile: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
123ecb8e07 _alpm_split_backup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
c6dd581ec5 alpm_dep_from_string: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
27506aba8f _alpm_conflict_dup: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
46459da39b local_db_read: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
895780bd9a _alpm_db_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
87e55a4ee7 _alpm_db_get_pkgcache_hash: check for error when loading pkgcache
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
cd5e4b89f4 _alpm_delta_parse: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
e892234207 _alpm_dep_dup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
f4796c905c pacman/util.c: fix potential memory leak in indentprint 2014-12-24 11:19:29 +10:00
Allan McRae
eac09e1d9f Fix memory leak in ALPM_EVENT_OPTDEP_REMOVAL callback
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
c0d9d26070 build_payload: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
32ebd7ad5d depmiss_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
bf06efaa78 _alpm_delta_dup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:28 +10:00
Evangelos Foutras
eb7cc246c6 checkupdates: include package versions in output
Especially useful now that pacman -Qu will also show the new version.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:28 +10:00
Evangelos Foutras
c9ca363431 checkupdates: show error when fakeroot is missing
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:28 +10:00
Allan McRae
863cfb5808 Improve db upgrade error message
This message is clearer without (another) error prefix.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:28 +10:00
Dave Reisner
d2d00e4543 makepkg: properly correlate checksums for multiple sources
Previously, we used a single boolean value to determine correlation of
sources to checksums. Since the introduction of arch-specific sources,
this is no longer sufficient, as we must ensure that we have checksums
for (potentially) multiple source arrays.

This change inlines the logic of have_sources to build an associative
array of source array names, unsetting them as we discover their
checksums. The error condition then becomes a non-empty correlation
array.

Fixes: https://bugs.archlinux.org/task/43192

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:15:38 +10:00
Evangelos Foutras
c07593c64c Use correct mode bits for the log file (0000 -> 0644)
Following commit 086bbc5 (Use O_CLOEXEC as much as possible when opening
files), the log file would be created by pacman with blank permissions.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:15:25 +10:00
Peter Wu
a1c50a08c9 pacman-db-upgrade: set umask 022
This prevents the database from becoming inaccessible for non-root
users when the script was executed with a umask of 027.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:15:15 +10:00
Allan McRae
325e20dea1 makepkg: download sources for all architectures when making source package
We validated all sources when making a source package, whether or not they
are included in the tarball.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:15:00 +10:00
Allan McRae
23850c7c99 pacman-db-upgrade: be more verbose
People have mentioned that the silent upgrade to DB version 9 when no
adjustments are needed for directory symlinks is confusion.  Always print
the upgrading message.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:14:50 +10:00
Florian Pritz
c8448bb466 makepkg-template: Remove unused printf format string
I'm pretty sure this is some kind of left over stuff that was supposed
to print the filename, linenumber and line content. This is already
done so just remove it.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-22 14:01:43 +10:00
Allan McRae
ec679e09b2 Check architecture specific fields for VCS support
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-22 14:01:34 +10:00
Allan McRae
a7c1b7a914 add VCSCLIENTS to etc/makepkg.conf
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-22 14:01:27 +10:00
Timothy Redaelli
91a56a7072 Fix double spaces in "Running %s as root is not allowed" message
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-21 16:26:45 +10:00
Evangelos Foutras
d107aced37 paclist: fix myver in usage()
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-21 16:26:36 +10:00
Dave Reisner
565c931e2c updpkgsums: add more error checking before replacement
Re-add some paranoia which was inadvertently lost with 768b65e934. In
case 'makepkg -g' fails to generate new sums (e.g. when a remote
resource cannot be fetched), or awk fails to write the new file (i have
no idea when this would happen), bail out with an error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-19 14:31:01 +10:00
Allan McRae
bc6ada0877 Release 4.2.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-19 13:57:21 +10:00
Allan McRae
54db3745d6 Update translations from transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-19 13:53:35 +10:00
Allan McRae
14dc3389fd Update NEWS for pacman-4.2 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-19 11:52:43 +10:00
Allan McRae
c9e9c1ccfd Update README for pacman-4.2
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-19 11:52:02 +10:00
Andrew Gregory
3af0268fdb remove.c: honor inverted patterns in noupgrade
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 22:22:35 +10:00
Andrew Gregory
df36fe2e79 add alpm_option_match_noupgrade
For parity with alpm_option_match_noextract.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 22:22:35 +10:00
Dave Reisner
768b65e934 updpkgsums: drop in-place rewrite hack, use a tempfile
This apparently exposes (what I think is) a subtle bug in cygwin's
handling of subst'd drives. Let's just drop the hackery and use a
tempfile, which should always work.

Also, introduce a proper die() function which replaces previous
hand-rolled error+exit pattern, but which wrote to stdout.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 16:36:18 +10:00
Dave Reisner
16259d728e shut up GCC on -Wmaybe-initialized warnings
Admittedly, these are totally bogus, but a clean build is a happy build.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 16:34:03 +10:00
Dave Reisner
0cd174efd5 makepkg: correctly add changelog files
Before this, we'd see bizzare behavior of:

  -> Adding changelog file (systemd.install)...

And, changelog files in the global section would not be added at all.

The code is clearly wrong here, as it references 'install' within a
loop of 'changelog' and 'install'. Let's use parameter indirection to
ensure that the proper file is identified and added.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 16:33:37 +10:00
Micah Saint Germain
a4b23417f9 Fix pointer declarations to be globally consistent
Refactored inconsistent pointer declarations to better improve consistency
throughout the pacman codebase which will, in turn, increase readability to
the user.

Expected format of a pointer declaration:
`typename *varname`

Signed-off-by: Micah Saint Germain <micah@lexme.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 16:32:55 +10:00
Miguel de Val-Borro
c54af84180 doc/translation-help.txt: Transifex example usage
Replace harcoded language code in example

Signed-off-by: Miguel de Val-Borro <miguel@archlinux.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-08 15:43:20 +10:00
Allan McRae
ed4032a908 pacman-db-upgrade: fix issue with find argument list length overflow
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-26 12:53:44 +10:00
Tobias Powalowski
41c8263ba2 pacman-key: compatibility with gnupg-2.1
GnuPG 2.1 no longer allow empty passphrases by default.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-21 20:54:58 +10:00
Allan McRae
bb878217cd Remove pacsysclean
This script parsed pacman output and was broken by the change to the use
of appropriate units for package sizes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-21 14:13:57 +10:00
Dave Reisner
04bc3a24eb pacsort: parse inputs up front into control struct
This moves most of the parsing work out of the sorting path. The explode
and splitfile functions now call input_new and append input_t structs
to the list of sort candidates instead of raw strings. This lets us
make smarter and easier decisions in the sorting callbacks, which are
now also split into the version and file comparison methods for clarity.

This fixes two bugs:

1) Incorrect ordering with filenames containing epoch in the pkgver
2) Incorrect ordering with package names which are substrings of
each other (e.g. "systemd" and "systemd-sysvcompat").

Performance of the --files mode degrades slightly as a result of this
change, but not unreasonably. Sorting with small inputs (5-10) doubles
in runtime, but larger inputs (4000+) only increase by 20%.

ref: https://bugs.archlinux.org/task/37631

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-20 14:40:25 +10:00
Allan McRae
c23ff87893 checkupdates: do not print ignored packages
FS#41223

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-19 17:09:55 +10:00
Dave Reisner
ef0577e3d5 version: fix memory leak in early return
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-19 14:14:04 +10:00
Allan McRae
3446453c72 Fix translation error and remove empty po files
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-19 14:13:15 +10:00
Allan McRae
193b2b33f8 Update po files to send to Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 15:14:51 +10:00
Allan McRae
db402d6029 Pull translation updates from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 15:12:40 +10:00
Allan McRae
eda65967ec Do not warn about missing files in NoExtract
When checking a packages files, ignore any missing files in NoExtract

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 12:50:56 +10:00
Allan McRae
96e9cf35f1 Add alpm_option_match_noextract
This is useful for frontends testing whether a file is in NoExtract

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 12:31:30 +10:00
Allan McRae
5d11605958 extract_single_file: fix memory leak in error condition
The memory assigned to checkfile was leaked in the error condition.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:26 +10:00
Allan McRae
5d618438c4 _alpm_backup_dup: fix memory leak in error case
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:26 +10:00
Allan McRae
a7298c36fd makepkg: symlink files in noextract into $srcdir
File in noextract should still be symlinked into $srcdir so that they
can be accessed without using $SRCDEST.  Using noextract on VCS files
makes no sense as these are not being extracted, so now this does
nothing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:25 +10:00
Allan McRae
d9aa7025ea Remove logging of NoExtract events
With globbing in NoExtract, these log events can quickly pile up hiding
important information from the log.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:25 +10:00
Allan McRae
8c00dd7341 Fix crash when using external downloader
Commit 9d96bed9 attempts to use the same effective URL for the db and its
signature download.  However, this information is not available when we use
an external downloader, resulting in a crash.

Fall back to the old method when the effective URL is unavailable.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-17 17:13:48 +10:00
Lukáš Jirkovský
4c1f41a7c1 makepkg: svn: update existing sources in srcdir without removing them first.
This matches the behaviour with non-VCS sources. It also allows incremental
builds when subversion is used to obtain sources.

Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-17 14:56:17 +10:00
Andrew Gregory
0d24994934 makepkg: only strip vcs prefixes from front of url
Referenced by FS#41811

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-17 13:02:12 +10:00
Andrew Gregory
6949012590 makepkg: do not strip bzr+ from bzr+ssh urls
bzr does not recognize bare ssh:// urls.

Fixes FS#41811

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-17 13:01:43 +10:00
Allan McRae
db2562113b makepkg: bzr: update existing sources in srcdir without removing them first.
The local changes are discarded when updating. This matches the behaviour
when non-VCS sources are used. It also allows incremental builds.

This also changes the checkout during bzr source "extraction" to a heavyweight
checkout so that pulling a specific revision does not alter the original
download.

Original-work-by: Lukáš Jirkovský <l.jirkovsky@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-17 12:58:06 +10:00
Lukáš Jirkovský
be3ce88bb2 makepkg: hg: update existing sources in srcdir without removing them first.
The local changes are discarded when updating. This matches the behaviour
when non-VCS sources are used. It also allows incremental builds.

Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 18:28:47 +10:00
Lukáš Jirkovský
f66ae5334e makepkg: checkout a revision specified in SVN fragment in download_svn.
Previously the sources were dowloaded in HEAD revision in the download_svn().
If a specific revision was requested in fragment, the code was updated to that
revision in extract_svn(). However, because SVN is a centralized system,
this means that the changed sources has to be downloaded again.

By moving the fragment handling to download_svn(), we get the correct revision
without having to download it later in extract_svn().

Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 17:28:22 +10:00
Lukáš Jirkovský
f6b3c9d803 makepkg: git: update existing sources in srcdir without removing them first.
The local changes are discarded when updating. This matches the behaviour
when non-VCS sources are used. It also allows incremental builds.

Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 16:09:27 +10:00
Allan McRae
ecf0e37fc5 makepkg: improve stripping pkgdesc of whitespace for .PKGINFO
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 15:53:16 +10:00
Dave Reisner
6029a77ac0 makepkg: introduce .SRCINFO files for source packages
Similar to .PKGINFO, .SRCINFO provides structured metadata from the
PKGBUILD to be included with source packages.

The format is structured such that it contains a "pkgbase" and one to
many "pkgname" sections.  Each "pkgname" section represents an "output
package", and inherits all of the attributes of the "pkgbase" section,
and then can define their own additive fields.

For example, a simple PKGBUILD:

  pkgbase=ponies
  pkgname=('applejack' 'pinkiepie')
  pkgver=1.2.3
  pkgrel=1
  arch=('x86_64' 'i686')
  depends=('friendship' 'magic')

  build() { ...; }

  package_applejack() {
    provides=('courage')

    ...;
  }

  package_pinkiepie() {
    provides=('laughter')

    ...;
  }

Would yield the following .SRCINFO file:

  pkgbase = ponies
  	pkgdesc = friendship is magic
  	pkgver = 1.2.3
  	pkgrel = 1
  	arch = x86_64
  	arch = i686
  	depends = friendship
  	depends = magic

  pkgname = applejack
  	provides = courage

  pkgname = pinkiepie
  	provides = laughter

The code to generate this new file is taken a project which I've been
incubating[0] under the guise of 'mkaurball', which creates .AURINFO
files for the AUR. AURINFO is the exactly same file as .SRCINFO, but
named as such to make it clear that this is specific to the AUR.

Because we're parsing shell in the packaging functions rather than
executing it, there *are* some limitations, but these only really crop
up in more "exotic" PKGBUILDs. Smoketesting[1] for accuracy in the Arch
repos yields 100% accuracy for [core] and [extra]. [community] clocks in
at ~98% accuracy (.3% difference per PKGBUILD), largely due to silly
haskell packages calling pacman from inside the PKGBUILD to determine
dependencies. [multilib] currently shows about 92% accuracy -- a
statistic which can be largely improved by utilizing the recently merged
arch-specific attribute work. This is also a smaller repo so the numbers
are somewhat inflated. In reality, this is only a .8% variance per
PKGBUILD.

Together, we can make PKGBUILD better.

[0] https://github.com/falconindy/pkgbuild-introspection
[1] https://github.com/falconindy/pkgbuild-introspection/blob/master/test/smoketest

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 15:41:50 +10:00
Dave Reisner
bd746568f6 makepkg: simplify epoch handling
We can avoid setting a default value for epoch since we intend to mean
unset and "0" as the same thing. This is also a more consistent default
as the display of epoch=0 is no epoch at all in the full package
version.

The extra paranoia in get_full_version can be removed due to lint_epoch
guarding against non-integer values of epoch.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 15:35:12 +10:00
Dave Reisner
03aa44a3ec makepkg: ignore empty global attributes in extraction
This bug isn't currently exposed by any of the existing codepaths, but
an upcoming patch to introduce SRCINFO files to makepkg will expose
this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 13:46:51 +10:00
Florian Pritz
f77933ea1e Add --assume-installed to shell completion
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-09 13:46:23 +10:00
Florian Pritz
9594f513a4 Add --assume-installed to pacman --help
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-05 11:01:09 +10:00
Dave Reisner
37aeb43644 makepkg.8: remove superfluous "::" in envvar description
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-05 11:00:43 +10:00
Dave Reisner
de442b6867 bash_completion: add --noarchive to makepkg's completions
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-05 10:59:57 +10:00
Dave Reisner
167a598265 updpkgsums: avoid exec'ing awk, so the trap actually works
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-05 10:59:30 +10:00
Andrew Gregory
bd744d067d add pacman-db-upgrade-v9.py to check_SCRIPTS
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-04 20:11:18 +10:00
Andrew Gregory
8cd41ec62b tests/pacman-db-upgrade-v9: set additional paths
--config does not respect root, causing pacman-db-upgrade to read the
local pacman.conf rather than the one in the test root.

Also add a rule to ensure the ALPM_DB_VERSION file is actually being
created.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-04 20:11:18 +10:00
Andrew Gregory
4114e25df1 pmtest: make test paths easily available to tests
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-04 20:11:18 +10:00
Andrew Gregory
1e0b2f6629 pacman-db-upgrade: fix --config option typo
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-04 20:11:18 +10:00
Eric Schultz
566dc23357 Exit with 0/SUCCESS if there are no packages to remove
Previously the lack of candidate packages was considered an error
and return 1/FAILURE but really this isn't an issue. Also, for
systemd (and others) this flagged the instance as having failed
for no good reason.

Signed-off-by: Eric Schultz <eric@schultzter.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-04 20:10:29 +10:00
Dave Reisner
75c80caebc makepkg.8: fix typo in reference to other flag
it's --syncdeps, not --syndeps
2014-10-19 21:36:19 +10:00
Andrew Gregory
82208c0239 testdb: ignore ALPM_DB_VERSION
Replaces the test for hidden files which appears to be leftover from
2e431e1cc before sync db checking was moved to a separate function.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 21:32:46 +10:00
Dave Reisner
9d4d81783d paccache: avoid spurious blank line written to stderr
this is just stylistic formatting, so write it to stdout.

ref: https://bugs.archlinux.org/task/42389

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 21:32:22 +10:00
Christian Hesse
d649dc669d dload: mark final_url as const
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 20:48:40 +10:00
Miguel de Val-Borro
91876c21f1 doc/translation-help.txt: Removed out-of-date paragraph
Signed-off-by: Miguel de Val-Borro <miguel@archlinux.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 20:48:18 +10:00
Miguel de Val-Borro
44bcb73327 doc/translation-help.txt: Minor rewording of Transifex usage
Updated as per Allan's suggestion and fixed Transifex URLs.

Signed-off-by: Miguel de Val-Borro <miguel@archlinux.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 20:48:08 +10:00
Dave Reisner
d6785a5726 makepkg: always look for sources in source=()
This regression snuck in during some reviewing of 963f7fe02f
(arch-specific sources). We must always check the source=() array for
sources.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 20:47:01 +10:00
Christian Hesse
d8f395fb56 dload: unlink file on filesize exceeded error
On filesize exceeded error pacman leaves a .part file in cache dir,
resulting in this error on next try:

error: failed to commit transaction (wrong or NULL argument passed)
Errors occurred, no packages were upgraded.

Unlink the file on error to avoid this.
2014-10-16 23:19:52 +10:00
Christian Hesse
11dff8a50e dload: use better error message on exceeded file size
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-16 23:19:52 +10:00
Christian Hesse
9d96bed9d6 be_sync: use effective URL for db file signature download
If download server is dynamic mirror chances are that db file download
and db file signature download are redirected to different mirrors,
resulting in invalid signature.
This uses effective URL for db file signature download and makes the
files always match.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-16 22:45:47 +10:00
Dave Reisner
a0cfed7df2 makepkg: reorder args to pkgbuild_get_attribute for consistency
In all other cases, this code gets the outvalue from the final
parameter.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 23:22:09 +10:00
Andrew Gregory
627ede8779 add pacman-db-upgrade test
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 15:10:37 +10:00
Andrew Gregory
c1d6cec2e2 sync.c: download packages before starting commit
download_files sets the transaction state to STATE_DOWNLOADING.
Modifying the state after it has already been set to STATE_COMMITTING
created a brief window where SIGINT would fail to interrupt the process
and caused interrupted downloads to result in a 'transaction started'
message in the log with no matching transaction end.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-13 14:28:29 +10:00
Andrew Gregory
42c859e4cc pmtest: allow tests to specify test binary
Adds a cmd property to tests (defaults to pacman) which is resolved
using directories specified with --bindir (defaults to PATH).  The
ability to manually specify a particular binary is preserved in order to
allow running individual tests with differently named binaries such as
lt-pacman.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Andrew Gregory
01beca5df7 pacman: add --confirm option
--confirm cancels the effect of a previous --noconfirm.
This makes it easier for scripts to default to --noconfirm
but allow users to override it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Andrew Gregory
7ddc967d7c pmtest: allow tests to specify db version
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Andrew Gregory
6dd593c293 pmrule: make backup file test more robust
This prevents an exception in the event backup entries are not in the
correct format and brings the test in line with alpm's backup parsing
which splits on the last tab rather than the first.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Andrew Gregory
19c3179b7e pmdb: include directories in package file lists
Needed for checking directories with PKG_FILES.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Dave Reisner
62c11e450a makepkg: simplify attr matching in extract_function_var
Interesting attributes created with 'local' or 'declare' won't be
surfaced in .PKGINFO, so we shouldn't try to look for them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:26 +10:00
Dave Reisner
3f0303dc92 makepkg: show full fingerprint on pgp failure
Rather than implementing suffix matching, which might clash, let's just
print the full fingerprint of the err'ing key so that the user can
copy/paste it into validpgpkeys. Also, make it clear in the manpage
that validpgpkeys needs full fingerprints, and nothing else.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:19 +10:00
Dave Reisner
926d998a75 Revert "makepkg: allow less than the full fingerprint in validpgpkeys"
This reverts commit 50296576d0.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:09 +10:00
Allan McRae
faf0246437 There are not hooks!
Refer to install scripts as scripts and not hooks.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-10 10:02:05 +10:00
Andrew Gregory
5002227296 pacman-db-upgrade: do not mangle file lists
grep'ing out blank lines and sorting output thoroughly breaks any file
lists with %BACKUP% entries which must be separated from the file list
by a blank line.  Adds a custom function to ensure that all paths
printed are non-empty and unique.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-06 19:00:34 +10:00
Olivier Brunel
1e3c088c2e alpm: Fix wrong xferred/total sizes when resuming downloads
When a package is already partially downloaded in the cache, its download
size will only be of what's left to be downloaded. Since pkg->download_size
is what's used when calculating the total download size for the totaldl
callback, same thing apply.

However, the download progress callback was including this initial size,
which would thus lead to invalid values (and percentage) used in frontends.
That is, the progress bar could e.g. go further than 100%

In the case of pacman, there is a sanity check for different historical
reason (44a57c89), so before the possible "overflow" was noticed, the total
download size/progress reported was wrong. Once caught, the TotalDownload
option was ignored and it would use individual file download values as
fallback instead.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-02 22:50:17 +10:00
Miguel de Val-Borro
ca8319aec9 doc/translation-help.txt: Remove link to tutorial on sarovar.org
The website sarovar.org has been shut down and the tutorial is
not relevant any more.

Signed-off-by: Miguel de Val-Borro <miguel@archlinux.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-02 22:40:17 +10:00
Andrew Gregory
7ee01c8666 _alpm_key_in_keychain: cache known keys
Implements FS#38042

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-01 09:12:54 +10:00
Andrew Gregory
aec4241af2 check_keyring: skip keys known to be missing
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-01 09:10:08 +10:00
Andrew Gregory
e123e04741 remove retry check from signature validation
The retry path was removed by
4ccf16dff5

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-01 09:03:31 +10:00
Florian Pritz
04e8048725 Add --assume-installed option
This allows to ignore specific dependencies.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30 22:33:26 +10:00
Florian Pritz
4e263f24c6 libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_free
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30 22:20:53 +10:00
Florian Pritz
13c9745302 deps.c: split _alpm_depcmp into _alpm_depcmp_provides
This allows to reuse the provision checker for a simple list of
provisions without a package.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30 22:07:11 +10:00
Andrew Gregory
b275e5184e table_display: only check width when non-zero
A width of 0 indicates that either pacman is not attached
to a tty or the user does not want line wrapping.  Either
way pacman should not fall back to the basic display.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-30 14:05:13 +10:00
Andrew Gregory
dc339faf6a avoid line wrapping if not in a tty or COLUMNS=0
Scripts that parse pacman's output (like pacsearch) generally do not
want wrapped lines.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-30 14:04:23 +10:00
Dave Reisner
50296576d0 makepkg: allow less than the full fingerprint in validpgpkeys
I found this feature confusing, and the documentation wasn't any help.
It was pointed out to me on IRC that validpgpkeys expects full
fingerprints, and won't accept shorter forms. This makes the
documentation insufficient, and the variable name itself misleading.

This patch bolsters the documentation to explain more about what the
contents should be, and implements suffix matching to allow matching on
shorters fingerprint suffices. Now, when makepkg tells you that a key
ID isn't valid, it's sufficient to manually check the key ID against
the known good ID, and add it as is to validpgpkeys.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30 14:00:43 +10:00
Dave Reisner
60c1f2857b makepkg: move negation in inequality comparisons
This commit changes the few remaining instances of:

  [[ ! $foo = "$bar" ]]

to the more common:

  [[ $foo != "$bar" ]]

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30 12:57:25 +10:00
Maxim Andersson
699937e94d paccache: parse_filename bug fix
Filenames got parsed wrongly, causing whitelist- and blacklist-checks to
always return false. Caused by 8122fae51a when full path names to pkgs
were introduced.

Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com>
2014-09-30 12:57:05 +10:00
Dave Reisner
cb9489119e makepkg: abort if we can't add install/changelog to package 2014-09-30 12:56:57 +10:00
Dave Reisner
235562a85e updpkgsums: update to recognize arch-specific sources
This change reveals a bootstrapping bug -- since we call the bare
"makepkg" and rely on PATH lookup, we might not have a makepkg which
can generate architecture-specific checksums.
2014-09-30 12:56:21 +10:00
Dave Reisner
963f7fe02f PKGBUILD: add support for arch-specific sources
This implements support for declarations such as:

  arch=('i686' 'x86_64')
  ...

  source=("somescript.sh")
  source_i686=("http://evilmonster.com/i686/ponies-9001-1.i686.bin")
  source_x86_64=("http://evilmonster.com/i686/ponies-9001-1.x86_64.bin")

  md5sums=('d41d8cd98f00b204e9800998ecf8427e')
  md5sums_i686=('e4ca381035a34b7a852184cc0dd89baa')
  md5sums_x86_64=('4019740e6998f30a3c534bac6a83f582')

Just the same as the "untagged" sources, multiple integrity algorithms
are supported. The manpage is updated to reflect support for these
suffices.

This commit also refactors download_sources slightly:

1) to use the otherwise preferred convention of lowercase local variable
names, and to make the handling of $1 more clear.
2) rename the "fast" parameter to "novcs", to make it more clear what
this token does.
3) add a new possible token "allarch" to ensure that download_sources
will fetch all sources, for all architectures.
2014-09-30 12:56:21 +10:00
Dave Reisner
51353edc61 makepkg: break out checksum generation to its own function
This also fixes a "bug" in which a PKGBUILD without any source array
would generate "md5sums=()". While not technically wrong, we can easily
do better and emit nothing at all.
2014-09-30 12:56:21 +10:00
Dave Reisner
a3d7230e4d makepkg: break out check_checksums to reasonably sized functions 2014-09-30 12:56:21 +10:00
Andrew Gregory
b52ed49d75 Revert "Remove log_cb, add ALPM_EVENT_LOG instead"
Moving logging to the event callback caused warnings
under clang due to non-literal format strings and
silenced all log messages when --print was used.

This reverts commit cd793c5ab7.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>

Conflicts:
	lib/libalpm/alpm.h
	src/pacman/callback.c
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30 12:56:21 +10:00
Johannes Löthberg
31b9862600 pacman.c: Add -gg, -ii, and -yy to help summary
The sync help summaries was missing the information about:
* -gg: View all groups and members
* -ii: View extended information
* -yy: Force refresh even if DBs are up to date

Fixes FS#41388.

Original-work-by: Earnestly <zibeon@gmail.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 23:29:03 +10:00
Andrew Gregory
24e0bd215c pacman: set SA_RESTART for signal handler
Calling a signal handler interrupts some functions, most notably read()
and therefore fgets().

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-23 21:43:16 +10:00
Andrew Gregory
c792262b13 wrap fgets to retry on EINTR
The read() underlying fgets() can be interrupted by a signal handler
causing fgets() to return NULL.  Before we started handling SIGWINCH,
the odds of interrupting a read were low and typically resulted in
termination anyway.  Replace all fgets calls with a wrapper that retries
in EINTR.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-23 21:43:16 +10:00
Dave Reisner
9c066dff43 makepkg: disallow values of 'arch' which might be problematic
We rely on values in the arch array to be valid as part of variable
names, so extend the arch lint check to catch this.

This also cleans up lint_arch to restrict the use of "lint" only to the
package-specific architecture checks. It previously had an odd
declaration with a conditional expansion that would never be true.
2014-09-23 21:43:16 +10:00
Dave Reisner
85c055da73 makepkg: let --source imply --ignorearch
Since source package creation is architecture independent, we should
ignore architecture-dependent behaviors such as the lint check which
will halt execution when the host machine is not a supported arch.

https://github.com/falconindy/pkgbuild-introspection/issues/15
2014-09-23 21:43:16 +10:00
Dave Reisner
e1f6fe652d makepkg: use correct terminology
unix has no "folders".
2014-09-23 21:43:16 +10:00
Wolfgang Bumiller
eab8cf6241 replace --reference on chmod/chown commands
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:16 +10:00
Andrew Gregory
f0c351b3fa alpm.h: remove outdated pkg_get_backup doxygen
alpm_pkg_get_backup hasn't returned strings since
54ef162a1a in 2011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:16 +10:00
Allan McRae
d02efd2f20 Check the version of the local database during validation
When we check the database version directly, there is no longer a
need to scan for depends files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:05 +10:00
Allan McRae
1660ed3cf9 Add version file to empty local database
If a user manually creates the local database directory, or has an empty
local database for some other reason, we silently add a version file

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:27:11 +10:00
Allan McRae
7e9ad22ac2 Add version file when creating local database directory
The version of the local pacman database is stored in its root in the file
ALPM_DB_VERSION.  The version is starting at 9, corresponding to the
next libalpm library version.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:26:55 +10:00
Allan McRae
d3f5ab0e70 Create local database directory if it is missing
This means that a missing local database becomes an error (as it
should be immediately created).  Note this only creates the "local"
directory and not its parent, which is checked for during locking.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:25:45 +10:00
Andrew Gregory
793b9c3b42 Extend database upgrade script to handle alpm db version 9
Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:25:44 +10:00
Andrew Gregory
e4773b1b82 pacman-db-upgrade: use pacman-style options
* convert dbpath from argument to option
* add --config and --root options
* read dbpath and root from config file
* if root is set but not dbpath, dbpath is set relative to root

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-16 20:05:42 +10:00
Andrew Gregory
8bf2c753f5 fix improper FREELIST calls
* conflicts need to be freed with alpm_conflict_free
* sync dbs need to be unregistered and are handled by alpm_release

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-16 20:03:33 +10:00
Dave Reisner
d9cf14ff1d updpkgsums: use a throwaway build dir
This prevents updpkgsums from potentially dirtying an otherwise pristine
directory (likely $PWD) when makepkg creates the srclinks.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:33:07 +10:00
lolilolicon
ee207d7c7b makepkg: do not eval dlcmd
This eval enables the following in a PKGBUILD to "just work":

  source=('$pkgname-$pkgver.tar.gz'::'https://host/$pkgver.tar.gz')

This has at least two problems:

- It violated the principle of least surprise.
- It could be a security issue since URLs are arbitrary input.

Instead, expand the dlagent command line into an array, replace the %o,
%u place holders, and run the resultant command line as is.

Embedded spaces in the DLAGENTS entry can be escaped with a backslash.

Fixes FS#41682

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:32:29 +10:00
William Giokas
95e1a1ef82 makepkg: Allow using sources with :: in them
Git has the ability to use helper applications for interfacing with hg,
and from what we had before, the following url::

  foo::git+hg::http://foo.bar/foobar

would get converted to something along the lines of:

  filename: foo
  URL: http://foo.bar/foobar

and the 'git+hg' part would essentially be ignored when it's getting set
up in the 'get_protocol' and 'get_downloadclient' functions. With this
patch it is possible to have a source link with '::' in it, however it
is not possible to have a filename with '::', which is the current
behavior.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:30:54 +10:00
Dave Reisner
38b6de937c paccache: read default cachedir from pacman.conf
Implements FS#40738.
2014-09-15 09:27:21 +10:00
Maxim Andersson
8122fae51a paccache: add support for multiple cachedirs
Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com>
2014-09-15 09:27:07 +10:00
Dave Reisner
b00269d9c8 PKGBUILD(5): arch-specific fields are always additional
Change e10775340 should have included this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:26:47 +10:00
Allan McRae
879e4665c4 pacman-key: stricter parsing for -verify
Prevents trust being spoofed by using TRUST_FULLY in the signatory's name
or in an added notation.

Fixes FS#41147.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 17:29:08 +10:00
Jason St. John
3e19cd366a pkgdelta(8): Fix broken example of --min-pkg-size with human-readable values
The example for human-readable values must not contain a space between
the value and the unit; otherwise, pkgdelta will not recognize the
command options and will error out.

In prose, however, there should be a space between the value and the
unit.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:19:28 +10:00
Jason St. John
ab07dfdeb9 man: Improve grammar and add missing single quotes around command options
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:18:59 +10:00
Jason St. John
37634d22e5 man: Use uniform line spacing between sections
Remove blank lines immediately following section headings.
Ensure two blank lines before the start of a new section.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:09:33 +10:00
Jason St. John
db14815f46 pacman(8): Improve grammar and quoting
Notable changes:
* Add double quotes around printf-like formatting options for "--print-format"
* Add a missing backslash in '--force'

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:08:41 +10:00
Olivier Brunel
99a5017f55 Fix loading invalid package
In 5acfa65f when adding a new variable (hit_mtree), the initialization of a
variable (config) was dropped, which could lead to loading invalid package
files, i.e. files that aren't archive (no metadata loaded) would return a new
alpm_pkg_t with everything set to 0/NULL.

Depending on the operation/use of the package, this could lead to segfault.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:08:41 +10:00
Dave Reisner
17ed9eb734 makepkg: replace bare eval with var extraction functions 2014-08-08 13:44:40 +10:00
Dave Reisner
2b556d89de PKGBUILD: handle arch specific attributes
This introduces support for architecture-specific conflicts, depends,
optdepends, makedepends, replaces, and conflicts by appending "_$CARCH"
to the array name. For example, in the global section:

  arch=('i686' 'x86_64')
  depends=('foo')
  depends_x86_64=('bar')

This will generate depends of 'foo' and 'bar' on x86_64, but only 'foo'
on i686. Moreover, this is supported in the package functions with the
same heuristics as the generic names, e.g.

  ...
  arch=('i686' 'x86_64')
  depends=('foo')
  ...

  package_somepkg() {
    depends_x86_64=('bar')

    ...
  }

Again, will cause x86_64 to have depends of 'foo' and 'bar', but only
'foo' for i686.
2014-08-08 13:44:25 +10:00
Dave Reisner
cbd6c300b5 makepkg: refactor check_sanity, give it some sanity of its own
Break apart each of the blocks into their own separate functions. And,
instead of the hand crafted eval statements, reuse the logic from
pkgbuild-introspection[0] to abstract away the complexities of parsing
bash.

This commit fixes at least 3 bugs in check_sanity:

1) The wrong variable is shown for the error which would be thrown
when, e.g.  pkgname=('foopkg' 'bar^pkg')
2) The "arch" variable is not sanity checked when the PKGBUILD has
an arch override, but only one output package.
3) https://bugs.archlinux.org/task/40361

Lastly, there's some string changes here which should help to clarify
a few errors emitted in the linting process.

[0] https://github.com/falconindy/pkgbuild-introspection
2014-08-08 13:44:00 +10:00
Allan McRae
8d5d7f6761 Update PKGBUILD documentation for removed override options
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-08 13:41:27 +10:00
Dave Reisner
8a02abcf19 makepkg: disallow pkgver/pkgrel/epoch overrides in packages
This is a confusing feature, and no one uses it.
2014-08-08 13:40:00 +10:00
Dave Reisner
b694d84554 remove --destination-dir argument from a2x options
This option is only for HTML output, and we're building manpages here.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-08 13:35:41 +10:00
Allan McRae
1431d244f7 Add Andrew to maintainers list.
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 16:18:18 +10:00
Andrew Gregory
574e45df28 trans_commit: log beginning and end of transaction
This makes it clear whether a transaction successfully completed and
allows log parsers to group related actions.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Ryo Munakata
7c75564af9 filecache_find_url: dereference the 'filebase' pointer
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
2025279eb6 replace strdup with STRDUP
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
d981f93f18 sync.c: fix style violations
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
4ccf49d3e7 pacman.c: simplify stdin parsing
Incorporate memory exhaustion and end-of-stream
checks into the main loop.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
0bf4ae726d handle_unlock: log error when lock file is missing
Problems due to concurrent running instances of pacman can be difficult
to diagnose.  Log a warning to make it more obvious that that's what
happened, that it's a bad idea, and hopefully encourage people who do
things like removing the lock file to run pacman from an install script
to at least be courteous enough to put it back when they're done.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
03b9bf08ac handle_unlock: log lock removal failure
Rather than have individual callers log failure, just
do it directly in _alpm_handle_unlock.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
7f1360b440 signing.c: remove useless error check
CHECK_ERR checks gpg_err which is a local variable.  Calling
gpg_op_import_result cannot modify it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
f4992960ad deps.c: use alpm_list_find_ptr
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
0c43198ee0 dep_graph_init: filter ignored packages by name
Ignored packages are from the transaction remove list which consists of
duplicated packages so a direct pointer comparison is not appropriate.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
22e478d203 pactest: delay test object creation
The actual test object is only used to run the test.  Storing test cases
as strings limits the test object scope and allows it to be garbage
collected, reducing memory usage when multiple tests are run.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
85c80542a5 pactest: only snapshot needed files
Only a few of our tests need file snapshots at all and most of them only
need a few files.  Taking snapshots of the entire test environment for
every single test is a massive waste.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
32413ad44b handle: factor out string list option handling
Consolidates repeated code and replaces dangerous
strdup calls with STRDUP.

Also fix a couple variables named "pkg" that
refer to file paths.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Allan McRae
dce82f9d19 makepkg: skip dependency checking with --verifysource
Dependencies are now handled with --nobuild unless specificially skipped.
Using --verifysource will skip dependency checks unless --syncdeps is
specified.

Fixes FS#35057 and FS#36999.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Allan McRae
7e87614665 makepkg: ensure vcs download tool are installed when required
Add an array VCSCLIENTS to makepkg.conf that matches vcs source protocols
to the package containing the software needed for handling the source.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:56 +10:00
Dave Reisner
fbb0945bfb makepkg: improve check and error message for buildfile location
The documentation very clearly states that the buildfile has to be in
$PWD, but the error thrown by makepkg reference some mysterious "build
directory". Simplify this check so that we more directly check that the
file being referred to is in fact in our $PWD. Revise the error message
when the check fails to more plainly point out the problem.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00
Andrew Gregory
9506409c3f sync_prepare: remove useless check for replacers
Since 017184fa, alpm_sync_sysupgrade will not add both a replacement and
a literal upgrade to the transaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00
Andrew Gregory
71da296d01 check_pkg_fast: check file type
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory
c3835c157a check_file_exists: replace lstat with llstat
Paths are constructed directly from package file lists and may contain
trailing slashes, causing lstat to dereference symlinks.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory
bbeced26f6 llstat: modify path in place
This makes llstat's signature differ from lstat's, but we never actually
use it on a const string and this saves a large number of strdup's.
This also allows stripping multiple trailing slashes and corrects a bug
where calling llstat on "/" would result in calling lstat on an empty
string.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory
e8de265f80 move _alpm_lstat into util-common
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory
0e2db97a42 add test for file type check with -Qk
If a directory has been replaced by a symlink, -Qk currently stats the
symlink target rather than the symlink itself and doesn't check that the
actual file type matches the package file list.  This will make it
difficult to discover errors once 4.2 is released and replacing
directories with symlinks is no longer supported.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Allan McRae
79548e0d78 pacdiff: allow DIFFPROG to contain commandline options
Also use 'vim -d' as default diff viewer.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00
Andrew Gregory
73717f89df pactest: check for tests before environment setup
Setting up the temporary directory and environment is pointless if there
are no tests to run.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:31 +10:00
Andrew Gregory
6650c43fca pactest: check for pacman binary before running
Using fakeroot or fakechroot as the command with subprocess.call
prevents the detection and reporting of a missing pacman binary.  Some
tests even pass when run with a non-existent binary.  Checking manually
allows us to provide a meaningful error message and prevent the false
positives.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:31 +10:00
Andrew Gregory
0c5e80c3b4 pactest: parse options before environment setup
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:31 +10:00
Johannes Löthberg
80eca94c8e makepkg: Respect XDG_CONFIG_HOME
Add support for following the XDG Base Directory Specification when
reading the user-specific configuration file.

If no $XDG_CONFIG_HOME/pacman/makepkg.conf file exists we fall back to
sourcing $HOME/.makepkg.conf

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

[Allan] Note XDG_CONFIG_HOME takes priority.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:31 +10:00
Andrew Gregory
0e18cefe38 filelist_intersection: manually compare paths
Prevents the need to modify paths, removing strndup as an unchecked
point of failure, and lengths only need to be calculated if the paths
match.

Also removed an old comment regarding directory/symlink compatibility.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:31 +10:00
Allan McRae
300dd62e0a Add validpgpkeys to PKGBUILD prototypes.
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-07-01 14:50:19 +10:00
Allan McRae
7305768d54 makepkg: handle "epoch=" in PKGBUILD with pkgver function
After resourcing the PKGBUILD in update_pkgver(), set the epoch to 0
if it is empty.  Also adjust the get_full_version function to be more
robust if epoch somehow still is empty.

Fixes FS#41022.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29 17:15:23 +10:00
Andrew Gregory
e0a7682607 use monotonic clock for progress updates
gettimeofday is susceptible to backwards system time adjustments,
skewing or altogether breaking progress output.  For the sake of
platforms that lack clock_gettime support, gettimeofday is retained as
a fallback.

Fixes FS#36983

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29 11:14:42 +10:00
Christian Hesse
e05fd5e060 libalpm: check for valid public key algorithm 2014-06-29 11:12:36 +10:00
Dave Reisner
357b9a24a9 cache terminal size, add SIGWINCH handler to reset
Refactoring getcols, yet again. We do the following:

1) Introduce a static global in src/pacman/util.c
2) getcols always prefers this cached value, but will derive it from
the COLUMNS environment var, the characteristics of stdout, or a sane
default (in that order).
3) Introduce a SIGWINCH signal handler to reset the cached value,
meaning we only call ioctl when we don't know the value.

On my machine, pacman -Syy goes from ~4300 ioctl calls to 3.
2014-06-29 11:04:17 +10:00
Allan McRae
07647d3d43 Revert refactoring in fa0c1e14
This will cause the code to break as soon as we handle another signal such
as SIGWINCH...

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29 10:59:46 +10:00
Silvan Jegen
fa0c1e1419 pacman: Correct signal handler comment and refactor
One of the comments for this function is out of sync with the code.
Since the code exhibits the more sane behavior of treating SIGINT and
SIGHUB the same way (by not exiting pacman when there is a commit in
flight) we adjust the comment.

Given this code flow, the if/else statements can be simplified somewhat
as well.

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 15:53:18 +10:00
Olivier Brunel
8dbb80cfe9 events: Make alpm_event_t an union of all event-specific struct
Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 13:57:18 +10:00
Olivier Brunel
f1fadecfb3 Update the question callback
Much like with events, instead of using a bunch of void* arguments for
all questions, we now send one pointer to an alpm_question_t union.
This contains the type of question that was triggered.

With this information, a question-specific struct can be accessed in
order to get additional arguments.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 13:52:15 +10:00
Olivier Brunel
d06d993d56 alpm.h: Move alpm_errno_t definition up
Because for the new question types, we'll need to use alpm_errno_t let's
move its definition up.

Of course to do so, we also need to move that of alpm_handle_t as well, so move
all opaque structures on top.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 13:44:51 +10:00
Hong Shick Pak
7b41952bfc Move break to a new line for consistency
This was the only break that didn't have its own line in the function
parsearg_query.

Signed-off-by: Hong Shick Pak <hong@hspak.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-23 22:35:21 +10:00
Allan McRae
537a335cc7 Use C locale for bsdtar calls during package creation
This ensures packages build on a UTF-8 locale system with non-ASCII character
names can be installed on non-UTF-8 systems.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-12 12:50:15 +10:00
Johannes Löthberg
9ff6dc93af makepkg: Remove redundant sig generation comment
Remove the comment above the signature generation command as the command
is self explanatory and no longer does what the comment says.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-10 14:27:27 +10:00
Florian Pritz
d920e7053c Add test case for the perl 5.20 dependency breakage
This test currently fails.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-10 14:24:45 +10:00
Allan McRae
b9f98ae97c Add compatibility with gpgme-1.5.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-02 10:31:25 +10:00
Allan McRae
4d65332ccd Clarify that -Ql prints a file list
FS#40234

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-25 14:38:35 +10:00
Andrew DeMaria
235ce32563 makepkg: pass "--nocolor" to pacman
FS#39982.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-25 14:06:58 +10:00
Allan McRae
2401468f51 makepkg: Force buildscripts to be in startdir
We expect all source file to lie in $startdir. However, using
"makepkg -p <buildscript>" can currently allows people to specify buildscripts
in other directories. This results in confusion about where other sources
should lie (in startdir or in the directory that the buildscript is in).
Explicitly disable using -p for files in other directories to avoid this issue.

Fixes FS#40293.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-25 13:53:19 +10:00
Allan McRae
ec01a22f7d Do not check makepkg-wrapper for standard options
Fixes "make distcheck".

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-23 16:02:18 +10:00
Thomas Bächler
d39d3b3a09 makepkg: Introduce validpgpkeys array
If validpgpkeys is set in the PKGBUILD, signature checking fails if
the fingerprint of the key used to create the signature is not listed
in the array.

The key's trust value is ignored.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-23 15:31:00 +10:00
Thomas Bächler
d174cc8943 makepkg: Treat a signature from an untrusted key as an error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-23 15:31:00 +10:00
Thomas Bächler
34ae6ce4e5 makepkg: Use read to parse status file during signature verification.
Instead of invoking grep multiple times, parse the status file once.

This refactoring also changes the behvaiour when signature verification
fails due to a missing public key: It is now an error instead of a
warning.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-23 15:30:54 +10:00
Dave Reisner
7a5e41925f dload: avoid using CURLOPT_FAILONERROR
Use of this flag causes connections to be closed on 404s -- a common
occurrence when your config sets DatabaseOptional. Handle the error
gracefully, so that the connection can be reused.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-22 15:52:22 +10:00
Florian Pritz
b929e74f2e util: Use off_t instead of int for size values
Old output:
> Total Installed Size:  -1527.44 MiB

Fixed:
> Total Installed Size:  2568.56 MiB

Bug introduced in 7b8f8753b1.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-22 15:50:20 +10:00
Andrew Gregory
060d06d2f7 remove.c: downgrade TRANS_DUP_TARGET to warning
Matches the behavior for sync packages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-07 14:14:41 +10:00
Andrew Gregory
00fbdabc55 pactest: treat arguments as files instead of globs
glob() returns an empty list if input does not match any files, causing
non-existent test files to be silently skipped.  Treating arguments as
files causes pactest to immediately bail out with an appropriate error
message on non-existent files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-04 16:20:11 +10:00
Andrew Gregory
80d3709e65 pmdb.py: change siglevel name to Required
"Always" is not a valid siglevel.  sign002.py was succeeding because
pacman failed to parse the resulting config file rather than a failed
signature check.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-04 16:16:06 +10:00
Andrew Gregory
dd694f433b register_syncdb: reject db names that contain /
alpm downloads databases based on basename causing [foo] and [bar/foo]
to silently overwrite each other.

Also remove an extra tab

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-04 16:14:44 +10:00
Dave Reisner
5293d57840 strtrim: reset pointer after trimming leading whitespace
Breakage introduced in 92216c5864 when we changed the signature
of strtrim to return something more useful.

Fixes FS#39976.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-04-21 20:25:45 +10:00
Steven Noonan
6103183253 makepkg: use dash instead of underscore in /usr/lib/debug/.build-id
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-04-21 20:25:02 +10:00
Allan McRae
d8b09e6656 repo-add: declare pkgbase as local 2014-03-27 15:46:07 +10:00
Allan McRae
ee72c016ab Always supply base name and version info in .PKGFILE if needed
Provide pkgbase information for non-split packages with pkgbase set.
Also record the version of the "base" package.  This is useful for
matching package files to source packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:24:22 +10:00
Allan McRae
d8f0c3e5b9 makepkg: sign source packages with --sign
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:24:11 +10:00
Andrew Gregory
b26432dbdb conf.c: remove extra indentation
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:52 +10:00
Andrew Gregory
b0dc547fcb check config_new return value
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:52 +10:00
Sören Brinkmann
fb8437b588 pacman/upgrade: Fix memory leaks
Make sure allocated memory is freed before returning.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:52 +10:00
Sören Brinkmann
fcf0cefd1a pacman/upgrade: Refactor memory management
Refactor the upgrade routine to use an array that can be allocated in
one step instead of an alpm_list that is gradually extended in loops.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:50 +10:00
Sören Brinkmann
3ebb7b94d9 pacman/upgrade: Check malloc() return value
Check the return value of malloc() before dereferencing the returned pointer.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-16 13:43:33 +10:00
Pierre Neidhardt
912ea363de makepkg: Reorder some entries in usage() and getopts
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-13 15:45:04 +10:00
Allan McRae
d8ee8d0c99 makepkg: enforce fakeroot usage
Packaging outside of fakeroot can result in incorrect permissions for
package files.  It has been years since fakeroot issues during packaging
were common, so it is safe to enforce fakeroot usage.  If using fakeroot
is impossible for some reason, a two line wrapper script will suffice to
fool makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-12 13:13:49 +10:00
Allan McRae
61ba5c961e makepkg: Remove --asroot option
The days of fakeroot being error ridden are long gone, so there is no
valid reason to run makepkg as root.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-12 13:13:49 +10:00
Pierre Neidhardt
ce3fbcb18d makepkg: Add a --noarchive option to inhibit archive creation
1. Packagers who want to test the package() function, i.e. to check the content
of the pkg/ folder.

2. Developers who want to check how the packaged version of a program looks, in
other words how the pkg/ folder looks.

3. For users of systems with no port tree, makepkg can ease package creation.
However the resulting archive of the whole makepkg process is often useless.

For all situations, makepkg will usually be called several times. But no archive
(the final package) is needed in any cases. The archive creation ends up being a
waste of time and resource, especially for big applications and slow machines.

Since this option aborts the process prematurely, it behaves like the
-o,--nobuild option, i.e. any other option acting on later stages in the process
will be automatically discarded. For --noarchive, it means that in

  $ makepkg --noarchive --install

the '--install' option does not do anything.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-12 13:13:49 +10:00
Pierre Neidhardt
2041586829 makepkg: Comment on install_package() return code
Previously, install_package() return code was either used as exit code or
ignored. This was rather confusing. The return code is now always ignored and a
comment on install_package() has been added.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-12 13:13:48 +10:00
Matthias Krüger
87b0818246 note that TotalDownload and XferCommand are incompatible.
Another small patch that I made long ago (but was too lazy to submit
back then).
When using XferCommand, TotalDownload option is not take into account.

Regards, Matthias

>From bff946cd9969b6bc6243875e0759f0ee02e487de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= <matthias.krueger@famsik.de>
Date: Thu, 9 May 2013 13:21:04 +0200
Subject: [PATCH] doc: pacman.conf: note that TotalDownload and XferCommand
 options are incompatible.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Matthias Krüger <matthias.krueger@famsik.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-08 17:29:56 +10:00
Allan McRae
ffdc2c5396 Use MALLOC throughtout libalpm
Use MALLOC instead of malloc for safety in libalpm.  Some changes are pure
refactoring, but for others this provides a success check for memory
allocation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-08 16:58:30 +10:00
Andrew Gregory
f3a280bc67 remove check for unused ALPM_ERR_PKG_IGNORED
alpm_add_pkg does not ignore packages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04 14:04:29 +10:00
Andrew Gregory
2e9602716c simplify check for leading "local/"
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04 13:59:46 +10:00
Andrew Gregory
2330a64589 sync_prepare: ignore explicitly removed conflicts
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04 13:57:02 +10:00
Allan McRae
1afddd74a9 Fix install order in scripts Makefile
We need to use install-exec-hook instead of install-data-hook to make sure
the hook is run after the installation of the scripts into $BINDIR.
2014-03-03 20:17:39 +10:00
Pierre Neidhardt
e6ff630763 makepkg.8: Fix typo
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Andrew Gregory
0475b2501a pactest: add prefix to temporary directory
This makes cleaning up /tmp after several --keep-root runs much easier.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Andrew Gregory
0b0fe51a2c pmpkg.py: remove unused imports
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Thomas Bächler
620d2d9d58 makepkg: Support kernel.org's PGP signature scheme
Files hosted on kernel.org only provide signatures for the uncompressed tarball.
Support this scheme by transparently uncompressing the archives and piping
the data into gpg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Allan McRae
b2488eb356 Fix warnings with strict-overflow in gcc-4.9
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt
e5c714f501 pacsearch: factored -Ss and -Qs parts into one single function
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt
cfde337b7b pacsearch: pattern arguments work as for pacman
Previously only one pattern was allowed.

  $ pacsearch foo bar
Search for packages containing 'foo bar'.

  $ pacman -Ss foo bar
Search for packages containing both 'foo' and 'bar'.

Note that removing the quotes from the call was not enough since
  $ pacsearch 'foo|bar'
would then fail.

Note the use of '--' to indicate the end of option parsing. This way we ensure
that input will always be valid and we need not input checks anymore.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Olivier Brunel
cfaff6e0c1 Add events on pacnew/pacsave/pacorig file creation
ALPM still adds a warning to the log, but doesn't emit an event about
said warning, instead using a specific event to let the frontend what
happened/how to inform the user.

Note that there are 2 cases for installing a .pacnew file, to not
overwrite user changes and because file is in NoUpgrade. In the later case
the warning was a bit different: it happened before and said "extracting"
instead of "installed." Now both happen after and are phrased the same.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt
894773eb5b pacsearch: fields are treated uniformly when printing
We include the leading space in the match for 'group' and 'installed'. This
allows us to remove the conditions when printing.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt
e2fe052576 pacsearch: removed redundant sorting
Package are processed in the same order as pacman output, so there is no real
need to sort. This makes the code simpler and faster.

The only difference is that local packages will always be printed at the
end. Previously, they were printed before multilib for instance.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt
fe961e6590 pacsearch: indexing by 'name version' instead of 'name'
In the old pacsearch, packages were identified uniquely by pkgfields[1], which
contained pkgname+pkgver. Since commit 4d13558 pkgver is stored in pkgfields[2],
and packages have been identified with pkgfields[1] only. Because of that
packages with a different version would appear once only.

This fixes the regression by identifying packages with both pkgfields[1] and
pkgfields[2].

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt
08cddb4b4b pacsearch: removed useless comment
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Steven Noonan
bf79c02440 makepkg: implement support for stripping kernel modules
I noticed when I built a kernel package with options 'strip' and 'debug' that
the debug package was missing the debug information for the kernel modules.
This patch adds kernel modules to the targets for 'strip' and is compatible
with the split-out debug information packages.

v2: Correct logic error -- did a 'continue' after the 2nd-level case statement
    instead of in the default case.
v3: Oops, forgot to terminate outer case. Ran this version through the test
    suite and all tests passed.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Andrew Gregory
9bfd6ff275 restrict transaction package origins
This moves the "wrong args" error up from trans_commit to add_pkg when
used with a local pkg and adds the error for remove_pkg when used with
a sync pkg, which currently just removes the db entry.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel
bd3d1a17c2 Add events _PKGDOWNLOAD_{START, DONE, FAILED}
These will be emmitted when download a package file from a repository,
indicating that the download starts, and whether it was successfull or
not.

Note that when multiple servers are available, no event is emmitted when
switching to another server.

(This doesn't apply to alpm_fetch_pkgurl(), but since it is called by
the frontend, it shouldn't have problems knowing when the download
starts and when it ends.)

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel
01cc55a1f4 Add events ALPM_EVENT_RETRIEVE_{DONE, FAILED}
To go along with RETRIEVE_START, one other event will be emmitted once
the downloads are done: RETRIEVE_DONE if all files were successfully
downloaded, else RETRIEVE_FAILED.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel
cd793c5ab7 Remove log_cb, add ALPM_EVENT_LOG instead
When ALPM emits a log message, it still goes through _alpm_log() but
instead of calling a specific log callback, it goes as an event.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel
28dbd5551e Update the event callback
Instead of using two void* arguments for all events, we now send one
pointer to an alpm_event_t struct. This contains the type of event that
was triggered.

With this information, the pointer can then be typecasted to the
event-specific struct in order to get additional arguments.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Florian Pritz
b6f6a165c4 be_local: Use alpm_greedy_grow
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
5acfa65ffb be_package: Build the file list from MTREE if possible
This greatly speeds up file list generation times by avoiding
uncompressing the whole package.

pacman -S base with a deliberate file conflict:
before: 9.1 seconds
after:  2.2 seconds

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
8e60adc916 be_package: Refactor code adding a file to the files list
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
11fb1d30f4 be_package: Refactor handling of simple path checks
This is used to deduplicate code when using the mtree as the file list
source.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
42f4a5081e util: Add _alpm_realloc() and _alpm_greedy_grow()
These will be used in the following patches.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
f27fad9b89 Check if a file is in the package's file list before extracting
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Andrew Gregory
a7da2a47c3 _alpm_sync_prepare: fix unresolvable packages leak
If the user opted not to remove the unresolvable packages from the
transaction, the list was neither free'd nor saved to the transaction to
be free'd in trans_release.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-08 09:55:35 +10:00
Pierre Neidhardt
0deeb9991c pactree: removed 'provision' from linear output
Linear output is especially useful when piped to other commands, e.g.

  $ pactree -lu pacman | pacman -Qqkk -

The above command would previously show errors on packages with provisions.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 14:21:07 +10:00
Andrew Gregory
b9601b1e59 alpm: export *_free functions
Front-ends should be able to free memory that alpm hands them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:48:37 +10:00
Andrew Gregory
953808a9ee pmtest: add memory check to tests with valgrind
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:45:11 +10:00
Andrew Gregory
4763341ea1 pmrule: add FILE_EMPTY rule
Succeeds if the specified path is a file and is empty.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:44:38 +10:00
Allan McRae
1601532a53 Give groups display text singular and plural forms
Reported on transifex

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 09:01:38 +10:00
Allan McRae
8014dc648f makepkg: remove unneeded "|| true"
makepkg only aborts on errors during PKGBUILD functions so the remaining
"|| true" statements are unneeded.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 17:37:58 +10:00
Allan McRae
b449878fea makepkg: Fix typo in variable name
It turns out that you should refer to variables by their actual name...
Introduced in commit a521cea9.

FS#38414.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 17:31:51 +10:00
Rafael Ferreira
236f1795e9 Do not remove source code references in PO/POT files
FS#34240.  This is useful for translators and has little cost to us since
we moved to transifex for translations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:32:55 +10:00
Lars Gustäbel
47a4741a3c Prevent makepkg creating armored signatures
If the user has "armor" in thier gpg.conf, makepkg will create an
ascii-armored signature. Use --no-armor in the gpg call to avoid.

FS#38503.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:30:59 +10:00
Pierre Neidhardt
e4f6edf237 pacsearch: CLI option to turn off colors
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt
1e07af1b0a pacsearch: using pacman color theme
No more per-repo coloring: this was not Arch-agnostic, and there is no
reasonable, simple way to color repos in a consistant manner with only 6 colors.

'local' is in red: this way we benefit from the pacman -Ss && pacman -Qs combo.

to_color subroutine: it takes an array instead of a string, this is faster and
simpler.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt
fe19a0c58d pacsearch: colors are portable (ANSI) and have natural variable names
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt
15f4144e12 pacsearch: Explicitly extract group information
Also store pkgname and pkgver separately.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt
135d862eb6 pacsearch: localized output
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt
6fb2035dd0 pacsearch: more accurate help message
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt
c71efe6d62 pacsearch: Copyright year bump
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Jason St. John
f5299d1752 makepkg.conf(5): Fix and improve grammar and spelling issues
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Jason St. John
6268e66efa Remove ChangeLog.proto and move important info to PKGBUILD(5)
The change log prototype should be distribution determined.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:27 +10:00
Jason St. John
ccabeafb3d makepkg.conf(5): Add missing backticks around vars, and use single quotes around "gpg" command
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:11:47 +10:00
Jason St. John
3dc87ec59a proto: Remove recommendation of "makepkg -g" in comments
This recommendation encouraged the practice of not checking the checksums
provided upstream.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:11:47 +10:00
Maxime Gauduin
edce7555a6 Add PKGBUILD-vcs.proto
This PKGBUILD proto covers the newly introduced VCS capabilities of
pacman. It serves as a replacement for the current bzr, git, hg and svn
protos found in ABS.

Signed-off-by: Maxime Gauduin <alucryd@gmail.com>

[Allan: add to Makefile.am]
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:11:32 +10:00
Andrew Gregory
aa4d3298fb table_display: free memory on errors
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:22:27 +10:00
Andrew Gregory
c2edd31eae _alpm_resolvedeps: free targ inside loop
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:12:06 +10:00
Andrew Gregory
fac9ac6c40 sync_prepare: manually set pm_errno
_alpm_resolvedeps resets pm_errno to 0 by calling alpm_checkdeps.
Whenever the last call succeeded, pm_errno was not properly set,
preventing pacman from properly handling the error and leaking
additional memory.  We know pm_errno should be ALPM_ERR_UNSATISFIED_DEPS
if resolvedeps has failed, so just set it manually.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:02:31 +10:00
Andrew Gregory
4d68092e2f dump_pkg_full: fix optionalfor memory leak
alpm_pkg_compute_optional returns a generated list that needs to be
free'd.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:46:58 +10:00
Andrew Gregory
6be08f76f6 local_db_populate: initialize empty pkgcache
If the db directory did not exist when local_db_populate was called, the
pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:45:53 +10:00
Silvan Jegen
819b4cd54e Move NULL check before dereference
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen
77da9dc974 Another NULL check removed
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen
cb8eae24c9 Another unneeded NULL check removed
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen
d895cae16c Remove unneeded NULL check
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:24 +10:00
Andrew Gregory
aabb7c3cdd pacman: use exit status 0 for --help and --version
The user requesting usage or version information is not an error.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:12:00 +10:00
Allan McRae
7ae25ac67f Consistently use 'directory' instead of 'folder'
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 21:37:00 +10:00
Andrew Gregory
333373f90e enable_colors: always set color strings
Only setting color strings when colors is true allowed subsequent
calls to enable colors but not disable them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:52:46 +10:00
Andrew Gregory
5be7b6a1b2 pmtest: use valgrind --child-silent-after-fork
Silences false warnings after alpm forks to run install scripts.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:34:43 +10:00
Andrew Gregory
d4def1c193 pmtest: use --gen-suppression=all with valgrind
Let valgrind do the work of writing any suppression rules needed by the
test suite.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:34:25 +10:00
Andrew Gregory
19b3ee6d39 pmtest: send valgrind output to var/log/valgrind
This will allow us to detect whether valgrind found any errors while
still preserving pacman's return code for tests.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:33:57 +10:00
Andrew Gregory
deaed047fd valgrind.supp: add fakeroot/fakechroot errors
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:33:53 +10:00
Allan McRae
6fa7e8aff5 HACKING: mention tab size and line width
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:30:51 +10:00
Florian Pritz
cd2370754a Remove ts and sw from vim modeline when noet is set
Forcing vim users to view files with a tabstop of 2 seems really
unnecessary when noet is set. I find it much easier to read code with
ts=4 and I dislike having to override the modeline by hand.

Command run:
find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} +

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:19:25 +10:00
Jason St. John
83e14aeebd Add missing optdepends to the main list of variables in the split PKGBUILD prototype
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:49 +10:00
Andrew Gregory
e6464f0cb6 pacman.c: free string commandline options
Plugs a memory leak when values were passed twice.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:49 +10:00
Olivier Brunel
4e9d88aa05 Rename ALPM_EVENT_OPTDEP_REQUIRED to _OPTDEP_REMOVAL
Because this event is triggered when an optdepend for another package is
being removed.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:49 +10:00
Olivier Brunel
e65a752475 pacman: Fix delayed warnings/errors sent to stdout not stderr
Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:48 +10:00
Andrew Gregory
ffe7f6d161 pacman.c: remove unnecessary optarg checks
getopt takes care of making sure that options that require a value have
one.  These checks were only added to silence clang, which no longer
complains about optarg being unchecked, and newer options already use
optarg unchecked.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:48 +10:00
Andrew Gregory
8a434aeb46 sync_prepare: treat from_sync as a boolean
We only care that packages are being installed from a repo, not how
many.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-15 16:05:31 +10:00
Andrew Gregory
62c76cf825 base64.c: comment out unused variable
Commit e47eb9a7 commented out base64_encode, which left base64_enc_map
unused, causing warnings under clang.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-15 15:54:56 +10:00
Andrew Gregory
b01c2aefd9 package.h: convert scriptlet field to int
It's a boolean, so signedness doesn't matter, and the public API already
exposes it as an int through alpm_pkg_has_scriptlet().

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-15 15:52:51 +10:00
Allan McRae
bce495e56f Consistently use #ifdef
Fix the occurances of #if to be #ifdef for consistency.
2014-01-10 14:32:38 +10:00
Allan McRae
1d3b17e251 Fix build with --disable-gpgme
The alpm_decode_signature function was made available for frontends to
display signature information, but this required libalpm to be build with
gpgme support.  As that function did not require anything from gpgme,
have it build unconditionally.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-10 14:30:05 +10:00
Dan McGee
5097b162fc Fix compile warnings on systems without getmntent
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-10 14:30:05 +10:00
Andrew Gregory
00b6694068 Makefile.am: move test-suite.log into test/
Pushing down the testing .gitignore entries in commit e25afaf6 exposed
test-suite.log in the root.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-10 14:30:05 +10:00
Andrew Gregory
3f34e0936a create_verbose_row: free malloc'd strings
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-10 14:30:05 +10:00
Andrew Gregory
480a9ff82f check_keyring: plug memory leak
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:51 +10:00
Andrew Gregory
ffa4c6fc8f valgrind.supp: suppress leak in gpgme_get_key
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:51 +10:00
Dan McGee
6c917e433e Reorder and reshape the package struct for better packing
This shrinks down the total size of the package struct by a handful of
bytes, saving us some memory and cache pressure when we are loading up
the entirety of the sync and local databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:51 +10:00
Dan McGee
30740d9d2f Minor struct member reordering for packing concerns
Noticed using clang and `-Wpadded`.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Dan McGee
086bbc5b62 Use O_CLOEXEC as much as possible when opening files
When calling open(), use O_CLOEXEC as much as possible to ensure the
file descriptor is closed when and if a process using libalpm forks.

For most of these cases, and especially in utility functions, the file
descriptor is opened and closed in the same function, so we don't have
too much to worry about. However, for things like the log file and
database lock file, we should ensure descriptors aren't left hanging
around for children to touch.

This patch is inspired by the problem in FS#36161, where an open file
descriptor to the current working directory prevents chroot() from
working on FreeBSD. We don't need this file descriptor in the child
process, so open it (and now several others) with O_CLOEXEC.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Dan McGee
8bec8a3f6a Log more in search debug message
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Dan McGee
bad86247f7 Remove -fgnu89-inline from compile options
This was a hack done by me in commit d8e88aa017 back in 2007 that is
no longer necessary, given a sufficiently smart compiler and one that
supports the inline keyword.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Dan McGee
e25afaf673 Push down testing .gitignore entries
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Dan McGee
e205003635 Clear up definition of INFRQ_ALL
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Allan McRae
3bb3b1555a Update copyright years for 2014
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Allan McRae
77268f352f Copy validation field in _alpm_pkg_dup
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:49 +10:00
Allan McRae
7fa35f32d8 Update comment for local db entry creation
Mention mtree files do not need creation in addtion to install files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:49 +10:00
Jeremy Heiner
19445e42e6 Add the unit tests for -Qk and -Qkk that are possible now.
The -Qk test (001) validates the existence of the package files (which
were installed to the filesystem by the framework because the package
was added to the "local" db).

The -Qkk test (002) does not validate any file's properties - it can
only check that the pacman run produces the expected warning message
saying that the package lacks an mtree.

Further tests will require modifications to the testing framework to
allow intentional damage to the filesystem and generating an mtree.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>

[Allan] Make warning message detection more specific
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:49 +10:00
Andrew Gregory
6f468c2465 deps.c: remove filtered_depend functions
filtered_dep was duplicating an alpm_depend_t solely for the purpose of
overriding its depmod and would effectively cause alpm_checkdeps to
ignore ALPM_TRANS_FLAG_NODEPVERSION if the duplication failed.  Manually
overriding/restoring the depmod for the original depend removes the
duplication as a point of failure and fixes a memory leak where the
duplicated depend was not being properly freed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:49 +10:00
Andrew Gregory
6a656c7429 conf.c: add missing newline to warning
Fixes tests that use pacman's output when built without libcurl.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:49 +10:00
Allan McRae
452ee39de1 Fix build warnings with --disable-nls
The gettext functions return a "char *", so do the same for the defines
in the case where gettext is unavailable.  This prevents a number of
warnings about const being dropped.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:49 +10:00
Jeremy Heiner
f7f8964c23 Use the 'configure'd PYTHON to run pactest.
Use the 'configure'd PYTHON to run pactest instead of the one
hard-coded (with '#!') in pactest.py. Also remove useless '#!' from
non-main .py files.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-21 10:20:04 +10:00
Maxime Arthaud
50e9543908 makepkg: fix check for distcc
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-21 10:12:53 +10:00
Andrew Gregory
2f8be5f8db trans_prepare: always sort trans->remove by deps
Packages can be removed during a sync transaction either directly or
due to conflicts and need to be sorted.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-19 15:19:52 +10:00
Dave Reisner
714609639f dload: allow curl to response to any auth challenge
Previously, we only allowed the default of responding to basic auth
challenges. Mirrors requiring authorization are far and away the edge
case, but there's no sense in preventing access to them.

Implements FS#38184.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-19 15:17:58 +10:00
Olivier Brunel
9652c27710 alpm: Rename a variable for future clarity
We will be adding event structs in the following patches.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 21:58:30 +10:00
Allan McRae
31fcdec619 Fix pactest README
The --test option no longer exists.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Andrew Gregory
e8ec7e54e5 remove useless continue
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Andrew Gregory
841c60f2b3 db.c: require unique database names
Allowing multiple databases with the same name causes conflicts as they
both point to the same database file but may use different servers,
usages, or siglevels.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Sébastien Luttringer
76a05e94c1 makepkg: fix consistency of downloaded sources permissions
Running 'makepkg -g' or 'makepkg' to download source files results in
different permissions on the files if the user has a non-default umask.

Put the umask definition at the "beginning" of the makepkg script to
ensure all files generated by makepkg have a 0022 umask.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Andrew Gregory
916c7085d8 alpm_sync_sysupgrade: skip packages being removed
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Allan McRae
b847d1d8e7 Color output from pm_vasprintf
This makes sure warning and error messages from _alpm_log are colored.
Fixes FS#35160.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Jason St. John
9749fb033c Fix misspellings and some grammar issues in output of some pacman contrib scripts
Affected files:
-- contrib/bacman.sh.in
-- contrib/paccache.sh.in
-- contrib/pacdiff.sh.in
-- contrib/rankmirrors.sh.in

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Vasiliy Korchagin
ae2c9bba5a pacdiff: do not remove pacfile after viewing
Automatically removing the file after viewing is not good if on viewing you
decide to deal with it later.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Jason St. John
af2c0a1537 pacscripts: Improve error message when sudo binary is not found
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Wolfgang Bumiller
20127e732c Close file descirptor before fork
FreeBSD chroot(2) fails with EPERM when a directory file descriptor is open
with either `kern.chroot_allow_open_directories` being 0, or when the process
already is inside a chroot.  This is exposed in alpm_run_chroot that uses
opendir() to open a file descriptor to the current directory before doing
the forking and chrooting.  Since the file descriptor is not used in the
forked process, we close it.

Fixes FS#36161.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Allan McRae
759c48cd34 .gitignore: Add intl directory.
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Allan McRae
1340ed7925 paccache: clarify help output
The help output referred to variables in the script rather than what
they were labelled in the parameter argument.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:36 +10:00
Jason St. John
a15fd48016 Improve --help switch output for pacman contrib and pacman scripts
Unify the formatting of the --help switch for pacman utils, if it exists.
All of the pacman utils will now output help text using the following
format:

  util-name (pacman) v<pacman version>

  one line description of util's purpose

  Usage: util-name [options]

    -b, --bar      whatever --bar does
    -f, --foo      whatever --foo does
    -h, --help     display this help message

Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2013-11-15 11:02:27 +10:00
Jason St. John
7bfaa358ea Replace "echo" command with "printf" in human_to_size_test.sh
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Jason St. John
1645dfd3d1 Fix typo in pacman-optimize
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Jason St. John
230bd5c2fd Fix whitespace and other formatting issues
This commit:
-- replaces space-based indents with tabs per the coding standards
-- removes extraneous whitespace (e.g. extra spaces between function args)
-- adds missing braces for a one-line if statement

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2013-11-15 11:02:27 +10:00
Jason St. John
b7b3f9c5e7 Fix minor grammatical issues in doc/index.txt
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Andrew Gregory
d78f45ae0c log important events from the backend
This ensures that important events will be logged and consistent
regardless of the frontend.  The need for global context in the event
callback is also removed.  The event is logged before any post_* scripts
run, so this also moves the post_* script output underneath the event in
the log.

Fixes FS#36504

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Andrew Gregory
ea6aeef8ba Makefile.am: fix typo in LOG_DRIVER variable
Self-executing tests were not being run through the tap log driver.
This caused `make check` to ignore discrepancies between the expected
number of tests and the actual number of tests.

Also, fix some uncommented output from test scripts that could confuse
TAP parsers.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Allan McRae
0da98ec6ba Ignore makedepend and checkdepend entries when parsing .PKGINFO file
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Allan McRae
5273e38fb2 makepkg: move update_pkgver out of extract_sources
The extract_sources function should be just extracting sources.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Allan McRae
da8cd388c4 Return zero from extract_file with local source file
The call to bsdtar to check if a file needs extracted returns 1 if it does
not.  We then propegate this return value accidentally which can cause
makepkg to report an error later on.  Explicitly return 0 in this case.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:12 +10:00
Andrew Gregory
57090d8cba alpm_handle: store lock file descriptor
There was a brief window between opening the file descriptor and
creating a stream to it.  If the process was interrupted during that
window the lock file would not be removed correctly.

The pid is no longer printed to the lock file as this was virtually
meaningless for lock files on NFS.

Fixes FS#35603

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Andrew Gregory
af284d5fdb support ALPM_SIG_USE_DEFAULT for file siglevels
This brings file siglevels in line with how db siglevels are handled.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Jason St. John
88df07717d Remove spaces between the opening "if" and the opening parenthesis
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Jason St. John
14cc790c59 Use title case for a heading in HACKING; fix capitalization of "Vim" in HACKING
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Dave Reisner
0c180cb7cc version: fix formatting in file to RPM upstream
This reverts a portion of 86eefc1a3a.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Allan McRae
fe824f87b9 makepkg: only remove static libraries if they have a shared version
It is fairly common that packages contain static libraries with no
shared counterpart.  These should not be removed with !staticlibs.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:02 +10:00
Allan McRae
5c5b28833c makepkg: Allow "static library" to be translated
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-01 15:48:03 +10:00
Andrew Gregory
d5acf7a44a upgrade.c: use iterator variable
remote was being used to loop over itself, making the FREELIST
ineffective.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Andrew Gregory
c3493360af deps.c: pass alpm_list** to _alpm_recursedeps
Improves consistency and makes it clear that targs will be modified by
_alpm_recursedeps.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Andrew Gregory
08191b13f2 check for -1 return value from getopt_long
getopt_long returns -1 when it has finished parsing all args.  A return
value of 0 indicates that a flag was set directly by getopt_long and
parsing should continue.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Andrew Gregory
1c5b94e6bb callback.c: check for negative xfered size
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Allan McRae
b82a0d83ce makepkg: do not allow badly formatted arch lines
It appears there are a lot of packages with arch=('i686 x86_64')
floating around.  Quote the arch array when passing as a parameter
to detect such things.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Florian Pritz
6405ecb259 pacman -Si/-Qi: Autodetect best fitting file size unit
I've tracked this back to e223366 and it looks like this just forces KiB
because back then humanize_size didn't exist, but the size was just
divided by 1024 to keep it somewhat readable. When humanize_size got
introduced in 3c8a448 this was just carried over.

The unit detected for "Download Size" is reused for "Installed Size" to
make it easier to read.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Vladimir A. Nazarenko
7e767b7e90 Use getuid instead of geteuid
If someone gives the pacman binary setuid permissions, the geteuid check
allows it to start running but subsequently fail. As we do not support
setting pacman setuid, use getuid to check permissions instead.

FS#37174.

Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Andrew Gregory
8f5dbd5614 libalpm/db.c: default to ALPM_DB_USAGE_ALL
This allows existing front-ends other than pacman to continue working
normally.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Andrew Gregory
a8285350cc makepkg: allow empty source arrays
Necessary for metapackages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Andrew Gregory
c2134fde2b sortbydeps: include local pkgs in dep graph
Detecting indirect dependencies by traversing a package's entire
dependency tree is prohibitively slow for larger transactions.  Instead
add local packages to the dependency graph.  This additionally requires
delaying dependency ordering for sync operations so that removed
packages may be excluded from dependency detection.

tests/sync012.py was also updated to ensure that the dependency cycle
was actually detected.

Fixes FS#37380

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
2194eddf30 Indicate ignored packages in -Qu output
Add "[ignored]" in the "pacman -Qu" output after packages that have their
upgrades ignored.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
23923200c3 Expose alpm_pkg_should_ignore
This function is useful for frontends to annotate package upgrades
that will be ignored.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
d4ba5bdda6 repo-add.8: Provide example usage
Detail the current standard of generating two databases - with and
without the file list.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
d63313efe1 makepkg.8: Document remaining environmental variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
49de11b340 makepkg.8: document environmental variables that affect gpg signing
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
2d9e7dc2bc Fix detection of joint --native and --foreign usage
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
70b2c5f5ef List signiture keyids in -Sii output
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae
c7f159c1c9 Make functions to decode a signature and extract keyid public
These are useful for frontends.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Dave Reisner
968486ecc0 makepkg: validate updated pkgver before replacement
Validate the new pkgver efore blindly ramming it into the PKGBUILD.
This gives us good feedback and prevents corrupting the PKGBUILD, e.g.

==> Starting pkgver()...
==> ERROR: pkgver is not allowed to contain colons, hyphens or whitespace.
==> ERROR: pkgver() generated an invalid version: a horse is not a pkgver

As an additional failsafe, exchange a valid for invalid character as
command separator in @SEDINPLACE@ expressions. For even more paranoia,
exit if sed fails for any reason.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae
e049bb8bd6 Ensure packages have a valid version
Currently you can manually create and then install a package with a
version not containing a pkgrel.  The created local database entry is
invalid as the directory name can not be split by _alpm_splitname due
to the assumtion of hyphens separating name-pkgver-pkgrel.

Ensure the package has a valid version when it is loaded. Fixes FS#35514.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae
e7ad883ebe makepkg: use source_safe when resourcing BUILDFILE
After updating the pkgver, we still need to safely source the BUILDFILE.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae
c69d71d55b contrib/pacdiff: error if diffprog is not found
FS#35936

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae
fb0f880f0a proto: remove missed $srcdir redundancies
Most of the redundant "cd $srcdir" in the prototypes were removed in commit
5f80d7af.  Fix the rest.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae
dcfc247a2c Fix progress bar overflow while checking package integrity
On 32bit systems, the progress bar intergrity checking can show values
greater than 100% with large transactions.  This is due to the total
size of all package files being greater than a size_t.  Use uint64_t
for these sizes.

Fixes FS#36608

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Eric Toombs
3e903d34cc Added list of mandatory options to PKGBUILD's man page
[Allan: Adjust wording due to remove al license warning]
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Dave Reisner
217aaaf3ea autogen.sh: remove useless shell flag and subshells
$ ./autogen.sh
./autogen.sh: 3: ./autogen.sh: BASH_SOURCE: parameter not set

The -u flag causes this (and lots of other mysterious problems). Since
there aren't even any variables in this script, it makes no sense to
use it.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae
ed511b141f Report which package is missing a signature
If any package in a sync transaction is missing a required signature,
we give an uninformative error message (which may or may not state that
the missing signature is the issue).  Always output the package with
the missing signature.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
slavomir vlcek
e5f23e0ebb libalpm: move function pointer condition
Function pointer gets uselessly compared for NULL in
every iteration. Move the condition to do it just once.

Signed-off-by: slavomir vlcek <svlc@inventati.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
d79872b4c7 Add parens around tuples in Python list comprehensions.
Reported by 2to3: optional in Python 2, but required in 3.

Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
e9c7c3b90d Use Python's "range" instead of deprecated "xrange".
Reported by 2to3. Python 3 throws out the old range, renames the old
xrange to be the new range, leaving no xrange. A shim could be used,
but using the less efficient version does not have a noticeable impact
on the run time.  This observed (lack of an) effect is as described in
the Python 2 docs for xrange. The largest range created is only 1000
elements big, and the memory cost of those ranges is negligible when
compared to that of all the pmpkg instances created.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
95b0a868f2 Use dict iteration methods common to both Python 2 and 3.
The .items, .keys, and .values methods in Python 2 make copies, so the
test framework uses the .iter* flavors of those methods. But in Python
3 those .iter* (and even the 2.7 .view*) flavors are removed and the
original methods return views.

Measurements were taken under Python2 to see what impact the copying
had, and there was none. Thus it is not worth the effort to avoid.

Reported as a compatibility issue by 2to3.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
071ba05534 Use Python's "0o#" octal literal instead of deprecated "0#".
Reported as a compatibility issue by 2to3.

Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
4d24da8cda Use "exec" instead of "execfile" (deprecated in Python 3).
This was the only compatibility issue reported by "python2 -3".

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
372e26118f Bail early with a clear error message if Python runtime isn't 2.7+.
Prior to this a test that used a feature too new for the runtime would
blow up when it was "exec"d (possibly in the middle of a run of a
bunch of tests) with an error message that was not very helpful.

Remove Python 2.5 and 2.6 runtimes from the list configure searches.
2.5 suffers the problem described above. The code currently will run
on 2.6 but, as was noted on the dev list, that runtime is at the end
of its life, so 2.7 is a better cutoff.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
807f014d77 include invalid options in error messages
On invalid combinations of flags we were only printing the unhelpfully
vague message "invalid option".

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
2c11e5da1d pacman: die on invalid option combinations
Fixes FS#20950

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
55ca38b4cd rename PKG_LOCALITY_LOCAL -> PKG_LOCALITY_NATIVE
PKG_LOCALITY_LOCAL was confusing because the enum is used with -Q, so
all packages are "local".  Also reversed the config->op_q_locality
assignment so that the locality matches the option used.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
64e4f627c1 do not run scriptlets with --dbonly
Running an install script does not fall under "Adds/removes the database
entry only."

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
3b804cb654 imply --print from --print-format
--print-format is totally useless without --print.  Implying --print
will also save us the hassle of checking it when we add transaction
option validation.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
122e16106f use non-ascii identifiers for optflags
Removes the overlap between optflags for different operations that
allowed non-sensical combinations of flags such as:

  $ pacman -Si --changelog $package
    --changelog is -c, meaning --clean for -S

  $ pacman -Q --sysupgrade
    --sysupgrade is -u, meaning --upgrades for -Q

Also add a few missing braces.

Original-work-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
0fc9545546 pacman/util: remove strsplit
strsplit was used in only one place and did the same thing as strtok.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
5477f2597b submitting-patches: address common mistakes
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
dfcf918763 remove executable bit on paclog-pkglist.sh.in
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Andrew Gregory
8ab44c7986 Makefile.am: remove old targets from .PHONY
These targets were part of the old test suite and no longer exist.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Jeremy Heiner
1bb0085dfe Jettison the truncation of the display of pmrules.
The truncation helped back when the test output appeared when run via
make. But now "make check" logs that output, and it makes little sense
to log the truncated rules.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Allan McRae
31a55df3d9 makepkg: add LIBRARY variable
This points makepkg to where is library is located.  Can be
overridden by value in the environment.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Ashley: Rebased]
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
2013-10-14 13:01:10 +10:00
Allan McRae
c9ab8a7f6c makepkg: run locally with libtool style wrapper
Build makepkg to scripts/.lib/makepkg and add a wrapper script to
call it. This is not useful at the moment, but is the first step
to allowing makepkg to be split into smaller pieces.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Ashley: rebased]
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
2013-10-14 13:01:03 +10:00
Allan McRae
0308df07d3 makepkg: alphabetically order option variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:01 +10:00
Allan McRae
141d7f234f makepkg: do not refer to src/ or pkg/
Use $srcdir and $pkgdir instead.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:01 +10:00
Lukáš Jirkovský
043f250d0e Add a -C, --cleanbuild option to clear the source directory before building a package.
Implements FS#17175.

[Allan: Minor changes to output strings, fix removing of source directory]
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:00:50 +10:00
Allan McRae
2f7e92ad04 Link non-vcs sources into $srcdir during extraction
The separation between downloading and extracting for non-vsc sources
was incomplete due to symlinks being made in $srcdir during the download
stage.  Have download_{local,file} just ensure the presence of the files
in $startdir or $SRCDEST (downloading if needed) and then have
extract_file symlink these files into $srcdir.

Also replace "continue" with "return" in extract_file to make it clearer
what is happening.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:49 +10:00
Allan McRae
d5ff21c221 Ignore failure to patch during autogen.sh
patch -N ignores the previously applied patch but still returns 1.
This causes a git build with a reused source directory to fail.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:49 +10:00
Allan McRae
adfab9c899 Remove makepkg license check
There is little reason for this field to be checked over all other
fields.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:49 +10:00
Allan McRae
37242ceb30 Use $srcdir/ rather than src/ in makepkg help
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:49 +10:00
Allan McRae
80ee9994f0 Clarify --repackage description
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:49 +10:00
Andrew Gregory
3a6bb2735b Add make target for TESTS
This causes make to update TESTS when tests are added (or updated).
For simplicity, this changes TESTS from a single multi-line list to
individually appending each test file.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>

[Allan: use C locale for sorting]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:48 +10:00
Florian Pritz
d43f54e5c4 Display old and new version in pacman -Qu output
This changes the output from "foo 1.0" to "foo 1.0 -> 1.1" which makes
cronjobs that mail the -Qu output way more helpful.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 12:59:48 +10:00
Andrew Gregory
8eb8995aa7 TESTS: add missing tests
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-19 10:42:16 +10:00
Andrew Gregory
d1ac6ffc13 Fix make distcheck
* set util binary paths relative to top_builddir
* set pactest.py path relative to top_srcdir
* include tap.py in check_SCRIPTS

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-19 10:42:15 +10:00
Xyne
2379eb1fa6 makepkg: redirect downloader output to STDERR
This allows scripts to safely capture the output of "makepkg -g".

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Xyne
028490ddcf makepkg: include all hash types in integlist
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Xyne
5ef0c3caa5 bacman: optionally include unmodified backup files when available
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Xyne
8561ad2256 bacman: update copyright information in version function
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Xyne
ec15e859a4 bacman: pass unshifted arguments to fakeroot
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Christian Hesse
3b3152fc50 dload: avoid renaming files downloaded via sync operations
If the server redirects from ${repo}.db to ${repo}.db.tar.gz pacman gets
this wrong: It saves to new filename and fails when accessing
${repo}.db.

We need the remote filename only when downloading remote files with
pacman's -U operation. This introduces a new field 'trust_remote_name'
to payload. If set pacman downloads to the filename given by the server.

The field trust_remote_name is set in alpm_fetch_pkgurl().

Fixes FS#36791 ([pacman] downloads to wrong filename with redirect).

[dave: remove redundant assignment leading to memory leak]

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Aaron Lindsay
3f99cfba1b contrib: Unify quoting in error messages
This fixes error messages to display the contents of variables rather
than the variable name by replacing backticks with single quotes (m4
eats backticks). It also removes $"" localization from error messages to
eliminate security holes.

For instance, `rankmirrors nonexistent_file' will now display:
	'nonexistent_file' does not exist.
rather than:
	$1 does not exist.

Signed-off-by: Aaron Lindsay <aaron@aclindsay.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Dave Reisner
9388808964 makepkg: use c-style for loops for integrity checks
These loops already maintain an independent loop counter, so cut out
the middle man. While this change doesn't necessarily require that we
drop support for sparse arrays, we do via this patch. A new lint check
is added in check_sanity to abort when a sparse array is encountered.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Dave Reisner
de570d1a65 makepkg: always use read's -r flag with filenames
These are all cases where we're reading filenames -- any backslashes
are intentional and should not be interpreted.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Dave Reisner
2091f7ab16 makepkg: inline creation of checksum indenting
With some simple math and printf formatting tokens, we can create the
whitespace necessary for this without the need for a loop and string
concatentation.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Dave Reisner
cfbc4fe809 makepkg: cleanup a few format string injections
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:02 +10:00
Dave Reisner
61e806b96a pactree: set full usage on DBs when registering
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
c0ee713704 pacman: add front end support for repo usage level
Add a "Usage" key to the repo section of the config which allows for the
tokens "Search", "Install", "Upgrade", "All", which correspond to values
in the alpm_db_usage_t enum. Users can specify "Usage" multiple times
for a given repo, or multiple flags per "Usage" line and they will be
OR'd together. If unspecified, the default is full usage of the repo.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
106d0fc541 libalpm: introduce a usage level for repos
This defines a level of interest a user has in a repository. These are
described by the bitmask flags in the alpm_db_usage_t enum:

  ALPM_DB_USAGE_SEARCH: repo is valid for searching
  ALPM_DB_USAGE_INSTALL: repo is valid for installs (e.g. -S pkg)
  ALPM_DB_USAGE_UPGRADE: repo is valid for sysupgrades
  ALPM_DB_USAGE_ALL: all of the above are valid

Explicitly listing the contents of a repo will always be valid, and the
repo will always be refreshed appropriately on sync operations.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
5f80d7afbd proto: remove redundancy in cd for each function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Sami Kerola
8a72761743 pacman/util.c: use switch when there are fall through statements
An 'if' clause with empty statement is allowed, but unusual construct.
When 'if' is used this way the statement should at least have orphan
semicolon ';'.  For empty statements 'switch' feels like a native way
express what is meant.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>

[Allan] Keep comment
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Jason St. John
a86015f73f Improve --help switch output for pacman utils
Unify the formatting of the --help switch for pacman utils, if it exists.
All of the pacman utils will now output help text using the following
format:

  util-name (pacman) v<pacman version>

  one line description of util's purpose

  Usage: util-name [options]

    -b, --bar      whatever --bar does
    -f, --foo      whatever --foo does
    -h, --help     display this help message

The --help switch does not exist for a couple of the utils, so the
help/usage text for those will be displayed when the util is run
with no arguments.

Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
4245c6b222 makepkg: add support for sha224 checksums
Implements FS#36776.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
b370f0ca42 makepkg: unify list of known hash algorithms
Unifying this list makes adding new algorithms easier. There's also
some menial cleanup in this patch to avoid use of eval and properly
treat lists of data as array instead of simple strings.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Sami Kerola
aade18cf3b libalpm: avoid name space conflict
The symbol 'err' refers to err() from err.h, and is wisest to be avoided
as a variable name.

Reference: http://man7.org/linux/man-pages/man3/err.3.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Sami Kerola
9020bcee37 common: compare value rather than pointer address
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
9e50e5314c makepkg.8: fix typo in usage
Looks like I fat fingered something when I refactored the original
submissions. Woops.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:20 +10:00
Dave Reisner
3a2a752e1e alpm: log errors for scriptlets terminated by a signal
Fixes FS#36618.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04 09:51:19 +10:00
Allan McRae
ce7456b4cc Store fgetc output as an int.
Bug exposed on ARM when char is unsigned resulting in the comparison
to EOF always failing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:14:01 +10:00
Andrew Gregory
d8c2ab0e6f conflict.c: fix directory ownership check
* append "/" to directories before searching package file lists
* use lstat over stat so symlinks aren't resolved
* fix the inverted check for stat's return value

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:13:46 +10:00
Olivier Brunel
15b667ef36 doc/repo-add: Add note on when signatures are added to the db
Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:13:25 +10:00
Dave Reisner
3d3c7ebb0d makepkg: allow make-style environment var overrides
This allows for VAR=value and VAR+=value variable declarations.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:13:12 +10:00
Andrew Gregory
9085aa4322 check.c: break backup file search loop after match
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:12:56 +10:00
Allan McRae
247b9af02b Do not refer to FlySpray numbers
These references to bug numbers assume we will forever be using that bug
tracker. It is better to properly comment the code instead (which was
done in almost all cases anyway).

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:12:30 +10:00
Andrew Gregory
c02b16c4cc ini.c: give recursion limit file scope
The recursion limit is an artificial limitation imposed to prevent
memory exhaustion in a recursive function.  Giving it file-level scope
increases its visibility.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
4d4f46ba2a ini.c: make errors in includes fatal
If an error in the main file would be fatal there is little reason to
ignore the error in an included file.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
bf1c8e3a3c ini.c: reuse line buffer
By the time we make the recursive call we have already finished with the
line buffer, making it safe to reuse.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
3d2c8e1fd0 conf.c: extract ini parsing code to separate files
Move _parseconfig to ini.c as _parse_ini and create a convenient wrapper
for the public API.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
ab84249a58 conf.c: pass _parse_directive as a callback
This will allow passing arbitrary key/value handlers.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
26da037fd5 conf.c: move section handling out of _parseconfig
_parseconfig now tracks the current section name directly so that the
name stored in the section struct is just a pointer to the one stored by
_parseconfig.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
8287312c29 conf.c: move directive parsing out of _parseconfig
Include directives no longer have to be within a section.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
36f702ba82 conf.c: move repo parsing out of _parseconfig
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
74c8943682 conf.c: add parse_options to section_t
This consolidates all of our state information into a single variable.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:06:41 +10:00
Andrew Gregory
12e00af531 pactest: remove results summary
This functionality can be provided by a test harness.  Having pactest
output this information as well clutters the result log created by
automake.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
403c175dbc integrate tests with automake
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
228221003d pactest: accept test names without a switch
This removes the --test switch, making it easier to call pactest from
a test harness.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
9263cc5874 provide default values for test scripts
Our test scripts currently require that the first argument be the
library or binary to be tested.  This makes integrating them with
automake which doesn't have a mechanism for passing specific arguments
to individual tests.  Instead, provide a default built from paths in the
environment which can be provided to all test scripts by automake.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
1152052b3e convert pactest to TAP output
Each test produces a single TAP result with the rules run in a sub-test.
This reduces output when run under automake and makes it possible to
continue setting expectfailure at the test level rather than per-rule.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
429b956fb2 pactest: treat unknown rules as failures
Tests should only be skipped when they aren't relevant, not when the
test itself is bad.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
d3726bbd26 convert test scripts to tap output
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Andrew Gregory
2e2c614f0e query006: only set expectfailure on 32-bit systems
Use the architecture of the python interpreter running the test to
detect 32bit systems.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-08-21 11:00:18 +10:00
Allan McRae
48861f509a Report missing directory if we can not initialise alpm library
When pacman failed to initialise the alpm library due to the database
directory being missing (either via the root not existing or the database
directory itself not existing), it just printed the non-informative
message "could not find or read directory".  Add the directory
information the the error output.  E.g.:

error: failed to initialize alpm library
(could not find or read directory: /this/does/not/exist/var/lib/pacman/)

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:02:06 +10:00
Allan McRae
d7bd40045c Remove setlocale usage from the backend
Using setlocale in the backend is bound to lead to frontend issues
and we have have been using epoch in our databases since April 2007
(commit 47622eef).  Remove support for old style times.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:01:26 +10:00
Allan McRae
e81faa9d6d Warn when directory ownership differs between filesystem and package
We currently only warn if a directory's permissions differ, but using -Qkk
on my system shows that directory permissions tend to change in packages
reasonably frequently without notice.  Provide a warning in such cases
so that it can be altered.  Example output:

(1/1) reinstalling nginx
warning: directory ownership differs on /var/lib/nginx/proxy/
filesystem: 33:0  package: 0:0

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:01:11 +10:00
Allan McRae
640324f1d4 Only note backup file changes with -Qkk
Backup files are expected to be changed and should not be flagged by -Qkk.
Note changed back-up files in -Qkk but do not count them as altered. Do
not report backup files in -Qqkk.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:58 +10:00
Jason St. John
8e533b0363 Fix whitespace in makepkg.sh.in and makepkg-template.pl.in
Replace spaces with tabs in one instance.
Remove extra spaces.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:25 +10:00
Jason St. John
4ad6939980 Fix whitespace in pacsort.c and pactree.c
Replace spaces with tabs.
Remove extra spaces.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:20 +10:00
Jonathan Frazier
0f22bef8c3 pacdiff: provide an --output option to show any .pac* files
This is an option to just echo's the pacnews/pacsaves instead of merging
or removing them. This can be used to check the config status such as in
a cron job without modifying the system.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
2d9dad5e14 pacdiff: make pacmandb search the default type.
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
a79661225a pacdiff: improve speed, accuracy finding active configs using pacmandb
This is a new search type, using -p or --pacmandb options. It reads
config file locations directly from the local pacman db. It will find
active configs anywhere they are defined in installed packages. It is
not dependant on outside configs such as updatedb.conf or scanning a
large set of directories for find.

This will find more pacnews than find when searching with the current
default of /etc, and it is faster than both find and updatedb when
searching the entire fs. When run directly after an update, the local db
is more likely to be cached than all files in /etc or / as other methods
read. This will increase performance further post upgrade.

After a package is removed and a pacsave is created, this method will
not find these pacsaves until the base config is added to the local db
again. These files have no influence in a working system and only take
up a few blocks of disk space.

Active configs need to be dealt with immediately to keep a system
working. pacsaves related to removed configs can remain for weeks or
months without problems. I would recommend occasionally running other
methods such as --locate to remove them.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
15eea825e6 pacdiff: rework search type handling, add --find option
Change cmd tests to if (( USE_FIND ))... as it is cleaner.  All search
cmds have an option and a variable initialized to zero. The active option
should be set to 1.  Add a switch to exclude multiple search options.
set the default when all are equal to zero.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
b1b9ca01f0 pacdiff: add --nocolor option for the terminally challenged.
Allow colors to be disabled for use on broken/serial terminals.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
05e954d2cd pacdiff: allow multiple separated options
loop over arguments, this will allow adding options such as --nocolor

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
bcde027091 pacdiff: clean up and reword --help
Clean up and reword --help
get rid of all the echos to make it easier to read in source.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier
c4d8da4727 pacdiff: Search and give warnings for older pacsave.[0-9]* files
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Ashley Whetter
6e3ea82f9b Corrected return codes for Sg flag
Non-zero is now returned if a group is searched for that doesn't exist.
Fixes FS#36097.

Signed-off-by: Ashley Whetter <awhetter.2011@my.bristol.ac.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:30:03 +10:00
Allan McRae
58832b0d7c Fix typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:29:44 +10:00
Zulker Nayeen Nahiyan
66f3b93331 clarified descriptions for pactree -r (--help)
Signed-off-by: Zulker Nayeen Nahiyan <nahiyan02@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:29:25 +10:00
Allan McRae
29498b6a2a Clarify inter-conflicts message
Use a clear message rather than using a made up word to describe what
we are doing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:29:07 +10:00
Ashley Whetter
a774e4d5e2 Install makedepends and checkdepends together
Fixes FS#31557

Signed-off-by: Ashley Whetter <awhetter.2011@my.bristol.ac.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:28:52 +10:00
Jonathan Frazier
9108bfe080 pacdiff: Add quit to found pacnew options
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:28:40 +10:00
Allan McRae
bcbb6a56a1 Carry a copy of gpgme.m4
On systems without gpgme installed, autoreconf will fail with an unrelated
error message unless the gpgme.m4 file is present.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:28:12 +10:00
Allan McRae
ec24d814ab Remove autoclean.sh
Use 'git clean' instead.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:27:58 +10:00
Allan McRae
28cb22e3c2 Patch ltmain on autoreconf
We used to carry a patched version of ltmain in our repos to fix libtools
issues with -Wl,-as-needed. Now that ltmain is "generated" by autoreconf,
we manually patch it afterwards.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:27:47 +10:00
Allan McRae
1438377401 Use autoreconf in autogen.sh
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:27:35 +10:00
Allan McRae
96a4d1ca04 Update gitignore files for use with autoreconf
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:27:23 +10:00
Allan McRae
df9d19ba73 Remove autotools files
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:27:07 +10:00
Dave Reisner
24abcddc57 be_sync: avoid crashing on files in the root of a DB
If a sync DB is malformed and contains entries in the root of the
archive, load_pkg_for_entry will leave the 'filename' variable empty,
leading to a crash in the ensuing strcmp() calls which determine the DB
fragment being examined.

While this isn't a read error, this should be reported to the user so
that it can be addressed by the creator of the DB.

As seen: https://bbs.archlinux.org/viewtopic.php?pid=1297766

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-07-22 13:26:56 +10:00
Allan McRae
ef6b6fe065 Hide unused parameter warnings when building without libcurl
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:26:42 +10:00
Allan McRae
5cc099a8ab Add missing header
Exposed when building with --without-libcurl

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:26:30 +10:00
Andrew Gregory
897e2b121a use full path when checking for mountpoints
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-05 14:34:58 +10:00
Dave Reisner
eb19d41d5f do not check error from close(2)
On operating systems we support, the behavior is always such that the
kernel will do the right thing as far as invalidating the file
descriptor, regardless of the eventual return value. Therefore,
potentially looping and calling close multiple times is wrong.

At best, we call close again on an invalid FD and throw a spurious EBADF
error. At worst, we might close an FD which doesn't belong to us when a
multi-threaded application opens its own file descriptor between
iterations of the loop.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-05 14:32:23 +10:00
Simon Gomizelj
7b8f8753b1 Consolidate and improve table implementations
Implement both the VerbosePkgList and the summary message with the same
table.

Improve VerbosePkgList by caching attributes and cell's lengths instead
of recaculating them.

Right align every cell that containing a file size in both the
VerbosePkgList and the summary.

Simplify the printf statements and the alignment application.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-05 14:32:09 +10:00
Allan McRae
dcb3b9f85f update to automake 1.14
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:16 +10:00
Andrew Gregory
96ac9c5299 query_fileowner: resolve trailing . or .. in paths
The full path needs to resolved any time it ends with "." or "..", not
just when those are the entire path.  This allows strange-but-valid
paths such as: "/home/." to be queried.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:16 +10:00
Andrew Gregory
b36b87656e query_fileowner: remove useless path variable
We no longer need it for resolving package files and using it to
resolve root is unnecessary as alpm does that for us.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:16 +10:00
Andrew Gregory
de7ccedbe7 query_group: allow package filters
Relocated query_group() to allow calling filter().

Fixes FS#19716

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:16 +10:00
Andrew Gregory
2436351d6e skip unknown repo names for pacman -Sl
Brings pacman -Sl behavior in line with other listing operations.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:16 +10:00
Patrick Steinhardt
dfcea1456d Enable inverted patterns in NoExtract and NoUpgrade.
It is now possible to invert patterns in NoExtract and NoUpgrade.
This feature allows users to whitelist certain files that were
previously blacklisted by another entry.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:16 +10:00
Andrew Gregory
ec831e05f5 deps.c: check for indirect deps when ordering
On upgrades, indirect dependencies were not being detected if there was
a dependency in between them that was not part of the transaction.  For
example, with the dependency chain: pkg1 -> pkg2 -> pkg3, if pkg1 and
pkg3 are being upgraded but not pkg2 pacman would not order pkg1 and
pkg3 properly.

This was particularly problematic when replacements were involved
because the replaced package(s) would be removed at the start of the
transaction.  If an install script required the replacer and lacked
a direct dependency, it could fail.

Fixes FS#32764.

Partially fixes FS#23011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:15 +10:00
Olivier Brunel
00513823dc Make --unrequired filter packages that are optdep as well
Specify it twice to only filter direct dependencies.

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:15 +10:00
Patrick Steinhardt
d7d4f47d63 Install unchanged backup files to get correct timestamps.
Fixes FS#35515.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-26 15:32:15 +10:00
Allan McRae
93f9052557 Merge branch 'maint' 2013-06-26 15:30:55 +10:00
Andrea Scarpino
af1c986383 Respect paths with spaces on --install
makepkg --install doesn't quote the absolute path, so if the path contains
spaces pacman -U fails.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-23 15:45:00 +10:00
Allan McRae
71328479f3 Merge branch 'maint' 2013-06-18 13:59:18 +10:00
Allan McRae
5a0c659a16 4.1.2 release preparation
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 13:38:11 +10:00
Allan McRae
c81615f38c contrib: update .gitignore
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 13:27:31 +10:00
Allan McRae
d985a62172 Pull translation updates
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 13:17:30 +10:00
Karol Blazewicz
cd421c8383 pacscripts: Update for pacman changes
Changes to pacman mean that -Sp can be called without root permissions
and '-d' needs passed twice to completely ignore dependencies.

Signed-off-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 12:55:57 +10:00
Karol Blazewicz
85fde7038f pacscripts: don't read the whole package from cache
'-q' means "Exit as soon as each specified pattern or filename has
been matched." There is no reason to keep reading the whole package
from the cache when the install script has already been printed to
stdout.

Signed-off-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 12:55:35 +10:00
Allan McRae
31d51052e1 checkupdates: Consistency in environmental variable name
Use CHECKUPDATES_DB rather than CHECKUPDATE_DB for consistency with the
script name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 12:53:26 +10:00
Allan McRae
4283199039 contrib/checkupdates: fix typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-16 16:36:20 +10:00
Allan McRae
1b08e26846 makepkg: fix typo for distcc test
Introduced in commit 9dd42dc0.  Fixes FS#35741.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-16 16:33:39 +10:00
Allan McRae
3e0e748b93 Correct INODECMD for BSD and Darwin
Fixes FS#35469.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:57:06 +10:00
Allan McRae
b7f8f5d26a paccache: make --help output look nice on 80 width terminal
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:47:32 +10:00
Phillip Smith
58782b1c55 repo-add; add option to remove existing package files from disk
When maintaining a custom repo, often it is undesirable to retain older
versions of packages. This patch adds the --remove option to remove the
current package file and it's signature from disk before adding the new
one to the database. Documentation is also updated. This is an optional
flag and default behaviour (leaving ondisk files alone) is not changed.

Signed-off-by: Phillip Smith <fukawi2@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:47:32 +10:00
Allan McRae
37e85c0031 Document alpm_list files are to be stand alone
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:47:32 +10:00
Andrew Gregory
ab3d8478c2 die if '-' is given with empty stdin
Several operations default to all packages/repos/etc if no targets are
provided.  If a user provides '-' they almost certainly expect there to
be targets on stdin and will be surprised if pacman falls back to the
default because there are none.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:47:32 +10:00
Allan McRae
9574bfd6c8 Merge branch 'maint' 2013-06-06 13:47:26 +10:00
Allan McRae
450be928da Pull translation updates and regenerate
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:12:20 +10:00
Dave Reisner
d080a469a0 pacman-key: Do not reinterpret keys from revoked keyrings
Given a revoked keyring containing only:

  BC1FBE4D2826A0B51E47ED62E2539214C6C11350

We should only disable this specific keyid. This change enforces that the
contents of the -revoked keyring file are full fingerprints which can uniquely
identify a key.

Before:

  # pacman-key --populate archlinux
  ==> Appending keys from archlinux.gpg...
  ==> Locally signing trusted keys in keyring...
    -> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
    -> Locally signing key 684148BB25B49E986A4944C55184252D824B18E8...
    -> Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887...
    -> Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0...
    -> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
  ==> Importing owner trust values...
  ==> Disabling revoked keys in keyring...
    -> Disabling key 1390420191...
    -> Disabling key E2539214C6C11350...
    -> Disabling key 8544EA82113502DE...
  ==> Updating trust database...
  gpg: next trustdb check due at 2014-01-22

After:

  # pacman-key --populate archlinux
  ==> Appending keys from archlinux.gpg...
  ==> Locally signing trusted keys in keyring...
    -> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
    -> Locally signing key 684148BB25B49E986A4944C55184252D824B18E8...
    -> Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887...
    -> Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0...
    -> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
  ==> Importing owner trust values...
  ==> Disabling revoked keys in keyring...
    -> Disabling key BC1FBE4D2826A0B51E47ED62E2539214C6C11350...
  ==> Updating trust database...
  gpg: next trustdb check due at 2014-01-22

Partially addresses FS#35478. This does nothing to confirm whether or not the
key was successfully disabled -- a ridiculously simple request which appears to
be far too difficult for gpg to manage.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-04 14:01:41 +10:00
Simon Gomizelj
dd62fde53e validate %FILEPATH% when parsing repo dbs
Currently we make no effort to validate the %FILENAME% field in the
repo db. This allows for relative paths to be considered valid.

A carefully crafted db entry with a malicious relative path,
(e.g. `../../../../etc/passwd`) will cause pacman to to
overwrite _any_ file on the target's machine.

Add the following validation:

- doesn't start with '.'
- doesn't contain a '/'
- won't overflow PATH_MAX

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-04 13:45:12 +10:00
Allan McRae
fe794ccb25 Restrict pkgname from starting with a dot.
Adding this restriction means we can filter any FILENAME entry from
starting with a "/" or a ".".  Use the term "dot" as it is more
computing relevant compared to "full stop" or "period" which vary
depending on English locale.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-04 13:38:48 +10:00
Andrew Gregory
cbbd3781c2 improve dir->file transition conflict resolution
Packages removed due to conflicts are always removed at the beginning of
the transaction and as such can be included in the check for whether all
owners of a directory will be removed in a transaction.  Installed
versions of packages being upgraded, other than the one with the
conflict, cannot be used because our transaction ordering is not
intelligent enough to ensure that they are removed prior to the
installation of the conflicted package.

Also, return false from dir_belongsto_pkgs on errors.  Previously, we
simply continued which could return true even if we were unable to
actually establish that the package owned the entire tree.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
47762ab687 query_fileowner: remove symlink support
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
b1e495b88d unlink_file: treat symlinks like normal files
We always want to work with the package file itself, not its target if
it's a symlink.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
bc3e73fc8f extract_single_file: consolidate symlink cases
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
c91d948486 conflict.c: check for file -> dir replacements
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
0b3d04719d conflict.c: exclude trailing slash from file path
After the initial checks, we either use the path as a directory and have
to append the trailing slash anyway or use it as a file in which case
the trailing slash should be excluded.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
aa7e42db11 conflict.c: do not ignore symlink<->dir conflicts
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
5cfa4ec47e alpm_filelist: remove resolved_path
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Andrew Gregory
0c41663c7b update tests for symlink support removal
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-03 13:33:47 +10:00
Jason St. John
9ca423b981 Revise pacman(8)
Resolve several grammatical errors and minor formatting consistency issues
in pacman(8). Generalize the "FTP servers" and package file extension
information.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-30 13:12:00 +10:00
Jason St. John
5df5d2c411 Revise PKGBUILD(5)
Resolve several grammatical errors and minor formatting consistency issues
in PKGBUILD(5).

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-30 13:11:46 +10:00
Florian Pritz
477fd794a0 makepkg-template: add --version and some license info
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-30 13:11:02 +10:00
Eric Bélanger
f1d74d928a Remove backslash typo from makepkg man page
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-05-29 14:45:45 +10:00
Florian Pritz
a36d4b2831 makepkg-template: Stop using given/when
given/when has been marked experimental in perl 5.18 because it will
change it 5.20. if/else is ugly, but hiding the generated warning is no
good solution either, so we us if/else for now.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:17:21 +10:00
Florian Pritz
cbc25c22fc makepkg-template: Add gettext support
This also slighty changes the word order in the description for
--newest.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:17:21 +10:00
Florian Pritz
ce3125196d Add makepkg-template
This allows for somewhat easy templating for PKGBUILDs.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:17:21 +10:00
Jason St. John
7ea58d09f6 Update example PKGBUILD
Update doc/PKGBUILD-example.txt with several changes from the official
Arch Linux package for patch-2.7.1-1, including other changes shown below:

-- replaces spaces with tabs in functions
-- replaces 'make prefix=' with 'make DESTDIR='
-- improves quoting of the "cd" command in functions

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Jason St. John
4fadcbfab2 Quote sources in PKGBUILD prototypes and example PKGBUILD
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Allan McRae
dc08eca368 Improve error message when package is missing required signature
When attempting to install a package (either via -S or -U) and the
signature is missing, the current error message "invalid or corrupted
package (PGP signature)" is very unclear.  Instead inform the user
that the package is missing the required signature.

Partial fix for FS#34741.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Andrew Gregory
9555ec714a pacman.8: document .pacorig files
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Andrew Gregory
e5dd8c2ac5 add.c: refactor backup file modification checks
The previous implementation was overly complex with unnecessary checks
and nested conditionals.  By reordering the tests and changing them to
all be checks for positive hash matches rather than non-matches, we can
collapse several cases and make the process much more linear.  This
removes the need to set hash_orig = "" just to reach some of the checks
and corrects a faulty assumption that files are equivalent when the
hashing process fails.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Phillip Smith
5bcc058d42 makepkg: add support for CARCH environment var
Add support for overriding configuration in /etc/makepkg.conf and
~/.makepkg.conf by setting the environment variable CARCH similar to
how SRCDEST and PKGDEST behave.

Fixes FS#35030.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Allan McRae
a975523fb9 Clean partial downloads from cache
When using "pacman -Sc" to clean the cache, it make sense to also remove
partially downloaded files.

Fixes FS#34317.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:03 +10:00
Allan McRae
dece66ac18 makepkg: remove support for PKGBUILDs without a package() function
Not having a package() function means all building occurs as root
and repackaging can lose permissions.  Given the use of package()
functions has been around for years and we deprecated not having
one in pacman-4.1, we can remove support for PKGBUILDs without
package() functions altogether. However, keep PKGBUILDs that have
neither a build() or package() function working.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:02 +10:00
Allan McRae
3b4e74cb3b makepkg: Add helper to test for functions in build script
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:02 +10:00
Allan McRae
28dd29dedb makepkg: remove sourcing PKGBUILD from stdin
Using PKGBUILDs from stdin means that we can not use pkgver() in
packages.  Given we have the "-p" option to pass any file to
makepkg and passing a PKGBUILD in the form "cat foo | makepkg"
does not work, this feature is unneeded.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:02 +10:00
Andrew Gregory
296e630edd pmtest: set LC_ALL=C in subprocess.call
LC_ALL=C is required to force pacman's output to English for tests that
rely on that output, but setting it in Makefile.am results in those
tests breaking under different locales when pactest.py is run directly.
This will also ease an eventual transition to python3 which LC_ALL=C
causes to default to ascii encoded strings, creating problems for tests
with unicode strings.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 14:08:02 +10:00
Allan McRae
84ac55b052 Merge branch 'maint' 2013-05-29 14:02:56 +10:00
Jason St. John
7d2c7fb347 Fix various typos in NEWS
imporve -> improve
diskspace -> disk space
BTRFS -> Btrfs
filelists -> file lists
filesize -> file size

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-29 13:56:55 +10:00
Allan McRae
d235f54114 Remove incorrect bug number from NEWS
The wrong bug number is mentioned in commit 32327dc8 and this was
perpetuated into the NEWS file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-19 22:53:06 +10:00
Allan McRae
8335e169a6 makepkg: Use LOGDEST for logpipe
If LOGDEST is set, we may not check that $startdir is writable. Store
the log pipe in LOGDEST instead.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 23:14:21 +10:00
Allan McRae
1ed881fed3 Fix comment typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 22:43:12 +10:00
William Giokas
090c4006d7 contrib: Remove harcoded /etc/pacman.conf
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 10:43:42 +10:00
Dave Reisner
8be08f7cae Revert "paccache: avoid subshell in calling runcmd"
su is terribad. In addition to reverting, this also removes support for
privilege escalation via su. If you want to use paccache as root and
fail to comprehend how much better sudo is than su, then run paccache
directly via su.

Fixes FS#35173.

This reverts commit 597286eb25.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 10:43:16 +10:00
Dave Reisner
72c6d19d64 makepkg: fixup broken revision and repo references
bzr support "worked", but didn't handle any of the actual features we
wanted with makepkg. This moves the revision specification to the proper
place (extraction, rather than download), and fixes an additional broken
reference to $repo which was never set.

Fixes FS#35281.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 10:42:30 +10:00
Allan McRae
0f988beff8 Merge branch 'maint' 2013-05-07 12:59:44 +10:00
Allan McRae
a4a7336dff 4.1.1 release NEWS, version bumps, etc.
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-07 12:53:24 +10:00
Allan McRae
35289bc17e More translation updates
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-07 12:53:23 +10:00
Andrew Gregory
692633264a pacman/util.c: add missing braces
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-07 12:53:23 +10:00
Andrew Gregory
34da9d25e4 pacman/util.c: fix output flushing in questions
Flush stream before taking input in select_question() and only flush
once during question().  Also fix some tabs inside related fprintf
statements.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-07 12:53:23 +10:00
Andrew Gregory
c5716d0e72 conflict.c: compare package pointers directly
p1 and p2 both come directly from the upgrade list without being copied
so they can be compared directly instead of comparing their names.

Also fix minor style violation.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-05 07:45:33 +10:00
Allan McRae
0aa9628560 Pull translation updates from transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-30 21:18:42 +10:00
Eric Bélanger
9de33488bf Add --noprepare option to makepkg
This new option disables the prepare function. Useful in combination
with -o to get an unpatched copy of the sources for testing purpose.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-30 21:04:21 +10:00
Eric Bélanger
91b9ea922a Add -V/--version option to makepkg's usage function and man page
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-30 21:01:38 +10:00
Dave Reisner
c5a4b35528 makepkg: avoid redirecting stdout
If stdout is already redirected, redirecting stderr to stdout can lead
to undesirable results.

Fixes FS#34974.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-28 23:11:37 +10:00
Allan McRae
c1dfdd2010 Use libalpm version in pkg-config file
We currently use the pacman version number in the libalpm.pc file. It makes
more sense to use the libalpm version.

Fixes FS#34967.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-26 12:43:53 +10:00
Eric Bélanger
99b8d78bc6 Add prepare function to PKGBUILD proto files
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-24 13:57:50 +10:00
Connor Behan
b8c8447971 Remove ALPM_QUESTION_LOCAL_NEWER
Remove a question that hasn't been used since the 3.0 days. To prevent
us from having an ugly enum of questions that is missing a bitmask, this
changes the API of the hidden --ask option.

Signed-off-by: Connor Behan <connor.behan@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-24 13:47:19 +10:00
Connor Behan
ee3b70c4a9 Unify front and backend responses for --print
When libalpm asks the user a question, there are two possible defaults.
One default for pacman (used when the user presses enter without typing
and for --noconfirm) and the libalpm default. Currently the libalpm
default gets used for the pacman "--print" option. This affects the
printing of ignored packages since the defaults differ for
"ALPM_QUESTION_INSTALL_IGNOREPKG". Adjust the response of this case when
using --print so pacman acts consistently.

Signed-off-by: Connor Behan <connor.behan@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-18 13:26:16 +10:00
Anatol Pomozov
769facca22 Fix spelling errors using 'codespell' tool
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-18 13:20:13 +10:00
Andrew Gregory
9f9cf95692 util.py: replace file() with open()
open() is the standard way to open a file in python.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-15 11:25:33 +10:00
Andrew Gregory
e19091b2bf pmpkg: default mode 0755 for dirs in sync packages
TarInfo objects default to mode 0644 while mkfile in util.py uses 0755
for directories, causing pacman warnings about differing permissions on
tests involving package updates.  Set the mode on TarInfo directory
objects to 0755 unless the test specifies a different mode.

Bug referenced in FS#30723.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-15 11:25:18 +10:00
Dave Reisner
597286eb25 paccache: avoid subshell in calling runcmd
Avoids problems with one of the worst CLI tools ever created, su.

Fixes FS#34656.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-12 09:42:43 +10:00
Allan McRae
695f0e443e makepkg: fix svn repo extraction
Copy SVN repos rather than using "svn export" to keep all anotation
files in the repo for build scripts that use (e.g.) "svin info".

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-12 09:42:43 +10:00
Allan McRae
7e0f528274 Do not use checkout directory for SVN config
Using the checkout directory for the SVN config can result in clashes
between config files and files from the SVN checkout.  Instead, use
a ".makepkg" directory within the checkout.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-12 09:42:41 +10:00
Maxime Gauduin
2bf2700b74 Add support for all bzr URLs in the PKGBUILD source array
Add support for all bzr URLs, including "lp:" URLs, in the source array.
This, however, requires an internet connection and will fall back to the
current behavior for offline builds. In that case, only the URL reported
by 'bzr config parent_location' run inside the local repo can be used,
and is outputted.

Signed-off-by: Maxime Gauduin <alucryd@gmail.com>
2013-04-11 10:56:50 +10:00
William Giokas
b7c994db8b makepkg: don't run remove_deps twice when unneeded
remove_deps already has a check and won't run unless -r is specified, so
if this was meant to remove dependencies of a failure no matter what,
then it's not doing it, and with -r it is run twice on a failure for no
real reason.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-11 10:53:52 +10:00
Allan McRae
3de8f8f1cc Rework callback message to add translation
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-11 10:53:52 +10:00
Allan McRae
32c91e2895 contrib/checkupdates: do not log
Avoid the log file filling up with "[PACMAN] synchronizing package lists".

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-09 11:52:32 +10:00
Andrew Gregory
95c68d26ef pacman: add -Qkk to usage() help
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-09 11:51:46 +10:00
William Giokas
0f486adfec contrib: Use sysconfdir instead of /etc
Don't force people to see /etc.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-09 11:51:45 +10:00
Dave Reisner
87acfef166 makepkg: avoid file|grep dependency for CRLF check
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-06 15:37:48 +10:00
Andrew Gregory
fa601c41ed makepkg: remove extra ansi color codes
All those extra '\e[1;'s were just setting bold redundantly or
immediately being cancelled.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-06 15:32:21 +10:00
Daniel Wallace
f9280a0523 zsh completion: make sure -Ss works
if you put a type in pacman -Ss <regex> it doesn't work because it never
passes through they pointer ->sync_search to set $state.  All of the
other iterations like this have a case, add one for -S*s*

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-06 13:16:05 +10:00
Simon Gomizelj
0f05bfc340 ctypes.h shouldn't be included twice
Earnestly spotted this on #archlinux.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-06 13:01:49 +10:00
William Giokas
7b10519835 doc: fix debug spelling mistake
with -> when

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-06 12:59:02 +10:00
Andrew Gregory
b5a7734a7e use off_t for table_row_t.size
size went from off_t in _display_targets to int in
add_transaction_sizes and back to off_t in humanize_size
leading to potential overflows.

Fixes FS#34616.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-06 12:55:09 +10:00
Allan McRae
5caf143faa Bump to version 4.0.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-01 15:53:13 +10:00
Allan McRae
e9639ad172 Update translations from transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-01 15:53:12 +10:00
Daniel Wallace
8d3ee29809 remove continue from download_local
Bug exposed by a6291858cc

popd doesn't run in the for loop in download_sources() if the continue
in download_files is executed. Causing the extract_files to extract
everything into $SRCDEST instead of $srcdir

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-04-01 15:53:12 +10:00
Simon Gomizelj
afc77a808d pm_asprintf logs 'failed to allocate' already
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-31 11:08:54 +10:00
Richard Pougnet
c85d155f3a Improve documentation of libalpm interface functions
Add details to the doxygen for the initialization and relase functions
of the library.

Signed-off-by: Richard Pougnet <richard@pougnet.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-31 11:08:54 +10:00
Andrew Gregory
950443a438 makepkg: unset GREP_OPTIONS
grep allows options to be set from the environment with GREP_OPTIONS.
Many of these options will alter grep's output, breaking makepkg.
GREP_OPTIONS=--line-number breaks installed dependency removal, for
instance.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-31 11:08:54 +10:00
Andrew Gregory
d5c0f39144 use default foreground color instead of white
Using white made important text invisible on terminals with white
backgrounds.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-30 09:06:12 +10:00
Allan McRae
a6291858cc Ensure we are always in $SRCDEST before downloading
When VCS sources were updated, we changed into their root directory.
Any following source was then downloaded to an incorrect place causing
a failure in makepkg.  Ensure we are always in the $SRCDEST directory
before starting any download.

Fixes FS#34488.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-30 09:06:12 +10:00
Allan McRae
3f00a03db4 Final NEW update for pacman-4.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-30 09:06:12 +10:00
Allan McRae
d413178354 Add releases and dates to table
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-30 09:06:12 +10:00
Allan McRae
a31e8bdff6 Document -Qkk
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-30 09:06:12 +10:00
Simon Gomizelj
38f0a7d462 signature_display should also be colourized
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-26 15:55:51 +10:00
Kyle Keen
f797749c4e contrib: adding checkupdates
Signed-off-by: Kyle Keen <keenerd@gmail.com>

[Allan: update contrib/README]
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-26 15:55:51 +10:00
Allan McRae
bf3618a7c1 contrib: Update bash_completion
Check all options are included in bash-completion.  Alphabetize the
pacman_key options for easier maintenance.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-26 15:55:51 +10:00
Allan McRae
6e2c15099a Remove duplicate option
The "skippgpcheck" option was specified twice.  Also, fix alphabetical
ordering.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-26 15:55:51 +10:00
Daniel Wallace
fb522face1 zsh_completion: remove sigfiles from package files completion
use setopt extendedglob to remove sigfiles from package completion

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-26 15:55:51 +10:00
Daniel Wallace
cd6ca88c49 zsh completion: make $tmp local
The tmp variable is conflicting with the $tmp variable in
${^fpath}/_main_complete(N) and which is used to complete all the
functions, and causing an error: command not found: for whatever was in
$tmp (which in this case is the last value in $words[@])

making it local fixes this.

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-26 15:55:51 +10:00
Allan McRae
3eee3d67af More translation updating
Pull updates from transifex.  Add new "id" translation.  Regerate po
files with updated filelists...

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-17 13:53:38 +10:00
Allan McRae
47a7ea8c86 Update POTFILES.in for libalpm and pacman
Be complete with files listed. Comment out files where code is used
or heavily based on other projects so will never have translatable
strings.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-17 13:53:38 +10:00
Allan McRae
66fe80f39b repo-add: Update copyright year
Also adjust translations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-15 13:21:32 +10:00
Allan McRae
a554e1a460 Fix typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-15 13:21:32 +10:00
Allan McRae
aa550a85f1 Merge updates from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-15 13:21:32 +10:00
Allan McRae
a97f792d3c Remove Indonesian translation
I imported this translation from transifex without realising that there
was no strings translated despite being "acitve" on transifex for quite
some time.  Remove it until translation begins...

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-15 13:21:32 +10:00
Jason St. John
9cd344fb0d Update documentation to use https links for sites that support it
The Arch web site now redirects to https links for all subdomains, so it
makes sense to use these links in the docs for pacman. Links were
changed to use https for a couple other sites that support it as well,
such as gnu.org and kernel.org.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-15 13:21:32 +10:00
Allan McRae
b2ea5f6860 update util-common.h copyright year
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
Allan McRae
e42e9ab873 Make "[removal]" translatable
Fixes FS#34241

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
Allan McRae
0ba9b262ab Revert "makepkg: Use a recursive git clone."
This reverts commit 8b03b1a877.

It is much better to download the submodules using separate source entries
and adjust the submodule configs to point at these versions in the
prepare() function.

See https://mailman.archlinux.org/pipermail/pacman-dev/2013-March/016771.html
for an example.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
William Giokas
342924f796 doc: consistent formatting for pacman.conf options
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
William Giokas
fa620685fa doc: Fix pacman-key title formatting
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
William Giokas
8c33d7f1ef doc: Fix pacman.conf formatting
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
Allan McRae
f3f257405b Add compression defaults for lrzip and lzo
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
Allan McRae
d5a06e964c Add Local/RemoteFileSigLevel to example config
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
Eric Bélanger
9ec049f518 pacman.conf: Remove empty line at end of file
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:12 +10:00
Eric Bélanger
0d99b54ba2 makepkg.conf: Add staticlibs to default OPTIONS array in comments
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:11 +10:00
Dan McGee
163c36bdcd Save and restore old locale when manipulating via setlocale
We shouldn't assume a frontend program didn't explicitly set the LC_TIME
setting to a value not in the environment, which is what we previously
assumed. Save the old locale before forcing the 'C' locale and restore
it when we are done.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:11 +10:00
Dan McGee
62f828014f Use C locale when parsing UseDelta floating point values
We should save the current locale, use the 'C' locale during parsing,
then restore the original locale. Config files should always parse
regardless of the current user's locale setting. Fixes FS#34253.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:11 +10:00
Andrew Gregory
d35a7fb6f3 alpm/remove.c: add newlines to debug output
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:11 +10:00
Dave Reisner
6c870953c5 pkgdelta: fix improper passing of file argument
Looks like I hosed this pretty hard in 5a5e712c74.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:11 +10:00
William Giokas
63f04177c3 zsh completion: Add new makepkg opts
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-14 11:47:10 +10:00
Allan McRae
1e21aa589d Update all translations files to push to Transifex
Run update-po and fix the few errors reported.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 13:32:11 +10:00
Allan McRae
0cb963df03 Remove all leading :: from pacman translations
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 13:32:11 +10:00
Allan McRae
c5652361fb Pull updated translations from transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 13:32:10 +10:00
Allan McRae
1366da57fa Add new languages from Transifex
Languages: eo, nl, hr, ko, ja, fa, ar, sl, gl, id

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 13:32:10 +10:00
Allan McRae
6a85e4a9ca update transifex config
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 13:32:10 +10:00
Allan McRae
b878157c78 fix distribution of contrib files
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 11:33:59 +10:00
Allan McRae
f9be4eed42 distribute library/term_colors.sh
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 11:33:59 +10:00
Allan McRae
312e9252f4 Bump to version 4.1.0rc1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:25:49 +10:00
Daniel Wallace
41ef7eff75 zsh completion: add support for all longopts commands
add all the longopts for the operations and allow for them to be
completed just like shortopts

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
0e5c22e7a1 zsh completion: include flags that can be doubled
include the flags that could be doubled up like -Sii -Syy -Suu -Qii etc
also include the long opts of all the commands

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
0d4ecae625 zsh completion: fix doubling up of specific variables
-i -y -u -d -s etc, so that they do not disappear

In the future I hope there is an easy way to limit it to just 2, right
now the *- makes it so that it can be added as many times as you want.

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
1b78e2bb1a zsh completion: add --color to completion
Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
8fd62a39b5 zsh completion: make sure all indentions are tabs
Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
704ab17a6a zsh completion: use consistent case statement style
Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
8db7e0c98d zsh completion: fix stacked completion
Before this, if you do pacman -Sy<tab> it completes to -y.  Now, with -S
and the other operations in the actual option _arguments, it won't
remove the operations.

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Daniel Wallace
e43c271650 zsh completion: add deptest and database
Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:07:00 +10:00
Andrew Gregory
c9b7f9b0d0 testdb: quote output substitutions
Quoting output substitutions makes whitespace errors such as FS#30101
much more obvious:

old:
    missing perl-test-pod  dependency for perl-test-output
new:
    missing 'perl-test-pod ' dependency for 'perl-test-output'

Several of the quoted substitutions should not be capable of containing
whitespace in theory, but this errs on the side of caution as the point
of the tool is to find error conditions.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Andrew Gregory
0ff57350fb testdb: pass empty local pkglist to alpm_checkdeps
Passing the local package list to alpm_checkdeps as both the local
packages and packages to be upgraded did nothing but cause extra
overhead as the packages were all removed from the installed package
list because they were being upgraded.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Andrew Gregory
43a2f63194 pmpkg: add missing directories to test packages
Several tests require complete file lists in order to provide accurate
results.  These can be non-obvious.  Adding missing parent directories
helps insure the integrity of tests against human error.  Filling in
parent directories also allows us to check that file lists are actually
valid.

There didn't seem to be a good place to do this that was always
guaranteed to be run, so this adds a finalize() function to packages
that will always be run before the package is actually used to allow for
this type of tidying.

Fixes FS#30723

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Olivier Brunel
2259dff7f3 makepkg: Add --verifysource to only download/verify source files
Because --noextract also implies to not download/verify source files, it wasn't
possible to simply do that, without either extracting and/or building.
(Note: --verifysource takes precedence over --noextract)

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Neer Sighted
93fa63ee8a makepkg: Make VCS download functions use get_filename
Make all VCS download functions uses get_filename to get the repo name.
In addition, creating a working directory from a Bazaar repository now shows
the short-name of the repository, not the full path on disk.

I'm not sure if the name of the variable that holds the basename of the local
clone should still be `repo`, but I have left the variable name for simplicity.

Signed-off-by: Neer Sighted <neersighted@myopera.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
William Giokas
fcdaa46b65 makepkg: Separate vcs download and extract
Previously makepkg would clone vcs sources in the download function,
regardless of the noextract settings. Now the download_* functions only
download or update the vcs sources, and the new extract_* functions just
create working copies using the specified protocols. The extract_sources
function will call the needed extract function for the protocol
specified. The tarball extraction has also been moved into its own
extract_file function to keep things consistent.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Simon Gomizelj
06d761a020 make paclog-pkglist understand 'downgraded'
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Simon Gomizelj
ce9fd69eba make status/log messages reflect version change
Currently pacman either prints 'adding' or 'upgrading' when installing
a package. This make pacman print and log the other possible actions:
'downgrade' and 'reinstall'

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Allan McRae
9876d97839 bash_completion: update for color
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Simon Gomizelj
51276f1ac5 remove the duplicate strnlen and strndup
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Dave Reisner
08a1244f4e libalpm/sync: remove useless intermediate variable
This also rearranges some code to ensure that declarations and code
aren't mixed.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
William Giokas
d90641a894 contrib: Add color to paccache
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:40 +10:00
William Giokas
6e0c47d22f contrib: Add color to bacman
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:40 +10:00
William Giokas
f8ed8620d0 contrib: Make pacdiff colors the same as makepkg
Added an `ask` message function that emulates pacman's appearance.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:40 +10:00
William Giokas
5a67eee78c scripts: Add color to repo-add
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas
79d60f0f42 scripts: Add color to pkgdelta
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas
81f945e2a5 scripts: Add color to pacman-optimize
Color enabled by default, use --nocolor to disable colored output.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas
9d99914a18 scripts: Add color to pacman-key
Use --nocolor to suppress colored output from pacman-key, otherwise
output will be in color.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas
2c91b991ee scripts: Add color to pacman-db-upgrade
Color enabled by default, use --nocolor to turn off colors.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas
65650f2cdb scripts: Add color to library/output_format.sh
Use the same colors as makepkg in messages. Add in the 'plain' function
as well.

To use the colors, you need to include the term_colors.sh file, or add
definitions for the colors explicitly.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
Simon Gomizelj
e292b1b5a2 update documentation and config files
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
32f3b4304c colourize -Q
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
7dd1a5a58d colourize -Sl/-Ql
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
326345b378 colourize -Ss/-Qs
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
46c10c5bf3 colourize the output of -Qi/Si
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
ce06e6f9b9 colourize table output
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
5dada13a1a colourize warnings and errors
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
e8130b8f2c colourize colon_printf and question
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
6582f68c9d introduce colstr for colourizing
colstr_t colstr will hold the colourizing agents.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
c8c7a51374 add a config settings and flag for colours
Colours can be enabled in two ways:

- Add Color to pacman.conf. This enables colours automatically.
- Use --color=WHEN where WHEN is none/auto/always.

WHEN as 'never' disables colours (overrides config file), as 'auto'
enables colours when stdout is a tty, and 'always' enables colours no
matter what.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj
ea42d03ea1 standardize format functions
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj
ce5ee8a065 remove format from statistic messages
Remove the format component of the "Total Download Size" and related
messages. The heading will be colourized, the size won't.

However since the length of these messages can vary by language, we need
a pretty printer to format them nicely.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj
b4459f1e04 split "Packages (%zd):" message
Basically all translation messages that need colouring but _also_ happen
to be format strings need to be split up.

This makes it easy to conditionally embed colour codes into the output
at runtime.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj
ef5feb15a7 remove :: prefix from all message
This will substantially simplify the logic to add colours to messages.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj
098cfe516d refactor common code in query_search/sync_search
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Neer Sighted
8b03b1a877 makepkg: Use a recursive git clone.
Make makepkg use a recursive clone when creating the working directory.
This will initialize submodules

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:48 +10:00
Sébastien Luttringer
6831a5f4b1 makepkg: Avoid find to fork for each rm call
Reported-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:48 +10:00
Sébastien Luttringer
a03f5f55cd Add staticlibs option in PKGBUILD
This option helps to removes static library files in packages.

Related to the thread:
https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.html

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:48 +10:00
Olivier Brunel
017184fab5 libalpm: Search for replacers before literals
Since 882bff36 literals would be searched before replacers, resulting in a
package being replaced by another not actually being replaced under certain
conditions (e.g. they're both in the same repo).

This change effectively reversed the expectations in test sync132. This patch
switches the order back to replacers first, thus making sure if a package is
replacing another one, the change will always happen, even if both are in the
same repo.

Note that a package replacing another one in a repo with higher priority will
not be done, see FS#11737 and test sync1105

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Olivier Brunel
1b39653e96 libalpm: Fix installing update of a replaced package
During a sysupgrade, if a package is replaced by another, and an update for the
former package is found (on another repo) the replaced package would be
re-installed.

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Andrew Gregory
a98bb96b43 fix typos in pacman tests
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Allan McRae
e6b8d5189f Do not resolve every local package filelist on remove
Although technically correct, this results in my system taking ~30 seconds
to resolve all filelists when removing a package that has a directory not
owned by any package.  The check for if any package own the empty directory
is a rare enough occurance, and it will be even rarer when that directory
has a directory symlink in its path, so just revert this at this stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Andrew Gregory
8e2648bf02 add SYMEXPORT to alpm_filelist_contains
alpm_filelist_contains is listed in alpm.h and should be public but was
not exported.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Dave Reisner
3d142fe8ef dload: don't download sig if package is found in cache
Avoids the segfault seen in FS#33911.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Richard Pougnet
63baba13ec Provide full path names in warning messages
Fix FS#31556 by printing filename instead of entryname. Thus,
removing a lot of confusion from the output.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Dave Reisner
972528c021 paccache: use xargs to execute mv/rm commands
This removes the restriction on the length of the command line, as xargs
will work around by running multiple instances of the command for us.

As seen: https://bbs.archlinux.org/viewtopic.php?pid=1232959

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Allan McRae
34749e177d Perform limited conflict checking with --force
Pacman currently bails when trying to extract a file over a directory
when using --force.  Instead of ignoring all conflict, perform the
check and skip any file-file conflicts. Conflicts between directories
and files are still flagged and cause the transation to abort.

As a bonus, we now know about files changing packages when using
--force, so we can skip removing them fixing upgrade046.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory
19754b34a3 use resolved_path for filelist_contains
alpm_filelist_contains was being used to search for resolved paths, but
searching in the unresolved paths, causing it to miss matches.  We
always search unresolved paths and search the resolved paths if
available because _alpm_filelist_resolve is not public and requires
a context handle, so it can't be called from alpm_filelist_contains.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory
083ac51816 return resolved paths from filelist_difference
We were comparing files based on resolved paths but returning the
original file_t structures, which were not necessarily in the same
order.  The extra file_t information was only being used to determine if
the file was a directory which can be accomplished by testing for
a trailing slash, so just return the resolved path.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory
9995510dc8 return resolved paths from filelist_intersection
We were comparing files based on resolved paths but returning the
original file_t structures, which were not necessarily in the same
order.  The additional file_t information was never used, so just return
the resolved path.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory
4a1d93b92c add fileconflict tests for cases with symlinks
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory
0bbc406ee8 use alpm_list_free on filelist intersection
alpm_filelist_intersection returns a list of pointers to internal file_t
struct's, so only the list itself should be freed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory
8803ae3b4d pmtest: install filesystem entries before packages
Installing filesystem entries first allows the filesystem to provide
a symlink to a directory.  Packages will then be able to use the symlink
as if it were a directory instead of causing an error.

For example:

self.filesystem = ["dir/", "link -> dir/"]
pkg = pmpkg("pkg1")
pkg.files = ["link/file"]
self.addpkg2db("local", pkg)

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:44 +10:00
Andrew Gregory
bc747fbfbf fix off-by-one error in _alpm_filelist_resolve
'/' should not be appended to the resolved root when root is "/".

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory
d5a5a6b512 fix style violations
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory
578dfcd977 fix alpm_validation_t comment
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory
158a249a77 add alpm_logaction to API updates
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory
c1a84c03b2 find_fileconflicts: reduce path resolution calls
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Dave Reisner
0a5b79e133 makepkg: add support for .pkg.tar.lzo
Supported by libarchive as of version 3.1.0 when compiled against lzo2
or in the presence of the lzop binary.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Dave Reisner
540cae816a makepkg.conf.5: fix bulletted list item formatting
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Dave Reisner
26a79cb29d libalpm: never attempt to remove a mountpoint
Arch Linux typically runs into this with /sys when upgrading the
filesystem package in build chroots, but LXC users might also run into
this, since their /sys is shared from the host and must, for security
reasons, be mounted RO.

I've neglected to add any tests for this because they would require root
in order to run. Current tests all pass with this patch and I've
confirmed the desired behavior in a VM. Incidentally, the first hunk of
this patch (skipping can_remove_file checks for directories) resolves the
case of API mountpoints being removed since they eventually fall into
unlink_file and fail with "contains files". However, this patch should
still be the Right Thing To Do™, as we can't possibly remove a directory
that is also a mountpoint.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>

[Allan] Do not skip checking if directories can be removed. Instead test
if directories are mountpoints in can_remove_file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Allan McRae
8fe8233dfa Fix registering database with non-gpgme builds
We record whether the default SigLevel is set in order to add upon
it for the *FileSigLevel entries.  When using the only valid value
of "SigLevel = Never" with non-gpgme builds, we need to ignore
the ALPM_SIG_PACKAGE_SET flag when determining if we have a valid
value for the database SigLevel.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:33 +10:00
Allan McRae
87ffc648b7 Fix --without-gpgme build
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:33 +10:00
Allan McRae
1d0a69c655 Fix gpgme detection
The gpgme detection had a couple of issues which are fixed:

1) In some cases it would not error out when gpgme was missing and
--with-gpgme was passed.

2) In some cases, the CFLAGS/LDFLAGS etc would not be properly
restored.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:33 +10:00
Allan McRae
3fa2830829 Add format attributes to all required functions
Fixes all clang warnings with -Wformat-literal.

Also, fix genuine formating issue discovered once adding these attributes
and add a cast to prevent a gcc warning.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:33 +10:00
Allan McRae
05b0d7e799 Fix --enable-warningflags
gcc gives an error on an unknown warning flag, but clang just gives a
warning.  Upgrade the warning in clang to an error by activating
-Werror=unknown-warning-option if available.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:33 +10:00
William Giokas
42b492b2fd makepkg: fix -r and --needed conflict
In makepkg, passing -sr --needed causes there to be a conflict when
pacman goes to remove the dependencies, as the --needed flag is not an
option for pacman -R. This patch makes --needed not get added to the
PACMAN_OPTS array, but it acts like ASDEPS, and is only added to an
install function.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:33 +10:00
Allan McRae
bafee395a6 Fix compilation error on clang
This also lead me to notice that in _alpm_gpgme_checksig many things
were not being cleaned up.  Fix this by having CHECK_ERR goto gpg_error
and make the required adjustments.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:32 +10:00
Allan McRae
572b1a5de7 makepkg: add lrzip compression support
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13 11:50:32 +10:00
Martin Panter
390b08f18b Exit with failure status if download or installation is not confirmed
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
9aead554bc pacman: print version information in debug output
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
d2ce93bc54 Quieten the build process some more
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
17d4ec5ed8 Skip reading sync db deltas files if UseDelta is unset
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
711b6d3911 Update NEWS for pacman-4.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
3068b52f9a README: update with 4.0 -> 4.1 API changes
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Andrew Gregory
829aeb2c2c README: update alpm options
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
5f5469c774 Import key if needed when installing package from file
When installing a package with "pacman -U" that has a detached
signature, check if the needed key is in the keyring and download
if necessary.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
0d89c10f4b Prompt to delete packages with signature fails
Offer to remove the bad package when a signature fails to validate
as is done for checksum failures.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
4ccf16dff5 Remove retry path from signature validation
Now that the keyring is checked for all needed keys before the
validation, we can not reach a point of a missing key when doing
validity checks for sync operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
31b9b264c1 Check keys are in keyring before package validation
Keys used to create signatures are checked for presence in the keyring
before package validation is performed.

Signed-off-by: Allan McRae <allan@archlinux.org>

Conflicts:
	lib/libalpm/alpm.h

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
198154962b Make decode_signature available to the library
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
05745089ac Add function to extract key id from signatures
This does not support all possibilities of RFC4880, but it does
cover every key currently used in Arch Linux.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:37 +10:00
Allan McRae
4ec6848f91 Move key importing into separate function
This will be useful for checking the availablity of all keys before
perfoming validation in sync operations and for downloading a needed
key in upgrade operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:36 +10:00
Allan McRae
45b6d36cf7 Make key_in_keychain available in library
In preparation for checking key presence and downloading needed keys
before conflict checking.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-09 12:43:36 +10:00
Allan McRae
c0835ff08e Additions to .mailmap
Standardize on the most common name for email addresses with multiple
name variants.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Chirantan Ekbote
defa561558 Document fakeroot and fakechroot as dependencies
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Allan McRae
fc0ec7644c Remove outdated instructions in pactest README
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Chirantan Ekbote
2d832adf08 Remove conditional checks for fakechroot from test files
We don't want test files to do any checks for fakechroot since we will
print a warning if it is not found.

Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Chirantan Ekbote
2f137fdd39 Print a warning if fakechroot is not found
Fixes FS#33551.

Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Andrew Gregory
1631255357 use strtok_r to parse multi-value config options
This prevents multiple spaces between values from being
parsed as empty values.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Andrew Gregory
ec339969d9 document that stdin must not be a tty to read from it
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Allan McRae
7956441350 Better error message with "-" is specified without stdin
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Allan McRae
5c5cdb0eb9 doc: update PKGBUILD man page
Rearrange the functions section of the PKGBUILD man package. Clarify
that the package() function is a requirement and the rest are all
optional.  Note that $pkgdir should only be used in the package()
function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Allan McRae
f170a94c13 makepkg: make $pkgdir non-accessible during build()
The idea of having separate build() and package() functions is that
build() is run as a normal uses and package() as (fake)root.  Any
files placed in $pkgdir during build() can have the wrong permissions.

Restrict access to $pkgdir during build() - unless there is no package()
function.

Also, set $pkgdir to something "useful" during build().  For split
packages, this uses "<path>/pkg/$pkgbase" because it is not obvious
which $pkgdir is being referred to.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Andrew Gregory
274c3890b0 make test/scripts/human_to_size.sh executable
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Andrew Gregory
529cf928ab add missing utilities to contrib/README
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Andrew Gregory
6617182229 unset executable bit on updpkgsums.sh.in
No other contrib script is executable.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Dave Reisner
7edd262a06 inline libarchive compat wrappers
Suggested-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Allan McRae
05d83c46fd Document LocalFileSigLevel and RemoteFileSigLevel
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Allan McRae
33b3b6d9b8 Add configuration option for Upgrade operation SigLevel
Add LocalFileSigLevel and RemoteFileSigLevel to control the signature
checking for "pacman -U <file>" and "pacman -U <url>" operations
respectively. The starting value for both these options is SigLevel,
if it is specified in the [options] section, or the built-in system
default. The specified values override and/or supplement this initial
value. Note there is no distinction between setting "Required" and
"PackageRequired" as there are no database options for Upgrade
operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-07 10:48:11 +10:00
Dan McGee
3aece8f0ee Restore libarchive 2.8.x compatibility
We still call some of these 'deprecated' methods elsewhere, so this
shouldn't present a problem. When we decide 2.x support is to be dropped,
we should update all of the code to not call deprecated methods.

Allan: Adjusted with respect to previous patches adding libarchive
compatibilty layer.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:37:32 +10:00
Dave Reisner
e1e4bbb79d Use libarchive compat header for relevant symbols
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:37:32 +10:00
Dave Reisner
2a57c2068c add libarchive compatability object
This allows us to support both libarchive 2.8.x as well as 3.x without
deprecation warnings on compile.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:37:32 +10:00
Chirantan Ekbote
266b3dd706 makepkg: Integrate check_install into tidy_install
Rearrange tidy_install so we first remove docs, unwanted files,
libtool files, and empty directories.  Then check for missing backup
files and references to $srcdir and $pkgdir.  Finally compress manpages,
strip debug symbols, and compress executables with upx.

Fixes FS33318

Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:37:25 +10:00
Dave Reisner
27067b1372 dload: pass back the effective URL to callers of _alpm_download
I suspect that eventually we're going to end up returning a pointer to
an allocated struct to describe the download result, but that's for
another patch when the need arises...

Fixes FS#33508.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:36:58 +10:00
LANGLOIS Olivier PIS -EXT
f21e1f54aa Relax requirement of what constitutes a dead connection
Users have hit issues behind corporate firewalls that initially throttle
downloads to ~1B/sec.

Signed-off-by: Olivier Langlois < olivier.pis.langlois@transport.alstom.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:36:58 +10:00
Simon Gomizelj
cb43bd8dfb Consolidate --foreign/--native filtering
Also fix a small bug where pacman won't check if the sync dbs are first
downloaded when invoked with --native (it should).

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29 13:36:58 +10:00
Maxime Gauduin
8624eddb31 Make sed follow symlinks on Linux
Signed-off-by: Maxime Gauduin <alucryd@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Andrew Gregory
24a78fe731 paclog-pkglist: parse entries with caller info
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Andrew Gregory
66a9b53141 add caller prefix to alpm_logaction
prefix defaults to "UNKOWN" if null or an empty string is provided.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Allan McRae
8308c7b320 Update "missing" file
The latest automake release causes complaints about an out of date
'missing' file during configure.  Sync with upstream.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
William Giokas
457642231e Fix printing of paths
Originally printed a leading \ before all path names as the `' would be
removed during the make. Using '' should be just as good as using `'.

paccache.sh.in:
die "cachedir \`%s' does not exist or is not a directory" "$cachedir"

paccache
die "cachedir \%s does not exist or is not a directory" "$cachedir"

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Andrew Gregory
6bbf6e8fa1 add doxygen comments to conflict.c
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Dave Reisner
250aaefb27 paccache: pass the --file option to pacsort
Resolves FS#33455.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Dave Reisner
a64a713fc2 pacsort: add -f, --files option for sorting filenames
Teach pacsort to understand package filenames and optionally strip away
some of the context. alpm_pkg_vercmp() intentionally only understands
pure versions, so strings such as '18.0-2-x86_64' and '18.0.1-1-x86_64'
will be compared wrongly.

Partially addresses FS#33455.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Allan McRae
89ecf8cabe Make path to ldconfig configurable
The FHS (2.3) says having ldconfig in /sbin is optional and it is usually
located in /usr/sbin.  So /sbin/ldconfig should not be hard coded in
pacman.  Instead, provide a configure option --with-ldconfig that defaults
to the current path.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Allan McRae
e3d8197d67 Remove leading / for pactest paths
The leading / makes the pactest suite look for the file in the users
filesystem.  This meant the ldconfig tests always passed (even when
broken in pacman...).

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:46 +10:00
Allan McRae
801f7d1033 pactest: handle non-default scriptlet shells
pacman can be configured to use a different shell than /bin/sh for
scriplets.  Pass the cnfigured value to the pactest suite and make the
necessary "copy" of the shell in the test root.

Also update all copyright years in the pactest suite.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:38:34 +10:00
Allan McRae
ad280e1b56 Revert execvp and related commits
This reverts commit 4a8c2852a8.
This reverts commit 993700bc6b.
This reverts commit bb4d2b72c1.
This reverts commit 60b192e383.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-28 23:30:40 +10:00
William Giokas
b27886ab59 makepkg: Formatting consistency in write_pkginfo
The difference between the echo and the printf's in write_pkginfo seemed
to be somewhat sporadic. Also, the INFAKEROOT check was doing the same
exact thing as the SPLITPKG check, but formatted much differently and
consuming two extra lines. I think this makes it more readable than it
was previously, if nothing else.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Dave Reisner
132e1ac10c dload: avoid showing progress bars on some redirects
RFC 2616 doesn't forbid a 301 or 302 repsonse from having a body, and
servers exist in the wild that show this behavior. In order to prevent
pacman from showing a progress bar when we aren't actually downloading a
package (and merely following one of these pain in the butt redirects),
capture the server response code in the response header, rather than
waiting to peel it off the handle after the download has finished.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Reported-by: Alexandre Filgueira <alexfilgueira@cinnarch.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Allan McRae
c628d649f6 Fix release dates
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Allan McRae
4a8c2852a8 pmtest: resolve path to scriptlet shell
In order to support a variety of values for the --with-scriptlet-shell
configure flag, pmtest has to be aware of what kind of path was passed,
be it an absolute path or a fragment for a path lookup. For absolute
paths, leave the path alone. For fragments, search the PATH environment
var for the resolved path to the binary. In both cases, join the
resultant path to the root directory defined for the test, not a
pre-determined bin directory.

Fixes FS#31552.

With-contribution-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Allan McRae
993700bc6b Do not require full path for scriptlet shell
This increases robustness to the shell location changing paths.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Allan McRae
bb4d2b72c1 Do not use full path for ldconfig
The ldconfig binary is not guaranteed to be in /sbin. Change to calling
just "ldconfig" rather than using the full path.

This removed the check that the ldconfig binary exists. However, it is
a reasonable assumption that it will exist if its configuration file
does.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Allan McRae
60b192e383 Use execvp for running programs in chroot
This makes us more robust to utilities changing paths.  There is no
functional change when a full path is specified.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-17 22:32:54 +10:00
Andrew Gregory
9c160cf3f3 Allow querying directory ownership
The restriction of not checking the ownership of a directory is
unnecessary given that all the package filelists contain this
information. Remove this restriction, with the expectation that you
might get multiple packages returned for a given directory.
Additionally attempt to minimise the number of files getting through
to the slow realpath call.

Original-work-by: Dan McGee <dan@archlinux.org>
Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:38 +10:00
Andrew Gregory
7a83cd003a query_fileowner: don't append '/' if path is "/"
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:38 +10:00
Pierre Schmitz
49c5f515e9 pacman-key: reduce verbosity of --populate
Do not bother the user with gpg's verbose output.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:38 +10:00
Allan McRae
09295f7e40 pacman-key: handle local signing of multiple keys
gpg --lsign-key does not like being given multiple keys to sign.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:38 +10:00
Gerardo Exequiel Pozzi
86eefc1a3a Fix space between control structure and open parens
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:38 +10:00
Gerardo Exequiel Pozzi
b5709b8171 Fix open braces style
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:37 +10:00
Gerardo Exequiel Pozzi
e13a3bf599 Fix missing spaces in operators
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:37 +10:00
Gerardo Exequiel Pozzi
46e9afdd74 fix comment style // -> /* */
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:37 +10:00
Allan McRae
925d44bde6 Fix spacing in HACKING spacing example
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:37 +10:00
Pang Yan Han
b6320de4be Save backup files with extension .pacsave.n
Teach pacman to save backup files with extension .pacsave.n, where n is a
positive integer. The current backup file shall be saved as <name>.pacsave,
while existing .pacsave.n files will be renamed to <name>.pacsave.n+1

Example:
1. You have subversion installed in your local repo. /etc/conf.d/svnserve
   is a file to be backed up. It contains local modifications

2. You remove subversion from your repo. /etc/conf.d/svnserve is backed up as
   /etc/conf.d/svnserve.pacsave

2. You install subversion again

3. You edit /etc/conf.d/svnserve

4. You remove subversion. The existing /etc/conf.d/svnserve.pacsave is renamed
   to /etc/conf.d/svnserve.pacsave.1 and /etc/conf.d/svnserve is backed up as
   /etc/conf.d/svnserve.pacsave

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>

Rebased from original email and adjusted for util-common usage.
Signed-off-by: Florian Pritz <bluewind@xinu.at>

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:37 +10:00
Allan McRae
27d9c25ee2 Split common utility functions for libalpm and pacman
There is duplicated code in the util.c files in the libalpm and pacman
source code. Split this into a separate file so that it can be shared
via a symlink. This prevents code divergence between the two code bases.

Also, move mbasename and mdirname from pacman/util.c into util-common.c
in preparation for the following patch that uses them to add an extension
to pacsave files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-04 21:49:37 +10:00
Danny George
965e1de217 Add a -n option to repo-add to only add new packages
Packages are already in the pkg db were given a warning, and then
readded anyway.  With -n specified, the warning is printed, but skips
readding it.

Signed-off-by: Danny George <dangets@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
William Giokas
fe0586e240 makepkg: Print out full version on pkgver update
When building sources with a pkgver function, makepkg will print out the
original version before pkgver() is run, claiming that that is the
package that will be built. This patch simply re-prints the output
later, after pkgver() has been run so people can see which package they
are actually building.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Allan McRae
b455bbc91d Update Doxyfile
A few parameters were outdated and this produced warnings from Doxygen

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Allan McRae
342f079f7e doc: Fix section link in pacman-key man page
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Danny George
04821ea9ca Fixed missing asciidoc id
Generated webpage contained dead links to section 'Package and Database
Signature Checking'
2013-01-03 12:03:10 +10:00
Allan McRae
241d6b884a makepkg: use --apparent-size when du supports it
Amazingly, using "sleep 1" to convince btrfs to report correct file
sizes is only a 90% fix.  Sometimes more sleep is needed.

Instead we use the --apparent-size argument to du to get actual file
sizes. This is used only on Linux as the various BSDs do not support
this argument.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Allan McRae
d5a6ce8ca1 Remove checks for geteuid
The geteuid function is defined in POSIX and we will not support any
operating systems without it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Allan McRae
5aaf5bcf83 Remove Cygwin support
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Florian Pritz
23f93118d0 pacdiff: update copyright notice
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Florian Pritz
163ba4016e pacdiff: Add option to overwrite, clarify remove option
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Florian Pritz
495460d717 pacdiff: check cmp's exit code rather than output
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Florian Pritz
6a804d55dd pacdiff: be more verbose if we rename or remove
Doesn't hurt and reassures the user that we did the right thing.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Florian Pritz
dd3762edc4 pacdiff: color filename and mention what we found
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Dan McGee
2616cb5fdc Use a defined constant in delta.c for num_matches
This allows compiling in both clang and gcc without running into
oddities regarding const vs. defined constant values.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-03 12:03:10 +10:00
Dan McGee
038b1815d0 util/pactree: correctly free the deps list in walk_deps()
If we are reversed, then we were correctly freeing both the list and the
contained data. However, we were leaking a list in the case of a
non-reversed traversal.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:10 +10:00
Dave Reisner
60d2588192 parseopts: remove superfluous continue/shift statements
Fun fact about bash: the below is valid and will only ever print 'a'!

  fn() {
    continue 2
  }

  for x in {1..5}; do
    for y in {a..e}; do
      echo "$y"
      fn
    done
  done

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:09 +10:00
Allan McRae
1dd3405813 Update copyright year for 2013
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:09 +10:00
Allan McRae
5186f702d3 Remove leading "./" from filenames in mtree file
A properly formatted mtree file may stick a leading "./" in front
of file names in the root directory.  Strip this if present.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
7d27b2b0f4 Check file types match before comparing properties
Bail early in file validation checks if the file type given in the
mtree file does not match that in the filesystem.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
ddd2b9e6f6 Check "install" and "changelog" files for changes
The "install" and "changelog" entries for a package  in the local
database are now checked for changes with -Qkk.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
01e093d0ae Perform full checking of files with -Qkk
The follow fields are checked:
  Directory: uid, gid, mode
  File: uid, gid, mode, size, time
  Symbolic Link: uid, gid, mode, link, time

A skeleton is added for checking a files md5sum and sha256sum when
reading this information is supported by libarchive.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
327c272bb4 Basic running of pacman -Qkk to check mtree files
If a package has an mtree file, using pacman -Qkk will read that
file and use it to perform more in depth package checking.

Currently this only checks for file presence.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
cfd9f1cc69 Separate checking a files existence into a function
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
18ddf90ff4 Move check function into its own file
There is going to be a lot of overlap in the code for the quick
and full checks that can be abstracted into their own functions.
Also many other file checking functions will be needed for the
full check. Put all these in a separate source file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
097d5a478b Add public functions for accessing mtree data
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
0445c68d9b Add internal functions for reading mtree file from local db
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
da3a0333de Extract .MTREE file into local package database
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
ad3a26c615 makepkg: add mtree file into package
Add an mtree file to the package with all file information. This
can be added to the local pacman database on install allowing full
package verification.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 13:45:12 +10:00
Allan McRae
f5d904d97f Do not warn about missing database if being downloaded
When a configured repo database is not already downloaded, a warning
message such as "warning: database file for 'testing' does not exist"
is printed.  Disable this warning when the database is scheduled to
be downloaded in the transaction.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
422a4021e4 Fix future signature timestamp warning
The warning given for a signature timstamp being in the future compared
to the system time stated the opposite.

Also, move this warning to debug output.  It is useless in its current
form as the package or database that is giving the error is not
mentioned and so other debug output is needed to find the offending
signature.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Jason St. John
a9ad5a75f2 Replace space-based indents in prototypes with tabs
The previous commit removed the Vim modelines which replaced tabs with
spaces. This commit replaces the space-based indents with tabs.

Tabs are generally more compatible with various user preferences
regarding indentation of code. Using space-based indents is not flexible
regarding user preferences at all.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2012-12-14 12:35:34 +10:00
Jason St. John
1dc3de3f69 Remove Vim modelines in prototype files
It makes little sense to "force" users to replace tabs with spaces, with
a width of 2. These settings should be configured by the user in their
own ~/.vimrc.

This is a resubmission based on Allan's feedback on the ML.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2012-12-14 12:35:34 +10:00
Simon Gomizelj
95f566d98a Print package name before changelog entry with -Qc
Fixes FS#32362

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory
53d610e0a5 query.c: simplify is_foreign
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
William Giokas
0c74ffd6b6 Added LOGDEST variable
Places logs in a pre-defined location. The logs are always neatly
labeled with package names and numbers, and this way can be more easily
sent to network shares as they are written or compressed/cleaned en
masse.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory
964640fbfc Plug various minor memory leaks
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Dave Reisner
c8417f3386 makepkg: normalize whitespace in $pkgdesc when writing .PKGINFO
Specifically, we shouldn't allow newlines in the pkgdesc field, as
pacman will ignore the continuation and end the description prematurely
as written to the local DB. Normalize ALL whitespace, replacing it with
single whitespace characters.

Fixes strange errors as seen by FS#32852.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Dave Reisner
5a5e712c74 pkgdelta: avoid use of eval and IFS manipulation
Instead of blindly consuming data from the .PKGINFO file, parse it more
closely and only declare variables as needed.

Should help to avoid nonsensical errors and possibly dangerous command
execution as seen in FS#32852.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
8e736e1c9a Display install status of optdependencies
When a packages (new) optdepends are printed in install (update),
add a note of their current installation status.  Packages currently
installed are labelled with [installed] and packages to be installed
in this transaction are labelled [pending].

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
62f1c590fc Make alpm_pkg_find public
This function is particularly useful, so make it public.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Benedikt Morbach
7a24f909fc Add pactest for "Optional for" output
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
d0e5cd2c7f Add "Optional for" to package information output
Much like packages that require a give package are displayed in the
"Required by" field of its information output, alos display packages
that optionally require the package.

Inspired-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Benedikt Morbach
9a24f1ffc5 Add pactests for displaying optdep installation status
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
63a2874fe4 Display optdep install status in package query output
Indicate which optional dependencies are installed when viewing
local package information (-Qi).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
eb9e74ecc7 Notify of removed package required as optdepend
When a package is being removed, provide a notification (via a callback)
if any local package requires it as an optdepend.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
0c2edbdd49 It turns out we do care about directories...
This is a bug that has been around since at least 2007.  On a package
upgrade (either by -S or -U) a new directory could overwrite any file.
This is caused by the filelist difference calculation ignoring all
directories and thus no new directories were checked for conflicting
files on the filesystem.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Florian Pritz
4a427dbc1b Add pactests for not detecting directory conflicts with upgrades
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory
5a247ccbd4 Fix overzealous package removal with unmet dependencies
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>

[Allan: Remove expected failure from fixed pactests]
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
927fdc0079 pactest: variant of package removal due to unmet dependencies
Duplicate of sync140.py but with the alphabetical ordering of the
packages changed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
1c2cfc5bad pactest: removal of packages with unmet dependencies
Provide a package for removing packages with unmet dependencies.
Currently pacman removes too many packages from the transaction
(FS#30649).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory
9cd7ff807d _alpm_filelist_resolve: add useful return code
Return -1 if a path is too long to resolve or we run out of memory.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
948f135a73 Avoid upgrade conflict with unchanged effective path
This applies to a case such as when /lib is a symlink to /usr/lib. If a
package is installed which contains /lib/libfoo.so, pacman will complain
if this package is then "fixed" to contain /usr/lib/libfoo.so. Since
these have the same effective path and it exists within the same
package, ignore the conflict.

Fixes FS#30681.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
88e7ea421e Resolve file paths during inter-package conflict check
File paths are resolved if necessary during inter-package conflict
checks so that packages carrying the same effective file due to
directory symlinks on the filesystem are flagged as conflicting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory
28d404f16a _alpm_filelist_resolve: use original filenames where possible
If a filename isn't resolved, the original can be used instead of strdup()ing
it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory
80bc89c147 Add _alpm_filelist_resolve
The _alpm_filelist_resolve function takes a filelist and creates
a list with any symlinks in directory paths resolved.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
2fad78974d Add resolved_path to alpm_filelist_t
Add an array to hold the resolved paths of the files in alpm_filelist_t.
When the file name and its resolved file name are identical, the pointer
to the original file name is used to avoid duplicate memory allocation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
c1abfeae1e Detect inter-package conflicts between files and directories
Detect a conflict between a file/symlink in one package and a directory
in another when both are being installed at once.

A side effect is the creation of conflicts between a directory symlink
and a real directory (e.g lib -> usr/lib in pkg1 and /lib in pkg2).
Given we can not guarantee pkg1 is installed before pkg2, this is a
genuine conflict.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
6860e2f703 pactest: Provide a full filelist to the pactests that need it
It turns out when you set the filelist for a package to include
"usr/lib/foo" in the pactest suite, it thinks there is only the
file "usr/lib/foo" in there...  No "usr/" or "usr/lib/" directory.
This makes life difficult when testing code that scrolls through
a filelist looking for directory entries.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae
254329f6fb makepkg: install debug symbol packages if requested
When using "makepkg -i", install the debugging symbol packages too
if present.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
dbbe3e7cb4 makepkg: assign debugging symbol directory to a variable
Simplifies the stripping of files a lot.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
13667fd4b1 makepkg: allow debug package suffix to be configurable
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
7e8d9dfda2 makepkg: create package from stripped debug symbols
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
a5e81f5599 makepkg: output the name of the package being created
Although it should be currently quite obvious what package is being
created when "Creating package..." is printed, it will not be in the
future when a debug package is potentially created too.  Also, given
$pkgname is always correctly set when split packaging now, we no
longer need to pass that around.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
bd4ff4a377 makepkg: strip debugging symbols into separate folder
When using the "debug" option in combination with "strip", move the
debugging symbols into a separate directory ($pkgdir-debug/usr/lib/debug)
suitable for creating a package from.

Create hardlinks between debugging symbols of hardlinked files and add
symlinks in the .build_id directory if the binary has a build ID.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
a53fd79632 makepkg: always use pkg/$pkgname as $pkgdir
Unify split and single packages to always use a folder within pkg/
as thier $pkgdir.  This will allow a folder for storing a package with
stripped debug symbols to be added within pkg/ too.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
6be96e7612 makepkg: move debug symbol stripping to separate function
Move stripping of files to a spearate function that will be expanded
for the handling of creating debug symbol packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
6c22ef2c82 makepkg: add option to include debugging compiler flags
Add a "debug" option that appends the compiler flags specified in the
variables DEBUG_CFLAGS and DEBUG_CXXFLAGS in makepkg.conf to their
counterpart buildflags.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
7199fb3b1a makepkg: always run tidy_install on repackaging
When using "makepkg -R" without a packge function, we should still
run tidy_install as the user might have added other packaging options
such as (e.g.) '!emptydir' to remove empty directories on repackaging.
Of course we can not revert some options when repackaging without a
package function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Andrew Gregory
a459156a4e pactree: unindent first limb
Removing the leader for the toplevel package shifted the name left
but not it's limb.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner
d9e8197e60 pactree: unify output between utf8 and ascii
Ensure that both output formats have equal spacing, and therefore an
equivalent layout. This change also removes the styling from the
toplevel package being searched for.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner
8054a254cb pactree: fix style violations
Stick to c89 and avoid mixed code and declarations, and always brace
block statements, even if they're only 1 line.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner
1c0c292728 pactree: autodetect and use unicode line drawing characters
Add a compile time check for langinfo.h so that we can possibly use
unicode line drawing characters if the current locale is supportive of
them. This can be explicitly disabled at runtime with the use of a new
switch: -a, --ascii.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Andrew Gregory
e1fdcfb145 pactree: style last branch node differently
Also removes the less helpful provides-specific branch tip.

  Old:                        New:
  |--pkg                      |--pkg
     +--dep1 provides dep5       |--dep1 provides dep5
     |  |--dep2                  |  `--dep2
     |--dep3                     `--dep3
        |--dep4                     `--dep4

[dreisner@archlinux.org: switch original suggestion of \-- to `--]

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Andrew Gregory
c4c5b8ba1d pactree: fix --sync getopt value
The long --sync options has apparently never worked.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
wgiokas
6b1deedf15 Add --needed option to makepkg
Simply add the option to pass the --needed flag to pacman when using -i
with makepkg. When using makepkg in scripts, particularly for git
packages with the new version functions and not just a date, this can
save disk io and time instead of reinstalling.

This would mostly be useful with the --noconfirm option.

Signed-off-by: wgiokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Jason St. John
3536975bbf Use sentence case in makepkg
Most of makepkg already uses sentence case. This cleans up the last few
stragglers.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
3531533c2f makepkg: save path to PACMAN and test availability
After we install dependencies, we source /etc/profile so that new
elements get added to the path. As this can override any local setting
of PATH, we store the full path of the PACMAN variable passed to makepkg.

Also, add a check for PACMAN availability if it is needed to deal with any
dependency operations.

Reported-by: Martin Panter <vadmium à gmail·com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Martin Panter
86233476b0 Remove last traces of handling command arguments in $PACMAN
This resolves an inconsistency with how the $PACMAN variable was interpreted.
Previously “makepkg” would extract the first word from the $PACMAN variable
and check that it existed as a command. This appears to have been happening
ever since the variable was implemented in revision 66c6d28 (makepkg: allow
to specify an alternative pacman command). Thus it looks like command
arguments were originally allowed in the variable.

However the run_pacman() function now quotes $PACMAN, so the whole variable
has to be just the command name. This quoting was introduced more recently,
perhaps in revision 622326b (makepkg: fix sudo/su calling of pacman).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Christian Hesse
0285c678ab makepkg: fix signing built package
Fixes issue introduced in 9dd42dc0

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
3232c975c6 makepkg: deprecate PKGBUILDs without a package() function
The package() function has been around since pacman-3.3 and has
significant advantages including limited fakeroot usage and correct
repackaging.  The ability to use PKGBUILDs without a package function
will be removed in a future release.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
93148d0879 makepkg: print "SKIP" for signature checksums
There are valid reasons for a source files PGP signature to be changed
(expired key, expired signature, additional person signing...). Thus
providing a checksum for signature files can potentially cause a
PKGBUILD to require unnecessary updating.

Avoid this issue by using "SKIP" for the signature checksum.
Fixes FS#31590.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
fbf96203ab makepkg: use last match in BUILDENV/OPTIONS array
Using the last match in the BUILDENV and OPTIONS arrays allows the
user to easily override these values without specifying the entire
array. For example add "BUILDENV+=(sign)" in ~/.makepkg.conf.

Fixes FS#26701.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Simon Gomizelj
fc35b16fd4 pacman: add -n/--native filter to -Q
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
b1d614a01d doc: PKGBUILD.5 - fix output of bzr command
Add quotes around 'bzr help revisionspec' to make it clearer that
this is a command to be run.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Paul Barbu Gheorghe
b25dda737b fixed erroneous memory access to newurl in alpm_db_remove_server
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
fe8bd95092 repo-add: quote filename for consistent output style
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner
ded25aeb98 etc/Makefile: simplify build rule for conf files
This lets us define the build rule and the dependency all at once, and
additionally removes the need for an intermediate temp file.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner
40d6894910 buildsys: eschew use of DEFS, prefer AM_CPPFLAGS
This is redundant, and any usage of -D should belong to CPPFLAGS.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner
768c8ba100 configure.ac: cleanup duplication in --enable-git-version
Avoid adding our own messaging, as autoconf will add this for us with
the result of the AC_CHECK_FILE test. Reuse the cache variable from
autoconf to set our local variable.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
977489d9ab m4/po.m4: Remove use of deprecated macro
Switch from AM_PROG_MKDIR_P to AC_PROG_MKDIR_P to avoid automake warning.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dan McGee
1d0ab50c05 Fix thinko in configure.ac CFLAGS empty checking
Since commit d2669b47, CFLAGS specified on the command line haven't been
respected at all, resulting in no optimization being applied to builds.
This exposed one warning flag issue in some new code, which is also
fixed here.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dan McGee
b57ada336b Fix typo in acinclude.m4 fs_old_*flags
Introduced in commit d2669b47.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae
2abe1f1646 makepkg: fix incorrect bracket usage
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:46 -05:00
Gary van der Merwe
3b02f80dcb makepkg: Add Bazaar VCS support
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:35 -05:00
Allan McRae
ea452d0277 makepkg: fix order of --help output
Small alphabeticalization issue in options passable to pacman.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:23 -05:00
Allan McRae
8b9cb8e03d makepkg: allow fragment to contain a "#" character
The frament element of a vcs url may contain the "#" charcter in the
(e.g) branch or tag name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:02 -05:00
Allan McRae
306c274239 makepkg: always check makepkg.conf for match to download protocol
The list of which download protocol should look in makepkg.conf for the
download agent was hard coded into makepkg.  Instead, fallback to checking
the the download agents array for any non-local or (implemented) vcs
source.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:40:44 -05:00
Allan McRae
7a4f76c2af makepkg: do not embed timestamps in compressed manpages
This will make the checksum of man pages match across architectures
despite different build times.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:40:17 -05:00
Allan McRae
2d347132ba makepkg: check if hg and svn directories are non-empty before updating
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:40:08 -05:00
Allan McRae
800799ea63 makepkg: do not create hg working directory on checkout
Creating the working directory can waste a lot of space.
Fixes FS#31221.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:39:52 -05:00
Gary van der Merwe
03ea8ca6a9 makepkg: Improvements to get_filename:
* For any vcs other that git, the fall through resulted in being handled by the
  code for std url, hence fragments were being left on.
* Handle vcs urls than end in a slash correctly, eg http://example.com/project/

Signed-off-by: Gary van der Merwe <garyvdm@gmail.com>
2012-09-18 08:39:37 -05:00
Mohammad Alsaleh
c926c39b04 makepkg: check if $dir is a local clone of the right git repo
Before this patch, makepkg does not check if $dir is a local clone of
the right repo.

For example, git fetch would be run even if $dir is not a local
bare clone of a git repo in present in source(), but a subdir of
a checked-out one. That means makepkg can potentially fetch from
a completely unrelated remote and update completely unrelated
dirs/files.

This patch adds a check to make sure we are fetching from the right
remote.

Signed-off-by: Mohammad Alsaleh <msal@i2pmail.org>
2012-09-18 08:39:18 -05:00
Mohammad Alsaleh
34b52c9a60 makepkg: git clone instead of git fetch if $dir exists but empty
Before this patch, makepkg would only check if $dir exists as an
indication that a local clone exists. And if $dir does exist, makepkg
will run git fetch inside it unconditionally.

After applying this patch, makepkg will check if the existent $dir is
empty. And if it is, it will be used to store a local clone.

Signed-off-by: Mohammad Alsaleh <msal@i2pmail.org>
2012-09-18 08:39:08 -05:00
Allan McRae
8f5ee72974 Avoid interger overflow when calculating remaining line length
When the len and cidx were changed to size_t in a8a1b093, it was
possible to have an integer overflow when a line ended right at the
edge of the terminal width.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:38:45 -05:00
Allan McRae
7262f4bed4 Fix typo in documentation
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:38:15 -05:00
Allan McRae
8550680924 makepkg: fix warnings with --noextract
Three warnings after someone deliberately typed --noextract is a
tad excessive...   Also, an empty $srcdir is perfectly valid when
the source array is empty, although using --noextact then is
wasteful.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:38:08 -05:00
Dave Reisner
aa50df630c makepkg: implement dir_is_empty for dir content checks
Rather than calling upon ls for this, use a proper shell function which
uses globbing to determine the existance of files in a directory.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-18 08:37:46 -05:00
Dan McGee
369c5aa7dd Merge branch 'maint' 2012-09-18 08:36:10 -05:00
Allan McRae
c4ab50584f pacman.8: remove redundant section
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:35:57 -05:00
Florian Pritz
f7558856b1 signing.c: warn if time went backwards
GPG signatures have a timestamp which is checked and if it's in the
future, verification will fail.

Dan: slight wording change.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-09-18 08:35:53 -05:00
Dave Reisner
37de9df7c0 pkgdelta: pass correct args to create_delta
Somewhere in the arg parse refactoring, the args array went away and we
simply stashed our remaining parameters as positionals. Fix this up so
that pkgdelta doesn't mysteriously hang in read_pkginfo().

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-18 08:30:17 -05:00
Allan McRae
87f9377b32 Fix documentation typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:30:05 -05:00
Allan McRae
e32d129967 Remove incorrect documentation for unlink_file
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:29:55 -05:00
Andrew Gregory
ea35ce5d2e query_fileowner, mdirname: add error checks
Also consolidates cleanup for query_fileowner.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-09-18 08:28:34 -05:00
Andrew Gregory
de7a5cf346 query_fileowner: remove assumption that root is "/"
Returning "/" from mdirname removes it as a special case which allows us to
test it like any other directory.  This corrects a false positive when querying
a file in / and root is not set to /.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-09-18 08:27:59 -05:00
Andrew Gregory
03f2e2360a query_fileowner: remove trailing '/' from targets
Trailing '/' in paths causes lstat to dereference symlinks to
directories which causes it to break even though the symlink is a valid
target.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-09-18 08:27:23 -05:00
Andrew Gregory
140c76d328 query_fileowner: resolve root early
Resolving root early prevents later calls to realpath from having to do the
work of actually resolving any symlinks in root.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-18 08:24:02 -05:00
Andrew Gregory
9648887481 query_fileowner: remove resolve_path function
resolve_path is a equivalent to calling realpath(path, NULL) except that the
returned string is guaranteed to be PATH_MAX long.  We never append to the
returned string, so this is unnecessary.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-09-18 08:21:42 -05:00
Andrew Gregory
bad00696f3 query_fileowner: break/continue pkgfile loop
Break out of pkgfile loop on match or continue if
the pkgfile path is too long.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-09-18 08:19:11 -05:00
Allan McRae
89319b5bfd Document system and user specific makepkg.conf
Add details of the system wide and user specific versions of
makepkg.conf to the man page.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-18 08:10:24 -05:00
Allan McRae
19b8298ce8 pactest: allow running with valgrind from any directory
When using the --valgrind flag with the pactest.py script, the path
to the suppression file relies on the script being called from the
source root directory.  Construct the path from the scripts location
to allow it to be called from directory.

Dan: style cleanup.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-18 08:09:57 -05:00
Allan McRae
0fe562011c Move important information up in -Si output
Currently, the package description is printed at the end of the -Si output.
This is probably one of the more important pieces of information so should
be nearer the top. Also move the package architecture up.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-07 21:10:16 -05:00
Jason St. John
632912261a PKGBUILD.vim: improve 'options' highlighting, add extra keywords
This fixes the current syntax highlighting behavior in the 'options'
array, which does *not* flag illegal options (e.g. typos, unsupported
options). The shDoubleQuote and shSingleQuote options were the culprits.
Now, if you enter `'!imptydurs'`, the typoed option will be flagged red.

I also added syntax highlighting for the new options listed in `man 5
makepkg.conf`, which I believe were introduced around pacman 4.0.0.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-07 20:59:27 -05:00
Barbu Paul - Gheorghe
c52bb7030c removed the condition in alpm_db_set_servers since FREELIST is NULL safe
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-07 20:56:57 -05:00
Barbu Paul - Gheorghe
527ae7092d added coding standard
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
2012-08-07 20:56:45 -05:00
Barbu Paul - Gheorghe
a50d1bc9ab fixed typo
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
2012-08-07 20:56:02 -05:00
Dan McGee
024bc44a25 Merge remote-tracking branch 'allan/working-split/vcs' 2012-08-07 20:55:11 -05:00
Dan McGee
0c95b294e9 Merge branch 'maint' 2012-08-07 20:54:59 -05:00
Florian Pritz
8853a6f282 coding style fixes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-07 20:32:30 -05:00
Allan McRae
c9b31ad622 Print repo being search for replaces in debug output
Given the message is repeated for each repo, it is a good idea to
print the repo name in the output.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-07 20:30:54 -05:00
Allan McRae
a818766c6e makepkg: delay checking for build package with pkgver()
If a pkgver() function is specified, delay checking the package is
built until the pkgver is updated..

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
7e4aa9e524 makepkg: add hg url support
Supported fragments are branch, revision and tag.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
d51902c978 doc: Add --holdver information for makepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
062204daa1 doc: Document using svn source url
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
c887ccf905 doc: document automatically updating the pkgver variable
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
e0cd7b0293 doc: Document using VCS sources in a PKGBUILD
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
4b129d4843 makepkg: check pkgver validity after updating
If a PKGBUILD has a pkgver() function, skip checking the pkgver validity
until it has been updated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae
b1e75d7dd6 makepkg: only update pkgver when all sources are available
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
6c8def6ae0 makepkg: add --holdver to control VCS source updating
Do not update VCS sources if --holdver is used. If the VCS checkout
is not present, it will still be downloaded.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
7fd56118d0 makepkg: do not download VCS sources unless needed
VCS sources are not needed for --geninteg or --source operations.
This also prevents VCS downloads outputting to stdout, which
prevented piping -g output to the PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
b3e82ec59e makepkg: rename myver
myver is a bit generic for an internal variable name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
2042b79bcc makepkg: add support for SVN urls
Allow SVN repo sources in the form:

source=("<folder>::<repo>#<fragment>")

where <repo> must start with svn (e.g svn+http://) and a <fragment>
can specify a revision (e.g. revision=22).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
888020de90 makepkg: provide mechanism for auto-updating pkgver
Now that VCS repos are provided in the source array, it becomes too
complicated to have automatic updating pkgver as was the case with
the old VCS PKGBUILDs (there can be multiple repos of different types
in the source array, the VCS repo may not be the package primary
source, etc).

Instead provide an optional way for a PKGBUILD to update the pkgver
value through the specifing of a pkgver() function that returns the
new version string.  This is run after all source files are downloaded
so can access the VCS repo if needed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
cca9849fc2 makepkg: modify get_filepath to handle VCS sources
With VCS sources, get_filepath should return the directory of the
checkout. This allows backing up of the VCS checkout when using
--allsource.  Fixes FS#21098.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
aa6fe1160b makepkg: modify get_filename to handle VCS sources
Modify get_filename to return the name of the folder with VCS sources.
This fixes output issues in checksum checking.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
682c9af846 makepkg: fix checksum generation with VCS sources
VCS sources should have "SKIP" for their checksum value

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
91d119af1c makepkg: allow using GIT source URLs
Allow specifing GIT sources using the following syntax

source=('<folder>::<repo>#<fragment>')

This will download the git repo <repo> into <folder> (into $SRCDIR
if set, otherwise $startdir). <repo> must start with "git", but
non-git protocols are handled using (e.g.) "git+http://...".

The <fragment> can be used to specify a branch, tag, or commit to
build from. e.g. branch=maint.

Checksum entries for git sources should be "SKIP".

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
57e06394dd makepkg: skip integrity checking early
If "SKIP" is provided for an integrity check, abort checking as soon
as possible.

Also swap fork to tr for bash4 conversion.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
1a04e2e11a makepkg: generalize download_sources
In order to treat all VCS sources as URLs, we need to be able to
deal with more protocols. Rewrite download_sources to use a case
statement so additional protocols are easily added.

Also fix the use of scp to not pass the protocol in the URL
(noticed by William J. Bowman <wjb@williamjbowman.com>)

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
a922d18056 makepkg: add function to return download protocol
Extract the download protocol from a source entry.  Returns "local"
for local source files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
e806414407 makepkg: reorder source handling functions
There is no actual code change here, but these related functions
were all over the place which makes this code difficult to adjust.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae
d338b3981d makepkg: remove VCS package support
The current VCS packaging support is really, really, really bad.
It is best to strip it out completely before rewriting it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Pierre Schmitz
ec5e6d9029 pacman-key: Use lsign_keys function in --populate
This reduces code duplication and also makes --populate a non-interactive function.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-08-02 09:46:16 -05:00
Allan McRae
d46bb6b27b Split _alpm_filelist_operation function
To improve conflict checking, we will need to make these functions
diverge to an extent where having two separate functions will be
preferable.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:40:44 -05:00
Dan McGee
72d3713cc7 Move filelist functions into separate source file
We have a few of these and might as well gather them together. This also
cleans up the code a bit by using an enum instead of integer values, as
well as makes a "search for file in filelist" function public so
frontends can do better than straight linear search of the filelists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:39:08 -05:00
Dave Reisner
70d8c2150e pactest: avoid upgrade conflict with unchanged effective path
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:38:58 -05:00
Allan McRae
41dae68952 pactest: Do not remove symlink to directory if a to be installed package uses it
If a pacakge has a directory symlink (e.g. /lib -> usr/lib), do not
allow it to be removed if any other package is trying to install a
file into that path (e.g. /lib/foo).  This is because the local
database can become invalidated if the symlink is removed after the
package with file /lib/foo is installed (sync702.py).  If the symlink
is removed before the file is installed (sync701.py), the upgrade is
actually a success, but we can not guarantee the ordering so both
cases should fail.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:38:45 -05:00
Allan McRae
fa2eadcec7 pactest: Do not remove symlink to directory if local package uses that path
If we have a symlink to a directory (e.g. /lib -> usr/lib), then
we can not remove it if a local package thinks it has files in the
symlink directory (e.g. /lib/foo), because this will invalidate the
local file database.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:38:37 -05:00
Allan McRae
eb87155391 pactest: conflict between files having same effective path
Note failure to detect a conflict between files having the same
effective path across packages due to a directory symlink.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:38:24 -05:00
Allan McRae
6f47dfc920 pactest: conflict between directory and a file
Note failure to detect a conflict between a directory in one package
and a file in the other when the directory is not currently on the
filesystem.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:38:16 -05:00
Allan McRae
e3772f7654 Add pactest for empty subdirectory conflict
The wrong test file was inadvertantly committed in 44e9fdd0. Add the
correct test and tidy up the test which was committed.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:37:48 -05:00
Jan Alexander Steffens (heftig)
49dbebcc36 Allow cleaning only some cachedirs
When cleaning the cache, ask for each cachedir separately.

Allan: add some white space in output

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-02 09:34:45 -05:00
Dan McGee
7193ce1ecd Merge branch 'maint' 2012-08-01 09:21:33 -05:00
Allan McRae
647b9ea6d9 contrib/updpkgsums: Fix error message
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:18:58 -05:00
Enjolras
eb25a18571 Add documentation for the prepare() function
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:18:06 -05:00
Enjolras
065b7f863a Add a function prepare() to PKGBUILD
prepare is run after the source extraction, and is not run with
--noextract option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:17:58 -05:00
Allan McRae
b782388f16 makepkg: remove unnecessary formatting
This extra newline leaves a gap that looks strange in of itself,
but is highlighted when piping -g output to a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:17:42 -05:00
Daniel Wallace
52550a2a0a asdeps flag passed from makepkg to pacman
add the asdeps flag for makepkg so that it does pacman -U --asdeps

[Allan: clean-up whitespace]
Signed-off-by: Daniel Wallace <daniel.wallace12@gmail.com>

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:17:12 -05:00
Allan McRae
d2669b4781 Do not enable _FORTIFY_SOURCE without optimization
With glibc-2.16, using -D_FORTIFY_SOURCE requires that optimization (-O)
be used or it will prodice a warning message. Enable -Werror in our
test for _FORTIFY_SOURCE support to catch when a users specifies CFLAGS
without optimization.

The line to set CFLAGS="" when no CFLAGS are specified (either due to
being unset or geniunely empty) is required as autoconf will use
"-O2 -g" for its tests by defult when CFLAGS is unset, but will not add
them to the CFLAGS used...

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-01 09:16:46 -05:00
Barbu Paul - Gheorghe
e94876089a Fix wrong parameter name in alpm_db_update's signature
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
2012-08-01 09:14:52 -05:00
Dan McGee
f619bc61f5 Clean up exclusion list in sync cache cleanup
Make an array out of our various glob skip patterns and loop through
them looking for items to skip. Additionally, when doing a full clean,
delete all objects rather than respect this skip list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:14:40 -05:00
Dan McGee
cc6fb2e8a7 Skip deltas and partial downloads in package cleanup
This affects -Sc only, not -Scc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:14:32 -05:00
Andrew Gregory
3fb934b59a pactree: show tree vertical "limbs"
Showing vertical limbs makes the tree easier to follow.

Old:            New:
|--pkg          |--pkg
   |--dep1         |--dep1
      |--dep2      |  |--dep2
   |--dep3         |--dep3
      |--dep4         |--dep4

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
[Allan: fix shadow warning]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:12:45 -05:00
Andrew Gregory
a6bd14285d pactree: consolidate both walk_deps functions
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
[Allan: fix shadow warning]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:12:29 -05:00
Allan McRae
958b41fa5f contrib/bacman: fix package architecture in filename
Give the generated package the correct architecture in its filename
rather than assuming the system architecture.

Also add updated copyright notice.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:02:30 -05:00
Dave Reisner
ddbd36103d util: fix line length calc in _alpm_archive_fgets
74274b5dc3 which added the real_line_size to the buffer struct
didn't properly account for what happens when archive_fgets has to loop
more than once to find the end of a line. In most cases, this isn't a
problem, but could potentially cause a longer line such as PGP signature
to be improperly read.

This patch fixes the oversight and focuses on only calculating the line
length when we hit the end of line marker. The effective length is then
calculated via pointer arithmetic as:

  (start_of_last_read + read_length) - start_of_line

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-08-01 08:53:10 -05:00
Dave Reisner
35ac4e7ef3 lib/conflict: use a binary search within filelists
Take advantage of the fact that our filelists are arrays sorted by
filename with a known length and use a binary search. This should speed
up file conflict checking, particularly when larger packages are
involved.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 08:53:10 -05:00
Dave Reisner
c5e7eeece7 lib/be_local: ensure local filelists are sorted
This may very well be a no-op, but better safe than sorry.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 08:53:10 -05:00
Dave Reisner
8fe383860e lib/be_package: use qsort instead of our own msort
On the assumption that these arrays are already mostly sorted, use the
standard quicksort method to sort the files arrays. The files_msort
function name is tweaked to give it a more general name to reflect this
change.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 08:53:10 -05:00
Dan McGee
7520c0facb Add more debug logging to dir_belongsto_pkg() function
Now that we pass in the handle, we might as well add logging.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 08:52:41 -05:00
Dan McGee
e41ca0f2f6 Merge branch 'maint'
Conflicts:
	etc/makepkg.conf.in
2012-07-10 08:41:18 -05:00
Dave Reisner
392fffe241 pacman: be more descriptive when opening an include fails
if fopen returns NULL, append the libc strerror-ized error message to
our own error message.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:39:20 -05:00
Dave Reisner
e0daaea38c update comments referring to alpm_option_get_syncdbs
This function was renamed alpm_get_syncdbs as part of b488f229d.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-10 08:37:59 -05:00
Dave Reisner
5c1ba2d5fd makepkg.conf: add -q option for curl
Avoid involving the user's ~/.curlrc file as this may alter the expected
behavior of downloads.

ref: https://bbs.archlinux.org/viewtopic.php?pid=1124441

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:36:20 -05:00
Dave Reisner
d7c3164fd5 makepkg.conf: enable curl's cookie engine for http
Implements FS#28098.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:36:17 -05:00
Dave Reisner
ea3439f928 diskspace: log errors when opening the mount table fails
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:33:33 -05:00
Allan McRae
44e9fdd0e8 Check empty subdirectory ownership
When checking if a package owns a directory, it is important to check
not only that all the files in the directory are part of the package,
but also if the directory is part of a package.  This catches empty
subdirectories during conflict checking for directory to file/symlink
replacements.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:31:48 -05:00
Allan McRae
717fdb8ee0 Add conflict for replacing owned empty directory
When two packages own an empty directory, pacman finds no conflict when
one of those packages wants to replace the directory with a file or a
symlink.  When it comes to actually extracting the new file/symlink,
pacman sees the directory is still there (we do not remove empty
directories if they are owned by a package) and refuses to extract.

Detect this potential conflict early and bail. Note that it is a
_potential_ conflict and not a guaranteed one as the other package owning
the directory could be updated or removed first which would remove
the conflict.  However, pacman currently can not sort package installation
order to ensure this, so this conflict requires manual upgrade ordering.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:29:37 -05:00
Ram Bhamidipaty
d6f31dc788 Add man page for pactree
Add a man page for the pactree utility.

Feedback-from: Allan McRae <allan@archlinux.org>
Feedback-from: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Ram Bhamidipaty <rambham@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-10 08:02:08 -05:00
Allan McRae
0c62b36c19 Allow leading "local/" in query operations
I find that when copying the output of "pacman -Qs foo" into a
"pacman -Qi" operation to get more information on the packages, I
consistently copy the "local/" prefix. It is a minor usability
improvement to strip this if present.

Dan: Pluck out LOCAL_PREFIX and magic numbers.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:43:36 -05:00
Allan McRae
47711947dd Scripts testsuite output consistency
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:39:52 -05:00
Dave Reisner
b1bb2eaa50 paccache: adopt size_to_human
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:46 -05:00
Dave Reisner
a98fce0896 scripts/library: add size_to_human
This function is the reverse of human_to_size, and converts integer byte
sizes to human readable SI prefixed values.

A logical extension of this might be to mimic the formatter that pacman
uses and allow a second argument to be passed in which can coerce the
size, rather than reducing until the unit count is below 1024.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:34 -05:00
Dave Reisner
ab8431c929 pkgdelta: use human_to_size to parse --min-pkg-size
Update the documentation accordingly to mention that users can expect
huamn readable sizes to be acceptable.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:28 -05:00
Dave Reisner
b58489d29a scripts/library: add human_to_size
This is a bash wrapper around an awk function that parses human readable
sizes and returns their representative values in bytes, as a string. A
small test harness is added to validate the functionality.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:12 -05:00
Dave Reisner
e183522e31 diskspace: only load filesystem info on demand
Only load filesystem details for the mount points that we're actually
going to write to. This reduces our syscall count considerably. In the
case of installation, we would actually stat every mountpoint twice (an
extra round for download diskspace) which means (on my system) a total
of 60 syscalls to write to 3 partitions when installing the kernel
package. This change reduces the 60 syscalls down to the expected 3.

A slight debug output change is added here to discern between a
mountpoint added to our linked list versus when we actually load the fs
info.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:37:10 -05:00
Dave Reisner
82c999a8bf diskspace: dedupe code for loading FS usage
add mount_point_load_fsinfo() for platforms using getmntent().

Dan: move the #ifdef slightly so we don't have unused functions on
certain platforms (e.g., OS X).

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:26:50 -05:00
Daniel Wallace
377cc23a09 zsh-completion: Allow use of names in pacman-key
With pacman-key now having the ability to use names in --list-keys etc,
we can remove the comments that temporarily blocked this in the zsh
completion file.

Signed-off-by: Daniel Wallace <daniel.wallace@gatech.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:09:04 -05:00
Jason St. John
12866ba791 Added syntax highlighting for the sha256sums, sha384sums, and sha512sums arrays Fixed FS#29213
Signed-off-by: Jason St. John <jstjohn .. purdue . edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:08:35 -05:00
Allan McRae
5951e9ce84 contrib: fix typo in PKGBUILD.vim
FS#30156

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:08:23 -05:00
Allan McRae
e253968b4d repo-add: add checkdepends information
Similar to the case for makedepends, it is useful to be able to
access this information without parsing a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:08:15 -05:00
Allan McRae
81dd6ddf0c makepkg: install deps with --repackage
I have noticed that quite a number of packages fail with "makepkg -R"
when their (make)dependencies are not installed. Adjust makepkg to
check for dependencies when used with -R.  This can still be avoided
by using --nodeps/-d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:08:08 -05:00
Jeremy Huntwork
d310b6f85c Allow wildcards in PURGE_TARGETS to match any type of file except for directories.
Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
2012-06-25 23:07:49 -05:00
Allan McRae
3a24e44206 makepkg: allow url to be overridden in split packages
This is already being used (despite not working...) in packages
in the Arch Linux repos.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:07:03 -05:00
Jeremy Huntwork
19c2347507 Portability fixes for makepkg
Allow makepkg to work correctly when used with find from busybox.
Fix handling of cross directory symlinks.

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:06:43 -05:00
Dave Reisner
da0dcc29cf query: avoid false ownership matches for files in root
Check for an exact match when querying ownership of files in the root.
Previously, our test was too simple and would match the the basename of
package files against the query parameter, e.g.

  $ pacman -Qo config
  /config is owned by cower-git 20120614-1

Adds a new test to verify this behavior, query007.py.

Fixes FS#30388.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:05:59 -05:00
Dave Reisner
c6e47cb435 updpkgsums: avoid fancy quoting in error message
m4 has a field day parsing escapes and actually vandalizes this string,
causing the error to look like:

 ==> ERROR: \PKGBUILD\ not found or is not a file

Avoid all quoting and just match up with how makepkg reports errors (no
quoting at all).

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:05:26 -05:00
Dave Reisner
9f751bf492 contrib: sed out @SCRIPTNAME@ in edit command
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:05:14 -05:00
Dave Reisner
f556fe8b4a add line length parameter to _alpm_strip_newline
If known, callers can pass the line size to this function in order to
avoid an strlen call. Otherwise, they simply pass 0 and
_alpm_strip_newline will do the call instead.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:04:31 -05:00
Dave Reisner
74274b5dc3 add real_line_size to alpm_read_buffer
We inevitably call strlen() or similar on the line returned from
_alpm_archive_fgets(), so include the line size of the interesting line
in the struct.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:04:24 -05:00
Dave Reisner
7245bc8e8e pkgdelta: add missing --version longopt
This was missed in the switch to parseopts, and was caught by distcheck.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:02:05 -05:00
Dave Reisner
6a5370b634 check proper variable for NULL
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:01:28 -05:00
Allan McRae
1d32934769 Create repo-remove symlink in scripts dir
Fix the creation of the repo-remove symlink in the scripts/ dir
on building.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:00:41 -05:00
Dave Reisner
9ce4f80db4 diskspace: canonicalize path to download dir
With lazy loading in place, it's now quite obvious that we aren't
necessarily checking the right mountpoint for necessary download space.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:00:12 -05:00
Andrew Gregory
ac990b96e7 libalpm/remove.c - add doxygen
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-21 00:03:20 -05:00
Dave Reisner
a64a8d6cea paccache: allow running as root
The main motivation for this change is to allow this to be run as a cron
job.

Satisfies FS#29897 and some other undocumented requests for this.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-20 19:32:58 -05:00
Allan McRae
9a76a458b8 makepkg: rework libdepends
Rewrite the handling of libdepends. The primary advantage are:
 - Moves functionality from write_pkginfo() to find_libdepends().
 - The order of the depends array in the PKGBUILD is kept in the package.
 - An unneeded libdepends is only a warning and not an error. This allows
   putting a libdepend on a library that is dlopened.
 - It is now modular so can be extended to library types other than
   ELF *.so.
 - Finding the list of libraries a package depends only occurs when a
   libdepend is specified in the depends array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-05-20 19:04:38 -05:00
Allan McRae
81bc390dc1 repo-add: add makedepends information
This is useful for tools that automatically rebuild packages and
thus require to generate a build order. These entries are skipped
by pacman.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 19:03:43 -05:00
Allan McRae
18e0a97209 makepkg: write makedepends into .PKGINFO
Currently there is no way to access the makedepends for a package
apart from parsing its PKGBUILD. Put these into the .PKGINFO file
with the idea of making them available in the repo dbs so that
automated build tools can readily determine build order.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 19:00:42 -05:00
Allan McRae
7eb6dc2a9c Define _FORTIFY_SOURCE in CPPFLAGS
The -D_FORTIFY_SOURCE=2 define should be in CPPFLAGS and not CFLAGS

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 19:00:14 -05:00
Allan McRae
8abef73ba9 makepkg: Add CPPFLAGS support
Add CPPFLAGS support in addition to the current CFLAGS and CXXFLAGS.
This keeps compiler flags split up in the same logical way done
everywhere else.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 18:58:17 -05:00
Dave Reisner
c4ea4e017f updpkgsums: add new contrib script
This updates checksums in a PKGBUILD in-place. If no sums are found,
they are appended to the end.
2012-05-20 17:55:32 -05:00
Dave Reisner
e533478e02 fix -Wshadow warnings as reported by gcc 4.4.3
Apparently gcc 4.7 has decided that -Wshadow warnings aren't worth
reporting anymore even with the flag enabled. These were found on
an Ubuntu 10.04 install.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:54:42 -05:00
Dave Reisner
363894e27b contrib/pacsysclean: use a standard vim modeline
Fix indenting to something more familiar with the rest of the codebase.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:41:32 -05:00
Dan McGee
9f6a67fee7 Merge branch 'maint'
Conflicts:
	scripts/pacman-key.sh.in
2012-05-20 17:41:21 -05:00
Dave Reisner
fc9002188b pacman-key: use mapfile over read
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-20 17:39:21 -05:00
Dave Reisner
9d3e59e311 makepkg: use mapfile where plausible
With bash4 as a requirement, we can use mapfile when reading command
output into an array. mapfile has the advantage of using block buffered
I/O rather than line buffered I/O, making it slightly faster for most
jobs.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-20 17:39:21 -05:00
Dave Reisner
c2fdc38b78 pacman: support group selection delimited by commas
We support multiple arguments being comma separated elsewhere, so this
seems like a natural extension to support in our multiparse selection
code.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:38:33 -05:00
Dave Reisner
ceb2362209 pkgdelta: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:38:33 -05:00
Dave Reisner
5de465d63e pacman-key: test for content in keyring files
Test for file content (-s) rather than just existance (-f). This fixes a
bug that manifests itself in the case of an empty -revoked file. A zero
element 'keys' array would be passed to gpg, forcing it to list and,
subsequently, revoke all known keys.

Bug introduced in d1240f67ea.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:35:31 -05:00
Dave Reisner
233e5f610c contrib/pacsysclean: avoid setting bogus PACMAN_OPTS
PACMAN_OPTS would be erroneously set when it was undefined, causing
pacsysclean to error out.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:30:41 -05:00
Dan McGee
26abe8f600 Fix gettext usage in pkgdelta help instructions
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 11:27:36 -05:00
Dan McGee
2671581123 Update pacman-scripts message catalog
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 11:22:51 -05:00
Dan McGee
951d23e3ec docs: remove 'in the wild' section
We haven't updated this info in years and it is out of date.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-18 10:04:27 -05:00
Dan McGee
9e2078b179 pacman-key: clarify messages, s/keychain/keyring/
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-04 15:01:53 -05:00
Dan McGee
3f202c7808 doc: remove --recursive documentation for non-remove operations
This documentation was added in commit 857357f9 so was not caught in the
removal of this option in commit 85712814.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-04 14:37:48 -05:00
Dan McGee
1bf05e706b Ensure pre_upgrade scriptlet gets old package version
This was accidentally broken in the refactor done in commit 73139ccb.

Fixes FS#29371.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-04 11:41:40 -05:00
Allan McRae
9d9c12e4e2 makepkg: fix package arch detection
get_pkg_arch checked for the arch variable being overridden in the
package_$1() function when used with a package as a parameter.
However, when there was no override, it did not fall back to the
global value.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-30 20:48:59 -05:00
Dave Reisner
92e20b508d contrib: remove executable bit from input files
There's no reason to make these executable, and this also mimics what we
do in the scripts/ subdir.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-30 17:37:29 -05:00
Daniel Wallace
7fd0d03795 zsh completion for makepkg
This adds zsh completion for makepkg to the _pacman file
in /usr/share/zsh/site-functions/. it completes makepkg and allows for
stacking of flags like -si, -sci, et cetera.

Signed-off-by: Daniel Wallace <daniel.wallace@gatech.edu>
2012-04-30 17:37:18 -05:00
Daniel Wallace
d214c2347a add zsh completion to pacman-key
This patch adds zsh completion to pacman-key. It completes
files/directories for --config or --gpgdir and just completes the
command for --keyserver then it can complete keyids or files for all
the other flags.

Signed-off-by: Daniel Wallace <daniel.wallace@gatech.edu>
2012-04-30 17:37:10 -05:00
Dan McGee
5a9f5c60da Convert ALLOC_FAIL macro into a function
This path is rarely (read: never) taken in any normal run of the code,
so injecting the fprintf() call everywhere with the macro is a bit
overkill. Instead, add a lightweight _alpm_alloc_fail() function that
gets called instead.

This does have a reasonable effect on the size of the generated code;
most places using the macros provided by util.c have their code size
reduced.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29 23:40:06 -05:00
Dan McGee
4d31709787 be_local: use the right length value for filename in all cases
Increment the strlen() provided value by 1 for the NULL byte so we use
the right value in all three places we later reference it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29 23:23:54 -05:00
Florian Pritz
678bdfb0d0 pkgdelta/repo-add: quoting fixes
Finish the job on master; most of these were applied to maint already.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-04-29 21:56:57 -05:00
Allan McRae
2e6cb69bf6 Output "Packages" instead of "Targets"
Prefix the list of packages being installed/removed with "Packages"
instead of "Targets" as they are package names by this stage.

Fixes FS#23123.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29 20:29:42 -05:00
Dan McGee
8c7202ca19 Merge remote-tracking branch 'dave/buildsys' 2012-04-29 20:27:32 -05:00
Dave Reisner
9dd42dc0da makepkg: remove subshelling from check_option and friends
Instead of creating a subshell for each of these checks (of which there
are many), pass in an expected value and make the check_* function do
the comparison for us, returning 0 (match), 1, (mismatch), or 127 (not
found).

For a measureable benefit, I tested this on a fairly simple package,
perl-term-readkey, and counted the number of clone(2) syscalls to try
and isolate those generated by makepkg itself, rather than the user
defined functions. Results as shown below:

  336 before
  180 after

So, roughly a 50% reduction, which makes sense given that a single
check_option() call could be up to 3 subprocesses in total.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-29 20:26:27 -05:00
Dave Reisner
8a9c666a8c makepkg: null terminate filenames to strip
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-29 20:26:11 -05:00
Dave Reisner
6d2fb6fd81 pacman/package.c: show checksums with -Sii
These were removed entirely by f34864cc9e, but some people (myself
included) still find them useful. Revive these details, but "demote"
them, so that they're only displayed when extra sync data is requested.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29 20:25:58 -05:00
Dan McGee
52a9a5240a Move short-lived realpath buffers to the stack
There is little reason here to grab 4K from the heap only to return it a
few lines later. Instead, just use the stack to hold the returned value
saving ourselves the malloc/free cycle.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29 20:14:10 -05:00
Dave Reisner
82b7122542 libalpm: add pkg-config file
No one seems to do this "correctly", but for the sake of having an easy
method of detecting the presence and version of libalpm on a given
system, we provide a straightforward .pc file.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-25 20:02:36 -04:00
Dan McGee
e0afd81d18 Pointer coding style cleanups
'foo_type_t *variable' rather than 'foo_type_t* variable'.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24 21:05:51 -05:00
Dan McGee
dbc58d9386 be_local: write all single-valued attributes first
There isn't a whole lot of reason other than code clarity for this, but
it makes it a bit more obvious where multivalued attributes start.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24 21:01:55 -05:00
Dan McGee
20ff0cd40f util/testdb: don't return crazy error values
With some contrived examples, you could easily make testdb return a very
high error count, which could easily overflow the 8-bit unsigned integer
limit. Instead, simply return 1 or 0 based on whether errors were found.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24 20:59:24 -05:00
Dan McGee
1583a2079c Split check steps in Makefile into multiple targets
This allows a `make -j4 check` invocation to actually run in parallel,
even though 95% of our test suite time is currently dominated by
pactest. It also allows running something like `make test-vercmp`.

Also, add some targets to the .PHONY list that belong in it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24 20:44:29 -05:00
Dave Reisner
953415c86a rankmirrors: move to contrib/
This script is of questionable value, as it ranks mirrors by an
uninteresting attribute: ping. While the script itself is interesting,
people should be encouraged to rank mirrors by more useful measures,
such as actual speed, locality, or up to date-ness.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 20:33:08 -04:00
Allan McRae
242411a1b4 makepkg: Be more consistent with missing program message
Also prevent "sudo" and "su" from being translated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:59 -05:00
Allan McRae
22050f18f4 makepkg: treat list of packages to be installed as an array
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:54 -05:00
Allan McRae
d38a1c02db makepkg: deal with overriden package arch properly
This fixes a lot of checks done by makepkg (e.g. to see if a package
is already built and choosing which package to install).  Previously,
if a package had both "i686" and "any" versions, the "i686" one
always took precidence regardless of the value of "arch" in the
PKGBUILD for that package.  Fixes FS#27204.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:49 -05:00
Dave Reisner
6d10de881e paccache: adopt parseopts for options parsing
Add longopts and update usage. This removes the TODO item and
incorporates --help/--version into the standard option set.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 09:54:06 -04:00
Dave Reisner
ea4aa6f184 configure: require bash >= 4.1 at compile time
We've unofficially agreed to raise our minimum supported bash version to
4.1, and since added features that require it. Additionally, an earlier
commit adds a syntax check to the builds of scripts/ and contrib/ which
could conceivably fail with an earlier shell. Therefore, make this a
hard requirement of the build process.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 09:54:06 -04:00
Dave Reisner
03acea832a validate bash scripts with 'bash -n' during build.
Use the no-exec mode of $(BASH_SHELL) to check for syntax errors in
shell scripts. Since we use the extglob feature in various places, this
requires that we pass -O extglob to the shell as well, to ensure that
the parser is armed to handle this syntax.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 09:54:06 -04:00
Dave Reisner
1b494ab771 contrib: rename bash scripts: .in -> .sh.in
For consistency with the scripts/ directory, ensure that all bash
scripts use the same pre-build suffix.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 09:54:06 -04:00
Dave Reisner
71fcb69028 contrib: use a separate build rule for bash scripts
Treat bash scripts separately from the others to allow for a different
build rule, which is reused from the scripts/ subdir.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 09:54:06 -04:00
Dave Reisner
b2a2a98297 pacman-key: lookup keys before receiving
Perform a search for keys that clearly aren't key IDs. This allows
receiving keys by name or email address, but only if the key resolves
unambiguously.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:46:13 -05:00
Dan McGee
ca4f8687f7 Merge branch 'maint'
Conflicts:
	scripts/repo-add.sh.in
2012-04-24 08:44:11 -05:00
Dan McGee
ac6ebcfe93 Merge branch 'parse-opts' 2012-04-24 08:39:31 -05:00
Dave Reisner
59dc631c9a makepkg.8: remove bold from --pkg's optarg
Keep this in line with the rest of the manpages.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
2d0a00b409 pacman-key: allow verification of multiple sig files
Loop through arguments passed to verify_sig and treat each as a
signature to be verified against a source file. Output each file as its
checked to avoid ambiguity.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
00ab01e634 scripts/library: remove parse_options
This is retired, as the two consumers of this function are now using the
new parseopts instead.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
e07a2ab45e bash_completion: update for changes to pacman-key
- only do file completion for options which expect files
- add completion for possible key ids when a relevant operation is in
  COMPWORDS.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
62dbf7ec43 scripts: avoid dumping usage on parser fail
Avoid letting the error message from parseopts get lost in the usage
output from pacman-key and makepkg (which is already verbose).
2012-04-24 08:38:36 -05:00
Dave Reisner
f61f075b1c pacman-key: adopt parseopts for option parsing
This requires an ugly amount of reworking of how pacman-key handles
options. The change simply to avoid passing keys, files, and directories
as arguments to options, but to leave them as arguments to the overall
program. This is reasonable since pacman-key limits the user to
essentially one operation per invocation (like pacman).

Since we now pass around the positional parameters to the various
operations, we can add some better sanity checking. Each operation is
responsible for testing input and making sure it can operate properly,
otherwise it throws an error and exits.

The doc is updated to reflect this, and uses similar verbiage as pacman,
describing the non-option arguments now passed to pacman-key as targets.

Similar to the doc, --help is reorganized to separate operations and
options and remove argument tokens from operations.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
3f9cf8471f makepkg: allow specifying --pkg multiple times
Make this option additive, so that the following two operations are
equivalent:

  makepkg --pkg foo --pkg bar
  makepkg --pkg foo,bar
2012-04-24 08:38:36 -05:00
Dave Reisner
d85c71865e makepkg: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
8679cd68d8 scripts/library: introduce parseopts
This will replace our current options parser used in pacman-key,
makepkg, and ideally elsewhere. It follows heuristics closer to that of
GNU getopt long (and thus pacman itself), with the exception that it
does not allow for options with optional arguments. Due to the way this
parser will be used, this sort of functionality will not be needed.

Instead of relying on eval+set, options are normalized into an array,
OPTRET, which callers should expect to be populated after returning from
parseopts. This avoids problems with quotes and spaces in arguments,
assuming that the user quotes properly when passing into the
application.

A new test harness for parseopts is added in test/scripts.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner
1eb6a9cbfe configure: avoid linking against libssl
We're not linking to libssl, only libcrypto. -Wl,--as-needed will get
rid of this, but there's no sense in checking for and linking against a
library we don't need.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24 08:34:17 -05:00
Dave Reisner
5f71570ec4 makepkg: restrict allowed characters in pkgname
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 18:14:45 -05:00
Florian Pritz
133d174e60 pkgdelta/repo-add: quoting fixes
This removes some unnecessary quotes and adds quotes in a few places to
hopefully work correctly if the tempdir has spaces.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 18:03:54 -05:00
Florian Pritz
839953f111 pkgdelta: implement requirments for delta generation
Big deltas or deltas for very small packages are not needed so we should
check that and not generate any.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 18:00:06 -05:00
Florian Pritz
70d425c1d3 pkgdelta: rework option/argument parser
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 17:59:57 -05:00
Dave Reisner
0fc5aea027 contrib: remove pactree make rule
This is a vestige leftover from the rewrite over a year ago in
622e7fdd4.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-19 22:59:45 -05:00
Dave Reisner
b9fc709c55 contrib: remove wget-xdelta from gitignore
I removed this in ff713a51 over a year ago.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-19 22:59:30 -05:00
Dan McGee
d7b728591a Merge branch 'maint' 2012-04-12 08:57:26 -05:00
Dan McGee
6a8e50a69e Remove SyncFirst option
This has outlived its usefulness and causes more problems than it
solves. It has historically only ever been used to install pacman first.
That should not be needed given we provide the vercmp utility (which has
no library dependencies) and so calling pacman in install scripts is a
sign of poor packaging.

Work-duplicated-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-12 08:55:49 -05:00
Dan McGee
ded66fbb62 Fix issues with unintialized variable value usage
Detected by clang scan-build static code analyzer.

* Don't attempt to free an uninitialized gpgme key variable
* Initialize answer variable before asking frontend a question
* Pass by reference instead of value if uninitialized fields are
  possible in download signal handler code
* Ensure we never call strlen() on NULL payload->remote_name value

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-09 00:46:54 -05:00
Allan McRae
8fb1948cd0 Add more warning flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-09 00:03:32 -05:00
Dan McGee
c27a946769 Fix a signed overflow error on i686 with GCC 4.7.0
Not sure why this one wasn't showing up on x86_64, but this fixes the
compile on i686.

    diskspace.c: In function 'calculate_removed_size':
    diskspace.c:247:4: error: assuming signed overflow does not occur when negating a division [-Werror=strict-overflow]
    cc1: all warnings being treated as errors

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 22:32:49 -05:00
Dan McGee
d158dde30c Merge remote-tracking branch 'dave/buildsys'
Oh god, what are we thinking thinking merging this. Hopefully this works with
only a few follow-up patches necessary.
2012-04-08 21:55:30 -05:00
Allan McRae
31091963ed makepkg: save and restore shopts when sourcing /etc/profile
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-08 21:52:42 -05:00
Dave Reisner
468270ce4f makepkg: complain when the buildfile isn't writeable
If the PKGBUILD isn't writeable for devel_update, throw a warning
instead of silently ignoring it. Some logical reordering is present in
this patch to reduce the number of nested if's.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:32 -05:00
Dave Reisner
8fe6791928 makepkg: catch errors sourcing files
create source_safe() function which temporarily disables extglob and
exits on error.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:26 -05:00
Dave Reisner
dca10b062f makepkg: restrict usage of errexit to user functions
It's expected that this will lead to unwanted behavior, and needs
widespread testing. It's desirable to commit this for a few reasons:

- there's no reason we can't do our own error checking for code that we
  write.
- it avoids the need for ||true hacks scattered about in the code.
- it makes us immune to upstream changes in exit codes (FS#28248)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:16 -05:00
Dan McGee
3a82885348 Merge branch 'maint' 2012-04-08 21:51:24 -05:00
Dave Reisner
ca090e10d2 pacman-key: avoid use of tempfile in verify_sig
Use --status-fd rather than --status-file to keep this contained in a
pipeline.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:46:15 -05:00
Dan McGee
b729ed0109 Add a new configure option for excessive compiler warning flags
This adds a bunch of warning flags to the list used when compiling.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 22:28:45 -04:00
Dan McGee
a8a1b093eb Various tweaks to support building with excessive GCC warning flags
This fixes a bunch of small issues in order to enable a clean
successful build with a crazy number of GCC warning flags. A lot of
these changes are covered by -Wshadow, -Wformat-security, and
-Wstrict-overflow=5.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
ec91133e38 autoclean.sh: abide by POSIX shebang
Avoid non-POSIX brace expansion and rely on find to locate and destroy
files outside the root.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
30ca48df4c buildsys: move autotools bloat to build-aux
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
4b95967bd0 buildsys: move acinclude.m4 to m4/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
5f77402577 buildsys: cleanup libtool and autoconf initialization
- Use LT_INIT over AC_PROG_LIBTOOL, as the latter is a deprecated alias
  for the former.
- Remove redundant macros which are called implicitly by LT_INIT.
- Remove unneeded AC_PROG_CXX call (we don't use c++ anywhere)
- Add AC_CONFIG_MACRO_DIR([m4]) -- not strictly necessary, but added for
  consistency with autogen.sh and Makefile.am

ref: http://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
793eff3704 buildsys: define warning CFLAGS in separate var
Continue the trend of not touching the environment CFLAGS, ensuring that
the user always has the final say.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
7fcb445f35 buildsys: use AC_DEFINE for CYGWIN macro
Instead of directly modifying CFLAGS, use config.h for its intended
purpose.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner
cb5b66367d buildsys: cleanup gpgme compile time check
- handle gpgme libs and cflags separately rather than appending to
  CFLAGS and LDFLAGS
- be consistent in AC_LINK_IFELSE check for gpgme 1.3.0 (though this is
  irrelephant since we don't actually run)
- be consistent with usage of "have" and "with" variables (this
  actually ends up reducing SLOC)
- when voluntary detection fails, unset GPGME_CFLAGS and GPGME_LIBS
- when requested support fails the version check, complain about the min
  version.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:41 -04:00
Dave Reisner
b2226ed11b buildsys: use pkg-config for libcurl detection
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner
059c572ca5 buildsys: use pkg-config for libarchive detection
This also introduces a versioned dependency of >=2.8.0.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner
c5d951846d buildsys: use pkg-config for openssl detection
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner
bcfc2155a0 buildsys: add pkg-config m4 macros
We'll need these for a small revamp to library detection.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner
f053141c87 pacman-key: verify TRUST_ULTIMATE keys as good
Extend our grep pattern to match TRUST_ULTIMATE, not just TRUST_FULLY,
as these keys are to be trusted as well.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:43:53 -05:00
Dave Reisner
569876f930 makepkg: treat lib{provides,depends} returns as proper arrays
Make these functions more whitespace space by treating newlines as the
element delimiter rather than every form of whitespace.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:42:47 -05:00
Dave Reisner
ecd6eddf13 makepkg: use proper array addition in libdeps
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:42:37 -05:00
Dave Reisner
87c4fb51a4 makepkg: add missing newline from libprovides output
This was a small oversight from 1917c845 which causes makepkg to write
provides entries to the .PKGINFO file improperly, e.g.

  provides = systemdlibsystemdudev=999

Add a newline in the printf format to ensure that these are spaced
appropriately.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:41:02 -05:00
Florian Pritz
62e8812fb9 repo-remove: remove deltas file if it becomes empty
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:30:56 -05:00
Allan McRae
3be02aa27c Prefix alpm_pkgfrom_t members with ALPM_
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:29:55 -05:00
Dan McGee
42d408e0c2 Return more useful error codes on package open failures
Failure isn't always due to the package file location not existing;
permission issues can also play a part on something like a FUSE-based
filesystem inaccessible to root.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:29:11 -05:00
Allan McRae
cb5ae428b6 Check minimum required gpgme version
We use interfaces first introduced in gpgme-1.3.0 so test we have
at least that version.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:28:28 -05:00
Allan McRae
b5043dd6c3 Make selecting scriptlet shell work
The initial patch to implement this achieved nothing apart from
adding a configure option.  This patch makes that configure option
do what it advertises.

Note that specifing any shell apart from /bin/sh causes testsuite
failures as /bin/sh is the only shell in the testing environment.

Bug-found-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:56 -05:00
Allan McRae
923214497f makepkg: safely change directories
In preparation for the removal of the global error trap we need a
way to ensure changing directories succeeds.  Add a "cd_safe"
wrapper that performs the necessary check.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:39 -05:00
Allan McRae
1917c845f7 makepkg: use printf rather than echo to output variable
Also make sure the strings passed to %s in printf are always quoted.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:23 -05:00
Allan McRae
d11192c73a makepkg: the rhs in string comparisons should be quoted
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:08 -05:00
Matthew Monaco
bb71d254e2 makepkg: devel_check(): cleanup for hg version
Use pushd/popd, quote args, handle some more errors
2012-04-07 11:26:44 -05:00
Matthew Monaco
0fd477238f makepkg: devel_check(): set newpkgver (cleanup)
The case structure allows the syntax to focus on what's actually being
done here.
2012-04-07 11:26:31 -05:00
Matthew Monaco
0666b13669 makepkg: devel_check(): consolidate common code 2012-04-07 11:26:16 -05:00
Matthew Monaco
80a811ec96 makepkg: devel_check(): determine vcs
Rather than prioritizing an arbitrary VCS, collect all development
directives. If there is more than one, give a warning and abort.
2012-04-07 11:26:00 -05:00
Matthew Monaco
6310bb5fbe makepkg: remove unused variable
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:25:34 -05:00
Dan McGee
4ca6590af5 Merge branch 'maint'
Conflicts:
	lib/libalpm/signing.c
	lib/libalpm/sync.c
2012-04-07 11:23:55 -05:00
Dan McGee
3f1ea8b62f Revert "makepkg: calculate exact total file size"
This reverts commit b264fb9e9d.
With our "fix" of sleeping for BTRFS, we can go back to using `du` to
calculate total installed size.
2012-04-07 11:20:08 -05:00
Pierre
0145604728 pacman: show groups once with -Sg
Only displays groups that haven't appeared yet..
Previously 'pacman -Sg' iterated over syncs, printed every group.

This change does not affect '-Sgg' which still orders by sync first.

To reproduce, on a current Arch Linux with [extra] and [community]:
$ pacman -Sg|sort|uniq -c|sort -n
[...]
      1 xorg-fonts
      2 vim-plugins
      2 xfce4-goodies

Signed-off-by: Pierre <pierre@spotify.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:16:58 -05:00
Dave Reisner
b5b9860a2e makepkg.conf: enable curl's cookie engine for http
Implements FS#28098.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:07:12 -05:00
Dan McGee
b752561a52 4.0.3 release NEWS, version bumps, etc.
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:04:00 -05:00
Dave Reisner
3c5d5a19b3 Revert "parseopts: normalize options into an array"
This was really only half a fix for FS#28445, as it still doesn't
correctly handle the case of filenames with spaces. In the short term,
there is no obvious fix for this. In the long term, I believe the
correct decision is to rewrite the options parser to be more in line
with GNU getopt_long.

This reverts commits:
  ca41427141.
  969dcddbdf.
2012-04-07 11:03:48 -05:00
Florian Pritz
297916e6a2 pkgdelta: exit 1 upon error
This has been 0 since 9fa18d9a4b, but it
doesn't makes sense because we are raising an error.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 10:31:10 -05:00
Pierre Schmitz
a8f03d07c7 pacman-key: Actually verify signatures and exit with correct codes
We cannot rely on gpg's exit code. Instead we have to check the status-fd to
figure out whether a signature is valid or not.

In addition to this pacman-key --verify can now be used in scripts as it will
return an exit code of 1 if the signature is invalid.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 10:22:10 -05:00
Dan McGee
114d121001 pkgdelta: use bsdtar -q option
This matches the optimization made to repo-add in commit 8bbaf045b9
way back in 2009. We don't need to read the whole package file to ensure
multiple .PKGINFO entries don't exist, as well-formed packages should
have this file first in the archive.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 10:13:38 -05:00
Dave Reisner
391769ff89 sync: fix crash on failed downloads
Dan was right. This should have been FREE(), not free().

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 10:13:38 -05:00
Dave Reisner
969dcddbdf parse_options: initialize unused_options as array
Since we treat this as an array, we need to initialize it as one. This
avoids addition of an empty element to the option string when we set the
option array from the calling program, e.g.

  +/usr/bin/makepkg[2033]: set -- -i --pkg vim -- ''

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 10:13:37 -05:00
Dan McGee
72ba4fb83f Updates from Transifex
This encompasses a few languages that have had changes since 4.0.2
available on Transifex.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 10:13:37 -05:00
Allan McRae
d7f4e8fbcc pacman-key: change to more reliable default keyserver
User reports indicate that the SKS keyservers are more reliable
than both the gnupg.net and mit.edu ones.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-29 16:49:54 -05:00
Allan McRae
ed353d91b7 pacman-key: make the -e option work as advertised
Using -e without arguments failed to export all keys. Using --export
worked as expected.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-29 16:49:22 -05:00
Dan McGee
1eeab12228 Update all translation files
Pull updates from transifex, run update-po on all files, fix a few
errors, and push them back to Transifex.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-28 18:05:06 -05:00
Dave Reisner
7f258619c6 makepkg: avoid reporting bogus install size on btrfs
delayed allocation hoses us here and causes erroenous install sizes to
be reported. Add a short sleep to allow the transaction to be committed
to the filesystem and the stat buffers to be updated.

This is apparently a "feature", as per to some of the denizens of #btrfs
on freenode.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-28 09:56:11 -05:00
Dave Reisner
be0e044404 signing: cope with gpg2's failure at life
For key searches only, gpg2 will fail to lookup any and all keys that
are not prefixed with 0x.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-28 09:55:14 -05:00
Dan McGee
c571bd7afb bash_completion: complete pacman-key options right away
pacman-key requires at least one dashed option, so complete them right
away, rather than falling back to default completion.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-27 19:29:48 -05:00
Dan McGee
e66edf817b Drop bash 3.2 completion support
This is pretty old at this point, and upstream bash completions project
uses compopt heavily. Completions are by no means a make-or-break
feature anyway, so this is not critical. This basically reverts commit
6f4f9c1b66 made in 2010.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-27 19:25:50 -05:00
Dan McGee
38c0ec868b Change table_display() to be static
It is only used inside util.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 18:08:22 -05:00
Dan McGee
8da489eac5 Reduce calls to getcols
This dramatically improves upon a much older attempt in 2008 in commit
ce3d70aa99. We don't need to call it once per line we print unless
there is a reasonable expectation of being able to resize the terminal
mid-operation; this is really only the case during our callback progress
bars.

Some before and after numbers of ioctl() calls, gleaned from strace of
the following operations (no targets to any of them to maximize the
amount of output):

    pacman -Qii :  37768 ->  2616  (93.1% decrease)
    pacman -Qs  :   2616 ->     4  (99.8%)
    pacman -Sii : 133036 -> 10926  (91.8%)
    pacman -Ss  :  10926 ->    14  (99.9%)

Obviously the search results are astounding; we only call getcols()
once in the case of -Qs, and once per repo in the case of -Ss. For
-Qii and -Sii we are still calling it once per package, but this is
much better than once per line of info output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 17:57:04 -05:00
Dan McGee
0972b7acfd Pass a file descriptor to getcols and flush_term_input
This makes these methods a bit more flexible.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 17:05:35 -05:00
Dan McGee
e6f72c61a0 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
2012-03-16 12:08:10 -05:00
Allan McRae
f988aa6b32 makepkg: quote removed filename as it can have spaces
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:01:52 -05:00
Allan McRae
573bd80f14 makepkg: abort when failing to create BUILDDIR
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:01:26 -05:00
Allan McRae
44de3183ff makepkg: prevent issues with files starting with a hyphen
Most places in makepkg deal with full file paths, but a few use the
file name only.  Protect from potential issues when a file name
starts with a hyphen.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:01:15 -05:00
Allan McRae
03465ad6b6 makepkg: append pkgbase to BUILDDIR if specified
This means multiple packages can be build using the same BUILDDIR
without their source files all ending up extracted in the same
directory.  Fixes FS#28417.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:00:42 -05:00
Dan McGee
d521f30f07 pactest: make OPTDEPEND rule look at non-description only
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:54:02 -05:00
Dan McGee
9e1a20022d Always display download size if it applies
Currently, we try to do a bunch of funkyness constraining download size
to print only when doing a -S/--sync operation. However, it is possible
we try to download packages on a -U/--upgrade operation, and we
currently won't show any itemized download sizes.

Fix this ommission by always including the download size stuff in the
built table rows; this column will be completely omitted anyway if there
are no values due to prior work in commit 33bb7dbd35.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:49:32 -05:00
Dan McGee
56f821b72a Handle printing NULL correctly in table display
Treat this value as the empty string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:49:32 -05:00
Dan McGee
930e93b892 Prefer fputs/fputc over fprintf when writing local database
Using fputs should be faster as no format string parsing is required. It
also prevents silly errors related to unescaped '%' signs, and removes
the need to double them up in a lot of places.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:49:31 -05:00
Dan McGee
89f4dd88d7 Extract a write_deps function from local database writing
This reduces a lot of code duplication in the write function, which
cleans it up a bit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:49:31 -05:00
Dan McGee
83e42dccce Remove unnecessary path check from local database
This removes a call to _alpm_local_db_pkgpath() as well as an access()
call when reading the local database. This appears to be code from 2006
that has stuck around. We don't need it because:

1) We never use this path except to check it via access(); however, we
   are already in a readdir() loop so it exists, or at least did at the
   time of the call.
2) The fopen() and other calls will fail on accessing the database files
   anyway, and we need to check those for errors.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 09:49:31 -05:00
Dave Reisner
f41037358a lib/sync: avoid unwanted unlink after download fail
In case we have a mirror failure, unlink_on_fail would remain set,
causing an interrupt in a successive download attempt to be wrongly
unlinked.

This also fixes a memory leak in the url member, as we would allocate
over the previous, unfreed URL.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-14 22:44:49 -05:00
Dave Reisner
952ee5e6cb dload: reset payload filename members before download
To avoid conflicts on reusing a payload after a failed download, ensure
that we reset the filename hints in the payload struct prior to the
download operation.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-14 22:17:37 -05:00
Allan McRae
47d0df6c10 Skip special files when cleaning package cache
Ignore *.sig, *.db*, and *.src.tar* when cleaning the package cache.

Fixes FS#25166.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-13 08:24:11 -05:00
Dan McGee
5bda38196f Minor format-string related cleanups
We had one stubbed out so we didn't require a translation update, and
the other is more a code style issue.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-12 21:47:29 -05:00
Dan McGee
ff58e5cb2d Add 3.0.x versions to doc/index.txt
These got lost when I switched to the new Asciidoc tables syntax in
commit 1ebe5dc197.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-12 21:16:14 -05:00
Dan McGee
8de0631edb Merge branch 'maint'
Conflicts:
	lib/libalpm/be_package.c
2012-03-08 18:08:15 -06:00
Dave Reisner
1a8c3e52d7 makepkg: exit via default signal handler in trap_exit
Similar to how we manage receipt of SIGINT in pacman's internal
downloader, catch the signal and invoke our own trap handler before
unsetting it and calling the default. This requires a slight
modification to the arguments passed to trap_exit so we can pass the
raised signal to trap_exit (note that we substitue USR1 for ERR since
the latter is unique to bash).

Fixes FS#28491.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08 18:01:53 -06:00
Allan McRae
f34864cc9e Simplify package validation info output for sync packages
Unify the output for local and sync packages by only printing a
list of possible validation types for sync packages.  This also
has the advantage of not printing the very long sha256 checksum
which line wrapped on a standard width terminal.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-08 18:00:05 -06:00
Allan McRae
4773c6b66e Remove _alpm_csum
The enum alpm_pkgvalidation_t is essentially a more generic version
of _alpm_csum, so use it instead.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-08 17:59:13 -06:00
Allan McRae
5c404268d9 Add information on how an installed package was validated
When installing a package, store information on which validation
method was used and output this on "pacman -Qi" operations.

e.g.
Validated By   : SHA256 Sum

Possible values are Unknown, None, MD5 Sum, SHA256 Sum, Signature.

Dan: just a few very minor tweaks.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08 17:58:04 -06:00
Dave Reisner
bc311a24ce makepkg: use array instead of string
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 17:30:25 -06:00
Dave Reisner
8d26df5ee5 makepkg: avoid use of eval in run_pacman
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 17:30:15 -06:00
Dave Reisner
708a227578 makepkg: enforce decimal format for pkgrel
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 17:29:27 -06:00
Allan McRae
82abe079ab Point python shebangs at python2
Python PEP-394 states that all python code should point at the
python2 or python3 symlinks at maintain cross-distro compatibility.

Note that this does not matter when calling these scripts using
"make check" as they are explictly called using the detected python
version.  As this only affects manually calling these scripts, I
have not had configure/make replace the shebangs.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-08 17:28:55 -06:00
Christian Hesse
09a93b2e0e makepkg: allow specifying compression options
Adds the ability to override the commands used to compressing
compiled and source packages.  This is useful for those wanting
to use alternative implementations of the compression tools or
non-default compression options.

Allan: documented options in man page

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-08 17:28:36 -06:00
Benedikt Morbach
e85e77e6f9 Hook new optdepend structures up
No new behaviour introduced, everything should work exactly as before.

Dan: refactored to use the single alpm_depend_t structure.

Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08 17:26:46 -06:00
Dan McGee
00f29cbc14 Allow alpm_depend_t to have a description
This is the first step in parsing and handling optdepends. There is no
behavior change introduced in this commit; however, depends that contain
a ": " string will now be parsed as having a description and it will be
stored in the depend structure. Later patches will utilize this new
field as appropriate.

This is heavily based on the work of Benedikt, who did something similar
but introduced a new type for this rather than only a new field to the
existing type.

Heavily-influenced-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08 17:26:41 -06:00
Dan McGee
6a636b2b6e pacman-optimize: standardize on openssl usage, only touch local/
The rest of our scripts have been using `openssl dgst` rather than tools
like `md5sum` for some time, so convert this one too. We also make the
following other adjustments:

* Use a `find -print0 | xargs -0` pipeline so paths with spaces and or
  newlines don't totally kill us.
* Ensure the files we write out contain only paths relative to the
  database root, where we know the filenames should all be sane.
* Remove use of `diff`, this was the only time we used it in scripts and
  we can get a cheap substitute by comparing file checksums instead.
* Only touch the local/ part of the database. It makes little sense to
  do anything to the sync/ directory anymore as they are compressed
  single files that should be regularly written out in full and won't be
  fragmented on any sane filesystem.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08 17:26:23 -06:00
Pierre Schmitz
1fe6cabc4d pacman-key: Remove useless signature verification in --populate command
Verifing the keyring at this point is useless as a malicious package is already
installed and as such has several options to bypass this check anyway.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05 11:57:30 -06:00
Dan McGee
4ffa0401d2 Translation updates from Transifex
* it updates to all translations
* minor fr, pt_BR, de, lt, sk and uk updates
* add new strings in pacman translation catalog

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05 11:45:23 -06:00
Allan McRae
cb64fbeac4 Do not dereference symlinks when calculating size
Passing the "-L" flag to stat means we get the size of the file
being pointed to for symlinks instead of the size of the symlink.

Keep "-L" usage in repo-add as we want the actual size of the
package/delta/signature there.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-05 11:44:34 -06:00
Florian Pritz
ea7fc8962a makepkg: fix false error with multiple libdeps
With multiple items in $libdepends this check only worked for the first
one, everything after this returned an error. This was probably an issue
with \s being treated wrong.

Fix-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-03-05 11:44:34 -06:00
Florian Pritz
fbfcd86650 makepkg: fix extraction of soname in find_libdepends
libperl.so results in soname="libperl.so.so" which is wrong.

This returns the correct string: "libperl.so"

Fix-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-03-05 11:44:34 -06:00
Dan McGee
986e99a613 Fix a potential memory leak in filelist creation
If we begin to create a file list when loading a package, but abort
because of an error to one of our goto labels, the memory used to create
the file list will leak. This is because we use a set of local variables
to hold the data, and thus _alpm_pkg_free() cannot clean up for us.

Use the file list struct on the package object as much as possible to
keep state when building the file list, thus allowing _alpm_pkg_free()
to clean up any partially built data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05 11:44:34 -06:00
Dan McGee
4b384b7f0b Fix a memory leak when loading an invalid package
This is easily triggered via a `pacman -Sc` operation when it attempts
to open a delta file as a package- we end up leaking loads of memory
due to us never freeing the archive object. When you have upwards of
1200 delta files in your sync database directory, this results in a
memory leak of nearly 1.5 MiB.

Also fix another memory leak noticed at the same time- we need to call
the internal _alpm_pkg_free() function, as without the origin data being
set the public free function will do nothing.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05 11:44:34 -06:00
Dan McGee
d1151b5ab9 Database cleanup enhancements
Ensure we give database signatures special treatment like we already did
for package signatures. Attempt to parse the database name out of them
before taking the proper steps to handle their existence. This fixes
FS#28714.

We also add an unlink_verbose() helper method that displays any errors
that occur when unlinking, optionally opting to skip any ENOENT errors
from being fatal.

Finally, the one prompt per unknown database has been removed, this has
no real sound purpose and we don't do this for packages. Simply kill
databases we don't know about; other programs shouldn't have random data
in this directory anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05 11:44:33 -06:00
Allan McRae
687f7b6ba8 Use "mode" in _alpm_makepath_mode
It seems that if we pass the permissions that we want the created
directory to have, then we should probably use it...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 18:03:19 -06:00
Dan McGee
3849c3aec1 Merge branch 'maint'
Conflicts:
	contrib/pacsysclean.in
	src/pacman/conf.h
2012-02-20 17:00:26 -06:00
Allan McRae
326c6a8eed Update copyright years
Add 2012 to the copyright range for all libalpm and pacman source files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:54:34 -06:00
Allan McRae
5bbe342932 makepkg: rework libprovides
This reworks the implmentation of libprovides for the following
benefits:
 - Moves functionality from write_pkginfo() to find_libprovides()
 - Only calculates the version for libraries specifically requested
   and not all libraries. This has the disadvantage of running find
   over the $pkgdir for as many libraries as needed, but is unlikely
   to be an issue due to caching.
 - The order of the provides array in the PKGBUILD is kept in the
   package
 - There are more warning messages when things fail and those that
   were there are no longer errors (as I do not think failure of
   libprovides should result in complete packaging failure)
 - It is now modular so can be easy extended to other library types
   other than ELF *.so.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:54:19 -06:00
Dave Reisner
f8892b9d08 util: reduce pointer hell in _alpm_makepath_mode
Simplify the implementation:

- allocate and manipulate a copy of the passed in path rather than
  building out a path as the while loop progresses
- use simple pointer arithmetic to skip uninteresting cases
- use mkdir(3)'s return value and errno to detect failure

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:52:48 -06:00
Nagy Gabor
31d95b8679 Print error message when to-be-downloaded file cannot be created
It can happen that the to-be-downloaded file cannot be created in cachedir.
For example, I am an -Sup user, and it is comfortable to set --cachedir to
/mnt/pendrive, which is a FAT filesystem, so files like
capseo-1:0.3-2-i686.pkg.tar.xz cannot be downloaded to there.

Before this patch, pacman didn't give clear output about what happens when
the download code could not create the necessary file. This can be confusing
with -Su. An example output:
***
$ sudo pacman -S capseo bochs --cachedir /c/TEMP

resolving dependencies...
looking for inter-conflicts...

Targets (2): bochs-2.4.6-1  capseo-1:0.3-2

Total Download Size:    0.61 MiB
Total Installed Size:   2.61 MiB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
warning: failed to retrieve some files from extra
 bochs-2.4.6-1-i686       611.5 KiB   118K/s 00:05 [------------------]  97%
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
***

After the patch, pacman will give more informative error message (and
pm_errno is set properly):
***
error: could not open file '/c/TEMP/capseo-1:0.3-2-i686.pkg.tar.xz.part': Invalid argument
error: failed to commit transaction (failed to retrieve some files)
***

Unfortunately, the "could not open file" error message is printed for
every mirror (that can be dozens of lines), which is ugly, but at least
informative... Without modifying the download logic (for example, by
introducing -2 return value for _alpm_download() to indicate giving up),
this ugliness cannot be eliminated.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:51:55 -06:00
Dan McGee
78adb71f20 Don't check diskspace when using --dbonly
Mostly a waste of time. Sure, we no longer make sure your pacman
database partition has enough space, but if you are using this option
you better know what you are doing anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit ee96900605)
2012-02-20 16:49:11 -06:00
Dan McGee
fe659153d5 Give better error messages on database locking failures
This was noted when trying to perform an operation on a pacman database
on a read-only file system. Print the actual underlying errno string,
and only show the "you can remove" message if the lock file actually
exists.

Before:
    $ pacman -Su
    error: failed to init transaction (unable to lock database)
      if you're sure a package manager is not already
      running, you can remove /e/db.lck

After:
    $ pacman -Su
    error: failed to init transaction (unable to lock database)
    error: could not lock database: Read-only file system

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-19 23:24:26 -06:00
Dan McGee
4899b5bd86 diskspace: ensure we match only full path components
If one had a mountpoint at '/e' (don't ask), a file being installed to
'/etc' would map to it incorrectly. Ensure we do more than just prefix
matching on paths by doing some more sanity checks once the simple
strncmp() call succeeds.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-19 23:04:12 -06:00
Dave Reisner
ca41427141 parseopts: normalize options into an array
Modify parse_options logic to fill an array instead of printing parsed
options. Avoid eval like the plague. Because it is the plague.

Fixes bugs such as FS#28445.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-16 17:31:16 -06:00
Eric Bélanger
242006933d pacsysclean: Fix script description and accept -o option without hyphen
Close FS#28434

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-16 17:30:24 -06:00
Dan McGee
85712814cd Revert "Add -S --recursive operation"
This reverts commit f3fa77bcf1 along with
making other necessary changes to fully back this (mis)feature out until
we can do it correctly.

The quick summary here is this was not implemented correctly; provides
are not fully taken into account in this logic, and making that happen
exposes a lot of other flaws in this code that are covered up later on
in the dependency resolving process by several other pieces of
convoluted and conditional logic.

Tests have been adjusted accordingly. Some test EXISTS conditions have
been removed as we already know the package is installed locally, and we
also are checking the VERSION condition anyway.

With these two related revert commits, we do have some changes in test
pass/fail results:

* upgrade078.py: does not pass, this is due to --recursive getting
  removed for -U/-S operations after this commit.
* sync302.py: the version checks have been disabled, so this test
  continues to pass but has been scaled back in scope.
* sync303.py: now passes, was failing before.
* sync304.py: still failing, was failing before.
* sync305.py: now passes, was failing before.
* sync306.py: still passes, was passing before.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-15 15:58:07 -06:00
Dan McGee
9a1ff474f1 Revert "Enable recursive/needed sync on SyncFirst"
This reverts commit 0903452032.

Tests affected by this revert have been adjusted; additionally a few
EXIST tests have been removed where there is already a VERSION test
doing the job for us.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-15 15:56:16 -06:00
Christoph Vigano
edd81f3e8b makepkg: fix syntax error in remove_deps
This fixes a problem that occurs if you tell makepkg to remove installed
dependencies (just to be sure) but there are none. As the $ was missing
in front of deplist, the check never happened and 'pacman -Rn' was
called which obviously failed.

Dan: later reported as FS#28448.

Signed-off-by: Christoph Vigano <mail@cvigano.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-15 15:12:59 -06:00
Dan McGee
6c78f0d560 Update SIGPIPE signal handler comment
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-14 12:12:24 -06:00
Dan McGee
13a1d5883c scripts: unset CDPATH if cd is used
This wonderful/awful little bash shell variable wrecks havoc on `cd`
calls in shell scripts. Unset CDPATH in makepkg where we use `cd` quite
heavily. In pacman-optimize, we can move the change directory logic into
the bsdtar call so we are left with no usages of `cd` in the script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-14 10:11:43 -06:00
Dan McGee
c7321a7b80 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
	src/util/pactree.c
2012-02-13 10:14:06 -06:00
Nathan Phillip Brink
115c0381c2 Use AM_PATH_GPGME macro from gpgme instead of home-built gpgme detection.
Fixes compilation on Gentoo, where CPPFLAGS=-I/usr/include/gpgme is
necessary.

The AC_SYS_LARGEFILE macro call has to be before the GPGME checks,
otherwise the GPGME header gives an error about ABI incompatibilities.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:07:22 -06:00
Allan McRae
48d63048f1 Add gpgme m4 autoconf macro file
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:07:15 -06:00
Allan McRae
991be28672 Do not check for ALPM_ERR_PKG_INVALID_ARCH on remove operation
alpm_trans_prepare can not return ALPM_ERR_PKG_INVALID_ARCH on a
remove operation so there is no point in checking for it.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:06:13 -06:00
Allan McRae
e530993392 testpkg: set gpgdir
Without setting gpgdir, testpkg outputs:
warning: Public keyring not found; have you run 'pacman-key --init'?

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:05:18 -06:00
Allan McRae
7a3f59cd66 Reset errno before opening archive
Set errno to 0 at the start of _alpm_open_archive as it is not set when
archive_read_open_fd fails.  This can result in _alpm_pkg_load_internal
thinking errno == ENOENT and setting the wrong pm_errno. e.g.

Before:
> testpkg pacman-4.0.1-4-i686.pkg.tar.gz.sig
error: could not open file pacman-4.0.1-4-i686.pkg.tar.gz.sig: Unrecognized archive format
Cannot find the given file.

After:
> testpkg pacman-4.0.1-4-i686.pkg.tar.gz.sig
error: could not open file pacman-4.0.1-4-i686.pkg.tar.gz.sig: Unrecognized archive format
Cannot open the given file.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:03:05 -06:00
Allan McRae
8741551dc9 Move ROOTDIR definition into config.h
This was the only variable of its kind when a define was done on the
compiler command line.  Move it into config.h instead.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:02:50 -06:00
Allan McRae
3ba5391839 Allow specifying shell for running scriptlets
Some distributions insist on using bash specific commands in their
install scripts under the assumption that "sh" is a symlink to bash.
This can causes issues if (e.g.) their users what to change sh to
point at another shell, such as dash, that does not support these
features. Add a configure option to explicitly set the shell being
used to run install scripts.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:02:35 -06:00
Florian Pritz
20a16f55b3 use _alpm_access in a few more places for increased debugging info
pacman -U <pkg> returns a bogus "could not find or read package" if the
file is on a fuse file system that doesn't allow root access. Debug
output isn't very helpful here either so we should log why the access
check failed.

The other 2 checks already log something when failing so logging a more
specific error won't hurt either.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:02:02 -06:00
Dave Reisner
b4f5a63e7f lib/sync: use full delta size as max download size
The max filesize for a delta download must be the full size of the delta
file, not just what's remaining.

Fixes FS#28345

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13 10:00:28 -06:00
Dan McGee
e7bc1e3c9a 4.0.2 release updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 15:24:35 -06:00
Dan McGee
f8ae60bc28 Final pre-release Transifex updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 15:01:35 -06:00
Allan McRae
294f0fdf4d pactree: allow comments after repo section header
Duplicate the fix in config file parsing from d95c0494.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 14:58:28 -06:00
Allan McRae
31432edcbe makepkg: disable extglob when sourcing BUILDSCRIPT
PKGBUILDs are advertised as being pure bash so it would be expected
that the default bash options are in effect when sourcing it.

This inadvertantly "fixes" FS#27780 where enabling extglob causes
the bash parser to error on non-valid bash function names like
package_libxml++(). Note that these function names are unsupported
in bash and could break again even with this "fix" in future bash
releases.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 14:53:33 -06:00
Allan McRae
9b1ab3d767 makepkg: deal with mercurial exit codes
From mercurial-2.1, "hg pull" returns 1 when there are no updates.
Catch the return code and either pull the update or return an
error as appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 14:52:54 -06:00
Dan McGee
ea32924c62 Fix a handful of comment typos or misspellings
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 22:12:11 -06:00
Dan McGee
5945241469 Translation updates from Transifex, mostly scripts
This is after some manual massaging to fix issues with newlines in some
translations of the script catalogs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 21:59:12 -06:00
Dan McGee
f55be48977 Merge branch 'maint'
Conflicts:
	lib/libalpm/alpm_list.c
2012-02-06 05:50:48 -06:00
Andrew Gregory
b7c06d6d67 makepkg.sh.in - if both -r and -i are provided, only remove makedeps
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:50:27 -06:00
Dan McGee
b488f229d2 ALPM API adjustments for sanity and consistency
This makes several small adjustments to our exposed method names, and in
one case, parameters. The justification here is to make methods less odd
in their naming convention. If a method takes an alpm_db_t argument, the
method should be named 'alpm_db_*', but perhaps more importantly, if it
doesn't take a database as the first parameter, it should not.

Summary of changes:

    alpm_db_register_sync   -> alpm_register_syncdb
    alpm_db_unregister_all  -> alpm_unregister_all_syncdbs
    alpm_option_get_localdb -> aplpm_get_localdb
    alpm_option_get_syncdbs -> aplpm_get_syncdbs
    alpm_db_readgroup       -> alpm_db_get_group
    alpm_db_set_pkgreason   -> alpm_pkg_set_reason

All methods keep the same argument list except for alpm_pkg_set_reason;
there we drop the 'handle' argument as it can be retrieved from the
passed in package object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:49:52 -06:00
Dan McGee
f12effc6ff alpm.h: enum cleanups, comment formatting cleanup
Don't use trailing commas in enums if people really want to use a strict
C89 compiler, and document why on earth one particular enum uses bitmask
values when it doesn't seem necessary.

With comments, shoot for more consistency. When something is a
one-liner, keep it that way and move the whole /** sequence */ to one
line. When it needs more than one line, ensure we format most of them in
a similar fashion.

Two minor function signature adjustments are made that don't change
anything other than matching the parameter name (name -> filename)
and fitting in with our coding style (type* var -> type *var).

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:49:46 -06:00
Dan McGee
d8e1c450a3 Remove last explicit include of config.h
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:49:40 -06:00
Dan McGee
52afce0a10 Update translations from Transifex
The pacman-scripts catalog is omitted here due to various newline errors
I don't have the time to fix right now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:44:35 -06:00
Andrew Gregory
216db87f99 remove.c: make "target not found" error consistent with sync.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:36:22 -06:00
Andrew Gregory
0fdf0b19ce makepkg.sh.in - fix remove_deps test for deps to be removed
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:34:55 -06:00
Mantas Mikulėnas
17e71fc908 makepkg: add forgotten newline in help output
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:34:46 -06:00
Dan McGee
090ea28942 pactest: check return code in some upgrade tests
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-03 10:59:14 -06:00
Dan McGee
e01fdc3dba Add simple integer-only pow() implementation
We hardly need the complexity (or slowness) provided by the libm power
function; add a super-cheap one that suits our needs and is specialized
for the values we plan on passing in.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-03 08:56:17 -06:00
Thomas Dziedzic
e8db984ce5 Fix FS#27924: don't display negative zeroes
Dan: don't compute lower bound unless needed, flip argument order so
out values are last, add param Doxygen documentation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-03 08:56:16 -06:00
Allan McRae
47313acee4 makepkg: Fix non-writable SRCPKGDEST error message
Provide a helpful error message for when creating a source tarball
and SRCPKGDEST is not writable.

Fixes FS#28197.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-31 11:22:50 -06:00
Allan McRae
fcbae69fe8 Fix rare segfault on package removal
Very rarely a segfault would occur when removing a number of packages
due to a corrupted list for the local database (FS#27805, FS#28195).
This was caused by the alpm_list_msort function not correctly dealing
with the two new head node's prev values.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-31 11:22:30 -06:00
Dan McGee
4f54bde439 Merge branch 'maint'
Conflicts:
	scripts/makepkg.sh.in
2012-01-30 22:00:26 -06:00
Dave Reisner
9aa4d9a7b9 pacman-key: call gpg fewer times for revocation keys
Instead of iterating over the revocation keyfile and calling gpg once
for each key, map the file into an array and call gpg once, iterating
over this output to mark each key as revoked.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:59:41 -06:00
Dave Reisner
2a73f4e994 pacman-key: simplify trusted keyring iteration
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:59:34 -06:00
Dan McGee
9d1e8084df Update translations
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:56:53 -06:00
Dan McGee
7b2f600d71 Update pot translation catalogs
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:49:34 -06:00
Dan McGee
5c2928aa25 Make a few more copyright date tweaks
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:43:23 -06:00
Dave Reisner
9e9835f464 scripts: always use printf with embedded gettext
This addresses two problems:

1) echo's behavior is inconsistent when dealing with flags, and can
potentially be problematic.

  $ echo -n
  $ echo -- -n
  -- -n

2) Always using the end of options markers prevents translated strings
from throwing errors, as shown in FS#28069.

The remaining "inconsistencies" are because printf is being used in a
guaranteed safe manner, e.g.

  printf '%s\n' "$(gettext "--this can never break")"

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:31:38 -06:00
Allan McRae
7ff1b945f6 makepkg: workaround for zipman issues
This "fixes" two issues:

1) MAN_DIRS contains a glob by default so should not be quoted.  It is
not quoted anywhere else so this should not cause breakage...

2) the find statement returns 1 when some of MAN_DIRS are missing. This
appears to only be exposed when running makepkg as root (which it appears
some wrappers do...).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:18:28 -06:00
Dave Reisner
41db62b77a makepkg: check for license when creating srcpackage
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-23 13:34:28 -05:00
Dave Reisner
225ee71cae makepkg: abstract license check into separate function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-23 13:34:28 -05:00
Dan McGee
be038f9cb2 Remove rmrf implementation from backend
This moves the code for removal of local database entries right into
be_local.c, which was the last user of the rmrf() function we had in our
utility source file. We can simplify the implementation and make it
non-recursive as we know the structure of the local database entries.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 12:21:11 -06:00
Dan McGee
ac239c54d0 libalpm/deps.c: access trans flags directly
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 12:21:05 -06:00
Dan McGee
e50c4a8837 Merge branch 'maint'
Conflicts:
	lib/libalpm/diskspace.c
	src/pacman/util.h
2012-01-23 12:20:52 -06:00
Dave Reisner
825b4ff35a lib/dload: give uniform naming to curl CB functions
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 12:16:49 -06:00
Dan McGee
a03c35125e Fix sys/mnttab.h header include
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 12:15:53 -06:00
Dave Reisner
44f146f232 lib/dload: enforce usage of TCP keepalives
This is particularly important in the case of FTP control connections,
which may be closed by rogue NAT/firewall devices detecting idle
connections on larger transfers which may take 5-10+ minutes.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 12:14:58 -06:00
Allan McRae
edd4276bbf makepkg: restrict usage of flags passed to pacman
With pacman-4.0, using --noconfirm or --noprogressbar with -Q or -T
results in pacman reporting an "invalid option" error. Restrict the
passing of these options to pacman. Fixes FS#28012.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 09:23:21 -06:00
Allan McRae
df47136bcf makepkg: fix error on unnecessary -r
The grep statement used to check for a difference between the
installed package list before and after resolving dependencies
returns 1 if there is no difference.  This sets of the error
trap when "-r" is used "unnecessarily".

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 09:23:15 -06:00
Dan McGee
de56874cc9 contrib/bash_completion: don't print stderr messages
If you are a crazy developer like me and have bogus options in your
pacman.conf file, the tab completion gets messed up by the output on
stderr. Suppress it.

Fix the same basic issue in zsh_completion, thanks to the work by
Florian Pritz <bluewind@xinu.at>.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-19 16:28:04 -06:00
Dan McGee
1eb40c8328 Add diskspace checking support for Solaris/Illumos
Was able to get my hands on one of these boxes today, so add yet another
new way of doing this. I'm glad these calls are so standardized. This
was compile tested on Linux and Illumos and seems to still be working in
both places.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-19 16:28:04 -06:00
Dan McGee
562109c0e8 Update copyright on changed files since beginning of year
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:25:27 -06:00
Dan McGee
b3612e9cc1 Allow UseDelta option to specify a delta ratio
Rework the frontend and backend to allow passing a ratio value in for
UseDelta rather than having a hardcoded #define-d 0.7 value always used.
This is useful for those with fast connections, who would likely benefit
from tuning this ratio to lower values; it is also useful for general
testing purposes.

The libalpm API changes for this, but we do support the old config file
format with a no-value 'UseDelta' option; in this case we simply use the
old default of 0.7.

We clamp the ratio values to a sane range between 0.0 and 2.0, allowing
ratios above 1.0 for testing purposes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:10:06 -06:00
Olivier Brunel
1b50223f82 util.c, rmrf(): only create string when needed
The entry's name is only used when not "." or ".." so only print the
string then.

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:08:03 -06:00
Allan McRae
c77cec2ffc Fix missing [removal] output
Currently, a transaction is considered to be purely package removal
until the first package install is found.  This resulted in the
removed packages at the start of a combined upgrade/removal transaction
not getting the "[removal]" output.

Fixes FS#27981.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:02:38 -06:00
canyonknight
c231c9af97 Improve exit statuses and error messages in pacman-key
Return codes from gpg commands are currently lost. This adds the functionality
of taking non-zero exit statuses from gpg. This includes error reporting for all
gpg commands that are run individually, run in a loop, and run through a pipe.

Includes the check_keyids_exist function which verifies a key exists locally
prior to attempted local manipulation of the key.

If a gpg command has a non-zero status, pacman-key will now exit with a non-zero
status. It will print a gettext error message of gpg's failure.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:01:12 -06:00
canyonknight
24ca6ce1f9 Turn gpg commands into functions in pacman-key
Adds functions for every gpg command. By pulling out the gpg commands from the
"program start" section, additional commands can be run before or after a
specific gpg command without adding additional clutter to the function call
section.

Adds an explicit exit status of 0 to prevent arithmetic expansions from
returning non-zero, thereby falsely causing pacman-key to have a non-zero exit
status.

This change creates the framework for additional error messages and better
exit statuses being added to every pacman-key gpg call.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:01:00 -06:00
Dan McGee
430b0df779 repo-add: clean up help messages
Use consistent blank lines across all commands, get rid of the
translated double newlines which only serve to confuse translators, and
fix -h/--help for that extra special third command this script offers.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:00:13 -06:00
Olivier Brunel
d9af1a0cf2 Fix broken output when asking question and stdin is piped
When asking question and stdin is piped, the response does not get printed out,
resulting in a missing \n and broken output (FS#27909); printing the response
fixes it.

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 21:59:54 -06:00
Dave Reisner
4e60b9646d fetch_url: look for files in cache before downloading
We lost this logic somewhere between the libfetch and libcurl
transition, as it existed in the internal downloader, but was pulled
back only into the sync workflow. Add a helper function that will let us
check for existance in the filecache prior to calling the downloader.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 21:56:50 -06:00
Dan McGee
b426488e2b Use isdigit() rather than character range comparisons
This is safer and guaranteed to work with even exotic character sets.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 15:32:48 -06:00
Dan McGee
7b1a86b893 Remove unused strtoupper() function
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 15:32:34 -06:00
Dan McGee
be229d129e Don't remove unknown files in cache cleaning code
This removes the hack I added to skip '*.sig' files earlier since there
are other files that also fall into the same bucket- source packages
from `makepkg --source`, delta files, etc. Rather than prompting for
each and every one, simply skip them. Doing '-Scc' rather than '-Sc'
will delete these files if that is really what you want to do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 12:15:11 -06:00
Dan McGee
e8a2c25456 doc/vercmp: add note about pkgrel handling
This comes from the Doxygen function documentation. Also, fix two rather
silly misspellings.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-12 17:30:08 -06:00
Dan McGee
6e8ca48cbb Reorder some operations in sig check for efficiency
We don't need to open the data to be checked if we don't have a
signature to check against, so postpone that open until we know we have
either the base64_data or a valid signature file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-12 09:31:09 -06:00
Dan McGee
b6209b4ba4 Use fileno() in isatty() call
This was our only use of the function that had a hardcoded file
descriptor.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-12 07:47:32 -06:00
Dan McGee
4f02b98338 Merge branch 'maint'
Conflicts:
	lib/libalpm/signing.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:14:04 -06:00
Allan McRae
73d0d743bd makepkg: abort on missing download agent
makepkg would not abort on a missing download agent due to the
output variable being declared local on the same line as the
function call in the assignment. That would result in strange output
such as:

==> Retrieving Sources...
==> ERROR: There is no agent set up to handle foo URLs. Check /etc/makepkg.conf.
    Aborting...
  -> Downloading foobaz...
/home/arch/code/pacman/scripts/makepkg: line 401: foo://foobaz: No such file or directory
==> ERROR: Failure while downloading foobaz
    Aborting...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:13:32 -06:00
Allan McRae
2b38f4eab7 makepkg: fix missing source file detection
Declaring the variable as local on the same line as the assignment
results in result of the assignment being returned rather than the
result of the function on the righthand side of the assignment.

Declaring the variable as local on a separate line means the result
of the function on the r.h.s. is returned and our error function
will be invoked if necessary  (although it is practically impossible
to ever trigger it...).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:03:56 -06:00
Allan McRae
36413aa856 makepkg: simplify source archive generation
Simplify the source tarball generation by unifying the handling of
local and remote files.  This also allows local files to be found
in $SRCDEST (FS#26580) and makepkg will abort on missing local source
files (only possible to trigger in combination with --skipinteg).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:03:48 -06:00
canyonknight
102e6209c7 Fix zsh completion for *.pkg.tar
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:03:36 -06:00
canyonknight
24c166f42a Fix bash completion for *.pkg.tar
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:03:28 -06:00
Dan McGee
7f51ba99ae Fix segfaults on opening invalid archive files
"invalid" in this case simply means files that may or may not be
archives. Discovered via a `pacman -Sc` operation with delta files in
the package cache directory, but can be triggered if any file is passed
to `pacman -Ql` that isn't an archive, for instance, or if the sync
database file is not an archive.

Fix it up so we are more careful about calling archive_read_finish()
only on archives that are valid and have not already been closed, and
teach our archive open function to set the returned archive to NULL if
we aren't going to be returning something valid anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 11:53:22 -06:00
Dan McGee
6f9ab22fd8 testdb: check local database for duplicate files
This adds an additional check step to find files in the local database
that claim to be owned by more than one package at once, which is
definitely not a supported setup.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07 11:28:37 -06:00
Dan McGee
2d794cc031 Update sync database size estimation values
As the comment states, this is more like a dartboard than science.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07 11:28:37 -06:00
Dan McGee
b7ecff160e Clean up <inttypes.h> header inclusions
In both cases we can go with the slightly leaner <stdint.h> header
include since we aren't using the print macros.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07 11:28:37 -06:00
Dan McGee
d59324c8ff Use 32-bit wide integer type in PolarSSL code
A look at what this does on 64 bit systems since we were using the
unnecessarily large 'unsigned long' type before even though it was 64
bits wide:

$ ~/bin/bloat-o-meter libalpm.so.old lib/libalpm/.libs/libalpm.so
add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-10412 (-10412)
function                                     old     new   delta
md5_finish                                   370     356     -14
sha2_finish                                  547     531     -16
md5_process                                 3762    2643   -1119
sha2_process                               20356   11093   -9263

The code size is nearly halved in the sha2 case (44% smaller code size),
and md5 gets a nice size reduction (27% smaller) as well.

We also move base64 code to <stdint.h> types as well; we can use
'uint32_t' rather than 'unsigned long' for at least two variables in the
decode function. This doesn't net the same size benefit as the hash code
case, but it is more proper.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07 11:27:41 -06:00
Dan McGee
a857b9c8e0 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05 17:04:42 -06:00
Dan McGee
c6e1d4ddde Update scripts translation catalog
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05 17:02:10 -06:00
Dan McGee
a1437cbf1b Remove useless logger message
We don't need two log messages back-to-back about the same thing here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05 16:48:21 -06:00
Dan McGee
def9e45aff Search for PGP subkeys in a keyserver-acceptable way
PGP keyservers are pieces of sh** when it comes to searching for
subkeys, and only allow it if you submit an 8-character fingerprint
rather than the recommended and less chance of collision 16-character
fingerprint.

Add a second remote lookup for the 8-character version of a key ID if we
don't find anything the first time we look up the key. This fixes
FS#27612 and the deficiency has been sent upstream to the GnuPG users
mailing list as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05 16:34:51 -06:00
Dan McGee
6513b0ba59 Merge branch 'maint'
Conflicts:
	doc/Makefile.am
2012-01-02 19:44:00 -06:00
Dave Reisner
f1d9b0a74a add new pactest for syncfirst with recursive deps
Add 1 failing for the -Su case, and the same case using -S (and
passing).

This is based on a real (current) issue of upgrading staging chroots
with the new pacman in staging for a libarchive build, and a new
toolchain in testing.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 19:42:56 -06:00
Dan McGee
0b9cd9448c pkghash improvements/modifications
This patch changes a variety of small things related to our pkghash
implementation with an eye toward performance, especially on native
32-bit systems.

* Use `unsigned int` rather than `size_t` for hash sizes. We already
  return ERANGE for any attempted creation of a hash greater than 1
  million elements, so unsigned int is more than large enough for our
  purposes. Switching to this type allows 32 bit systems to do native
  math without helper functions from libgcc.
* _alpm_pkghash_create() now internally adds extra padding for
  additional array elements, rather than that being the responsibility of
  the caller.
* #define values are moved into static const values in pkghash.c; a new
  `stride` value is also extracted (but remains set at 1).
* Division and modulus operators are removed from the normal find and
  add paths if possible. We store the upper limit of the number of
  elements in the hash so we no longer need to calculate this every
  element addition. When doing wraparound position calculations, we only
  apply the modulus operator if the value is greater than the number of
  buckets.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 19:41:42 -06:00
Allan McRae
6507fd6bf0 Prevent rebuild of man pages when using release tarballs
Commit 43cad9c8 made the building of all docs depend on the Makefile.
However, the Makefile is generated after running ./configure so is
always newer than any pregenerated docs.  This means that people
building from released pacman tarballs are forced to rebuild the
docs (and thus have asciidoc installed).  That defeats the purpose
of prebuilding the documentation.  Have the documentatin depends on
Makefile.am instead as this is probably what was intended.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 19:15:58 -06:00
Dan McGee
177beb91c9 Minor optimization on likely sync package lookup
We have a name_hash value here, so add a cheap compare of it before
falling to the strcmp() call.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 13:17:44 -06:00
Allan McRae
29e94dc065 be_package.c: fix compiler warning
be_package.c: In function 'parse_descfile':
be_package.c:181:28: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]

ptr - key + 2 is guaranteed to be > 0 so we can cast to size_t

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:58:51 -06:00
Dan McGee
eb5cb8ec02 Remove unnecessary counters in file removal code
Now that filelist arrays know their own size, we don't need to do the
bookkeeping we used to do when they were linked lists. Remove some of
the counter variables and use math instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:58:51 -06:00
Dan McGee
496f7b4f64 alpm_list_msort: inline alpm_list_nth() call
This reduces the number of functions we call by log(n) in this function,
and the inlined version is trivial and barely increases the size of the
function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:58:51 -06:00
Dan McGee
566f5210ce contrib: add install rules for bash and zsh completion
Uninstall rules are provided as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:58:47 -06:00
Dan McGee
2ce4f85f1e Convert get_update_timediff to integer return value
We don't need absolute floating point precision at all here; we can
stick to integer land and use milliseconds which are precise enough for
our purposes. This also removes most floating point math out of the
non-update code path.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:55:59 -06:00
Dan McGee
819c28bf8c Only compile delta regex once
This reduces the number of regcomp() calls when parsing delta entries in
the database from once per entry to once for the entire context handle
by storing the compiled regex data on the handle itself. Just as we do
with the cURL handle, we initialize it the first time it is needed and
free it when releasing the handle.

A few other small tweaks to the parsing function also take place,
including using the stack to store the transient and short file size
string while parsing it.

When parsing a sync database with 1378 delta entries, this reduces the
time of a `pacman -Sl deltas` operation by 50% from 0.22s to 0.12s.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:55:55 -06:00
Dan McGee
627cf6bca8 Fix delta parsing
In commit 4c5e7af32f, we changed this code to use the regex gathered
substrings. However, we failed to correctly store the delta file name
(leaking memory), as well as freeing the temporary string used to hold
the file size string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-31 21:03:24 -06:00
Dan McGee
39cb865e71 Simplify hash function to a single multiplication
More than likely the compiler will do the three operation breakdown we
had here before (2 shifts + subtraction), but let the compiler do the
optimizations and make the actual operation more obvious. This actually
slightly shrinks the function binary size, likely due to instruction
reordering or something.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-31 21:03:24 -06:00
Dan McGee
7113ea4e08 Fix bogus string cast in search debug message
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-29 14:24:08 -06:00
Allan McRae
b264fb9e9d makepkg: calculate exact total file size
The current calculation of the total file size for a package using "du"
suffers from issues in portability and correctness.  Especially on btrfs,
this can result in clearly wrong package information such as:

Download Size  : 14684.29 KiB
Installed Size : 7628.00 KiB

Use an approach based on "stat" to calculate total file size.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-28 22:32:22 -06:00
Allan McRae
1b46137426 makepkg: Use SKIP in checksum to skip integrity check
Using the value of "SKIP" in the checksum array will cause that
integrity check to be skipped.  This makes building packages that
rely on user configurable sources less painful.

Based-on-patch-by: Dan McGee <dan@archlinux.org>
Based-on-patch-by: David Campbell <davekong@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-28 22:27:02 -06:00
Lukas Fleischer
a77e638c77 contrib/*: Support the "--help" and "--version" options
Add "--help"/"-h" and "--version"/"-V" support to all contrib scripts.
Also, update scripts that used "-v" as a short option for "--version"
and use "-V" for the sake of consistency.

Additionally:

* Move version and usage messages to separate convenience functions in
  all scripts.

* Add a workaround to paccache to support "--help" and "--version". This
  should be replaced by a proper POSIX-compliant command line parser
  that supports long options in a future patch.

* Add a "$myver" variable to all scripts and use it whenever we refer to
  the program version (e.g. in version messages). Also, use the pacman
  version number everywhere instead of using a different versioning
  scheme for each contrib script. This is achieved by adding a
  "PACKAGE_VERSION" placeholder that is replaced by sed(1) when the
  script is built.

* Ensure we always return with exit status 0 if "--help" is used and
  return with exit status 1 if we display the usage message due to
  invalid arguments.

* Add "AUTOMAKE_OPTIONS = std-options" and add all scripts to
  "bin_SCRIPTS" to make `make installcheck` check that installed scripts
  actually support the "--help" and "--version" options.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:49:46 -06:00
Lukas Fleischer
cd75ae46ab Makefile.am: Extract "contrib/" into DIST_SUBDIRS
This implies following changes:

* contrib scripts can be built and installed easily by running make(1)
  in "contrib/". This removes the need to pick all contrib scripts
  manually when packaging pacman-contrib.

* contrib scripts will no longer be built when running make(1) in the
  top level source directory. This seems like the most natural approach.
  We install those separately and should act the same when building
  stuff.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:49:40 -06:00
Dan McGee
c34b69b5c7 Convert strtrim/strlen paired calls to only strtrim
This utilizes the new return value so we don't have to find the length
of the string again.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:47:30 -06:00
Dan McGee
38143770a9 Merge branch 'maint' 2011-12-23 14:40:59 -06:00
Timothy Redaelli
5b749eeee9 pacman-key: Add missing quotes
Signed-off-by: Timothy Redaelli <timothy.redaelli@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:39:12 -06:00
Dan McGee
aac639351f Remove strtrim function from backend
The last user of this was the code in the backend for loading packages,
but this no longer uses it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:37:03 -06:00
Dan McGee
a7cb150931 be_package: be more explicit parsing key/value pairs
This eliminates the need for strtrim() usage completely, instead relying
on the fact that the only allowed delimiter between key and value is the
" = " string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:37:03 -06:00
Dave Reisner
e28f321a48 pactree: cleanup register_syncs
- take advantage of the new strtrim return value
- tighten scope on line pointer

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23 14:37:03 -06:00
Dave Reisner
bec0b0c823 pactree: update with new strtrim function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23 14:37:03 -06:00
Dan McGee
6b29374a60 Rework package removal code
Extract the actual unlinking of files into a new method, which
eliminates a goto used for flow control. Also fix up a few small issues
in the code:

* Unnecessary (unsigned long) cast, use '%zd' instead
* Total up errors returned from unlink_file calls and return to caller
* Be consistent with scriptlets- we run pre_remove on dbonly, so we
  should also run post_remove. Both can be disabled by way of the
  --noscriptlet argument.
* Don't pass an invalid pointer to oldpkg to the event callbacks;
  instead call the callback before we free the object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:37:03 -06:00
Dave Reisner
92216c5864 pacman/util: return size_t from strtrim
Instead of returning the same value as the parameter to this function,
return the length of the string, which can be useful to the caller when
its non-zero (e.g. to find the end of the string).

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23 14:37:03 -06:00
Allan McRae
d95c04945f Allow comments after repo section header in pacman.conf
Pacman assumes that the final character of a line specifing a repo
in pacman.conf is a "]".  But it did not clean whitespace from the
line after removing any comments.  So lines like:

[allanbrokeit]  # could break system

caused pacman not to recognize the repo.  Adjust config parsing to
strip comments before trimming whitespace from the end of the string.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:36:25 -06:00
Diogo Sousa
7b2f68cc21 Created hex_representation() in lib/libalpm/util.c
Used in alpm_compute_md5sum() and alpm_compute_sha256sum().

Signed-off-by: Diogo Sousa <diogogsousa@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-21 18:13:17 -06:00
Dave Reisner
d6ccd44390 include config.h via Makefiles
Ensures that config.h is always ordered correctly (first) in the
includes. Also means that new source files get this for free without
having to remember to add it.

We opt for -imacros over -include as its more portable, and the
added constraint by -imacros doesn't bother us for config.h.

This also touches the HACKING file to remove the explicit mention of
config.h as part of the includes.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-21 18:13:17 -06:00
Dan McGee
6c1426842a Add note to HACKING about operator spacing 2011-12-21 18:13:17 -06:00
Dan McGee
ee96900605 Don't check diskspace when using --dbonly
Mostly a waste of time. Sure, we no longer make sure your pacman
database partition has enough space, but if you are using this option
you better know what you are doing anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-21 16:42:47 -06:00
Dave Reisner
71164b76c4 sync: avoid checking file conflicts with --dbonly
Scratches my own itch from FS#25667

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-13 10:44:37 -06:00
Dave Reisner
4c5e7af32f delta: use regex substring matching
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-13 10:44:28 -06:00
Dan McGee
2a4df070c3 Merge branch 'maint' 2011-12-12 14:07:44 -06:00
Dan McGee
370c873be5 Calculate root length only once when checking for file conflicts
It is quite easy to hoist this potentially repeated computation out of
the loop; even if we don't end up using it, it is super cheap to do it
only once.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 13:05:10 -06:00
Dave Reisner
8c8f043717 lib/conflict: save strlen call by reusing snprintf return
The return should probably be checked to ensure its not longer than
PATH_MAX, but I have no idea what the correct behavior is when that
happens.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:56:48 -06:00
Dave Reisner
67290441b8 contrib/paccache: silence possible output from cd
If CDPATH is set, this could possibly write to stdout.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:52:40 -06:00
Dave Reisner
3d4656c020 code syntax cleanup
As per HACKING file, we use 'CTRL(' rather than 'CTRL ('

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:51:59 -06:00
Eric Bélanger
b75fac5be3 pacsysclean: Add new contrib script
pacsysclean sort installed packages by decreasing installed size. It's
useful for finding large unused package when doing system clean-up. This
script is an improved version of other similar scripts posted on the
forums. Thanks goes to Dan for fixing and improving my original script.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:48:50 -06:00
Dave Reisner
5f0df42303 makepkg: split source elements when looking for sigs
Allows renamed .asc/.sig files to be still discovered by makepkg. This
is needed for a package such as PuTTY, which provides abnormally named
sig files (.DSA and .RSA) which are valid input for gpg --verify.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:47:46 -06:00
Dan McGee
1a1f5540a4 pacman: process all sync targets before exiting on error
If someone specifies a bogus line such as

    pacman -S baz adsf/boo base-devel

we are better off trying to process all targets and showing all relevant
errors before exiting. This is easier in -U and -R operations where we
aren't dealing with groups, but here we attempt to skip group selection
once we know a target has errored to avoid cluttering the output and
hiding the real problem.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Dan McGee
074cf4cb95 pacman: process all targets on upgrade operation
If an early target fails, we stopped processing the rest of the list. We
should continue all the way through and show relevant errors for each
target if possible, and error out only at the end.

We do process all targets to check for URLs first and will error out if
some could not be processed; we then do a second loop and try to load
each target specified on the command line.

This mirrors a patch by Allan to do the same for removal operations.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Allan McRae
62fa0c7d8d pacman: list all unknown targets on removal operation
On a removal operation, pacman currently reports an error for the
package that is not found in the database and then exists.  Adjust
so that all unknown packages are reported.

Before:
> pacman -R foo bar
error: 'foo': target not found

After:
> pacman -R foo bar
error: 'foo': target not found
error: 'bar': target not found

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Dan McGee
781af8f91b Use automake verbose helpers in custom make rules
This converts our script generation to use the built-in AM_V_GEN macro,
which honors the V= setting passed to make and allows one to see the
full command if they truly desire. The AM_V_at macro is also used in
place of an explicit @ so verbose-mode compiles show all commands being
run.

We can also use these two macros in doc generation to quiet it down to
the level we expect.

Other minor changes:
* a pointless test call is removed in test/pacman/tests/
* sed is used instead of dos2unix as we depend on it anyway
* consecutive chmod calls are reduced to a single call (e.g., '+x,a-x')

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-08 09:17:39 -06:00
Dan McGee
dacda1f6b3 Make automake generate silent rules by default
This will require you to pass 'V=1' if you want the previous, more
verbose output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-08 09:15:41 -06:00
Dan McGee
b5225165c0 Move items around in the alpm handle struct
This allows for the struct layout to have no empty spaces.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:05:02 -06:00
Dan McGee
86cb6e1f0f Slight local database files reading optimization
Since we know the length of the line, we can use this all the way
through and do a cheaper operation than strdup() by just invoking malloc
and memcpy directly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:04:14 -06:00
Lukas Fleischer
0e4946d559 scripts/*: Declare several constant variables read-only
Be more semantically accurate and avoid accidental overwriting of some
configuration variables that are considered to be constant.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:02:11 -06:00
Dan McGee
a3a75e0a41 Merge branch 'maint' 2011-12-07 10:00:20 -06:00
Lukas Fleischer
1038e66964 contrib/*: Hardcode program names
Add a read-only variable "$myname" to every contrib script and hardcode
program names instead of relying on "$0". The variable name "$myname"
was chosen because it is already used in pacman and because we use
"$myver" to specify the program version in the official scripts.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 09:59:30 -06:00
Dan McGee
48188fbeee Add 'silent-rules' to automake setup in configure.ac
This is awesome, and I don't know why we haven't already done this. It
gives us the much more less verbose make output in a few different ways:

* If you run `make V=0`, you will get the quiet output.
* If you run `./configure --enable-silent-rules`, the quiet output is
  the default; verbose output can be had by passing V=1 to make.

    make[3]: Entering directory `/home/dmcgee/projects/pacman/lib/libalpm'
      CC     add.lo
      CC     be_local.lo
      CC     be_package.lo
      CC     be_sync.lo
      CC     delta.lo
    .....

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 09:59:27 -06:00
Dan McGee
6a1d3948a6 Use correct size in memset
We were using the size of a pointer, not the size of the whole
archive_read_buffer struct. Thanks to Clang/LLVM 3.0 and Allan/Dave in
IRC for finding this one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 23:21:56 -06:00
Dan McGee
17e0be9e6a repo-add: enforce maximum .sig file size
This prevents user error in adding a file generated via `gpg --sign`
rather than `--detach-sign`, for example. The same 16KiB limit is used
we use in our pacman download code.

The section is moved above the checksum generation to avoid presenting
info messages to the user if the signature isn't valid.

Addresses a shortcoming pointed out in FS#27453.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 10:48:47 -06:00
Dan McGee
d85d0ddcfe Enforce signature download size limit on -U <url> operations
We had a 16 KiB limit on database signatures, we should do the same here
too to have a slight sanity check, even if we can't do so for the
package itself yet.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 10:07:05 -06:00
Lukas Fleischer
61ce2ca1bb contrib/paclist: Add "--help" command line parameter
Be consistent with all other contrib scripts and support the "--help"
command line switch. Fixes FS#27258.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 09:22:12 -06:00
Dan McGee
1d98c6347c Merge branch 'maint' 2011-11-30 22:34:25 -06:00
Dave Reisner
5490cd6eb2 makepkg.5: fix typo s/tar,bz2/tar.bz2/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:30:22 -06:00
Dave Reisner
a521cea96f makepkg: avoid using comm for diff'ing package lists
Whereas comm will check inputs to see if they're sorted (and warn when
they aren't), grep doesn't even care about ordering. In this particular
instance -- neither do we. We're only interested that the two lists are
equivalent.

Fixes FS#26580.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee
15aa57d51b _alpm_ldconfig: return value from _alpm_run_chroot
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee
d7f8838294 Add two new pactests for pacman upgrade behavior
Both currently marked as failing.

* sync303.py encapsulates the broken behavior reported in FS#27214.
* sync304.py shows how packages depending on a specific version of a
  package in SyncFirst can cause breakage of the dependency resolver.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee
f5820c8bd6 Miscellaneous post-4.0.1 updates
Some late-arriving translation updates and add the correct dates to the
index.txt releases table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee
86b5b7aa42 Add helper function for duplicating depends lists
We do this in several of the package duplication steps; add a helper
function for doing so to reduce some of the repetitive code.

Also add a free_deplist function for our repeated depend list free calls
of both the data and the list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:26:52 -06:00
andrew.gregory.8@gmail.com
77af613efc added doxygen documentation
Made existing documentation more consistent and added
documentation where there was none. One function still
needs documentation and is marked with 'TODO'.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-22 00:31:10 -06:00
Dan McGee
96b3ba3470 Merge branch 'maint' 2011-11-20 21:40:50 -06:00
Florian Pritz
2141b7112d add key algo to import msg
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:40:19 -06:00
Florian Pritz
2f96067fe7 change gpg import message to resemble gpg --list-keys
Dan: const pointers, don't worry about bitfields.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:39:33 -06:00
Phillip Smith
5ba8b83b8b makepkg: add support for PACKAGER environment var
Add support for overriding configuration in /etc/makepkg.conf and
~/.makepkg.conf by setting the environment variable PACKAGER similar to
how SRCDEST and PKGDEST behave.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-11-20 21:36:30 -06:00
Allan McRae
cb898be887 repo-add: Remove .tmp. prefix from output
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dan McGee
80868b0da6 repo-add: ensure database and signature files are always viewed in whole
This addresses a short but sweet race condition currently existing in
repo-add and repo-remove. We do the smart thing and zip the database to
a location in a temporary directory and not over the original database
directly. However, we then proceed to move this file directly from the
temporary directory to our final location, which is more than likely a
cross-filesystem move (/tmp on tmpfs) and thus non-atomic.

Instead, zip the file to the same directory, prefixing the filename with
'.tmp.'. We then move the file into place. This move is guaranteed to be
atomic, so any reader of the database file will get either the old
version, the new version, or ENOENT.

We also perform a hardlink if possible instead of a move when shifting
the old database out of the way to '.old'; this ensures there is no
chance of a database file not existing during the whole process.

Only one small race condition should now be present- when the database
has been fully moved into place and the signature has not, you may see a
mismatch. There seems to be no good way to address this, and it existed
before this patch.

A final note- if someone had locked-down permissions on the directory
that the database files are in (e.g., could only write to foo.db.tar.gz,
foo.db, foo.db.tar.gz.old, foo.db.old, and the lock file), this would
break.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dan McGee
6a9ed33055 repo-add: ensure path to LOCKFILE is always absolute
Given our semi-frequent use of pushd/popd, if we are in any directory
but the original and the database path given was relative, we won't
unlock the database file when cleaning up after an error.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dan McGee
507a2d15e6 Final changes before 4.0.1 release
* Add last-minute changes to NEWS
* Don't treat '_' or '_n' special in scripts when finding translatable
  strings; this breaks with one use of `read` and a dummy _ variable

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:29:46 -06:00
Dave Reisner
b8ef22312b makepkg: trim trailing space from whitespace sensitive vars
This applies to pkgver, pkgrel, and epoch and ensures that any trailing
whitespace outside of the context of the variable declaration itself is
properly trimmed. The Bash parser will ignore this, and so should we.

We don't need to worry about leading space because it would force a
syntax error, or fail validation.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:17:43 -06:00
Dan McGee
2752932d19 Update alpm_errno_t type to non-enum version
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:53:34 -06:00
Dan McGee
919b604c29 Merge branch 'maint' 2011-11-16 14:51:17 -06:00
Dan McGee
dee8144ce5 Add helper method for creating and opening archive object
This moves the common setup code of about 5 different callers into one
method. Error messages will now be common and shared in all places;
several paths did not have any messages at all before.

In addition, we now pick an ideal block size for the archive read based
off the larger value of our default buffer size or the st.st_blksize
field. For a filesystem such as NFS, this is often much larger than the
default 8192- values such as 32768 and 131072 are common.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:51:06 -06:00
Dan McGee
c79c068fe9 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:45:25 -06:00
Dave Reisner
ad09db3c55 makepkg.conf: disable motd printing for rsync DLAGENT
Fixes FS#26806.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:37:42 -06:00
Dan McGee
9363e7dc22 Allow sync_prepare to work in certain cases without sync databases
When doing a bare -U operation on a local package that doesn't pull in
any dependencies from the sync databases, we can get away with missing
database files. This makes the check conditional on no sync targets
found in the target list. This is not the prettiest code here so we have
a bit of hackish behavior required to straighten both the behavior and
the nonsensical error message out.

Addresses FS#26899.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:12:18 -06:00
Dan McGee
f1ec3b9b10 Remove unnecessary casts in callback code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:11:03 -06:00
Allan McRae
37ff0f5658 Update documentation regarding signature extensions
Commit e7b56f48 allowed makepkg to handle pgp signatures with the
.sign extension.  Update the man page to reflect this.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 08:17:08 -06:00
Jonathan Conder
a3f9399295 create a typedef for enum _alpm_errno_t
This is consistent with the other enums and structs, and should be
slightly more readable.

Signed-off-by: Jonathan Conder <jonno.conder@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-14 08:54:03 -06:00
Dan McGee
c0ce10397a Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 22:21:02 -06:00
Dan McGee
fcf0a8b203 Updates in preparation for 4.0.1 release
Bump the version, update the translation template files, and fill in
NEWS with relevant commits and changes since 4.0.0.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 21:55:52 -06:00
Dan McGee
1de5070bb3 Merge branch 'maint' 2011-11-13 13:38:57 -06:00
Dave Reisner
10241a6d76 add fnmatch support for HoldPkg
Adds test remove031.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-13 14:19:16 -05:00
Dave Reisner
902305f163 add support for back end fnmatch'd options
This is work originally provided by Sascha Kruse on FS#20360 with only
minor adjustments to the implementation. It's been expanded to cover:
NoUpgrade, NoExtract, IgnorePkg, IgnoreGroup.

Adds tests ignore008, sync139, sync502, and sync503.

Also satisfies FS#18988.

Original-work-by: Sascha Kruse <knopwob@googlemail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-13 14:19:00 -05:00
Dave Reisner
64d54f6741 invert iteration order for ignoregroup
This is a simple change that allows comparions to be more in line with
how other checks are done. It will be necessary for ensuing patchwork
that implements fnmatch for comparing and assumes a specific argument
ordering.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-11 16:08:21 -05:00
Dave Reisner
42e2f8bfbf makepkg: check for value before using eval'd var
This prevent bsdtar from exploding when install= or changelog= are
present without a value.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-10 09:22:17 -06:00
Dan McGee
1a994bf180 Merge branch 'maint' 2011-11-07 09:16:10 -06:00
Allan McRae
e7b56f48d7 makepkg: handle pgp signatures with .sign extension
Detached sgnature files with extension .sign are accepted by gnupg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-07 09:14:09 -06:00
Dan McGee
601c808b8d Fix download progress rounding edge case
Allan's original message: Occasionally when the download rate showed
100.0 the output got messed up. This was caused by the rounding of a
number between 99.95 and 100.  Adjust the threshold to avoid this
rounding issue.

Dan: make this fix, but also show values between 0 and 9.995 with two
decimal places since we have the room.

Original-fix-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03 09:54:33 -05:00
Dan McGee
1953fe4368 Fix thinko in _alpm_strip_newline
The point of this early compare to NULL byte check was so we could bail
early and skip the strcmp() call. Given we weren't doing the check
right, this never exited early. Fix it to work as intended.

Noticed-by: Pepe Juárez <trulustapa@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 19:17:26 -05:00
Dan McGee
90477f156c libalpm/util: don't use sprintf to convert from bin to hex
This is a trivial operation that doesn't require calling a function over
and over- just do some math and indexing into a character array.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:27:31 -05:00
Dan McGee
8b3717ef0d Fix size reported in CALLOC allocation failure message
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:27:31 -05:00
Dan McGee
6df558177f Convert package and database archive reads to use file descriptors
This gives us a bit more control and over the archive reading process,
and a bit less is done behind the scenes. It also allows us to use
fstat() in preference to stat(), which should avoid some potential race
conditions.

Some reorganization is necessary to move the stat calls after the open()
calls. Error handling and cleanup in general is also improved, as we had
several potential memory and file handle leaks before in some error
paths.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:27:31 -05:00
Dan McGee
ed3cd75736 libalpm/util: use low-level I/O for copyfile and checksum routines
This removes an unnecessary level of buffering. We are not doing
line-based I/O here, so we can read in blocks of 8K at a time directly
from the file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:27:31 -05:00
Dan McGee
ba7a056d58 Add OPEN() and CLOSE() util macros
These wrap the normal open() and close() low-level I/O calls and ensure
EINTR is handled correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:27:31 -05:00
Dan McGee
a4ce3edf95 Merge branch 'maint' 2011-11-01 10:26:45 -05:00
Dave Reisner
d98ff04cc9 src/util: link vercmp against .lo, not the .o
This seems to fix FS#26652.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:25:15 -05:00
Dave Reisner
4c259d51f7 dload: remove redundant conditional
Replacing the strdup when after the first NULL check assures that we get
continue with payload->remote_name defined.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-27 17:49:09 -05:00
Dave Reisner
f4875fab9b dload: chmod tempfiles to respect umask
Dan: fix mask calculation, add it to the success/fail block instead.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-27 17:46:48 -05:00
Dan McGee
3343185473 Introduce ALPM_BUFFER_SIZE constant
This takes the place of three previously used constants:
ARCHIVE_DEFAULT_BYTES_PER_BLOCK, BUFFER_SIZE, and CPBUFSIZE.

In libarchive 3.0, the first constant will be no more, so we can ensure
we are forward-compatible by removing our usage of it now. The rest are
unified for consistency.

By default, we will use the value of BUFSIZ provided by <stdio.h>, which
is 8192 on Linux. If that is undefined, a default value is provided.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-27 14:59:24 -05:00
Dave Reisner
1052709921 paccache: add vim modeline
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-26 17:46:59 -05:00
Dave Reisner
24881034f6 paccache: ensure seen/seenarch vars are set
Doesn't do a whole lot of good to compare against values that are never
set. Fixes bug where -vvv output wasn't grouping packages together
properly.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-26 17:46:53 -05:00
Dan McGee
8a9ce12a27 Fix issues with replacing unowned symlinks
There aretwo seperate issues in the same block of file conflict
checking code here:
1) If realpath errored, such as when a symlink was broken, we would call
   'continue' rather than simply exit this particular method of
   resolution. This was likely just a copy-paste mistake as the previous
   resolving steps all use loops where continue makes sense. Refactor
   the check so we only proceed if realpath is successful, and continue
   with the rest of the checks either way.
2) The real problem this code was trying to solve was canonicalizing
   path component (e.g., directory) symlinks. The final component, if
   not a directory, should not be handled at all in this loop. Add a
   !S_ISLNK() condition to the loop so we only call this for real files.

There are few other small cleanups to the debug messages that I made
while debugging this problem- we don't need to keep printing the file
name, and ensure every block that sets resolved_conflict to true prints
a debug message so we know how it was resolved.

This fixes the expected failures from symlink010.py and symlink011.py,
while still ensuring the fix for fileconflict007.py works.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 17:32:46 -05:00
Dan McGee
5c1885b55e Add some unowned symlink replacement tests
These should all prevent installation, and yet two of the three tests
currently fail. Not good.

The best way to see what is going on here is to diff the three new tests
side by side- there is only a small difference between the three tests,
and that is in the destination of the symlink in question that should
never be overwritten.

  symlink010.py: myprogsuffix -> myprog
  symlink011.py: myprogsuffix -> broken
  symlink012.py: myprogsuffix -> otherprog

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 17:31:43 -05:00
Dan McGee
7a6b01d46c Don't realloc a 0-length files array when loading packages
There is some pecular behavior going on here when a package is loaded
that has no files, as is very common in our test suite. When we enter
the realloc/sort code, a package without files will call the following:

    files = realloc(NULL, 0);

One would assume this is a no-op, returning a NULL pointer, but that is
not the case and valgrind later reports we are leaking memory. Fix the
whole thing by skipping the reallocation and sort steps if the pointer
is NULL, as we have nothing to do.

Note that the package still gets marked as 'files loaded', becuase
although there were none, we tried and were successful.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 15:44:55 -05:00
Dan McGee
d5f0395dc1 libalpm/util: two stat() related cleanups
First, use fstat() in preference to stat() since we already have an open
file handle. This also removes the need to check for a symlink as that
is not possible when a file is opened.

Next, use archive_entry_mode() rather than archive_entry_stat() as we
only use the mode portion of the stat struct and the call is much
cheaper. Also delay it until it is necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26 14:55:50 -05:00
Dan McGee
a708e7d28e Merge branch 'maint' 2011-10-25 10:40:26 -05:00
Dave Reisner
2da59e1aa9 lib/sync: inform callers of compute_download_size of a partial
Extend the return values of compute_download_size to allow callers to
know that a .part file exists for the package.

This extra value isn't currently used, but it'll be needed later on.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 10:38:12 -05:00
Allan McRae
571f2f7814 Fix libtool detection of --as-needed flag
The fix for -Wl,--as-needed in commit b0f9477f assumes that
--as-needed/--no-as-needed is the only option given in a -Wl line.
However, it is perfectly valid to specify multiple flags comma
separated after a single -Wl (e.g. the default LDFLAGS in Arch
Linux makepkg.conf).

Adjust the fix so it detect --as-needed in a more general context

> readelf -d lib/libalpm/.libs/libalpm.so.?.?.? | grep NEEDED | wc -l
Before: 13
After: 5

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 10:37:30 -05:00
Allan McRae
0d9e7da309 Update libtool files
Update for libtool-2.4.2 while keeping the fix for --as-needed from
commit b0f9477f.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 10:37:21 -05:00
Dan McGee
5853025137 Add more logging to download code
This adds a logger to the CURLE_OK case so we can always know the return
code if it was >= 400, and debug log it regardless. Also adjust another
logger to use the cURL error message directly, as well as use fstat()
when we have an open file handle rather than stat().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-24 13:49:14 -05:00
Dan McGee
90ddcbe71d Merge branch 'maint'
Conflicts:
	src/pacman/package.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:47 -05:00
Dan McGee
33bb7dbd35 Hide empty columns in table package list display
On -R operations, the "New Version" column is always empty, taking up
space and not really showing the user anything valuable. The same is
true on -S or -U operations for the "Old Version" column when packages
are only being installed and not upgraded.

Remove this column so we get a few screen columns back, especially now
that we show repo/packagename style output. This also makes some
adjustment to the padding logic. We no longer include padding in column
widths but it is included in the total table width. We also ensure the
last displayed column is always right aligned, even if this is not the
actual rightmost column.

Example output, before:
    $ sudo pacman -R eclipse
    checking dependencies...

    Targets (1):

    Name     Old Version  New Version   Net Change

    eclipse  3.7-1                     -194.02 MiB

    Total Removed Size:     194.02 MiB

And after:
    $ sudo pacman -R eclipse
    checking dependencies...

    Targets (1):

    Name     Old Version   Net Change

    eclipse  3.7-1        -194.02 MiB

    Total Removed Size:     194.02 MiB

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:31 -05:00
Dave Reisner
32327dc8c9 pacman: show repo name in download prompt
This only applies to the VerbosePkgLists option. Lessens the
deficiencies created by earlier work to separate download records by
repository.

Satisfies FS#26334.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:31 -05:00
Dave Reisner
89edea326b sync: move file download loop out of download_files
Create a new static function called 'download_single_file' which
iterates over the servers for each payload.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:31 -05:00
Dave Reisner
d72487cc00 sync: check for necessary disk space for download
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-21 19:29:31 -05:00
Dan McGee
0b155677cf sync: extract build_payload() method from find_dl_candidates
This is done by both the delta and regular file code, so we can extract
a little helper method. Done mostly to satisfy my "why are we repeating
code here" itch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:31 -05:00
lolilolicon
d6e3446e70 bacman: pkgrel does not have to be an integer
pkgrel, as with pkgver, simply mustn't contain hyphens.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 12:31:24 -05:00
Dave Reisner
6f2faf16ba sync: dont group sync records by repository
Break out the logic of finding payloads into a separate static function
to avoid nesting mayhem. After gathering all the records, download them
all at once.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 11:12:00 -05:00
Dan McGee
20a47aba8e Remove remaining usages of fprintf() from frontend
These can either be replaced with pm_printf() if they are error related,
or in the fprintf(stdout, ...) case a bare printf() will do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:51:49 -05:00
Dan McGee
9e9ecf2183 Remove pm_fprintf() in favor of pm_printf()
Now that pm_printf() always prints to stderr, we don't need this second
function that was always used with stderr as the first argument. Thus,
this patch removes the function and makes the following sed replacement:

    sed -i -e 's#pm_fprintf(stderr, #pm_printf(#g' src/pacman/*.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:45:18 -05:00
Dan McGee
45f86ca1ca Use stderr as output stream for pm_printf()
This matches what we now do in our backend callback function- all
debug/info/warning/error/etc. messages should be on stderr. These are
all the messages with a "warning:" or other type prefix, so does not
affect general pacman output.

This should fix the output confusion noted in FS#26555.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:38:02 -05:00
Dan McGee
e47eb9a777 base64: don't compile base64_encode() function
We don't use this anywhere; "comment" it out so we still remain
relatively close to the upstream sources.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 12:03:02 -05:00
Dan McGee
4bada45464 pacman-key: add a default keyserver timeout value on --init
The default is supposidely 30 seconds from the gpg manpage, but that
sure wasn't what I was seeing- it was somewhere closer to two minutes of
silence. Add a more reasonable 10 second timeout value which should be
good enough for any keyserver that doesn't totally stink at it's job.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 09:42:46 -05:00
Dan McGee
bac670ddc9 Show an error message on failed remote key lookup
The absolutely terrible part about this is the failure on GPGME's part
to distinguish between "key not found" and "keyserver timeout". Instead,
it returns the same silly GPG_ERR_EOF in both cases (why isn't
GPG_ERR_TIMEOUT being used?), leaving us helpless to tell them apart.

Spit out a generic enough error message that covers both cases;
unfortunately we can't provide much guidance to the user because we
aren't sure what actually happened.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 09:38:35 -05:00
Dave Reisner
b633985e60 dload: add pointer to server list for each payload
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 08:40:20 -05:00
Dave Reisner
758d3403cd diskspace: create static function mount_point_list_free
This logic is reused in both diskspace and downloadspace check
functions, so pull it out into its own static method.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 08:39:09 -05:00
Dave Reisner
6e29f02e94 diskspace: add _alpm_check_downloadspace()
This function determines if the given cachedir has at least the given
amount of free space on it. This will be later used in the sync code to
preemptively halt downloads.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 08:39:04 -05:00
Dan McGee
842c4422ed Table display: print message with warning: prefix
Use the normal error functions here rather than a bare fprintf().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 08:28:57 -05:00
Dan McGee
ae25167bcd Large performance improvement for check for owned directories
We can take a large shortcut here that saves us a lot of time,
especially when upgrading packages with lots of directories. Obviously
iterating the full file list of every single package to determine if
this directory was present in any other package can take quite some time
on a system with many packages installed. We don't need to remove a
directory at all if we are upgrading a package and the version we are
moving to still had the directory.

Also make a small optimization on the package comparsion- we really only
care about equality here, not the result of the compare, so we can
shortcut using our name_hash.

What kind of benefit does this give us? Oh, only a reduction from 295.7
million to 1.4 million strcmp() calls (99.5% fewer) during a
`pacman -S linux libreoffice-common` operation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 14:58:12 -05:00
Dan McGee
bf84dc4cf1 Make _alpm_filelist_contains() NULL-safe
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 14:50:27 -05:00
Dan McGee
a33424f879 Merge branch 'maint' 2011-10-14 08:16:18 -05:00
Dan McGee
020bdb4298 makepkg: don't attach traps until after argument parsing
Nothing we do in our traps is necessary this early in the script. This
fixes FS#26196.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:16:06 -05:00
Dan McGee
dbd54c0cb9 Use fputs and putchar in callback progress display
When we have fixed strings or output, printf overhead is unnecessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:14:44 -05:00
Dan McGee
0d2600c575 Remove -f short option for --force
This is not something that should be used on a frequent basis, and
giving it a short option encourages use without making the drawbacks
obvious. For the 1% of situations that require it, the 5 extra
keystrokes are a fair price to pay.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:13:38 -05:00
Dan McGee
185cbb8a44 Add missing #ifdef around cURL error code in download struct
Thanks to Eduardo Tongson on the mailing list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 07:38:58 -05:00
Dan McGee
8605284e0d Use puts() instead of no-op printf() where applicable
This replaces several printf calls of the following styles:
   printf("%s", ...);
   printf("some fixed string");
   printf("x");

We can use either fputs() or putchar() here to do the same thing
without incurring the overhead of the printf format parser.

The biggest gain here comes when we are calling the print function in a
loop repeatedly; notably when printing local package files.

    $ /usr/bin/time ./pacman-before -Ql | md5sum
      0.25user 0.04system 0:00.30elapsed 98%CPU
    $ /usr/bin/time ./pacman-after -Ql | md5sum
      0.17user 0.06system 0:00.25elapsed 94%CPU

    $ /usr/bin/time ./pacman-before -Qlq | md5sum
      0.20user 0.05system 0:00.26elapsed 98%CPU
    $ /usr/bin/time ./pacman-after -Qlq | md5sum
      0.15user 0.05system 0:00.23elapsed 93%CPU

So '-Ql' shows a 17% improvement while '-Qlq' shows a 13% improvement on
382456 total files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 20:59:16 -05:00
Dan McGee
9934052b54 Remove mcheck.h support
When was the last time anyone used this? That's what I thought.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 20:49:24 -05:00
Dan McGee
53e525c4f3 Fix some strict 32-bit gcc warnings
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 16:25:21 -05:00
Dan McGee
5b5b250443 Coding style cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 15:16:59 -05:00
Dan McGee
86bc36412e curl_gethost() potential bug fixups
This is in the realm of "probably not going to happen", but if someone
were to translate "disk" to a string longer than 256 characters, we
would have a smashed/corrupted stack due to our unchecked strcpy() call.
Rework the function to always length-check the value we copy into the
hostname buffer, and do it with memcpy rather than the more cumbersome
and unnecessary snprintf.

Finally, move the magic 256 value into a constant and pass it into the
function which is going to get inlined anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 15:16:10 -05:00
Dan McGee
1ebe5dc197 doc/index.txt: Reformat past releases chart
This makes it a three-column deal with releases all the way back to 1.0.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 14:54:49 -05:00
Dan McGee
43cad9c871 doc: update .gitignore, add CSS override for new tables usage
* Make all docs depend on Makefile; if we change flags here we want them
  rebuilt.
* Add explicit filenames to .gitignore so we can add our own CSS
  override file, and add an asciidoc-override.css resource.
* Adjust a few asciidoc options when generating HTML.
* Remove asciidoc-manpage.css; apparantly this doesn't exist anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 14:53:52 -05:00
Dan McGee
ff87046354 Merge branch 'maint'
Conflicts:
	src/pacman/util.c
2011-10-13 11:25:50 -05:00
Dan McGee
04fd320e97 Update NEWS for missing 4.0 stuff and 4.0.1 changes so far
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:22:50 -05:00
Lukas Fleischer
35e6136f4b scripts/*.sh.in: Honor TMPDIR environment variable
Replace "/tmp" with "${TMPDIR:-/tmp}" to allow for overriding the
hardcoded path.

Since we only use "/tmp" in conjunction with mktemp(1), we could also
have used "--tmpdir", which is GNU-ish, however (and the BSD counterpart
"-t" has been deprecated in GNU mktemp).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:21:05 -05:00
Lukas Fleischer
241946ccea scripts/*.sh.in: Fix signal handler error messages
This includes some fixes to the messages that are displayed when a
signal is caught in makepkg or repo-add:

* Instead of always showing "==> ERROR: TERM signal caught. Exiting...",
  replace "TERM" by whatever signal is actually caught.

* Fix a typo in the SIGERR error message in repo-add ("occurred" instead
  of "occured"). Francois already fixed this for makepkg in 1e51b81c.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:20:12 -05:00
Lukas Fleischer
d4c97ea2f6 repo-add: Avoid race condition in signal handlers
There is a small chance that a user sends SIGINT (or any other signal
that is trapped) when we're already in clean_up() which used to lead to
trap_exit() being executed and the remaining code in clean_up() being
skipped due to the bash signal/trap handler blocking EXIT (since its
handler is already being executed, even if it's interrupted).

In practice, this behaviour caused unexpected results (primarily because
pressing ^C at the wrong time left a lock file behind):

    $ ./repo-add extra.db.tar.gz foobar
    ==> Extracting database to a temporary location...
    ^C
    ==> ERROR: Aborted by user! Exiting...
    $ ./repo-add extra.db.tar.gz foobar
    ==> Extracting database to a temporary location...
    ==> ERROR: File 'foobar' not found.
    ==> No packages modified, nothing to do.
    ^C
    ==> ERROR: Aborted by user! Exiting...
    $ ./repo-add extra.db.tar.gz foobar
    ==> ERROR: Failed to acquire lockfile: extra.db.tar.gz.lck.
    ==> ERROR: Held by process 18522

Fix this and reduce the chance of race conditions in signal handlers by:

* Unhooking all traps in both clean_up() and trap_exit().

* Call clean_up() explicitly in trap_exit() to make sure we remove the
  lock file and the temporary directory even if we send SIGINT when
  clean_up() is already being executed but didn't reach the unhook code
  yet.

Also, add an optional parameter to clean_up() to allow for setting an
explicit exit code when we call clean_up() from trap_exit().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:20:03 -05:00
Dan McGee
12642a299b Add user-visible warning message if public keyring not found
This should help point users in the right direction if they have not
initialized via pacman-key just yet.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 17:54:08 -05:00
Dan McGee
6be492d2f7 Remove alpm_list_getdata wrapper function
This one is pretty darn useless. Just derefence the ->data attribute
since the type is public anyway and save yourself the function call.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:22:49 -05:00
Dan McGee
1b7d2b0cfa diskspace: extract check_mountpoint() function
This will be useful when extending disk space checks to free space
checking before we download package files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:22:49 -05:00
Dan McGee
a27bdcfe51 _alpm_archive_fgets: optimize EOL search
Instead of iterating character by character, use memchr() calls to
hopefully speed up the search. A newline is the most likely culprit, so
search for that first followed by a NULL byte if there was no newline in
the buffer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:22:48 -05:00
Dan McGee
2a18171afa signing: delay gpgme_init() until latest possible moment
In the default configuration, we can enter the signing code but still
have nothing to do with GPGME- for example, if database signatures are
optional but none are present. Delay initialization of GPGME until we
know there is a signature file present or we were passed base64-encoded
data.

This also makes debugging with valgrind a lot easier as you don't have
to deal with all the GPGME error noise because their code leaks like a
sieve.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:20:47 -05:00
Dan McGee
61c6ae01b3 VerbosePkgLists: format table lines in i18n-compatible way
This had the unfortunate implementation detail that depended on the
strings having 1 byte == 1 column hold true. As we know, this is not at
all the case once you move past the base ASCII character set.

Reimplement this whole thing so it doesn't depend on format strings at
all. Instead, simply calculate the max column widths, and then when
displaying each row add the correct amount of padding using UTF-8 safe
string length functions.

Before:

名字        旧版本新版本  净变化 下载大小

libgee                0.6.2.1-1  0.60 MiB    0.10 MiB
libsocialweb          0.25.19-2  1.92 MiB    0.23 MiB
folks                 0.6.3.2-1  1.38 MiB    0.25 MiB

After:

名字          旧版本  新版本     净变化    下载大小

libgee                0.6.2.1-1  0.60 MiB  0.10 MiB
libsocialweb          0.25.19-2  1.92 MiB  0.23 MiB
folks                 0.6.3.2-1  1.38 MiB  0.25 MiB

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:18:38 -05:00
Dan McGee
89fe19f3e1 Convert MALLOC to actually call malloc()
If you need zero-filled allocations, call CALLOC() instead.

This was from the original definition of these macros in commit
cc754bc6e3be0f3; hopefully our code is in the shape it needs to be to
switch this behavior.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:01:25 -05:00
Dan McGee
980b3faea5 Move infrequently used path variables off the stack
These backup-related paths in package extraction are used on relatively
few files during the install process, so bump them off the stack and
into the heap. This removes the artificial PATH_MAX limitation on their
length as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:01:25 -05:00
Dan McGee
027a8a3260 Extract a try_rename helper from extract_single_file()
This moves the repetitive (and highly unlikely) logging work to a
single location.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:01:25 -05:00
Dan McGee
5f3629bea0 Introduce alpm_time_t type
This will always be a 64-bit signed integer rather than the variable length
time_t type. Dates beyond 2038 should be fully supported in the library; the
frontend still lags behind because 32-bit platforms provide no localtime64()
or equivalent function to convert from an epoch value to a broken down time
structure.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:01:25 -05:00
Dan McGee
759f435fb9 _alpm_parsedate: use strtoll() to parse numeric value
This prepares the function to handle values past year 2038. The return type
is still limited to 32-bits on 32-bit systems; this will be adjusted in a
future patch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:01:25 -05:00
Dan McGee
d3d3b861ac Bump version to 4.0.0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 13:52:21 -05:00
Dan McGee
a0d0f3f47f Final Transifex update before 4.0
We have a few incomplete translations, but these should be addressable
before the 4.0.1 maint release that is surely not that far in the
future.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 13:42:12 -05:00
Dan McGee
e1ae3a6038 pactest: add a better description
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 12:33:14 -05:00
Dan McGee
0c1a0a6d87 Add note to TRANSLATORS regarding Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 10:07:27 -05:00
Dan McGee
5a39172835 pacman-key: don't escape single quote in usage message
This screws up gettext and causes the message to display always
untranslated.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 09:07:20 -05:00
Allan McRae
d9c0a08e6d Document verifying source file signatures in makepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 09:07:20 -05:00
Allan McRae
8ac7cf6b1b Fix typo in PKGBUILD man page
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 09:07:20 -05:00
lolilolicon
4de3d9092e PKGBUILD.vim: fix epoch syntax highlighting
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 09:07:20 -05:00
Dan McGee
8cc4ed0d63 Update translations from Transifex
In prep for the 4.0.0 release.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 09:07:19 -05:00
Dave Reisner
abfa8370c0 dload: unhook error buffer after transfer finishes
Similar to what we did in edd9ed6a, disconnect the relationship with our
stack allocated error buffer from the curl handle. Just as an FTP
connection might have some network chatter on teardown causing the
progress callback to be triggered, we might also hit an error condition
that causes curl to write to our (now out of scope) error buffer.

I'm unable to reproduce FS#26327, but I have a suspicion that this
should fix it.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10 19:09:59 -05:00
Lukas Fleischer
8f414cd040 pactree: Make error message smarter in register_syncs()
Our error message used to be very unclear when the configuration file
could not be found:

    $ ./pactree -lsr gtk
    error: failed to register sync DBs

Instead, display an accurate message and include the file name:

    $ ./pactree -lsr gtk
    error: config file /usr/local/etc/pacman.conf could not be read

Also, move the error message inside register_syncs() to allow for
differentiating between different errors that might require a handler in
the future.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10 19:09:18 -05:00
Lukas Fleischer
fb401f569e pactree: Add "--config" option
This allows for specifying an alternate configuration file path, similar
to pacman's "--config" option.

Given that there is currently no other way to tell pactree to read from
another configuration file (except for patching or symlinking), this
seems totally sensible - even if there are plans to refactor and/or
replace the standalone configuration file parser.

We do not define a short option for the sake of consistency with
pacman's set of command line options.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10 19:09:12 -05:00
Allan McRae
36f31dd133 makepkg: strip comments after pkgver/pkgrel when checking value
Inline comments after pkgver or pkgrel would cause the sanity
checks to fail so remove them before checking the value.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10 19:05:22 -05:00
Allan McRae
cc13f47532 Format pacsort and vercmp testsuite output
Make the output into a single block and add separators at the end
so that they do not merge into each other.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-07 09:21:58 -05:00
Dan McGee
9168977b3b Update NEWS for 4.0.0 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-06 02:13:41 -05:00
lolilolicon
22abe27bfa bacman: use globbing to get local package db path
The original code- pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)" is
problematic in several ways:

 - $pac_db and $pkg_name should be quoted, obviously.
 - It assumes pkgver always starts with an integer, while in fact
   it just can't contain ':' and '-'.
   Counterexample: the code breaks on lshw B.02.15-1.
 - It assumes there are no more than one directory matching the
   pattern.  While this should be the case if everything works
   perfectly, it certainly relies on external conditions.
   Counterexample: if the local db contains two packages named
   foo and foo-3g, even if everything else is perfect, the code
   will match two directories.

Don't make assumptions, use what is known.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06 02:10:25 -05:00
lolilolicon
4928f9edc3 bacman: add tar.Z package creation support
bacman should support whatever makepkg does as PKGEXT.
Also remove obsolete $EXT variable.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06 02:10:25 -05:00
lolilolicon
273cc66a8a bacman: small code cleanup
This includes:
 - Quoting fixes.
 - Drop deprecated mktemp option -p.
 - Set extglob nullglob shell options at the top.
 - Use extended globbing instead of regex to match %HEADER% in pacman db.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06 02:10:25 -05:00
lolilolicon
7e5bbf0387 bacman: bashify using [[ ]] and (( ))
Another style change.  The [[ expression ]] form is particularly
cleaner, safer and more powerful than the [ expression ] form.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06 02:10:24 -05:00
lolilolicon
3f937c8404 bacman: indent code using TAB
As every piece of code in the whole project uses TAB as indentation
character, bacman shouldn't be an exception.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06 02:10:24 -05:00
Dan McGee
524847145d Enable CheckSpace by default in default config file
This will have to be picked up downstream of course, but addresses
FS#25684 now that this is a lot faster in 4.0 than it was in the
original 3.5 implementation.

Also make curl the first XferCommand listed, as we are moving away from
any other download program at this point.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05 23:44:11 -05:00
Dan McGee
a8ca9b93f8 Update translation message catalogs in prep for 4.0 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05 22:39:05 -05:00
Dan McGee
2df519f807 Add a top-level 'update-po' make target
This makes the maintainer's life (read: my life) a lot easier when
updating translation files to push to Transifex.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05 22:36:34 -05:00
Dan McGee
dc7d691b20 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05 22:30:14 -05:00
Dan McGee
484d5ec624 pacman-key: treat foo-trusted as an ownertrust export file
This allows it to serve double-duty. In order to allow users to base
verification decisions off of both a valid signature and a trusted
signature, we need to assign some level of owner trust to the keys we
designate as trusted on import.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05 22:00:52 -05:00
Dan McGee
ab7d2890a4 pacman-key: refine and clarify import/import-trustdb behavior
* --import now only imports keys from pubkey.gpg and does not import
  owner trust; if you want to have both simply run the operations in
  sequence.
* --import-trustdb has been simplified; it will overwrite existing
  values in the trust database as before, but there is no need to export
  it first as those values are safe if left untouched.
* Fix the manpage referring to a non-existent option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05 21:55:53 -05:00
Dan McGee
cf0edb92ba Parse '0' as a valid package installed size
This was a bad oversight on my part, pointed out by Jakob. Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-04 15:31:17 -05:00
lolilolicon
94bc64ae1b makepkg: create tar file for bogus PKGEXT
If PKGEXT is not one of the recognized tar*'s, create_package() would
create an empty package file and fail, since bsdtar on the left side of
the pipe returns 141 on SIGPIPE (broken pipe).

This patch changes the behavior for an invalid PKGEXT. A warning is
printed on stderr, and a tar file is created. Also retire the obsolete
$EXT variable.

Add the obligatory comment why we don't use bsdtar's compression.
Finally, fix mixed-tab-space indentation.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-10-03 10:59:10 -05:00
Dan McGee
c4d6688694 Use _alpm_local_db_pkgpath in _cache_changelog_open
Another place where we were doing the dirty work by hand.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 11:08:49 -05:00
lolilolicon
b0543440ca makepkg: support .tar.Z source packages creation
SRCEXT should allow whatever PKGEXT does.
Also address an uninitialized use of $ret.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-30 10:57:44 -05:00
Dan McGee
39b0ac43fc Revamp scriptlet path formation for scriptlets in local database
Expose the current static get_pkgpath() function internally to the rest
of the library as _alpm_local_db_pkgpath(). This allows use of this
convenience function in add.c and remove.c when forming the path to the
scriptlet location.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 10:55:58 -05:00
Dan McGee
73139ccb3c Refactor _alpm_runscriptlet()
Add an is_archive parameter to reduce the amount of black magic going
on. Rework to use fewer PATH_MAX sized local variables, and simplify
some of the logic where appropriate in both this function and in the
callers where duplicate calls can be replaced by some conditional
parameter code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 10:55:58 -05:00
lolilolicon
6bb5948025 paccache: proper quoting in [[ expression ]]
Always quote the right-hand side of expression when the == or != operator
is used, unless intended as a pattern.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-30 10:48:49 -05:00
lolilolicon
e0400fff96 paccache: declare variables explicitly
Declare and initialize integer variables 'needsroot' and 'verbose'.
Don't use the fact that (( undefined_variable )) evaluates to 0.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-30 10:48:43 -05:00
Dave Reisner
938fb2c878 pacman-key: remove errexit flag from shebang
We're ill equipped to be using this flag as we don't trap and respond to
the ERR signal. The result is that if is ever tripped, pacman-key will
instantly exit with no indication of why. At the same time, we're
already fairly good about doing our own error checking and verbalizing
it before dying.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 10:48:28 -05:00
Allan McRae
07ecd40a1a pacman-key: return 0 from get_from if default value used
This prevents the error trap being set off when GPGDir is commented
in pacman.conf.  Bug introduced in 507b01b9.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 10:48:19 -05:00
Allan McRae
6dfb9d35f8 Remove redundant transaction size output
Printing all of "Installed", "Removed" and "Net Upgrade" sizes is
redundant as the difference of the first two is the last. Instead,
only print "Installed Size" and "Net Upgrade Size" when both the
installed and removed are non-zero.

This results in the following output in the following cases:
 - package installation only: Installed Size
 - package removal only: Removed Size
 - package installation involving replacement: Installed + Net Upgrade Size
 - package upgrade: Installed + Net Upgrade Size
 - combination upgrade and installation: Installed + Net Upgrade Size

Download Size remains outputted whenever something is downloaded.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 10:48:01 -05:00
lolilolicon
83c05e71bc paccache: allow strictly integer for -k option
Verify the argument to -k is a non-negative integer.  Leading zeros
are simply stripped.

'declare -i keep' allowed the argument to -k to be any arithmetic
evaluation expression.  The simple assignment 'keep=$OPTARG' triggers
arithmetic evaluation implicitly, which can either consume a huge amount
of resources with input such as '2**2**32' or immediately produce an error
on invalid input.  Instead, we simply 'declare -- keep' and avoid all that.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-29 13:02:41 -05:00
Allan McRae
1463a9aa36 Remove redundant "removal" output in pure remove operation
Printing "[removal]" beside all package names is redundant when all
packages are being removed (i.e. when using -R).

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-09-29 13:02:02 -05:00
Dave Reisner
ad8d3ceb89 move prevprogress onto payload handle
This is a poor place for it, and it will likely move again in the
future, but it's better to have it here than as a static variable.

Initialization of this variable is now no longer necessary as its
zeroed on creation of the payload struct.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-29 12:58:37 -05:00
lolilolicon
775b94e649 pkgdelta: proper quoting in [[ expression ]]
Always quote the right-hand side of expression when the == or != operator
is used, unless intended as a pattern.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-28 14:09:01 -05:00
lolilolicon
497501d1c7 makepkg: proper quoting in [[ expression ]]
Always quote the righthand side of expression when the == or != operator
is used, unless intended as a pattern.  Quoting bash(1):

When the == and != operators are used, the string to the right of the
operator is considered a pattern.  Any part of the pattern may be quoted
to force it to be matched as a string.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-28 13:06:03 -05:00
Dan McGee
d1af9b70c8 Refactor display_targets to not be recursive
This also fixes a memory leak and makes the dual-purpose "rows" variable
go away in favor of storing the rows and non-verbose names separately.

This also fixes some potential memory leaks and/or wrong behavior due to
the config->verbosepkglists flag being flipped, which we should never be
doing.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 13:01:03 -05:00
Dan McGee
e0acf2f144 Refactor download payload reset and free
This was done to squash a memory leak in the sync database download
code. When we downloaded a database and then reused the payload struct,
we could find ourselves calling get_fullpath() for the signatures and
overwriting non-freed values we had left over from the database
download.

Refactor the payload_free function into a payload_reset function that we
can call that does NOT free the payload itself, so we can reuse payload
structs. This also allows us to move the payload to the stack in some
call paths, relieving us of the need to alloc space.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 13:01:03 -05:00
Dan McGee
9a58d5c6c5 Initialize cURL library on first use
Rather than always initializing it on any handle creation. There are
several frontend operations (search, info, etc.) that never need the
download code, so spending time initializing this every single time is a
bit silly. This makes it a bit more like the GPGME code init path.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 13:01:03 -05:00
Dan McGee
83f99bfb39 Add more valgrind suppressions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 13:01:03 -05:00
Dan McGee
a8ed39ce05 verbose package lists: remove errant debugger
Left this in as part of the last set of commits, whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 10:26:53 -05:00
Dan McGee
6f3a657f66 Always show download size if -w/--downloadonly was provided
The prompt can be rather confusing otherwise when all files have already
been downloaded, but there is not a single total size listed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 10:18:42 -05:00
Dan McGee
bcc6a5d72d Table format creation code cleanup
Better scoping of variables for the most part, and ensure we are using
string_length() and not strlen() as appropriate. Also refactor the
longest cell code to call string_length() a lot less; by simply using an
array of max sizes we don't have to recompute values nearly as much.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 10:17:15 -05:00
Dan McGee
1b8bb7c1cd Use unsigned types for indent width and column count
For getcols(), the functions we call return a value of type 'unsigned
short', so it makes sense for us to do the same.

string_length() is meant to behave like strlen(), so it should return
type size_t. This exposes other functions such as indentprint() which
should also be using signed return types.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 09:48:08 -05:00
Dan McGee
f682cbd433 Show download sizes when using -S/--sync
We now label the old 'Size' column as 'Net Change' to reflect the
reality of what we are looking at. Sync operations now get an additional
'Download Size' column.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:52:37 -05:00
Dan McGee
7edeb276b6 Keep track of explicitly added and removed packages
This allows us to sort the output list by showing all pulled
dependencies first, followed by the explicitly specified targets.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:52:37 -05:00
Dan McGee
bd83c8e756 Combine add and removal package list display
There was no real reason for these to be done separately.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:52:37 -05:00
Dan McGee
40a264478e Track unresolvable transaction packages
Rather than free them right away, keep the list on the transaction as
we already do with add and remove lists. This is necessary because we
may be manipulating pointers the frontend needs to refer to packages,
and we are breaking our contract as stated in the alpm_add_pkg()
documentation of only freeing packages at the end of a transaction.

This fixes an issue found when refactoring the package list display
code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:52:37 -05:00
Dan McGee
6e081a0c57 Move pacsave path construction code off the stack
This is definitely not in the normal hot path, so we can afford to do
some temporary heap allocation here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:48:53 -05:00
Dan McGee
98e0371ae3 Use the full buffer when computing md5/sha256 sums
No wonder these were slower than expected. We were only reading 4
(32-bit) or 8 (64-bit) bytes at a time and feeding it to the hash
functions. Define a buffer size constant and use it correctly so we feed
8K at a time into the hashing algorithm.

This cut one larger `-Sw --noconfirm` operation, with nothing to
actually download so only timing integrity, from 3.3s to 1.7s.

This has been broken since the original commit eba521913d introducing
OpenSSL usage for crypto hash functions. Boy do I feel stupid.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:48:42 -05:00
Dan McGee
f66f9f11cd Fix memory leak in download payload->remote_name
In the sync code, we explicitly allocated a string for this field, while
in the dload code itself it was filled in with a pointer to another
string. This led to a memory leak in the sync download case.

Make remote_name non-const and always explicitly allocate it. This patch
ensures this as well as uses malloc + snprintf (rather than calloc) in
several codepaths, and eliminates the only use of PATH_MAX in the
download code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:48:33 -05:00
Dan McGee
ea3c47825e Revert "libalpm: compare pkgname with strcoll"
This commit was made with the intent of displaying "correctly" sorted
package lists to users. Here are some reasons I think this is incorrect:

* It is done in the wrong place. If a frontend application wants to show
  a different order of packages dependent on locale, it should do that
  on its own.
* Even if one wants a locale-specific order, almost all package names
  are all ASCII and language agnostic, so this different comparison
  makes little sense and may serve only to confuse people.
* _alpm_pkg_cmp was unlike any other comparator function. None of the
  rest had any dependency on anything but the content of the structs
  being compared (e.g., they only used strcmp() or other basic
  comparison operators).

This reverts commit 3e4d2c3aa6.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 20:24:04 -05:00
Dan McGee
69962184bb _alpm_splitdep: use malloc instead of calloc
There was only one simple to handle case where we left a field
uninitialized; set it to NULL and use malloc() instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 17:52:38 -05:00
Dan McGee
d8fab9b441 be_sync: fetch only entry mode, not full stat struct
This saves a lot of unnecessary work since we don't need any of the
other fields in the stat struct.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 17:49:34 -05:00
Dan McGee
bf56fb6eb8 alpm_list: use malloc instead of calloc
In every case we were calling calloc, the struct we allocated (or the
memory to be used) is fully specified later in the method.

For alpm_list_t allocations, we always set all of data, next, and prev.

For list copying and transforming to an array, we always copy the entire
data element, so no need to zero it first.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 17:49:27 -05:00
Dave Reisner
619c3629ca makepkg: ensure '-' is last in a character glob
If '-' isn't the last item, it's interpreted as a range and not
literally, causing problematic behavior in parsing optdepends.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27 11:35:17 -04:00
Dan McGee
e70d540501 pacman-key: use consistent punctuation in error messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 09:17:11 -05:00
Dan McGee
fa929e8258 Fix compilation using --without-gpgme
I'm really good at breaking this on a regular basis. If only we had some
sort of automated testing for this...

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 09:15:36 -05:00
Dan McGee
b242b2d050 Remove unnecessary logger
This is just a wrapper function; the real function we call logs an
almost identical line.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 09:08:01 -05:00
Dan McGee
47657107af Delay check for repository servers until we need them
In the sync download code, we added an early check in 6731d0a940 for
sync download server existence so we wouldn't show the same error over
and over for each file to be downloaded. Move this check into the
download block so we only run it if there are actually files that need
to be downloaded for this repository.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27 07:53:38 -05:00
Allan McRae
5e13b2b6af Avoid comparison between signed and unsigned types
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 23:04:09 -05:00
Dan McGee
80b0f27125 Ensure fileconflict value is actually a string
When we switched to a file object and not just a simple string, we missed an
update along the way here in target-target conflicts. This patch looks
large, but it really comes down to one errant (char *) cast before that has
been reworked to explicitly point to the alpm_file_t object. The rest is
simply code cleanup.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 17:36:29 -05:00
Dave Reisner
d1fc3aec4c bash_completion: add completion for pacman-key
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Dave Reisner
507b01b912 pacman-key: allow get_from to return a default value
Keep the non-zero return val to let the caller know that the key wasn't
found.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Dave Reisner
b6ccae2d18 pacman-key: simplify writing to config file
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Allan McRae
dd82b8d09f makepkg: normalize whitespace for optdepends in .PKGINFO
Many PKGBUILDs use formatting whitespace when specifying optdepends.
This is removed when adding a package to a repo-database so the
output of "pacman -Si <package>" and "pacman -Qip <package file>"
becomes inconsistent.  Instead, do the adjustment when creating
the .PKGINFO file.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Allan McRae
6adf502f0d makepkg: allow versioned optdepends with epoch
Allow the specification of versioned optdepends with an epoch.
This also (partially) enforces a whitespace between ":" and the
description which is required for the future optdepends parsing
code.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Dan McGee
d26d50e664 Revamp pacman signal handler
* All errors now go to stderr, so do the same here and simplify the
  writing of the error message.
* Add SIGHUP to the handled signal list, and don't repeat code.
* Attempt to release the transaction (e.g. remove the lock file)
  for all of HUP, INT, and TERM. Signals HUP and INT respects
  transaction state, TERM will immediately terminate the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:12 -05:00
Dan McGee
2517ba3303 Update Doxyfile and fix some documentation errors caught by Doxygen
A few parameters were outdated or wrongly named, and a few things were
explicitly linked that Doxygen wasn't able to resolve.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 16:37:36 -05:00
Dan McGee
c406949226 Ensure database validity flags are set in invalid signature case
We returned the right error code but never set the flags accordingly.
Also, now that we can bail early, ensure we set the error code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 16:01:11 -05:00
Dan McGee
1e0ed133f4 Handle key import errors correctly and with good error messages
This adds calls to gpgme_op_import_result() which we were not looking at
before to ensure the key was actually imported. Additionally, we do some
preemptive checks to ensure the keyring is even writable if we are going
to prompt the user to add things to it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 16:01:10 -05:00
Dan McGee
907e8af5be signing: be consistent with returning -1 for error cases
This also fixes a segfault found by dave when key_search is
unsuccessful; the key_search return code documentation has also been
updated to reflect reality.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 16:01:05 -05:00
Dan McGee
f1beb050a3 Update configure.ac version to rc2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 12:08:35 -05:00
Dan McGee
43787d0067 Regenerate message catalogs and translations
We've had a bit of churn since the last time this was done.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:36:09 -05:00
Dan McGee
a78e3e3a23 Translation file updates from Transifex
Pick up any updates before I push new source messages out to the
service.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:35:31 -05:00
Dan McGee
1df9b2aa79 pacman-key: add an additional plain text 'foo-trusted' file
This is similar to the 'foo-revoked' file we had. This will be used to
inform the user what keys in the shipped keyring need to be explicitly
trusted by the user.

A distro such as Arch will likely have 3-4 master keys listed in this
trusted file, but an additional 25 developer keys present in the keyring
that the user shouldn't have to directly sign.

We use this list to prompt the user to sign the keys locally. If the key
is already signed locally gpg will print a bit of junk but will continue
without pestering the user.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:15:45 -05:00
Dan McGee
067721cbff pacman-key: factor out validate_with_gpg() method
This was copy-pasted code for the most part once the filename was
factored out.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:15:45 -05:00
Dan McGee
33685b960d pacman-key: remove holdkeys functionality
We're putting the cart ahead of the horse a bit here. Given that our
keyring is not one where everything is implicitly trusted (ala gpgv),
keeping or deleting a key has no bearing on its trusted status, only
whether we can actually verify things signed by said key.

If we need to address this down the road, we can find a solution that
works for the problem at hand rather than trying to solve it now before
signing is even widespread.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:15:45 -05:00
Dan McGee
595e1a437f pacman-key: implement promptless lsigning
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:15:45 -05:00
Dan McGee
7d961c849b pacman-key: disable, don't remove, revoked keys
Unlike our protégé apt-key, removing a key from our keyring is not
sufficient to prevent it from being trusted or used for verification. We
are better off flagging it as disabled and leaving it in the keyring so
it cannot be reimported or fetched at a later date from a keyserver and
continue to be used.

Implement the logic to disable the key instead of delete it, figuring
out --command-fd in the process.

Note that the surefire way to disable a key involves including said key
in the keyring package, such that it is both in foobar.gpg and
foobar-revoked.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:15:39 -05:00
Dan McGee
6767de5380 Add status and check for key being disabled
Because we aren't using gpgv and a dedicated keyring that is known to be
all safe, we should honor this flag being set on a given key in the
keyring to know to not honor it. This prevents a key from being
reimported that a user does not want to be used- instead of deleting,
one should mark it as disabled.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:35 -05:00
Dan McGee
213950afa3 pacman-key: simplify import in populate
This finishes the cleanup started in 710e83999b. We can do a straight
import from another keyring rather than all the funky parsing and piping
business we were doing.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:35 -05:00
Dan McGee
491b656c54 pacman-key: don't hide --verify details in populate
Otherwise we're hiding extremely relevant bits like this one:
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg:          There is no indication that the signature belongs to the owner.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:35 -05:00
Dan McGee
03e1b4caa9 pacman-key: print message in populate if signature is missing
Rather than saying it was invalid, tell the user no signature exists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:35 -05:00
Dan McGee
a7691ba6fd pacman-key: clean up populate output
* Ensure usage message is indented correctly
* Show short filenames for both the gpg keyring and revocation file

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:35 -05:00
Dan McGee
4b6a5ae159 pacman-key: ensure array iterations are quoted
When doing something like `pacman-key --edit-key 'Dan McGee'`, one would
expect it to work, and not fail.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:34 -05:00
Dan McGee
765178c5ba Implement PGP key search and import
Add two new static methods, key_search() and key_import(), to our
growing list of signing code.

If we come across a key we do not have, attempt to look it up remotely
and ask the user if they wish to import said key. If they do, flag the
validation process as a potential 'retry', meaning it might succeed the
next time it is ran.

These depend on you having a 'keyserver hkp://foo.example.com' line in
your gpg.conf file in your gnupg home directory to function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:14:31 -05:00
Dan McGee
0ef7129a4a signing: document most undocumented functions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 11:06:03 -05:00
Dan McGee
4849a4596d Add _alpm_process_siglist() logic to failed package validation
This moves the result processing out of the validation check loop itself
and into a new loop. Errors will be presented to the user one-by-one
after we fully complete the validation loop, so they no longer overlap
the progress bar.

Unlike the database validation, we may have several errors to process in
sequence here, so we use a function-scoped struct to track all the
necessary information between seeing an error and asking the user about
it.

The older prompt_to_delete() callback logic is still kept, but only for
checksum failures. It is debatable whether we should do this at all or
just delegate said actions to the user.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:35:52 -05:00
Dan McGee
0a4a5cea97 Add new import key question enum value and stub frontend function
This is for eventual use by the PGP key import code. Breaking this into
a separate commit now makes the following patches a bit easier to
understand.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:35:52 -05:00
Dan McGee
3e4749fe3e Fix signature printing in package info
pm_asprintf() does not return a length as asprintf() does. Fail. Make
sure it is not -1 as that is the only failure condition.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:34:07 -05:00
Dan McGee
361ed6a600 config parsing: add note if libcurl disabled and no XferCommand
Just a helpful warning for those users in this unenviable position.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:33:48 -05:00
Dan McGee
e4690232d6 config parsing: include file and line number in more errors
Before:
    $ pacman -Si pacman
    error: invalid value for 'SigLevel' : 'FooValue'

After:
    $ ./src/pacman/pacman -Si pacman
    error: config file /etc/pacman.conf, line 88: invalid value for 'SigLevel' : 'FooValue'

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:33:43 -05:00
Dan McGee
ca58e326dc Pull option names out of messages in config parsing
This allows some message reuse, as well as making it clear to
translators what *not* to translate.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:33:39 -05:00
Dan McGee
69694edd2c Check capabilities in SigLevel option parsing
Only allow turning it on if the backend library has support for it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:32:39 -05:00
Dan McGee
d36d70d294 Add alpm_capabilities() method and enumeration
This allows a frontend program to query, at runtime, what the library
supports. This can be useful for sanity checking during config-
requiring a downloader or disallowing signature settings, for example.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:32:35 -05:00
Dan McGee
33f2518531 Move default siglevel value from backend to frontend
This takes the libraries hidden default out of the equation: hidden in
the sense that we can't even find out what it is until we create a
handle. This is a chicken-and-egg problem where we have probably already
parsed the config, so it is hard to get the bitmask value right.

Move it to the frontend so the caller can do whatever the heck they
want. This also exposes a shortcoming where the frontend doesn't know if
the library even supports signatures, so we should probably add a
alpm_capabilities() method which exposes things like HAS_DOWNLOADER,
HAS_SIGNATURES, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:32:30 -05:00
Dan McGee
01f5c9e79a validate_deltas: split verify/check errors loops
This allows us to do all delta verification up front, followed by
whatever needs to be done with any found errors. In this case, we call
prompt_to_delete() for each error.

Add back the missing EVENT(ALPM_EVENT_DELTA_INTEGRITY_DONE) that
accidentally got removed in commit 062c391919.

Remove use of *data; we never even look at the stuff in this array for
the error code we were returning and this would be much better handled
by one callback per error anyway, or at least some strongly typed return
values.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:32:24 -05:00
Dan McGee
5e7875ae6a Fix possible segfault if siglist was empty
If siglist->results wasn't a NULL pointer, we would try to free it
anyway, even if siglist->count was zero. Only attempt to free this
pointer if we had results and the pointer is valid.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22 10:31:28 -05:00
Dan McGee
3a460a8be6 Remove noisy debug logger
This one can be overwhelming when reading debug output from a very large
package. We already have the output of each extracted file so we
probably can do without this in 99.9% of cases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-21 13:02:35 -05:00
Dan McGee
47dd315609 Fix int/size_t type in alpm_list_count() call
alpm_list_count() returns size_t, which we should use to store the
result since it is easy enough to format for printing.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 17:15:09 -05:00
Dan McGee
8375ad214a _alpm_sync_commit: extract two static methods
This adds two new static methods, check_validity() and load_packages(),
to sync.c which are simply code fragments pulled out of our
do-everything sync commit code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
b7ebacc576 Pass package signature data up one more level
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
ec790ced7c signing: add a process and retry loop for database signatures
In reality, there is no retrying that happens as of now because we don't
have any import or changing of the keyring going on, but the code is set
up so we can drop this in our new _alpm_process_siglist() function. Wire
up the basics to the sync database validation code, so we see something
like the following:

    $ pacman -Ss unknowntrust
    error: core: signature from "Dan McGee <dpmcgee@gmail.com>" is unknown trust
    error: core: signature from "Dan McGee <dpmcgee@gmail.com>" is unknown trust
    error: database 'core' is not valid (invalid or corrupted database (PGP signature))

    $ pacman -Ss missingsig
    error: core: missing required signature
    error: core: missing required signature
    error: database 'core' is not valid (invalid or corrupted database (PGP signature))

Yes, there is some double output, but this should be fixable in the
future.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
994cb4da4f Allow our PGP helper method to pass back the signature results
This will make its way up the call chain eventually to allow trusting
and importing of keys as necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
a27f993600 Split package validation and load loops
This adds a some new callback event and progress codes for package
loading, which was formerly bundled in with package validation before.
The main sync.c loop where loading occurred is now two loops running
sequentially. The behavior should not change with this patch outside of
progress and event display; more changes will come in following patches.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
afdbfc05f7 Extract an _alpm_pkg_validate_internal() method
_alpm_pkg_load_internal() was becoming a monster. Extract the top bit of
the method that dealt with checksum and signature validation into a
separate method that should be called before one loads a package to
ensure it is valid.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dave Reisner
7eb2f0cd15 pacman/upgrade: print 'loading packages...' only once
Do this outside the loop to prevent the message from being displayed
(and pluralized!) for each individual package.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
8e3b39a9e0 pacman: use dynamic string allocation where it makes sense
None of these are hot-code paths, and at least the target reading has
little need for an arbitrary length limitation (however crazy it might
be to have longer arguments).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
0f92fc5963 utils/cleanupdelta: remove unneeded syncdbpath
This variable was totally unused.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:11 -05:00
Dan McGee
79cbce60ac Remove all usages of alpm_list_getdata() from the library
No need for the indirection; just access ->data instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:10 -05:00
Dan McGee
70e2c34f0f _alpm_runscriptlet(): remove clean_tmpdir variable
This is always true at the end since we return early if we couldn't
create the tmpdir, so it is totally unnecessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:10 -05:00
Dan McGee
3796164848 Access db->pkgcache directly in db_free_pkgcache()
We shouldn't be going through the accessor that does a bunch of
unnecessary legwork, including potentially loading the pkgcache right
before we free it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:10 -05:00
Dan McGee
95119d46d4 Flip getcwd()/chdir() for open()/fchdir() in the frontend
Just like we did in libalpm in commit 288a81d847.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20 10:23:10 -05:00
Dan McGee
288a81d847 Use more efficient way of restoring working directory
Rather than using a string-based path, we can restore the working
directory via a file descriptor and use of fchdir().

From the getcwd manpage:
    Opening the current directory (".") and calling fchdir(2) to
    return is usually a faster and more reliable alternative when
    sufficiently many file descriptors are available.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19 14:11:08 -05:00
Dan McGee
bfe36c2ddf Reduce path allocation on the stack in local database
We did a lot of both malloc-ing and stack printing to form some paths in
this code. Attempt to unify it all into the one get_pkgpath() method by
adding an optional third "filename" parameter, and form the necessary
path string all in one go.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19 13:43:13 -05:00
Dan McGee
e1899cbc64 Be smarter about running ldconfig during removal transactions
1. Don't run it if something failed in package removal- this mirrors
what we already do in sync transactions.
2. Don't run it if we are invoking it for the replaces removal bit of a
sync transaction- it doesn't make sense to run ldconfig halfway through
a sync install; we should only run it once at the end.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19 13:18:42 -05:00
Dan McGee
a94ad29740 Search for non-prefixed paths in skip_remove list
We add them to this list with the root path not appended; we should be
searching for them this way as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19 13:17:16 -05:00
Dan McGee
41d8deff88 be_local: cope with a desc file without trailing newline
We checked the (fgets == NULL and !feof) case, but never actually bailed
out of the loop if we were at the end of the file, causing infinite
looping.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 17:32:15 -05:00
Dan McGee
86d9fcbfff Remove const specifier from changelog_read() void parameter
This shouldn't really be declared with const, and causes a compile error
when -Wcast-qual is used. Remove the const specifier from the function
specification and all implementations.

Also fix one other trivial -Wcast-qual warning in _alpm_db_cmp().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 17:11:39 -05:00
Dan McGee
69a3558b75 Remove dead changelog_feof() code
We never ended up using or really needing this; kill it for now knowing
it is in git history if ever needed again.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 17:03:56 -05:00
Dan McGee
49dff4c80b Add a random pactest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 17:00:21 -05:00
Dave Reisner
83ee9708b1 src/util: provide strndup definitions where needed
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 16:58:21 -05:00
Dave Reisner
07e89c1e5d dload: avoid using memrchr
This function doesn't exist on OSX. Since there aren't any other
candidates in alpm for which this function would make sense to use,
simply replace the function call with a loop that does the equivalent.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-18 16:57:59 -05:00
Dan McGee
52c65fdfea Ensure entire struct is zeroed in _alpm_parsedate()
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-18 16:57:26 -05:00
Dave Reisner
c12fa4ab19 pactree: include missing ctype.h header
needed for isspace() -- avoids warnings on OSX.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 16:57:09 -05:00
Dave Reisner
b1a09b93ef configure: Fix quoting in SEDINPLACE on Darwin
single quotes expanded to nothing, leaving us with a command that
assumed the sed expression was the backup suffix. Use a pair of escaped
double quotes, which survives automake and ends up properly in makepkg.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 16:57:07 -05:00
Dave Reisner
223a92ca9d dload: remove user:pass@ definition from hostname
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-18 15:35:58 -05:00
Dave Reisner
7ad78c2c88 paccache: remove unnecessary if check
This is superfluous as the ensuing for loop will exit immediately on the
same condition avoided by the if.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-18 15:34:54 -05:00
Dan McGee
a7d7798032 Fix build without gpgme
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-18 15:34:28 -05:00
Dave Reisner
f883efe2cb pacman: add short opt '-p' for --print to -{S,R}h
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-14 17:24:55 -05:00
Dave Reisner
e01dbcc068 include ldconfig.stub in EXTRA_DIST
Since c51b9ca, ldconfig.stub is required by pactest so we need to
include it as part of the dist tarball.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-14 17:18:44 -05:00
Dave Reisner
68856755c4 buildsys: remove existing symlinks before installing
This fixes build errors when performing a manual install straight to a
filesystem where the files already exist.

Reported-by: Sergej Pupykin <ml@sergej.pp.ru>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-14 17:18:07 -05:00
Dan McGee
a2356d5ae3 Don't duplicate header strings
There is no need to print them into buffers; we can use the values
returned by gettext() directly without issue.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-14 17:18:07 -05:00
Dave Reisner
4a02350ded makepkg: fix recreation of hardlinks to .gz manpages
4ed12ae tightened up the logic to use only find, but ignored the fact
that since the manpage hard link names were no longer captured. They
were created as separate compressed manpages, rather than as hardlinks.

This also introduces a minor efficiency of deleting all hardlinks at
once and using proper iteration over an array rather than a string.

Note to anyone else touching this code: e2fsprogs and libpcap are useful
for testing this. If that changes in the future, you can use the below
bash to locate others:

  IFS=$'\n' read -rd '' -a a < <(find /usr/share/man -type f \! -links 1)
  pacman -Qqo "${a[@]}" | sort -u

I broke it!

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-14 17:25:29 -04:00
Dave Reisner
d1e04c1b67 makepkg: add missing newline on passing gpg sourcecheck
When a sourceball passes this check without any warnings, a newline is
omitted. Similar to the if clause of this else block, print a single new
line at the end of the clause instead of accounting for each output.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-14 14:19:18 -04:00
Dave Reisner
0f69e2ec0b makepkg: check for var existance before file existance
This prevents makepkg from aborting with 'file not found' when
changelog= or install= are declared in a PKGBUILD, but empty.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-12 08:27:13 -04:00
Dave Reisner
3905ada993 account for partial delta files in download size
Similar to an earlier commit which accounts for .part files for full
packages, calculate the download_size for deltas keeping mind the
possibility of a partial transfer.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-11 19:10:48 -05:00
Dave Reisner
d8eacae7bc make compute_download_size consider .part files
Check for the existance of a partial download of a package file before
jumping to delta calculations. Currently, if there were 10MiB remaining
in a 100MiB the values passed to the front end do not reflect this.

Refactored from an old patch originally by Dan.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-11 19:09:04 -05:00
Dave Reisner
befddfc3e6 dload: provide optional netrc support
if ~/.netrc exists and has credentials for the hostname requested in a
download, they will be provided in an http auth request. This can still
be overridden by explcitly declaring user:pass in the URL.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-11 19:07:25 -05:00
Dave Reisner
c736a12e86 makepkg: unset errexit when sourcing /etc/profile
This is a fix for a bash3 specific bug, where a file sourced by
/etc/profile would exit non-zero and make its way back up to makepkg,
forcing it to exit after package installation. Along with unsetting the
ERR handler, temporarily unset errexit to avoid this.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-11 13:47:07 +10:00
Dave Reisner
7f1235ccbc paccache: escape . in trimming of diskspace string
Before:
==> finished dry run: 2 candidates (diskspace saved: 7. MiB)

After:
==> finished dry run: 2 candidates (diskspace saved: 7.8 MiB)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-11 13:46:07 +10:00
Dan McGee
4737a87b84 download callback: show decimal places in rate if we have room
Display now looks like this, whereas before we would have just showed
'2M/s' for the extra repository download. The cutoff is placed at 100.0
to ensure we only use 4 character slots of width (e.g. '99.9', '100').

:: Synchronizing package databases...
 testing                   39.9 KiB   470K/s 00:00 [######################] 100%
 core                      51.4 KiB   469K/s 00:00 [######################] 100%
 extra                    768.8 KiB   2.1M/s 00:00 [######################] 100%
 community-testing       1941.0   B  54.4M/s 00:00 [######################] 100%
 multilib                  26.6 KiB   458K/s 00:00 [######################] 100%
 community                449.8 KiB  1649K/s 00:00 [######################] 100%

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-11 13:45:59 +10:00
Dan McGee
f7653e582b Move download callback static vars into function
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-11 13:45:54 +10:00
Dave Reisner
db70c9da15 diskspace: fix memory leak on root mount not found
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-08 14:18:19 -05:00
Dan McGee
a03313f3f6 Print 'loading packages' message on -U operations
This will be the first thing printed when doing an upgrade. Currently
there is no output at all until we start resolving dependencies, which
can be a while in if specifying very large targets on the command line,
in which case it is nice to let the user know we are doing something.

Addresses FS#25822 in the most KISS way possible.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-08 14:14:51 -05:00
Dave Reisner
905ae640cf makepkg: use more awk'ish syntax in sanity checks
This simplifies the flow a bit, making the pipeline a little easier to
grok.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:05 -05:00
Dave Reisner
4ed12aec30 makepkg: avoid for loop in deleting manpage hardlinks
find can do this all on its own and remain portable.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:04 -05:00
Dave Reisner
17c3de3e4f makepkg: act on function return value, not output
Correcting a typo, as this function will never output anything.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:04 -05:00
Dave Reisner
3d9f961d13 makepkg: refactor check_pgpsigs output
- display associated warnings on same line as pass/fail msg, to be more
  consistent with checksum verification output
- properly error on a revoked key (matching pacman's behavior)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:04 -05:00
Dan McGee
8ffa2b24a5 Use more correct integer types in diskspace checks
This adjusts type usage to match POSIX provided types from
<sys/types.h> rather than assuming everything will fit in a long or
unsigned long. Use fsblkcnt_t (unsigned) and blkcnt_t (signed) as
appropriate. These are affected the same way off_t is on 32 bit
platforms, where the types are extende to 64 bits if large file support
is enabled.

Because most numbers here are block counts, this isn't
near as pressing as using a 32-bit variable for file sizes where
anything over 2GiB can burn you; we likely can support files at least
512 but mainly 4096 times larger.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-07 21:05:04 -05:00
Dan McGee
b961ebe16f query check: use provided filelist count instead of keeping track
We don't need to keep track of how many files are in a package now that
said value is provided to us. It also makes more sense to use size_t
here for types rather than the (hopefully never too short) int.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-07 20:51:35 -05:00
Dan McGee
6317db8429 Remove unnecessary cast
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-07 20:51:35 -05:00
Dan McGee
3e08614fda Ensure PackageRequired works as expected
Changes in commit dc3336c277 caused this to stop working as expected for
sync packages, due to the way the logic is structured. Ensure we always
enter the signature code if the bitflag is flipped on to check
signatures for packages. Rename 'use_sig' to 'has_sig' for clarity.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-07 20:51:35 -05:00
Dave Reisner
0e79802c0a makepkg: use globs in place of regex
We seem to enjoy using bash regex capabilities, but never referencing
the result with BASH_REMATCH. Replace almost all regexes with equivalent
globs which are faster and functionally equivalent in these cases.

This enables the extglob shopt.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 11:46:01 -05:00
Dan McGee
8d0ff3d7dc dload: use intmax_t when printing off_t
This works for both 32-bit and 64-bit platforms.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 11:44:29 -05:00
Dave Reisner
29ad9e0a0a makepkg: unset variables as per !{make,build}flags
Don't just set the flag variables to zero length strings, actually unset
them from the environment. This fixes issues with broken gnu Makefies
that use ?= for assigment, where the presence of a var is enough to make
this condition avoid assignment.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 08:45:44 -05:00
Dave Reisner
7ed54a9940 rankmirrors: properly sort resulting times
- Properly read each sorted line into a new array, instead of breaking
  on every word.
- LC_COLLATE should apply to the sort portion of the pipeline, not the
  printing.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-06 08:44:34 -05:00
Dave Reisner
a4e0d3e930 dload: abstract dload_interrupted reasons
This gives us some amount of room to grow in case we ever find another
reason that we might return with an error from the progress callback.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-06 08:44:14 -05:00
Dave Reisner
6c236277a3 dload: improve debug output
We lost some of this output in the fetch->curl conversion, but I also
noticed in FS#25852 that we just lack some of this useful information
along the way.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-06 08:44:09 -05:00
Dave Reisner
7054e37126 sync: add missing newline in warning message
Dan: fix the other missing one too.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 08:43:23 -05:00
Dave Reisner
400942fedf avoid blowing out the filecache list when using tmpdir
_alpm_filecache_setup() destroys the list of cachedirs when it finds no
writeable directories in the config. This put us in an awkward situation
where _alpm_filecache_find() would locate a downloaded file in a r/o
cachedir, but then fail to install it after _alpm_filecache_setup() is
called (with a NULL argument). Change this behavior to merely prepend
the temporary directory to the list of available cachedirs.

Dan exposed it in e07547ee4e, as now a package can be found in a
directory we may not be able to actually store packages in.

Reported-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 08:42:02 -05:00
Dan McGee
7ea1ea88bb More package operations cleanup
Neither deltas nor filename attributes are ever present in the local
database, so we can remove all of the indirection for accessing these
attributes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 22:07:06 -05:00
Dan McGee
7c956d5d4b Add -p/--print tip for -Q operations on filepath
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:45:33 -05:00
Dan McGee
98fdfa1968 Former transaction callback rename refactor
Put all the callback stuff in alpm.h in one spot, and make the following
renames for clarity with the new structure:

ALPM_TRANS_EVT_* --> ALPM_EVENT_*
ALPM_TRANS_CONV_* --> ALPM_QUESTION_*
ALPM_TRANS_PROGRESS_* --> ALPM_PROGRESS_*
alpm_option_get_convcb() --> alpm_option_get_questioncb()
alpm_option_set_convcb() --> alpm_option_set_questioncb()

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:45:08 -05:00
Dan McGee
37da18aee8 Move all callbacks up to the handle level
This was just disgusting before, unnecessary to limit these to only
usage in a transaction. Still a lot of more room for cleanup but we'll
start by attaching them to the handle rather than the transaction we may
or may not even want to use these callbacks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:45:03 -05:00
Dan McGee
d88e524e7c Be fully silent on any -Sp operation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:44:45 -05:00
Dan McGee
062c391919 Make delta validation/application more logical
The call to apply was tucked inside validate, and the EVENT callbacks
were done outside the function rather than inside. Reorganize things a
bit to make more sense.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:44:39 -05:00
Dan McGee
16fd66f879 pacman-key: add --refresh-keys operation
This allows new signatures to be pulled, revocations to be found, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:44:04 -05:00
Dan McGee
d9545103b9 pacman-key: split keyserver to a separate option
This also renames '--receive' to '-recv-keys' to match the wrapped gpg
option name, rather than invent a new one, now that the calling
convention is the same.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:43:03 -05:00
Dan McGee
5a9b07b0e7 pacman-key help and documentation cleanup
We were using the mystical [<foobar>] options which is some sort of
cross between a <required> argument and an [optional] one. Remove this
madness and do some other general cleanup/consistency work in the
manpage.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:41:40 -05:00
Dan McGee
24f4f9822f doc: consistency when referencing other options
Use '\--option' rather than `--option` everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:41:40 -05:00
Dan McGee
3c3ee6796a pacman-key: document --lsign-key
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:41:40 -05:00
Dan McGee
83a1e4fee3 Clean up handling of size fields
We currently have csize, isize, and size concepts, and sometimes the
difference isn't clear. Ensure the following holds:

* size (aka csize): always the compressed size of the package; available
  for everything except local packages (where it will return 0)
* isize: always the installed size of the package; available for all
  three package types

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 19:26:07 -05:00
Dan McGee
c51b9ca0ad pactest: remove PACMAN_OUTPUT from ldconfig tests
This removes the last usages of this rule that aren't explicitly looking
at real output from pacman. Notably, these tests depended on one
particular debug logger not ever being changed, which is too fragile,
not to mention doesn't work at all with --nolog.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 14:36:44 -05:00
Dan McGee
ad051f7328 _alpm_parsedate(): return time_t and not long
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 12:36:11 -05:00
Dan McGee
13072ef86c Add pactest for overflowing date (year 2038 problem)
This will work fine on x86_64 (or any platform that has a 64 bit long),
but currently fails on i686. This test also stresses the recent changes
to accommodate package size values greater than a 32 bit UINT_MAX.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 12:18:48 -05:00
Dan McGee
11873b70ae makepkg: fix overzealous PGP signature file matching
The regex wasn't rooted at the end of the filename, nor was it matching
a period/dot before the file extension. The end result was this matched a
file named '07_all_sig.patch' which is totally broken.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:42:55 -05:00
Dave Reisner
11ab9aa9f5 pacman/callback: reuse strlen calculation
Call strlen earlier in the dl progress callback, and reuse this length
to replace some heavier str*() calls with more optimized mem*()
replacements. This also gets rid of a false assumption that the ending
string will ever be longer than the original string.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:33:28 -05:00
Dave Reisner
cf1f014393 makepkg: fix sanity checking in versioning
Read the entire variable, respecting escapes, which are necessary to
retain for the successive eval.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:32:26 -05:00
Dave Reisner
5bb2d2e0a0 makepkg: read filenames in a while loop
Further improvments on 2ca27ab which will allow the changelog and
install script files to contain whitespace.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:32:20 -05:00
Dave Reisner
35d8cc8bc8 makepkg: fix breakage in eval'ing quoted strings
Broken in 2ca27a by me, trying to fix another problem.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:32:14 -05:00
Dan McGee
50f53b293c pacman-key: add --lsign-key operation
This allows local signing of a given key to help establish the web of
trust rooted at the generated (or imported) master key.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-30 08:39:26 -05:00
Dan McGee
7479bf21e8 pacman-key master key generation
This enables pacman-key, during --init, to generate a single secret key
for the pacman keyring if one is not present. This will be used as the
root of the web of trust for those that do not wish to manage it with
their own key, as will be the default.

This does not preclude later adding other secret keys to the keyring, or
removing this one- we simply ensure you have at least one secret key
available.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-30 08:23:46 -05:00
Dan McGee
06b228b20f Scale package integrity progress bar/percentage by package size
This upgrades the simple 15/17 scaling by package number we used before
to package sized based scaling, which is much more accurate. Addresses
some of the issues raised in FS#25817.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-30 08:23:32 -05:00
Allan McRae
19c3880ec9 Remove outdated comment for _alpm_outerconflicts
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-30 08:11:57 -05:00
Pang Yan Han
2c5f000d5b Improve advice for sync ops when db.lck is present
When the database is locked, sync operations involving transactions, such as
pacman -Syy, show the following:

:: Synchronizing package databases...
error: failed to update core (unable to lock database)
error: failed to update extra (unable to lock database)
error: failed to update community (unable to lock database)
error: failed to update multilib (unable to lock database)
error: failed to synchronize any databases

Whereas pacman -U <pkg> shows:

error: failed to init transaction (unable to lock database)
  if you're sure a package manager is not already
  running, you can remove /var/lib/pacman/db.lck

Which is much more meaningful, since the presence of db.lck may indicate an
erroneous lockfile instead of an ongoing transaction.

Improve the error messages for sync operations by advising the user to remove
db.lck if he is sure that no package manager is running.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 20:17:08 -05:00
Dan McGee
234b6ffc2c Parse > 2GiB file sizes correctly
We were using atol(), which on 32 bit, cannot handle values greater than
2GiB, which is fail.

Switch to a strtoull() wrapper function tailored toward parsing off_t
values. This allows parsing of very large positive integer values. off_t
is a signed type, but in our usages, we never parse or have a need for
negative values, so the function will return -1 on error.

Before:
    $ pacman -Si flightgear-data | grep Size
    Download Size  : 2097152.00 K
    Installed Size : 2097152.00 K

After:
    $ ./src/pacman/pacman -Si flightgear-data | grep Size
    Download Size  : 2312592.52 KiB
    Installed Size : 5402896.00 KiB

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:57:05 -05:00
Helder Martins
d74dad79b7 lib/libalpm/handle.c: Removed redundant if condition
Signed-off-by: Helder Martins <heldermartins89@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:56:24 -05:00
Dan McGee
515720a6fc Ensure progress callback updates if XX/YY numerator changes
We only updated if the percentage incremented and enough time had
elapsed, even though the numerator of the current/howmany fraction may
have changed. Ensure we proceed with the progress bar update in these
cases so as to not mislead the user.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:56:14 -05:00
Dan McGee
8129b93afe pacman-key: fix broken logic around updating trust database
Any option that flips UPDATEDB=1 doesn't work right now due to what we
thought was a good idea in commit cab1379a1a. Fix this by not
including the update operation in the option count and special casing
it where necessary.

Also, bring back the helpful "Updating trust database" message.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:55:28 -05:00
Allan McRae
e3676ae7b5 Run pacman test-suite with LC_ALL=C
Running the pacman test-suite in a non-English locale results in a few
failures.  Force the test-suite to run with LC_ALL=C.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:54:33 -05:00
Dan McGee
499e09734b Streamline alpm_splitdep() comparisons
This reduces from 5 to 3 the number of searches needed on the string
looking for a comparison operator, since we can so a second quick
comparison looking for '=' if we find '<' or '>'. It also makes every
search doable with strchr() or memchr() rather than the slower strstr()
method.

In testing, only 10% of splitdep calls (~1600 / 16000) during an -Ss
database load found a version comparison operator, so optimizing the not
found path to be require less work makes sense.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:54:18 -05:00
Dave Reisner
b3c0ae5205 pacsort: use boolean, not binary OR operation
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 19:53:58 -05:00
Dan McGee
7480df68ce Rework scriptlet tests to not depend on pacman output
This actually does something in a scriptlet we can check with our normal
set of rules, rather than relying on pacman debug output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 07:48:59 -05:00
Dan McGee
f46db04f98 Merge branch 'allan/pacman-key' 2011-08-28 23:51:05 -05:00
Dan McGee
8973875a1f _alpm_splitdep(): don't pass bogus length value to strndup
If we fell through to the ALPM_DEP_MOD_ANY case, ptr would be NULL, and
we would pass (0 - <str>), which is a rather large negative number or
bogus positive number, depending on signed/unsigned. Just use strdup in
the case where we don't have a ptr available.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 23:50:28 -05:00
Dan McGee
b221af660d Database read optimizations
Hard to believe there was still more room to improve on this, but I
found an easily correctable oversight tonight. Our databases (both sync
and local) contain many blank lines, and we were not moving onto the
next line right away in these cases; instead we would proceed through
our strcmp() conditional checks as normal.

Some local numbers follow to show the effects of this patch:

Sync `-Ss foobarbaz`:
71,709 blank lines skipped early
~1,505,889 strcmp() calls avoided (21 per line)
~15% speed improvement (.210 --> .179 sec)

Local `-Qs foobarbaz`:
6,823 blank lines skipped early
115,991 strcmp() calls avoided (17 per line)
~6% speed improvement (.080 -> .071 sec)

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 23:49:27 -05:00
Dan McGee
040083b97f Allow access to package origin data
Add new alpm_pkg_get_origin() method, use it in the front end now that
the enum constants are publicly available.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 23:41:17 -05:00
Diogo Sousa
3a458783a2 Removed multiple definitions of pkgfrom_t
libalpm now exports type alpm_pkgfrom_t in alpm.h, which may be used
by frontends.

Pacman now uses alpm_pkgfrom_t instead of replicating that type (pkg_from
as was in src/pacman/package.h)

Updated API change in README.

Signed-off-by: Diogo Sousa <diogogsousa@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 23:30:10 -05:00
Dan McGee
12a6c77fdd pacman-key: have --init add more options to default gpg.conf
This adds a add_gpg_conf_option() helper function which tries to be
intelligent and only add not found options, and those which have not
been explicitly commented out.

The new options added are 'no-greeting', 'no-permission-warning', and a
default 'keyserver'.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 11:55:23 +10:00
Dan McGee
7ceeebf150 pacman-key: refine permission and locking checks
* secring.gpg can be 600, readable by root user only
* ensure grep for lock-never option in check_keyring doesn't catch comments

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29 11:55:23 +10:00
Allan McRae
e1b9f7b300 pacman-key: rework and document holding keys in keyring
The HoldKey option was undocumented and was not suited for pacman.conf.
Instead use the file "/etc/pacman.d/gnupg/heldkeys" to contain a list
of keys not to be removed from the pacman keyring with the --populate
option.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-08-29 11:55:23 +10:00
Allan McRae
29dede2eb7 pacman-key: Improve documentation for --populate
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-08-29 11:55:23 +10:00
Allan McRae
cab1379a1a pacman-key: update trust database for relevant operations
After most operations that touch the keyring, it is a good idea to
always run a check on the trustdb as this prevents gpg complaining
on later operations.

Inspiration-from: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-08-29 11:55:22 +10:00
Allan McRae
710e83999b pacman-key: import everything then revoke on --populate
The optimization of only importing keys that were not to be later
revoked was a not smart enough.  For example, if a key was
in both a repos keyring and its revoke list, alternate runs of
pacman-key --populate would add then remove the key from the pacman
keyring.  This problem is made worse when considering the possibility
of multiple keyrings being imported.

Instead, import all keys followed by the revoking of all keys.  This
may result in a key being added then revoked, but that is not much of
an issue given that is a very fast operation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-08-29 11:55:22 +10:00
Allan McRae
d1240f67ea pacman-key: rework importing distro/repo provided keyrings
The current --reload option, apart from being non-clear in its naming,
is very limited in that only one keyring can be provided.  A distribution
may want to provide multiple keyrings for various subsets of its
organisation or custom repo providers may also want to provide a keyring.

This patch adds a --populate option that reads keyrings from (by default)
/usr/share/pacman/keyrings.  A keyring is named foo.gpg, with optional
foo-revoked file providing a list of revoked key ids.  These files are
required to be signed (detached) by a key trusted by pacman-key, in
practice probably by the key that signed the package providing these
files. The --populate flag either updates the pacman keyring using all
keyrings in the directory or individual keyrings can be specified.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-08-29 11:55:22 +10:00
Dan McGee
2cfcc874b9 Better error handling out of package load method
There are many other ways to fail a package load other than "file not
found". We should also use the correct error code in this case. Clean it
up a bit in the various callers.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:52:41 -05:00
Dan McGee
dc3336c277 Refactor some args out of pkg_load_internal
Just pass the entire sync package in if we have it; that way we can do
any necessary operations involving it rather than have a parameter list
growing endlessly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:52:19 -05:00
Dan McGee
c7e4005e5c Add more info to debug key display
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:52:10 -05:00
Dan McGee
de43d00db0 Refactor signature result return format
I was trying to take a shortcut and not introduce a wrapper struct for
the signature results, so packed it all into alpm_sigresult_t in the
first iteration. However, this is painful when one wants to add new
fields or only return information regarding a single signature.

Refactor the type into a few components which are exposed to the end
user, and will allow a lot more future flexibility. This also exposes
more information regarding the key to the frontend than was previously
available.

The "private" void *data pointer is used by the library to store the
actual key object returned by gpgme; it is typed this way so the
frontend has no expectations of what is there, and so we don't have any
hard gpgme requirement in our public API.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:51:54 -05:00
Diogo Sousa
12387ca4e5 lib/libalpm/signing.c: Fix memory leak in decode_signature() in case of error.
Signed-off-by: Diogo Sousa <diogogsousa@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:50:22 -05:00
Lukas Fleischer
0dad2f6e62 lib/libalpm/util.c: Fix two memory leaks
Free "md5sum" if md5_file() fails in alpm_compute_md5sum(). Free
"sha256sum" if sha2_file() fails in alpm_compute_sha256sum().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:49:02 -05:00
Dan McGee
a12a4ea396 Check local database status flag in db_write sanity check block
Do all the checks at once; this also avoids the 'return' call after we
have allocated memory for "pkgpath" as well as tweaked the umask.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:46:09 -05:00
Lukas Fleischer
455ca55f4e be_sync.c: Fix memory leak in alpm_db_update()
Free "syncpath" and restore umask if we fail to grab a lock.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:40:22 -05:00
Lukas Fleischer
a2002b8f69 pacman.c: Remove redundant strdup() in parsearg_global()
config_set_arch() already calls strdup(). Remove strdup() from the
config_set_arch() invocation to avoid a memory leak.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:37:16 -05:00
Dan McGee
87fb8f5d57 Make sync error message smarter on unfound targets
We had two issues here. One is a file with an absolute path passed to -S
results in a cryptic error message due to the database name being '\0'.
The second is not realizing you should be doing -U instead of -S. Fix
both of these to transform this:

    $ sudo pacman -S /tmp/binutils-2.21.1-2-i686.pkg.tar.xz
    error: database not found:

to this:

    $ sudo pacman -S /tmp/binutils-2.21.1-2-i686.pkg.tar.xz
    error: target not found: /tmp/binutils-2.21.1-2-i686.pkg.tar.xz
    warning: '/tmp/binutils-2.21.1-2-i686.pkg.tar.xz' is a file, did you mean -U/--upgrade instead of -S/--sync?

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:37:04 -05:00
Dan McGee
84d6de806b Fix possible mismatched type with several curl arguments
After commit 2e7d002315, we use off_t rather than long variables.
Use the _LARGE variants of the methods to indicate we are passing off_t
sized variables, and cast using (curl_off_t) accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-28 19:36:50 -05:00
Dan McGee
5a07b75b22 Always process validity value returned by gpgme
Don't force 'never'; you should be checking both the status and validity
anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 17:41:47 -05:00
Dan McGee
be72e10015 Fix small memory leak in sig check code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 17:41:27 -05:00
Dan McGee
c5982a3eb5 strtrim: don't move empty string
There were many cases where the string coming in was a blank line, e.g.
"\n\0", length 1. The trim routine starts by trimming leading spaces,
thus trimming everything. We would then proceed to do a memmove of the
NULL byte, which is completely worthless as we can just assign it
instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 17:14:19 -05:00
Dan McGee
e1dce078b2 Remove argument from check_pgp_helper
This one wasn't all that necessary as we only used it in one place in
the function, which can be checked easily enough at the call site.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:12:49 -05:00
Dan McGee
6aa9fdce5a Remove trans is NULL check in QUESTION/EVENT/PROGRESS macros
trans cannot (and better not) be NULL at any point when these are being
called.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:12:33 -05:00
Dan McGee
0ee3ce70a8 Remove short/long label distinction
We only used short labels in one place, and the short label is always
the first character of the long label anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:09:52 -05:00
Dan McGee
73fcf17041 Slight refresh of the download progress callback
This cleans up some of the mess we have here.

* switch to long units for the download size
* omit the .0 decimal part from the download rate
* omit the almost always zero HH: from estimated time if eta_h == 0
* Display --:-- if eta_h > 99; formatting was screwed up before

The net result of this is we usually have 1 more character to use for
filename display.

Before:
 extra                   500.9K 1242.4K/s 00:00:00 [######################] 100%
 community-testing       947.0B   28.2M/s 00:00:00 [######################] 100%
 multilib                 26.5K  405.1K/s 00:00:00 [######################] 100%
 community               450.6K 1238.3K/s 00:00:00 [######################] 100%

After:
 extra                    500.9 KiB  1118K/s 00:00 [######################] 100%
 community-testing        947.0   B    23M/s 00:00 [######################] 100%
 multilib                  26.5 KiB   255K/s 00:00 [######################] 100%
 community                450.6 KiB  1211K/s 00:00 [######################] 100%

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:09:52 -05:00
Dan McGee
30cad47fb9 Add a few more sizes to humanize_sizes()
Because why the hell not? Exbibyte, zebibyte, and yobibyte are going in,
even though nothing bigger than the 2^60 exbibyte can be represented
using an off_t variable anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:09:52 -05:00
Dan McGee
f7a3c4c8df Finish large file download attack prevention
This handles the no Content-Length header problem as stated in the
comments of FS#23413. We add a quick check to the callback that will
force an abort if the downloaded data exceeds the payload size, and then
check for this error in the post-download cleanup code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:09:52 -05:00
Dan McGee
2e7d002315 Use off_t rather than double where possible
Beautiful of libcurl to use floating point types for what are never
fractional values. We can do better, and we usually want these values in
their integer form anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:09:52 -05:00
Dan McGee
f0357e415c Add new 'lt' and 'zh_TW' translations from transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:04:41 -05:00
Dan McGee
5c48ca3239 Update existing translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:04:41 -05:00
Diogo Sousa
268d0bbcbe Improved alpm_list_mmerge() performance (fixed coding style)
Improved alpm_list_mmerge() performance by removing an extra
pass to obtain the tail node.

This was actually suggested by a TODO comment.

Signed-off-by: Diogo Sousa <diogogsousa@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-24 11:27:11 -05:00
Dan McGee
30d978a966 vercmp: ensure 2.0a and 2.0.a do not compare equal
We had this interesting set of facts conundrum, according to vercmp
return values:
    2.0a <  2.0
    2.0  <  2.0.a
    2.0a == 2.0.a

This introduces a code change that ensures '2.0a < 2.0.a' as would be
expected by the first two comparisons. Unfortunately this stays us a bit
further from upstream RPM code, but those are the breaks (in RPM, the
versions involving 'a' do in fact compare the same, but they are both
greater than the bare '2.0').

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-23 01:49:29 -05:00
Dan McGee
cc03d6366a Style-match rpmvercmp code with upstream
Not sure how or why some of this differed, but it is easy enough to set
it back to how it was so it is easier to diff.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-23 01:47:45 -05:00
Dan McGee
a8a4395098 Retrieve default SigLevel value from backend after initial setting
This ensures we grab and use the library default once we have processed
the global SigLevel setting, but before processing the repo-specific
settings. This means the following two configs will now evaluate the
same, as the backend currently defaults to 'Optional':

Config 1:
    [options]
    # nothing here
    [repo]
    SigLevel = TrustAll

Config 2:
    [options]
    SigLevel = Optional
    [repo]
    SigLevel = TrustAll

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-23 01:06:56 -05:00
Dave Reisner
6731d0a940 sync: halt file discovery if repo has no servers
This avoids error spam when no servers are configured for a repo and a
sync operation is performed:

Proceed with installation? [Y/n] y
:: Retrieving packages from testing...
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing
warning: failed to retrieve some files from testing

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-23 00:49:14 -05:00
Jakob Gruber
dddd6a46a0 Fix formatting in pacman-key manpage
Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 13:15:15 -05:00
Dan McGee
762cbf574b dload: prevent need to copy struct in mask_signal()
Since we store this directly in the download function, just rework
mask_signal() to take a pointer to a location to store the original.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:27:13 -05:00
Dave Reisner
f3e2858621 dload: extract tempfile creation to its own function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:23:18 -05:00
Dave Reisner
c65cea0dcb dload: move (un)masking of signals to separate functions
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:23:14 -05:00
Dave Reisner
10cbfc956c dload: move curl option setting to static function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:19:38 -05:00
Dave Reisner
d64c409913 dload: add open_mode to payload struct
This is a precursor to a following patch which will move the setting of
options to a separate function. With the open mode as part of the
struct, we can avoid modifying stack allocated variables.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:18:00 -05:00
Dave Reisner
592ed13bce dload: rename cd_filename to content_disp_name
This is more in line with the menagerie of file name members that we now
have on the payload struct.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:15:11 -05:00
Dave Reisner
329a7b7e24 dload: move tempfile and destfile to payload struct
These are private to the download operation already, so glob them onto
the struct. This is an ugly rename patch, with the only logical change
being that destfile and tempfile are now freed by the payload_free
function.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 09:14:45 -05:00
Dave Reisner
c4350d90f1 pacman/util: use string_length to calculate line length
This is measuring strings that are potentially localized, so we need a
multibyte aware function to count characters instead of bytes.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 08:53:25 -05:00
Allan McRae
b6914d16cc Print callback messages to stderr
Fixes FS#25099.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 08:53:01 -05:00
Dan McGee
a98babbfef Print debug timestamps to same stream as rest of output
We used fprintf() elsewhere in this function, but we didn't use it on
the debug timestamp printing. Use fprintf() instead of printf() to fix
this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 08:53:01 -05:00
Pang Yan Han
343ea81718 pacsort: correct list freeing
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 08:53:01 -05:00
Dan McGee
ffdfc82523 pacsort: ensure list is freed if size is 0
Found using: `valgrind ./src/util/.libs/lt-pacsort /dev/null`

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 08:53:01 -05:00
Pang Yan Han
e9b8a7693d pacsort: correct pointer type in list_new
Pointer sizes are the same but this makes intention clearer.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22 08:53:01 -05:00
Dan McGee
d9e5dab6ac Remove alpm_option_get_* usage from backend
These are all available directly on the handle without indirection.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 19:12:21 -05:00
Dave Reisner
d307ed5eb9 dload: remove unused macro
This was a vestige leftover from the libfetch days of yore.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 19:01:57 -05:00
Dave Reisner
82fc816d79 dload: delete zero length downloads on curl error
In the case of a non-operation (e.g. DNS resolver error), delete the
leftover 0 byte .part file.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 19:00:58 -05:00
Dave Reisner
43940f591e dload: rename payload->filename to payload->remote_name
This is a far more accurate description of what this is, since it's more
than likely not really a filename at all, but the name after a final
slash on a URL.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 19:00:40 -05:00
Dave Reisner
eae363c96f dload: remove code duplication
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 19:00:13 -05:00
Dave Reisner
d3f135af8f bash_completion: add dbonly to sync options
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 18:56:00 -05:00
Dan McGee
e07547ee4e Rework finding a writable cache directory
This is a refactor and refresh of the code used to find where we should
download packages.

* Incorporate suggestions from FS#25435 to use TMPDIR from the
  environment if set, otherwise fall back to /tmp as before.
* Make the writability tests a bit more in depth. We now do a three part
  check consisting of:
  - S_ISDIR(): is this even a directory
  - access(W_OK): is this directory writable by the current user.
    Unfortunately for root, this almost always returns that it is, but
    in the case of a RO mount or NFS share inaccessible to root, this
    check will exclude the directory.
  - mode & (any write bit): is there a writable bit set on this
    directory. This makes it possible to enforce a read-only cache
    directory by setting permissions to 0555, for example.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 13:10:17 -05:00
Dan McGee
6d544984f2 Be more robust when copying package data
This changes the signature of _alpm_pkg_dup() to return an integer error
code and provide the new package in a passed pointer argument. All
callers are now more robust with checking the return value of this
function to ensure a fatal error did not occur.

We allow load failures to proceed as otherwise we have a chicken and egg
problem- if a 'desc' local database entry is missing, the best way of
restoring said file is `pacman -Sf --dbonly packagename`. This patch
fixes a segfault that was occurring in this case.

Fixes the segfault reported in FS#25667.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 11:09:57 -05:00
Dave Reisner
9934b3bd34 lib/dload: unlink on response code >=400
ftp and http both define >=400 as being "something bad happened"

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 09:54:58 -05:00
Dave Reisner
24824b54ce dload: add 'unlink_on_fail' to payload struct
Let callers of _alpm_download state whether we should delete on fail,
rather than inferring it from context. We still override this decision
and always unlink when a temp file is used.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 09:43:19 -05:00
Dave Reisner
2ca27ab3a1 makepkg: quote re-evaluation of simple vars
This is a safety measure to prevent simple code injection.

$ i="foo bar"
$ eval i="$i"
bash: bar: command not found
$ eval i=\"$i\"
$ echo "|$i|"
|foo bar|

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 09:42:41 -05:00
Dave Reisner
1723e6dc4f lib/dload: prevent possible NULL dereference
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 09:41:55 -05:00
Dave Reisner
16334f778b sync: fix garbled output in conflict prompt
$ pacman -S cronie
resolving dependencies...
looking for inter-conflicts...
:: cronie and fcron are in conflict (@.). Remove fcron? [y/N] n

$ sudo pacman -S pacman
resolving dependencies...
looking for inter-conflicts...
:: pacman and pacman-git are in conflict (pKÈ). Remove pacman-git? [y/N]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 09:40:07 -05:00
Allan McRae
c28052e45b makepkg: deal with variable substitution when checking sanity
If any of pkgver, pkgrel or epoch contained a variable substitution,
then it needed to be evaluated before checking its value conformed
to the rules.

[Dan: add quotes around RHS]

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:50:17 -05:00
Dan McGee
2a466c2abc doc/PKGBUILD: update regarding versioned package fields
Add the info that versioned replaces are now supported, as well as
beefing up some of the other places touching on versioned fields.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
6cfc4757b9 Convert resolvedep() to use _alpm_depcmp_literal()
The whole first loop is trying to check literals only, so teach it to do
so. Also, reorder operations to make more sense by putting the strcmp()
first in the literal loop, and using a very cheap name_hash check first
in the second loop.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
3752edbff4 Fix replacement of provider issue
When we switched to using alpm_depcmp() in resolving replacments, we had
some interesting behavior with regard to providers and packages not
found in repositories. Teach the replacement resolving code to not look
at provisions at all to be slightly more sane.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
d008a816f1 Add an _alpm_depcmp_literal() function
This omits the finding of matching provisions and only checks the
package itself against the provided dep.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
78b63ce7c3 Replacements refactor: extract check_replacers()
This moves code that was inline in alpm_sync_sysupgrade() to its own
method.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
231d6cc1e4 Replacements refactor: extract check_literal()
This moves code that was inline in alpm_sync_sysupgrade() to its own
method.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
5d291d050e Remove usages of alpm_list_next() in backend
Another function call that can be replaced by a single pointer
dereference.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
c4bd476ad1 Remove use of no-op accessor functions in library
The functions alpm_db_get_name(), alpm_pkg_get_name(), and
alpm_pkg_get_version() are not necessary at all, so remove the calling
and indirection when used in the backend, which makes things slightly
more efficient and reduces code size.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee
c885a953eb Enhance and utilize database status flags
* Move is_local standalone field to status enum
* Create VALID/INVALID flag pair
* Create EXISTS/MISSING flag pair

With these additional fields, we can be more intelligent with database
loading and messages to the user. We now only warn once if a sync
database does not exist and do not continue to try to load it once we
have marked it as missing.

The reason for the flags existing in pairs is so the unknown case can be
represented. There should never be a time when both flags in the same
group are true, but if they are both false, it represents the unknown
case. Care is taken to always manipulate both flags at the same time.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Sebastien Luttringer
4a7f3bbc46 Add makepkg -S which is an alias to makepkg --source
makepkg --source is a often used go make source package like for AUR.
Have a -S shortcut will save the world.

Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Lukas Fleischer
d18e600952 lib/libalpm/dload.c: Use STRDUP() instead of strdup()
Use the STRDUP macro instead of strdup() for the sake of better error
handling on memory allocation failures.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Lukas Fleischer
0745288c14 lib/libalpm/dload.c: Add ASSERT() to alpm_fetch_pkgurl()
Return with ALPM_ERR_WRONG_ARGS instead of causing a potential segfault
if alpm_fetch_pkgurl() is invoked with a NULL URL.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 07:38:31 -05:00
Dave Reisner
9f139550f8 lib/dload: refactor deletion on failure
This moves all the delete-on-fail logic to under cleanup label. This
also implies should_unlink when a payload is received that doesn't allow
resuming.

Fixes .db.sig.part files leftover in the sync dir.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 21:03:43 -05:00
Dave Reisner
2dbdfe0788 lib/dload: avoid renaming download to 0 length destfile
This leverages earlier work that avoids a rename when destfile is unset.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 17:31:04 -05:00
Lukas Fleischer
b9833838c6 Avoid stat() on NULL path in curl_download_internal()
stat()'s behaviour is undefined if the first argument is NULL and might
be prone to segfault. Add an additional check to skip the stat()
invocation if no destfile is used.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 17:30:52 -05:00
Lukas Fleischer
9cddc4ad80 Skip rename() on NULL destfile in curl_download_internal()
Avoid a potential segfault that may occur if we use a temporary file and
fail to build the destination file name from the effective URL.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 17:30:41 -05:00
Dan McGee
3ceef97799 Fix trailing whitespace in whole codebase
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 17:03:19 -05:00
Sebastien Luttringer
b2688e9559 Update PKGBUILD manpage about startdir deprecation
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 16:54:53 -05:00
Dan McGee
b952a3b08c Fix compilation using --without-gpgme
This function is used regardless of whether gpgme support is enabled, so
make sure it is always accessible.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 19:51:21 -05:00
Allan McRae
c5c1a1349a configure.ac: add checks for more types, functions and headers
This covers most types, functions and headers that we use in the
code base.  Currently we do not use any of these checks, but it
is useful to have the configure output when looking at build issues
on other peoples systems.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 19:39:07 -05:00
Dave Reisner
b008193c12 dload: zero out pm_errno in curl_download_internal
This reverts some hacky behavior from 5fc3ec and resets the handle's
pm_errno where it should be reset -- prior to each download. This
prevents a transaction with a download from being aborted when a package
is successfully grabbed from a secondary server.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 19:37:14 -05:00
Dan McGee
cea6d7eb13 doc/PKGBUILD: fix Asciidoc formatting issues
We had this gem:
    ⇐ (less than or equal to)

Due to not ensuring we did literal printing of things like this. Fix it
and a few other problems noticed scanning through both the HTML and
manpage generated files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 11:47:53 -05:00
Dan McGee
70db027204 Update authors and contributors
* .mailmap: add mapping for Dave's two email addresses.
* AUTHORS: clear out file, tell people to use `git shortlog -s` instead.
* doc/footer.txt: "promote" Dave, put Xavier and Nagy in past contributors.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 11:46:44 -05:00
Allan McRae
f41dc7e8fa repo-add: fix creation of signature symlink
When creating a repo outside the current directory, the signature
symlink was not created.

Reported-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16 09:25:10 -05:00
Dan McGee
1175702828 Update message catalogs
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 16:09:45 -05:00
Dan McGee
d4a92cacc6 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 16:09:11 -05:00
Dan McGee
11b9bc443d repo-add: reorganize output messages for clarity
The use of warning once we had already started adding a package was
confusing as it broke the standard indent pattern. It was especially bad
if adding multiple packages as it wasn't clear what sub-messages applied
to which package being added. This should be an output change only from:

    ==> Adding package '/tmp/sync/netcfg-2.6.7-1-any.pkg.tar.xz'
      -> Computing checksums...
      -> Adding package signature...
    ==> WARNING: An entry for 'netcfg-2.6.7-1' already existed
      -> Removing existing entry 'netcfg-2.6.7-1'...
      -> Creating 'desc' db entry...
      -> Creating 'depends' db entry...

to:

    ==> Adding package '/tmp/sync/netcfg-2.6.7-1-any.pkg.tar.xz'
    ==> WARNING: An entry for 'netcfg-2.6.7-1' already existed
      -> Computing checksums...
      -> Adding package signature...
      -> Removing existing entry 'netcfg-2.6.7-1'...
      -> Creating 'desc' db entry...
      -> Creating 'depends' db entry...

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 15:15:11 -05:00
Dan McGee
11f4a7a48e Only check necessary signatures and checksums
The precedence goes as follows: signature > sha256sum > md5sum

Add some logic and helper methods to check what we have available when
loading a package, and then only check what is necessary to verify the
package. This should speed up sync database verifies as we no longer
will be doing both a checksum and a signature validation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 15:15:11 -05:00
Rémy Oudompheng
855bc16a9e libalpm: fix a remaining old syntax of RET_ERR() macro
It would prevent compilation of pacman on FreeBSD, and possibly other
systems.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 14:55:14 -05:00
Dave Reisner
5fc3ecf7f8 lib/sync: ignore download errors for as long as possible
Previously, the behavior was such that if a sync operation required
packages from multiple repos, a download error in the first repo would
cause a hard repo, ignoring the remainder of the repositories. Change
this behavior so that we do a better job of fetching as many packages as
possible before aborting the transaction.

There's a little bit of refactoring mixed in here to get rid of some
useless variables. Since we now depend heavily on the value of
handle->pm_errno being accurate the determine the function's return
value, we clear it when the transaction state is set.

Fixes FS#25532.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 14:54:21 -05:00
Dan McGee
796eaaed40 Further fixes to replacement iteration
A partial fix for this was in commit 7de92cb22, but this should fix the
remaining cases. There are still several issues dealing with "provision
as replacement" selection however.

Addresses FS#25538 and FS#25527.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 14:47:19 -05:00
Dan McGee
88bd1cec77 Add short example signature config to pacman.conf
This is similar to what we do with every other option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 13:08:24 -05:00
Dave Reisner
82ffe2cbfd build-sys: always use $(RM) instead of rm -f
These are equivalent. Use the autoconf macro for consistency.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 13:05:27 -05:00
Dave Reisner
1741b5cc30 dist: preserve symlinks on installation
This applies to the repo-remove man page as well as the script itself.

Yes Dan, I ran distcheck afterwards.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 13:05:17 -05:00
Dan McGee
a628feee46 Parse conflicts/provides/replaces at database load time
We did this with depends way back in commit c244cfecf6 in 2007. We
can do it with these fields as well.

Of note is the inclusion of provides even though only '=' is supported-
we'll parse other things, but no guarantees are given as to behavior,
which is more or less similar to before since we only looked for the
equals sign.

Also of note is the non-inclusion of optdepends; this will likely be
resolved down the road.

The biggest benefactors of this change will be the resolving code that
formerly had to parse and reparse several of these fields; it only
happens once now at load time. This does lead to the disadvantage that
we will now always be parsing this information up front even if we never
need it in the split form, but as these are uncommon fields and our
parser is quite efficient it shouldn't be a big concern.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:56:41 -05:00
Dan McGee
bd5ec9cd8e Validate the sha256sum if available
Adjust load_internal() to check the sha256sum value if we have it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:13:35 -05:00
Dan McGee
f37c501657 Show 'None' in Signatures -Qip/-Si output if none found
This is to be as consistent as possible across both types of display.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:12:37 -05:00
Dan McGee
fa4aad5b50 decode_signature: guess signature data length for efficiency
We may end up allocating 1 or 2 extra bytes this way, but it is worth it
to simplify the method and not have to call base64_decode() a second
time. Use the hueristic that base64 encoding produces 3 bytes of decoded
data for every 4 bytes of encoded data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:11:59 -05:00
Dan McGee
f3f39cef84 Remove checksum access indirection
These items are never present in anything but sync databases, nor do we
even try to load them from the local database. Remvoe the indirection
meant to allow the caching layer to work since it will never do anything
anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:11:59 -05:00
Dave Reisner
7de92cb223 lib/sync: reset flag after rejecting a replace
This prevents iteration through the remainder of the current tree, with
pacman claiming that they're all replacements to the original
replacement candidate.

:: Synchronizing package databases...
 allanbrokeit is up to date
 testing is up to date
 core is up to date
 extra is up to date
 community-testing is up to date
 community is up to date
:: Starting full system upgrade...
:: Replace util-linux-git with core/util-linux? [Y/n] n
:: Replace util-linux-git with core/vi? [Y/n] n
:: Replace util-linux-git with core/vpnc? [Y/n] n
:: Replace util-linux-git with core/wget? [Y/n] n
:: Replace util-linux-git with core/which? [Y/n] n
:: Replace util-linux-git with core/wireless-regdb? [Y/n] n
:: Replace util-linux-git with core/wireless_tools? [Y/n] n
:: Replace util-linux-git with core/wpa_actiond? [Y/n] n
:: Replace util-linux-git with core/wpa_supplicant? [Y/n] n
:: Replace util-linux-git with core/xfsprogs? [Y/n] n
:: Replace util-linux-git with core/xinetd? [Y/n] n
:: Replace util-linux-git with core/xz? [Y/n] n
:: Replace util-linux-git with core/zd1211-firmware? [Y/n] n
:: Replace util-linux-git with core/zlib? [Y/n] n
 there is nothing to do

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:11:59 -05:00
Dan McGee
ebb2e36cc4 Load and allow access to sha256sum
This adds a field in the package struct for this checksum type as well
as allowing access via the API to it. The frontend is now able to
display any read value. Note that this does not implement any use or
verification of the value internally.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 12:11:55 -05:00
Dan McGee
31f2e0cba3 Add ALPM sha256sum routines
These mirror ones we already have for md5sums.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 07:07:13 -05:00
Dan McGee
ff88228abd Add sha2 (sha256) routines from PolarSSL
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 07:07:13 -05:00
Allan McRae
31a7b150b0 repo-add: indicate whether package signature is found
When adding a package to a repo, it is useful to be able to see
that repo-add has indeed found the signature file.

[Dan: update text to be more in line with other messages]

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 07:07:13 -05:00
Dave Reisner
20b5cc96be pacman/package: show presence of signature in in -Si
adds a new API method: alpm_pkg_get_base64_sig

[Dan: don't use a new header string in frontend]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 07:06:23 -05:00
Dave Reisner
ea79de21d8 README: update with 3.5.0 -> 4.0.0 API changes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:34:15 -05:00
Dave Reisner
71f854dde8 makepkg: don't hardcode path to strip
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:33:01 -05:00
Dave Reisner
05f87e0b09 alpm.h: fix inconsistency in function prototype
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:30:58 -05:00
Dave Reisner
8d5018e780 add pactest for replacing a shared provider
This is currently expected to fail.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:30:25 -05:00
Dave Reisner
ce8f91a71b pactest/sync200: check for curl instead of fetch
We can't just check for LIBS as curl won't be listed. Instead, look at
the length of the LIBCURL var from the Makefile.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:29:09 -05:00
Dave Reisner
6bf60568f8 lib/dload: avoid deleting .part file on too-slow xfer
Take this opportunity to refactor the if/then/else logic into a
switch/case which is likely going to be needed to fine tune more
exceptions in the future.

Fixes FS#25531

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:26:08 -05:00
Dan McGee
83f076d3a8 Update base64 PolarSSL code
Also adjust our code using it for the size_t adjustments made by
upstream.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:24:49 -05:00
Dan McGee
835365b817 Update MD5 routines with changes from PolarSSL
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 20:17:21 -05:00
Dan McGee
c9cc2332cf pacman/query.c: avoid variable redeclaration
We were using i as the loop variable in both the inner and outer loop.
Use j in the inner loop instead for clarity.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 20:17:21 -05:00
Pang Yan Han
450bcb5d7b pactest: -U --recursive
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 12:52:18 -05:00
Dan McGee
fffaba50fb scripts/pkgdelta: fix make distcheck
--help and --version are required by the sanity checks performed by
`make distcheck`.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:56:47 -05:00
Dan McGee
c5eccedc63 Bump version to 4.0.0rc1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:45:27 -05:00
Dave Reisner
a58dc9283c pactest: add sync302 to test recursive syncfirst
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:36:58 -05:00
Dan McGee
0903452032 Enable recursive/needed sync on SyncFirst
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:36:50 -05:00
Dan McGee
dd865d2981 Merge branch 'maint'
Conflicts:
	scripts/repo-add.sh.in
2011-08-11 11:35:29 -05:00
Dan McGee
d0c64c4196 Attempt to update zsh_completion
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:29:49 -05:00
Dave Reisner
0bfefa87c8 bash_completion: update for adjusted options
Remove -k option excepting query operations and add --recursive for sync
and upgrade operations.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:29:49 -05:00
Dave Reisner
6e4f695a0f pacman: remove --dbonly shortopt
This is somewhat of a dangerous option with limited use cases. Don't
advertise it as an easily accessibly option.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:29:49 -05:00
Dan McGee
725edde73f Update trust level strings in -Qi display
It makes more sense to use the same tense and construction on all of
these.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:29:49 -05:00
Dan McGee
857357f940 Allow --needed and --recursive on -U operations
Trivial to implement as the same backend machinery is used anyway.
Document it and add it to the accepted options.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:29:46 -05:00
Dan McGee
f3fa77bcf1 Add -S --recursive operation
This closely matches what we had before for -R --recursive. Basically,
when specifying a target (e.g., pacman), we can now recursively pull all
dependencies, regardless of version specifiers and whether they are
already satisfied in the local database. This could be used to update
pacman on a system with an old glibc, for example, as both pacman and
glibc would get pulled into the transaction.

This is most useful with --needed to prevent needless reinstalls as
described in the man page changes.

The end goal of this change is to wire it into SyncFirst and have it be
the default mode of operation there, but that belongs in a separate
changeset.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:19:04 -05:00
Dan McGee
1f6afe6b0b Dependency code style cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:18:55 -05:00
Dan McGee
ca41470462 configure: simplify CARCH generation madness
Rather than a hardcoded list of only a few select architectures (of the
250+ case statements in config.guess), simply define CARCH to be the
first component of the "target triplet".

This introduces one "regression"- powerpc will no longer become ppc.
However, this is easily worked around in downstream distros if wanted.
This was the only CPU architecture with this oddity so it was felt worth
the price to make this change. Note that 'ppc64' wasn't handled in this
same odd fashion before anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:18:48 -05:00
Dan McGee
f0803f6ece build: remove mucking with CARCHFLAGS
We've never received an update to this, and gcc has sane defaults out of
the box anyway, as do most projects in their build systems. Remove the
magic here and just let downstream distros handle any changes or
additions necessary, as we already do for LDFLAGS.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:18:39 -05:00
Dave Reisner
edd9ed6a3b stop progress callbacks after curl_easy_perform returns
This prevents possible null dereferences in FTP transfers when the
progress callback is touched during connection teardown.

http://curl.haxx.se/mail/lib-2011-08/0128.html

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:18:21 -05:00
Dave Reisner
c4112da8c3 dload: remove unnecessary cast in alpm_load_payload_free
Dan: make it compile, s/load/payload/.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-11 11:18:00 -05:00
Allan McRae
c493eef643 makepkg: fix removing symbolic link
The path was not being stripped from $file before prefixing with
$srcdir resulting in the attempted removal of a very weird
filename.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit e92905a2c8)
2011-08-10 08:08:13 -05:00
Dan McGee
05608ee57e Fix stupid typo in NEWS file updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 19:52:15 -05:00
Dan McGee
e0f41e0fb4 3.5.4 release preparation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 19:16:19 -05:00
Eric Bélanger
c36dbf9711 Remove -f option from ln for POSIX compliance
Fixes FS#24893.

Conflicts:

	scripts/makepkg.sh.in
	scripts/repo-add.sh.in

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 51ed7dff0d)
2011-08-09 19:01:37 -05:00
Dave Reisner
6b57118c15 pacman/util: flush terminal input before reading response
Addresses FS#20538

Conflicts:

	src/pacman/util.c

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 9477abc359)
2011-08-09 18:59:49 -05:00
Allan McRae
07996bfac7 Document group and providers selection
The format required for selection of packages within the group selection
dialog is not entirely obvious, so provide some documentation.

Fixes FS#24134.

Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit 94d22f9309)
2011-08-09 18:55:16 -05:00
Dan McGee
82d45d66ca Merge branch 'maint'
Conflicts:
	src/pacman/callback.c
2011-08-09 16:24:55 -05:00
Dan McGee
5c1b83d9b1 Parse replaces strings as dep strings with version specs
This is done extremely crudely and is not very efficient, but it does
push us down the path of being closer to right, as one additional test
now passes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 16:13:25 -05:00
Dan McGee
ce74f76a4c Conflict comparison performance enhancements
* Add *_hash fields to conflict struct and populate them
* Remove unnecessary backwards string comparisons

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 16:11:22 -05:00
Dan McGee
76dfea6e83 Update string catalogs after string tweaks
This also pulls in some early translations we had entered in Transifex
in the last day so those would not be lost. The diffstat is huge and not
very telling as usual, as all sorts of fuzzyness switches happened this
time around for some reason.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 16:00:48 -05:00
Dan McGee
5a6ebec7b2 Add a slightly simpler versioned replace test
It turns out we have a few problems here which are best tackled
independently. The first is simply parsing replacements as dep strings;
the second will be dealing with replaces when the original package name
still exists in the repository.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:46:11 -05:00
Dan McGee
96c4b1c303 Don't walk off front of string when stripping newline
If the string was zero-length to begin with, or consists of only newline
characters, nothing stopped us from incrementing right off the front of
the string. Ensure len stays above zero the whole time.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:41:18 -05:00
Dan McGee
a42e52a09f doc/pacman.conf: make SigLevel overview an unordered list
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:41:07 -05:00
Dan McGee
6803260f26 Fix compile error when curl is not used
Noticed in my PowerPC Linux VM:

    cc1: warnings being treated as errors
    dload.c:45: error: 'get_filename' defined but not used
    make[3]: *** [dload.lo] Error 1

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:40:21 -05:00
Dan McGee
40ea6cd607 Depend on name_hash being set
This is a fairly valid assumption at this point, or at least as good of
one as assuming packages all have names.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:38:54 -05:00
Dan McGee
9d3d647f00 pactest: improve speed of local DB dependent rules
We were doing some really silly stuff before and abusing the os.walk()
call, having to walk the entire local database for every single PKG
rule. We really only need top level directories, and we can cache any
generated package since calls to db_read() are well-defined and only
happen in one place.

This speeds up the running of tests that may want to add 100 PKG_VERSION
rules at once, where before we had to limit how many we used in order to
not put a serious cramp in the speed of the test suite run.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09 15:36:05 -05:00
Dan McGee
5f38660be1 Add reason to corrupted package callback
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 19:55:44 -05:00
Dan McGee
9d09c9fdf7 Attempt to fix up some of the brokenness around failed package loads
This is a bit of a mess, due to the fact that we have a progress meter
running. It is also ironic that we are in the midst of a method named
"commit" when we haven't done a damn thing yet, and can still fail hard
if either a checksum or signature is invalid or unrecognized.

Adapt the former test_md5sum method to be invoked for any of the various
failure types, which at least gives the user some indication of what
packages are failing. A second patch will be needed to actually show
worthwhile error codes, but this is going to involve modifying the
actual data passed with the callback.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 19:42:52 -05:00
Dan McGee
1d16875db7 Update several translation strings
* Fix typos/capitalization
* Make sure large blocks of text are translated in one unit

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 19:01:26 -05:00
Dan McGee
4885a7fa3a Fix divide by zero when downloading zero length files
If someone did a 'touch bogusrepo.db', we had the potential to throw a
SIGFPE or divide by zero, given that the total file size was 0 and
getting passed up to the pacman callback. Fix this so we get weird but
sane output and don't blow up when downloading:

:: Synchronizing package databases...
 core             35.7K  306.7K/s 00:00:00 [###################] 100%
 bogusrepo         0.0K    0.0K/s 00:00:00 [###################] 100%

Exception as seen in gdb:

Program received signal SIGFPE, Arithmetic exception.
0x000000000040cc73 in cb_dl_progress (filename=0x619dfc "bogusrepo.db", file_xfered=0, file_total=0) at callback.c:584
584             file_percent = (file_xfered * 100) / file_total;

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 18:18:09 -05:00
Dan McGee
21240d4746 Update transifex config for new translation layout
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 17:45:44 -05:00
Dan McGee
9a40927533 Update all translation files
This moves us toward staring translations for the 4.0.0 release,
although this should not be interpreted as a string freeze by any means.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 17:17:15 -05:00
Dan McGee
09f950af07 _alpm_access(): don't call gettext() in debug level loggers
This is standard procedure elsewhere and cuts down on translations that
won't be seen (and we don't want if we need English debug output
anyway).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 17:11:14 -05:00
Dan McGee
8fa330335f Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
	lib/libalpm/po/fi.po
	lib/libalpm/po/libalpm.pot
	po/de.po
	po/fi.po
	src/pacman/po/pacman.pot
	src/pacman/util.c
2011-08-08 17:05:25 -05:00
Dan McGee
ef4757afa5 Store a package info level flag if we fail to load data
If we are missing a local database file, we get repeated messages over
and over telling us the same thing, rather than being sane and erroring
only once. This package adds an INFRQ_ERROR level that is added to the
mask if we encounter any errors on a local_db_read() operation, and
short circuits future calls if found in the value. This fixes FS#25313.

Note that this does not make any behavior changes other than suppressing
error messages and repeated code calls to failure cases; we still have
more to do in the "local database is hosed" department.

Also make a small update to the wrong but unused flags set in
be_package; using INFRQ_ALL there was not totally correct.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:56:48 -05:00
Dan McGee
d9f9b87d3f Add a test harness for new pacsort command
Note that this is meant to exercise pacsort more than the underlying
version comparsion; that is better left to the standalone vercmptest.sh
test script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:55:01 -05:00
Dave Reisner
1d37c19e04 mark option structs as const
These are never modified and even getopt_long's prototype shows this
modifier on the parameter.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:50:03 -05:00
Dave Reisner
5136df0f39 paccache: use pacsort instead of sort -V
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:49:56 -05:00
Dave Reisner
b283a1e065 src/util/Makefile.am: alphabetize targets
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:49:49 -05:00
Dave Reisner
0b57da2a43 pacsort: add new utility
pacsort is a command line sorting utility that implements libalpm's
alpm_pkg_vercmp algorithm.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:49:43 -05:00
Dan McGee
fab66f157d Bash-ify test/util/vercmptest.sh
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:49:19 -05:00
Dave Reisner
1a919a11b8 makepkg: ignore epoch when undeclared
In this case, we skip the epoch versioning entirely, as if it were
declared as 0.

Prevents errors such as:

/usr/bin/makepkg: line 244: ((: !  : syntax error: operand expected
(error token is " ")
==> Finished making: cower-git :20110808-1 (Mon Aug  8 17:17:27 EDT
2011)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:47:47 -05:00
Dan McGee
67445334e7 Update translations from transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:39:04 -05:00
Dave Reisner
1e16b94a85 contrib/paccache: misc cleanup and bugfix
* change error verbiage when run as root
* delete sigs along with packages
* fix bug in diskspace calculations
* merge END block in pkgfilter

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 13:29:45 -05:00
Dan McGee
07a1292721 Check return value of rename() calls
We did a good job checking this in add.c, but not necessarily anywhere
else. Fix this up by adding checks into dload.c, remove.c, and conf.c in
the frontend. Also add loggers where appropriate and make the message
syntax more consistent.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 13:29:45 -05:00
Florian Pritz
4c37d74ae5 doc/PKGBUILD: fix pkgver for -git packages
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 13:28:40 -05:00
Dan McGee
f10aea73e4 docs/pacman.conf: Document SigLevel option
This adds docs for SigLevel, which can exist in both [options] and
[repository] sections. It also does a bit of reworking of the structure
of this manpage and adds a labeled list under the repo sections where we
didn't have one before.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:25:23 -04:00
Dan McGee
b03b06cfd3 Implement parsing of the new SigLevel directive
Add code to conf.c that parses the new SigLevel directive. An
overwhelming number of options are presented, but most users will still
be fine with the Never/Optional/Required trio. More advanced users can
combine these or any of the other options on a 'SigLevel = ' line, which
is parsed in a left-to-right fashion and flags turned on and off
accordingly. For example, all three of these will net the same config:

    SigLevel = Required PackageOptional
    SigLevel = Optional DatabaseRequired
    SigLevel = DatabaseRequired PackageOptional

Additionally, database-specific lines assume you wish to start with any
global default that has been set. For example, if any of the above lines
were in the [options] section, something such as:

    SigLevel = PackageRequired PackageAllowMarginal

Would continue to enforce required database signatures.

Inspiration-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:25:09 -04:00
Dave Reisner
6997a738bb paccache: add new contrib script
paccache is a robust and flexible package cache cleaner with a variety
of options. Much credit goes to DJ Mills and Pat Brisbin for ideas
behind this script.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
[Dan: add .gitignore entry]
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:24:06 -04:00
Allan McRae
c55cbfbd5f pacman-key: follow gpg options for listing keys
The current --list option outputed the keys and all their signatures
which can be overly verbose.  It also did not take a list of keys on
the command line to limit its output (although the code suggests that
was intended).

That patch brings consistency with gpg, providing --list-keys and
--list-sigs options that function equivalently to those provided by
gpg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:20:42 -04:00
Dan McGee
cbaff216b3 Don't trim whitespace when reading database entries
We don't write with extra or unknown whitespace, so there is little
reason for us to trim it when reading either. This also fixes the
hopefully never encountered "paths that start or end with spaces" issue,
for which two pactests have been added. The tests also contain other
evil characters that we have encountered before and handle just fine,
but it doesn't hurt to ensure we don't break such support in the future.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:20:34 -04:00
Dan McGee
573260556d pactest: use subprocess module instead of os.system
This is more in line with standard Python practice, and makes keyboard
interrupts behave a lot more sanely. It also prevents the useless
spawning of a shell as well as simplifies the command building and
working directory stuff.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02 08:20:27 -04:00
Dan McGee
66d9995711 Revamp signing checks
This ensures we are actually making correct use of the information gpgme
is returning to us. Marginal being allowed was obvious before, but
Unknown should deal with trust level, and not the presence or lack
thereof of a public key to validate the signature with.

Return status and validity information in two separate values so check
methods and the frontend can use them independently. For now, we treat
expired keys as valid, while expired signatures are invalid.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28 18:46:52 -05:00
Dan McGee
aecd0740cf Tidy up testdb to match coding styles
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28 15:01:39 -05:00
Dan McGee
a3def7ac87 Make free_groupcache() private
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28 15:01:31 -05:00
Dan McGee
dffff9659b Merge remote-tracking branch 'dave/scripts-fixup' 2011-07-28 12:48:38 -05:00
Dave Reisner
e42d97b737 scripts/pkgdelta: exit properly on missing args
Removes usage of 'nounset' which, when combined with 'errexit' can cause
undesirable early exits.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-28 13:10:10 -04:00
Dave Reisner
e99b6a131e scripts/repo-add: show usage when no DB file specified
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-28 13:07:25 -04:00
Dan McGee
cd8747ba6d Unify modelines in Asciidoc files
This gets us close to using the same modeline in all files we run
through Asciidoc, as well as adding the spell and spelllang
declarations, just as we had in NEWS already.

The choice of 'en_us' is mainly for consistency and because the body of
work already uses these spellings.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28 11:42:08 -05:00
Pang Yan Han
804e2505cf pacman-key: Add --import and --import-trustdb
Currently, pacman-key allows the user to import their keys using the --add
option. However, no similar functionality exists for importing ownertrust
values.

The --import-trustdb option takes a list of directories and imports ownertrust
values if the directories have a trustdb.gpg database.

The --import option takes a list of directories and imports keys from
pubring.gpg and ownertrust values from trustdb.gpg. Think of it as a combination
of --add and --import-trustdb

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:53 -05:00
DJ Mills
c5d4c92ad4 pacman-key: change GPG_PACMAN and GPG_NOKEYRING to arrays
Allows the commands to safely handle any possible arguments

Signed-off-by: DJ Mills <danielmills1@gmail.com>
Allan: rebase patch
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:46 -05:00
Allan McRae
d9875c5e6c pacman-key: fix syntax error in -r arg parsing
Previous fix did not work...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:37 -05:00
Allan McRae
49d9426b6a makepkg: refactor checking source integrity
Move the source integrity checking into its own function as the code
was duplicated and is now more complicated with the separation of the
two checks types.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:23 -05:00
Allan McRae
2b3405e01b makepkg: more control of skipping integrity checks
Allows the skipping of all integrity checks (checksum and PGP) or
either the checksum or PGP checks individually.

Original-patch-by: Wieland Hoffman <theminew@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:13 -05:00
Wieland Hoffmann
94f61c5b29 makepkg: Add support for verifying pgp signatures
Many projects provide signature files along with the source code
archives. It's good to check these, too, when verifying the integrity
of source code archives.
Not everybody is using gpg so the verification can be disabled with
--skippgpcheck.
Additionally, only a warning is displayed when the key that signed the
source file is unknown.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:06 -05:00
Dan McGee
9929a34a6d Remove duplicate code shared between sync and upgrade
Pacman did a great job of having almost (but not quite) duplicate code
paths through the sync and upgrade code. We can use the same logic in
both upgrade in sync once the targets are resolved, so extract a
function and delete a bunch of code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:46:15 -05:00
Allan McRae
ccdb2fa800 makepkg: get package version with overrides
When epoch, pkgver and/or pkgrel were overridden in a split package
function, makepkg failed hard finding the real version for checking
if packages were already built or trying to install packages. Fix
the get_full_version function to deal with overrides and return the
actual package version.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:25 -05:00
Allan McRae
03447ce39c makepkg: allow epoch to be overridden
We can override pkgver and pkgrel so it is only logical to add epoch
to that list

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:18 -05:00
Allan McRae
a7940e7419 makepkg: check arch overrides for required architecture
Check any overrides of the "arch" variable contain the required
architecture.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:12 -05:00
Allan McRae
819f675004 makepkg: check overrides for pkgrel and pkgver
Enforce syntax checking for pkgrel and pkgver overrides in package
functions.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:06 -05:00
Allan McRae
00949db191 makepkg: pkgver and pkgrel can not have whitespace
There is always someone who tries to break things (cough *Dave* cough...)

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:44:59 -05:00
Dan McGee
06974ebf2f contrib/pacsearch: skip non-matching lines
This prevents some perl errors from popping up when pacman prints error
or warning messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:44:17 -05:00
Dan McGee
88644e181d Fix group selection entry for large inputs
Hardcoding anything always ends up burning you, and the arbitrary length
of 64 here did just that. Add the ability to reallocate the readline
buffer for longer inputs if necessary, and add other error checking as
approprate. This also plugs one small memory leak of the group
processing code selection array.

Addresses FS#24253.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-25 10:07:48 -05:00
Lukas Fleischer
005eab0a08 libalpm: Set ret correctly in download_internal()
Immediately jump to the cleanup code after setting the return code to -1
in case rename() fails. Otherwise, it will be reset to 0 right after we
leave the if branch.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-25 08:48:02 -05:00
Dave Reisner
98073afe55 pacman-key: refactor post parse opt check into a case
This is a cleaner expression of the same information.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21 15:05:52 -05:00
Dave Reisner
768d3589a3 pacman-key: s/UPDATEBD/UPDATEDB/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21 15:05:39 -05:00
Dave Reisner
2bd1687f51 pacman-key: fix syntax error in -r arg parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21 15:05:30 -05:00
Dave Reisner
9f500f684d pacman-key: return $ret, not errors
fixes: /usr/bin/pacman-key: line 286: return: errors: numeric argument required

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21 15:04:49 -05:00
Dan McGee
bb3dada871 Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.

1. Iteration is much more performant, due to a reduction in pointer
   chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
   linked list as the file struts are now laid out consecutively in
   memory.
3. Memory allocation has been massively reworked. Before, we would
   allocate three different pieces of memory per file item- the list
   struct, the file struct, and the copied filename. What this resulted
   in was massive fragmentation of memory when loading filelists since
   the memory allocator had to leave holes all over the place. The new
   situation here now removes the need for any list item allocation;
   allocates the file structs in contiguous memory (and reallocs as
   necessary), leaving only the strings as individually allocated. Tests
   using valgrind (massif) show some pretty significant memory
   reductions on the worst case `pacman -Ql > /dev/null` (366387 files
   on my machine):

   Before:
     Peak heap:   54,416,024 B
	 Useful heap: 36,840,692 B
	 Extra heap:  17,575,332 B

   After:
     Peak heap:   38,004,352 B
	 Useful heap: 28,101,347 B
	 Extra heap:   9,903,005 B

Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21 15:04:30 -05:00
Dan McGee
058ee17371 contrib: add paclog-pkglist to gitignore
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21 15:03:33 -05:00
Dan McGee
70d6fe6632 Clean up my debug logger mess
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 00:23:42 -05:00
Dan McGee
61410814c2 Merge remote-tracking branch 'allan/pacman-key' 2011-07-18 21:10:56 -05:00
Dan McGee
05f7c0280e Fix test suite when GPGME is disabled
As noted by Allan, we failed pretty hard if gpgme was compiled out. With
these changes, only sign001.py fails. This can/will be fixed later once
we beef up the test suite with more signing tests anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 21:06:24 -05:00
Dave Reisner
f1d25ba2dd pacman/callback: show .sig suffix on sig download
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 21:01:12 -05:00
Pang Yan Han
333269482a pacman-key: --init: correct creation of gpg.conf
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Pang Yan Han
fa3aaa41e3 pacman-key: correct spelling mistake
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Allan McRae
7e5dea5d32 pacman-key: add dependency on parse_options to Makefile
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Allan McRae
31c9a521b4 pacman-key: check required permissions on keyring
Makes sure that the pacman keyring is readable and that the user
has permissions to create a lock file if lock-never is not specified
in the gpg.conf file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Allan McRae
0c9e86bab1 pacman-key: add --init option
Add an --init option that ensures that the pacman keyring has all
the necessary files and they have the correct permissions for being
read as a user.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Dave Reisner
0be9e4a4cd pacman-key: tidy up logic for finding pacman keyring directory
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Dave Reisner
df7b390514 pacman-key: refactor get_from
This function had a variety of pitfalls, including the inability to
successfully find a key=value pair where no whitespace surrounded the
equals sign. Make it more robust by splitting the line on the equals
itself, and performing whitespace trimming on the resulting key/value
pair.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Allan McRae
0e85c4989b pacman-key: add --verify option
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:54 +10:00
Allan McRae
fec10d4a65 pacman-key: check only a single operation has been specified
Follow the example of gpg and only allow a single operation to be
specified each time.  Prevents having to deal with conflicting
variable names and potential issues due to the order in which the
operations are run.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
74f6d717a3 pacman-key: move verifying keyring files to own function
Also check all files before bailing on errors.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
74e5a494b0 pacman-key: move --edit-key and --receive processing to functions
This moves the processing of the --edit-key and --receive options
to functions, keeping the final option processing to be all single
line statements.

Also rework the --edit-key option to validate all input before
processing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
7963c5d000 pacman-key: update man page
Update man page to reflect current options.  Also add a description
on how to manually interact with the pacman keyring with gpg.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Ivan Kanakarakis
e37adcd664 pacman-key: hide output of executed commands on logic checks
This commit correctly redirects to /dev/null the output of several
commands that get executed on logic checks.

Original-patch-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com>
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
e458606ad2 pacman-key: rename --trust to --edit-key
This keeps the naming of the option more consistent with what is
actually being called by gpg.

Original-patch-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Ivan Kanakarakis
15ca6dca5c pacman-key: fix quotation on several variable assignments
This commit adds quotes to several variable assignments. Unquoted values
can cause problems on several occasions if the value is empty. It is
safer to have every assignment quoted.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
2011-07-19 10:27:53 +10:00
Allan McRae
b300b991a7 pacman-key: allow the export of all key ids
The gpg --export will exprt all keys if none are specified. Replicate
this behavior in pacman-key.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
8ee0724558 pacman-key: rename --del to --delete
There is already the short -d alias provided, so stay verbose with
the longer option name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
95d7e16163 pacman-key: remove the --adv option
The conversion to using parse_options causes this option to break.
It is preferable to remove the option rather than fix it as it is
simply a wrapper for "gpg --homedir @sysconfdir@/pacman.d/gnupg".
Any user using more advanced keyring management than provided by
pacman-key can manage to point gpg at the right place themselves...

How to manually edit the keyring with gpg will instead be documented
in the man page in a later commit.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Allan McRae
7d205a70a2 pacman-key: use our option parser
The pacman-key script is complicated enough to warrent usage of the
parse_options script.  This is especially helpful in dealing with
all the configuration file override flags as the no longer need to
be specified first.  It also allows us to do the right thing early
with --help/--version and no option cases cleanly. This change also
makde the check for root privileges only occur on operations where
they are needed.

This patch is inspired by and supercedes some patches submitted by
Denis A. Altoé Falqueto and Ivan Kanakarakis who were altering the
previous option handling in an attempt to deal with the above issues.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-19 10:27:53 +10:00
Dave Reisner
d86a60c694 PKGBUILD.vim: add new var and assert bash syntax
* assert is_bash to pickup more valid syntax
* add checkdepends highlighting

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-18 11:50:47 -04:00
Florian Pritz
dad96ccce2 replace access() calls for debug info where applicable
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:44:28 -05:00
Florian Pritz
89c070b263 signing.c: check if needed files are readable
If we can't read the keyring, gpgme will output confusing debug
information and fail to verify the signature, so we should log some
debug information.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:44:07 -05:00
Florian Pritz
29a96bcfe1 add _alpm_access() wrapper
This is a wrapper function for access() which logs some debug
information and eases handling in case of split directory and filename.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:42:48 -05:00
Dan McGee
48e2a1a119 Merge branch 'maint' 2011-07-18 10:41:37 -05:00
Allan McRae
297cd7897b makepkg: fix issue with filenames with spaces and noextract
Specifying a filename with spaces in a PKGBUILDs noextract array fails
due to a lack of quoting.

Fixes FS#25100.

Reported-by: Thomas Weißschuh <thomas_weissschuh@lavabit.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:41:27 -05:00
Allan McRae
c0fe1743e5 Fix compilation without gpgme
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:36:41 -05:00
Allan McRae
f0e34be990 configure: output more compile settings
Add information on CPPFLAGS, LDFLAGS and LIBS to the end of the
configure output. This is very helpful in tracing issues when
adjusting the configure file and also will allow us to more
easily replicate any issues discovered due to a users build
environment.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:36:28 -05:00
Allan McRae
36db8c5047 makepkg.conf: remove curl from other common tools
It is now set as the main tool, so make wget another common one.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:36:13 -05:00
Allan McRae
49427d1fb4 repo-add: do not print full path of signature file
The full path to the signature file when it is created is in a temporary
directory so only print the filename.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:35:57 -05:00
Allan McRae
bf120635a7 repo-add: always remove repo signature symlink
This prevents a dangling symlink being left behind if the repo goes
from being signed to unsigned.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:35:47 -05:00
Dave Reisner
3934a842b8 contrib/paclog-pkglist: whitespace cleanup
add a modeline and change 2 space indent to a tab.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:35:12 -05:00
Dave Reisner
3294039a00 contrib/paclog-pkglist: rework as bash wrapping awk
Avoid some pain in awk's limited handling of command line arguments by
wrapping this in a Bash script. We also default to
@localstatedir@/log/pacman.log when no args are specified, meaning that
-h or --help is required to get the help message.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:34:56 -05:00
Dan McGee
0b92d9ed9c Add a new epoch pactest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:34:39 -05:00
Dan McGee
1c39e4fbad Handle removal of empty directories properly
This addresses FS#25141. We shouldn't remove every empty directory we
come across during the removal process unless it is truly not known to
any other package. This will prevent removal of essential directories
such as '/var/lock/'.

This is accomplished by first checking the empty/non-empty status of a
directory, which was previously done implicitly by calling rmdir() and
ignoring errors. We do this to avoid the next (new) check in most cases,
which is to look at all local packages to see if the to-be-removed
directory is present in another packages' filelist. If we do not find it
anywhere, then we remove it, else we keep the file around.

The pactest has been updated to test more cases, as well as finding a
flaw in the original expected to fail case- we need separate DIR and
FILE based EXIST rules.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:34:05 -05:00
Rogutės Sparnuotos
3a04267cdd makepkg: only test for writable PKGDEST when needed.
There is no need for a writable PKGDEST when using the --nobuild or
--geninteg flags.

Allan: added --geninteg
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:28:19 -05:00
Allan McRae
65847fad44 Move some .gitignore entries
Put a .gitignore entry at the right level and sort that file
alphabetically.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:28:19 -05:00
Dan McGee
e209955606 doc/PKGBUILD: clarify scriptlet version arguments
It was a bit unclear that both pkgver and pkgrel were included in the
passed version strings; clarify this fact in the manpage. Also include
epoch in the mix now that it exists.

Also make two other minor consistency touchups to code-print variables
in text.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 16:12:15 -05:00
Dan McGee
8f72ffbc45 Make alpm_db_set_pkgreason() arguments more sane
This can only ever operate on the local database, and a local package at
that. Change the function signature to take a handle and package object,
add the relevant asserts, and ensure the frontend can detect the package
not found condition when finding packages to pass to this method.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:59:57 -05:00
Dave Reisner
0fe93bc34c contrib/paclog-pkglist: new contribution
converts a pacman log file to a list of installed packages, which should
match the output of `pacman -Q'.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:49:34 -05:00
Dave Reisner
1376ba5b0e contrib/bash_completion: update with new makepkg opts
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:49:21 -05:00
Dave Reisner
6907a22b27 makepkg: remove unused -C option from option list
We nuke it from the completion file as well along with its longopt.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:49:13 -05:00
Dave Reisner
727e03fe19 makepkg: skip devel_check when reading from a pipe
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:44:48 -05:00
DJ Mills
282be6bf4b makepkg: Remove pre-optimization from in_array()
The '[[ -z' test in in_array() is redundant, so remove it.

Signed-off-by: DJ Mills <danielmills1@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-14 15:42:37 -05:00
DJ Mills
7f5b24597b makepkg: Remove OPT_TEMP hack in parse_options call
Instead of hacking around the error trap, simply do an explicit
test for failure.

Signed-off-by: DJ Mills <danielmills1@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-14 15:42:29 -05:00
Dan McGee
af357d6ab0 Allow fileconflict if unowned file moving into backup array
The bulk of this commit is adding new tests to ensure the new behavior
works without disrupting old behavior. This is a relatively sane maneuver
when a package adds a conf file (e.g. '/etc/mercurial/hgrc') that was
not previously in the package, but it is placed in the backup array. In
essence, we can treat the existing file as having always been a part of
the package and do our normal compare/install as pacnew logic checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:34:04 -05:00
Dan McGee
36e48573ce Add 'compress' compression format as an available option
This adds the '.tar.Z' option to both repo-add and makepkg for no other
reason than "why not", and because bsdtar supports it natively with the
'-Z' flag. Also update the documentation accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 14:58:46 -05:00
Dan McGee
00628c7268 Unify package removal code
This code duplication has always been a rather clumsy casuality of
fixing some past upgrade issues. Unify the removal code across upgrade
and remove operations into  a new _alpm_remove_single_package() method
wihch makes it very clear how we handle upgrade and remove differently,
via several conditionals on newpkg.

This commit highlights interesting behavior such as the fact that the
implicit removal in every package upgrade never gets transaction events
or progress callbacks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-06 09:26:09 -05:00
Dan McGee
1d53dd716d include util.h in rawstr.c
Fixes "error: no previous prototype for '_alpm_raw_cmp'
[-Werror=missing-prototypes]" warnings, and also prevents someone from
getting the prototypes and functions out of sync.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 22:36:40 -05:00
Dan McGee
b678e00271 Merge remote-tracking branch 'dave/download' 2011-07-05 22:01:29 -05:00
Dave Reisner
57eac093c4 absorb fileinfo struct into dload_payload
This transitional struct becomes delicious noms for dload_payload.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-05 23:00:03 -04:00
Dave Reisner
3eec745910 absorb some _alpm_download params into payload struct
Restore some sanity to the number of arguments passed to _alpm_download
and curl_download_internal.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-05 23:00:02 -04:00
Dave Reisner
6dc71926f9 lib/dload: prevent large file attacks
This means creating a new struct which can pass more descriptive data
from the back end sync functions to the downloader. In particular, we're
interested in the download size read from the sync DB. When the remote
server reports a size larger than this (via a content-length header),
abort the transfer.

In cases where the size is unknown, we set a hard upper limit of:

* 25MiB for a sync DB
* 16KiB for a signature

For reference, 25MiB is more than twice the size of all of the current
binary repos (with files) combined, and 16KiB is a truly gargantuan
signature.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-05 22:58:55 -04:00
Dave Reisner
6c9b82e72a dload: handle irregular URLs
URLs might end with a slash and follow redirects, or could be a
generated by a script such as /getpkg.php?id=12345. In both cases, we
may have a better filename that we can write to, taken from either
content-disposition header, or the effective URL.

Specific to the first case, we write to a temporary file of the format
'alpmtmp.XXXXXX', where XXXXXX is randomized by mkstemp(3). Since this
is a randomly generated file, we cannot support resuming and the file is
unlinked in the event of an interrupt.

We also run into the possibility of changing out the filename from under
alpm on a -U operation, so callers of _alpm_download can optionally pass
a pointer to a *char to be filled in by curl_download_internal with the
actual filename we wrote to. Any sync operation will pass a NULL pointer
here, as we rely on specific names for packages from a mirror.

Fixes FS#22645.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-07-05 22:58:27 -04:00
Allan McRae
eda741ae93 repo-add: backup old database signature too
If you are keeping a copy of the old database, you probably want
to keep a copy of its signature too.  Also, delete the previously
backed-up database signature if no new one is being copied.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 21:40:26 -05:00
Dan McGee
043931ca45 Rework -Si display logic
We did some funny stuff here before to allow specifying fully-qualified
package names, such as 'testing/gcc' or 'core/gcc'. However, it was done
by duplicating code, not to mention an early escape if a repository
could not be found for an early target. Something like `pacman -Si
foo/bar core/gcc' would not give expected results, although `pacman -Si
bar gcc' would.

Clean up the code, remove strncpy() usage, and clarify the error
messages a bit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 21:38:32 -05:00
Allan McRae
e2f00abe26 pacman-key: fix syntax highlighting
The lone quotation mark in "pacman's" causes issues for some syntax
highlighting. Change the printing of the nessage from echo to printf
so we can invisibly escape it.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 21:38:07 -05:00
Dave Reisner
62880d7568 contrib/paclist: rewrite in bash
The original concept for this script was a bash implementation, but
turned out to be unreasonable at the time due to the efficiencies of the
database format. Since those have been resolved, we can rewrite this in
bash as a much simpler script.

All the action happens in a single line, but we add extend this a
little, binding to gettext to keep our pacman translations intact.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 21:37:18 -05:00
Florian Pritz
36474af463 fix segfault if pacman.conf can't be read
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 21:36:46 -05:00
Dan McGee
ae7139adcf Remove most usages of strncmp()
The supposed safety blanket of this function is better handled by
explicit length checking and usages of strlen() on known NULL-terminated
strings rather than hoping things fit in a buffer. We also have no need
to fully fill a PATH_MAX length variable with NULLs every time as long
as a single terminating byte is there. Remove usages of it by using
strcpy() or memcpy() as appropriate, after doing length checks via
strlen().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 21:29:02 -05:00
Dave Reisner
44889da5b7 dload: rearrange code to avoid extra cpp block
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-05 17:18:23 -04:00
Dave Reisner
6cce517f1a lib/rawstr: borrow raw string functions from curl
We'll need these functions to do locale agnostic and case insensitive
string comparisons.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-05 17:18:23 -04:00
Allan McRae
dfc532668d makepkg: update --pkg desciption in man page
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:45 -05:00
Allan McRae
77a93328cf Add library files to POTFILES.in
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:37 -05:00
Allan McRae
bfd6d22be2 parse_options: accept multiple arguments
Allow command-line options to accept multiple arguments without
additional quoting by taking the list of arguments until one
starting with a "-" is reached.

The only current use of this is the --pkg option in makepkg.  This
allows (e.g.)

makepkg --pkg foo bar

and packages "foo" and "bar" will be built.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:31 -05:00
Allan McRae
87ee38d8b3 parse_options: implement optional arguments
This allows options specified with a trailing "::" to optionally
take arguments.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:25 -05:00
Allan McRae
ddb8617d96 parse_options: add missing newlines
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:20 -05:00
Allan McRae
24324ff0e1 Simplify alpm_list_previous
We can readily detect the first node in a list by checking if
node->prev->next is NULL. So there is no need to pass the head
of the list to this function and its prototype now looks like
all the other item accessors.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:11 -05:00
Allan McRae
97103f860d Remove alpm_list_first
The only thing this accessor did was remove the const qualifier
given our entire list implementation requires passing around the
head anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:05 -05:00
Dan McGee
c748eadc80 Allow invalid sync DBs to be returned by the library
They are placeholders, but important for things like trying to re-sync a
database missing a signature. By using the alpm_db_validity() method at
the right time, a client can take the appropriate action with these
invalid databases as necessary.

In pacman's case, we disallow just about anything that involves looking
at a sync database outside of an '-Sy' operation (although we do check
the validity immediately after). A few operations are still permitted-
'-Q' ops that don't touch sync databases as well as '-R'.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:13:20 -05:00
Dan McGee
07502f2d82 Allow frontend access to signature verification information
Show output in -Qip for each package signature, which includes the UID
string from the key ("Joe User <joe@example.com>") and the validity of
said key. Example output:

Signatures     : Valid signature from "Dan McGee <dpmcgee@gmail.com>"
                 Unknown signature from "<Key Unknown>"
                 Invalid signature from "Dan McGee <dpmcgee@gmail.com>"

Also add a backend alpm_sigresult_cleanup() function since memory
allocation took place on this object, and we need some way of freeing
it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:13:20 -05:00
Dan McGee
e8443b1685 Correctly check the GPG error codes
The error code is in fact a bitmask value of an error code and an error
source, so use the proper function to get only the relevant bits. For
the no error case, this shouldn't ever matter, but it bit me when I was
trying to compare the error code to other values and wondered why it
wasn't working, so set a good example.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:13:20 -05:00
Dan McGee
7af0ab1cde signing: move to new signing verification and return scheme
This gives us more granularity than the former Never/Optional/Always
trifecta. The frontend still uses these values temporarily but that will
be changed in a future patch.

* Use 'siglevel' consistenly in method names, 'level' as variable name
* The level becomes an enum bitmask value for flexibility
* Signature check methods now return a array of status codes rather than
  a simple integer success/failure value. This allows callers to
  determine whether things such as an unknown signature are valid.
* Specific signature error codes mostly disappear in favor of the above
  returned status code; pm_errno is now set only to PKG_INVALID_SIG or
  DB_INVALID_SIG as appropriate.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:13:20 -05:00
Dan McGee
1ce7f39ad7 Merge remote-tracking branch 'allan/ALPM'
Conflicts:
	lib/libalpm/be_local.c
	lib/libalpm/be_package.c
	lib/libalpm/conflict.c
	lib/libalpm/diskspace.c
	lib/libalpm/dload.c
	lib/libalpm/remove.c
2011-07-03 14:44:57 -05:00
Dan McGee
c839415e3f conflict code tweaks and cleanups
We can take advantage of a few things on our new and improved filelist
in this code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 14:29:30 -05:00
Dan McGee
26195f8da1 diskspace: remove all libarchive usage
Now that the filelists capture mode and size information, we can read
the data from there and prevent having to loop through and uncompress
every archive to check required diskspace usage.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 14:29:30 -05:00
Dan McGee
6a6fc3107f Move alpm filelists to a struct object
This allows us to capture size and mode data when building filelists
from package files. Future patches will take advantage of this newly
available information, and frontends can use it as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 14:29:30 -05:00
Dan McGee
a2995f586e pactest: add a few more checks to fileconflict checks
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:44:45 -05:00
Dan McGee
06840f14b4 Fix debug logger without a newline
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:44:26 -05:00
Allan McRae
a7b02d07f4 Do not replicate files list when removing packages
This saves replicating the potentially large list of files in a package
that is being removed.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:42:43 -05:00
Allan McRae
ab79b13079 Add alpm_list_previous method
Helper function to get the previous item in a list

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:42:24 -05:00
Dan McGee
f612e5ede7 checkdeps: remove unnecessary list join and copy
We can just perform the same search operation on both lists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:39:13 -05:00
Dan McGee
925d74f38d be_local: use macros in database loading similar to be_sync
This removes some of the repetition in the code for reading and parsing
database file lines.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:37:04 -05:00
Dan McGee
de8b9a85a5 be_sync: make READ_NEXT() a no-arg macro
We passed in 'line', but not 'buf.line'. In addition, the macros
building off of READ_NEXT() assume variable names anyway. Since we only
use these macros in one function, might as well simplify them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03 13:07:19 -05:00
Allan McRae
afc96f2ab3 Prefix _alpm_errno_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:39 +10:00
Allan McRae
bd88a8d551 Prefix alpm_transprog_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:39 +10:00
Allan McRae
495ba26e63 Prefix alpm_transconv_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:39 +10:00
Allan McRae
3189d3bc4a Prefix alpm_transevt_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:39 +10:00
Allan McRae
39262acab6 Prefix alpm_transflag_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:39 +10:00
Allan McRae
ca43fdd92f Prefix alpm_loglevel_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:38 +10:00
Allan McRae
d796d1cdda Prefix alpm_fileconflicttype_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:38 +10:00
Allan McRae
f818f570c5 Prefix alpm_depmod_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:38 +10:00
Allan McRae
eb39a9482b Prefix alpm_pkgreason_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-02 02:01:38 +10:00
Dan McGee
cf1401a04d signing: check validity of all available signatures
Change the check into a loop over all signatures present and returned by
GPGME. Also modify the return values and checks slightly now that I know
a little bit more about what type of values are returned.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 17:25:53 -05:00
Dan McGee
23a2d2c16a Make alpm_db_get_sigverify_level() public
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 16:16:41 -05:00
Dan McGee
68284da0d7 Add an alpm_db_get_valid() public function
This allows one to check if a database is valid or invalid.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 16:05:20 -05:00
Dave Reisner
6633b8e5c2 move proto files to new subdirectory, proto/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 13:37:58 -05:00
Dave Reisner
98a2fc8deb pacman: return with 128+signum on signaled exit
This is a convention that is widely followed in *nix and posix-ish
environments. We should follow it, too.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 12:43:57 -05:00
Dan McGee
35ffe6af2d pactest: remove no longer necessary newline hacks
libalpm can now cope with this as of commit 719e0d3ddb.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 12:02:33 -05:00
Dan McGee
0ed848a9ea pactest: create packages in memory
This is similar to what was just done for the sync databases. Move a few
pieces around so we never need to actually write out the filesystem to
create a package, and simply stream the tarfile out from the data we've
collected.

Once again, a few newline addition hacks and other things have to be
left in place in order not to break everything; this time however most
of the assumptions are in pactest and not libalpm.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 11:55:00 -05:00
Dan McGee
13235ba65a Make local_db_read() private to the local backend
There is little need to expose the guts of this function even within the
library. Make it static in be_local.c, and clean up a few other things
since we know exactly where it is being called from:

* Remove unnecessary origin checks in _cache_get_*() methods- if you are
  calling a cache method your package type will be correct.
* Remove sanity checks within local_db_read() itself- packages will
  always have a name and version if they get this far, and the package
  object will never be NULL either.

The one case calling this from outside the backend was in add.c, where
we forced a full load of a package before we duplicated it. Move this
concern elsewhere and have pkg_dup() always force a full package load
via a new force_load() function on the operations callback struct.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 11:51:49 -05:00
Dan McGee
b94e8ecd1f Fix a few warnings pointed out via clang scan-build
Some of these are legit (the backup hash NULL checks), while others are
either extemely unlikely or just impossible for the static code
analysis to prove, but are worth adding anyway because they have little
overhead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 11:51:36 -05:00
Florian Pritz
9efd10cd2a fix vim syntax highlighting of .sh files
vim recognises what type of shell script it's dealing with by looking at
the shebang. If detection fails it falls back to sh which doesn't
support some bash features. Adding a normal, possibly broken, shebang
which gets fixed by the Makefile allows vim to detect bash syntax.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:44:45 -05:00
Dan McGee
c2cce4f3f5 Merge remote-tracking branch 'dave/makepkg' 2011-06-30 10:41:49 -05:00
Dan McGee
ad577b3cb4 Merge remote-tracking branch 'allan/breakshit' 2011-06-30 10:37:08 -05:00
Dave Reisner
0f4aaeee42 lib/util: modify entry_prefix, not prefix
Modifying prefix caused tmp directories to be left behind after
running scriptlets, and the path '/' to be passed to _alpm_rmrf. Broken
in f01c6f.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:34:32 -05:00
Dave Reisner
002d2fda7a lib/alpm: unlock the handle before freeing it
This avoids, probably among other things, leaving the lock file in place
after a SIGINT'd sync DB update.

Fixes regression introduced in 4f8ae2b.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:33:24 -05:00
Dave Reisner
2860ade2f5 repo-add.sh.in: avoid being clever with repo repacking
Revert to the old behavior that 6f5a90 attempted to simplify and go with
the original proposed solution of using "ugly" bash to detect empty
directories.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:32:15 -05:00
Dan McGee
84974ed04c repo-add: fix db creation one last time
We fubar-ed this pretty good.

1. The whole old/new move shuffle was totally busted if you used a
relative path to your database, as we would just build the database in
place.
2. Our prior temp directory layout had the database files extracted
directly into it. When we tried to create a xxx.db.tar.gz file in this
same directory, due to the fact that we were no longer using a shell
wildcard, we tried to include the db in ourself, which is a big failure.
Fix all this by extracting to tree/ so we can have a clean top-level
temp directory.
3. Fix the inclusion of the './' directory entry; ensure the regex
prunes both leading paths of '.' as well as './'.

Where is that test suite again?

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:29:55 -05:00
Dan McGee
c2e6a01a28 makepkg: only source user override if using default config file
Otherwise there is no way to easily test or run with a standalone config
file without outside interference.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:29:49 -05:00
Rémy Oudompheng
4c80f994c3 makepkg: fix typo (missing quotes)
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:28:24 -05:00
Allan McRae
e92905a2c8 makepkg: fix removing symbolic link
The path was not being stripped from $file before prefixing with
$srcdir resulting in the attempted removal of a very weird
filename.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:28:18 -05:00
Allan McRae
fed3e09c94 Use ignoregroup rather than ignoregrp in the handle
This matches the naming in pacman.conf.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-29 16:00:25 +10:00
Allan McRae
b1894ccf06 Rename internal functions with grp in their name
The following function renames take place for the same reasoning as
the previous commit:

  _alpm_grp_new -> _alpm_group_new
  _alpm_grp_free -> _alpm_group_free
  _alpm_db_free_grpcache -> _alpm_db_free_groupcache
  _alpm_db_get_grpfromcache -> _alpm_db_get_groupfromcache

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-29 15:52:33 +10:00
Allan McRae
f1bb56cebf Rename public functions with grp in their name
Using grp instead of group is a small saving at the cost of clarity.
Rename the following functions:

  alpm_option_get_ignoregrps -> alpm_option_get_ignoregroups
  alpm_option_add_ignoregrp -> alpm_option_add_ignoregroup
  alpm_option_set_ignoregrps -> alpm_option_set_ignoregroups
  alpm_option_remove_ignoregrp -> alpm_option_remove_ignoregroup
  alpm_db_readgrp -> alpm_db_readgroup
  alpm_db_get_grpcache -> alpm_db_get_groupcache
  alpm_find_grp_pkgs -> alpm_find_group_pkgs

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-29 15:46:49 +10:00
Dave Reisner
9a29888ba7 makepkg: simplify SIGNPKG check
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-28 23:15:58 -04:00
Dave Reisner
5f6e8c9274 makepkg: fix vim syntax highlighting
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-28 23:05:57 -04:00
Dave Reisner
452bf71cec makepkg: remove unneeded echo
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-28 23:05:57 -04:00
Allan McRae
3bb469d558 Update README with changes to struct names
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
7633c14bd5 Rename _pmdbstatus_t to _alpm_dbstatus_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
028b965e1a Rename pmdbinfrq_t to alpm_dbinfrq_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
925f42e460 Rename pmtransstate_t to alpm_transstate_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
71fa9f912d Rename pmpkghash_t to alpm_pkghash_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
57b9b19b10 Rename pmgraph_t to alpm_graph_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
08fc1db24c Rename pmpkgfrom_t to alpm_pkgfrom_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
ddad400900 Rename pmerrno_t to alpm_errno_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
1059df7486 Rename pmtransprog_t to alpm_transprog_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
565e167356 Rename pmtransconv_t to alpm_transconv_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
011ef6be0e Rename pmtransevt_t to alpm_transevt_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
590a8fcb1e Rename pmtransflag_t to alpm_transflag_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
0aef91bc4f Rename pmloglevel_t to alpm_loglevel_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae
cd1e39ba62 Rename pmbackup_t to alpm_backup_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
bfe1771067 Rename pmdelta_t to alpm_delta_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
1fdbe79022 Rename pmgrp_t to alpm_group_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
37b6cceed4 Rename pmfileconflict_t to alpm_fileconflict_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
220842b37b Rename pmconflict_t to alpm_conflict_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
6d876f9b6b Rename pmdepmissing_t to alpm_depmissing_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
9540dfc4d9 Rename pmdepend_t to alpm_depend_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:23 +10:00
Allan McRae
6b62508c86 Rename pmtrans_t to alpm_trans_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:27:16 +10:00
Allan McRae
8a04bc25a1 Rename pmpkg_t to alpm_pkg_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:26:39 +10:00
Allan McRae
939d5a9511 Rename pmdb_t to alpm_db_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 14:16:12 +10:00
Allan McRae
64c1cf7921 Rename pmhandle_t to alpm_handle_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 14:04:00 +10:00
Allan McRae
1c5c7c907c Rename pmfileconflicttype_t to alpm_fileconflicttype_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 13:58:59 +10:00
Allan McRae
0a80cf31cf Rename pmdepmod_t to alpm_depmod_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 13:56:46 +10:00
Allan McRae
7ce674491b Rename pmpkgreason_t to alpm_pkgreason_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 13:54:04 +10:00
Dan McGee
9aab1440ca Revert "Merge branch 'master' of git://projects.archlinux.org/pacman"
This reverts the merge of 2d32a9a3a3,
which reverts the commit 8581694ceb.

Thanks Dave for the dirty branch and non-clean rebase! :) Dave broke it.
2011-06-27 21:43:58 -05:00
Dan McGee
97e1dd9318 repo-add: remove extra exit call
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 15:08:14 -05:00
Dan McGee
09c803783d pacman-optimize: use output library
We already use msg() and error() in here, might as well just use the
standard functions. In addition, fix one translated message that would
have printed ERROR twice if anyone ever saw it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 13:30:41 -05:00
Dan McGee
a12acbc2ff Merge remote-tracking branch 'dave/repo-add' 2011-06-27 13:30:37 -05:00
Dave Reisner
db172b09c5 repo-add: add new command, repo-elephant
_    _
  / \__/ \_____
 /  /  \  \    `\
 )  \''/  (     |\
 `\__)/__/'_\  / `
    //_|_|~|_|_|
    ^""'"' ""'"'

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27 14:10:03 -04:00
Dave Reisner
399184d68f repo-add: enforce file extensions
Allow one of 4 archive extensions: .tar{,.gz,.xz,.bz2} for each of the 2
valid repo extensions: .db and .files. Check for this via
'verify_repo_extension' directly after option parsing to assert that
this extension is present, and again after files have been added to get
the proper archive option for bsdtar.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27 13:39:02 -04:00
Dave Reisner
122b4c2187 repo-add: move command invocation out of arg parsing loop
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27 13:39:02 -04:00
Dave Reisner
6f5a90edb3 repo-add: refactor repacking of repo file
Dump the whole conditional and filter the contents of the directory to
create an empty or non-empty archive.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27 13:39:02 -04:00
Dan McGee
865ac0f055 Remove setter for DB signature level
This should have been removed with commit db3b86e7f3 but was
erroniously left behind.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 11:57:43 -05:00
Dan McGee
f01c6f814a Fix several -Wshadow warnings
Only one of these looked like a real red flag, in find_requiredby(), but
it doesn't hurt to fix several of them up anyway.

Unfortunately, we can't turn this on universally due to things like the
sync(), remove(), etc. builtins which we often use as variable names.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 10:10:08 -05:00
Dan McGee
77a09c92c6 Merge branch 'maint'
Conflicts:
	lib/libalpm/conflict.c
2011-06-27 09:33:27 -05:00
Eric Bélanger
51ed7dff0d Remove -f option from ln for POSIX compliance
Fixes FS#24893.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:24:41 -05:00
Eric Bélanger
f5dc5c46e0 makepkg: Add warning if VCS tool is not present when determining latest VCS revision
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:24:28 -05:00
Eric Bélanger
bdd8ebd631 makepkg: Move check for sudo into check_software function
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:24:19 -05:00
Allan McRae
6a413fe72f Remove two alpm_list_count usages
We have just looped through the list of files, so might as well get
the count as we go.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:19:08 -05:00
Allan McRae
93c77565f6 Add scripts po directory to autoclean.sh
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:16:47 -05:00
Dan McGee
e378170c25 Ensure a file can be replaced by a directory
This addresses FS#24904. In a normal upgrade case, this replacement
seems to work just fine. However, when doing a sync "replace" type
upgrade, we weren't properly handling this edge case due to path
comparison not ignoring trailing slashes. Fix this by pruning any
trailing slashes past a certain point of file conflict resolution where
we no longer need them, which allows us to safely detect cases such as
now tested in the new pactest.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:15:31 -05:00
Dan McGee
f8f4c2a6f3 File conflict code cleanups
While researching the root cause of FS#24904, I couldn't help but clean
up some of the cruft in here. A few whitespace/line-wrapping issues, but
also fix shadowed variables and add some const where applicable.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27 09:15:28 -05:00
Dave Reisner
3725998cbc pactree: add -s option to walk sync DBs
Add a whole lot of bloat to parse pacman.conf and only a few lines to
use the list of sync DBs instead of the local DB.

Dan: I fully plan on this being temporary and us finding a better way in
the future to parse pacman.conf from multiple binaries. Adding a
standalone config parser is probably not the right way of going about
things, but for now it is by far the easiest.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 14:18:07 -05:00
Dan McGee
777bdc6c50 Make sync DB reading a bit more flexible
We can reorganize things a bit to not require reading a directory-only
entry first (or at all). This was noticed while working on some pactest
improvements, but should be a good step forward anyway.

Also make _alpm_splitname() a bit more generic in where it stores the
data it parses.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 14:04:39 -05:00
Dan McGee
719e0d3ddb archive_fgets(): ensure we return any trailing text with no newline
Discovered this when doing some pactest rewrite work to generate
archives in memory only. If a sync database file or PKGINFO file is
missing a newline on the final line, the text from that line gets tossed
aside and never read into the package struct. This is pretty critical
when that last line is a depend or something.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 14:03:51 -05:00
Dan McGee
1187edb38c valgrind.supp: add known leaks from GPGME
Thank you too, GPGME, for these. Why don't you provide a way to
clean up your static variable mess?

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 14:03:35 -05:00
Dave Reisner
112858ae61 repo-add.8.txt: document valid DB file extensions
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 14:55:49 -04:00
Dave Reisner
7d8e9b8ed6 repo-add: use format_entry for all desc/depends fields
This ranks high on the code readability scale. The same function formats
all of our data and writes to the metadata file at once.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 14:55:49 -04:00
Dave Reisner
5246fdecf6 repo-add: store multi-value fields as arrays
Fields like groups and depends should be stored as arrays. This requires
rewriting our write_list_entry function to accomodate our new data type.
This new function will not write to a file, but rather only format it.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 14:55:49 -04:00
Dave Reisner
522c94f168 repo-add: bashify reading of .PKGINFO file
grep and sed aren't needed here, and this removes the truly ugly
manipulation of IFS. The process substituion could just as well be a
herestring, but it breaks vim's syntax highlighting. Style over
substance, mang.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 14:55:49 -04:00
Dave Reisner
2d32a9a3a3 Merge branch 'master' of git://projects.archlinux.org/pacman
* 'master' of git://projects.archlinux.org/pacman:
  pactree: carry a list of databases for dep resolution
  makepkg: Remove a lone quotation mark
  makepkg: remove the cleancache option
  Don't require a transaction for sync DB updates
  Move locking functions to handle
  Add a 'valid' flag to the database object
  Move database 'version' check to registration time
  Do database signature checking at load time
2011-06-24 14:55:32 -04:00
Dave Reisner
e06586ceb4 pactree: carry a list of databases for dep resolution
Declare an alpm_list which, for now, only holds our local database.
walk_deps and walk_reverse_deps are refactored to account for this, and
a helper function is added to wrap alpm_db_get_pkg for traversing a
list.

This is groundwork for letting pactree walk the sync DBs.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 13:37:09 -05:00
Wieland Hoffmann
61cb8e76c3 makepkg: Remove a lone quotation mark
Allan broke it in 4bdb868.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 13:36:46 -05:00
Allan McRae
c45cfb1741 makepkg: remove the cleancache option
This is a fairly useless feature given all it does is an "rm" on a
directory.  It is also unlikely that you would want to remove the
entire SRCDEST anyway, but rather just the old files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 13:36:38 -05:00
Dave Reisner
8581694ceb makepkg: fix incorrect parenthesis in gettext call
allan broke it in 4bdb868a.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 08:36:54 -04:00
Dan McGee
4f8ae2bab6 Don't require a transaction for sync DB updates
Instead, just do the required locking directly in the backend in calls
to alpm_db_update().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 04:11:38 -05:00
Dan McGee
7b8f8f69f1 Move locking functions to handle
These operate on the handle, and the state is stored on the handle, so
move them where they belong. Up until now only the transaction stuff
calls them, but this will soon change and alpm_db_update() will handle
locking all on its own.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 04:02:58 -05:00
Dan McGee
79e98316ea Add a 'valid' flag to the database object
Start by converting all of our flags to a 'status' bitmask (pkgcache
status, grpcache status). Add a new 'valid' flag as well. This will let
us keep track if the database itself has been marked valid in whatever
fashion.

For local databases at the moment we ensure there are no depends files;
for sync databases we ensure the PGP signature is valid if
required/requested. The loading of the pkgcache is prohibited if the
database is invalid.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 03:46:12 -05:00
Dan McGee
1150d9e15a Move database 'version' check to registration time
This is another step toward doing both local database validation
(ensuring we don't have depends files) and sync database validation (via
signatures if present) when the database is registered.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 03:31:32 -05:00
Dan McGee
db3b86e7f3 Do database signature checking at load time
This is the ideal place to do it as all clients should be checking the
return value and ensuring there are no errors. This is similar to
pkg_load().

We also add an additional step of validation after we download a new
database; a subsequent '-y' operation can potentially invalidate the
original check at registration time.

Note that this implementation is still a bit naive; if a signature is
invalid it is currently impossible to refresh and re-download the file
without manually deleting it first. Similarly, if one downloads a
database and the check fails, the database object is still there and can
be used. These shortcomings will be addressed in a future commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 02:34:50 -05:00
Allan McRae
94d22f9309 Document group and providers selection
The format required for selection of packages within the group selection
dialog is not entirely obvious, so provide some documentation.

Fixes FS#24134.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-24 02:02:40 -05:00
Allan McRae
4bdb868ac8 makepkg: clean-up of output messages
There was a lot of inconsistency in how strings that should not be
translated (program names, option flags, PKGBUILD directives, etc) were
handled. This patch moves them all outside the gettext invocation for
consistency and to prevent accidental translation.

Note that some of these may need reverted if they cause difficulties in
translation due to gettext usage in bash not taking positional parameters
for arguments. A quick survey of current translations indicates that this
issue will be rare.  Also, we should be able to catch these before a full
string freeze given we are going to probably need a "developer preview"
release before the next release series.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-24 02:02:21 -05:00
Dan McGee
624a878701 pactest: generate sync DB's in memory
Sync database are no longer exploded on the filesystem. Rework the logic
used to generate our test databases so we can create them completely in
memory without having to write the individual files to disk at all. The
local database is unaffected.

Note that several shortcomings in libalpm parsing were discovered by
this change, which have since been temporarily patched around in this
test suite:

* archive_fgets() did not properly handle a file that ended in a
  non-newline, and would silently drop the data in this line.
* sync database with only the file entries and not the directories would
  fail to parse properly, and even cause segfaults in some cases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee
63335859d1 pactest: refactor install file creation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee
f15cce1d41 pactest: move filelist/backup generation into package object
These are definite methods that operate on a package, so move them there
which cleans up util a bit more.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee
3ace8ceb23 pactest: make pmfile a bit more pythonic
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee
11d8418737 pactest: small cleanups and chmod -x most files
Remove empty docstrings, small and easy pylint fixes, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee
763d638ca1 pactest: clean up database section writing
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:48 -05:00
Dan McGee
a8c3202836 pactest: add isize attribute, fix url attribute
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:47 -05:00
Dan McGee
f12ead2cf2 Remove three unnecessary usages of alpm_list_count()
For the files count when loading from a package, we can keep a counter.
The two in the frontend were completely useless due to the fact that if
sync_dbs is non-NULL, alpm_list_count() will always be greater than 0.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:47 -05:00
Dan McGee
d589a7b5db Prevent segfault when parsing unexpected sync database file
This doesn't fix the real (bigger) problem of failing to parse sync
databases without directory entries, but it does prevent the parser from
segfaulting when the first desc file encountered did not have a
directory entry, among other conditions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 01:36:47 -05:00
Dave Reisner
e27a5c8851 parse-options: simplify unused-arg & parameter printing
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 00:02:06 -05:00
Dan McGee
ac7d17f88e Merge branch 'po-split' 2011-06-23 23:44:35 -05:00
Dave Reisner
d8d287b4d2 repo-add: fix path designation regression
b899099 made path checking a bit more strict than I had intended, and
would actually forbid creation of a repo in $PWD if only the filename
was specified. readlink would be the fun and easy solution here, but
it's avoided due to portability issues, making the validation process a
bit more verbose.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 23:27:07 -05:00
Dan McGee
d62a429b92 scripts/po/: add pacman-key
This has gettext strings, but wasn't added to the list of files in
POTFILES.in just yet. Add it and update the catalogs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:55:57 -05:00
Dan McGee
c699c0b154 src/pacman/po/: prune message catalog and translations
Now that we have performed the split, prune the catalogs of all
scripts-only messages.

All old messages were pruned from the files using the following command:
    sed -i -e '/^#\~/,$d' *.po

Note: the diff on this commit looks much less insane if the --patience
option is used.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:55:56 -05:00
Dan McGee
963b942bb9 scripts/po/: prune message catalog and translations
Now that we have performed the split, prune the catalogs of all
pacman-only messages.

All old messages were pruned from the files using the following command:
    sed -i -e '/^#\~/,' *.po

Note: the diff on this commit looks much less insane if the --patience
option is used.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:50:30 -05:00
Dan McGee
a4a7006a13 po/: split into scripts/po/ and src/pacman/po/
This is the first step at separating the pacman message catalog and the
scripts message catalog. Makefiles, configure.ac, and other such files
are adjusted accordingly, as well as renaming files. The TEXTDOMAIN of
scripts is also adjusted.

Note that no actual pot or po files get changed here; these will get
pruned in a future commit so each catalog contains only the necessary
messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:50:01 -05:00
Dan McGee
78f297dabe Update all translation files
This is for the eventual 4.0.0 release, but more importantly to
logically separate new translations and strings from the PO split about
to happen between pacman and scripts.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:49:59 -05:00
Dan McGee
fa3aa6441c Let configure gettext setup know we use ngettext()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:49:59 -05:00
Eric Bélanger
eedd56f320 makepkg: Added checks in check_software for distcc, ccache, strip and gzip
Dan: slightly shorten some of the messages.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 21:39:37 -05:00
Dan McGee
aa89a65a83 makepkg: remove distcc/makeflags option interaction
Way back in c94bfbaba when refactoring makepkg options handling, I added
these lines to unset MAKEFLAGS if '!distcc' was set in a PKGBUILD (not
taking into account makepkg.conf settings). This was an attempt to say
"if it is broken in distcc, it is probably broken even more". However,
this is silly as one should be using '!makeflags' as well. Remove the
linkage.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 21:35:52 -05:00
Dan McGee
54ef162a1a Convert backup list to new pmbackup_t type
This allows us to separate the name and hash elements in one place and
not scatter different parsing code all over the place, including both
the frontend and backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 12:31:12 -05:00
Dan McGee
886a31ef20 makepkg: fix 'check_sofware' typo
Allan broke it!

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 11:51:58 -05:00
Dave Reisner
85902d98e8 repo-add: style cleanup
Unify function braces to be top right opening, bottom left closing.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 11:22:36 -05:00
Kerrick Staley
3d4bf3b3fd Fixed outdated documentation in test/pacman/README
test/pacman/README mentioned the -A flag, which no longer exists.

Signed-off-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 11:13:52 -05:00
Allan McRae
7468956236 makepkg: add software check function
Add a function that checks for the software needed by makepkg to
process a PKGBUILD with the requested options.  This allows makepkg
to bail early in the packaging process.

Many other checks can be added to this function...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:49:33 -05:00
Allan McRae
e97541c208 Remove old TODO lists
These had not been touched since 2007 and had lost most of their
relevance.  The bug tracker is a better place for the filing of
ideas.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:48:14 -05:00
Allan McRae
41f9fa9bed makepkg: move comment into correct place
Oops... Introduced by commit d21f6ca4.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:47:12 -05:00
Allan McRae
3497eb4e2c makepkg: adjust libprovides/depends messages
Contractions are less clear for non-native speakers so should be
avoided (and cause syntax highlighting issues).  Also, the 'provides'
and 'depends' strings are not to be translated.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:46:38 -05:00
Allan McRae
508b360c24 makepkg: allow specifying alternative build directory
Add a BUILDDIR variable (which can be overridden in the environment)
to specify an alternative location for building the package. This is
useful for people who want to build on a different filesystem for
improved performance (e.g. tmpfs).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:45:55 -05:00
Allan McRae
b803a33a8f makepkg: Add UPX compression support
This patch enables the automatic compression of executable binaries
using UPX when the 'upx' options is specified in makepkg.conf or the
PKGBUILD.  Additional arguments can be passed to UPX by specifying
the UPXFLAGS variable.

Original-patch-by: Bryce Gibson <bryce@gibson-consulting.com.au>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:45:18 -05:00
Dave Reisner
b899099327 repo-add: show better error when path to repo does not exist
Previously, the error message when trying to add to a repo where a
parent directory didn't exist was:

==> ERROR: Failed to acquire lockfile: /path/to/noexist/repo.tar.gz.lck

This sucks. Make an explicit check to ensure that the path to the repo
really does exist, and throw a meaningful error message when it can't be
found.

Dan: reuse an existing (translated) error message.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 11:22:39 -05:00
Dan McGee
ee638415e3 repo-add: allow creating a database with no compression
A plain '.tar' ending should be allowed. This corresponds to how we
handle this extension in makepkg. Also fix up the other extension
checks, which were missing a leading '.' character.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 11:08:40 -05:00
Dave Reisner
ab53aa3e3c repo-add: use bash equivalents of basename/dirname
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-20 10:44:20 -05:00
Dave Reisner
3847446603 lib/util: call _alpm_log before setting handle->pm_errno
This is an unfortunate chain of events. RET_ERR and RET_ERR_VOID will
eventually call CHECK_HANDLE, which resets the handle's pm_errno member.
Dan probably had a reason for doing this, so we merely switch the order
of operations in the RET_ERR macros to avoid stomping on our pm_errno.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-20 10:43:54 -05:00
Dan McGee
81e6071e0f pactest: add retcode=0 to several tests
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:36:01 -05:00
Florian Pritz
34876e4fe9 makepkg: fix broken syntax (double $)
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:20:52 -05:00
Dan McGee
36d98b3919 Improve cachedir removal and error handling
* Check the return value of canonicalize_path() for non-NULL
* Use ASSERT and RET_ERR as appropriate
* Make remove_cachedir() use same path munge logic as add_cachedir()

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:18:29 -05:00
Kerrick Staley
83071f579c Documented _alpm_download()
Documented the _alpm_download() function in dload.c

Signed-off-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:18:03 -05:00
Kerrick Staley
d980bd403d Documented purpose of be_*.c
Added a line to the top of each of be_local.c, be_package.c, and
be_sync.c indicating their purposes.

Signed-off-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:17:54 -05:00
Dave Reisner
620cddfc13 pacman/util.c: support terminals with unknown width
Add detection for stdout being attached to a tty device. When this check
fails, return a default width of 0, which callers interpret to mean
"don't wrap". Conversely, when our term ioctl suceeds but returns 0, we
interpret this to mean a tty with an unknown width (e.g., a serial
console), in which case we default to a sane value of 80.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-20 00:11:46 -05:00
Dan McGee
0f26e3aa5b Correctly duplicate delta objects
We were using copy_data before; this works for the struct itself but not
the strings contained within. Fix it up by duplicating all the data as
we do with our other structures.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:10:11 -05:00
Dan McGee
deb5601d8d Clean up util md5sum method
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:08:15 -05:00
Dan McGee
0ee9ced4cb Merge branch 'public-structs' 2011-06-20 00:07:10 -05:00
Dave Reisner
eb2d607899 lib/handle: use CALLOC macro instead of bare calloc
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:05:03 -05:00
Dan McGee
36ae77dd49 Don't call public API in _alpm_log()
Calling get_logcb() here would reset any previous setting of
handle->pm_errno due to the CHECK_HANDLE() macro contained within. This
would make error setting a bit funny if one set pm_errno before calling
_alpm_log(), such as in the RET_ERR() macro.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:03:53 -05:00
Dan McGee
25b7df4dab Make pmgrp_t public
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16 11:58:04 -05:00
Dan McGee
51359e6d33 Make pmdelta_t public
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16 11:58:04 -05:00
Dan McGee
7f6c1a76c6 Make pmdepend_t and pmdepmissing_t public
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16 11:57:33 -05:00
Dan McGee
19fcc74016 Make struct pmconflict_t public
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16 11:57:30 -05:00
Dan McGee
bdf00d3dbd Make pmfileconflict_t type public
This removes the need to write accessor methods for every type we have,
and simplifies the API. Any type that doesn't need magic* can be
converted in this fashion to make it easier for frontend applications to
use, as well as make it less of a pain to introduce new such structs in
the future.

* "magic" meaning something like pmpkg_t where values can be lazy loaded.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16 11:57:06 -05:00
Dan McGee
1cd6515af0 API: change 'signaturedir' to 'gpgdir'
This is more in line with reality and what we have our makepkg, etc.
options named anyway.

Original-patch-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 12:02:29 -05:00
Allan McRae
d21f6ca4aa makepkg: create source package inside fakeroot
Create source package files inside the fakeroot environment to
ensure reasonable ownership of files within the archive.

Fixes FS#24330.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:20:52 -05:00
Allan McRae
06cb713f39 Clean up makefile for script generation
We no longer have any python scripts in our scripts/ directory so
we can simplify the makefile a bit.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:19:56 -05:00
Allan McRae
e27e658033 parse_options: adjust error messages
Provide consistent error messages for unknown long and short options.
Also get full string translation for the messages.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:19:45 -05:00
Allan McRae
53f4e43191 scripts/library: add README file
Add a README file to briefly document the code snippets in the scripts
library folder.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:19:10 -05:00
Allan McRae
4272b37d3d scripts: refactor output formatting functions
Move the common output formatting functions into a separate
library file and import that into each script.  makepkg is
excluded due to its additional color formatting.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:18:05 -05:00
Allan McRae
6f3a2145b0 makepkg: move option parsing code to separate file
This move the getopt replacement function parse_options out of
makepkg.sh.in and into a separate file.  The code is inserted
into the relevant place in makepkg using m4.

This will allow the reuse of the option parsing code in other
scripts (i.e. pacman-key) while avoiding code duplication.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:16:38 -05:00
Dan McGee
5f404f2cb7 Merge branch 'maint' 2011-06-15 09:16:08 -05:00
Jakob Gruber
e92083798c Ensure humanize_size works for negative values
Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:14:00 -05:00
Jakob Gruber
5b33f48389 Use pm_fprintpf in table_create_format
Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:13:51 -05:00
Allan McRae
700a5374f1 makepkg: reword purge message
Clarfiy that it is unwanted files are being removed rather than "other"
files (whatever they are...).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:13:02 -05:00
Dan McGee
6eee3f6781 list_display: fix incorrect assignment
Commit 895a888865 erroneously left this around.

Noticed-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:11:47 -05:00
Allan McRae
4664a095a4 Fix man page generation for out of tree build
Fix failure at man page generation when building outside the source tree.
There may still be issues with other documentation types...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 08:49:39 -05:00
Dan McGee
82a701401c valgrind.supp: add known leak exposed by cURL
This one comes courtesy of OpenSSL and some static initialization.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 12:01:07 -05:00
Florian Pritz
ef3ec2603d doc/PKGBUILD: misc changes
Acked-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2011-06-14 10:21:57 -05:00
Dan McGee
2f5f157274 Rename and rework signing helper methods
* Don't name static methods with a gpgme_ prefix to avoid confusion with
  methods provided by the library. These are static and local to our
  file so just give them sane non-prefixed names.
* Rework sigsum_test_bit() to not require assignment.
* Don't balk if there is more than one signature available (for now,
  only check the first).
* Fix error codes in publicly visible methods to return -1, not 0, if pkg
  or db are not provided.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 10:18:43 -05:00
Dan McGee
71fd34e596 Alpm pkg accessors: ensure pkg argument is non-NULL
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 10:09:35 -05:00
Dan McGee
ee015f086f Ensure handle is valid and pm_errno is reset when calling into API
We didn't do due diligence before and ensure prior pm_errno values
weren't influencing what happened in further ALPM calls. I observed one
case of early setup code setting pm_errno to PM_ERR_WRONG_ARGS and that
flag persisting the entire time we were calling library code.

Add a new CHECK_HANDLE() macro that does two things: 1) ensures the
handle variable passed to it is non-NULL and 2) clears any existing
pm_errno flag set on the handle. This macro can replace many places we
used the ASSERT(handle != NULL, ...) pattern before.

Several other other places only need a simple 'set to zero' of the
pm_errno field.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 10:01:08 -05:00
Dan McGee
be97276735 Avoid setting sigverify option twice
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 09:32:39 -05:00
Dan McGee
76a991c117 Conflict check and skip_remove code cleanups
* Move several variables into better scope
* const-ify a few variables
* Avoid duplicating filelists if it is unnecessary
* Better handling out out of memory condition when adding file conflicts
  to our list

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 09:30:46 -05:00
Dan McGee
ba63e31cc7 Small handle related cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 08:39:02 -05:00
Dan McGee
0074cadb3b Add handle argument to _alpm_pkg_should_ignore()
This allows callers to retrieve it from wherever is convenient, which
may or may not be on the package object itself.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 08:38:51 -05:00
Dan McGee
c206b3a6d5 Merge remote-tracking branch 'florian/sodeps' 2011-06-14 08:30:23 -05:00
Florian Pritz
d355376865 doc/PKGBUILD: misc changes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 08:30:18 -05:00
Dan McGee
fbb44a6e0d Merge branch 'maint'
Conflicts:
	doc/makepkg.conf.5.txt
2011-06-14 08:29:39 -05:00
Dan McGee
00a1b1deeb Remove alpm_db_get_url()
This method is old, it doesn't adequately check for a NULL server list,
and can easily be done using better API method we provide these days.
All former users of this method can get similar results by calling
alpm_db_get_servers() and using the data from the returned server list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14 08:26:58 -05:00
Eric Bélanger
07e97a5f2c Added check option to BUILDENV array in makepkg.conf man page
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 20:48:00 -05:00
Dan McGee
8be4db8caf Add a helper method for retrieving the DB signature path
Note that is a bit different than the normal _alpm_db_path() method; the
caller is expected to free the result.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:37 -05:00
Dan McGee
f6700d5c98 alpm_db_update(): refactor out sync dir create/check
This was a lot of stuff that can stand by itself for the most part.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:37 -05:00
Dan McGee
a775530941 conf: do batch processing of repo sections
We now parse an entire repo section and store all information about it.
When the next section is encountered or the end of the root config file
is reached, we will then process the stored information.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:37 -05:00
Dan McGee
c730ca5997 conf: _parseconfig() cleanups and documentation
* Function doxygen documentation
* Reuse a single strlen() call
* Prevent infinite recursion (limit to 10 levels)
* Other small cleanups

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:37 -05:00
Dan McGee
29ea0fa09f Always pass data to trans_commit()
Even though we currently don't use it here in the backend, we might as
well pass it in since we used it earlier.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:16 -05:00
Dan McGee
4d9278f87f Remove global handle variable
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:16 -05:00
Dan McGee
52bffd2457 Switch all logging to use handle directly
This is the last user of our global handle object. Once again the diff
is large but the functional changes are not.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:41:16 -05:00
Dan McGee
e2aa952689 Move pm_errno onto the handle
This involves some serious changes and a very messy diff, unfortunately.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:38:38 -05:00
Dan McGee
8b62d9bc0a Add handle argument to two more alpm methods
This takes care of alpm_checkdeps() and alpm_find_dbs_satisfier().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:35:22 -05:00
Dan McGee
70a86c14f4 Require handle for alpm_checkconflicts()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:35:22 -05:00
Dan McGee
d76341297a Require handle for alpm_pkg_load()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:35:22 -05:00
Dan McGee
fb3ad7f882 Add handle argument to alpm_(add|remove)_pkg()
This makes these functions consistent with the rest of the transaction
related API calls. We do an additional assert to ensure the handle
attached to the package is the same as the handle passed in.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:32:59 -05:00
Kerrick Staley
01ad3faee9 Added initialization code for database siglevel
The siglevel field of a newly created pmdb_t struct is now
initialized when it is created in _alpm_db_new().

Signed-off-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:32:59 -05:00
Dan McGee
bcd442761b Fix memory leak if package sig was invalid
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 17:44:49 -05:00
Dan McGee
c5761bfe41 Fix all current return(x) usages
A few of these snuck in as of late, some from the table display patches
that were using the previous format before we changed it after the 3.5.X
major release.

Noticed-by: Kerrick Staley <mail@kerrickstaley.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 17:43:11 -05:00
Dan McGee
895a888865 Fix list_display on non-ttys and other output fixes
commit c1f742d775 broke what was one of the tenants of out output-
if piping pacman output somewhere else, we shouldn't ever try to
line-wrap and indent print our output. This makes it easier for tools to
use output from pacman -Ss, -Qs, -Qi, etc. list_display() unfortunately
was given a default value of 80 rather than 0, so fix this.

Next, make some additional changes that ensure we don't insert an
unnecessary blank line if for some crazy reason the indent level (such
as on -Qi output) is greater than the number of columns. Accomplish this
by printing the first item unconditionally as we do in
list_display_linebreak().

Finally, teach indentprint to not wrap if the number of columns is less
than the indent level, this prevents some forms of ridiculous output
such as the following:

    Install Date   : Wed
                     08
                     Jun
                     2011
                     04:39:19
                     AM
                     CDT

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 17:04:35 -05:00
Florian Pritz
5689478c68 doc/PKGBUILD: document libdeps
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2011-06-09 23:18:23 +02:00
Dan McGee
ff7ad5fd73 commit_single_pkg(): Use handle object directly
Commit e68f5d9a30 did something a bit silly and changed the
scriptlet calls to use 'newpkg->handle' rather than the 'handle'
argument passed in. Use the handle directly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 15:32:28 -05:00
Dan McGee
ff8e519d4b Require handle for alpm_sync_sysupgrade()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:24:45 -05:00
Dan McGee
7d27cf8364 Require handle for alpm_db_register_sync()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:24:45 -05:00
Dan McGee
24000b83c9 Require handle argument to all alpm_trans_*() methods
Begin enforcing the need to pass a handle. This allows us to remove one
more extern handle declaration from the backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:24:45 -05:00
Dan McGee
17a6ac5675 Require handle argument to all alpm_option_(get|set)_*() methods
This requires a lot of line changes, but not many functional changes as
more often than not our handle variable is already available in some
fashion.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:24:45 -05:00
Dan McGee
7968d30510 Require handle argument to alpm_logaction()
This is the first in a series of patches to update the API to remove the
implicit global handle variable.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:24:45 -05:00
Dan McGee
e826c143d3 Kill all remaining 'PATH_MAX + 1' usages
The few remaining instances were utilized for buffers in calls to
snprintf() and realpath(). Both of these functions will always ensure
the returned value is padded with '\0', so there is no need for the
extra byte.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:16:55 -05:00
Dan McGee
9d6568da0f _alpm_lstat: only duplicate string if necessary
The vast majority of the time we will just be passing the same string
value on to the lstat() call. The only time we need to duplicate it is
if the path ends in '/'. In one run using a profiler, only 400 of the
200,000 calls (0.2%) required the string to be copied first.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:14:55 -05:00
Allan McRae
451cd2c88d Fix bracket type in makefile
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09 14:14:46 -05:00
Dan McGee
dfaeb6bb2c Merge remote-tracking branch 'allan/working' 2011-06-08 02:49:09 -05:00
Dan McGee
11ba7a0e8a Fix graph free valgrind warnings
Due to the way we set up the graph structure, we don't always have good
parent information. The changes made in dd8cf0c12d assumed this, so
back them out and just live with the dead pointers being there in the
memory while we are cleaning up after ourselves.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-08 02:49:03 -05:00
Dan McGee
beffab02c4 pactest: only create install file if necessary
We were testing whether there were any values in the array, rather than
looking if the values contained anything.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-08 02:48:52 -05:00
Dan McGee
2668782db2 Plug a memory leak
Introduced by me in commit cc25576f8b.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-08 02:48:43 -05:00
Allan McRae
87072ff639 Fix name of original files in scripts
Our scripts all currently say:

Generated from foo.in; do not edit by hand.

Fix this to say foo.sh.in, which is the actual original file name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-08 17:36:03 +10:00
Allan McRae
361b6a9403 pacman-key: add vim modeline and fix whitespace issues
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-08 16:48:56 +10:00
Allan McRae
80b024d56a pkgdelta: add vim modeline
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-08 16:44:38 +10:00
Allan McRae
45fe92bf39 Remove incorrect output with download only and IgnorePkg
When only downloading a package that is in IgnorePkg, pacman
incorrectly asks about installing.

e.g. with <pkg> in IgnorePkg in pacman.conf:

> pacman -Sddw <pkg>
:: <pkg> is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n]

This output is now silenced when downloading only.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-08 15:34:47 +10:00
Dan McGee
b059040011 Add late-breaking 3.5.3 NEWS
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 15:05:37 -05:00
Dan McGee
8c6a636cd9 Merge branch 'maint'
Conflicts:
	lib/libalpm/add.c
2011-06-07 11:43:12 -05:00
Allan McRae
c750114894 pacman-key: update copyright
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-07 11:39:18 -05:00
Dan McGee
4fdcf50d66 Revamp pacman setup code to handle new alpm initialize routine
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 11:37:05 -05:00
Dan McGee
19755b648c Update utilities for new initialize/release methods
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 11:37:05 -05:00
Dan McGee
fb4b422fc4 New signatures for alpm initialize and release
These new method signatures return and take handle objects to operate on
so we can move away from the idea of one global handle in the API. There
is also another important change and that deals with the setting of root
and dbpaths. These are now done at initialization time instead of using
setter methods. This allows the library to operate more safely knowing
that paths won't change underneath it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 11:37:05 -05:00
Dan McGee
992fa50dfd Add cachedirs one-by-one in set_cachedirs()
This addresses the issue where calling set_cachedirs() didn't
canonicalize the passed-in paths.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 11:36:30 -05:00
Dan McGee
c1a5b11f11 Be consistent with memory treatment for plural option setters
In all cases we should duplicate the passed-in list so the caller is
free to do with it as it pleases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 11:33:29 -05:00
Dan McGee
991b3ff7e6 Add helper methods for setting directory options
This keeps duplicate code to a minimum. This will come in more handy as
we refactor some of these option setters away.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 11:30:44 -05:00
Dan McGee
e62566a763 Transifex updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 10:52:57 -05:00
Allan McRae
67c33fb8ff Remove incorrect output when downloading only
When only downloading a package, pacman can produce some incorrect
output.

> pacman -Sddw nvidia-utils
warning: nvidia-utils-270.41.19-1 is up to date -- reinstalling

This line is now now silenced when using -Sw.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 10:51:46 -05:00
Allan McRae
3df88a1a01 makepkg: fix creation of source package with -p
When creating a source package using an non-local buildscript via
the -p option, the inclusion of changelog and install files would
fail. Fixes FS#24567.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 10:49:28 -05:00
Dan McGee
cc25576f8b Use standard errno codes in return from _alpm_archive_fgets
This allows us to not require the context (e.g. handle) when calling
this function. Also beef up the checks in the two callers of this
function to bail if the last return code is not ARCHIVE_EOF, which is
the expected value.

This requires a change to one of the pactest return codes and the
overall result of the test, but results in a much safer operating
condition whereby invalid database entries will stop the operation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 14:37:51 -05:00
Dan McGee
e68f5d9a30 Remove global handle dependencies from sync/upgrade paths
This kills a lot more global handle business off. sync.c still requires
the handle declaration for one reference that can't be changed yet; it
will be removed in a future patch which isolates all of the necesary API
changes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 13:18:36 -05:00
Dan McGee
d2f05f72f0 Remove global handle from remove.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:53:53 -05:00
Dan McGee
307a6de17a Remove global handle from some package and db code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:44:01 -05:00
Dan McGee
4015b23e8e Remove global handle from diskspace.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:36:13 -05:00
Dan McGee
7fc635fee0 Remove global handle from util.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:33:18 -05:00
Dan McGee
de36c5fac4 Push down extern handle variable to files that need it
This will make the patching process less invasive as we start to remove
this variable from all source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:23:32 -05:00
Dan McGee
7f98460e37 Add handle attribute to pmpkg_t struct
Similar to what we just did for the database; this will make it easy to
always know what handle a given package originated from.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:13:22 -05:00
Dan McGee
c47d25d74b Add handle attribute to pmdb_t struct
This is the first step in a long process to remove our dependence on the
global handle variable we currently share in libalpm, with the goal to
make things a bit more thread-safe and re-entrant.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:06:25 -05:00
Dan McGee
2102d1a2eb Remove unnecessary handle != NULL asserts
These are simple accessor functions for a struct; the handle never even
comes into play when calling these functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 11:54:58 -05:00
Dan McGee
78cbc045c1 Remove ALPM_LOG_FUNC macro
The usefulness of this is rather limited due to it not being compiled
into production builds. When you do choose to see the output, it is
often overwhelming and not helpful. The best bet is to use a debugger
and/or well-placed fprintf() statements.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 11:48:24 -05:00
Dan McGee
9d73b261cf Merge branch 'maint'
Conflicts:
	src/pacman/callback.c
2011-06-02 17:34:12 -05:00
Dan McGee
8f30e1b110 Show net upgrade size on -U/-S operations
If it is different than the raw installed size metric we already show,
compute the net upgrade size. For some sync operations, this can even be
negative if newer packages are smaller than the ones they replace
locally. Implements FS#12566.

Example:

    Targets (1): telepathy-glib-0.14.7-1

    Total Download Size:    1.07 MiB
    Total Installed Size:   15.72 MiB
    Net Upgrade Size:       -0.29 MiB

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-02 17:21:38 -05:00
Dan McGee
142c2132cf Add two currently failing test cases from bug reports
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-02 17:20:45 -05:00
Dan McGee
1744fe12d4 3.5.3 release preparation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-02 16:33:45 -05:00
Dan McGee
d63599719a repo-add: anchor exclusion pattern when generating filelist
Fixes FS#24534. Dotfiles, such as /etc/skel/.bash_profile, were not
being included in generated files entries. bsdtar --exclude option
supports anchors on the pattern, so using "^.*" instead of ".*" solves
our problem and still excludes all root-level dotfiles (e.g. .PKGINFO).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-02 08:04:06 -05:00
Dave Reisner
0d1fcd329f lib/dload.c: remove assumption in continuation logic
Callers to curl_download_internal now tell us if its okay to continue a
transfer, so obey this instead of using a heuristic.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 15:05:41 -05:00
Dave Reisner
8807cac100 dload: abort transfer on CURLOPT_LOW_SPEED_LIMIT
If a connection drops below 1kb/s for 10s, curl will kill the transfer
and we'll report failure. This is the average transfer speed over the
delta defined by CURLOPT_LOW_SPEED_TIME, so setting a low value here
shouldn't bother folks using 14.4k dial-up.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 15:05:30 -05:00
Dan McGee
c1f742d775 Ensure list_display works on outputs of unknown width
If getcols() returns 0, we were getting stuck before in a loop of no
return. Teach getcols() to take a default value to return if the width
is unknown, and use this everywhere as appropriate.

Also make a few other cleanups while diagnosing this issue, such as
const-ifying some variables.

Noticed-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 14:58:10 -05:00
Florian Pritz
73d5eb1edf makepkg: add libdepends support
The user adds libaries to the depends array without a version. These
must end with .so.
Example: depends=(glibc libc.so)

find_libdepends() looks for ELF files (not symlinks because these could
point outside of pkgdir) in $pkgdir, extracts the library sonames the
binary links to and outputs depends seperated by spaces.
This list contains all libraries needed by the package.
Example: libfoo.so=3-64

write_pkginfo() only keeps .so depends with version information and warns
the user about unneded ones.

Support-by: Thomas Bächler <thomas@archlinux.org>
Support-by: Christoph Schied <Christoph.Schied@uni-ulm.de>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
2011-06-01 21:34:16 +02:00
Dan McGee
8f1c873b5f doc: monospace attribute escape fixes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 12:56:38 -05:00
Pang Yan Han
5842dad7e7 pacman-key: print default gpgdir in usage
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 12:27:03 -05:00
Dan McGee
41da225336 Merge branch 'maint' 2011-06-01 12:13:49 -05:00
Pang Yan Han
fe9804a96d Update pacman manpage and pacman.conf for gpgdir
pacman.8.txt --gpgdir section is updated based on the pacman.conf manpage

pacman.conf is updated to include the default GPGDir

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 12:13:43 -05:00
Dan McGee
aad57cc06a doc: fix attribute substitution in monospaced text
When I switched all paths to use `` formatting, I didn't realize
substitution didn't work in these quote marks. Use ++ instead to ensure
attributes are substituted where appropriate.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 12:11:31 -05:00
Dan McGee
ac1726788c doc: update Makefile for new asciidoc resource location
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 12:11:24 -05:00
Dan McGee
1855b3073a doc: add a few more escapes and fix usage of {}
These addditional attributes come from the git asciidoc.conf file. Also,
fix a place where we used {treename} without escaping the braces,
causing the generated manpage to be missing text.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 11:46:13 -05:00
Pang Yan Han
7b26167580 Let pacman -v print GPG Dir
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01 11:30:34 -05:00
Florian Pritz
79f1a3c4a1 makepkg: add libprovides support
The user adds libaries to the provides array without a version. These
must end with .so.
Example: provides=(readline libreadline.so)

find_libprovides() looks for .so files (not symlinks because these could
point outside of pkgdir) in $pkgdir, extracts the library soname (ld
links the binary to this name) and outputs provides seperated by spaces.
This list contains all libraries provided by the package.
Example: libfoo.so=3-64

write_pkginfo() only keeps .so provides with version information and warns
the user about unneded ones.

Support-by: Thomas Bächler <thomas@archlinux.org>
Support-by: Christoph Schied <Christoph.Schied@uni-ulm.de>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
2011-05-27 13:29:22 +02:00
Pang Yan Han
e711e5b950 alpm_list: fix typo in doxygen comment
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-24 08:27:21 -05:00
Dan McGee
65c1880735 Bail early if we don't have a valid lockfile path
This addresses FS#24292. If one does the bad thing of not checking
pm_errno after calling set_dbpath(), you may not realize the
initialization process went wrong and calling trans_init() resulted in a
segfault. If we don't have a lockfile path, bail out and have
trans_init() fail.

Also remove a ALPM_LOG_FUNC call that was causing pm_errno to return "no
handle"; this was due to a log call in the handle setup (whereby the log
attempts to use a callback attached to the handle).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-19 17:42:22 -05:00
Dan McGee
11fb9c7674 Merge branch 'maint'
Conflicts:
	lib/libalpm/trans.c
	src/pacman/query.c
2011-05-19 17:17:32 -05:00
Dan McGee
f2c4e7e552 Coding style cleanups; add a null check
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-19 16:59:53 -05:00
Dan McGee
ba467779bb Ensure --print doesn't enable --noconfirm when not expected
This is at best a hack around the way we currently do our --print magic,
but at least prevents someone from shooting themselves in the foot as
indicated in FS#24287.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:52:49 -05:00
Dan McGee
aec60e3782 Fix segfault when uninstalling broken backed-up symlink
Issue FS#24230. If a symlink is broken and included in the removal
process of a package, we blew up and segfaulted due to
alpm_compute_md5sum() returning NULL and then performing a strcmp()
operation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:50:13 -05:00
Dan McGee
93f02f5793 Add test for FS#24230, dead backup symlink removal
This currently causes a segfault, which is bad news.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:32:33 -05:00
Dan McGee
3000b6b473 pactest: treat symlinks with more respect
Don't call os.stat() when we should be using os.lstat(); this allows us
to actually test dead symlinks that don't have a corresponding file. Add
a new LINK_EXIST rule that complements FILE_EXIST for a similar purpose.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:31:26 -05:00
Dan McGee
ac6f6b317a Transifex updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 10:19:21 -05:00
Dave Reisner
b9a2318bec trans.c: create transaction prior to checking DB version
The addition of the DB version check introduces a lag time between the
lockfile creation and the transaction initialization. In cases where the
local DB is large enough and/or the user's disk is slow enough, this
time is significant enough that its possible for a user to send a SIGINT
and leave behind a db.lck file.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 10:16:13 -05:00
Dan McGee
70cf4546d6 Don't balk on .sig files being invalid in package cache
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-10 17:39:22 -05:00
Dan McGee
2cd79bc853 Remove sync DB reregister check
It's your own damn fault if you do this, and this code is remnants from
an old time when we weren't very good at coding.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 15:26:19 -05:00
Dan McGee
dd95c96b8a Rework config parsing to reduce variable duplication
This removes the need to strdup() the section name at every decent into
an Include statement, as well as having duplicate DB pointers around
that are never used independently.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 15:16:52 -05:00
Dan McGee
0fbdfd02dc Refactor VerifySig option value parsing into standalone method
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 15:01:35 -05:00
Dan McGee
6b308d89f9 Merge branch 'maint' 2011-05-05 13:25:10 -05:00
Dan McGee
f2d696cd51 Don't null-check handle lists before setting
This needlessly prevents the easiest way available of clearing any of these
values. We can also do the same for the 'arch' value.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:46:42 -05:00
Dan McGee
42ab639bf7 Improve database server API
Currently we have one call that has all sorts of crazy behavior and doesn't
make a whole lot of sense. Go from one method to the normal four methods we
have for all of our other lists we use in the library to make it a lot
easier for a frontend to manipulate server lists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:31:09 -05:00
Dan McGee
b14c5477e5 Ensure populate error return codes are consistent
It must be -1 to differentiate it from a number of packages loaded
count.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:10:51 -05:00
Dan McGee
3045f09ef4 Logging changes during DB load
The switch from FUNCTION to DEBUG was ill-advised inside the local
database load. Instead, add a DEBUG level logger to both local and sync
database loads that shows the number of packages processed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:08:59 -05:00
Dan McGee
73c74355ab Make config parsing a two-part affair
This ensures we call any alpm_option type functions before registering
databases, making sure all paths and other defaults (e.g. sig
verification levels) have been set first. This will ensure we can
continue to allow crazy config files where [options] doesn't come first.

The diffstat on this commit is misleading; view with
-w/--ignore-all-space to get a better idea of what needed to be touched.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 11:48:12 -05:00
Dan McGee
bda208f823 Move parseconfig to conf.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 11:12:49 -05:00
Dan McGee
d360153bc6 pactest: run with root in /tmp and clean up automatically
This moves the generated root/ directory into /tmp, or at least a path
returned by tempfile.mkdtemp(), by default. This can make test runs
significantly faster if done when /tmp is a tmpfs.

If you are debugging a failed test, use the new --keep-root option to
not clean up and pactest will print the location of the generated root/
test directory.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 11:12:26 -05:00
Dan McGee
47de7973fd dload: ensure we return success if we found files on any mirror
We were erroring out in the case where a first (possibly bogus) mirror
would cause the download process to return a failure code, even though
subsequent servers had the file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 10:01:01 -05:00
Allan McRae
500a6f576d Dan broke my patch
Add a missing space.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-05-05 11:12:46 +10:00
Dan McGee
73553e60ec Fix incorrect memory allocation assignment
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 16:46:52 -05:00
Dan McGee
22b1338390 dload: make sure we never print a bogus error buffer
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 16:29:41 -05:00
Dan McGee
991bfb7cbf Merge branch 'maint' 2011-05-04 15:54:42 -05:00
Allan McRae
7680f46157 Deal with unused function parameters correctly
This started off removing the "(void)foo" hacks to work around
unused function parameters and ended up fixing every warning
generated by -Wunused-parameter.

Dan: rename to UNUSED.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:53:49 -05:00
Dan McGee
c4fccfe3e6 pactree: make -Wwrite-strings friendly
Use a few structs to hold configuration values we change given certain
options so we can be const-correct with string assignment across the
board. Behavior should be completely unchanged.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:49:47 -05:00
Dan McGee
e8a40526cb Fix warnings reported by -Wwrite-strings
These are places where we stuck a string constant in a variable not
marked as const.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:48:47 -05:00
Dan McGee
c03faa32f3 Reduce duplicate signing debug code and fix logic condition
We had a lot of similar looking code that we can collapse down into a
function. This also fixes errors seen when turning on some gcc warnings
and implicitly casting away the const-ness of the string. Free the list
when we are done with it as well.

Also, fix a logic error where we should be checking with &&, not ||.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:46:18 -05:00
Allan McRae
8fd9037cfd makepkg: quote variable that may contain spaces
Prevents failures when $PKGDEST contains spaces (FS#24002)

Patch-by: Sebastien Duthil
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-02 10:04:36 -05:00
Allan McRae
9a127d8ed4 Update PKGBUILD example
Add quotes around $srcdir/$pkgdir (FS#23960) and use a package()
function.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-02 10:04:13 -05:00
Dan McGee
4758cfe33f Merge branch 'maint' 2011-04-29 16:05:59 -05:00
Dan McGee
da24324e2d Transifex updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-29 16:04:13 -05:00
Matt Mooney
3ec723ddc7 pacman(8): grammar correction for relative clauses
Change "which" to "that" when used in a restrictive clause.
Replace usage of the relative prounoun "those" with a common noun for
added clarity.

Signed-off-by: Matt Mooney <mfm@muteddisk.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-29 15:58:59 -05:00
Matt Mooney
1b25cb80ba pacman(8): change "options" to "operation" when referring to -D
-D is an operation not an option.

Signed-off-by: Matt Mooney <mfm@muteddisk.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-04-29 15:58:32 -05:00
Dan McGee
9c552272e8 configure: add output showing what libraries will be used
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-27 16:59:08 -05:00
Dan McGee
97be2f0e0a Allow conditional compilation with GPGME
This makes it possible to omit usage of -lgpgme, just as we can do for
-lcurl and -lcrypto.

Thanks to Rémy Oudompheng for an initial stab at this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-27 16:58:58 -05:00
Dan McGee
b7b3fc2386 signing: add more detail to unexpected signature count error
Do a quick loop and count of the returned data so we can show how many
signatures were parsed and read.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:50:06 -05:00
Dan McGee
1d7ad5d24b Enhance GPGME debug output
Add some lookup functions for nice names for the various types used by
the library, and remove some fields that are of little use to us in the
debug output. This should make looking at key loading and verification a
bit easier, especially in determining what makes up our good and bad
criteria.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee
4d63ebe2fb Perform package verification at package load time
Both md5sum verification and PGP verification can and should be done at
package load time. This allows verification to happen as early as
possible for packages provided by filename and loaded in the frontend,
and moves more stuff out of sync_commit that doesn't really belong
there. This should also set the stage for simplified parallel loading of
packages later down the road.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee
1cf79eb8c8 sync_commit: refactor out validate_deltas
More stuff going on in the pre-committing stage that can be in a static
method to make things a bit more clear.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee
2df1534b78 sync_commit: refactor out file downloads
This part is almost completely self-contained, except building the list
of delta filenames that we use later to check their md5sums. Refactor it
into a static method so we can bring most of the code in sync_commit
closer to the method name.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee
225acbbff1 Rein in the complexity of the signature type
Given that we offer no transparency into the pmpgpsig_t type, we don't
really need to expose it outside of the library, and at this point, we
don't need it at all. Don't decode anything except when checking
signatures. For packages/files not from a sync database, we now just
read the signature file directly anyway.

Also push the decoding logic down further into the check method so we
don't need this hanging out in a less than ideal place. This will make
it easier to conditionally compile things down the road.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:33 -05:00
Dan McGee
31e55b8049 signing: let GPGME handle loading signatures from files
Rather than go through all the hassle of doing this ourselves, just let
GPGME handle the work by passing it a file handle.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:33 -05:00
Allan McRae
a7d33d0c36 repo-add: update copyright message
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:44:52 -05:00
Allan McRae
1cb1b0a52c repo-add: document -k option
Also unify the usage output with that given by repo-add itself.

Dan: use 'options', not 'option(s)'.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:44:22 -05:00
Allan McRae
036f98575c repo-add: check for gpg early
Check for the presence of gpg as soon as we know we need it.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:43:43 -05:00
Allan McRae
fade60088e repo-add: check for valid key when signing is requested
Follow the example of makepkg

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:43:25 -05:00
Denis A. Altoé Falqueto
59da64146d repo-add: add option to specify a different key to sign with
Add -k/--key option to specify a non-default key for signing
a package database.

Original-patch-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:43:01 -05:00
Allan McRae
2eab4ab033 repo-add: simplify usage message
Listing every option on the usage line becomes unweildly as more
options get added so simplify it. Also, provide a standard package
name in the repo-add example.

Dan: just use 'options' as we use elsewhere, not 'option(s)'.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:41:52 -05:00
Dan McGee
8b34aa50b9 Make dump_pkg_full a little less insane
The various "level" values were a bit crazy to decipher, and we were
doing some very interesting comparisons in certain places. Break it out
into two parameters instead so we can seperate the type from the extra
information display, and do things accordingly.

Nothing changes with the display of any of the five types we currently
show: -Si, -Sii, -Qi, -Qii, -Qip.

Something to note- we should expose the PKG_FROM enum type somehow, this
patch leaves the door open to do that quite easily.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 17:08:33 -05:00
Dan McGee
9579879b1b libalpm/dload: major refactor of signature downloading
There's a lot of related moving parts here:
* Iteration through mirrors is moved back to the calling functions. This
  allows removal of _alpm_download_single_file and _alpm_download_files.
* The download function gets a few more arguments to influence behavior.
  This allows several different scenarios to customize behavior:
  - database
  - database signature (req'd and optional)
  - package
  - package via direct URL
  - package signature via direct URL (req'd and optional)
* For databases, we need signatures from the same mirror, so structure
  the code accordingly.

Some-inspiration-from: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 17:08:33 -05:00
Dan McGee
204bbc4714 libalpm/dload: add allow_resume and reorder error checks
The allow_resume is the start of the fix to the "don't ever resume
database downloads" problem, as well as being useful for '.sig'
downloads as well. For now, we say "always allow resume", but this will
eventually get pushed down as necessary.

Error checks are reworked in order to correctly error out when a file is
not found on the remote end and reports 0 bytes downloaded. In addition,
the two error messages printed are now different as one reports a more
specific error message provided via the cURL error buffer.

Some example output from an -Sy run with [testing], [community],
[community2], [eee], and [nonexistant] defined as repos. [community2]
and [nonexistant] are both invalid, one using FTP and one using HTTP.

    :: Synchronizing package databases...
    testing is up to date
    community is up to date
    error: failed retrieving file 'community2.db' from ftp.archlinux.org : Given file does not exist
    error: failed to update community2 (FTP: couldn't retrieve (RETR failed) the specified file)
    eee is up to date
    error: failed retrieving file 'nonexistant.db' from code.toofishes.net : The requested URL returned error: 404
    error: failed to update nonexistant (HTTP response code said error)

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 17:08:33 -05:00
Dan McGee
934e8c79af Merge branch 'maint' 2011-04-22 17:08:12 -05:00
Dan McGee
e3268d5e88 Small translation update from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 17:07:58 -05:00
Dan McGee
e39c104d13 cleanup: add_pkg() and remove_pkg()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 15:58:34 -05:00
Dan McGee
53c749ce0a libalpm/dload: const and static correctness
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 15:58:19 -05:00
Dan McGee
1ff04b980f be_sync: use _alpm_db_get_sigverify_level()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-22 15:58:09 -05:00
Rémy Oudompheng
10b8cd75b3 sync.c: remove unnecessary check for PM_PGP_VERIFY_UNKNOWN
The value PM_PGP_VERIFY_UNKNOWN is reserved to error cases,
now that the signature verification level defaults to the
globally set level. The only error case is when handle == NULL,
which is false in the context of _alpm_sync_commit().

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21 12:14:34 -05:00
Rémy Oudompheng
dd7b17aa0a handle.c: force sigverify level not to be PM_PGP_VERIFY_UNKNOWN
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21 12:14:23 -05:00
Dan McGee
ada5bc1404 Merge remote-tracking branch 'remy/doxygen' 2011-04-21 12:12:29 -05:00
Ivan Kanakarakis
908e9f41ed pacman-key: improved reading of the configuration file
This commit replaces the find_config() function with the get_from()
function. get_from expects two arguments, the first is the file to
read and the second is the key to look for in the given file.
get_from returns the first matching value for the given key. The
file is expected to be in the format:
key = value
Each of 'key' 'equal sign' 'value' can be surrounded be random
whitespace.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21 12:10:31 -05:00
Ivan Kanakarakis
fdbcc9847d pacman-key: display the unsupported command to the user
If the user provides an unsupported command, inform the user that this
switch is unknown, display usage and exit.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21 12:09:23 -05:00
Ivan Kanakarakis
6f19a8c9f7 makepkg, pacman-key: unify help message with other scripts
The help message changed to match the one rankmirrors script has.
It's clearer as to what the --help switch does.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21 12:09:18 -05:00
Rémy Oudompheng
36737aebb7 alpm.h: add several missing documentation strings
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-21 07:45:27 +02:00
Rémy Oudompheng
96ad414d73 alpm.h: rationalize option getters/setters documentation
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-21 07:43:32 +02:00
Rémy Oudompheng
670b315c4d alpm.h: add/improve function documentation
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-21 07:08:35 +02:00
Dan McGee
442e1420f9 Rename gpgsig struct fields for clarity
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 20:11:26 -05:00
Dan McGee
3c5661ec3c Form the signature file location in one place
Since we do this for all cases anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 20:10:27 -05:00
Dan McGee
791928dc48 Header inclusion cleanup
This does touch a lot of things, and hopefully doesn't break things on
other platforms, but allows us to also clean up a bunch of crud that no
longer needs to be there.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 20:09:13 -05:00
Xavier Chantry
74994faee7 doc/pacman: split -Su description in 3 paragraphs
One paragraph for -Suu and one for -Su foo. Fixes FS#23451.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 19:51:10 -05:00
Dan McGee
4af6c72d79 syntax: if/while statements should have no trailing space
This is the standard, and we have had a few of these introduced lately
that should not be here.

Done with:
  find -name '*.c' | xargs sed -i -e 's#if (#if(#g'
  find -name '*.c' | xargs sed -i -e 's#while (#while(#g'

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 19:47:39 -05:00
Dave Reisner
6760ec2b77 Allow VerifySig to act as a default verification in [options]
* add _alpm_db_get_sigverify_level
* add alpm_option_{get,set}_default_sigverify

And set the default verification level to OPTIONAL if not set otherwise.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 19:42:01 -05:00
Dan McGee
2c8c763723 alpm.h: forward-declare shared enumerations
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 19:29:14 -05:00
Dave Reisner
91594a1ef8 style cleanup: cast as (type *) not (type*)
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 19:04:53 -05:00
Dave Reisner
fdcfcf28a2 lib: remove dead code in be_local and be_package
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-04-20 19:04:27 -05:00
Dan McGee
a6c05458d4 Put comments on their own line
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 19:00:59 -05:00
Allan McRae
4c31bc6e3f Add configure option to specify package signing key
Add the "GPGKEY" option to makepkg.conf for specifying signing packages
with the non-default key from the keyring.  Is overridded by makepkg's
--key option.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 18:58:55 -05:00
Allan McRae
cb35affd1b Document makepkg package signing options
Dan: fix some grammar issues.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 18:54:42 -05:00
Jakob Gruber
e95be3379a New VerbosePkgLists option
If enabled, displays package lists for upgrade, sync and remove
operations formatted as a table. Falls back to default list display if
insufficient terminal columns are available.

Example output:

:: Starting full system upgrade...
:: Replace libjpeg with testing/libjpeg-turbo? [Y/n]
resolving dependencies...
looking for inter-conflicts...

Remove (1):

Name     Old Version       Size

libjpeg  8.3.0-1        0.83 MB

Total Removed Size:   0.83 MB

Targets (5):

Name            Old Version  New Version       Size

libjpeg-turbo                1.1.0-1        0.20 MB
linux-firmware  20110201-1   20110227-1     8.23 MB
ncurses         5.7-4        5.8-1          0.92 MB
ppl             0.11.1-1     0.11.2-1       2.74 MB
v4l-utils       0.8.1-1      0.8.3-1        0.23 MB

Total Download Size:    12.32 MB
Total Installed Size:   58.82 MB

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 18:13:02 -05:00
Jakob Gruber
0152266dd3 Table formatted output functions
table_display takes a list of lists of strings (representing the table
cells) and displays them formatted as a table.
The exact format depends on the longest string in each column.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 17:41:13 -05:00
Dan McGee
50de7019c0 Merge branch 'maint' 2011-04-20 17:35:33 -05:00
Jakob Gruber
c3f3d0b81a Refactor display_targets for readability
Row handling is moved to its own function in preparation for verbose
package lists.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 17:33:13 -05:00
Dan McGee
ecf15be0a7 Remove outdated comments
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 17:32:16 -05:00
Jakob Gruber
84cfc13589 Use IEC unit prefixes
Display {KiB, MiB, ...} instead of {KB, MB, ...} since that's what's
actually being displayed.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 17:31:56 -05:00
Jakob Gruber
3c8a448a2f Add a utility function to humanize sizes
Converts the given size in bytes in two possible ways:
1) target_unit is specified (!= 0): size is converted to target unit.
2) target_unit is not specified (== '\0'): size is converted to the first
   unit which will bring size to below 2048.

If specified, label will point to the long label ('MB') if long_labels is
set or the short label ('M') if it is not.

Dan: use '\0' rather than 0 for the special value as a matter of coding
style for char variables.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 17:29:32 -05:00
Jakob Gruber
dcb6fb224d Remove ShowSize option
Dan: The commit message originally referenced "VerbosePkgLists", but I'm
going to change the name of the option. In addition, this patch serves
a purpose being standalone- we should really do things like this with
-S --print and hopefully -Q --print in the future.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 17:13:20 -05:00
Dan McGee
18c73b0002 Final updates for 3.5.2 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-18 11:27:35 -05:00
Dan McGee
1995561f56 3.5.2 translation updates from Transifex
And also a POT version and package version update.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-18 11:26:20 -05:00
Dan McGee
efd8ae483f Merge branch 'maint'
Conflicts:
	lib/libalpm/alpm.h
	lib/libalpm/trans.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-15 18:41:49 -05:00
Dan McGee
202ade1398 Include "config.h" in header files using off_t
This makes it absolutely dead easy to ensure off_t has the same length
in all compilation units. I just spent 2.5 hours bashing my head on an
issue related to this so damn it I'm fixing it for good.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-15 18:40:32 -05:00
Rémy Oudompheng
4ffda3f05b libalpm: consistently use int as return type for option setters
Currently the only error case then when handle == NULL.
However several handle functions return -1 on this error,
and a uniform API makes things simpler.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-15 18:37:10 -05:00
Dan McGee
dff2d916ba Remove indirection on get_name and get_version operations
For a package to be loaded from any of our backends, these two fields
are always required upfront. Due to this fact, we don't need them to be
backend-specific operations and can just refer to the field directly.

Additionally, our static (and thus private) cache package accessors had
a NULL check on pkg before returning the relevant field. Eliminate this
since they only way they are ever called is via the packages attached
callback struct, which would have caused the NULL pointer dereference in
the first place.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-15 18:37:09 -05:00
Dan McGee
dd8cf0c12d Move graph.h functions into graph.c
So we only need one copy in the final library, not one copy per time
used. Ensure all necessary includes are in place (especially to get the
right size of off_t each time it is compiled) by including "config.h" in
the new graph.c.

One small adjustment here makes the graph_free code more robust- ensure
we don't have invalid pointers after each iteration by looking at the
parents and children and adjusting accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-15 18:36:53 -05:00
Xavier Chantry
21a881ec68 pacman/query: correctly handle root files with -Qo
spotted by clang-analyzer (strcmp with NULL rpath is bad)

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-15 15:30:09 -05:00
Rémy Oudompheng
a93e058b68 makepkg.sh.in: fix a GNU-ism in su invocation
GNU su supports the -c option to specify a command to execute.
However, other flavours of su may have a different interpretation
of the '-c' flag (e.g. FreeBSD and OpenBSD).

The behaviour is correct when '-c' follows an explicit username.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-13 10:33:22 -05:00
Rémy Oudompheng
8e8391e17c alpm.h: fix typos in documentation
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-13 10:32:04 -05:00
Dan McGee
fa9cd98ecf Remove Korean language translation files
There is no actual translation done here yet, just a dormant Transifex
language with nothing checked in.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-12 01:33:19 -05:00
Dan McGee
8df7208d7b Don't create two pmpkg_t objects in be_package
Ensure we only have one- this looks like the result of a bad merge from
old 2008 signing code with the current stuff which has changed quite a
bit.

Originally-seen-by: Rémy Oudompheng <remyoudompheng@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-11 15:56:34 -05:00
Dan McGee
31cb210057 bacman: fix the fact that the depends file no longer exists
Addresses FS#23641.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-09 17:26:55 -05:00
Rémy Oudompheng
dbd7d49d31 alpm.h: document transaction flags
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-09 23:28:00 +02:00
Rémy Oudompheng
b750d3e7b0 More documentation for option getters/setters. 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
fa47dd9615 alpm.h: more documentation for pkgreason, depend and errno. 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
6ebb6fec8b Move documentation for public package function to alpm.h 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
3901ca1a6d alpm.h: organize doxygen documentation in groups 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
96432ab4ef Move documentation of public database functions to alpm.h 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
0c320b5a51 alpm.h: add documentation for package property accessors 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
aac9e7c280 Move documentation of public transaction functions to alpm.h 2011-04-09 22:36:43 +02:00
Rémy Oudompheng
ff6f6027f0 Fix broken documentation for alpm_trans_prepare()
The current state of the code does not allow to see immediately
that it returns a list of pmdepmissing_t structures.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-09 15:24:11 -05:00
Rémy Oudompheng
a479e0300b libalpm: set pm_errno correctly in alpm_trans_get_flags()
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-09 15:24:05 -05:00
Rémy Oudompheng
f888283910 diskspace: add the actually used statfs type in ifdefs
Some systems, like FreeBSD might define both statfs
and statvfs: however if statvfs exists whereas getmntinfo()
uses a statfs struct, the current ifdefs would select the wrong
line of code.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-06 15:56:21 -05:00
Dan McGee
c5addd94e3 Merge branch 'maint'
Conflicts:
	lib/libalpm/be_sync.c
	lib/libalpm/db.c
	src/pacman/util.c
2011-04-05 00:49:30 -05:00
Xavier Chantry
272e9b355b libalpm/be_local.c: unused variable ent
spotted by clang analyzer

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-04-04 23:35:51 -05:00
Xavier Chantry
ff1974c6e9 libalpm/pkghash.c: unused variable ptr
spotted by clang analyzer

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-04-04 23:35:39 -05:00
Xavier Chantry
2f71d1dc00 pacman.c : useless extra parenthesis
clang 3.0 git complained about these

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 23:33:39 -05:00
Rémy Oudompheng
40fd8123a2 makepkg: fix a GNU-ism in awk usage
A non-GNU version of awk may not support the (|...) syntax for
an optional group and require '()' to match an empty string.
The (...)? syntax is more appropriate for this usage.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:49 -05:00
Allan McRae
37df0d4f4f makepkg: improve parsing for sanity checks
Trailing backslahses can lead to additional spaces at the front
of extracted entries.  See FS#23524.  Strip these while parsing
the PKGBUILD entries.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:40 -05:00
Rémy Oudompheng
fc334b4e77 db.c: set pm_errno appropriately in alpm_db_set_pkgreason()
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:27 -05:00
Dan McGee
6a8b1c4f84 Coding style cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:27 -05:00
Dan McGee
38e5a4a54f test: fix invalid usage of 'type -p'
The vercmptest script needs to be invoked as a bash script for this to
be valid; the -p operator is interpreted as an argument to look up by
sh. This goes way back to commit 3bf9448943, done to solve
http://mailman.archlinux.org/pipermail/pacman-dev/2008-July/007180.html.

Saw this problem running in a virtual machine where sh is not bash, but
in fact dash:

    user@debian-powerpc:~/projects/pacman$ ./test/util/vercmptest.sh
    src/util/vercmp-p: not found
    src/util/vercmp is src/util/vercmp
    vercmp binary (src/util/vercmp) could not be located

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:27 -05:00
Rémy Oudompheng
0458572a6e util.c: include limits.h for PATH_MAX macro
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-02 12:40:12 -05:00
Rémy Oudompheng
c377107346 Fix compatibility with older versions of libarchive.
There is no reason to not support versions of libarchive that lack
ARCHIVE_COMPRESSION_UU. Distributions should work properly without
this.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-02 12:39:04 -05:00
Xavier Chantry
a461837835 dload: dont forget to initialize open_mode
That's a funny one, building with optimization levels (with both gcc and
clang) caused open_mode to always be set to "ab", which worked.

This was spotted both with clang-analyzer, and by Jakob who reported a
segfault as he was using an un-optimized build.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-02 12:37:17 -05:00
Xavier Chantry
0e03c0849d configure.ac: we use fabs now so -lm is needed
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-02 12:37:03 -05:00
Dan McGee
d8d89d8d27 Ensure stdout/stderr are flushed when asking questions
Addresses FS#23492, where the question was shown without knowing what
one was answering to. Ensure we flush our output streams before printing
the question, and flush the stream on which we ask the question before
waiting for an answer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-01 15:18:52 -05:00
Dan McGee
7f6d986ac9 Add default changelog functions to pkg_operations
So we don't segfault when calling this on be_sync loaded packages. They
return logical values as much as possible for indicating there is no
changelog available.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-01 15:13:37 -05:00
Dan McGee
39fd8bc318 Ensure dbpath is not null when populating sync database
We didn't do this sanity check before trying to open an archive. If
the alpm dbpath wasn't set, the sync database dbpath would be NULL,
causing us to hang indefinitely in archive_read_open_filename() rather
than erroring out.

We already have a corresponding check in local_db_populate().

The following program will test this case, and hangs before this patch
without the call to set_dbpath:

	int main(int argc, char *argv[]) {
		alpm_initialize();
		// alpm_option_set_dbpath("/var/lib/pacman/");
		pmdb_t *core = alpm_db_register_sync("core");
		pmpkg_t *pkg = alpm_db_get_pkg(core, "pacman");
		return 0;
	}

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-01 14:31:50 -05:00
Dan McGee
20c4928ee1 Ignore upcoming new values in sync backend
PGPSIG and SHA256SUM are new and we can safely ignore them for now if
we come across them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-01 12:31:48 -05:00
Allan McRae
a164c8405a makepkg: remove unnecessary tr usage
The use of "tr" only leads to trouble.  Remove unnecessary usage
of it from within makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-30 20:43:36 -05:00
Dave Reisner
541c2470b8 makepkg: avoid usage of tr to sidestep locale issues
to quote dan:
  "turkish will FUCK YOU UP. this is not the first or the last time"

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-30 20:43:11 -05:00
Dan McGee
3089c833ff Unify filelist operation functions in conflict checking
We had two functions that were oh so similar but slightly different. We
can combine them and add some conditional operation stuff to decide what
to return.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-30 20:20:16 -05:00
Dan McGee
d3d18a42d2 Merge branch 'maint' 2011-03-29 12:21:07 -05:00
Rémy Oudompheng
287e8d356e alpm/handle.c: ensure handle is not NULL before proceeding
Many alpm_option_get/set_*() functions already check this
and set pm_errno to the right value, but not all, so
this improves consistency.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29 12:10:08 -05:00
Andrea Scarpino
b6ecb2329b call alpm_option_get_localdb once in syncfirst()
Signed-off-by: Andrea Scarpino <andrea@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29 11:01:43 -05:00
Dan McGee
1a8c792e8f Fix an outdated comment
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29 02:20:54 -05:00
Dan McGee
6303d4920c Add initial 3.5.2 notes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 10:31:08 -05:00
Dan McGee
db722bb4b1 Update .mailmap file
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 10:11:28 -05:00
Dave Reisner
9477abc359 pacman/util: flush terminal input before reading response
Addresses FS#20538

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 09:04:15 -05:00
Denis A. Altoé Falqueto
e8069cfc3d makepkg: command line options for signing packages
Three new command line options were added:

--sign: forces the generation of a signature for the resulting package,
taking precedence over the value in makepkg.conf

--nosign: do not sign the resulting package

--key <key>: use a different key than the user's default for signing
the package.

A check is performed to ensure the user has (provided) a valid gpg key
for signing.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 09:03:28 -05:00
Ray Kohler
4ef664f485 Create pacman keyring directory if missing
Use mode 755, so non-root users can see inside.
Add "--no-permission-warning" to GPG_PACMAN to suppress the noise that
otherwise comes of not using mode 700 - this is not private data.

GPGme turns out not to issue this warning itself, so no problem there.

TODO: should non-root users be allowed to use the read-only operations
(--list, --export, --finger)?

Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 21:50:52 -05:00
Dan McGee
7a9b0e0f06 Update pacman.pot with changed strings
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 21:39:16 -05:00
Dan McGee
c3ae209246 Documentation formatting updates
Be consistent in the Synopsis and Description sections with the use of
quotes around command names.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 21:27:15 -05:00
Ray Kohler
f6c8532fd0 Add manpage for pkgdelta
Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 21:26:52 -05:00
Ray Kohler
c0190798e1 Update repo-add manpage
Add -v, mention delta support (other than -d), and split
repo-add-specific options out from those common to repo-add and
repo-remove.

Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 21:20:20 -05:00
Ray Kohler
86ff381ac2 Clean up repo-add usage message
This now includes -s and -v, tailors itself to the current command,
and is formatted more like that of other pacman commands.

Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 21:13:52 -05:00
Dan McGee
4a3cd364d0 Temporary fix for new warnings from gcc 4.6
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:48:26 -05:00
Dan McGee
3f269503d5 Merge branch 'maint'
Conflicts:
	lib/libalpm/deps.c
2011-03-27 20:41:23 -05:00
Ray Kohler
630b7b94c3 Sign database even if empty
Move the create_signature() call outside the case of non-empty
databases, so it will be called regardless.

Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:35:43 -05:00
Ray Kohler
43dacceb6b makepkg: allow PKGEXT and SRCEXT to be overridden by env variables
Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:15:52 -05:00
Dave Reisner
c02556e290 Rely on the return value of type instead of its output
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:15:20 -05:00
Dave Reisner
a9fb4d9d5b lib/dload: abstract out helper function to set utimes
This greatly simplifies the cleanup fallthrough in our download function
and we'll be able to reuse this for signatures.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:14:47 -05:00
Dave Reisner
98c8ab18ff lib/dload: remove proxy debug output
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:14:20 -05:00
Dave Reisner
33c08ac91e lib/dload: code simplification
Based on the fact that localf always points to the same file, there's no
need to code in multiple fopen calls with varying results. Instead,
track the desired file open mode and make a single call to fopen.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:14:10 -05:00
Dave Reisner
fd64988c80 lib/dload: merge get_{destfile,tempfile} into get_fullpath
Create a more general function that allows appending a suffix to a
filepath.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:12:51 -05:00
Dave Reisner
55f790ebe4 pacman/pacman.c: fix setting of useragent string
libcurl doesn't natively honor the HTTP_USER_AGENT environment variable.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:12:29 -05:00
Dave Reisner
283bf7e87c lib/dload: pass a struct with filename and size to curl_progress
This lets us determine the real size of the file on disk so that we can
properly bump the progress bar when we're resuming a download.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:12:17 -05:00
Dan McGee
ea216d3f5a Clarify error message in pacman-db-upgrade
Addresses FS#23451.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:03:08 -05:00
Dan McGee
68701a98af Ensure reported missing dependencies show correct version comparison
This addresses FS#23424. The -dd backend code was introduced in commit
b6ec9019d7, and unfortunately the munged depend used for comparison did
not carry through to the eventual display of this version. To fix this,
we undo some of the depcmp_tolerant() business introduced, and instead
make a new pmdepend_t object if necessary when the no dependency version
flag is set. This results in the correct depend being copied to the
missing depend passed onto the frontend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25 15:43:08 -05:00
Dan McGee
3bc3999bd2 Mark various functions in deps.c static
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25 15:40:12 -05:00
Dan McGee
5a9a570dda Move alpm_find_dbs_satisfier() function down in deps.c
This will make sense for a later commit when static/non-static
properties of other functions are changed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25 15:40:12 -05:00
Dan McGee
c40fc6b80d Rework find_requiredby() to not use _alpm_dep_edge()
And move the sort after the final loop; we don't need to sort once for
each database we look at.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25 15:40:12 -05:00
Dan McGee
7f480ccc0d Don't include version in dep string if mod == ANY
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25 15:40:12 -05:00
Dan McGee
e214b260ef Update usage instruction strings
* Address FS#23433 by documenting -d vs. -dd
* Drop the useless "as well", "also", "too", and "that won't break
  packages" strings from -R usage
* Fix alignment of multiline strings in source (no string change)

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25 13:47:27 -05:00
Dan McGee
86e7f60756 Merge branch 'maint' 2011-03-24 21:18:09 -05:00
Ray Kohler
c37c9c5dca Add -T, --deptest to usage message
Fixes FS #23369

Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24 21:16:11 -05:00
Jan Steffens
14474a32c9 Make log redirection saner
My main motivation was to remove the "sync", which can stall for
minutes on a busy machine (FS#23378). I also cleaned up the redirection.

Signed-off-by: Jan Steffens <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24 20:27:56 -05:00
Dave Reisner
e68e994eb2 alpm/db: do not close local DB in alpm_db_unregister_all
pacman 3.5.0 removed alpm_db_register_local, so calling
alpm_db_unregister_all leaves the front end in a position where there's
no local db, and no way to re-register it.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24 17:18:24 -05:00
Ray Kohler
cfa2eebdaf Fix use of relative paths for packages in repo-add
Move checksum and pgpsig calcluation before changing into the
tmpdir, otherwise we can't find the files if a relative path
was used.

Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24 17:15:35 -05:00
Allan McRae
a8b22e16ef Do not reuse old signature
After updating a database, remove the old signature to prevent it
being used in validation if the new signature fails to download.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 22:58:32 -05:00
Allan McRae
38da050f31 Download and verify package database signatures
If signature verification is needed, attempt to download a signature
file for a repo when it is updated. Return an error if unable to
download signature only when checking is mandatory, or if signature is
invalid.

TODO: At the moment the database signature is only checked on download.
Should we do anything with a database if it fails to be verified to prevent
its future usage?

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 22:58:00 -05:00
Dan McGee
9a3325a56d Refactor signature loading code into common function
We can use this for both standalone package signatures as well as
standalone database signatures.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 22:56:54 -05:00
Allan McRae
ed6fda2f98 Add functions for verifying database signature
Add a pmpgpsig_t struct to the database entry struct and functions for
the lazy loading of database signatures.  Add a function for checking
database signatures, reusing (and generalizing) the code currently used
for checking package signatures.

TODO: The code for reading in signature files from the filesystem is
duplicated for local packages and database and needs refactoring.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 22:22:33 -05:00
Dave Reisner
ef26c44524 etc/makepkg.conf: use curl in place of wget as a DLAGENT
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 20:37:20 -05:00
Dave Reisner
b9263fb4e1 lib/dload.c: Check for dlcb == NULL earlier
Our curl callback does a whole lot of work for nothing if the front end
never defined a callback to receive the data we'd calculate for it.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 11:04:42 -05:00
Dan McGee
351942c71b Update doc/index.txt with 3.5.1 release date
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 11:03:35 -05:00
Dave Reisner
47e41b2023 lib/dload.c: don't use deprecated curl symbols
CURLINFO_HTTP_CODE is deprecated in favor of CURLINFO_RESPONSE_CODE.
Both yield the same values.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:44:16 -05:00
Dave Reisner
e29301954c lib/dload.c: don't request compressed transport
The files we transfer are generally compressed already, so this just
adds unnecessary overhead.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:44:10 -05:00
Dave Reisner
82fb7a0202 lib/dload.c: Fix progress callback issues on download
Use a static variable to effectively track the initialization state of
the progress callback via the last byte amount reported as downloaded by
libcurl.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:43:58 -05:00
Dave Reisner
768451c5e3 lib/dload.c: fix compiler warnings generated by -Wfloat-equal
* introduces new macro in util.h (DOUBLE_EQ) for properly comparing
  floating point values

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:43:53 -05:00
Dave Reisner
db49c4a7f0 buildsys: use libcurl's m4 macro for buildtime detection
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:43:17 -05:00
Allan McRae
2f060dec6a Report output from signature checking to debug log
Move the (possibly still temporary) output generated during signature
checking into the --debug output.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:36:48 -05:00
Xavier Chantry
f9505063f8 Added gpg verification options per repo to the config file.
Once we do this, add support for VerifySig to pactest. We just check if
the repo name contains Always, Never or Optional to determine the value
of VerifySig. The default is Never. pacman uses Always by default but
this is not suitable for pactest.

Original-work-by: shankar <jatheendra@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:35:50 -05:00
Dan McGee
18c6946961 Remove unnecessary sanity check on db->setserver
We pass in a db object, so no need to go looking for it in the list on
the handle. This is a remnant of when we passed in a treename, more than
likely.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:33:31 -05:00
Chris Brannon
ac88e90557 Let pacman specify GnuPG's home directory.
GnuPG looks for configuration files and keyrings in its home directory.
For a user, that is typically ~/.gnupg.
This patch causes pacman to use /etc/pacman.d/gnupg/ as the default
GnuPG home.  One may override the default using --gpgdir on the command-line
or GPGDir in pacman's configuration file.

Signed-off-by: Chris Brannon <cmbrannon@cox.net>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:22:36 -05:00
Dan McGee
5b962f0d1c Add a pactest showing failed GPG verification
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:16:29 -05:00
Dan McGee
39c75c7000 Integrate GPGME into libalpm
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:16:29 -05:00
Dan McGee
061948597d Add some error codes for signature verification
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:16:29 -05:00
Dan McGee
4ae902ec5f Add signature directory as option on libalpm handle
This will serve as the home directory we pass to GPGME when making calls so
we can have a libalpm-utilized keyring.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:16:29 -05:00
Dan McGee
39ce9b3afc Actually read PGPSIG field in sync DB code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 03:07:08 -05:00
Dan McGee
f7b577dc77 Merge branch 'gpg-libalpm-basics' 2011-03-23 02:34:51 -05:00
Dan McGee
cedc633757 Add a few pactests for PGP integration
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:33:07 -05:00
Dan McGee
8584c25903 Remove libfetch error code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:29:35 -05:00
Dan McGee
88746ec067 Read in .sig files when opening a package file
If a .sig file sits side-by-side on the filesystem with a package archive,
read it in during the package struct creation process so we can verify it at
a later time if necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 02:22:00 -05:00
Dan McGee
39da0198cd Add PGP signature support to pactest
Allow pkg.pgpsig to end up in the created sync databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:22:00 -05:00
Dan McGee
60159c2e77 Allow PGP signature to be read from sync database
Add a new field to the package struct to hold PGP information and
instruct db_read to pick it up from the database. It is currently unused
internally but this is the first step.

Due to the fact that we store the PGP sig as binary data, we need to store
both the data and the length so we have a small utility struct to assist us.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 02:22:00 -05:00
Dan McGee
9f2a3023f8 Add base64 algorithms from PolarSSL to libalpm
We will need these for GPG functionality (decoding the base64 encoded
signature stored in the databases).

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 02:22:00 -05:00
Dan McGee
0908533127 Merge branch 'gpg-build-tools' 2011-03-23 02:18:57 -05:00
Dan McGee
a31d091fb3 repo-add: add sha256sum values to repo database
Implements FS#23103. Also modify libalpm so it ignores this value
without any warning as we know it is likely to exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:18:48 -05:00
Dan McGee
36747e4a7f Merge branch 'gpg-pacman-key' 2011-03-23 02:17:58 -05:00
Dan McGee
3df49acb30 Merge branch 'maint' 2011-03-23 02:16:13 -05:00
Dan McGee
115bf1bf9f Bump version to 3.5.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:13:49 -05:00
Dan McGee
87fbbdc649 Updated 3.5.1 translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:12:36 -05:00
Slobodan Terzić
02945ca7ad Add new Serbian translation from Transifex
Thanks!

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:12:21 -05:00
Dan McGee
c46f21af0a 3.5.1 NEWS updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:07:47 -05:00
Dan McGee
7d899910c5 Documentation consistency fixes
Fix the way we were referring to paths (use ``), .pac* extensions (use
''), and other general things across our main manpages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:07:47 -05:00
Dan McGee
5eca2fbdf1 Fix documentation typo in makepkg.8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 02:07:47 -05:00
Dan McGee
b625d03dd6 pacman-key manpage updates
Make consistent in formatting, syntax, and prose with the rest of our
documentation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 01:59:43 -05:00
Dan McGee
964e8c5bf2 pacman-key help, round three
Make it actually like all our other tools rather than some homegrown
format. Also make it translator friendly by not wrapping messages across
lines in different strings.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 01:59:42 -05:00
Guillaume Alaux
482da2eceb Add man-page for pacman-key
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 01:59:42 -05:00
Allan McRae
5a89a12aa0 pacman-key: improve usage output
Make the usage output display nicely on 80 character width terminals.

Also fix parsing of "-h" and "-v" options and avoid root check when
run with no commands.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 01:59:42 -05:00
Denis A. Altoé Falqueto
422925a65e pacman-key: remake of --reload command
The --reload command was refactored to allow a more flexible management.
There are two sets of keys that will be added, one that will be
removed and one that will be kept.

The set of keys to be kept are configured in pacman.conf, with the
option HoldKeys, with the same meaning of HoldPkgs. It can be repeated
and several values can be put in the same entry.

The new behavior allows a key to be marked for removal, but the user
can decide if that key must be kept. For example, if a developer has
a public repository, signed with his own key, that key must be added
to the HoldKeys option. If the key is marked for removal from pacman's
keyring, it will not be removed for the users that have configured
HoldKeys correctly.

There are other minor fixes, mainly in the handling of --add command
when there is no aditional parameter. In that case, pacman-key will
behave just like gpg, adding the contents of stdin into pacman's keyring.

Signed-off-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com>
2011-03-23 01:59:42 -05:00
Denis A. Altoé Falqueto
ae20f88202 pacman-key: keyring management tool
The script pacman-key will manage pacman's keyring. It imports, exports,
fetches from keyservers, helps in the process of trusting and updates
the trust database.

Signed-off-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 01:59:42 -05:00
Allan McRae
93591d428f repo-add: add symlink to signature file
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23 00:26:54 -05:00
Dan McGee
f0f8319769 repo-add: Fix up usage with GPG options
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 00:26:54 -05:00
Dan McGee
38f94da47d repo-add: add -v/--verify option
This is intended to verify an existing signature on a database before
making further changes to it and performing updates. Rarely would you
use this without immediately resigning it via the -s/--sign option.
Instead, it is intended as a "chain of trust" operation where the
previous signature is verified to give you some sense that what you sign
off on is also safe.

Still todo: don't make changes unless the signature is not only good,
but also in the accepted list of keys.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 00:26:54 -05:00
Dan McGee
a4120f2015 repo-add: allow signing of the package database
In order to be fully secure, we can't only sign packages. We also need
to sign our repository metadata to prevent database falsification,
dependency injection, etc. Add an '-s/--sign' option that allows this
functionality, and will generate a .sig file side-by-side with the
package database.

While at it, fix the issue where a signature file would never be found
because of 'cd' madness (this needs fixing in another commit).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 00:26:54 -05:00
Geoffroy Carrier
8fde399fe6 Add PGPSIG field in repo-add
Use base64 encoding to store the value in the database if a .sig file exists
for the package being added.

Signed-off-by: Geoffroy Carrier <geoffroy.carrier@koon.fr>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23 00:26:54 -05:00
Allan McRae
2f2f53ddc9 makepkg: place signature symlink in build dir
Be consistent in package and signature placements when using
PKGDEST.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-22 23:52:00 -05:00
Dan McGee
82e22596d8 makepkg: allow signatures to work with split packages
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-22 23:52:00 -05:00
Geoffroy Carrier
ee34869e89 Add GPG signature support to makepkg
This is a rather simple patch to add signing support to makepkg. Add a
create_signature() to makepkg, add a 'sign' BUILDENV option in makepkg.conf,
and document the changes in the makepkg.conf manpage.

Signed-off-by: Geoffroy Carrier <geoffroy.carrier@koon.fr>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-22 23:52:00 -05:00
Dan McGee
7b60a639d1 Minor code cleanups
Wrap lines of long length, noticed while creating and messing around
with some of the other maint branch patches.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 09:02:03 -05:00
Dan McGee
110eb314f0 Ensure package removal list does not contain duplicates
Noticed with the openoffice/libreoffice replacement scheme where many
packages are listed as replacements to one package, thus electing it for
removal multiple times. Ensure a given package is not already present
before placing it in the removal list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 08:59:59 -05:00
Dan McGee
834ba4da93 Fix line_offset not being reset in _alpm_archive_fgets()
This is a rather serious data corruption issue that luckily manifested
itself today in a noticable way. A package in testing had replaces
entries read in as ["%RE pkgname", "%RE"] which was clearly wrong. This
happens when we hit the end of an archive block, do not have a newline,
and have to continue reading from the next block to complete the line.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 08:52:24 -05:00
Dan McGee
0ff52b6845 Merge branch 'maint'
Conflicts due to change in return calling style.

Conflicts:
	src/pacman/pacman.c
	src/pacman/sync.c
2011-03-21 07:53:13 -05:00
Lukas Fleischer
c67c864ffd Don't initialize progress to zero before calling curl_easy_perform().
Drawing progress bars before calling curl_easy_perform() is needless as
the curl progress callback is called with zero progress before actually
downloading the file anyways. Fixes display of "0%" progress bars when
sync'ing package databases that are already up to date.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:51:27 -05:00
Dan McGee
488f341f57 Ensure dlcb is defined before calling it
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:50:31 -05:00
Allan McRae
b0bb4f9024 Do not query group selection when using -Sp
Remove unnecessary output when using -Sp.  Fixes FS#23340.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:43:55 -05:00
Allan McRae
9cab9807e0 Some more zsh completion tidy up
Changes for consistency across functions

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:40:49 -05:00
Allan McRae
c3e72e11b6 Fix zsh completion
Fixes completion for "pacman -S <tab>" and "pacman -S repo/<tab>"

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:40:27 -05:00
Dan McGee
fd3acff5e6 Restore --debug/--verbose output without a primary operation
This is by no means a guarantee of this behavior remaining the same in
the future, but it is easy enough to do what we used to in this case by
delaying any sort of error condition until after we are completely done
parsing options. Addresses FS#23370.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:40:13 -05:00
Dan McGee
d3b32a68fe Add a few more notes about translating using Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 23:46:44 -05:00
Dan McGee
451f9493f5 Update source translation files in prep for 3.5.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 23:08:22 -05:00
Dan McGee
78e55be0e6 Remove unnecessary NULL check
fp can never be NULL at this point in the code, proven by Coccinelle.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 20:11:11 -05:00
Dan McGee
32e35d4028 Fix comparison to 0 rather than NULL
Another fix found by Coccinelle example semantic patches.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 20:10:19 -05:00
Dan McGee
bdc1508a06 Fix assignment before NULL check
Easy fix, found using null_ref.cocci example Coccinelle script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 19:56:55 -05:00
Dan McGee
0303b26b1e Style change: return(x) --> return x
This was discussed and more or less agreed upon on the mailing list. A
huge checkin, but if we just do it and let people adjust the pain will
end soon enough. Rebasing should be relatively straighforward for anyone
that sees conflicts; just be sure you use the new return style if
possible.

The following semantic patch was used to do the change, along with some
hand-massaging in order to preserve parenthesis where appropriate:

The semantic match that finds this problem is as follows, although some
hand-massaging was done in order to keep parenthesis where appropriate:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression a;
@@
- return(a);
+ return a;

// </smpl>

A macros_file was also provided with the following content:

Additional steps taken, mainly for ASSERT() macros:
$ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c
$ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 19:49:45 -05:00
Dave Reisner
0cf05c77ad lib/dload.c: fix opening braces to conform with coding style
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 18:49:01 -05:00
Dan McGee
b2fde01c54 Merge branch 'maint' 2011-03-20 11:49:42 -05:00
Dan McGee
67c0e9cab3 Add missing include for size_t
Needed for things like our strndup() substitute function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:45:17 -05:00
Dave Reisner
524b338974 INSTALL: replace libfetch with libcurl
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:32:08 -05:00
Dave Reisner
352b799efc lib/dload.c: remove lingering libfetch specific headers
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:32:02 -05:00
Lukas Fleischer
b0f9477f01 Fix libtool and LDFLAGS reordering issues
This is a Debian patch (from #347650) that makes libtool play nicely
with "-Wl,--as-needed".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:22:41 -05:00
Pang Yan Han
58df372be6 Fix handling of ignored packages
Noted in FS#23342. When the user attempts to install an ignored package
and answers no when asked whether to install it, pacman bails out with:

"error: target not found: packagename"

This is because satisfiers are not found for the package and execution
continues to process_group(), where the package is treated as a group
(which does not exist).

In addition, test ignore006.py is updated with PACMAN_RETCODE=0 since
saying no to installing an ignored package should not be considered an
error.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:17:41 -05:00
Allan McRae
f6716ae94a Use sane umask for repo db downloads
Fixes FS#23343.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:17:00 -05:00
Allan McRae
b6cada3eed makepkg: Improve optdepends extraction
Prevents issues where optdepends descriptions contain a bracket.
Also, strip all comments from arrays before joining them.

Fixes FS#23307.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:15:34 -05:00
tuxce
b48f718417 Correctly parse %DELTAS% entries in sync DB
We erroniously dropped the call to _alpm_delta_parse() when macro-izing,
causing segfaults for repos that provide deltas. Addresses FS#23314.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 10:51:44 -05:00
Dave Reisner
ff713a51bd remove antiquated contrib/wget-xdelta.sh
Support for this script was removed in makepkg by commit b4e1365. Delta
creation support has been provided by scripts/pkgdelta.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 10:05:33 -05:00
Dave Reisner
0da6c591c0 Fix triple progress bars on download
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 10:05:26 -05:00
Dan McGee
e47fc2d7c6 Ensure we have a root partition when checking space
Partially addresses the "why doesn't CheckSpace work in a chroot" issue.
We can't make it work, but we can at least detect when it won't work by
checking for a partition for our given installation root. If we can't
determine the mountpoint for this, bail out with an error.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 09:33:04 -05:00
Dan McGee
e6c9076a74 Merge branch 'maint' 2011-03-16 19:55:28 -05:00
Dave Reisner
308aa38a40 pacman.8: (re)document behavior of reading from stdin
Change the term 'packages' to 'targets' in the synopsis as well, since
command line parameters could just as well be groups, repos, or URLs.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:54:32 -05:00
Dan McGee
3707d5bc46 Warn but don't error for unknown pacman.conf directives
This makes all the pacman developers' jobs harder as we have to switch
files whenever running multiple pacman versions and are using newly
introduced options. Instead of erroring out, print warnings and continue
on.

This patch also fixes a const-correctness issue. We immediately cast a
'const char *' to a 'char *' in setrepeatingoption(), which is just
plain wrong as we manipulate the underlying string. Fix the types and
remove the now unnecessary variable.

Finally, a few messages change here for consistency and clarity and
because we continue parsing rather than bailing out on a problem.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dave Reisner
40a6c5c5ec Only read from stdin if '-' is provided as a target
This prevents a regression for people who enjoy piping yes to pacman to
avoid prompts.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dave Reisner
deed0286ef alpm_list: fix typo in doxygen comment
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dan McGee
e28c47ade3 Update translations for message with added newline
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Allan McRae
771c002c98 Add missing newline to warning message
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dan McGee
f1ea4c8d24 Update index.txt with 3.5.0 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dan McGee
cff36093f3 Merge branch 'download' 2011-03-16 19:25:35 -05:00
Dan McGee
92630c6607 Bump pacman versions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:40:05 -05:00
Dan McGee
656b470163 contrib/Makefile.am: don't simplify what you don't understand
This was totally screwed under a 'make distcheck' invocation. Bring it
inline with what we have (and what works!) in scripts/Makefile.am. This
was broken/introduced in commit 05f0a28932.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:38:35 -05:00
Dan McGee
9ae6ee0f09 Updated translations for 3.5.0 from Transifex
Thanks to all translators that contributed!

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:30:02 -05:00
Dave Reisner
f2eac18a6e Remove all traces of libfetch
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
4ad4527d10 dload: temp patch to allow curl/fetch coexistance
this is just some debuggery to allow pacman to operate with both fetch
and curl at the same time. use the PACMANDL variable to control which
library is used.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
96e458b705 dload.c: add curl_download_internal
This is a feature complete re-implementation of the fetch based internal
downloader, with a few improvements:

* support for SSL
* gzip and deflate compression on HTTP connections
* reuses a single connection over the entire session for lower resource
  usage.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
8a58648471 handle error case for PM_ERR_LIBCURL
Add PM_ERR_LIBCURL to error enum and handle case in error.c by returning
curl_easy_strerror() based on the error number carried by the gloabl alpm
handle.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
a5b6a75787 share code between libfetch and libcurl
no actual code changes here. change preprocessor logic to include
get_tempfile, get_destfile, signal handler enum, and the interrupt
handler logic when either HAVE_LIBCURL or HAVE_LIBFETCH are defined.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
159e1b06a5 prefix fetch based functions with fetch_
Do this in preparation for implementing similar curl based
functionality. We want the ability to test these side by side.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
278c847106 handle: Add CURL* and CURLcode vars to struct
Adding the CURLcode is necessary in order to return an error string from
pm_error. Unlike libfetch, curl returns numerical error numbers and does
not maintain a staticly allocated string with the last error generated.

Adding the curl object itself to the handle is advantageous (and
encouraged by curl_easy_perform(3)) because the handle is reusable for
successive operations. This cuts back on overhead when downloading
multiple files in a single transaction.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
75bfe825fc add curl to alpm initialization and teardown routines
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner
67391c2c6c Add configure.ac option for --with-curl
To avoid breaking compilation, fetch defaults to 'no', and curl defaults
to 'check'.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dan McGee
36c570712a Fix value of ngettext() count parameter in callback
I was awesome and ran alpm_list_count() on an empty list. Fail.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 15:34:30 -06:00
Allan McRae
36df611203 Update NEWS for pacman-3.5 release
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:59:34 -06:00
Allan McRae
21f16fa7ab Document API changes for pacman-3.5 release
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:55:15 -06:00
Allan McRae
f2023176f6 Do not print warning with files entry in sync db
repo-add can add a "files" entry into the sync db.  Currently we
do nothing with this file, so explicitly skip it to prevent
unknown database file warnings.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:54:38 -06:00
Dan McGee
0b6aa428cf Fix gettext plural detection
Our keywords were all screwed up in this regard. Fix it so our
ngettext() shortcut calls are actually recognized and respected.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-03 11:10:14 -06:00
Xavier Chantry
79f8cfb529 libalpm/diskspace.c: remove bogus parenthesis
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 18:16:52 -06:00
Dan McGee
d68635e7c2 pactest: use actual regexes in OUTPUT rules
I managed to just make deptest001.py fail by changing a DEBUG-level
logger in commit b12be99c89. This should not be this fickle. Enhance the
OUTPUT rule to use an actual Python re object when looking for matches,
and make a lot of the rules use stronger patterns to match with.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 14:24:13 -06:00
Dan McGee
b12be99c89 Ensure d_type is not DT_UNKNOWN before relying on it
Fixes FS#23090, a rather serious problem where the user was completely
unable to read the local database. Even if entry->d_type is available,
the given filesystem providing it may not fill the contents, in which
case we should fall back to a stat() as we did before. In this case, the
filesystem was XFS but there may be others.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 13:39:43 -06:00
Dan McGee
09ce8b446c Fix some easy to find double translations
A lot of these were places that should have used the same message but
didn't, or were very easy to convert to using the same message and
letting some of the burden off of the translators.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 17:50:23 -06:00
Dan McGee
07538b948a Update translation template files
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 11:11:19 -06:00
Dan McGee
aafb387455 Merge branch 'maint' 2011-02-28 11:08:08 -06:00
Dan McGee
23451e7fa4 Update translation instructions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 11:08:01 -06:00
Jakob Gruber
dcd234ea27 --print-format displays size in bytes
Printing the exact size seems to make more sense for scripting contexts.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
[Dan: adjust for master before VerbosePkgLists patches, fix type]
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:54:33 -06:00
Jakob Gruber
1a524fa8b8 A couple of minor manpage adjustments
Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:48:51 -06:00
Dan McGee
f45369800a Check local DB version before continuing transaction
Ensure we have a local DB version that is up to par with what we expect
before we go down any road that might modify it. This should prevent
stupid mistakes with the 3.5.X upgrade and people not running
pacman-db-upgrade after the transaction as they will need to.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:46:00 -06:00
Dan McGee
5ea4706f57 Move locking functions to where they are needed
We only call these from the transaction init and teardown, so move them
to that file, mark them static, and push more of the logic of handle
manipulation into these functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:43:36 -06:00
Dan McGee
1eccae3d93 Fix trans no-argument function definitions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:41:32 -06:00
Dan McGee
2d25993d2d Add base transifex client configuration
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 14:01:26 -06:00
Jonathan Conder
acd9269478 Fix double close of the lock file
According to FOPEN(3), using fclose on an fdopen'd file stream also
closes the underlying file descriptor. This happened in _alpm_lckmk
(util.c), which meant that when alpm_trans_release closed it again, the
log file (which reused the original file descriptor) was closed instead.

Signed-off-by: Jonathan Conder <jonno.conder@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 13:32:41 -06:00
Allan McRae
e8f799ba83 pactest for removing a required empty directory
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 13:26:56 -06:00
Dan McGee
3149a45bfb Add directory name to ownership error message
If you were doing a -Qo via xargs, it is at least nice to see what input
caused the error message to occur rather than having a bunch of plain
messages. This matches the style when we can't find the owner of a file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:48:20 -06:00
Dave Reisner
1fcc496756 alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcache
This avoids needless breakage of the public API.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:46:36 -06:00
Dave Reisner
eefe8c8364 alpm: remove public visibility of pmpkghash_t
There's no API functions exposed which allow manipulation of this type,
so remove it from public view. Also, rename the public and private
alpm_db_get_pkgcache symbol to alpm_db_get_pkgcache_has.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:45:13 -06:00
Dan McGee
ab49bf6fa9 Add test case for util-linux/util-linux-ng name switch and deps
This case currently fails, but highlights a failure in our install
process I experienced the other day. Because we don't do replacement
uninstalls inline with the rest of the upgrade uninstalls, we can have a
time on our system where a critical package is not installed.

I hope no one ever renames glibc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:57:41 -06:00
Dan McGee
2f96764058 Continue resolving dependencies rather than bailing on first error
This allows error messages emitted by the frontend to be a bit more
descriptive and not have the annoying "well why didn't you tell me that
the first time" problem. If a package had multiple missing deps, we
would bail on the first one before rather than finish processing all
missing dependencies, and only print one error message. Instead,
continue through this entire set of missing deps and append all eventual
errors.

The added pactest tests this case, as the to be installed package has
two missing dependencies. However, pactest does not actually test or see
the difference in output from before and after, so it passes in both
cases, but it is clearly visible in the logs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:55:16 -06:00
Dan McGee
d4d304cdb7 Various small spelling fixes and small tweaks
Nothing that changes behavior here. Spelling fixes and pushing a
variable down to the scope it is used.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:53:11 -06:00
Dan McGee
7c14e48776 Mark log callback format string const
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-24 09:38:59 -06:00
Dan McGee
6735807c0f Remove trans->skip_add
This is old code that has since gone stale; we no longer ever add
anything to this list so no need to keep it around and check the
contents during extraction.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-22 16:48:51 -06:00
Dan McGee
cfa7602032 Don't generate filelist unless we are going to use it
We throw it away if !full, so no need to waste time creating the list in the
first place.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-16 20:57:07 -06:00
Dan McGee
00c393d49f Conflict checking code cleanup
* Make conflict_isin() static; it is used nowhere else.
* Remove does_conflict(): it turns out to be replaceable by a single call to
  _alpm_depcmp(). By pushing it up, we can reduce calls to _alpm_splitdep()
  from 60,368 to 16,940 during one test -Su operation I ran.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-16 20:57:07 -06:00
Dan McGee
d1cc1ef6c3 Fix some database size estimation problems
* Use stat() and not lstat(); we don't care for the size of the symlink if
  it is one, we want the size of the reference file.
* FS#22896, fix local database estimation on platforms that don't abide by
  the nlink assumption for number of children.
* Fix a missing newline on an error message.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 16:58:08 -06:00
Pang Yan Han
62a2e45b12 Use CALLOC for _alpm_graph_new()
Change _alpm_graph_new() to use CALLOC to avoid explicit zeroing out of fields
in pmgraph_t.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 16:23:36 -06:00
Dan McGee
30f338cce6 diskspace: allow used flag to be toggled for both remove and install
Turn it into an enum rather than a boolean, and use a bitmask like we do for
reading DB entries. The relevant flag is turned on in our two calculate
loops, and anything reading the used flag later can decided which flag (or
either) is relevant.

This will allow the read-only partition code to be triggered on a
remove-only operation, e.g. if /boot was read-only and one tried to remove
grub in a sync transaction. Of course, right now, we don't actually run the
diskspace check code in the '-R' codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:51:59 -06:00
Dan McGee
3afe3b6dfb Check mountpoint read-only status when checking space
This is a bit of a stopgap solution for the problem, but an easier one than
revamping the file conflict checking code to support the same stuff. Using
some more gross autoconf magic, figure out which struct field we need to
look at to determine read-only status and store that on our mountpoint
struct. If we find out we needed this partition after calculating size
requirements, then toss an error.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:38:58 -06:00
Dan McGee
1358a4a80f diskspace: use calloc instead of malloc
Prevents us from having to manually zero out several of our fields.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:36:41 -06:00
Dan McGee
0eac60cd9d Fix mount dir length calculation
In the getmntinfo() section, the local variable mnt doesn't exist; this
would have caused a compile error if I had tested the code on such a
platform. Unify both codepaths to just run strlen() on the already copied
mount path instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:34:37 -06:00
Dan McGee
06cbb516c3 Avoid a memmove by advancing value pointer
In packages, our description file contains:
key = value is here
type entries, and we passed "key " and " value is here" to our strtrim
function, causing us to always memmove the value portion to remove the
space. Since this is a throwaway buffer, do the advancing on our own before
trimming to save the need to shift memory around; "value is here" will now
be passed and strtrim will be responsible for trailing whitespace.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Dan McGee
56721c12ce Fix fileconflict progress with only one package
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Dan McGee
62fc966882 Ensure pkgbase/epoch are defined before doing anything
When generating integrity sums, we could get some weird output before due to
epoch being uninitialized:

    /usr/bin/makepkg: line 234: [[: 2.6.37: syntax error: invalid arithmetic operator (error token is ".6.37")

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Dan McGee
942bb9e64a Skip diskspace checking for symlinks and directories in all cases
We did this in some but not all cases, assuming the 0 value coming out of
libarchive would not be a problem. However, this does not work for "fake"
filesystems such as rpc_pipefs, which reports a free block and total block
count of zero.

Fix this by not ever counting symlinks or directories, and adding a note
explaining that if we someday do count directories, their size needs to be
attributed to the proper place.

This patch also includes a few cleanups/performance tweaks- avoid calling
strlen() on the mountpoint directory string as much by storing this size in
our mountpoint struct, and push the snprintf() call up to the calculate
functions since we were already doing it here in the remove case.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-08 09:28:24 -06:00
Pang Yan Han
da3b934602 Refactor out common code in pkghash add functions
The overlapping code in _alpm_pkghash_add() and _alpm_pkghash_add_sorted()
are now in a new static function pkghash_add_pkg(). This function has a
third flag parameter which determines whether the package should be added in
sorted order.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-07 20:26:11 -06:00
Pang Yan Han
be9a60a338 Handle null pkgcache for local/sync db_populate()
In sync_db_populate() and local_db_populate(), a NULL db->pkgcache is not
caught, allowing the functions to continue instead of exiting.

A later alpm_list_msort() call which uses alpm_list_nth() will thus traverse
invalid pointers in a non-existent db->pkgcache->list.

pm_errno is set to PM_ERR_MEMORY as _alpm_pkghash_create() will only return
NULL when we run out of memory / exceed max hash table size. The local/sync
db_populate() functions are also exited.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-07 20:21:34 -06:00
Allan McRae
bb071f4eb2 makepkg: more bash-3.2 compatibility
Adding the "|| true" to the subshell prevents bash-3.2 setting off the
error_trap but requires changing the if statement.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-06 12:52:59 -06:00
Dan McGee
3cf870eda5 Merge branch 'maint' 2011-02-06 12:52:20 -06:00
Pang Yan Han
3865352d23 Remove redundant _alpm_strtrim() in be_local.c
When reading the "desc" file in _alpm_local_db_read(), some
strings are trimmed and checked for length > 0 before their
use/duplication subsequently. They are then trimmed again
when there is no need to.

The following code snippet should illustrate it clearly:

while(fgets(line, sizeof(line), fp) &&
	strlen(_alpm_strtrim(line))) {

	char *linedup;
	STRDUP(linedup, _alpm_strtrim(line), goto error);
	info->groups = alpm_list_add(info->groups, linedup);
}

This patch removes the redundant _alpm_strtrim() calls in
_alpm_local_db_read() such as the one inside the STRDUP shown
above.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-06 12:50:46 -06:00
Pang Yan Han
30bb969ace Handle PM_ERR_WRITE in alpm_strerror()
PM_ERR_WRITE is defined in alpm.h but not handled in
alpm_strerror(). This patch corrects that.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 14:21:43 -06:00
Dan McGee
e17c4fe611 Add new translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 14:20:02 -06:00
Dan McGee
15e143bdfb Add updated Kazakh translation from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 14:20:02 -06:00
Dan McGee
fafa909a2d Update translation file indexes and Makevars
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:15:51 -06:00
Dan McGee
7664a58d4e Add comment about download file resolution
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:15:22 -06:00
Dan McGee
e34fc4eddf Merge remote-tracking branch 'allan/hash' 2011-02-04 09:10:25 -06:00
Dan McGee
c12ccbfb2c Add more error checking and logging
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:00:47 -06:00
Dan McGee
7467fb9e76 Ensure found files are actually files
We located files in a few places but didn't check if they were files or
directories. Ensure they are actually files using stat() and S_ISREG(); this
showed itself when trying to download to the directory name itself in
FS#22645.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 08:42:55 -06:00
Dan McGee
6b0d4674bb Improve pkghash_remove algorithm
Rather than potentially move every item to the next NULL, attempt to move at
most one item at a time by iterating backwards from the NULL location in the
hash array. If we move an item, we repeat the process on the now shorter
"chain" until no more items need moving.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 10:03:04 +10:00
Dan McGee
1f145bcd1a Use alpm_list_remove_item in pkghash_remove
Removes the code that was duplicated and has now been refactored into a
separate method.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:46 +10:00
Dan McGee
14fd1e63a2 Add new alpm_list_remove_item() function
This takes in the list and a list item, and does the pointer dance necessary
to remove it from the list regardless of whether it is first, last, or
somewhere in the middle. It is useful for callers that already know what
item needs to be removed and have a pointer to it rather than doing a search
by data that the plain alpm_list_remove() does.

Refactor alpm_list_remove() to use this function as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:46 +10:00
Dan McGee
09e582b411 Add a new removal smoke test
Hint: this will really stress hash table removal.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:46 +10:00
Allan McRae
01c3c7e4f2 Actually remove packages from pkghash on removal
Fully removes a package from the hash.  Also unify prototype with
removal from an alpm_list_t, fixing issues when removing a package
from the pkgcache.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
11e5e86151 Refactor finding position for new hash entry
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
9320786349 Rehash efficiently
Rehash without recreating the hash table list or reallocating the
memory for holding the list nodes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
c9820ec97b Slightly more efficient rehash size selection
While probably still not optimal in terms of everyday usage in
pacman, this reduces the absolute size increase to "more reasonable"
levels.  For databases greater than 5000 in size, the minimum size
increase is used which is still on the order of a 10% increase.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
d843c86b7b Error handling for maximum database size
Check that the requested size of a pkghash is not beyond the maximum
prime.  Also check for successful creation of a new hash before
rehashing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Dan McGee
021085624e Change default sync hash table sizing to 66% full
Since the sync database never changes size once we initialize it, we
allow it to be filled a bit more. This reduces the overall memory
footprint needed by the hash table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:45 +10:00
Dan McGee
ce54715112 Implement a quick and dirty rehash function
This allows us to get through the rehash required by smoke001 and pass
all pactests. It is by no means the best or most efficient
implementation but it does do the job.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
f8fdce6cb0 Read pkgcache into hash
Read the package information for sync/local databases into a pmpkghash_t
structure.

Provide a alpm_db_get_pkgcache_list() method that returns the list from
the hash object.  Most usages of alpm_db_get_pkgcache are converted to
this at this stage for ease of implementation.  Review whether these are
better accessing the hash table directly at a later stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Dan McGee
5dae577a87 Get estimated package count when populating databases
This works for both local and sync databases in slightly different ways. For
the local database, we can use the directory hard link count on the local/
folder. For sync databases, we use the archive size coupled with some
computed average per-package sizes to determine an estimate.

This is currently a dead assignment once calculated, but could be used to
set the initial size of a hash table.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
e17b0446bd Add a hash table for holding packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
f892775366 makepkg: initialize local arrays to empty
Fixes bash-3.2 compatibility.

Thanks-to: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 20:47:08 -06:00
Allan McRae
35a8cf134b makepkg: error on invalid optdepends
Missed in commit a88cb03a.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:47 -06:00
Cedric Staniewski
d8c4b12c66 makepkg: make SRCPKGDEST default to $startdir
The current behaviour, which is placing source packages in PKGDEST if
SRCPKGDEST is not set, is inconsistent with {SRC,PKG}DEST handling and
there is no real advantage in doing so.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:39 -06:00
Nezmer
332dd86912 makepkg: Fix the check for references to srcdir/pkgdir
At least in FreeBSD, find always returns 0 if it finds stuff
(imagine that). It doesn't care about the exit status of whatever is
passed to -exec.

This patch makes the checks compatible with this behaviour.

Using xargs and not using grep directly because packages with too many
files would cause grep to complain about argument list being too long.

This should also fix the false positive in packages with no files.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:23 -06:00
Cedric Staniewski
3444146b48 makepkg: fix indention to follow style guide
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-01 10:04:44 -06:00
Dan McGee
87240dae6d Fix locale.h/setlocale inclusion with --disable-nls
Noted in FS#22697. When I factored out _alpm_parsedate() into a common
function, I didn't move the <locale.h> include properly, causing a build
failure when NLS is disabled and this header isn't automatically included
everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-01 09:59:12 -06:00
Florian Pritz
111e07d0be make -d less strict; add -dd option
-d skips checking the version of a dependency.

-dd skips the whole dependency check.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 10:49:53 -06:00
Xavier Chantry
b6ec9019d7 alpm/depcmp: new NODEPVERSION flag
This flag allows to disable version checking in dependency resolving
code.

depcmp_tolerant respects the NODEPVERSION flag but we still keep the
original strict depcmp. The idea is to reduce the impact of the
NODEPVERSION flag by using it in fewer places.

I replaced almost all depcmp calls by depcmp_tolerant in deps.c (except
in the public find_satisfier used by deptest / pacman -T), but I kept
depcmp in sync.c and conflict.c

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 10:49:39 -06:00
Xavier Chantry
b8d01dace8 add pactests for -Sdd
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 10:45:36 -06:00
Dan McGee
09f9f24331 Allow both cleanmethod values to be specified at the same time
No reason to disallow this- it allows keeping even more packages around in
the cache. Test cases included for this case and to ensure the default
behavior is preserved.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:38:14 -06:00
Dan McGee
986edb8bd4 Style cleanups in clean cache code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Dan McGee
d6a9436143 Add three clean cache tests
The first two are rather standard tests of our two available clean options,
and the third is attempting to test a reported bug (and failing to make the
given case fail).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Dan McGee
2d5ec02d7c pactest: allow checking for cache file existence
This will allow some tests to be added for cache cleaning.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Xavier Chantry
ed1aef7bc5 libalpm: fix db_update documentation
return codes were mixed up

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:36:30 -06:00
Dan McGee
2e1b5c96a6 Call count() once in callback
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 13:34:51 -06:00
Xavier Chantry
e263cf7231 alpm: drop old target interfaces
It's likely that these interfaces will break sooner or later, now that
pacman no longer uses them.

So better force the two people who use them to migrate their code to the
new add_pkg/remove_pkg interface, which is very easy anyway.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:08 +01:00
Xavier Chantry
05f2abfba9 select_display: per-database output
This function is used both for provision and group selection. Now the
database name will be displayed.

$ pacman  -S base-devel
:: There are 11 members in group base-devel:
:: Repository testing
   1) make
:: Repository core
   2) autoconf  3) automake  4) bison  5) fakeroot  6) flex  7) gcc  8) libtool  9) m4  10) patch  11) pkg-config
Which ones do you want to install?
Enter a number (default=all):

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:08 +01:00
Xavier Chantry
2dd53e50de pacman: improve select-question
Make use of parseindex like in multiselect, and loop until we get a
valid answer like in multiselect.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:07 +01:00
Xavier Chantry
00fec5e250 pacman/sync: implement interactive group selection
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:07 +01:00
Xavier Chantry
2a90dbe3a8 alpm: deprecate old interface
Old interface is marked as deprecated:
int alpm_sync_target(char *target);
int alpm_sync_dbtarget(char *db, char *target);
int alpm_add_target(char *target);
int alpm_remove_target(char *target);

New recommended interface:
int alpm_add_pkg(pmpkg_t *pkg);
int alpm_remove_pkg(pmpkg_t *pkg);

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:39:06 +01:00
Xavier Chantry
eed7ba92e8 pacman/remove: switch to new alpm_remove_pkg interface
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:39:05 +01:00
Xavier Chantry
4a72c0964a pacman/upgrade: switch to new interface
Note that there is a behavior change here : if the same package name
appeared several times in the target list, the alpm_add_target interface
chooses the new package, while alpm_add_pkg returns PKG_DUP.

I don't see why we cannot unify the behavior of -S and -U, and just
choose one behavior that applies to both.

Otherwise, it's always possible to handle these different behaviors in
the frontend, it just requires more work.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
953e0d48d7 alpm: new alpm_remove_pkg interface
For consistency with alpm_add_pkg.

The new recommended interface is alpm_add_pkg / alpm_remove_pkg, all
others interfaces are deprecated.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
f2fcf7eeb1 pacman/sync: rewrite target handling
This uses the new public functions to handle targets from the frontend,
like it used to be :
1) alpm_find_dbs_satisfier to find (optionally versioned) package or
provision
2) alpm_find_grp_pkgs to find members for a groups
3) alpm_add_pkg to finally add the pmpkg_t from 1 or 2

Of course, this adds more code to the frontend, but it completely
deprecates sync_target and sync_dbtarget interfaces.

This all-in-one interfaces felt wrong and left no control to the
frontend. A good frontend should just use alpm_add_pkg, with pkg coming
from alpm_db_get_pkg (for normal targets), alpm_find_dbs_satisfier (for
versioned provisions) or alpm_find_grp_pkgs (for groups).

This also opens the way to provide a better group handling in pacman
without constraint from libalpm and callbacks.

In ignore006, only the retcode changes, because no package was found to
satisfy the target (the only possible package is ignored).

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
1767a569c6 alpm: add alpm_find_grp_pkgs
This group function is meant to help group handling from frontend : it
scans all dbs, handling ignored packages and duplicate members (the
first repo where a member is found has the priority).

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
fb7e1b4b9b alpm: new alpm_add_pkg interface
This new function is meant to deprecate all existing
sync/add target functions :
int alpm_sync_target(char *target);
int alpm_sync_dbtarget(char *db, char *target);
int alpm_add_target(char *target);

Rather than dropping these 3 interfaces, it might be better to rewrite
them using alpm_add_pkg for now.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:15 +01:00
Xavier Chantry
b8590ed634 alpm/dep: add alpm_find_dbs_satisfier
This is a public interface for resolvedep. It looks nicer to expose it
this way rather than through sync_target.

This function can also be helpful for external tools as it should give
good results close to how pacman select a package for satisfying a given
dep.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:15 +01:00
Xavier Chantry
4097c98c1e Add interactive provider selection
If there are multiple providers in one db, pacman used to just stop at
the first one (both during dependency resolution or for pacman -S
'provision' which uses the same code).

This adds a new conversation callback so that the user can choose which
provider to install. By default (user press enter or --noconfirm), the
first provider is still chosen, so for example the behavior of sync402
and 403 is preserved. But at least the user now has the possibility to
make the right choice in a manual run.

If one of the provider is already installed, it is picked for
reinstall/upgrade, so that provision 002/003 pactest now pass.

$ pacman -S community/smtp-server
:: There are 3 providers available for smtp-server:
   1) courier-mta  2) esmtp  3) exim

Which one do you want to install?
Enter a number (default=1):

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:15 +01:00
Dan McGee
ba97a22ce1 Merge branch 'maint' 2011-01-29 12:16:11 -06:00
Dan McGee
ce089e1b97 pactest: pass entire test to rule.check()
We were piecemeal passing fields from the test object in and it was getting
out of hand, and future work would have added yet another argument. Instead,
just pass the entire test object and entrust the rule to get what it needs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 12:15:15 -06:00
Dan McGee
ef86da97f5 Remove need to explicitly register the local DB
Perform the cheap struct and string setup of the local DB at handle
initialization time to match the teardown we do when releasing the handle.
If the local DB is not needed, all real initialization is done lazily after
DB paths and other things have been configured anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 12:13:56 -06:00
Dan McGee
9b876fff09 Ignore known but unused package descfile fields
We explicitly place 'pkgbase' (and used to place 'force') fields inside
PKGINFO files, so ignore them silently instead of printing an error for
them. Also make the error message for unknown keys actually contain the key.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 17:34:06 -06:00
Thomas Bächler
272f7cf25e libalpm: Fix a missing "nicht" (not) in German translation.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 16:41:21 -06:00
Dan McGee
f95080884c Enable failure on server error for curl download command
This will make a 404 a silent failure that returns an error code rather than
0 as was previously done, screwing up the logic used by pacman/libalpm to
allow moving onto the next server on a failed download. Fixes FS#22630.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 12:00:00 -06:00
Dan McGee
7f93f0620c Fix libtool performance regression with many arguments
Reported and fixed upstream, patching our version for now until a future
release fixes it:

* http://lists.gnu.org/archive/html/bug-libtool/2011-01/msg00007.html
* http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=286e87b1030c353d9cfc89dbb72d59e0391cb693

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 11:42:35 -06:00
Dan McGee
fe76c353af Fix memory leak and error code in DB reading
We were returning a package error code rather than a DB one, and we
would leak the archive memory if the database file didn't exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 21:46:42 -06:00
Dan McGee
0f24390fe8 pkgsearch: handle non-matching lines gracefully
Before any non-matching line would trigger some perl warnings about
undefined variables. If a line doesn't match, just show it to the user
unprocessed; this is seen with warning and error messages pacman not so
helpfully emits on stdout rather than stderr.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 15:20:10 -06:00
Dan McGee
d6a997ee38 Update contrib/ Makefile
We didn't have the proper dependencies specified for our scripts after
the move to *.in extensions, so a change to a file didn't trigger a
rebuild. Also remove old stuff from .gitignore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 15:19:14 -06:00
Dan McGee
27e8f06e03 Query fileowner performance improvements
Clean up some of the code by doing less string copying and printing. This is
accomplished by either doing it after we know we need it, or taking
advantage of the fact that some strings never change such as the root
directory prefix. Also, fix an issue where a file at the root level (e.g.
/foobar) could not be queried.

End result is a much faster user experience when combined with the
mbasename() changes. These timings are for looking up 113 files in /etc/,
some of which are owned and some which are not.

	$ find /etc -maxdepth 1 -type f | xargs time pacman -Qo >/dev/null
	6.10user 0.05system 0:06.17elapsed 99%CPU (0avgtext+0avgdata 131040maxresident)k
	0inputs+0outputs (0major+9436minor)pagefaults 0swaps

	$ find /etc -maxdepth 1 -type f | xargs time ./src/pacman/.libs/lt-pacman -Qo >/dev/null
	0.86user 0.04system 0:00.92elapsed 99%CPU (0avgtext+0avgdata 131120maxresident)k
	0inputs+0outputs (0major+9436minor)pagefaults 0swaps

I'll take a 600% increase in speed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:34:42 -06:00
Dan McGee
4d291508c2 Improve mbasename performance
Rather than roll our own, use strrchr() instead, which glibc may have a
better implementation than the simple iteration method we were using.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:34:42 -06:00
Dan McGee
d16a5ae7dd Merge branch 'backup-status' 2011-01-22 16:32:34 -06:00
Dan McGee
6e71922e6c Add a few new provides tests
These deal with already-installed packages and how they should be the
preferred provider in cases where provider selection now occurs. A few
involve multiple sync repos.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
a99e7272b8 pactest: sort repos by alpha order in config file
The order was non-deterministic before, and just happened to work for
sync023.py as it was written. Ensure there is some sort of predictable
ordering.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
b3d71bf7d0 pactest: use new-style python classes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
cda7d7847f Be smarter about failure to read backup file contents
Instead of always printing MISSING, we can switch on the errno value set by
access() and print a more useful string. In this case, handle files we can't
read by printing UNREADABLE, print MISSING on ENOENT, and print UNKNOWN for
anything else. Fixes FS#22546.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:38:34 -06:00
Dan McGee
c91bd3dda9 Mark backup status strings as untranslated
And also change "Not Modified" -> "UNMODIFIED" for consistency. This makes
it a lot easier to machine-parse this and not worry about locale
differences.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:25:45 -06:00
Dan McGee
61864e1f6f Refactor backup file status check into separate function
This will make it a lot easier to use this stuff elsewhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:25:21 -06:00
Dan McGee
32727efc38 pactest: revamp modified logic
Remove all logic dealing with PKG_MODIFIED as this rule no longer exists.
This removes a bunch of unnecessary stat and checksum logic that most of the
time we were never even using. Also update the file modified checks to mark
every file created using mkfile() with an older time so any modified checks
will just work without hacks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:19:21 -06:00
Dan McGee
5699f2c94c Modify all pactests to not use PKG_MODIFIED
All conditions that this particular rule tested are better served by using a
more specific rule, whether that be checking a package version or whether
files inside the package have changed or still exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:19:17 -06:00
Dan McGee
2a3b5e40bc pactest: pylint changes for pmdb
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
8f711a7181 pactest: pylint changes for util
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
ff96649eeb pactest: pylint changes for pmtest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
d94346ede2 pactest: pylint changes for pmpkg
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
946f4af7f3 pactest: pylint changes for pmrule
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
2c6be06bba pactest: pylint changes for pmenv
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
505ad87e67 pactest: pylint changes for pactest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
0de314205f pactest: pylint changes for pmfile
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
36ea02cc48 Compute download size for sync packages only
Neither packages from files nor packages from the local database will ever
have a download size.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:11:29 -06:00
Dan McGee
c4332c8091 Merge branch 'maint' 2011-01-22 10:12:46 -06:00
Dan McGee
a97e28205a Update 3.4.3 release date
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:07:46 -06:00
Dan McGee
51175f31c4 Merge branch 'epoch-work' 2011-01-22 10:03:51 -06:00
Xavier Chantry
e277e838d7 Makefile: Use git describe --dirty for GIT VERSION
dirty indicates if the repo has uncommited changes or not when building,
so dont hardcode this info.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:57 -06:00
Allan McRae
b947db040c repo-add: only attempt to create deltas when asked
repo-add should only attempt to create the delta file when using the -d
option.

Also adjust a couple of tests to use the "double bracket" syntax.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:51 -06:00
Dan McGee
859bdb5b1d doc: update current list of authors
Allan, I had no idea you were not listed here. I think you count as an
active developer at the moment. Also, move Aaron to the past contributors
section.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:15 -06:00
Dan McGee
01403f423a doc: add a vercmp manpage
This includes info on version comparison that is very similar to the stuff
in the pacman manpage, but also a few vercmp examples, the return values,
and other fun stuff.

Also update the version comparison stuff in the pacman manpage.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:15 -06:00
Dan McGee
b8ab96a270 makepkg: encode epoch in version specifier if > 0
This makes things consistent with everywhere else we are incorporating the
new optional epoch field. Add a helper function that forms the version
string for you and use it in makepkg where I found 'pkgver.*-.*pkgrel'.

This exposes a few shortcomings in a previous "Override pkgver" patch
(2020e629) in the install package and check if built functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:09 -06:00
Dan McGee
bf46e04614 Remove epoch as an independent field
Instead, go the same route we have always taken with version-release in
libalpm and treat it all as one piece of information. Makepkg is the only
script that knows about epoch as a distinct value; from there on out we will
parse out the components as necessary.

This makes the code a lot simpler as far as epoch handling goes. The
downside here is that we are tossing some compatibility to the wind;
packages using force will have to be rebuilt with an incremented epoch to
keep their special status.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
5c46ba14f7 Allow version comparison to contain epoch specifier
Adapting from RPM, follow the [epoch:]version[-release] syntax. We can also
borrow some of their parsing code for our purposes (thanks!).  Add some new
tests to our vercmp shell script tester for epoch comparisons, and then make
the code work with these newfangled epoch specifiers.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
e068b58507 pactest: add more testing for epoch
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
50f446886b pactest: Rename epoch pactests
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
76735e6519 Copy new backend translation over from frontend translation
Since it is the same string. Done with some bash looping and sed magic.

    for src in po/*.po; do
        echo $src
        newtrans=$(grep -A1 "msgid.*$1" $src | tail -n1)
        newtrans=${newtrans//\\/\\\\}
        echo "$newtrans"
        fname=${src##*/}
        dest=lib/libalpm/po/$fname
        sed -i -e "/msgid.*$1/{N; s/msgstr.*$/$newtrans/}" $dest
    done

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 11:04:52 -06:00
Dan McGee
85d0111da8 3.4.3 release preparation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 10:36:51 -06:00
Dan McGee
3863e48788 Add a likely_pkg hint argument to sync_db_read
In most (all?) cases, we will process all files for a given sync database
entry sequentially. The code currently does an _alpm_pkg_find() for every
file in the database, but we had the "current" package readily available.
Shift some local variables around a bit to expose this to sync_db_read() and
use it if the package is the correct one.

On my system, this cuts calls to _alpm_pkg_find() from 20,769 to 10,349
calls during a -Qu operation, and results in a ~30% speedup of the same
operation (0.35 sec -> 0.27 sec). This benefit should be apparent anywhere
we read in the full contents of the sync databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 10:11:59 -06:00
Dan McGee
c86ff120c8 Improve splitname memory allocation
We don't need to create a temporary copy of the string if we are smart with
our pointer manipulation and string copying. This saves a bunch of string
duplication during database parsing, both local and sync.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
01c8f39ab8 Improve depends string parsing
Remove the need for an unconditional string duplication by using pointer
arithmetic instead, and strndup() instead of an unspecified-length strdup().
This should reduce memory churn a fair amount as this is called pretty
frequently during database loads.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
aff3e63c45 Add strndup fallback function to libalpm util
The same fallback we are currently using in the pacman frontend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
b40c8e2922 Update valgrind suppressions file
We haven't tweaked this in a while, but some of the old stuff seems to no
longer be necessary and there are a few new things we should add.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:18 -06:00
Dan McGee
c49f198042 Add a pactest for the situation in FS#7524
Confirming the current behavior. And yes, the error message is still no
better than it was when this was reported 3.5 years ago.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:07:12 -06:00
Dan McGee
f65edb7f29 Fix integrity check status when installing from file
When installing packages from a file, the integrity check count
stays at (0/x) complete.  This ensures it is bumped to (x/x) at
the end of the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-18 13:19:25 -06:00
Dan McGee
a88cb03a58 makepkg: perform all sanity checks before erroring out
It is pretty annoying to get one, fix it, and then get another. We should be
able to continue on through most of the sanity checks in one go so the user
gets all the error messages at once.

Also ensure $pkgbase is defined by the time we call this function;
previously we printed nothing where a package name should have been due to
this oversight.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-14 00:25:16 -06:00
Dan McGee
665528d7ba repo-add: fix misguided conditional correction
I tried to move things around here when testing and did a bit too much; the
warning message always showed regardless of delta inclusion in the call. Fix
it so we only warn if we have a filename, but the file couldn't be located.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-13 23:43:58 -06:00
Dan McGee
5615b71688 Merge branch 'maint'
Conflicts:
	lib/libalpm/be_files.c
2011-01-12 09:23:24 -06:00
Dan McGee
30f53cfe8d Fix double read issue in maint releases
This is essentially a backport/cherry-pick of commit 33240e87b9 from
master, but has to be done by hand because the DB format has diverged. Read
more in the commit message used there, which follows.

Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-12 09:17:22 -06:00
Dan McGee
cae2bdafec pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 0d4dd09993)
2011-01-12 09:11:10 -06:00
Dan McGee
8e30a46adb Make debug config messages consistent in capitalization
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:16:52 -06:00
Dan McGee
9e8af82c97 Back out anticipated epoch changes
After all the debate as to what to do on maint, we are going to end up just
incorporating epoch into the version string, so we don't need this separate
field at all. Revert commit 5c8083baa4 and also kill the force flag we were
recording here as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:15:44 -06:00
Dan McGee
dd26592155 Merge branch 'diskspace-fixes' 2011-01-11 21:20:12 -06:00
Dan McGee
57c5afd69c Merge branch 'fix-double-load' 2011-01-11 21:20:10 -06:00
Dan McGee
0284cf2128 Merge branch 'repo-add-improvements' 2011-01-11 21:20:07 -06:00
Dan McGee
33240e87b9 Fix double filelist issue when upgrading a package
Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

A debug log message was added to upgraderemove as well to match the one
already in the normal remove codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:16:39 -06:00
Dan McGee
25fab402c7 Call archive_read_data_skip() while checking diskspace
libarchive eventually calls it anyway, but backtraces make a lot more sense
if we call it, as well as matching our precedent from alpm_pkg_load().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
6942bba75d Add error message stating which partition is full
This is helpful anyway to the user, and should also be helpful to us if we
see problems cropping up in the check during development.

Also add a missing ->used = 0 initialization in the code path less taken.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
55bff19b76 Unify two free diskspace error messages
Although they won't be the same in the gettext catalog because of the '\n'
we should still use the same text.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
fe6e90c21f Add a progressbar for package integrity checking
This can take a while too, and it is really easy to add the necessary
callback stuff for adding a progressbar.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:10 -06:00
Dan McGee
9a82cb92a4 Small fix to download size lookup and a logger
These were just two small things I came across today and found could be
fixed or helpful, so I've added them and I'm not sure what else to bundle
them with. commit_count++

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:04 -06:00
Dan McGee
d0c327df17 doc: add docs for repo-add -d option
This never got added when the option was brought in, so fix it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 20:30:27 -06:00
PyroPeter
eda4d9ec00 repo-add: Create/modify files databases
Implements FS#11302.

Dan: updated docs to not reference pkgfile.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 20:30:27 -06:00
Dan McGee
b04a56dbe9 Add two pactests with non-trivial file counts
These are probably useful anyway, but also exposed the double file list bug
that will be fixed in a later commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:44:26 -06:00
Dan McGee
0d4dd09993 pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:43:28 -06:00
Dan McGee
7ce90bb135 repo-add: use pushd/popd
Rather than explicit cd calls, we can use the directory stack to our
advantage. This also removes the need to store and restore $startdir, so
kill the variable entirely.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 17:18:46 -06:00
Dan McGee
a9cbd15260 pactest: correctly write epoch and force as necessary
We were missing this in a few places; also add the ability to check the
outcome via a new rule type.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:51:35 -06:00
Dan McGee
3e1bdfa93c Use double rather than float everywhere
No real need to use the smaller floating point types here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
5f140a62de Progress callback cleanups and fixes
* Remove a stale comment
* Fix a logic error- the conditional disagreed with the comments
* Remove some unnecessary floating point casts

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
842cbc9ea4 Ensure we use local package when calculating removed size
We were checking if a package existed locally, but then using the
incoming package to calculate removed size rather than the currently
installed package.

Also adjust the local variable in the replaces loop to make it more
clear that we are always dealing with local packages here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
d03b57f459 Remove need for floating point division in backend
All of these can be done with integer division; the only slightly
interesting part is ensuring we round up like before with calling the
ceil() function.

We can also remove the math library from requirements; now that the only
ceil() calls are gone, we don't need this anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:49:55 -06:00
Xavier Chantry
281a4c0a4f libalpm/be_package.c: fix small memleak
file_pkg_ops can be a static struct like in other backends, we just need
to initialize it at some point.

Dan: add initialization flag.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:27:39 -06:00
Dan McGee
62f5da3779 Fix some more simple conversion "errors"
None of these warn at the normal "-Wall -Werror" level, but casts do occur
that we are fine with. Make them explicit to silence some warnings when
using "-Wconversion".

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:47 -06:00
Allan McRae
f966f3a834 Use size_t for alpm_list sizes
There is a lot of swtiching between size_t and int for alpm_list sizes
in the codebase.   Start converting these to all be size_t by adjusting
the return type of alpm_list_count and fixing all additional warnings
given by -Wconversion that are generated by this change.

Dan: a few more small changes to ensure things compile, adjusting some
printf format string characters to accommodate the larger size on x86_64.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:46 -06:00
Dan McGee
4bc6ed56aa Refactor old date parsing into single method
We've managed to duplicate this four times at this point, so make it a
method in util.c instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 20:55:05 -06:00
Allan McRae
d288240426 Update copyright years for 2011
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 18:47:37 -06:00
Dan McGee
04dc87e012 vercmp: always return 0 if we perform a compare
And change the wording slightly to indicate we *print* a value, not *return*
it. You can't return negative values (they get coerced to 255), so it isn't
worth it to try and cram the result into the return code.

Acked-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 21:17:30 -06:00
Dan McGee
26652768d6 Remove FORCE reading from local DB
We never wrote it here, so no need to read it in either.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:56:06 -06:00
Dan McGee
46eda12c1b pactest: Use booleans where it makes sense
No need to use 0/1 when we can use False/True for the force option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:57 -06:00
Dan McGee
e57c3efeaa pactest: remove dead function
Stopped being used after commit fa933df65b.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:13 -06:00
Dan McGee
c41edf49be Fix function indentation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-02 12:25:33 -06:00
Dan McGee
08d885fda5 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
	test/pacman/tests/ignore007.py
2010-12-30 09:41:46 -06:00
Allan McRae
351250adb4 Declare all local functions static
All functions that are limited to the local translation unit are
declared static.  This exposed that the _pkg_get_deltas declaration
in be_local.c was being satified by the function in packages.c which
when declared static caused linker failures.

Fixes all warnings with -Wmissing-{declarations,prototypes}.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:39:23 -06:00
Jakob Gruber
6ddc115c7f Respect Ignore{Pkg,Group} for group members
Fixes FS#19854.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber
df360b791d Move group code to separate function
This makes the following commits more readable.
No logic was changed in this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber
58ee249c86 Tests: Sync group which includes ignored pkgs
* FS#19854 (--ignore is ignored with groups)

* http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html
  (operation aborts when a package from a group is ignored/and user chooses
  not to install it)

If a group member is ignored, we expect
a) a question whether to install
b) after saying 'no' to a), the ignored member not to be installed
c) all other group members to be installed
d) pacman to execute successfully

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 9d0b33fd33)
2010-12-30 09:35:03 -06:00
Jakob Gruber
cb7ba4e4e5 Add const to some ALPM function signatures
char * -> const char *.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:25:16 -06:00
Dan McGee
e0d327462c doc: add website zip to clean files
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 20:06:40 -06:00
Dan McGee
619c165d36 Merge branch 'maint' 2010-12-29 19:28:46 -06:00
Allan McRae
2052f29cdb makepkg: add option to clear buildflags
Add the "buildflags" option, which is useful in its negative form
for disabling CFLAGS, CXXFLAGS and LDFLAGS when building a package.
This is useful when determining of one of these flags is causing
an issue with a package.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:28:33 -06:00
Allan McRae
0c29eb431a makepkg: Add check() function for running test suites
A PKGBUILD can have an option check() function for running test suites
between the build() and package() stages.  This function is run by
default but can be disabled globally in with "!check" in BUILDENV in
makepkg.conf. This setting can be controlled on an individual package
basis using makepkg's --check and --nocheck flags. Addition dependencies
needed for running the test suite can be specified in the checkdepends
array and are only checked when running the check() function.

Original-work-by: Jeff C <jeff@kcaccess.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:28:00 -06:00
Allan McRae
d227771464 Use limits.h for PATH_MAX
We use PATH_MAX everywhere by including limits.h so there is no
point in doing a check for it in a different header when dealing
with FreeBSD's libfetch.

Also, remove autoconf check for strings.h header as it is not used
anywhere.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:26:21 -06:00
Allan McRae
81dd9d3ebc Detect undefined PATH_MAX
POSIX does not require PATH_MAX be defined when there is not actual
limit to its value.  This affects HURD based systems.  Work around
this by defining PATH_MAX to 4096 (as on Linux) when this is not
defined.

Also, clean up inclusions of limits.h and remove autoconf check for
this header as we do not use macro shields for its inclusion anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:24:13 -06:00
Allan McRae
fcc09bd7e3 Correct type for hash value storage
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:10:49 -06:00
Dan McGee
c002567d96 Various documentation updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:07:30 -06:00
Dave Reisner
bd98b93a6e makepkg: escape closing bash array paren for awk
The closing parenthesis of bash arrays needs to be escaped in the ending
address of awk expressions in order to play nicely with implementations
of awk other than gawk. This change provides compatibility with gawk,
nawk and mawk.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 18:44:46 -06:00
Allan McRae
eb93955477 makepkg: allow pkgname usage in split package functions
Currently, using $pkgname in a split package package_*() function
always returns the first value in the pkgname array rather than the
name of tha package being packaged.  Fix this so $pkgname gives the
expected value.

Fixes FS#22174

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 18:44:32 -06:00
Dan McGee
a7972625e3 Merge branch 'depcmp-perf' 2010-12-29 18:43:47 -06:00
Dan McGee
a58083459b Merge branch 'fgets-perf' 2010-12-29 18:43:44 -06:00
Dan McGee
735a197fc2 Use name hashes in depends to avoid strcmp calls
Just like we did for package name comparsions, if we add a depend name_hash
field on depend struct initialization, we can use it instead of doing a
string name comparison, saving us a lot of checks in the depcmp code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 17:25:34 -06:00
Dan McGee
34a78d935a Remove need for memory allocation in _alpm_depcmp
Noticed when tweaking testdb, when we run _alpm_depcmp in loops and call it
seven million times, the strdup()/free() combo can add up. Remove the need
for any string duplication by some pointer manipulation and use of strncmp
instead of strcmp. Also kill the function logger and add an escape so we
don't needlessly retrieve the list of provides.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 17:25:02 -06:00
Dan McGee
e3c19569cf Add pactest to test long archive reads
This creates two packages with extremely long description lines (500KB and
600 KB), causing our archive read code to perform reallocation to store the
whole contents. One of the packages will successfully read while the other
will fail for the time being.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Dan McGee
fbcc427754 pactest: allow testing of package description
And modify the code to not print the full rule string if it is more than 40
characters long; truncate it instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Dan McGee
f2dff08600 Overhaul archive fgets function
The old function was written in a time before we relied on it for nearly
every operation. Since then, we have switched to the archive backend and now
fast parsing is a big deal.

The former function made a per-character call to the libarchive
archive_read_data() function, which resulted in some 21 million calls in a
typical "load all sync dbs" operation. If we instead do some buffering of
our own and read the blocks directly, and then find our newlines from there,
we can cut out the multiple layers of overhead and go from archive to parsed
data much quicker.

Both users of the former function are switched over to the new signature,
made easier by the macros now in place in the sync backend parsing code.

Performance: for a `pacman -Su` (no upgrades available),
_alpm_archive_fgets() goes from being 29% of the total time to 12% The time
spent on the libarchive function being called dropped from 24% to 6%.

This pushes _alpm_pkg_find back to the title of slowest low-level function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Dan McGee
126f50ab0b testdb: update for new database format
Sync DB's no longer have an extracted directory, so remove the files check
for those. Local databases no longer have a 'depends' file, so kill that
check as well. Finally, do a little other cleanup and remove the need for
PATH_MAX.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 19:54:33 -06:00
Allan McRae
c78a808c49 Only check diskspace availability if needs more than zero
The amount of diskspace needed for a transaction can be less than
zero.  Only test this against the available disk space if it is
positive, which avoids a comparison being made between signed and
unsigned types (-Wsign-compare).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:34 -06:00
Allan McRae
a611879318 Always specify arguement type in function delcarations
Always declare a function with (void) rather than () when we expect
no arguements.  Fixes all warnings with -Wstrict-prototypes.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:21 -06:00
Allan McRae
5776090055 makepkg: remove last inappropriate PKGBUILD usage
We should always use $BUILDSCRIPT instead of PKGBUILD.  The only
remaining uses of PKGBUILD in makekg are in comments.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:01 -06:00
Dan McGee
8ac7f7e6e5 Use macros in sync DB parsing
This simplifies a lot of the repetative code and makes it obvious where the
tricky or different ones are (e.g. depends, dates). It also makes it
significantly easier to change the way this code works in the future.

There should be no functional change with this patch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:02:47 -06:00
Dan McGee
45146dccbb Merge branch 'maint' 2010-12-15 00:41:59 -06:00
Dan McGee
ab9c0814d2 Add a cushion for diskspace checking
It is the minimum of 5% of disk capacity or 20 MiB on a per-partition basis.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15 00:41:41 -06:00
Allan McRae
6605637b53 Document PKGEXT and SRCEXT
Add some basic documentation for the PKGEXT and SRCEXT options in
makepkg.conf.  Fixes FS#21302.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15 00:36:16 -06:00
Dan McGee
c7d332a26a Reorganize fields in package struct
Saves a few bytes due to padding (256 -> 248 bytes), especially on x86_64,
so we get the overhead of our new hash field right back.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 17:46:02 -06:00
Dan McGee
919bb6c9e0 Used hashed package name in _alpm_pkg_find
This results in huge gains to a lot of our codepaths since this is the most
frequent method of random access to packages in a list. The gains are seen
in both profiling and real life.

    $ pacman -Sii zvbi
    real: 0.41 sec -> 0.32 sec
    strcmp: 16,669,760 calls -> 473,942 calls
    _alpm_pkg_find: 52.73% -> 26.31% of time

    $ pacman -Su (no upgrades found)
    real: 0.40 sec -> 0.50 sec
    strcmp: 19,497,226 calls -> 524,097 calls
    _alpm_pkg_find: 52.36% -> 26.15% of time

There is some minor risk with this patch, but most of it should be avoided
by falling back to strcmp() if we encounter a package with a '0' hash value
(which we should not via any existing code path). We also do a strcmp once
hash values match to ensure against hash collisions. The risk left is that a
package name is modified once it was originally set, but the hash value is
left alone. That would probably result in a lot of other problems anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 12:36:02 -06:00
Dan McGee
c2a73ba989 When setting package name, set hash value as well
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 12:06:31 -06:00
Dan McGee
dbf59a6b14 Add hash_sdbm function
This is prepping for the addition of a hash field to each package to greatly
speed up the string comparisons we frequently do on package name in
_alpm_pkg_find.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 11:56:32 -06:00
Dan McGee
d1d163c5a3 Use _alpm_pkg_find in deps search
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 11:50:50 -06:00
Dan McGee
a5e43b1605 Correctly force load of package reason
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:25:14 -06:00
Dan McGee
580fe21065 Abstract has_scriptlet() to package ops struct
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:25:14 -06:00
Dan McGee
c00e05992e Remove non-public functions from header
And rename accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:16:47 -06:00
Dan McGee
94d3d665f0 Mark sync_db_read() as static
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:14:03 -06:00
Bruno Widmann
5f36523af9 Abort db_populate if dbpath is not set
Rather than segfault. Fixes FS#21345.

Signed-off-by: Bruno Widmann <bruno.widmann@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 16:45:22 -06:00
Dan McGee
ed367fe96d Update scripts/ .gitignore
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 22:42:22 -06:00
Dan McGee
1ff8118212 Create sync/ DB directory if it does not exist
Rather than error out, this is easy enough. Looks quite similar to the code
in be_local for creating the local directory.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 22:41:02 -06:00
Dan McGee
13a2847aa1 pacman-optimize: ensure database directory contains local/
And also default dbpath to the one we may find in pacman.conf.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:54 -06:00
Allan McRae
d98bacd4ec Add script to update pacman database format
The pacman-db-upgrade script was added to detect old pacman database
formats and upgrade them.

Currently performs the merging of depends files into desc files in
the local database.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Allan McRae
8f3b485517 Update pactest suite for change in db structure
Merging desc and depends files in sync and local db.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Allan McRae
21833d90e2 Merge desc and depends files in local db
Whenever depends is needed from the local db, so is desc.  The only
disadvantage to merging them is the additional time taken to read the
depends entries when they are not needed.  As depends is in general
relatively small, the additional time taken to read it in will be
negligable.  Also, merging these files will speed up local database
access due to less file seeks.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee
209d0643e5 Attempt to stop installation when we encounter problems
This should hopefully address some of the concerns raised in FS#11639 with
regards to continuing after filling the disk up.

Add some more checks and passing of error conditions between our functions.
When a libarchive warning is encountered, check if it is due to lack of disk
space and if so upgrade it to an error condition.  A review of other
libarchive warnings suggests that these are less critical and can remain as
informative warning messages at this stage.

Note the presence of errors after extraction of an entire package is complete.
If so, we abort the transaction to be on the safe side and keep damage to a
minimum.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: make ENOSPC warning into an error]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee
b276a76dc9 Turn libarchive warnings into libalpm warnings
Rather than hiding these warnings, show them to the user as they happen.
This will prevent things such as hiding full filesystem errors (ENOSPC) from
the user as seen in FS#11639.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: adjust warning wording and add gettext calls]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee
3030542d10 Make reading from any file possible in sync DB
Whether it be "desc", "depends", or "deltas", it really doesn't matter-
treat them all the same and have the ability to read any data from any file
in that list. This continues the work in a44c7b8956.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:38:20 -06:00
Allan McRae
9f96c5433a Explicitly test time difference is greater than zero
We are comparing a floating point number so should use an inequality
rather than implicitly testing != 0.

Prevents warning given by -Wfloat-equal.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:32:32 -06:00
Allan McRae
ef977865a1 makepkg: perform sanity checks on variables in package functions
Check the over-ridden entries for provides, backup, optdepends and
options for illegal entries.  Partially fixes FS#16004.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:32:13 -06:00
Dan McGee
b7015af0fc diskspace style cleanups and small fixes
* Use our normal return() function syntax
* Rework a few things to reduce number of casts
* Fix void function argument declaration
* Add missing gettext _() call
* Remove need for seperate malloc() of statvfs/statfs structure
* Unify argument order of static functions- mountpoints now always
  passed first
* Count all files that start with '.' in a package against the DB
* Rename db to db_local in check_diskspace to clarify some code
* Fix some line wrapping to respect 80 characters

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:32:05 -06:00
Dan McGee
ec136784d4 Refactor statfs/statvfs type check
Turn it into a configure-type typedef, which allows us to reduce the
amount of duplicated code and clean up some #ifdef magic in the code
itself. Adjust some of the other defined checks to look at the headers
available rather than trying to pull in the right ones based on
configure checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:31:51 -06:00
Allan McRae
24684a616e Display progress bar for disk space checking
Checking disk space needed for a transaction can take a while so add
an informative progress bar.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:30:11 -06:00
Allan McRae
e22aa23c8f Add configuration option to control disk space checking
Disk space checking is likely to be an unnecessary bottleneck to
people with reasonable partition sizes so add a configuration option
to allow it to be disabled/enabled as wanted.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:30:05 -06:00
Allan McRae
3f0d98c124 Implement disk space checking
Pull together the work of the previous commits to implement a check
for enough free space before performing an install transaction. Abort
if there is not enough free space with an appropriate pm_errno..

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:59 -06:00
Allan McRae
e527699ddd Add functions to calculate approximate disk usage by packages
Two helper function are added to calculate the disk usage from packages
that are either currently installed on the system or from a package
archive.

Some minor approximations have been made:

1. Size for directories is not considered when removing a package from the
   filesystem to avoid multiple counting across packages. Also, these are
   reported to take zero size while installing.

2. Symlinks are reported to contribute zero size towards removal as
   libarchive reports them to have zero size for install.

3. Package data files (.PKGINFO, .INSTALL, .CHANGELOG) are counted towards
   usage on dbpath on install, but their size is not counted on package
   removal.

4. No handling of extra size needed for .pacsave/.pacnew files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:54 -06:00
Allan McRae
695656d252 Add function to match file to mount point
For a given file, determine which mount point it is on or will be
installed to.  Take into account that we might be using an alternative
installation root.

Add additional helper function added to sort mount point list for easier
matching.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:49 -06:00
Allan McRae
f4e9deb6d7 Add function for listing system mount points
Add a mount_point_list() function that attempts to portably obtain
a list of system mount points and a struct to hold needed mount point
information.

Abort the transaction if we are unable to determine the mount points.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:43 -06:00
Allan McRae
adb10c3ab2 Prototype disk space checking functionality
Very basic prototyping for adding functionality to check free disk
space before performing package installs.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:37 -06:00
Dan McGee
f0051a7678 Remove AC_TYPE_SIGNAL usage
This macro is deemed unnecessary by even the autoconf guys, so we really
don't need to use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:30 -06:00
Dan McGee
fc74ef93b6 dirent usage cleanup
We were including the header in a lot of places it is no longer used.
Additionally, use the correct autoconf macro for determining whether
d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:20 -06:00
Allan McRae
8e9a69e8f6 Move MAX_DELTA_RATIO definition
This is a delta specific definition so it makes more sense to put
it in the delta specific header file.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:05 -06:00
Allan McRae
a44c7b8956 Combine reading from depends and desc in sync db
This will allow us to eventually combine the depends and desc entries
within the sync database.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:25:35 -06:00
Andres P
889c260cbf makepkg: remove dead code from handle_deps
The error message that has been removed never gets to print because, given the
same condition, handle_deps throws the same error and then immediately exits
makepkg.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:25:09 -06:00
Andres P
579533d1a0 makepkg: do not ignore errors from pacman when checking deps
As check_deps is run in a subshell, exit had the same meaning as return.
Since the intention is to halt makepkg when pacman throws an error other than
127, the enclosing function has to handle error control instead.

Fixes FS#19840

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:59 -06:00
Carlos Diaz
330951200c makepkg: use portable escape sequence for terminal escapes
The escape string isn't necesarily \033; it's determined by what the
particular termcap/info entry for that terminal contains.

Bash uses ncurses functions to expand \e to the _correct_ terminal
escape.

Signed-off-by: Carlos Diaz <839273@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:46 -06:00
Allan McRae
970ffbb4c7 Add epoch to PKGBUILD prototypes
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:26 -06:00
Dan McGee
d4bab6f8fc src/util: update .gitignore
Add pactree and sort entries.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:23:25 -06:00
Xavier Chantry
622e7fdd4f contrib: remove bash pactree
This has been rewitten in C which is much much faster.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:48 -06:00
Xavier Chantry
65a96e900d pactree: use variables for color and tree output
This allows to very easily support non-color and linear mode, by just
setting the variables to an empty string, very much like it was done in
the bash script.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:40 -06:00
Xavier Chantry
6b928fc0bf pactree: separate dependency and print logic
The deps walking code simply calls print_start, print, print_end, and
all the printing logic is handled there.

The unresolvable printing is disabled for now because it does not handle
linear mode, and the linear and color output will be re-written.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:27 -06:00
Dave Reisner
7c06e66c24 pactree: rewrite in C
Use the bash script in contrib as the basis for a C rewrite using
libalpm. The speedup can go from dozens of seconds to less than one
second.

Colorized output is preserved.

The --graph option generates output that graphviz's `dot' utility will
understand to draw us a graph. Output is written to stdout and it is
left up to the user to pipe the data and determine the output
characteristics.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:15 -06:00
Xavier Chantry
abefa23341 alpm/remove.c : respect --dbonly during remove-upgrade
When a -Sk or -Uk operation induced a removal of an existing local
package, --dbonly was not in effect and the files were all removed.

Fixing this behavior was already marked as TODO in database012 pactest
------------
TODO: I honestly think the above should NOT delete the original les, it
hould upgrade the DB entry without touching anything on the file stem.
E.g. this test should be the same as:
   pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz
------------

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
[Dan: small coding style touchup]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:19:24 -06:00
Xavier Chantry
3a9dec1048 pacman: sort --help output
Example with pacman -Uh :
$ pacman -Uh
options:
  -b, --dbpath <path>  set an alternate database location
  -d, --nodeps         skip dependency checks
  -f, --force          force install, overwrite conflicting files
  -k, --dbonly         only modify database entries, not package files
  -r, --root <path>    set an alternate installation root
  -v, --verbose        be verbose
      --arch <arch>    set an alternate architecture
      --asdeps         install packages as non-explicitly installed
      --asexplicit     install packages as explicitly installed
      --cachedir <dir> set an alternate package cache location
      --config <path>  set an alternate configuration file
      --debug          display debug messages
      --ignore <pkg>   ignore a package upgrade (can be used more than once)
      --ignoregroup <grp>
                       ignore a group upgrade (can be used more than once)
      --logfile <path> set an alternate log file
      --noconfirm      do not ask for any confirmation
      --noprogressbar  do not show a progress bar when downloading files
      --noscriptlet    do not execute the install scriptlet if one exists
      --print          only print the targets instead of performing the operation
      --print-format <string>
                       specify how the targets should be printed

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
[Dan: small coding style touchups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:17:38 -06:00
Xavier Chantry
c78f5fb99a CLI args: update --help and manpage
The three parts (help, manpage and code) are now organized in the same
way and much easier to compare :
- specific options
- install/upgrade options for -S and -U
- transaction options for -S -R and -U
- global options

After this re-organization, it was easy to update and sync the three
components together. Duplication is also avoided.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:15:53 -06:00
Xavier Chantry
d0d8f605d5 alpm: don't expose alpm_depcmp
Either we expose all low levels function dealing with pmdepend_t
(splitdep and depfree come to mind), or we don't.

Since none of the tools use depcmp, I chose to remove it. In the future,
we might want to expose higher level functions such as
alpm_find_satisfier, or just lower level functions like splitdep and
depfree together with depcmp.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:54 -06:00
Xavier Chantry
d5a7dc67d9 alpm: kill alpm_deptest
This has been replaced by the more flexible alpm_find_satisfier
function, and alpm_deptest was completely unsused now.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:27 -06:00
Xavier Chantry
8791ae0fda pacman/deptest: reimplement with alpm_find_satisfier
It's very easy to re-implement the -T feature with the more generic
alpm_find_satisfier rather then the more specific and less useful
alpm_deptest.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:16 -06:00
Xavier Chantry
a03daad073 alpm: add new alpm_find_satisfier function
whatprovides and splitdep were removed, so depcmp alone is quite useless
now without splitdep, and deptest is not flexible enough.

Introduce a new alpm_find_satisfier which is hopefully more flexible,
this should make implementation of deptest very easy, and also help alpm
tools such as pactree.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:07:58 -06:00
Xavier Chantry
c2cce1f46a Fix a few problems reported by clang-analyzer
One missing NULL-check and 3 dead assignments.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:07:15 -06:00
Dan McGee
0e39cf9275 Ensure stdin args are correctly terminated
And don't require pm_targets to be empty to read from stdin either.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:01:14 -06:00
Dan McGee
a35610beba Merge branch 'maint'
Conflicts:
	lib/libalpm/be_local.c
	lib/libalpm/trans.c
2010-12-12 19:53:20 -06:00
Dave Reisner
4fb3cfc48f Support reading package args from stdin
Only occurs if no arguments were provided directly. Arguments can be
separated by any amount of valid whitespace. This allows for piping into
pacman from other programs or from itself, e.g.:

  pacman -Qdtq | pacman -Rs

This is better than using xargs, as xargs will not reconnect stdin to
the terminal. The above operation performed using xargs would require
the --noconfirm flag to be passed to pacman.

Signed-off-by: Dave Reisner <d@falconindy.com>
2010-11-04 21:10:32 -05:00
Dan McGee
0f3957ab48 Merge branch 'maint' 2010-10-18 16:52:57 -05:00
Xavier Chantry
ce96f39ac9 pactest: use valgrind.supp file
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:51:38 -05:00
Jakob Gruber
8f2eaa51c2 Tests: '-S repo/group' syntax
when calling '-S repo/group', only group members in <repo> should should
be installed (group members in other repos are ignored)

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:51:38 -05:00
Jakob Gruber
9d0b33fd33 Tests: Sync group which includes ignored pkgs
* FS#19854 (--ignore is ignored with groups)

* http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html
  (operation aborts when a package from a group is ignored/and user chooses
  not to install it)

If a group member is ignored, we expect
a) a question whether to install
b) after saying 'no' to a), the ignored member not to be installed
c) all other group members to be installed
d) pacman to execute successfully

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:51:38 -05:00
Xavier Chantry
7237903c66 be_package: read force entry and convert to epoch
We still need to read force entry in epoch-aware pacman, so that when we
install an old force package, EPOCH gets written to the local db.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14 20:23:13 -05:00
Carlos Diaz
f5059038f2 bash_completion: remove upstream deprecated functions
Populate $cur and $prev with the new bash-completion 1.2 function,
_get_comp_words_by_ref.

_get_cword and _get_pword have been deprecated.

Signed-off-by: Carlos Diaz <839273@gmail.com>
2010-10-14 06:53:12 -05:00
Dan McGee
de5f438aef Merge branch 'maint' 2010-10-13 23:42:35 -05:00
Dan McGee
73886504d7 Add several pactests for epoch code
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee
93718046d7 Add epoch verification to makepkg
If defined, it must be an integer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee
0d5fa576b3 Update contrib/ for epoch
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee
8aa7ed5a7e Add epoch support to pactest
This adds epoch support to pactest, while still producing packages and
database entries the same way makepkg and repo-add currently do in a
backward compatible fashion (still including the 'force' option).

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
6f37ba61ed Make repo-add and makepkg epoch-aware
Allow it to be a variable in the PKGBUILD as well as propagating it through
to the built package and the package database. We leave some backward
compatibility in place by placing the '%FORCE%' option in the database if
the package contains an epoch; this will be used by older versions of pacman
and more or less ignored by versions that use epoch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
42893e7165 Update documentation to reflect new epoch package variable
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
feb9889f22 Add epoch support to pacman/libalpm
This will allow for better control of what was previously the 'force' option
in a PKGBUILD and transferred into the built package.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
ef32aa0219 Small tweaks after backend merge
Just a few small things I noticed looking through the code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:09:20 -05:00
Dan McGee
68b50c81c7 Merge remote branch 'allan/backend' 2010-10-13 22:46:04 -05:00
Allan McRae
24d77291da Only write to local repos
We do not write to sync repos so kill the code for that.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
5b17d8f27d Clean-up parsing sync database
Remove unnecessary parsing of fields not found in sync desc file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
fbcadebcab Clean-up parsing local database
Remove unnecessary parsing of fields not found in local desc files.
Leave %FORCE% parsing as this likely will make an appearance in desc
files in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
d39248120e Remove lazy loading of deltas
Local packages do not have deltas so remove lazy loading of delta
information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
e464339e3b Move and rename splitname
The splitname function is a general utility function and so is better
suited to util.h.  Rename it to _alpm_splitname to indicate it is an
internal libalpm function as was the case prior to splitting local and
sync db handling.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
448f78c067 Restrict visibility of checkdbdir and get_pkgpath
These functions are only needed by be_local and were only promoted
to db.{h,c} as part of the splitting of handling the local and sync
dbs.  Move them into be_local.c and make them static again.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
5717c7d508 Clean up all old database files and directories
Clean-up the previous download location of the sync database and
any old extracted sync database directories which are unneeded
with the tar-db backend.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
149ab6b272 Only download sync databases
As the sync databases are read directly from the tarball, we no
longer need to extract them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
4a8e396a58 Parse sync database
Read in package information for a tar based sync database. Do not
use lazy loading for sync db.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
5e61f07735 Populate sync db from archive
Read in list of packages for sync db from tar archive.

Breaks reading in _alpm_sync_db_read and a lot of pactests (which
is expected as they do not handle sync db in archives...).

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
fc32faaa6a Completely separate local and sync db handling
Put the db_operations struct to use and completely split the handling
of the sync and local databases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
5b2de3d8ec Separate be_files into be_sync and be_local
The file be_files.c is "split" to be_local.c and be_sync.c in order
to achieve separate handling of sync and local databases.

Some basic clean-up of functions that are only of use for local or
sync databases has been performed and some rough function renaming
in duplicated code has been performed to prevent compilation errors.
However, most of the clean-up and final separation of sync and local
db handling occurs in following patches.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:38 +10:00
Dan McGee
6eedf06fcc Fix bash shell location check
BASH is defined when you are actually using bash during configure, which
sucks because it ends up being '/bin/sh', messing up all of our scripts.
Change the name of the variable we use in configure, and also ensure we get
a full path to the executable by using AC_PATH_PROGS rather than
AC_CHECK_PROGS. Finally, change the variable name everywhere we use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 17:50:54 -05:00
Allan McRae
96e277cfd9 Move db cache handling functions
These will be needed for the handling of both local and sync database
caches, so put them in a common location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Allan McRae
0909a72000 Move database handling utility functions
Move splitname, checkdbdir, get_pkgpath into db.{h,c} as these will be
needed to parse both the local and sync databases during the initial
splitting.  They will be moved out of db.{h,c} at to more appropriate
locations at a later stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Allan McRae
c56b576f6f Fix documentation syntax and typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
efbae3cfcb Initial hack at a DB operations struct
It doesn't do a whole lot yet, but these type of operations will
potentially be different for the DBs we load.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
522ef5e981 Move the cache stuff where it should be
Cache bullshit only has relevance to be_files, so move it there.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: BIG rebase]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
b9a531c2d7 Move changelog functions to callback struct
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
6cebd4e602 Complete rework of package accessor logic
Hopefully we've finally arrived at package handling nirvana, or at least
this commit will get us a heck of a lot closer. The former method of getting
the depends list for a package was the following:

1. call alpm_pkg_get_depends()
2. this method would check if the package came from the cache
3. if so, ensure our cache level is correct, otherwise call db_load
4. finally return the depends list

Why did this suck? Because getting the depends list from the package
shouldn't care about whether the package was loaded from a file, from the
'package cache', or some other system which we can't even use because the
damn thing is so complicated. It should just return the depends list.

So what does this commit change? It adds a pointer to a struct of function
pointers to every package for all of these 'package operations'  as I've
decided to call them (I know, sounds completely straightforward, right?). So
now when we call an alpm_pkg_get-* function, we don't do any of the cache
logic or anything else there- we let the actual backend handle it by
delegating all work to the method at pkg->ops->get_depends.

Now that be_package has achieved equal status with be_files, we can treat
packages from these completely different load points differently. We know a
package loaded from a zip file will have all of its fields populated, so
we can set up all its accessor functions to be direct accessors. On the
other hand, the packages loaded from the local and sync DBs are not always
fully-loaded, so their accessor functions are routed through the same logic
as before.

Net result? More code. However, this code now make it roughly 52 times
easier to open the door to something like a read-only tar.gz database
backend.

Are you still reading? I'm impressed. Looking at the patch will probably be
clearer than this long-winded explanation.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: rebase and adjust]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
d1126db128 Allow local and sync db to be treated separately
Implement this seemingly simple change in package.h:

 typedef enum _pmpkgfrom_t {
-       PKG_FROM_CACHE = 1,
-       PKG_FROM_FILE
+       PKG_FROM_FILE = 1,
+       PKG_FROM_LOCALDB,
+       PKG_FROM_SYNCDB
 } pmpkgfrom_t;

which requires flushing out several assumptions from around the codebase
with regards to usage of the PKG_FROM_CACHE value. Make some changes where
required to allow the switch, and now the correct value should be set (via a
crude hack) depending on whether a package was loaded as an entry in a local
db or a sync db.

This patch underwent some big rebasing from Allan and Dan.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
49176461a6 Unify caching concerns in package accessors
Move almost all of the caching related stuff into a single #define
(which should maybe even just be a static function) so we don't
duplicate logic all over the place. This also makes the code a heck of a
lot shorter and means further changes to this stuff don't have to touch
each and every getter function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:17 +10:00
Dan McGee
a7dc3875f1 contrib/ follow-up work
* Add a .gitignore file
* Use the same 'GEN' output we have in the scripts/ Makefile when doing our
  edits on the .in files
* Remove PKGBUILD.vim and vimprojects from our edit list, they have no need
  to be in the list

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-12 08:26:50 -05:00
Jakob Gruber
5fcb005ebd CLI args: stricter/better parsing
In the following, the letters SRUDQ refer to the corresponding pacman
operations.

Most of the work in this commit is about removing as many options as
possible from the global section and moving them to where they actually
belong.

Additionally, --ignore{,group} are added to U and --dbonly is added
to S.

--dbonly added to S
--asdeps moved to S/U/D
--asexplicit moved to S/U/D
--print-format moved to S/U/R
--noprogressbar moved to S/U/R
--noscriptlet moved to S/U/R
--ignorepkg added to U
--ignoregrp added to U
-d moved to S/U/R (--nodeps) and Q (--deps)
-p moved to S/U/R (--print) and Q (--file)
-f moved to S/U

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:57:36 -05:00
Jakob Gruber
827258f32e CLI args: reorganize parsing
Split parsing of CLI arguments into separate functions:

parsearg_op (operations)
parsearg_global (global options)
parsearg_{database,query,remove,sync,deptest,upgrade}

Organization strictly follows the manpage (even where the manpage is
incorrect) - these cases will be fixed in the following commits.

Switch cases are copy/pasted and statements unrelated to chosen
operation are deleted.

Parsing logic adjusted as follows:

1) Parse operation
2) If we can bail out early (duplicate op, help/version requested) do so
3) Parse arguments again:
    foreach arg:
        if arg is operation:
            continue
        tryparse_args_specific_to_op
        if unsuccessful tryparse_args_global
        if unsuccessful print error message and exit

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:57:26 -05:00
Dan McGee
0ff2a91497 util: fall cleaning on single file programs
* Add a bunch of static declarations where possible
* Fix void functions to be proper syntax, e.g. void func(void)
* Consistency fixes (such as argv references)
* Remove dead str_cmp() function from testdb
* Remove unneeded config.h header includes
* vercmp: remove completely unnecessary string copying

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Nezmer
05f0a28932 Use sysconfdir, localstatedir, BASH instead of hardcoded values
This applies to contrib/ files, our scripts, and the documentation.

Dan: fix 'make clean' in contrib/ directory.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Nezmer
bce3c8efc7 Add .in extension to files in contrib
This is needed If we want to use sysconfdir,localstatedir and other variables.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Xavier Chantry
7d93777231 repo-add: more informative delta messages
- Print an error if database entry was not found and delta entry cannot
  be added
- More informative line when delta entry is added (oldfile -> newfile)

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Xavier Chantry
c9179b09db repo-add: add delta generation
This allows deltas to be generated at repo-add invocation time as opposed to
just added to the database. It will generate the delta from the package
version currently in the database.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:28:43 -05:00
Xavier Chantry
53b41afbe8 pactest: fix typo in ignore001
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:02:03 -05:00
Nezmer
fb79d58109 makepkg: Use mkfifo instead of GNU-only 'mknod <file> p'
'mknod <file> p' is apparently GNU-only. Looking at coreutils' source
code, It just calls mkfifo.

This one line patch should fix makepkg logging in non-GNU systems.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:01:55 -05:00
Jakob Gruber
46ffd342a4 CLI args: add pactest with an invalid combination
Pacman should catch cases in which the passed arguments don't apply to the
current operation (sync/query/...).

Also see FS#20950.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Xavier Chantry
fa933df65b pactest: fix gensync
gensync generated a sync.db file with PKGINFO syntax, this is not quite what
pacman expects.

Also the file was only added to the Server path:
	root/var/pub/sync/sync.db
but it was not available in the normal sync db path:
	root/var/lib/pacman/sync/sync.db

Change gensync() to generate var/lib/pacman/sync/sync.db and then copy it to
var/pub/sync/sync.db (this is used by sync200 -Sy test).

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Xavier Chantry
67068b64b9 pactest: use simpler method to create tar
Just like in 24fc623e1a8bf905cf0367f9bd40bc5bd6034378, apply to pmdb
gensync as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Dan McGee
73442a7e03 Only check for function if we are using libfetch
We did this check unconditionally, rather than only doing it if we were
actually going to build and run with libfetch. This is safe because we would
have already bailed if libfetch was explicitly requested but not found.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Dan McGee
1e0e5b2a02 Remove use of seq in pactree
This is not a bash builtin, so can potentially cause portability issues.
Additionally, the use of it is completely unnecessary as it can all be done
within bash (and done faster).

$ time pactree xfwm4 >/dev/null (old version)
real	0m3.245s

$ time ./contrib/pactree xfwm4 >/dev/null (new version)
real	0m3.042s

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Dan McGee
dff73a2a69 Avoid stat call to determine is_directory if possible
On Linux and OS X, we can determine if an entry obtained through a readdir()
call is a directory without also having to stat it. This can save a
significant number of syscalls. The performance increase isn't dramatic, but
it could be on some platforms (e.g. Cygwin) so it shouldn't hurt to use this
unconditionally where supported.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:03 -05:00
Dan McGee
bef19a266b Merge branch 'maint' 2010-10-05 11:15:56 -05:00
Allan McRae
c0f58ea9a2 makepkg: canonicalize paths from environmental variables
This prevents circular symlinks and weird final package locations
when using commands like  'PKGDEST="." makepkg'.

Fixes FS#20922.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:03:28 -05:00
Allan McRae
960c2cdcf7 makepkg: compare paths using bash test
Compare paths using bash's "-ef" rather than by string tests as this
takes symlinks into account.  This will prevent issues similar to those
in FS#20922 if (e.g.) $PKGDEST is a symlink to $startdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:03:06 -05:00
Allan McRae
f2296aab89 makepkg: improve srcdir check and add pkgdir
The checking of the package for $srcdir references was overly
sensitive and gave a lot of what appear to be false positives with
binary files (in particular with debugging symbols kept).

Restrict the search for $srcdir to non-binary files as this should
still catch the majority of configuration issues the check was
initially designed to catch. Also, add a similar check for $pkgdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 10:58:21 -05:00
Allan McRae
022ec3dbb7 makepkg: remove STRIP_DIRS
For binary packages, the majority of the time used in the debugs symbol
stripping process is the actual stripping of the binaries/libraries and
not the testing of which files to strip.  This allows more complete
stripping of packages that install to "non-standard" paths that would
not be generally included in makepkg.conf.

Any performance hit that may be apparent for (_large_) "arch=('any')"
packages can readily be avoided by disabling stripping in the PKGBUILD
options array.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 10:58:05 -05:00
Sebastian Nowicki
821ff061b1 Set pm_errno on libarchive errors while reading
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-27 10:53:48 -05:00
Dan McGee
f7895cc188 Merge branch 'maint' 2010-09-27 09:24:28 -05:00
Dan McGee
dff06a8170 Merge branch 'build-system' 2010-09-27 09:21:02 -05:00
Allan McRae
900605912b Add FORTIFY_SOURCE support
Adds a check for the minimum mainline GCC version for FORTIFY_SOURCE
support and enables -D_FORTIFY_SOURCE=2 by default when building with
--enable-debug.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-27 16:06:52 +10:00
Allan McRae
28c662e7a4 Add wrapper around asprintf calls
Not checking the return value of asprintf calls reuslts in a warning
when using -D_FORTIRFY_SOURCE=2.  This adds a simple wrapper around
asprintf calls which checks the return value.

Currently the check does nothing more than outputing a message to stderr
on failure, but that is at least an improvement over silent failures.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-27 16:06:51 +10:00
Allan McRae
879fed5098 repo-add: make --quiet output more quiet
Fixes FS#20403.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-27 15:06:59 +10:00
Dan McGee
f489e969f0 Update build system (automake, autoconf, libtool)
Unfortunately this patch is hard to split up into smaller chunks. Our build
system and the associated automake/autoconf/libtool macros has been left
untouched for a while, and could use a refresher.

* Upgrade ltmain.sh to the latest version
* Move away from a huge acinclude.m4 directory to using individual files in
  the m4/ subdirectory, suggested by upstream automake documentation
* Update all macros to their latest available version
* Adjust Makefile.am and autogen.sh to accommodate m4/ subdirectory

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 09:10:53 -05:00
Dan McGee
413508c6fa Update more supplementary build scripts
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 09:08:30 -05:00
Dan McGee
af31fd6494 Update config.guess and config.sub
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:20:50 -05:00
Dan McGee
541f183cd6 Clean up root .gitignore
We had a few files listed in here that we have checked in to our repo, which
doesn't make a whole lot of sense. Also alphabetize the list while we are at
it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:17:06 -05:00
Dan McGee
d2ff8f4b96 Update gettext Makefiles to 0.18
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:17:06 -05:00
Dan McGee
d201d1f312 Merge branch 'maint' 2010-09-15 07:31:37 -05:00
Dan McGee
31aed1243e Remove quotes in remaining bash regexes
After a8dcfeccfc, Allan noted that one more regular exprssion inside makepkg
also contained quotes; these should not be there for the same reason as that
commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-07 08:27:25 -05:00
Dan McGee
e344fab3b1 Restore trimming of db and pkg extensions
These keep having to change because we are getting really good at changing
the downloaded filename. Shorten the match sequences to just .db and .pkg
and trim everything after and including these strings.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-07 08:24:36 -05:00
Dan McGee
fe788ee4a6 Fix libfetch configure checking
I don't know what I tested in commit 3e7b90ff69, but it definitely wasn't
working as advertised. Fix the checks in the source code itself to match the
right define (HAVE_LIBFETCH), as well as make sure the configure check
defaults to looking for the library but not bailing if it could not be
found.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-06 11:20:51 -05:00
Dan McGee
881bf5c90f Merge branch 'maint' 2010-09-03 20:06:08 -05:00
Dan McGee
3e7b90ff69 Clean up libfetch checking in configure
Model it after the new OpenSSL check, and have it be a bit more useful. If
you do not explicitly pass a command line option, it will be linked if
available but will not error out if it is missing. Also bump the version to
that where connection caching was introduced as we use these new features in
the codebase.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 12:30:36 -05:00
Dan McGee
eba521913d Use OpenSSL MD5 crypto functions if available
I've noticed my Atom-powered laptop is dog-slow when doing integrity checks
on packages, and it turns out our MD5 implementation isn't near as good as
that provided by OpenSSL. Using their routines instead provided anywhere
from a 1.4x up to a 1.8x performance benefit over our built-in MD5 function.

This does not remove the MD5 code from our codebase, but it does enable
linking against OpenSSL to get their much faster implementation if it is
available on whatever platform you are using. At configure-time, we will
default to using it if it is available, but this can be easily changed by
using the `--with-openssl` or `--without-openssl` arguments to configure.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 12:05:23 -05:00
Dan McGee
24d8a15308 libalpm md5: use larger and dynamic buffer
This gave at least a 10% improvement on a few tested platforms due to the
reduced number of read calls from files when computing the md5sum. It really
is just a precursor to another patch to come which is to use MD5 functions
that do the job a lot better than anything we can do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 10:33:21 -05:00
Dan McGee
5a25f54757 Merge branch 'maint' 2010-09-01 21:19:06 -05:00
Jürgen Hötzel
38a60f49bd Use pipe to create compressed package instead of an intermediate tar file
A pipe between tar and compression command is used. This improves
performance by running tar and the compression command simultaneously.

Using a pipe also reduces IO by not writing an intermediate tar file
to disk.

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 13:07:57 -05:00
Jonathan Conder
693ebbd16b use execv to avoid using sh just to run ldconfig
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:19:15 -05:00
Jonathan Conder
0223a028e0 redirect scriptlet stderr synchronously through alpm
Fixes FS#18770, and hopefully an occasional deadlock in my frontend as well.
For simplicity it redirects all scriptlet output through SCRIPTLET_INFO, and
all callbacks in the child process have been replaced for thread-safety.

Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:19:09 -05:00
Dan McGee
d14a98db25 Merge branch 'maint' 2010-08-27 11:19:05 -05:00
Dan McGee
a8dcfeccfc makepkg: remove trailing quote mark in regex
Regular expressions in bash should not be quoted. Glad this was in the
documentation and I didn't have to go to #bash to ask...

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:04:21 -05:00
Dan McGee
8d88f0c897 Merge branch 'maint' 2010-08-23 21:53:06 -05:00
Allan McRae
a28868eeae makepkg: error out on empty optdepends entries
If optdepends was defined with empty members, then makepkg would
abort late in the package building process.  Detect such cases
in the check_sanity() function.

Fix-provided-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:51:45 -05:00
Allan McRae
08e1d4764c makepkg: use less local variables in check_sanity
Instead of declaring a new local variable for each loop in the
check_sanity() function, just reuse $i.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:51:12 -05:00
Allan McRae
f04530eb61 makepkg: remove unnecessary variable presence check
It is unnecessary to check for a variables existence before
looping over it.

Extracted from patch supplied by Andres P <aepd87@gmail.com>

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:57 -05:00
Allan McRae
68d8bfa0b5 makepkg: clarify invalid backup entry errors
"Invalid backup entry" was not a particular helpful error message,
especially when it was due to the file not being in the final package.
Clarify these two messages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:46 -05:00
Andres P
f27fed14b1 makepkg: less code duplication in create_package
Combine changelog and install file creation in create_package().

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:49:55 -05:00
Allan McRae
298cbf2cb1 makepkg: use regex to match options for privilege escalation
Eases maintanence if we need to add further options in the future.

Extracted from a patch supplied by Andres P <aepd87@gmail.com>

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:49:44 -05:00
Allan McRae
48589ccc64 Fix some whitespace issues
The combination of tabs and spaces is annoying in any editor that
does not use a tab width of 2 spaces.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:49:05 -05:00
Dan McGee
d896527d21 fgets invocation cleanup
From the fgets manpage:

	fgets() reads in at most one less than size characters from stream and
	stores them into the buffer pointed to by s. Reading stops after an EOF
	or a newline. If a newline is read, it is stored into the buffer. A
	'\0' is stored after the last character in the buffer.

This means there is no need at all to do 'size - 1' math. Remove all of that
and just use sizeof() for simplicity on the buffer we plan on reading into.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:48:28 -05:00
Dan McGee
ce3f4e7800 Enable libfetch connection caching
This will allow downloads to reuse connections if possible, which could make
big differences on perceived FTP speed as the connection won't have to be
reestablished each time. For the most part, HTTP requests wouldn't be using
keep alive anyway so this won't have an effect there.

I'm not enthused about having to do this with the library initialization,
but there isn't a much better place due to the fact that the loop over
databases occurs on the frontend and not the backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 17:42:22 -05:00
Thomas Bächler
8155571183 makepkg: Allow creation of uncompressed packages
When performing local testing, it may be useful to add PKGEXT='.pkg.tar'
to the PKGBUILD to save time, especially with big packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-08 10:24:24 -05:00
Dan McGee
e7d5803f07 Use the plural features of gettext
Gettext has this whole 'Plural-Form' thing that until now we haven't taken
advantage of. Given that not all languages have the same plural form rules
as English, take advantage of it by defining a new _n() macro which will
normally define to ngettext(), and adjust a few messages as an example of
how to use.

There are surely other places where we do singular/plural logic without me
having noticed, so further patches are welcome to fix those up too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 15:50:43 -05:00
Dan McGee
ddc4130c97 Merge branch 'maint' 2010-07-27 10:18:35 -05:00
Allan McRae
a835599496 Download sync db into DBPath/sync
The sync db should be stored in the sync/ folder.  This cleans up
DBPath to only have local/ and sync/ directories in it.

A nice side effect is that the db are now in the right place so we
can implement directly reading from them.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:26:04 -05:00
Allan McRae
68dcabdfbe Remove DBEXT usage
With commit 5dffef78, the repo database always has a symlink
of the form reponame.db.  Use that filename and let libarchive
determine the compression type.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:25:55 -05:00
Allan McRae
60de8ec932 Check return value of fgets calls
Prevents compiler warnings with -D_FORTIFY_SOURCE=2

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:24:57 -05:00
Dan McGee
686b8c1463 Merge branch 'maint'
Conflicts:
	scripts/makepkg.sh.in
2010-07-02 18:29:37 -05:00
Andres P
1a9db4cac7 makepkg: undeclared local variables
Variables that are only meaningful within the function they are declared in are
now prefixed by "local".

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: fix whitespace]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:27:27 -05:00
Nico Schottelius
9ebb596805 manpage: add real world examples
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:27:12 -05:00
Allan McRae
5a3aae02fe Check return value of chdir and getcwd
Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-01 00:14:59 -05:00
Allan McRae
41724cbcde Check return value of fwrite when copying files
Check that writing to destination file actually occurs in
_alpm_copyfile.  Required adding a new error (PM_ERR_WRITE)
as none of the others appeared appropriate.

Prevents compiler warning when using -D_FORTIFY_SOURCE=2.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 23:49:48 -05:00
Dan McGee
96a1255ead Merge branch 'maint' 2010-06-30 08:41:43 -05:00
Allan McRae
c11bf581a3 makepkg: clarify aborting on packaging failure
When makepkg catches a command failure it currently prints "Aborting..."
and exits.  Clarify the reason for aborting from packaging is a failure
during one of the PKGBUILDs functions.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 08:32:34 -05:00
Allan McRae
081e6a8360 Do not compare signed and unsigned types
The casting of nread is safe as it is tested to be >0 when it is
initally assigned.  It is also being implicitly cast in the fwrite
call in the line above.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 08:32:11 -05:00
Dan McGee
630e7508ee Merge branch 'maint' 2010-06-24 08:32:33 -05:00
Eric Bélanger
71330a4310 makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24 08:22:55 -05:00
Andres P
c6a94a8d22 makepkg: fix regression in split package function checking
Commit 13748ca052 inversed the nature of one test wherein the if clause would
throw a fatal error if a legitimate package function was defined in PKGBUILD.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24 08:22:15 -05:00
Dan McGee
67d71ea932 Merge branch 'maint' 2010-06-20 21:01:32 -05:00
Allan McRae
59c47aaf52 Clarify testing within conditional statements
Follow the HACKING guidelines and always use != 0 or == 0 rather
than negation within conditional statements to improve clarity.
Most of these are !strcmp usages which is the example of what not
to do in the HACKING document.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:58 +10:00
Andres P
d7dccd5419 makepkg: remove unnecessary use of sort
pacman -Qq output is sorted according to the users LC_COLLATE
setting as is needed for comm.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:58 +10:00
Andres P
3e4d2c3aa6 libalpm: compare pkgname with strcoll
Use strcoll to compare package names to provide output sorted
according to a users LC_COLLATE settings.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: added commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
f5f107674b makepkg: use parameter expansion instead of basename
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
1b93a116e7 makepkg: fix inconsistent output when checking dependencies
Instead of writing:
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Installing missing dependencies...

Just make it homogeneous:
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
70418e48f6 makepkg: merge in-line splitpkg handling logic
Ease maintainace; the two parts that have been combined into a function were
identical.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: rename function]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
c7a37d039b makepkg: add to variables without expanding them
Use foo+=" bar" instead of foo="${foo} bar"

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
cd042640c6 makepkg: less code repetition for empty variable checking
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
13748ca052 makepkg: use "declare -f" to test for function presence
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
34229c5625 makepkg: fix variable checks when writing pkginfo
Regression caused by c71fe7db. Was checking for "optdepend" and "conflict"
rather than "optdepends" and "conflicts" when populating .PKGINFO.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Nezmer
09aae4b7a5 makepkg: Extract from any file bsdtar can recognize
If "file -bizL" does not return a supported type, check if the file is
recognized by bsdtar and if yes extract from it.

Dan: use '-q' option to prevent needing to seek the entire archive.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
c71fe7db42 makepkg: use printf when writing pkginfo
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
0e96532096 makepkg: use single redirection when writing PKGINFO
Instead of specifying the output file on every echo, leave it to the
caller of write_pkginfo to specify the target.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
f258ffab25 makepkg: use double brackets
Change all instances of the (test) [ builtin to the [[ keyword.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
95145d4c52 makepkg: use type -p's return value for PATH checks
Rely on type -p's return value instead of a string check.

And gettext was previously being checked with type -t, which was
inconsistent with the rest of the tests pertaining commands that aren't
expected to be functions nor builtins.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Allan McRae
3c8816f74b makepkg: fallback to sane defaults for library stripping
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken.  Fallback to a
sane default stripping level.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:32:08 +10:00
815 changed files with 251860 additions and 88156 deletions

24
.editorconfig Normal file
View file

@ -0,0 +1,24 @@
# EditorConfig configuration for pacman
# https://editorconfig.org
# Top-most EditorConfig file
root = true
# Unix-style newlines without trailing whitespaces, but with a newline
# ending every file, utf-8 charset, set indent to tabs
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
[{NEWS,HACKING}]
indent_style = space
[meson.build]
indent_style = space
indent_size = 2
[*.py]
indent_style = space

29
.gitignore vendored
View file

@ -1,30 +1,3 @@
Makefile
Makefile.in
mkinstalldirs
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.status
config.status.lineno
config.rpath
config.sub
configure
configure.lineno
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
*.o
*~
root
tags
cscope.out
cscope.in.out
cscope.po.out
*.o
pacman-*.tar.gz

132
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,132 @@
variables:
MAKEFLAGS: "-j10"
VERBOSE: 1
default:
after_script:
- build-aux/print-failed-test-output build/meson-logs/testlog.json
.arch-test:
image: archlinux:base-devel
before_script:
- >
pacman -Syu --needed --noconfirm
git
gpgme libarchive curl
python
fakeroot fakechroot
meson
artifacts:
when: always
paths:
- build/meson-logs/meson-log.txt
arch:
extends: .arch-test
script:
- meson setup build
- ninja -C build
- fakechroot meson test -C build
arch-debug:
extends: .arch-test
script:
- meson setup --buildtype=debug --werror build
- ninja -C build
- fakechroot meson test -C build
arch-docs:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm asciidoc
- meson setup -Ddoc=enabled build
- ninja -C build
arch-clang:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm clang
- CC=clang meson setup build
- ninja -C build
- 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 setup -Dcrypto=nettle --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-gpg:
extends: .arch-test
script:
- meson setup -Dgpgme=disabled --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-curl:
extends: .arch-test
script:
- meson setup -Dcurl=disabled --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-nls:
extends: .arch-test
script:
- meson setup -Di18n=false --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
debian:
image: debian:bookworm
before_script:
- apt update
- >
apt -y install --no-install-recommends
git pkg-config meson gcc libtool
libgpgme-dev libarchive-dev libcurl4-openssl-dev libssl-dev curl
gettext python3 python3-setuptools dash gawk ca-certificates
fakeroot fakechroot
script:
- meson setup --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
fedora:
image: fedora
before_script:
- >
dnf -y install
git findutils patch sed
meson gcc libtool bsdtar
gpgme-devel libarchive-devel libcurl-devel openssl-devel gettext-devel
asciidoc python3 dash gawk
fakeroot fakechroot
perl-Module-Load-Conditional
script:
- meson setup --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
pages:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm asciidoc
- meson setup -Ddoc=enabled build
- ninja -C build html
artifacts:
paths:
- build/doc
publish: build/doc
rules:
- if: $CI_COMMIT_BRANCH == "release/6.1.x"

View file

@ -3,18 +3,24 @@ Allan McRae <allan@archlinux.org> <mcrae_allan@hotmail.com>
Allan McRae <allan@archlinux.org> <mcrae_allan at hotmail.com>
Allan McRae <allan@archlinux.org> <allan.mcrae@qimr.edu.au>
Andres P <aepd87@gmail.com> <stderr@mail.com>
Andrew Gregory <andrew.gregory.8@gmail.com>
Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Bryan Ischo <bryan@ischo.com> <bji-keyword-pacman.3644cb@www.ischo.com>
Christos Nouskas <nous@archlinux.us> <nouskas@gmail.com>
Daenyth Blank <daenyth+arch@gmail.com> <Daenyth+Arch@gmail.com>
Daenyth Blank <Daenyth+Arch@gmail.com> <Daenyth+git@gmail.com>
Daenyth Blank <Daenyth+arch@gmail.com> <Daenyth+git@gmail.com>
Dave Reisner <dreisner@archlinux.org> <d@falconindy.com>
甘露(Gan Lu) <rhythm.gan@gmail.com>
Giovanni Scafora <giovanni@archlinux.org> <linuxmania@gmail.com>
Jan Alexander Steffens (heftig) <heftig@archlinux.org> <jan.steffens@gmail.com>
Jaroslaw Swierczynski <swiergot@gmail.com> <swiergot@juvepoland.com>
Jonathan Conder <j@skurvy.no-ip.org> <jonno.conder@gmail.com>
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar>
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> <jotapesan@gmail.com>
Manuel Tortosa <manutortosa@chakra-project.org> <manutortosa@gmail.com>
Marc - A. Dahlhaus <mad@wol.de>
Matthias Gorissen <matthias@archlinux.de> <siquame@web.de>
morganamilo <morganamilo@archlinux.org> <morganamilo@gmail.com>
Laszlo Papp <djszapi@archlinux.us> <djszapi2@gmail.com>
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba@petra.hos.u-szeged.hu>
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba at bibl.u-szeged.hu>
@ -23,6 +29,7 @@ Roman Kyrylych <roman@archlinux.org> <roman.kyrylych@gmail.com>
Sebastian Nowicki <sebnow@gmail.com> <xilonmu@gmail.com>
Vojtěch Gondžala <vojtech.gondzala@gmail.com> <vogo@seznam.cz>
Vojtěch Gondžala <vojtech.gondzala@gmail.com> Vojtech Gondzala <vojtech.gondzala@gmail.com>
William Giokas <1007380@gmail.com>
Xavier Chantry <shiningxc@gmail.com>
Xavier Chantry <shiningxc@gmail.com> <chantry.xavier@gmail.com>
Xavier Chantry <shiningxc@gmail.com> <xav@chantry.homelinux.org>

18
.tx/config Normal file
View file

@ -0,0 +1,18 @@
[main]
host = https://www.transifex.com
[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
[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
[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

17
AUTHORS
View file

@ -1,16 +1 @@
Judd Vinet <jvinet@zeroflux.org>
Aurelien Foret <aurelien@archlinux.org>
Aaron Griffin <aaron@archlinux.org>
Dan McGee <dan@archlinux.org>
Miklós Vajna <vmiklos@frugalware.org>
Christian Hamar <krics@linuxforum.hu>
Josh Wheeler <deltalima@gmail.com>
David Kimpe <DNAku@frugalware.org>
James Rosten <seinfeld90@gmail.com>
Roman Kyrylych <Roman.Kyrylych@gmail.com>
Andrew Fyfe <andrew@neptune-one.net>
Chantry Xavier <shiningxc@gmail.com>
Nagy Gabor <ngaba@bibl.u-szeged.hu>
Nathan Jones <nathanj@insightbb.com>
Allan McRae <mcrae_allan@hotmail.com>
Use `git shortlog -s` for a list of contributors.

View file

@ -1,16 +0,0 @@
2007-12-01 Your Name <youremail@domain.com>
* pkgver-pkgrel :
new upstream release.
Reason we changed stuff.
Another reason we changed stuff.
* gcc-4.1.patch :
Removed, no longer needed.
2007-11-01 Your Name <youremail@domain.com>
* 1.0-5 :
added ChangeLog.
the last line should end with just one newline.
you can cat the file to check it displays fine.

101
HACKING
View file

@ -6,16 +6,13 @@ concerns when hacking on pacman. If you are interested in contributing, please
read link:submitting-patches.html[submitting-patches] and
link:translation-help.html[translation-help] as well.
Coding style
Coding Style
------------
1. All code should be indented with tabs. (Ignore the use of only spaces in
this file) By default, source files contain the following VIM modeline:
+
[source,C]
-------------------------------------------
/* vim: set ts=2 sw=2 noet: */
-------------------------------------------
this file.) A tab size of two spaces is used when calculating line widths,
which should be a maximum of 80 characters. An EditorConfig file is used
to set this project-wide default.
2. When opening new blocks such as 'while', 'if', or 'for', leave the opening
brace on the same line as the beginning of the codeblock. The closing brace
@ -35,7 +32,7 @@ while(it) {
if(fn) {
fn(it->data);
} else {
return(1);
return 1;
}
free(it);
it = ptr;
@ -67,21 +64,13 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
NOT
// This is a comment
5. Return statements should be written like a function call.
5. Return statements should *not* be written like function calls.
return(0);
NOT
return 0;
6. The sizeof() operator should accept a type, not a value. (TODO: in certain
cases, it may be better- should this be a set guideline? Read "The Practice
of Programming")
sizeof(alpm_list_t);
NOT
sizeof(*mylist);
return(0);
7. When using strcmp() (or any function that returns 0 on success) in a
6. When using strcmp() (or any function that returns 0 on success) in a
conditional statement, use != 0 or == 0 and not the negation (!) operator.
It reads much cleaner for humans (using a negative to check for success is
confusing) and the compiler will treat it correctly anyway.
@ -90,6 +79,61 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
NOT
if(!strcmp(a, b))
7. Use spaces around almost all arithmetic, comparison and assignment
operators and after all ',;:' separators.
foobar[2 * size + 1] = function(a, 6);
NOT
foobar[2*size+1]=function(a,6);
for(a = 0; a < n && n > 0; a++, n--) {}
NOT
for(a=0;a<n&&n>0;a++,n--) {}
8. Declare all variables at the start of the block.
[source,C]
-------------------------------------------
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
{
char *newurl, *vdata = NULL;
newurl = url;
if(!newurl) {
return -1;
}
...
if(vdata) {
...
}
return 1;
}
-------------------------------------------
NOT
[source,C]
-------------------------------------------
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
{
char *newurl = url;
if(!newurl) {
return -1;
}
char *vdata = NULL;
if(vdata) {
...
}
return 1;
}
-------------------------------------------
Other Concerns
--------------
@ -103,8 +147,6 @@ general pattern, including blank lines:
[source,C]
-------------------------------------------
#include "config.h"
#include <standardheader.h>
#include <another.h>
#include <...>
@ -133,19 +175,4 @@ For pacman:
#include "anythingelse.h"
-------------------------------------------
GDB and Valgrind Usage
~~~~~~~~~~~~~~~~~~~~~~
When using GDB or valgrind on pacman, you will want to run it on the actual
binary rather than the shell script wrapper produced by libtool. The actual
binary lives at `src/pacman/.libs/lt-pacman`, and will exist after running
`./src/pacman/pacman` at least once.
For example, to run valgrind:
./src/pacman/pacman
valgrind --leak-check=full -- src/pacman/.libs/lt-pacman -Syu
/////
vim: set ts=2 sw=2 syntax=asciidoc et:
/////
Never directly include config.h. This will always be added via Makefiles.

243
INSTALL
View file

@ -1,243 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
You will need to build and install two libraries before you can
properly build pacman.
libarchive
http://code.google.com/p/libarchive/
libfetch
ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/net/libfetch/README.html
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
instructions are generic. Run `./configure --help` for specific
options.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View file

@ -1,32 +0,0 @@
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po test/pacman test/util contrib
if WANT_DOC
SUBDIRS += doc
endif
# Make sure we test and build manpages when doing distcheck
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
# Some files automatically included, so they aren't specified below:
# AUTHORS, COPYING, NEWS, README
EXTRA_DIST = HACKING
# Sample makepkg prototype files
pkgdatadir = ${datadir}/${PACKAGE}
dist_pkgdata_DATA = PKGBUILD.proto PKGBUILD-split.proto proto.install ChangeLog.proto
# run the pactest test suite and vercmp tests
check-local: test/pacman test/util src/pacman src/util
$(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
--test $(top_srcdir)/test/pacman/tests/*.py \
-p $(top_builddir)/src/pacman/pacman
rm -rf $(top_builddir)/root
$(SH) $(top_srcdir)/test/util/vercmptest.sh \
$(top_builddir)/src/util/vercmp
# create the pacman DB and cache directories upon install
install-data-local:
for dir in "$(DESTDIR)$(localstatedir)/lib/pacman" "$(DESTDIR)$(localstatedir)/cache/pacman/pkg"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
# vim:set ts=2 sw=2 noet:

1002
NEWS

File diff suppressed because it is too large Load diff

View file

@ -1,63 +0,0 @@
# This is an example of a PKGBUILD for splitting packages. Use this as a
# start to creating your own, and remove these comments. For more information,
# see 'man PKGBUILD'. NOTE: Please fill out the license field for your package!
# If it is unknown, then please put 'unknown'.
# Maintainer: Your Name <youremail@domain.com>
pkgname=('pkg1' 'pkg2')
pkgbase=BASE
pkgver=VERSION
pkgrel=1
pkgdesc=""
arch=()
url=""
license=('GPL')
groups=()
depends=()
makedepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=($pkgbase-$pkgver.tar.gz)
noextract=()
md5sums=() #generate with 'makepkg -g'
build() {
cd "$srcdir/$pkgbase-$pkgver"
./configure --prefix=/usr
make
}
package_pkg1() {
# options and directives that can be overridden
pkgver=
pkgrel=
pkgdesc=""
arch=()
license=()
groups=()
depends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
cd "$srcdir/$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg1
}
package_pkg2() {
# options and directives overrides
pkgdesc=""
cd "$srcdir/$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg2
}

458
README
View file

@ -6,7 +6,7 @@ Package Management) library. This document, while not exhaustive, also
indicates some limitations (on purpose, or sometimes due to its poor design) of
the library at the present time.
There is one special file,"alpm.h", which is the public interface that
There is one special file, "alpm.h", which is the public interface that
should be distributed and installed on systems with the library. Only
structures, data and functions declared within this file are made available to
the frontend. Lots of structures are of an opaque type and their fields are
@ -52,9 +52,15 @@ library is initialized.
* logcb: The callback function for "log" operations.
* dlcb: The callback function for download progress of each package.
* fetchcb: Callback for custom download function.
* totaldlcb: The callback function for overall download progress.
* root: The root directory for pacman to install to (Default: /)
* dbpath: The toplevel database directory (Default: /var/lib/pacman)
* eventcb: Callback for transaction messages.
* questioncb: Callback for selecting amongst choices.
* progresscb: Callback to handle display of transaction progress.
* gpgdir: Directory where GnuPG files are stored.
* arch: Allowed package architecture.
* checkspace: Check disk space before installing.
* default_siglevel: Default signature verification level.
* local_file_siglevel: Signature verification level for local file upgrades.
* remote_file_siglevel: Signature verification level for remote file upgrades.
* logfile: The base path to pacman's log file (Default: /var/log/pacman.log)
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
@ -71,14 +77,10 @@ alpm_option_{get,set}_noupgrades -> alpm_option_{add,remove}_noupgrade.
The following options are read-only, having ONLY alpm_option_get_* functions:
* lockfile: The file used for locking the database
(Default: <dbpath>/db.lck)
* localdb: A pmdb_t structure for the local (installed) database
* syncdbs: A list of pmdb_t structures to which pacman can sync from.
* root: The root directory for pacman to install to
* dbpath: The toplevel database directory
* lockfile: The file used for locking the database (Default: <dbpath>/db.lck)
The following options are write-only, having ONLY alpm_option_set_* functions:
* usedelta: Download delta files instead of complete packages if possible.
[Transactions]
@ -154,7 +156,7 @@ specified error code into a more friendly sentence, and alpm_strerrorlast()
does the same for the last error encountered (represented by pm_errno).
[List - alpm_list_t]
[List - alpm_list_t]
The alpm_list_t structure is a doubly-linked list for use with the libalpm
routines. This type is provided publicly so that frontends are free to use it
@ -192,8 +194,8 @@ remove.c and sync.c).
The frontend is using a configuration file, usually "/etc/pacman.conf". Some
of these options are only useful for the frontend only (mainly the ones used to
control the output like showsize or totaldownload, or the behavior with
cleanmethod and syncfirst). The rest is used to configure the library.
control the output like verbosepkglist, or the behavior with cleanmethod).
The rest is used to configure the library.
[UPGRADE/REMOVE/SYNC]
@ -237,7 +239,7 @@ API CHANGES BETWEEN 3.1 AND 3.2
- alpm_checkdbconflicts()
- alpm_sync_newversion()
- alpm_deptest()
- error codes :
- error codes:
PM_ERR_DLT_INVALID, PM_ERR_LIBARCHIVE, PM_ERR_LIBDOWNLOAD and
PM_ERR_EXTERNAL_DOWNLOAD
- flags:
@ -328,3 +330,429 @@ API CHANGES BETWEEN 3.3 AND 3.4
- alpm_pkg_unused_deltas()
- alpm_conflict_get_reason()
- error code: PM_ERR_PKG_INVALID_ARCH
API CHANGES BETWEEN 3.4 AND 3.5
===============================
[REMOVED]
- alpm_db_register_local()
- alpm_pkg_has_force()
- alpm_depcmp()
[CHANGED]
- alpm_trans_cb_progress type had some types changed from int to size_t
- alpm_cb_log format string is now const char *
- the interface to add/remove targets:
- functions take pmpkg_t * rather than char *.
- alpm_sync_target() and alpm_sync_dbtarget() are replaced by alpm_add_pkg()
- alpm_add_target() is replaced by alpm_add_pkg()
- alpm_remove_target() is replaced by alpm_remove_pkg()
- packages can come from:
- alpm_db_get_pkg() for normal targets
- alpm_find_dbs_satisfier() for versioned provisions
- alpm_find_grp_pkgs() for groups
- alpm_deptest() is replaced by the more flexible alpm_find_satisfier()
- size_t used for alpm_list_t sizes
- return type for alpm_list_count()
- parameter type in alpm_list_msort() and alpm_list_nth()
[ADDED]
- alpm_option_get_checkspace(), alpm_option_set_checkspace()
- alpm_find_grp_pkgs()
- alpm_trans_get_flags()
- error codes:
PM_ERR_DISK_SPACE, PM_ERR_WRITE
- flags:
PM_TRANS_FLAG_NODEPVERSION, PM_TRANS_EVT_DISKSPACE_START,
PM_TRANS_EVT_DISKSPACE_DONE, PM_TRANS_CONV_SELECT_PROVIDER,
PM_TRANS_PROGRESS_DISKSPACE_START, PM_TRANS_PROGRESS_INTEGRITY_START
API CHANGES BETWEEN 3.5 AND 4.0
===============================
[REMOVED]
- error codes:
PM_ERR_LIBFETCH, PM_ERR_WRITE
- alpm_option_set_root(), alpm_option_set_dbpath()
- alpm_list_first()
- alpm_grp_get_name(), alpm_grp_get_pkgs()
- alpm_delta_get_from(), alpm_delta_get_to(), alpm_delta_get_filename(),
alpm_delta_get_md5sum(), alpm_delta_get_size()
- alpm_miss_get_target(), alpm_miss_get_dep(), alpm_miss_get_causingpkg()
- alpm_dep_get_mod(), alpm_dep_get_name(), alpm_dep_get_version()
- alpm_conflict_get_package1(), alpm_conflict_get_package2(),
alpm_conflict_get_reason()
- alpm_fileconflict_get_target(), alpm_fileconflict_get_type(),
alpm_fileconflict_get_file(), alpm_fileconflict_get_ctarget()
- alpm_db_get_url()
[CHANGED]
- PM_ prefixes for enum values are now ALPM_
- pm prefixes for structs and enums are now alpm_
- alpm_initialize now has parameters: char *root, char *dbpath,
alpm_errno_t *err and returns an alpm_handle_t struct.
- alpm_release now takes an alpm_handle_t *.
- alpm_db_register_sync() now requires a extra parameter of a alpm_siglevel_t.
- alpm_pkg_load() now requires an extra parameter of an alpm_siglevel_t
- alpm_db_setserver() replaced by alpm_db_set_servers(), alpm_db_add_server(),
alpm_db_remove_server()
- alpm_trans_init() no longer takes callbacks, set those using
alpm_option_set_*cb() functions
- many functions now require a first parameter of an alpm_handle_t *:
- alpm_option_get_*
- alpm_option_set_*
- alpm_option_add_*
- alpm_option_remove_*
- alpm_trans_*
- alpm_add_pkg
- alpm_checkconflicts
- alpm_checkdeps
- alpm_db_register_sync
- alpm_db_set_pkgreason
- alpm_db_unregister_all
- alpm_fetch_pkgurl
- alpm_find_dbs_satisfier
- alpm_logaction
- alpm_pkg_load
- alpm_release
- alpm_remove_pkg
- alpm_sync_sysupgrade
- several structs are no longer opaque:
- alpm_conflict_t
- alpm_delta_t
- alpm_depend_t
- alpm_depmissing_t
- alpm_depmod_t
- alpm_fileconflict_t
- alpm_group_t
- alpm_pkg_reason_t
[ADDED]
- option functions:
- alpm_{get,set}_eventcb()
- alpm_option_{get,set}_convcb()
- alpm_option_{get,set}_progresscb()
- package signing functions:
- alpm_option_get_default_siglevel()
- alpm_option_set_default_siglevel()
- alpm_option_get_gpgdir()
- alpm_option_set_gpgdir()
- alpm_db_get_siglevel()
- alpm_siglist_cleanup()
- alpm_db_check_pgp_signature()
- alpm_pkg_check_pgp_signature()
- alpm_pkg_get_origin()
- alpm_pkg_get_sha256sum()
- alpm_pkg_get_base64_sig()
- list functions:
- alpm_list_to_array()
- alpm_list_previous()
- structs:
- alpm_backup_t
- alpm_file_t
- alpm_filelist_t
- enums:
- alpm_siglevel_t
- alpm_sigstatus_t
- alpm_sigvalidity_t
- alpm_pkgfrom_t
- error codes:
ALPM_ERR_DB_INVALID, ALPM_ERR_DB_INVALID_SIG, ALPM_ERR_GPGME,
ALPM_ERR_PKG_INVALID_CHECKSUM, ALPM_ERR_PKG_INVALID_SIG, ALPM_ERR_SIG_INVALID,
ALPM_ERR_SIG_MISSING
API CHANGES BETWEEN 4.0 AND 4.1
===============================
[REMOVED]
- alpm_list_getdata()
[CHANGED]
- alpm_pkgfrom_t members are now prefixed with ALPM_
- alpm_siglevel_t - added members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
- alpm_depend_t - additional desc member
- alpm_filelist_t - additional resolved_path member
- alpm_pgpkey_t - added members length, revoked, pubkey_algo
- alpm_logaction - added caller identifier argument
- function renaming:
- alpm_option_get_localdb -> alpm_get_localdb
- alpm_option_get_syncdbs -> alpm_get_syncdbs
- alpm_db_register_sync -> alpm_register_syncdb
- alpm_db_unregister_all -> alpm_unregister_all_syncdbs
- alpm_db_readgroup -> alpm_db_get_group
- alpm_db_set_pkgreason -> alpm_pkg_set_reason (handle parameter removed)
- alpm_time_t typedef used for all times:
- members of alpm_pgpkey_t
- return types of alpm_pkg_get_builddate and alpm_pkg_get_installdate
- delta options now use required ratio rather than on/off:
- alpm_option_get_usedelta -> alpm_option_get_deltaratio
- alpm_option_set_usedelta -> alpm_option_set_deltaratio
[ADDED]
- tracking of how a package was validated:
- alpm_pkgvalidation_t
- alpm_pkg_get_validation()
- adjustable signature verification levels for upgrade operations:
- alpm_option_get_local_file_siglevel()
- alpm_option_set_local_file_siglevel()
- alpm_option_get_remote_file_siglevel()
- alpm_option_set_remote_file_siglevel()
- sync database usage functions:
- alpm_db_usage_t
- alpm_db_set_usage()
- alpm_db_get_usage()
- wrapper functions for reading mtree files:
- alpm_pkg_mtree_open()
- alpm_pkg_mtree_next()
- alpm_pkg_mtree_close()
- utility functions:
- alpm_pkg_find()
- alpm_pkg_compute_optionalfor()
- alpm_filelist_contains()
- types:
- alpm_time_t
- alpm_errno_t
- flags:
ALPM_EVENT_OPTDEP_REQUIRED, ALPM_EVENT_DATABASE_MISSING,
ALPM_EVENT_KEYRING_START, ALPM_EVENT_KEYRING_DONE, ALPM_EVENT_KEY_DOWNLOAD_START,
ALPM_EVENT_KEY_DOWNLOAD_DONE, ALPM_PROGRESS_KEYRING_START
API CHANGES BETWEEN 4.1 AND 4.2
===============================
[CHANGED]
- alpm_filelist_t - removed member resolved_path
- alpm_filelist_contains - now returns alpm_file_t
- event callback:
- alpm_event_t renamed to alpm_event_type_t
- alpm_event_t union added
- alpm_event_cb now takes only an alpm_event_t parameter
- alpm_event_any_t, alpm_package_operation_t, alpm_event_package_operation_t,
alpm_event_optdep_removal_t, alpm_event_delta_patch_t, alpm_event_scriptlet_info_t,
alpm_event_database_missing_t, alpm_event_pkgdownload_t, alpm_event_pacnew_created_t,
alpm_event_pacsave_created_t, alpm_event_pacorig_created_t added
- ALPM_EVENT_*_START -> ALPM_EVENT_PACKAGE_OPERATION_START
- ALPM_EVENT_*_DONE -> ALPM_EVENT_PACKAGE_OPERATION_DONE
- question callback:
- alpm_question_t renamed to alpm_question_type_t
- alpm_question_t union added
- alpm_cb_question now takes only an alpm_question_t parameter
- alpm_question_any_t, alpm_question_install_ignorepkg_t, alpm_question_replace_t
alpm_question_conflict_t, alpm_question_corrupted_t, alpm_question_remove_pkgs_t,
alpm_question_select_provider_t, alpm_question_import_key_t added
[ADDED]
- memory management:
- alpm_fileconflict_free()
- alpm_depmissing_free()
- alpm_conflict_free()
- alpm_dep_free()
- database usage:
- alpm_db_usage_t
- alpm_db_set_usage()
- alpm_db_get_usage()
- assume installed:
- alpm_option_get_assumeinstalled()
- alpm_option_add_assumeinstalled()
- alpm_option_set_assumeinstalled()
- alpm_option_remove_assumeinstalled()
- using noupgrade/noextract:
- alpm_option_match_noupgrade()
- alpm_option_match_noextract()
- utility functions:
- alpm_dep_from_string()
- alpm_pkg_should_ignore()
- alpm_decode_signature()
- alpm_extract_keyid()
- flags:
ALPM_EVENT_RETRIEVE_DONE, ALPM_EVENT_RETRIEVE_FAILED, ALPM_EVENT_PKGDOWNLOAD_START,
ALPM_EVENT_PKGDOWNLOAD_DONE, ALPM_EVENT_PKGDOWNLOAD_FAILED, ALPM_EVENT_OPTDEP_REMOVAL,
ALPM_EVENT_PACNEW_CREATED, ALPM_EVENT_PACSVAE_CREATED, ALPM_EVENT_PACORIG_CREATED
API CHANGES BETWEEN 4.2 AND 5.0
===============================
[REMOVED]
- alpm_siglevel_t - removed members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
- removed .pacorig generation:
- ALPM_EVENT_PACORIG_CREATED
- alpm_event_pacorig_created_t
- alpm_event_t.pacorig_created
[ADDED]
- hook support:
- alpm_option_get_hookdirs()
- alpm_option_set_hookdirs()
- alpm_option_add_hookdir()
- alpm_option_remove_hookdir()
- alpm_event_hook_t, alpm_event_hook_run_t
- alpm_hook_when_t
- ALPM_EVENT_HOOK_START, ALPM_EVENT_HOOK_DONE
- ALPM_EVENT_HOOK_RUN_START, ALPM_EVENT_HOOK_RUN_DONE
- ALPM_ERR_TRANS_HOOK_FAILED
- different database extension support:
- alpm_option_get_dbext()
- alpm_option_set_dbext()
- pkgbase accessor:
- alpm_pkg_get_base()
- transaction events:
- ALPM_EVENT_TRANSACTION_START, ALPM_EVENT_TRANSACTION_DONE
- database unlocking:
- alpm_unlock()
API CHANGES BETWEEN 5.0 AND 5.1
===============================
[CHANGED]
- alpm_errno_t - added member ALPM_ERR_OK
- alpm_siglevel_t - value of ALPM_SIG_USE_DEFAULT changed
- functions using bitfields return/pass an int instead of an enum:
- alpm_option_get_default_siglevel()
- alpm_option_set_default_siglevel()
- alpm_option_get_remote_file_siglevel()
- alpm_option_set_remote_file_siglevel()
- alpm_register_syncdb()
- alpm_db_get_siglevel()
- alpm_db_set_usage()
- alpm_db_get_usage()
- alpm_pkg_load()
- alpm_pkg_get_validation()
- alpm_trans_get_flags()
- alpm_trans_init()
- alpm_option_get_local_file_siglevel()
- alpm_option_set_local_file_siglevel()
[ADDED]
- overwrite support:
- alpm_option_get_overwrite_files()
- alpm_option_set_overwrite_files()
- alpm_option_add_overwrite_file()
- alpm_option_remove_overwrite_file()
- download timeout control:
- alpm_option_set_disable_dl_timeout()
- access make/checkdepends info:
- alpm_pkg_get_checkdepends()
- alpm_pkg_get_makedepends()
- check pacman capabilities:
- alpm_capabilities()
- duplicate and add to list:
- alpm_list_append_strdup()
API CHANGES BETWEEN 5.1 AND 5.2
===============================
[REMOVED]
- package delta support:
- alpm_delta_t
- alpm_event_delta_patch_t
- alpm_event_t union - removed alpm_event_delta_patch_t
- ALPM_EVENT_DELTA_INTEGRITY_START, ALPM_EVENT_DELTA_INTEGRITY_DONE,
ALPM_EVENT_DELTA_PATCHES_START, ALPM_EVENT_DELTA_PATCHES_DONE,
ALPM_EVENT_DELTA_PATCH_START, ALPM_EVENT_DELTA_PATCH_DONE,
ALPM_EVENT_DELTA_PATCH_FAILED
- ALPM_ERR_DLT_INVALID, ALPM_ERR_DLT_PATCHFAILED
- alpm_option_get_deltaratio()
- alpm_option_set_deltaratio()
- alpm_pkg_get_deltas()
- alpm_pkg_unused_deltas()
- alpm_transflag_t - removed member ALPM_TRANS_FLAG_FORCE
[CHANGED]
- alpm_errno_t - added member ALPM_ERR_MISSING_CAPABILITY_SIGNATURES
- alpm_sync_newversion() replaced with alpm_sync_get_new_version() which
does not filter on any ALPM_DB_USAGE_*.
API CHANGES BETWEEN 5.2 AND 6.0
===============================
[REMOVED]
- ALPM_EVENT_PKGDOWNLOAD_START, ALPM_EVENT_PKGDOWNLOAD_DONE, ALPM_EVENT_PKGDOWNLOAD_FAILED
- ALPM_ERR_PKG_REPO_NOT_FOUND
- old TotalDownload implementation:
- alpm_cb_totaldl
- alpm_option_get_totaldlcb()
- alpm_option_set_totaldlcb()
[CHANGED]
- alpm_db_update() now accepts a list of databases rather than a single database.
- alpm_fetch_pkgurl() accepts a list of packages to download.
- alpm_db_search() now has an additional parameter and returns success status
- ALPM_EVENT_RETRIEVE_* -> ALPM_EVENT_DB_RETRIEVE_* and ALPM_EVENT_PKG_RETRIEVE_*
- alpm_cb_download pass event and data
- multi architecture support:
- alpm_option_get_arch() -> alpm_option_get_architectures()
- alpm_option_set_arch() -> alpm_option_set_architectures()
- alpm_db_get_servers() copies parameter data
[ADDED]
- parallel download support:
- alpm_option_set_parallel_downloads()
- alpm_option_get_parallel_downloads()
- file download events:
- alpm_download_event_type_t
- alpm_download_event_init_t
- alpm_download_event_progress_t
- alpm_download_event_completed_t
- download misc:
- ALPM_DOWNLOAD_RETRY
- alpm_download_event_retry_t
- alpm_event_pkg_retrieve_t
- multiarchitecture support:
- alpm_option_add_architecture()
- alpm_option_remove_architecture()
- misc:
- alpm_pkg_get_sig()
- callbacks add front-end provided context
API CHANGES BETWEEN 6.0 AND 6.1
===============================
[REMOVED]
- alpm_trans_t
[CHANGED]
- alpm_conflict_t - full package added as member, removing package name and name
hash members
- alpm_question_import_key_t - holds key uid and fingerprint rather than alpm_pgpkey_t
- alpm_pkgreason_t - added ALPM_PKG_REASON_UNKNOWN
- alpm_transflag_t - added ALPM_TRANS_FLAG_NOHOOKS
[ADDED]
- extensible package data type:
- alpm_pkg_xdata_t
- alpm_pkg_get_xdata()
- accessor functions:
- alpm_db_get_handle()
- alpm_pkg_get_handle()
- cache server support:
- alpm_db_get_cache_servers()
- alpm_db_set_cache_servers()
- alpm_db_add_cache_server()
API CHANGES BETWEEN 6.1 AND 7.0
===============================
[ADDED]
- sandbox functions:
- alpm_option_get_sandboxuser()
- alpm_option_set_sandboxuser()
- alpm_option_set_disable_sandbox()
- alpm_sandbox_setup_child()
API CHANGES BETWEEN 7.0 AND 7.1
===============================
[CHANGED]
- error codes:
PM_ERR_TRANS_COMMITING renamed to PM_ERR_TRANS_COMMITTING

34
RELEASE Normal file
View file

@ -0,0 +1,34 @@
The following checklist should be used for making a pacman release.
- Ensure "ninja dist" succeeds
- Call a freeze to development.
- Send translation updates to Transifex at least two weeks before a major
release (see below). At this stage, strings can only be changed for a
major issue.
- Update NEWS and README files
- Pull translation updates from Transifex
- Update version in meson.build as described in file
- Update doc/index.asciidoc
- Create a signed git tag (git tag -s vX.Y.Z -m "commit message")
- Create and sign release tarballs (generate with "ninja dist")
- Create release on gitlab project page
- Upload release tarball and signature to gitlab ("glab release upload ...")
- Create branch release/?.?.x (with ?.? replaced by major version number)
- Update .gitlab-ci.yml to point the website pages run at release branch
Transifex updates are handled using the transifex client. The basic process is:
- Pull updates from transifex ("tx pull -f --minimum-perc 75")
- Update po files ("./build-aux/update-po")
- Fix all translation errors found (e.g. using "mint-check-translations")
- Add any new locales to the relevant LINGUAS file
- Optional: Make any manual changes needed (e.g. fixing spacing in a string)
and update po files again
- Push updated po files to transifex ("tx push -s -t --skip")
Point releases:
- all bugs fixes slated for the release branch must first land on master
(unless no longer relevant)
- following the initial post-release period when the release and master
branches may be kept in sync, commits are backported to the release branch
using "git cherry-pick -x"
- translation updates should be pulled onto the release branch only

View file

@ -1,57 +0,0 @@
== This is my custom TODO file ==
* transaction object should contain two package list (install and remove)
instead of a single list of syncpkgs - this should allow us to get rid of that
type. This also requires seperate functionality to return a list of
"replaces" packages to the front end, so the frontend can handle the QUESTION()
stuff in that case
* libalpm -> front end communication needs a work-up. Both progress functions
can be combined into one callback, IFF we adjust it to accept a prefix string
for the progress bars, and format it at the lib side. Question functions
should also do the same - create the string at the library side, and simply
call some sort of int yes_no = ask_question("Do foo with bar?");
* move logging (alpm_logaction) out of the library. log files should be
written by the app, not the library. Adding a PM_LOG_* constant that
frontends can recognize and send to a file is probably a good idea.
* clear up list allocation/deallocation - some lists need to be free'd, some
do not and there is no clear indication WHEN this should happen.
* remove DB entries (directories) on a read error?
* Add a pm_errstr error string, which will allow us to do things like:
pm_errno = PM_ERR_LIBARCHIVE;
pm_errstr = archive_error_string(archive);
or:
pm_errno = PM_ERR_LIBDOWNLOAD;
pm_errstr = downloadLastErrString;
This way we don't break abstraction when returning specific errors in
cases like the above.
* pacman: A LOT of functions are way too long. There should be an upper limit of
100-200 lines. _alpm_add_commit is around 600 lines, and is far too complex.
* pacman: fixup doxygen documentation for public interface
* feature for 3.1: package file hooks *
I've been planning on this one for some time. Here's a simple rundown:
in /etc/pacman.d/hooks:
Hook /usr/include/* : /usr/bin/ctags -R /usr/include/*.h -f /usr/include/systags
This will allow us to make "global hooks" to simplify a lot of repetitive
install files (scrollkeeper, depmod, etc). This also allows us to move
ldconfig out of pacman entirely.
possible: /etc/pacman.hooks/* files for hooks, so packages can add them too
* feature for 3.1: multiple search/match types
option: MatchType regex (current way)
MatchType fnmatch (use fnmatch to match things like 'pacman -S gnome*')
MatchType plain (no matching. expect plain text).
* feature for 3.1: revamp the autotools system. I'd LOVE to use a manual system
like wmii and friends do. It'd be real nice if we could just do away with
autotools altogether.
**** BUGS ****
* Removal of conflicts on -A and -U (INCOMPLETE)

101
TODO.dan
View file

@ -1,101 +0,0 @@
TODO.dan
========
This is my personal TODO list. No guarantees if it is out of date and things no
longer apply. If you want to help out with any of it, send me an email.
Pacman 3.1:
-----------
Downgrade feature - allow users to see cached packages and downgrade to
(previous or any?) available options.
Installed size and download size in -Si/Qi output should scale with package
size- KB to MB to GB. We should also get consistancy of K/KB, M/MB, etc.
Extreme similarity between some of the sync and add code...we have to be able
to abstract more away from sync actions and add actions to just 'actions'
(example: sync,c, add.c, and deptest.c all contain a switch on PM_DEP_MOD_*).
Merge update, add, and sync code when possible, so we reduce duplication.
Review progress/transaction event subsystem. (from TODO)
Add Doxygen comments to every function in libalpm including private functions.
Ensure functions are doing exactly their purpose and nothing more. Find
functions that perform duplicate behavior and merge them. Combine and refactor
others. Delete unnecessary functions. Stop keeping everything clustered in
little add/sync/remove parts, allow transactions to share code.
Go through options list. Decide if namings are good, all options are still
relevant, etc. Ideas for -Re (#6273), changing meaning of -c (has two meanings,
another FS bug), etc. Remove the -A flag and possibly -D, -T, and -Y (-Y is
killed now in favor of vercmp binary) if they can be done by other actions.
Possible switch of -U --> -I (#5571).
Review display and logging functions. There seems to be an abundance of them.
Make it extensible to use color, review what verbose/debug means. Perhaps
separate logging functionality- Pacman has its normal log, and alpm backend
keeps a very simple log file - listing only adds (including syncs) and removes.
This way a consistency list can be kept of what is currently installed and what
isn't, without all the logging junk from the front end.
Profile the code. Find the functions that are being called a lot, and see what
can be done about it. Find out if all these calls are necessary (e.g. excessive
alpm_list_count calls), and maybe think about changing data structures to speed
operations up (e.g. a 'count' field). NOTE: already found two huge issues with
quick profiling- excessive setlocale calls, and extremely excessive strcmp
calls.
Fix other localized issues- use non-printf when necessary. We may need to use
some wchar_t output on the progress bar as char/byte counts differ here. Sizes
of packages (e.g. 10,400.23 MB) should all be localized with correct
seperators.
Rewrite makepkg to use terminal-safe coloring/bolding. tput utility should
allow us to do this. Make universal message functions for systemwide use,
including all pacman utilites- abs, pacman-optimize, etc.
Bugs/FRs to smash: 6468, 6437, 6430?, 6420, 6404, 6389, 6312?, 6284, 6273?,
6255?, 6208, 5987, 5885, 5571, 4182, 3492, 2810?, 1769, 1588, 1571
Update doxygen comments, they may need some work. Try to document all of the
private internal functions too- it helps a ton for people just getting a
start on pacman hacking.
Other smaller things:
---------------------
unsigned int vs. unsigned- determine a standard and stick with it
FS #4185 - move where message is logged, perhaps?
Update copyrights (2007)
Update pacman website, and add/finish pacman coding style page
Refine makepkg error codes. Each kind of failure could have its own code:
--package already built
--failed integ checks
--failed build
--etc.
Add utility function to either frontend or backend to convert sizes: e.g. bytes
to KB, MB, GB.
Revamp the downloadprog function a bit. Seems kind of messy.
--print-uri option to sync should not require saying yes or no to up to date
Build a replacement for this, or at least standardize its use. We shouldn't
always need to pass handle->root around, it is constant. Something like char*
buildpath(file).
/* build the new entryname relative to handle->root */
snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
Random ideas:
-------------
Possibly split utilities/extras from pacman package
Make .indent.pro file for GNU indent (started, but didn't finish)

View file

@ -1,14 +1,13 @@
Thanks to all of those who have helped translate pacman, both in the past
and currently. Here are some of the current translators (past translators
can be found by looking in the GIT history).
Thanks to all of those who have helped translate pacman, both in the past and
currently. Our translations are currently maintained in Transifex; please read
doc/translation-help.txt for more details.
If your language is listed here and you are interested in helping translate,
contact either the pacman mailing list at pacman-dev@archlinux.org, or one
of the translators listed above.
Below is a list of past translators before we switched to Transifex; more can
be found by looking in the Git history.
If your language is not listed here and you wish it was, let the pacman mailing
list know you are interested in making a translation. We will be happy to add
your language to the mix.
If your language is not already in the various po/ subdirectories and you wish
it was, set up a team in Transifex for your language and we will be happy to
add your language to the mix.
Catalan (ca):
Manuel Tortosa <manutortosa@chakra-project.org>

File diff suppressed because it is too large Load diff

View file

@ -1,37 +0,0 @@
#!/bin/sh -xu
[ -f Makefile ] && make distclean
rm -rf autom4te.cache
rm -f {Makefile.in,Makefile}
rm -f {config.h.in,config.h}
rm -f config.status
rm -f configure
rm -f stamp*
rm -f aclocal.m4
rm -f compile
rm -f libtool
rm -f lib/libalpm/{Makefile.in,Makefile}
rm -f src/util/{Makefile.in,Makefile}
rm -f src/pacman/{Makefile.in,Makefile}
rm -f scripts/{Makefile.in,Makefile}
rm -f etc/{Makefile.in,Makefile}
rm -f etc/pacman.d/{Makefile.in,Makefile}
rm -f etc/abs/{Makefile.in,Makefile}
rm -f test/{pacman,util}{,/tests}/{Makefile.in,Makefile}
rm -f contrib/{Makefile.in,Makefile}
rm -f doc/{Makefile.in,Makefile}
rm -f test/pacman/*.pyc
rm -f doc/html/*.html
rm -f doc/man3/*.3
rm -f po/{Makefile.in,Makefile}
rm -f po/POTFILES
rm -f po/stamp-po
rm -f po/*.gmo
rm -f lib/libalpm/po/{Makefile.in,Makefile}
rm -f lib/libalpm/po/POTFILES
rm -f lib/libalpm/po/stamp-po
rm -f lib/libalpm/po/*.gmo

View file

@ -1,6 +0,0 @@
#!/bin/sh -xu
aclocal
autoheader
automake --foreign
autoconf

2
build-aux/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!ltmain-asneeded.patch

11
build-aux/cat-test-file Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/python3
import sys
for path in sys.argv[1:]:
print('# -----------------------------------')
print('# ' + path + ':')
print('# -----------------------------------')
with open(path, 'r') as f:
for line in f:
print('# ' + line, end='')

View file

@ -0,0 +1,29 @@
#!@BASH@
input=$1
output=$2
mode=$3
sed \
-e "s|@rootdir[@]|@ROOTDIR@|g" \
-e "s|@localedir[@]|@LOCALEDIR@|g" \
-e "s|@sysconfdir[@]|@sysconfdir@|g" \
-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" \
-e "s|@PACKAGE_NAME[@]|@PACKAGE_NAME@|g" \
-e "s|@BUILDSCRIPT[@]|@BUILDSCRIPT@|g" \
-e "s|@TEMPLATE_DIR[@]|@TEMPLATE_DIR@|g" \
-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
chmod "$mode" "$output"
fi

View file

@ -0,0 +1,10 @@
#!/bin/sh
set -eu
# this is needed mostly because $DESTDIR is provided as a variable,
# and we need to create the target directory...
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
rm -f "${DESTDIR:-}$2"
ln -vs "$1" "${DESTDIR:-}$2"

View file

@ -0,0 +1,17 @@
#!/usr/bin/python
import json
import sys
def print_result(result):
print('==================================================================')
print(result['name'])
print(' '.join(result['command']))
print('==================================================================')
print(result['stdout'])
with open(sys.argv[1], 'r') as f:
for line in f:
result = json.loads(line)
if result['result'] == 'FAIL':
print_result(result)

6
build-aux/script-wrapper.sh.in Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
# This script serves as a trampoline for running scripts which depend on
# libmakepkg with the libmakepkg within the build tree.
MAKEPKG_LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"

8
build-aux/update-copyright Executable file
View file

@ -0,0 +1,8 @@
#! /bin/sh
OLD=$1
NEW=$2
for file in $(git grep -l "Copyright .* Pacman Development" | grep -v "\.po"); do \
sed -i -e "/Copyright (/s/-${OLD}/-${NEW}/" -e "/Copyright (/s/ ${OLD}/ ${OLD}-${NEW}/" "$file"
done

39
build-aux/update-po Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
find_build_directory() {
local build_dirs=(*/build.ninja)
if [[ ! -e ${build_dirs[0]} ]]; then
echo "error: No build directory found. Have you run 'meson build' yet?" >&2
return 1
elif (( ${#build_dirs[*]} > 1 )); then
echo "error: Multiple build directories found. Unable to proceed." >&2
return 1
fi
printf '%s\n' "${build_dirs[0]%/*}"
}
filter_targets_by_name() {
if command -v jq &>/dev/null; then
jq --arg re "$1" -r 'map(.name)[] | select(match($re))'
else
json_pp | awk -v filter="$1" -F'[:"]' \
'$2 == "name" && $(NF - 1) ~ filter { print $(NF - 1) }'
fi
}
# Make things simple and require that we're in the build root rather than
# trying to chase down the location of this script and the relative build dir.
if [[ ! -d .git ]]; then
echo "This script must be run from the root of the repository" >&2
exit 1
fi
build_dir=$(find_build_directory) || exit 1
mapfile -t targets < \
<(meson introspect "$build_dir" --targets | filter_targets_by_name "-update-po$")
ninja -C "$build_dir" "${targets[@]}"

1526
config.guess vendored

File diff suppressed because it is too large Load diff

View file

@ -1,614 +0,0 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2006 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux*)
case $cc_basename in
icc* | ecc*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
sco3.2v5*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
wl='-Wl,'
;;
sysv4*MP*)
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix3*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | kfreebsd*-gnu | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
libname_spec='lib$name'
case "$host_os" in
aix3*)
;;
aix4* | aix5*)
;;
amigaos*)
;;
beos*)
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
shrext=.dll
;;
darwin* | rhapsody*)
shrext=.dylib
;;
dgux*)
;;
freebsd1*)
;;
kfreebsd*-gnu)
;;
freebsd* | dragonfly*)
;;
gnu*)
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
;;
interix3*)
;;
irix5* | irix6* | nonstopux*)
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux*)
;;
knetbsd*-gnu)
;;
netbsd*)
;;
newsos6)
;;
nto-qnx*)
;;
openbsd*)
;;
os2*)
libname_spec='$name'
shrext=.dll
;;
osf3* | osf4* | osf5*)
;;
solaris*)
;;
sunos4*)
;;
sysv4 | sysv4.3*)
;;
sysv4*MP*)
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
;;
uts4*)
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1658
config.sub vendored

File diff suppressed because it is too large Load diff

View file

@ -1,406 +0,0 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Minimum version of autoconf required
AC_PREREQ(2.60)
# UPDATING VERSION NUMBERS FOR RELEASES
#
# libalpm:
# current
# The most recent interface number that this library implements.
# revision
# The implementation number of the current interface.
# age
# The difference between the newest and oldest interfaces that this library
# implements. In other words, the library implements all the interface
# numbers in the range from number current - age to current.
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release of
# your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then
# increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last
# update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then
# increment age.
# 6. If any interfaces have been removed since the last public release, then
# set age to 0.
#
# pacman:
# Extreme huge major changes:
# pacman_version_major += 1
# pacman_version_minor = 0
# pacman_version_micro = 0
#
# Real releases:
# pacman_version_minor += 1
# pacman_version_micro = 0
#
# Bugfix releases:
# pacman_version_micro += 1
m4_define([lib_current], [5])
m4_define([lib_revision], [2])
m4_define([lib_age], [0])
m4_define([pacman_version_major], [3])
m4_define([pacman_version_minor], [4])
m4_define([pacman_version_micro], [2])
m4_define([pacman_version],
[pacman_version_major.pacman_version_minor.pacman_version_micro])
# Autoconf initialization
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
# Set subsitution values for version stuff in Makefiles and anywhere else,
# and put LIB_VERSION in config.h
AC_SUBST(LIB_VERSION)
AC_SUBST(LIB_VERSION_INFO)
AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
# Help line for root directory
AC_ARG_WITH(root-dir,
AS_HELP_STRING([--with-root-dir=path], [set the location of pacman's root operating directory]),
[ROOTDIR=$withval], [ROOTDIR=/])
# Help line for package extension
AC_ARG_WITH(pkg-ext,
AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
# Help line for source package directory
AC_ARG_WITH(src-ext,
AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
[SRCEXT=$withval], [SRCEXT=.src.tar.gz])
# Help line for database extension
AC_ARG_WITH(db-ext,
AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]),
[DBEXT=$withval], [DBEXT=.db.tar.gz])
# Help line for buildscript filename
AC_ARG_WITH(buildscript,
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
# Help line for libfetch
AC_ARG_ENABLE(internal-download,
AS_HELP_STRING([--disable-internal-download], [do not build with libfetch support]),
[internaldownload=$enableval], [internaldownload=yes])
# Help line for documentation
AC_ARG_ENABLE(doc,
AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
[wantdoc=$enableval], [wantdoc=yes])
# Help line for doxygen
AC_ARG_ENABLE(doxygen,
AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
[wantdoxygen=$enableval], [wantdoxygen=no])
# Help line for debug
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [enable debugging support]),
[debug=$enableval], [debug=no])
# Help line for using git version in pacman version string
AC_ARG_ENABLE(git-version,
AS_HELP_STRING([--enable-git-version],
[enable use of git version in version string if available]),
[wantgitver=$enableval], [wantgitver=no])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC_C99
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
# find installed gettext
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.13.1)
# Check for libarchive
AC_CHECK_LIB([archive], [archive_read_data], ,
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
# Enable or disable usage of libfetch
AC_MSG_CHECKING(whether to link with libfetch)
if test "x$internaldownload" = "xyes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE([INTERNAL_DOWNLOAD], , [Use internal download library])
# Check for a download library if it was actually requested
AC_CHECK_LIB([fetch], [fetchParseURL], ,
AC_MSG_ERROR([libfetch is needed to compile with internal download support]), [-lcrypto -ldl] )
# Check if libfetch supports conditional GET
# (version >=2.21, struct url has member last_modified)
AC_CHECK_MEMBER(struct url.last_modified, ,
AC_MSG_ERROR([libfetch must be version 2.21 or greater]),
[#include <fetch.h>] )
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(INTERNAL_DOWNLOAD, test "x$internaldownload" = "xyes")
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h sys/time.h syslog.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_TYPE_UID_T
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MKTIME
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([geteuid realpath regcomp strcasecmp \
strndup strrchr strsep swprintf \
wcwidth uname])
# Enable large file support if available
AC_SYS_LARGEFILE
# Check if we can use symbol visibility support in GCC
GCC_VISIBILITY_CC
# Check if we have -fgnu89-inline flag
GCC_GNU89_INLINE_CC
# Host-dependant definitions
SIZECMD="stat -L -c %s"
SEDINPLACE="sed -i"
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
case "${host_os}" in
*bsd*)
SIZECMD="stat -L -f %z"
SEDINPLACE="sed -i ''"
;;
cygwin*)
host_os_cygwin=yes
CFLAGS="$CFLAGS -DCYGWIN"
;;
darwin*)
host_os_darwin=yes
SIZECMD="/usr/bin/stat -L -f %z"
SEDINPLACE="/usr/bin/sed -i ''"
STRIP_BINARIES=""
STRIP_SHARED="-S"
STRIP_STATIC="-S"
;;
esac
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
AC_SUBST(SIZECMD)
AC_SUBST(SEDINPLACE)
AC_SUBST(STRIP_BINARIES)
AC_SUBST(STRIP_SHARED)
AC_SUBST(STRIP_STATIC)
# Check for architecture, used in default makepkg.conf
# (Note single space left after CARCHFLAGS)
case "${host}" in
i686-*)
CARCH="i686"
CARCHFLAGS="-march=i686 "
;;
x86_64-*)
CARCH="x86_64"
CARCHFLAGS="-march=x86-64 "
;;
ia64-*)
CARCH="ia64"
CARCHFLAGS="-march=ia64 "
;;
sparc-*)
CARCH="sparc"
CARCHFLAGS="-mcpu=v9 "
;;
ppc-* | powerpc-*)
CARCH="ppc"
CARCHFLAGS="-mcpu=750 "
;;
i386-*)
CARCH="i386"
CARCHFLAGS="-march=i386 "
;;
arm-*)
CARCH="arm"
CARCHFLAGS="-march=armv4 "
;;
*)
AC_MSG_WARN([[Your architecture is unknown for makepkg.conf, consider adding it to configure.ac]])
CARCH="unknown"
CARCHFLAGS=""
;;
esac
# Now do some things common to all architectures
CHOST="${host}"
AC_SUBST(CARCH)
AC_SUBST(CARCHFLAGS)
AC_SUBST(CHOST)
# Check for documentation support and status
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
AC_MSG_CHECKING([for building documentation])
if test "x$wantdoc" = "xyes" ; then
if test $ASCIIDOC ; then
AC_MSG_RESULT([yes, enabled by configure])
else
asciidoc="(warning : asciidoc not installed)"
AC_MSG_RESULT([yes $asciidoc])
fi
wantdoc=yes
else
AC_MSG_RESULT([no, disabled by configure])
wantdoc=no
fi
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
# Check for doxygen support and status
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AC_MSG_CHECKING([for doxygen])
if test "x$wantdoxygen" = "xyes" ; then
if test $DOXYGEN ; then
AC_MSG_RESULT([yes])
usedoxygen=yes
else
AC_MSG_RESULT([no, doxygen missing])
usedoxygen=no
fi
else
AC_MSG_RESULT([no, disabled by configure])
usedoxygen=no
fi
AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")
# Enable or disable debug code
AC_MSG_CHECKING(for debug mode request)
if test "x$debug" = "xyes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
# Check for mcheck
AC_CHECK_HEADERS([mcheck.h])
# Check for -fstack-protector availability
GCC_STACK_PROTECT_LIB
GCC_STACK_PROTECT_CC
CFLAGS="$CFLAGS -g -Wall -Werror"
else
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS -Wall"
fi
# Enable or disable use of git version in pacman version string
AC_MSG_CHECKING(whether to use git version if available)
if test "x$wantgitver" = "xyes" ; then
AC_CHECK_PROGS([GIT], [git])
AC_CHECK_FILE([.git/], hasgitdir=yes)
if test $GIT -a "x$hasgitdir" = "xyes"; then
AC_MSG_RESULT([yes])
usegitver=yes
AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
else
AC_MSG_RESULT([no, git or .git dir missing])
usegitver=no
fi
else
AC_MSG_RESULT([no, disabled by configure])
usegitver=no
fi
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
# Set root directory
AC_SUBST(ROOTDIR)
# Set package file extension
AC_SUBST(PKGEXT)
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
# Set source package file extension
AC_SUBST(SRCEXT)
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
# Set database file extension
AC_SUBST(DBEXT)
AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases])
# Set makepkg build script name
AC_SUBST(BUILDSCRIPT)
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
# Configuration files
AC_CONFIG_FILES([
lib/libalpm/Makefile
lib/libalpm/po/Makefile.in
src/pacman/Makefile
src/util/Makefile
scripts/Makefile
doc/Makefile
etc/Makefile
po/Makefile.in
test/pacman/Makefile
test/pacman/tests/Makefile
test/util/Makefile
contrib/Makefile
Makefile
])
AC_OUTPUT
echo "
${PACKAGE_NAME}:
Build information:
source code location : ${srcdir}
prefix : ${prefix}
sysconfdir : $(eval echo ${sysconfdir})
conf file : $(eval echo ${sysconfdir})/pacman.conf
localstatedir : $(eval echo ${localstatedir})
database dir : $(eval echo ${localstatedir})/lib/pacman/
cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
compiler : ${CC}
compiler flags : ${CFLAGS}
defines : ${DEFS}
Architecture : ${CARCH}
Architecture flags : ${CARCHFLAGS}
Host Type : ${CHOST}
Filesize command : ${SIZECMD}
In-place sed command : ${SEDINPLACE}
libalpm version : ${LIB_VERSION}
libalpm version info : ${LIB_VERSION_INFO}
pacman version : ${PACKAGE_VERSION}
using git version : ${usegitver}
Directory and file information:
root working directory : ${ROOTDIR}
package extension : ${PKGEXT}
source pkg extension : ${SRCEXT}
database extension : ${DBEXT}
build script name : ${BUILDSCRIPT}
Compilation options:
Run make in doc/ dir : ${wantdoc} ${asciidoc}
Use download library : ${internaldownload}
Doxygen support : ${usedoxygen}
debug support : ${debug}
"
# vim:set ts=2 sw=2 noet:

View file

@ -1,15 +0,0 @@
EXTRA_DIST = \
PKGBUILD.vim \
bacman \
bash_completion \
pacdiff \
paclist \
pacscripts \
pacsearch \
pactree \
vimprojects \
wget-xdelta.sh \
zsh_completion \
README
# vim:set ts=2 sw=2 noet:

View file

@ -1,262 +0,0 @@
" Vim syntax file
" Language: PKGBUILD
" Maintainer: Alessio 'mOLOk' Bolognino <themolok at gmail.com>
" Last Change: 2007/05/08
" Version Info: PKGBUILD-0.2 (colorphobic)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let b:main_syntax = "sh"
runtime! syntax/sh.vim
" case on
syn case match
" pkgname
" FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '='
syn keyword pb_k_pkgname pkgname contained
syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
" pkgbase
" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
syn keyword pb_k_pkgbase pkgbase contained
syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
" pkgver
syn keyword pb_k_pkgver pkgver contained
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained
syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote
" pkgrel
syn keyword pb_k_pkgrel pkgrel contained
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgver
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
" pkgdesc
syn keyword pb_k_desc pkgdesc contained
" 90 chars: 80 for description, 8 for pkgdesc and 2 for ''
syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign
syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
syn match pbPkgdescSign /[='"]/ contained
" url
syn keyword pb_k_url url contained
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl
syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote
" license
syn keyword pb_k_license license contained
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
syn keyword pbLicense APACHE CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RALINK RUBY ZPL contained
" special cases from http://wiki.archlinux.org/index.php/Arch_Packaging_Standards
syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
" backup
syn keyword pb_k_backup backup contained
syn match pbValidBackup /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained
syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote
" arch
syn keyword pb_k_arch arch contained
syn keyword pbArch i686 x86_64 ppc any contained
syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
" groups
syn keyword pb_k_groups groups contained
syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote
" depends
syn keyword pb_k_depends depends contained
syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote
" makedepends
syn keyword pb_k_makedepends makedepends contained
syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote
" optdepends
syn keyword pb_k_optdepends optdepends contained
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
" conflicts
syn keyword pb_k_conflicts conflicts contained
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote
" provides
syn keyword pb_k_provides provides contained
syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote
" replaces
syn keyword pb_k_replaces replaces contained
syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbReplacesGroup start=/^replaces=(/ end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote
" install
" XXX remove install from bashStatement, fix strange bug
syn clear bashStatement
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
syn keyword pb_k_install install contained
syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
" changelog
syn keyword pb_k_changelog changelog contained
syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
" source:
" XXX remove source from shStatement, fix strange bug
syn clear shStatement
syn keyword shStatement xxx wait getopts return autoload whence printf true popd nohup enable r trap readonly fc fg kill ulimit umask disown stop pushd read history logout times local exit test pwd time eval integer suspend dirs shopt hash false newgrp bg print jobs continue functions exec help cd break unalias chdir type shift builtin let bind
syn keyword pb_k_source source contained
syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/
syn region pbSourceGroup start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation
syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
hi def link pbDerefEmulation PreProc
" md5sums
syn keyword pb_k_md5sums md5sums contained
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
syn match pbValidMd5sums /\x\{32\}/ contained
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
hi def link pbMd5Quotes Keyword
hi def link pbMd5Hash Error
hi def link pbValidMd5sums Number
" sha1sums
syn keyword pb_k_sha1sums sha1sums contained
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
syn match pbValidSha1sums /\x\{40\}/ contained
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
hi def link pbSha1Quotes Keyword
hi def link pbSha1Hash Error
hi def link pbValidSha1sums Number
" options
syn keyword pb_k_options options contained
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|force\)/ contained
syn match pbOptionsNeg /\!/ contained
syn match pbOptionsDeprec /no/ contained
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
" noextract
syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained
syn keyword pb_k_noextract noextract contained
syn region pbNoextractGroup start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote
" comments
syn keyword pb_k_maintainer Maintainer Contributor contained
syn match pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained
syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained
syn cluster pbCommentGroup contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate
syn keyword pbTodo contained COMBAK FIXME TODO XXX
syn match pbComment "^#.*$" contains=@pbCommentGroup
syn match pbComment "[^0-9]#.*$" contains=@pbCommentGroup
" quotes are handled by sh.vim
hi def link pbComment Comment
hi def link pbTodo Todo
hi def link pbIllegalPkgname Error
hi def link pb_k_pkgname pbKeywords
hi def link pbIllegalPkgbase Error
hi def link pb_k_pkgbase pbKeywords
hi def link pbIllegalPkgver Error
hi def link pb_k_pkgver pbKeywords
hi def link pbIllegalPkgrel Error
hi def link pb_k_pkgrel pbKeywords
hi def link pbIllegalPkgdesc Error
hi def link pb_k_desc pbKeywords
hi def link pbIllegalUrl Error
hi def link pb_k_url pbKeywords
hi def link pb_k_license pbKeywords
hi def link pbIllegalLicense Error
hi def link pb_k_backup pbKeywords
hi def link pb_k_arch pbKeywords
hi def link pbIllegalArch Error
hi def link pb_k_groups pbKeywords
hi def link pb_k_makedepends pbKeywords
hi def link pb_k_optdepends pbKeywords
hi def link pb_k_depends pbKeywords
hi def link pb_k_replaces pbKeywords
hi def link pb_k_conflicts pbKeywords
hi def link pb_k_provides pbKeywords
hi def link pbIllegalInstall Error
hi def link pb_k_install pbKeywords
hi def link pbIllegalChangelog Error
hi def link pb_k_changelog pbKeywords
hi def link pb_k_source pbKeywords
hi def link pbIllegalSource Error
hi def link pb_k_md5sums pbKeywords
hi def link pbIllegalMd5sums Error
hi def link pb_k_sha1sums pbKeywords
hi def link pbIllegalSha1sums Error
hi def link pb_k_options pbKeywords
hi def link pbOptionsDeprec Todo
hi def link pbIllegalOption Error
hi def link pb_k_noextract pbKeywords
hi def link pbNoextract Normal
hi def link pb_k_maintainer pbKeywords
hi def link pbKeywords Keyword
hi def link pbDate Special
"syntax include @SHELL syntax/sh.vim
"syntax region BUILD start=/^build()/ end=/^}/ contains=@SHELL
"let b:current_syntax = "PKGBUILD"
" vim: ft=vim

View file

@ -1,36 +0,0 @@
Here is a brief description of the files included in this directory:
PKGBUILD.vim - a vim/gvim syntax file for PKGBUILDs. Colors known variable
names, highlights common errors such as invalid characters in pkgname or
pkgver, etc.
bash_completion - a bash completion script for pacman, install in
/etc/bash_completion.d/ for use (but rename to something descriptive!).
zsh_completion - a zsh completion script, install (with a rename) to
/usr/share/zsh/site-functions/.
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
paclist - list all packages installed from a given repository. Useful for
seeing which packages you may have installed from the testing repository,
for instance.
pacscripts - tries to print out the {pre,post}_{install,remove,upgrade}
scripts of a given package.
pacsearch - a colorized search combining both -Ss and -Qs output. Installed
packages are easily identified with a *** and local-only packages are also
listed.
pactree - generate a dependency tree of an installed package in textual or
graphical form (using graphviz).
bacman - regenerate a pacman package based on installed files and the pacman
database entries. Useful for reuse, or possible config file extension.
vimprojects - a project file for the vim project plugin.
wget-xdelta.sh - A download script for pacman which allows binary deltas
generated with makepkg to be used instead of downloading full binary packages.
This should cut download sizes for some package upgrades significantly.

View file

@ -1,310 +0,0 @@
#!/bin/bash
#
# bacman: recreate a package from a running system
# This script rebuilds an already installed package using metadata
# stored into the pacman database and system files
#
# (c) 2008 - locci <carlocci_at_gmail_dot_com>
#
# 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/>.
#
readonly progname="bacman"
readonly progver="0.2.1"
#
# User Friendliness
#
function usage(){
echo "This program recreates a package using pacman's db and system files"
echo "Usage: $progname <installed package name>"
echo "Example: $progname kernel26"
}
if [ $# -ne 1 ] ; then
usage
exit 1
fi
if [ "$1" = "--help" -o "$1" = "-h" ] ; then
usage
exit 0
fi
if [ "$1" = "--version" -o "$1" = "-v" ]; then
echo "$progname version $progver"
echo "Copyright (C) 2008 locci"
exit 0
fi
#
# Fakeroot support
#
if [ $EUID -gt 0 ]; then
if [ -f /usr/bin/fakeroot ]; then
echo "Entering fakeroot environment"
export INFAKEROOT="1"
/usr/bin/fakeroot -u -- $0 $1
exit $?
else
echo "WARNING: installing fakeroot or running ${progname} as root is required to"
echo " preserve the ownership permissions of files in some packages"
echo ""
fi
fi
#
# Setting environmental variables
#
if [ ! -r /etc/pacman.conf ]; then
echo "ERROR: unable to read /etc/pacman.conf"
exit 1
fi
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
pac_db="${DBPath:-/var/lib/pacman/}/local"
if [ ! -r /etc/makepkg.conf ]; then
echo "ERROR: unable to read /etc/makepkg.conf"
exit 1
fi
source "/etc/makepkg.conf"
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
pkg_arch=${CARCH:-'unknown'}
pkg_dest="${PKGDEST:-$PWD}"
pkg_pkger=${PACKAGER:-'Unknown Packager'}
pkg_name="$1"
pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)"
pkg_namver="${pkg_dir##*/}"
#
# Checks everything is in place
#
if [ ! -d "$pac_db" ] ; then
echo "ERROR: pacman database directory ${pac_db} not found"
exit 1
fi
if [ ! -d "$pkg_dir" ] ; then
echo "ERROR: package ${pkg_name} not found in pacman database"
exit 1
fi
#
# Begin
#
echo Package: ${pkg_namver}
work_dir=$(mktemp -d -p /tmp)
cd "$work_dir" || exit 1
#
# File copying
#
echo "Copying package files..."
cat "$pkg_dir"/files |
while read i; do
if [ -z "$i" ] ; then
continue
fi
if [[ "$i" =~ %[A-Z]*% ]] ; then
current=$i
continue
fi
case $current in
%FILES%)
ret=0
if [ -e "/$i" ]; then
bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
# Workaround to bsdtar not reporting a missing file as an error
if [ ! -e "$work_dir/$i" -a ! -L "$work_dir/$i" ]; then
echo ""
echo "ERROR: unable to add /$i to the package"
echo " If your user does not have permssion to read this file then"
echo " you will need to run $progname as root"
rm -rf "$work_dir"
exit 1
fi
else
echo ""
echo "WARNING: package file /$i is missing"
echo ""
fi
;;
esac
done
ret=$?
if [ $ret -ne 0 ]; then
rm -rf "$work_dir"
exit 1
fi
pkg_size=$(du -sk | awk '{print $1 * 1024}')
#
# .PKGINFO stuff
#
echo Generating .PKGINFO metadata...
echo "# Generated by $progname $progver" > .PKGINFO
if [ "$INFAKEROOT" = "1" ]; then
echo "# Using $(fakeroot -v)" >> .PKGINFO
fi
echo "# $(LC_ALL=C date)" >> .PKGINFO
echo "#" >> .PKGINFO
cat "$pkg_dir"/{desc,files,depends} |
while read i; do
if [[ -z "$i" ]]; then
continue;
fi
if [[ "$i" =~ %[A-Z]*% ]] ; then
current=$i
continue
fi
case "$current" in
# desc
%NAME%)
echo "pkgname = $i" >> .PKGINFO
;;
%VERSION%)
echo "pkgver = $i" >> .PKGINFO
;;
%DESC%)
echo "pkgdesc = $i" >> .PKGINFO
;;
%URL%)
echo "url = $i" >> .PKGINFO
;;
%LICENSE%)
echo "license = $i" >> .PKGINFO
;;
%ARCH%)
echo "arch = $i" >> .PKGINFO
;;
%BUILDDATE%)
echo "builddate = $(date -u "+%s")" >> .PKGINFO
;;
%PACKAGER%)
echo "packager = $pkg_pkger" >> .PKGINFO
;;
%SIZE%)
echo "size = $pkg_size" >> .PKGINFO
;;
%GROUPS%)
echo "group = $i" >> .PKGINFO
;;
%REPLACES%)
echo "replaces = $i" >> .PKGINFO
;;
%FORCE%)
echo "force = true" >> .PKGINFO
;;
# files
%BACKUP%)
# strip the md5sum after the tab
echo "backup = ${i%%$'\t'*}" >> .PKGINFO
;;
# depends
%DEPENDS%)
echo "depend = $i" >> .PKGINFO
;;
%OPTDEPENDS%)
echo "optdepend = $i" >> .PKGINFO
;;
%CONFLICTS%)
echo "conflict = $i" >> .PKGINFO
;;
%PROVIDES%)
echo "provides = $i" >> .PKGINFO
;;
esac
done
comp_files=".PKGINFO"
if [ -f "$pkg_dir/install" ] ; then
cp "$pkg_dir/install" "$work_dir/.INSTALL"
comp_files+=" .INSTALL"
fi
if [ -f $pkg_dir/changelog ] ; then
cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
comp_files+=" .CHANGELOG"
fi
#
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
#
chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
#
# Generate the package
#
echo "Generating the package..."
case "$PKGEXT" in
*tar.gz) EXT=${PKGEXT%.gz} ;;
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
*tar.xz) EXT=${PKGEXT%.xz} ;;
*tar) EXT=${PKGEXT} ;;
*) echo "WARNING: '%s' is not a valid archive extension." \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
ret=0
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself
shopt -s nullglob
# TODO: Maybe this can be set globally for robustness
shopt -s -o pipefail
bsdtar -cf - $comp_files * |
case "$PKGEXT" in
*tar.gz) gzip -c -f -n ;;
*tar.bz2) bzip2 -c -f ;;
*tar.xz) xz -c -z - ;;
*tar) cat ;;
esac > ${pkg_file} || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: unable to write package to $pkg_dest"
echo " Maybe the disk is full or you do not have write access"
rm -rf "$work_dir"
exit 1
fi
rm -rf "$work_dir"
echo Done
exit 0
# vim: set ts=2 sw=2 noet:

View file

@ -1,115 +0,0 @@
# This file is in the public domain.
_arch_compgen() {
local i r
COMPREPLY=($(compgen -W '$*' -- "$cur"))
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
for r in ${!COMPREPLY[@]}; do
if [[ ${COMP_WORDS[i]} = ${COMPREPLY[r]} ]]; then
unset 'COMPREPLY[r]'; break
fi
done
done
}
_arch_ptr2comp() {
local list= x y
for x; do
for y in '0 --' '1 -'; do
eval 'set -- ${'$x'[${y% *}]}'
list+=\ ${@/#/${y#* }}
done
done
_arch_compgen $list
}
_arch_incomp() {
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
}
_makepkg() {
local cur opts prev
COMPREPLY=()
cur=$(_get_cword)
prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $cur = -* && ! $prev =~ ^-(-(cleancache|config|help)$|\w*[Chp]) ]]; then
opts=('allsource asroot clean cleancache config force geninteg help holdver
ignorearch install log nobuild nocolor noconfirm nodeps noextract
noprogressbar pkg repackage rmdeps skipinteg source syncdeps'
'A C L R c d e f g h i m o p r s')
_arch_ptr2comp opts
fi
true
}
_pacman_pkg() {
_arch_compgen "$(
if [[ $2 ]]; then
\pacman -$1 | \cut -d' ' -f1 | \sort -u
else
\pacman -$1
fi
)"
}
_pacman() {
local common core cur database prev query remove sync upgrade o
COMPREPLY=()
cur=$(_get_cword)
prev=${COMP_WORDS[COMP_CWORD-1]}
database=('asdeps asexplicit')
query=('changelog check deps explicit file foreign groups info list owns
search unrequired upgrades' 'c e g i k l m o p s t u')
remove=('cascade dbonly nodeps nosave print recursive unneeded' 'c k n p s u')
sync=('asdeps asexplicit clean downloadonly force groups ignore ignoregroup
info list needed nodeps print refresh search sysupgrade'
'c f g i l p s u w y')
upgrade=('asdeps asexplicit force nodeps print' 'f p')
common=('arch cachedir config dbpath debug help logfile noconfirm
noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
core=('database help query remove sync upgrade version' 'D Q R S U V h')
for o in 'D database' 'Q query' 'R remove' 'S sync' 'U upgrade'; do
_arch_incomp "$o" && break
done
if [[ $? != 0 ]]; then
_arch_ptr2comp core
elif [[ ! $prev =~ ^-\w*[Vbhr] &&
! $prev = --@(cachedir|config|dbpath|help|logfile|root|version) ]]
then
[[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
case ${o% *} in
D|R)
_pacman_pkg Qq;;
Q)
{ _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
{ _arch_incomp 'p file' && _pacman_file; } ||
_arch_incomp 'o owns' || _arch_incomp 'u upgrades' ||
_pacman_pkg Qq;;
S)
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
{ _arch_incomp 'l list' && _pacman_pkg Sl sort; } ||
_pacman_pkg Slq;;
U)
_pacman_file;;
esac
fi
true
}
if [[ $(type -t compopt) = "builtin" ]]; then
_pacman_file() {
compopt -o filenames; _filedir 'pkg.tar.*'
}
complete -F _pacman -o default pacman
else
_pacman_file() {
_filedir 'pkg.tar.*'
}
complete -F _pacman -o filenames -o default pacman
fi
complete -F _makepkg -o default makepkg
# ex:et ts=2 sw=2 ft=sh

View file

@ -1,80 +0,0 @@
#!/bin/bash
# pacdiff : a simple pacnew/pacorig/pacsave updater
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
#
# 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/>.
#
diffprog=${DIFFPROG:-vimdiff}
diffsearchpath=${DIFFSEARCHPATH:-/etc}
locate=0
usage() {
echo "pacdiff : a simple pacnew/pacorig/pacsave updater"
echo "Usage : pacdiff [-l]"
echo " -l/--locate makes pacdiff use locate rather than find"
echo " DIFFPROG variable allows to override the default vimdiff"
echo " DIFFSEARCHPATH allows to override the default /etc path"
echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" pacdiff"
}
cmd() {
if [ $locate -eq 1 ]; then
locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave
else
find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave \) -print0
fi
}
if [ $# -gt 0 ]; then
case $1 in
-l|--locate)
locate=1;;
*)
usage; exit 0;;
esac
fi
# see http://mywiki.wooledge.org/BashFAQ/020
while IFS= read -u 3 -r -d '' pacfile; do
file="${pacfile%.pac*}"
echo "File: $file"
if [ ! -f "$file" ]; then
echo " $file does not exist"
rm -i "$pacfile"
continue
fi
check="$(cmp "$pacfile" "$file")"
if [ -z "${check}" ]; then
echo " Files are identical, removing..."
rm "$pacfile"
else
echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
while read c; do
case $c in
r|R) rm "$pacfile"; break ;;
v|V)
$diffprog "$pacfile" "$file"
rm -i "$pacfile"; break ;;
s|S) break ;;
*) echo -n " Invalid answer. Try again: [v/s/r] "; continue ;;
esac
done
fi
done 3< <(cmd)
exit 0
# vim: set ts=2 sw=2 noet:

View file

@ -1,88 +0,0 @@
#!/usr/bin/perl
# paclist - List all packages installed from a given repo
#
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
#
# 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/>.
use strict;
use warnings;
my $progname = "paclist";
my $version = "1.0";
if ($#ARGV != 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
print "$progname - List all packages installed from a given repo\n";
print "Usage: $progname <repo>\n";
print "Example: $progname testing\n";
if ($#ARGV != 0) {
exit 1;
}
exit 0;
}
if ( $ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
print "$progname version $version\n";
print "Copyright (C) 2008 Dan McGee\n";
exit 0;
}
# This hash table will be used to store pairs of ('name version', count) from
# the return of both pacman -Sl <repo> and pacman -Q output. We then check to
# see if a value was added twice (count = 2)- if so, we will print that package
# as it is both in the repo we queried and installed on our local system.
my %packages = ();
my $output;
$output = `pacman -Sl $ARGV[0]`;
if ($? != 0) {
exit 1;
}
my @sync = split(/\n/, $output);
# sample output from pacman -Sl:
# testing foobar 1.0-1
foreach $_ (@sync) {
my @info = split(/ /);
# we only want to store 'foobar 1.0-1' in our hash table
my $pkg = $info[1] . " " . $info[2];
$packages{$pkg}++;
}
$output = `pacman -Q`;
if ($? != 0) {
exit 1;
}
# sample output from pacman -Q:
# foobar 1.0-1
my @local = split(/\n/, $output);
foreach $_ (@local) {
# store 'foobar 1.0-1' in our hash table
$packages{$_}++;
}
# run comparison check- if value was added twice, it was in the intersection
my @intersection;
foreach $_ (keys %packages) {
if ($packages{$_} == 2) {
push @{ \@intersection }, $_;
}
}
# print our intersection, and bask in the glory and speed of perl
@intersection = sort @intersection;
foreach $_ (@intersection) {
print $_ . "\n";
}
#vim: set noet:

View file

@ -1,132 +0,0 @@
#!/bin/bash
#
# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
# scripts of a given package
#
# Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>
# Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
#
# 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/>.
#
# bash options
set -o nounset
set -o errexit
progname=$(basename $0)
progver="0.4"
conf="/etc/pacman.conf"
if [ ! -r "$conf" ]; then
echo "ERROR: unable to read $conf"
exit 1
fi
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
pac_db="${DBPath:-/var/lib/pacman}/local"
pac_cache="${CacheDir:-/var/cache/pacman/pkg}"
error() {
local mesg=$1; shift
printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
}
usage() {
echo "This program prints out the {pre,post}_{install,remove,upgrade} scripts"
echo "of a given package."
echo "Usage: $progname pkgname|pkgfile"
echo
echo " OPTIONS:"
echo " -h, --help Print this help message"
echo " -v, --version Print program name and version"
echo
echo "Example: $progname gconf-editor"
echo "Example: $progname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
}
spacman() {
if [ $EUID -eq 0 ]; then
pacman "$@"
else
if [ ! "$(type -p sudo)" ]; then
error "Cannot find the sudo binary! Is sudo installed?"
error "Otherwise try to run the program as root"
exit 1
else
sudo pacman "$@"
fi
fi
}
print_db() {
pkg=$(pacman -Q "$1")
pkg=${pkg/ /-}
if [ -f $pac_db/$pkg*/install ]; then
cat $pac_db/$pkg*/install
echo
return 0
else
error "Package $1 does not include any .INSTALL script"
return 1
fi
}
print_pkg() {
if ! bsdtar -xOf "$1" .INSTALL 2>/dev/null; then
error "Package $1 does not include any .INSTALL script"
return 1
fi
echo
}
print_scriptlet() {
if [ -f "$1" ]; then
if bsdtar tf "$1" .PKGINFO &>/dev/null; then
print_pkg "$1"
return
fi
fi
if pacman -Q "$1" &>/dev/null; then
print_db "$1"
return
fi
if ! pacman -Si $1 &>/dev/null; then
error "Package $1 not found"
return 1
fi
url=$(spacman -Sdp $1 | tail -n1)
filename=$(basename $url)
if [ ! -f "$pac_cache/$filename" ]; then
if ! spacman -Sdw --noconfirm $1 >&2; then
error "Failed to download $1"
return 1
fi
echo >&2
fi
print_pkg "$pac_cache/$filename"
return
}
if [ $# -ne 1 ] ; then
usage
exit 1
fi
case "$1" in
--help|-h) usage; exit 0 ;;
--version|-v) echo "$progname version $progver"; exit 0 ;;
*) print_scriptlet $1 ;;
esac

View file

@ -1,130 +0,0 @@
#!/usr/bin/perl
# pacsearch - Adds color and install information to a 'pacman -Ss' search
#
# Copyright (C) 2008, 2010 Dan McGee <dpmcgee@gmail.com>
#
# Based off original shell script version:
# Copyright (C) 2006-2007 Dan McGee <dpmcgee@gmail.com>
#
# 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/>.
#TODO: colors flag on commandline
use strict;
use warnings;
my $progname = "pacsearch";
my $version = "2.0";
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
print "$progname - Add color and install information to a pacman -Ss search\n";
print "Usage: $progname <pattern>\n";
print "Example: $progname ^gnome\n";
if ($#ARGV lt 0) {
exit 1;
}
exit 0;
}
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
print "$progname version $version\n";
print "Copyright (C) 2006-2010 Dan McGee\n";
exit 0;
}
# define our colors to use when printing
my $CLR1 = "\e[0;34m";
my $CLR2 = "\e[0;32m";
my $CLR3 = "\e[0;35m";
my $CLR4 = "\e[0;36m";
my $CLR5 = "\e[0;31m";
my $CLR6 = "\e[0;33m";
my $CLR7 = "\e[1;36m";
my $INST = "\e[1;31m";
my $BASE = "\e[0m";
# color a "repo/pkgname pkgver" line based on the repository name
sub to_color {
my $line = shift;
# get the installed text colored first
$line =~ s/(\[.*\]$)/$INST$1$BASE/;
# and now the repo and dealings
$line =~ s/(^core\/.*)/$CLR1$1$BASE/;
$line =~ s/(^extra\/.*)/$CLR2$1$BASE/;
$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
$line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
# any other unknown repository
$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
return $line;
}
my %allpkgs = ();
my $syncout = `pacman -Ss '@ARGV'`;
# split each sync search entry into its own array entry
my @syncpkgs = split(/\n^(?=\w)/m, $syncout);
# remove the extra \n from the last desc entry
if ($#syncpkgs >= 0) {
chomp($syncpkgs[$#syncpkgs]);
}
# counter var for packages, used here and in the query loop too
my $cnt = 0;
foreach $_ (@syncpkgs) {
# we grab 4 fields here: repo, name/ver, installed, and desc
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
# since installed is optional, we should fill it in if necessary
$pkgfields[2] = "" if not defined $pkgfields[2];
# add a fifth field that indicates original order
push (@pkgfields, $cnt++);
# add each sync pkg by name/ver to a hash table for quick lookup
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
}
my $queryout = `pacman -Qs '@ARGV'`;
# split each querysearch entry into its own array entry
my @querypkgs = split(/\n^(?=\w)/m, $queryout);
# remove the extra \n from the last desc entry
if ($#querypkgs >= 0) {
chomp ($querypkgs[$#querypkgs]);
}
foreach $_ (@querypkgs) {
# we grab 4 fields here: repo, name/ver, installed, and desc
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
# since installed is optional, we should fill it in if necessary
$pkgfields[2] = "" if not defined $pkgfields[2];
# check if the package was listed in the sync out
if (not exists $allpkgs{$pkgfields[1]}) {
$pkgfields[2] = "[installed]";
# add a fifth field that indicates original order (after sync)
push (@pkgfields, $cnt++);
# add our local-only package to the hash
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
}
}
# sort by original order (the fifth field) and print
foreach $_ ( sort{ @{$allpkgs{$a}}[4] <=> @{$allpkgs{$b}}[4] } keys %allpkgs) {
my @v = @{$allpkgs{$_}};
my $line = "$v[0]/$v[1] $v[2]";
$line = to_color($line);
# print colorized "repo/pkgname pkgver" string with possible installed text
print "$line\n";
print "$v[3]\n";
}
#vim: set noet:

View file

@ -1,321 +0,0 @@
#!/bin/bash
# pactree : a simple dependency tree viewer
#
# Copyright (C) 2008 Carlo "carlocci" Bersani <carlocci@gmail.com>
#
# 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/>.
# Original http://carlocci.ngi.it/arch/pactree
# Credit to scj for the graphviz idea
# set the colors
branch1_color="\033[0;33m" #Brown
branch2_color="\033[0;37m" #Gray
leaf_color="\033[1;32m" #Light green
leaf2_color="\033[0;32m" #Green
# set the separators
separator=" "
branch_tip1="|--"
branch_tip2="+--"
provides="provides "
# set the graphviz options
# http://www.graphviz.org/doc/info/output.html for available output formats
# http://www.graphviz.org/doc/info/colors.html for available colors
gformat="png" #output format
start_color="red" #START color
nodes_color="green" #color of the nodes
arrow1_color="chocolate4" #color of the normal arrow
arrow2_color="grey" #color of the "provided by" headless arrow
readonly prog_name="pactree"
readonly prog_ver="0.3"
_usage(){
echo "This program generates the dependency tree of an installed package"
echo "Usage: $prog_name [OPTIONS] <installed packages>"
echo
echo " OPTIONS:"
echo " -c, --color Enable color output"
echo " -d, --depth INT Limit the shown dependencies depth"
echo " -g, --graph Use graphviz to make an image of the tree"
echo " -l, --linear Enable linear output"
echo " -r, --reversed Show reversed dependancies"
echo " -s, --silent Shh, let me hear those errors!"
echo " -u, --unique Print the dependency list with no duplicates"
echo
echo " -h, --help Print this help message"
echo " -v, --version Print the program name and version"
echo
echo "Example: $prog_name -c -d2 readline"
}
_version(){
echo "$prog_name version $prog_ver"
echo "Copyright (C) 2008 Carlo \"carlocci\" Bersani <carlocci@gmail.com>"
}
# end of the friendliness
# grab a field from the database: $1=path/to/file, $2=field to grab
_grabfield(){
for line in $(cat "$1" 2>/dev/null ); do
if [ -z "$line" ]; then
continue;
fi;
if [[ "$line" =~ %[A-Z]*% ]]; then
current="$line"
continue;
fi;
if [ "$current" = "$2" ]; then
echo "$line"
fi;
done
}
# find a dep in the db: $1=dep, $2=field, $3=dbfile, ret=file list
_finddep(){
for line in $(awk 'BEGIN{RS=""}
{
if ($1=="'"$2"'"){
for (i=2 ; i<=NF ; ++i){
if ($i ~ /^'"$1"'([<>=]+.*|)$/ ){
print FILENAME}
}
}
}' $(find $pac_db -name $3)); do
echo "${line%/*}"
done
}
# Recursive function: does all of the work, pays all of the taxes #
_tree(){
pkg_name="$1"
pkg_dirs="$(echo $pac_db/$pkg_name-[0-9]*)"
# Is $pkg_name real or provided?
[ ! -d "$pkg_dirs" ] && pkg_dirs="$(_finddep $pkg_name %PROVIDES% depends)"
for pkg_dir in $pkg_dirs ; do
spaces="$2"
unset provided
branch_tip="$branch_tip1"
branch_color="$branch1_color"
pkg_name="$(_grabfield "$pkg_dir/desc" %NAME%)"
if [ ! "$pkg_name" = "$1" ]; then
provided="$leaf2_color $provides$leaf_color$1"
branch_tip="$branch_tip2"
branch_color="$branch2_color"
if [ $graphviz -eq 1 ] && [[ ! "${dep_list[@]}" =~ _$1_ ]] && [ $spaces -ne $((max_depth+1)) ]; then
echo "\"$1\" -> \"$pkg_name\" [arrowhead=none, color=$arrow2_color];"
dep_list=( "${dep_list[@]}" "_$1_" )
_tree "$pkg_name" $((spaces+1))
continue
fi
fi
# Generate the spacer
spacer=""
for each in $(seq 1 $spaces); do
spacer="$spacer$separator"
done
spacer="$spacer$branch_tip"
[ $silent -ne 1 ] && echo -e "$branch_color$spacer$leaf_color$pkg_name$provided"
[ ! -d "$pkg_dir" ] && echo "No $pkg_name in the database (inconsistent database?)" >&2
if [[ ! " ${dep_list[@]} " =~ " $pkg_name " ]] && [ $spaces -ne $max_depth ]; then
dep_list=( "${dep_list[@]}" "$pkg_name" )
if [ $reversed_dep -eq 0 ]; then
deps_pkg="$(_grabfield "$pkg_dir/depends" %DEPENDS%)"
else
reqs_pkg_dir="$(_finddep "$pkg_name" %DEPENDS% depends)"
unset deps_pkg
for req_pkg_dir in $reqs_pkg_dir; do
deps_pkg=$(echo "$deps_pkg" "$(_grabfield "$req_pkg_dir/desc" %NAME%)")
done
fi
for dep_pkg in $deps_pkg; do
spaces=$2 #Bash scoping ;_;
if [ $graphviz -eq 1 ]; then
echo "\"$1\" -> \"${dep_pkg%%[<>=]*}\" [color=$arrow1_color];"
fi
_tree "${dep_pkg%%[<>=]*}" $((spaces+1))
done
fi
done
}
# Main program: gets all of the money, pays none of the taxes
# Command line parameters parser
if [ $# -eq 0 ]; then
_usage
exit 1
fi
options=( "$@" )
len_options=${#options[@]}
for (( n=0 ; n < $len_options ; n++ )); do
if [ "${options[$n]}" = "--" ]; then
unset options[$n]
break
fi
if [ "${options[$n]}" = "-h" -o "${options[$n]}" = "--help" ]; then
_usage
exit 0
fi
if [ "${options[$n]}" = "-v" -o "${options[$n]}" = "--version" ]; then
_version
exit 0
fi
if [ "${options[$n]}" = "-l" -o "${options[$n]}" = "--linear" ]; then
unset options[$n]
linear=1
continue
fi
if [ "${options[$n]}" = "-s" -o "${options[$n]}" = "--silent" ]; then
unset options[$n]
silent=1
continue
fi
if [ "${options[$n]}" = "-u" -o "${options[$n]}" = "--unique" ]; then
unset options[$n]
silent=1
nodup=1
continue
fi
if [ "${options[$n]}" = "-g" -o "${options[$n]}" = "--graph" ]; then
unset options[$n]
graphviz=1
continue
fi
if [ "${options[$n]}" = "-c" -o "${options[$n]}" = "--color" ]; then
unset options[$n]
colored=1
continue
fi
if [ "${options[$n]}" = "-r" -o "${options[$n]}" = "--reversed" ]; then
unset options[$n]
reversed_dep=1
continue
fi
if [[ "${options[$n]}" =~ -d[[:digit:]]+ || "${options[$n]}" == "--depth" ]]; then
if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then
max_depth="${options[$n]#-d}"
elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then
max_depth="${options[$((n+1))]}"
unset options[$((n+1))]
((++n))
fi
unset options[$n]
continue
fi
done
# End of the dumb command line parser
# Env
colored=${colored:-0}
max_depth=${max_depth:--10}
linear=${linear:-0}
silent=${silent:-0}
nodup=${nodup:-0}
graphviz=${graphviz:-0}
reversed_dep=${reversed_dep:-0}
if [ $colored -ne 1 ]; then
unset branch1_color
unset leaf_color
unset leaf2_color
unset branch2_color
fi
if [ $linear -eq 1 ]; then
unset separator
unset branch_tip1
unset branch_tip2
unset provides
fi
if [ $graphviz -eq 1 ]; then
silent=1
nodup=0
if [ ! -f /usr/bin/dot ]; then
echo "ERROR: package graphviz is not installed"
echo " Run pacman -S graphviz to install it"
exit 1
fi
fi
if [ ! -r /etc/pacman.conf ]; then
echo "ERROR: unable to read /etc/pacman.conf"
exit 1
else
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
fi
pac_db="${DBPath:-/var/lib/pacman}/local"
if [ ! -d "$pac_db" ] ; then
echo "ERROR: pacman database directory ${pac_db} not found"
exit 1
fi
# Env End
# Program starts
_main(){
for pkg_name in ${options[@]} ; do
[ $graphviz -eq 1 ] && echo -e "\"START\" -> \"$pkg_name\" ;"
_tree "$pkg_name" 0
if [ $nodup -eq 1 ]; then
for pkg_tree in ${dep_list[@]} ; do
echo "$pkg_tree"
done
fi
done
if [ $silent -eq 0 ]; then
echo -ne '\033[0m' # return colors to normal?
echo -ne '\033[?25h' #return cursor to normal?
fi
}
if [ $graphviz -eq 1 ]; then
root_pkgs="${options[@]}"
# Uncomment for the "generated by pactree" node in graphviz
#advert="xyz [height=0.07, fontsize=8.0, label=\"GENERATED WITH PACTREE\",shape=box,color="black",style=filled,fontcolor="white"];\n"
if [ $reversed_dep -eq 0 ]; then
file_extension="deps.$gformat"
else
file_extension="reqs.$gformat"
fi
echo -e "digraph G { START [color=$start_color, style=filled];\n node [style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o "${root_pkgs// /_}.$file_extension"
else _main
fi
# vim: set ts=2 sw=2 noet:

View file

@ -1,25 +0,0 @@
This is a project file
for the vim-project plugin.
Save it as ~/.vimprojects
$ pacman -S vim-project
change the pacman path below
$ vim
:Project
Press \r in the project view
on a project name to generate
the list of files
pacman=~/devel/pacman/ CD=. filter="*.ac *.am" flags=S {
libalpm=lib/libalpm/ filter="*.c *.h *.am" {
}
pacman=src/pacman/ filter="*.c *.h *.am" {
}
scripts=scripts/ filter="*.sh.in *.py.in *.am" {
}
utils=src/util filter="*.c *.h *.am" {
}
contrib=contrib CD=. {
}
}

View file

@ -1,70 +0,0 @@
#!/bin/bash
if [ -r "/etc/makepkg.conf" ]; then
source /etc/makepkg.conf
else
echo "wget-xdelta: Unable to find makepkg.conf"
exit 1
fi
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
out_file=$(basename $1)
file_url=$2
if ! [[ "$out_file" =~ "pkg.tar.gz" ]]; then
# If it's not a package file download as normal and exit.
#wget --passive-ftp -c -O "$out_file" "$file_url"
exit $?
fi
# Get the package name and version
[[ "$out_file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
pkg_data=$(echo $out_file | \
sed "s|^\(.*\)-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}${PKGEXT}.part|\1 \2|")
pkgname=$(echo $pkg_data | cut -d ' ' -f 1)
new_version=$(echo $pkg_data | cut -d ' ' -f 2)
base_url=${file_url%/*}
# Look for the last version
for file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
check_version=$(echo $file | \
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
grep -v "^/var/cache/pacman/pkg")
[ "$check_version" = "" ] && continue
vercmp=$(vercmp "$check_version" "$old_version")
if [ "$check_version" != "$new_version" -a $vercmp -gt 0 ]; then
old_version=$check_version
old_file=$file
fi
done
if [ "$old_version" != "" -a "$old_version" != "$new_version" ]; then
# Great, we have a cached file, now calculate a patch name from it
delta_name="$pkgname-${old_version}_to_${new_version}-${CARCH}.delta"
echo "wget-xdelta: Attempting to download delta $delta_name..." >&2
if wget --passive-ftp -c "$base_url/$delta_name"; then
echo "wget-xdelta: Applying delta..."
if xdelta patch "$delta_name" "$old_file" "$out_file"; then
echo "wget-xdelta: Delta applied successfully!"
rm "$delta_name"
exit 0
else
echo "wget-xdelta: Failed to apply delta!"
rm $delta_name
fi
fi
fi
echo "wget-xdelta: Downloading new package..."
wget --passive-ftp -c -O "$out_file" "$file_url"
exit $?
# vim:set ts=4 sw=4 noet:

View file

@ -1,332 +0,0 @@
#compdef pacman pacman.static=pacman
# copy this file to /usr/share/zsh/site-functions/_pacman
typeset -A opt_args
# options for passing to _arguments: main pacman commands
_pacman_opts_commands=(
'-Q[Query the package database]'
'-R[Remove a package from the system]'
'-S[Synchronize packages]'
'-U[Upgrade a package]'
'-V[Display version and exit]'
'-h[Display usage]'
)
# options for passing to _arguments: options common to all commands
_pacman_opts_common=(
'-b[Alternate database location]:database_location:_files -/'
'-h[Display syntax for the given operation]'
'-r[Set alternate installation root]:installation root:_files -/'
'-v[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files'
'--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
'--print[Only print the targets instead of performing the operation]'
)
# options for passing to _arguments: options for --upgrade commands
_pacman_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar.*(.)"'
)
# options for passing to _arguments: subactions for --query command
_pacman_opts_query_actions=(
'-g[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
_pacman_opts_query_modifiers=(
'-c[List package changelog]'
'-d[List packages installed as dependencies]'
'-e[List packages explicitly installed]'
'-i[View package information]'
'-ii[View package information including backup files]'
'-k[Check package files]'
'-l[List package contents]'
'-m[List installed packages not found in sync db(s)]'
'-t[List packages not required by any package]'
'-u[List packages that can be upgraded]'
)
# options for passing to _arguments: options for --remove command
_pacman_opts_remove=(
'-c[Remove all dependent packages]'
'-d[Skip dependency checks]'
'-k[Only remove database entry, do not remove files]'
'-n[Remove protected configuration files]'
'-s[Remove dependencies not required by other packages]'
'*:installed package:_pacman_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_modifiers=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
'-u[Upgrade all out-of-date packages]'
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
_pacman_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:
_pacman_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
)
# handles --help subcommand
_pacman_action_help() {
_arguments -s : \
"$_pacman_opts_commands[@]"
}
# handles cases where no subcommand has yet been given
_pacman_action_none() {
_arguments -s : \
"$_pacman_opts_commands[@]"
}
# handles --query subcommand
_pacman_action_query() {
local context state line
typeset -A opt_args
# _arguments -s : \
# "$_pacman_opts_common[@]" \
# "$_pacman_opts_query_actions[@]" \
# "$_pacman_opts_query_modifiers[@]"
case $state in
query_file)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.*"'
;;
query_group)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:groups:_pacman_completions_installed_groups'
;;
query_owner)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:file:_files'
;;
query_search)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_actions[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package:_pacman_completions_installed_packages'
;;
esac
}
# handles --remove subcommand
_pacman_action_remove() {
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_remove[@]"
}
# handles --sync subcommand
_pacman_action_sync() {
local context state line
typeset -A opt_args
# _arguments -s : \
# "$_pacman_opts_common[@]" \
# "$_pacman_opts_sync_actions[@]" #\
# #"$_pacman_opts_sync_modifiers[@]"
case $state in
sync_clean)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*-c[Remove old packages from cache]' \
;;
sync_group)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package group:_pacman_completions_all_groups'
;;
sync_search)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package:_pacman_completions_all_packages'
;;
esac
}
# handles --upgrade subcommand
_pacman_action_upgrade() {
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_pkgfile[@]"
}
# handles --version subcommand
_pacman_action_version() {
# no further arguments
return 0
}
# provides completions for package groups
_pacman_completions_all_groups() {
local -a cmd groups
_pacman_get_command
groups=( $(_call_program groups $cmd[@] -Sg) )
compadd "$@" -a groups
}
# provides completions for packages available from repositories
# these can be specified as either 'package' or 'repository/package'
_pacman_completions_all_packages() {
local -a cmd packages repositories packages_long
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
packages_long=(/var/lib/pacman/sync/${^repositories}/*(/))
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
typeset -U packages
_wanted packages expl "packages" compadd - "${(@)packages}"
if [[ $PREFIX != */* ]] ; then
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
else
compset -P '*/'
packages_long=(/var/lib/pacman/sync/$IPREFIX*(/))
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
typeset -U packages
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
fi
}
# provides completions for package groups
_pacman_completions_installed_groups() {
local -a cmd groups
_pacman_get_command
groups=(${(o)${(f)"$(pacman -Qg)"}% *})
typeset -U groups
compadd "$@" -a groups
}
# provides completions for installed packages
_pacman_completions_installed_packages() {
local -a cmd packages packages_long
packages_long=(/var/lib/pacman/local/*(/))
packages=( ${${packages_long/\/var\/lib\/pacman\/local\//}%-*-*} )
compadd "$@" -a packages
}
# provides completions for repository names
_pacman_completions_repositories() {
local -a cmd repositories
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
# Uniq the array
typeset -U repositories
compadd "$@" -a repositories
}
# builds command for invoking pacman in a _call_program command - extracts
# relevant options already specified (config file, etc)
# $cmd must be declared by calling function
_pacman_get_command() {
# this is mostly nicked from _perforce
cmd=( "pacman" )
integer i
for (( i = 2; i < CURRENT - 1; i++ )); do
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
cmd+=( ${words[i,i+1]} )
fi
done
}
# main dispatcher
_pacman() {
case $words[2] in
-Q*g*) # ipkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:groups:_pacman_completions_installed_groups'
;;
-Q*o*) # file
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files'
;;
-Q*p*) # file *.pkg.tar.*
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.*"'
;;
-Q*) _pacman_action_query ;;
-R*) _pacman_action_remove ;;
-S*c*) # no completion
return 0
;;
-S*l*) # repos
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package repo:_pacman_completions_repositories' \
;;
-S*g*) # pkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package group:_pacman_completions_all_groups'
;;
-S*) _pacman_action_sync ;;
-U*) _pacman_action_upgrade ;;
-V*) _pacman_action_version ;;
-h*) _pacman_action_help ;;
- ) _pacman_action_none ;;
* ) return 1 ;;
esac
}
# run the main dispatcher
_pacman "$@"

584
depcomp
View file

@ -1,584 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2006-10-15.18
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# 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, 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

14
doc/.gitignore vendored
View file

@ -1,13 +1,9 @@
PKGBUILD.5
libalpm.3
makepkg.8
makepkg.conf.5
pacman.8
pacman.conf.5
repo-add.8
repo-remove.8
*.css
*.[1-8]
asciidoc-manpage.css
asciidoc.css
asciidoc.js
*.html
*.xml
man3
website.tar.gz
Doxyfile

79
doc/BUILDINFO.5.asciidoc Normal file
View file

@ -0,0 +1,79 @@
BUILDINFO(5)
============
Name
----
BUILDINFO - Makepkg package build information file
Synopsis
--------
This manual page describes the format of a BUILDINFO file found in the root of
a package created by makepkg. The file contains a description of the package's
build environment. The information is formatted in key-value pairs separated by
a '=', one value per line. Arrays are represented as multiple key-value pairs
having the same key.
Description
-----------
This is a description of the contents of version '2' of the
BUILDINFO file format.
*format*::
Denotes the file format version, represented by a plain positive integer.
*pkgname*::
The name of the package.
*pkgbase*::
The base name of a package, usually the same as the pkgname except for
split packages.
*pkgver*::
The version of the package including pkgrel and epoch.
*pkgarch*::
The architecture of the package.
*pkgbuild_sha256sum*::
The sha256sum in hex format of the PKGBUILD used to build the package.
*packager*::
The details of the packager that built the package.
*builddate*::
The build date of the package in epoch.
*builddir*::
The directory where the package was built.
*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.
*options (array)*::
The options set specified when building the package.
*installed (array)*::
The installed packages at build time including the version information of
the package. Formatted as "$pkgname-$pkgver-$pkgrel-$pkgarch".
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
include::footer.asciidoc[]

View file

@ -1,13 +1,16 @@
# Doxyfile 1.5.5
# Doxyfile 1.9.3
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = libalpm
PROJECT_NUMBER =
OUTPUT_DIRECTORY = ./
PROJECT_NUMBER =
PROJECT_BRIEF = "Arch Linux Package Manager Library"
PROJECT_LOGO =
OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
@ -25,36 +28,51 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
PYTHON_DOCSTRING = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = YES
TYPEDEF_HIDES_STRUCT = YES
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
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
@ -62,51 +80,66 @@ HIDE_IN_BODY_DOCS = YES
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
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
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"
WARN_LOGFILE =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../lib/libalpm/
INPUT = @INPUT_DIRECTORY@/../lib/libalpm/alpm.h \
@INPUT_DIRECTORY@/../lib/libalpm/alpm_list.h
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = _alpm_* \
__alpm_*
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# configuration options related to source browsing
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
@ -114,90 +147,140 @@ STRIP_CODE_COMMENTS = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = NO
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_DYNAMIC_MENUS = YES
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
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
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_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PAPER_TYPE = letter
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_BIB_STYLE = plain
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# configuration options related to the RTF output
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = .
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
@ -206,29 +289,35 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH = ../..
INCLUDE_FILE_PATTERNS = *.h
PREDEFINED = HAVE_CONFIG_H= \
SYMHIDDEN= \
SYMEXPORT=
EXPAND_AS_DEFINED =
SYMEXPORT= \
HAVE_LIBARCHIVE \
HAVE_LIBCURL \
HAVE_LIBGPGME
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 0
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
@ -236,16 +325,18 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
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
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View file

@ -1,140 +0,0 @@
# We have to do some funny stuff here with the manpages. In order to ensure
# a dist tarball doesn't get put out there without manpages, we keep those
# files listed in EXTRA_DIST no matter what. However, we only add them to
# man_MANS if --enable-asciidoc and/or --enable-doxygen are used.
ASCIIDOC_MANS = \
pacman.8 \
makepkg.8 \
repo-add.8 \
PKGBUILD.5 \
makepkg.conf.5 \
pacman.conf.5 \
libalpm.3
DOXYGEN_MANS = $(wildcard man3/*.3)
HTML_MANPAGES = \
pacman.8.html \
makepkg.8.html \
repo-add.8.html \
PKGBUILD.5.html \
makepkg.conf.5.html \
pacman.conf.5.html \
libalpm.3.html
HTML_OTHER = \
index.html \
submitting-patches.html \
translation-help.html \
HACKING.html
HTML_DOCS = \
$(HTML_MANPAGES) \
$(HTML_OTHER)
EXTRA_DIST = \
asciidoc.conf \
pacman.8.txt \
makepkg.8.txt \
repo-add.8.txt \
PKGBUILD.5.txt \
PKGBUILD-example.txt \
makepkg.conf.5.txt \
pacman.conf.5.txt \
libalpm.3.txt \
footer.txt \
index.txt \
submitting-patches.txt \
translation-help.txt \
Doxyfile \
$(ASCIIDOC_MANS) \
$(DOXYGEN_MANS)
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) repo-remove.8
# Ensure manpages are fresh when building a dist tarball
dist-hook:
$(MAKE) $(AM_MAKEFLAGS) clean
$(MAKE) $(AM_MAKEFLAGS) all
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 | sed s/^v//')-dirty
REAL_PACKAGE_VERSION = $(GIT_VERSION)
else
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
endif
man_MANS =
dist_man_MANS = $(ASCIIDOC_MANS) repo-remove.8
if USE_DOXYGEN
man_MANS += $(DOXYGEN_MANS)
all-local: doxygen.in
doxygen.in:
$(DOXYGEN) $(srcdir)/Doxyfile
endif
html: $(HTML_DOCS)
website: html
bsdtar czf website.tar.gz $(HTML_DOCS) \
-C /etc/asciidoc/stylesheets/ \
xhtml11.css xhtml11-manpage.css xhtml11-quirks.css \
-C /etc/asciidoc/javascripts/ \
asciidoc-xhtml11.js \
-C /etc/asciidoc/ \
images
pkgdatadir = ${datadir}/${PACKAGE}
ASCIIDOC_OPTS = \
-f asciidoc.conf \
-a pacman_version="$(REAL_PACKAGE_VERSION)" \
-a pacman_date="`date +%Y-%m-%d`" \
-a pkgdatadir=$(pkgdatadir) \
-a sysconfdir=$(sysconfdir)
A2X_OPTS = \
--no-xmllint \
-d manpage \
-f manpage \
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
# These rules are due to the includes and files of the asciidoc text
$(ASCIIDOC_MANS): asciidoc.conf footer.txt
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt
%.html: %.txt
asciidoc $(ASCIIDOC_OPTS) $*.txt
dos2unix $@
HACKING.html: ../HACKING
asciidoc $(ASCIIDOC_OPTS) -o $@ ../HACKING
dos2unix $@
# Customizations for certain HTML docs
$(HTML_MANPAGES): asciidoc.conf footer.txt
$(HTML_OTHER): asciidoc.conf
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons
%.8.html: ASCIIDOC_OPTS += -d manpage
%.5.html: ASCIIDOC_OPTS += -d manpage
%.3.html: ASCIIDOC_OPTS += -d manpage
# Dependency rules
pacman.8 pacman.8.html: pacman.8.txt
makepkg.8 makepkg.8.html: makepkg.8.txt
repo-add.8 repo-add.8.html: repo-add.8.txt
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.txt PKGBUILD-example.txt
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.txt
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.txt
libalpm.3 libalpm.3.html: libalpm.3.txt
# this one is just a symlink
repo-remove.8: repo-add.8
rm -f repo-remove.8
$(LN_S) repo-add.8 repo-remove.8
# vim:set ts=2 sw=2 noet:

View file

@ -1,20 +1,27 @@
# Maintainer: Joe User <joe.user@example.com>
pkgname=patch
pkgver=2.5.4
pkgrel=3
pkgver=2.7.1
pkgrel=1
pkgdesc="A utility to apply patch files to original sources"
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/patch/patch.html"
url="https://www.gnu.org/software/patch/patch.html"
license=('GPL')
groups=('base-devel')
depends=('glibc' 'ed')
source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
depends=('glibc')
makedepends=('ed')
optdepends=('ed: for "patch -e" functionality')
source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
sha256sums=('9124ba46db0abd873d0995c2ca880e81252676bb6c03e0a37dfc5f608a9b0ceb'
'SKIP')
build() {
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr
make
make prefix=$pkgdir/usr install
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr
make
}
package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir/" install
}

544
doc/PKGBUILD.5.asciidoc Normal file
View file

@ -0,0 +1,544 @@
PKGBUILD(5)
===========
Name
----
PKGBUILD - Package build description file
Synopsis
--------
PKGBUILD
Description
-----------
This manual page describes general rules about PKGBUILDs. Once a
PKGBUILD is written, the actual package is built using makepkg and installed
with pacman.
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'
along with other example files such as an install script. You can copy the
provided PKGBUILD.proto file to a new package build directory and make
customizations to suit your needs.
Options and Directives
----------------------
The following is a list of standard options and directives available for use
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
of them will be directly transferred to the built package. The mandatory
fields for a minimally functional PKGBUILD are *pkgname*, *pkgver*, *pkgrel*
and *arch*.
If you need to create any custom variables for use in your build process, it is
recommended to prefix their name with an '_' (underscore).
This will prevent any possible name clashes with internal makepkg variables.
For example, to store the base kernel version in a variable, use something
similar to `$_basekernver`.
*pkgname (array)*::
Either the name of the package or an array of names for split packages.
Valid characters for members of this array are alphanumerics, and any of
the following characters: ```@ . _ + -`''. Additionally, names are not
allowed to start with hyphens or dots.
*pkgver*::
The version of the software as released from the author (e.g., '2.7.1').
The variable is not allowed to contain colons, forward slashes, hyphens
or whitespace.
+
The `pkgver` variable can be automatically updated by providing a `pkgver()`
function in the PKGBUILD that outputs the new package version.
This is run after downloading and extracting the sources and running the
`prepare()` function (if present), so it can use those files in determining the
new `pkgver`. This is most useful when used with sources from version control
systems (see below).
*pkgrel*::
This is the release number specific to the distribution. This
allows package maintainers to make updates to the package's configure
flags, for example. This is typically set to '1' for each new upstream
software release and incremented for intermediate PKGBUILD updates. The
variable is a positive integer, with an optional subrelease level
specified by adding another positive integer separated by a period
(i.e. in the form x.y).
*epoch*::
Used to force the package to be seen as newer than any previous versions
with a lower epoch, even if the version number would normally not trigger
such an upgrade. This value is required to be a positive integer; the
default value if left unspecified is '0'. This is useful when the version
numbering scheme of a package changes (or is alphanumeric), breaking normal
version comparison logic. See linkman:pacman[8] for more information on
version comparisons.
*pkgdesc*::
This should be a brief description of the package and its functionality.
Try to keep the description to one line of text and to not use the package's
name.
*url*::
This field contains a URL that is associated with the software being
packaged. This is typically the project's web site.
*license (array)*::
This field specifies the license(s) that apply to the package.
If multiple licenses are applicable, list all of them:
`license=('GPL' 'FDL')`.
*install*::
Specifies a special install script that is to be included in the package.
This file should reside in the same directory as the PKGBUILD and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g., `install=$pkgname.install`).
*changelog*::
Specifies a changelog file that is to be included in the package.
The changelog file should end in a single newline.
This file should reside in the same directory as the PKGBUILD and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g., `changelog=$pkgname.changelog`).
*source (array)*::
An array of source files required to build the package. Source files
must either reside in the same directory as the PKGBUILD, or be a
fully-qualified URL that makepkg can use to download the file.
To simplify the maintenance of PKGBUILDs, use the `$pkgname` and `$pkgver`
variables when specifying the download location, if possible.
Compressed files will be extracted automatically unless found in the
noextract array described below.
+
Additional architecture-specific sources can be added by appending an
underscore and the architecture name e.g., 'source_x86_64=()'. There must be a
corresponding integrity array with checksums, e.g. 'cksums_x86_64=()'.
+
It is also possible to change the name of the downloaded file, which is helpful
with weird URLs and for handling multiple source files with the same
name. The syntax is: `source=('filename::url')`.
+
makepkg also supports building developmental versions of packages using sources
downloaded from version control systems (VCS). For more information, see
<<VCS,Using VCS Sources>> below.
+
Files in the source array with extensions `.sig`, `.sign` or, `.asc` are
recognized by makepkg as PGP signatures and will be automatically used to verify
the integrity of the corresponding source file.
*validpgpkeys (array)*::
An array of PGP fingerprints. If this array is non-empty, makepkg will
only accept signatures from the keys listed here and will ignore the
trust values from the keyring. If the source file was signed with a
subkey, makepkg will still use the primary key for comparison.
+
Only full fingerprints are accepted. They must be uppercase and must not
contain whitespace characters.
*noextract (array)*::
An array of file names corresponding to those from the source array. Files
listed here will not be extracted with the rest of the source files. This
is useful for packages that use compressed data directly.
*cksums (array)*::
This array contains CRC checksums for every source file specified in the
source array (in the same order). makepkg will use this to verify source
file integrity during subsequent builds. If 'SKIP' is put in the array
in place of a normal hash, the integrity check for that source file will
be skipped. To easily generate cksums, run ``makepkg -g >> PKGBUILD''.
If desired, move the cksums line to an appropriate location. Note that
checksums generated by "makepkg -g" should be verified using checksum
values provided by the software developer.
*md5sums, sha1sums, sha224sums, sha256sums, sha384sums, sha512sums, b2sums (arrays)*::
Alternative integrity checks that makepkg supports; these all behave
similar to the cksums option described above. To enable use and generation
of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
linkman:makepkg.conf[5].
*groups (array)*::
An array of symbolic names that represent groups of packages, allowing
you to install multiple packages by requesting a single target. For
example, one could install all KDE packages by installing the 'kde' group.
*arch (array)*::
Defines on which architectures the given package is available (e.g.,
`arch=('i686' 'x86_64')`). Packages that contain no architecture specific
files should use `arch=('any')`. Valid characters for members of this array
are alphanumerics and ```_`''.
*backup (array)*::
An array of file names, without preceding slashes, that
should be backed up if the package is removed or upgraded. This is
commonly used for packages placing configuration files in '/etc'. See
`"Handling Config Files"` in linkman:pacman[8] for more information.
*depends (array)*::
An array of packages this package depends on to run. Entries in
this list should be surrounded with single quotes and contain at least
the package name. Entries can also include a version requirement of the
form 'name<>version', where `<>` is one of five comparisons: `>=` (greater
than or equal to), `<=` (less than or equal to), `=` (equal to), `>`
(greater than), or `<` (less than).
+
Additional architecture-specific depends can be added by appending an
underscore and the architecture name e.g., 'depends_x86_64=()'.
*makedepends (array)*::
An array of packages this package depends on to build but are not
needed at runtime. Packages in this list follow the same format as
depends.
+
Additional architecture-specific makedepends can be added by appending an
underscore and the architecture name e.g., 'makedepends_x86_64=()'.
*checkdepends (array)*::
An array of packages this package depends on to run its test suite
but are not needed at runtime. Packages in this list follow the same
format as depends. These dependencies are only considered when the
check() function is present and is to be run by makepkg.
+
Additional architecture-specific checkdepends can be added by appending an
underscore and the architecture name e.g., 'checkdepends_x86_64=()'.
*optdepends (array)*::
An array of packages (and accompanying reasons) that are not essential for
base functionality, but may be necessary to make full use of the contents
of this package. optdepends are currently for informational purposes only
and are not utilized by pacman during dependency resolution. Packages in
this list follow the same format as depends, with an optional description
appended. The format for specifying optdepends descriptions is:
optdepends=('python: for library bindings')
+
Additional architecture-specific optdepends can be added by appending an
underscore and the architecture name e.g., 'optdepends_x86_64=()'.
*conflicts (array)*::
An array of packages that will conflict with this package (i.e. they
cannot both be installed at the same time). This directive follows the
same format as depends. Versioned conflicts are supported using the
operators as described in `depends`.
+
Additional architecture-specific conflicts can be added by appending an
underscore and the architecture name e.g., 'conflicts_x86_64=()'.
*provides (array)*::
An array of ``virtual provisions'' this package provides. This allows
a package to provide dependencies other than its own package name. For
example, the dcron package can provide 'cron', which allows packages to
depend on 'cron' rather than 'dcron OR fcron'.
+
Versioned provisions are also possible, in the 'name=version' format. For
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.
+
Additional architecture-specific provides can be added by appending an
underscore and the architecture name e.g., 'provides_x86_64=()'.
*replaces (array)*::
An array of packages this package should replace. This can be used
to handle renamed/combined packages. For example, if the 'j2re' package
is renamed to 'jre', this directive allows future upgrades to continue
as expected even though the package has moved. Versioned replaces are
supported using the operators as described in `depends`.
+
Sysupgrade is currently the only pacman operation that utilizes this field.
A normal sync or upgrade will not use its value.
+
Additional architecture-specific replaces can be added by appending an
underscore and the architecture name e.g., 'replaces_x86_64=()'.
*options (array)*::
This array allows you to override some of makepkg's default behavior
when building packages. To set an option, just include the option name
in the options array. To reverse the default behavior, place an ``!'' at
the front of the option. Only specify the options you specifically want
to override, the rest will be taken from linkman:makepkg.conf[5].
*NOTE:* 'force' is a now-removed option in favor of the top level 'epoch'
variable.
*strip*;;
Strip symbols from binaries and libraries. If you frequently
use a debugger on programs or libraries, it may be helpful to
disable this option.
*docs*;;
Save doc directories. If you wish to delete doc directories,
specify `!docs` in the array.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to
remove them.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
remove them (if they have a shared counterpart).
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress man and info pages with gzip.
*ccache*;;
Allow the use of ccache during `build()`. More useful in its negative
form `!ccache` with select packages that have problems building
with ccache.
*distcc*;;
Allow the use of distcc during `build()`. More useful in its negative
form `!distcc` with select packages that have problems building
with distcc.
*buildflags*;;
Allow the use of user-specific buildflags (CPPFLAGS, CFLAGS, CXXFLAGS,
LDFLAGS) during `build()` as specified in linkman:makepkg.conf[5]. More
useful in its negative form `!buildflags` with select packages that
have problems building with custom buildflags.
*makeflags*;;
Allow the use of user-specific makeflags during `build()` as specified
in linkman:makepkg.conf[5]. More useful in its negative form
`!makeflags` with select packages that have problems building with
custom makeflags such as `-j2` (or higher).
*debug*;;
Add the user-specified debug flags (DEBUG_CFLAGS, DEBUG_CXXFLAGS) to
their counterpart buildflags as specified in linkman:makepkg.conf[5].
When used in combination with the `strip' option, a separate package
containing the debug symbols is created.
*lto*;;
Enable building packages using link time optimization. Adds '-flto'
to both CFLAGS and CXXFLAGS.
*xdata (array)*::
This array allows you to add additional metadata to the package.
This data is neither used by pacman nor by makepkg;
It has purely informational purpose, or may be interpreted by third-party tools.
+
All entries in that array must have the form 'key=value', where
'key' is an arbitrary non-empty string and 'value' must not contain an equal sign.
Furthermore, the key ``pkgtype'' is reserved for the makepkg program.
Packaging Functions
-------------------
In addition to the above directives, PKGBUILDs require a set of functions that
provide instructions to build and install the package. As a minimum, the
PKGBUILD must contain a `package()` function which installs all the package's
files into the packaging directory, with optional `prepare()`, `build()`, and
`check()` functions being used to create those files from source.
This is directly sourced and executed by makepkg, so anything that Bash or the
system has available is available for use here. Be sure any exotic commands
used are covered by the `makedepends` array.
If you create any variables of your own in any of these functions, it is
recommended to use the Bash `local` keyword to scope the variable to inside the
function.
*package() Function*::
The `package()` function is used to install files into the directory that
will become the root directory of the built package and is run after all
the optional functions listed below. The packaging stage is run using
fakeroot to ensure correct file permissions in the resulting package.
All other functions will be run as the user calling makepkg.
This function is run inside `$srcdir`.
*verify() Function*::
An optional `verify()` function can be specified to implement arbitrary
source authentication. The function should return a non-zero exit code when
verification fails. This function is run before sources are extracted.
This function is run inside `$startdir`.
*prepare() Function*::
An optional `prepare()` function can be specified in which operations to
prepare the sources for building, such as patching, are performed. This
function is run after the source extraction and before the `build()`
function. The `prepare()` function is skipped when source extraction
is skipped.
This function is run inside `$srcdir`.
*build() Function*::
The optional `build()` function is used to compile and/or adjust the source
files in preparation to be installed by the `package()` function.
This function is run inside `$srcdir`.
*check() Function*::
An optional `check()` function can be specified in which a package's
test-suite may be run. This function is run between the `build()` and
`package()` functions. Be sure any exotic commands used are covered by the
`checkdepends` array.
This function is run inside `$srcdir`.
All of the above variables such as `$pkgname` and `$pkgver` are available for
use in the packaging functions. In addition, makepkg defines the following
variables:
*srcdir*::
This contains the directory where makepkg extracts, or copies, all source
files.
+
*pkgdir*::
This contains the directory where makepkg bundles the installed package.
This directory will become the root directory of your built package. This
variable should only be used in the `package()` function.
*startdir*::
This contains the absolute path to the directory where the PKGBUILD is
located, which is usually the output of `$(pwd)` when makepkg is started.
Use of this variable is deprecated and strongly discouraged.
Package Splitting
-----------------
makepkg supports building multiple packages from a single PKGBUILD. This is
achieved by assigning an array of package names to the `pkgname` directive.
Each split package uses a corresponding packaging function with name
`package_foo()`, where `foo` is the name of the split package.
All options and directives for the split packages default to the global values
given in the PKGBUILD. Nevertheless, the following ones can be overridden within
each split package's packaging function:
`pkgdesc`, `arch`, `url`, `license`, `groups`, `depends`, `optdepends`,
`provides`, `conflicts`, `replaces`, `backup`, `options`, `install`, and
`changelog`.
Note that makepkg does not consider split package `depends` when checking
if dependencies are installed before package building and with `--syncdeps`.
All packages required to make the package are required to be specified in
the global `depends` and `makedepends` arrays.
An optional global directive is available when building a split package:
*pkgbase*::
The name used to refer to the group of packages in the output of makepkg
and in the naming of source-only tarballs. If not specified, the first
element in the `pkgname` array is used. Valid characters for this
variable are alphanumerics, and any of the following characters:
```@ . _ + -`''. Additionally, the variable is not allowed to start with
hyphens or dots.
Install/Upgrade/Remove Scripting
--------------------------------
Pacman has the ability to store and execute a package-specific script when it
installs, removes, or upgrades a package. This allows a package to configure
itself after installation and perform an opposite action upon removal.
The exact time the script is run varies with each operation, and should be
self-explanatory. Note that during an upgrade operation, none of the install
or remove functions will be called.
Scripts are passed either one or two ``full version strings'', where a full
version string is either 'pkgver-pkgrel' or 'epoch:pkgver-pkgrel', if epoch is
non-zero.
*pre_install*::
Run right before files are extracted. One argument is passed:
new package full version string.
*post_install*::
Run right after files are extracted. One argument is passed:
new package full version string.
*pre_upgrade*::
Run right before files are extracted. Two arguments are passed in this
order: new package full version string, old package full version string.
*post_upgrade*::
Run after files are extracted. Two arguments are passed in this order:
new package full version string, old package full version string.
*pre_remove*::
Run right before files are removed. One argument is passed:
old package full version string.
*post_remove*::
Run right after files are removed. One argument is passed:
old package full version string.
To use this feature, create a file such as 'pkgname.install' and put it in the
same directory as the PKGBUILD script. Then use the install directive:
install=pkgname.install
The install script does not need to be specified in the source array. A
template install file is available in '{pkgdatadir}' as 'proto.install' for
reference with all of the available functions defined.
Using VCS Sources[[VCS]]
------------------------
Building a developmental version of a package using sources from a version
control system (VCS) is enabled by specifying the source in the form:
source=('directory::url#fragment?query')
Currently makepkg supports the Bazaar, Git, Subversion, Fossil and Mercurial
version control systems. For other version control systems, manual cloning of
upstream repositories must be done in the `prepare()` function.
Some <<VCS,VCS Sources>> like Git support pinning the checkout by a checksum of
its content using deterministic export functionality like ``git archive''.
The source URL is divided into four components:
*directory*::
(optional) Specifies an alternate directory name for makepkg to download
the VCS source into.
*url*::
The URL to the VCS repository. This must include the VCS in the URL protocol
for makepkg to recognize this as a VCS source. If the protocol does not
include the VCS name, it can be added by prefixing the URL with `vcs+`. For
example, using a Git repository over HTTPS would have a source URL in the
form:
`git+https://...`.
*fragment*::
(optional) Allows specifying a revision number or branch for makepkg to checkout
from the VCS. A fragment has the form `type=value`, for example to checkout a
given revision the source line would be `source=(url#revision=123)`. The
available types depends on the VCS being used:
*bzr*;;
revision (see `'bzr help revisionspec'` for details)
*fossil*;;
branch, commit, tag
*git*;;
branch, commit, tag
*hg*;;
branch, revision, tag
*svn*;;
revision
*query*::
(optional) Allows specifying whether a VCS checkout should be checked for
PGP-signed revisions. The source line should have the format
`source=(url#fragment?signed)` or `source=(url?signed#fragment)`. Currently
only supported by Git.
Example
-------
The following is an example PKGBUILD for the 'patch' package. For more
examples, look through the build files of your distribution's packages.
[source,sh]
-------------------------------
include::PKGBUILD-example.txt[]
-------------------------------
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
include::footer.asciidoc[]

View file

@ -1,417 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
PKGBUILD(5)
===========
Name
----
PKGBUILD - Arch Linux package build description file
Synopsis
--------
PKGBUILD
Description
-----------
This manual page is meant to describe general rules about PKGBUILDs. Once a
PKGBUILD is written, the actual package is built using makepkg and installed
with pacman.
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'.
Also located there are other example files such as a ChangeLog and an install
script. You can copy the provided PKGBUILD.proto file to a new package build
directory and make customizations to suit your needs.
Options and Directives
----------------------
The following is a list of standard options and directives available for use
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
will be directly transferred to the built package.
If you need to create any custom variables for use in your build process, it is
recommended to name your custom variables with an '_' (underscore) prefix.
This will prevent any possible name clashes with internal makepkg variables.
For example, to store the base kernel version in a variable, use something
similar to `$_basekernver`.
*pkgname (array)*::
The name of the package. This has be a unix-friendly name as it will be
used in the package filename. Members of the array are not allowed to start
with hyphens.
*pkgver*::
The version of the software as released from the author (e.g. '2.7.1').
The variable is not allowed to contain hyphens.
*pkgrel*::
This is the release number specific to the Arch Linux release. This
allows package maintainers to make updates to the package's configure
flags, for example. A pkgrel of 1 is typically used for each upstream
software release and is incremented for intermediate PKGBUILD updates. The
variable is not allowed to contain hyphens.
*pkgdesc*::
This should be a brief description of the package and its functionality.
Try to keep the description to one line of text.
*url*::
This field contains a URL that is associated with the software being
packaged. This is typically the project's website.
*license (array)*::
This field specifies the license(s) that apply to the package.
Commonly-used licenses are 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
found in '/usr/share/licenses/common', then you should include the license
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 for a package, list all of them:
`license=('GPL' 'FDL')`.
*install*::
Specifies a special install script that is to be included in the package.
This file should reside in the same directory as the PKGBUILD, and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `install=pkgname.install`).
*changelog*::
Specifies a changelog file that is to be included in the package.
This file should reside in the same directory as the PKGBUILD, and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `changelog=$pkgname.changelog`).
*source (array)*::
An array of source files required to build the package. Source files
must either reside in the same directory as the PKGBUILD file, or be a
fully-qualified URL that makepkg will use to download the file. In order
to make the PKGBUILD as useful as possible, use the $pkgname and $pkgver
variables if possible when specifying the download location. Any files
that are compressed will automatically be extracted, unless found in
the noextract array listed below.
+
It is also possible to specify an optional filename, which is helpful
with weird URLs and for handling multiple source files with the same
name. The syntax is: `source=('filename::url')`.
*noextract (array)*::
An array of filenames corresponding to those from the source array. Files
listed here will not be extracted with the rest of the source files. This
is useful for packages which use compressed data which is downloaded but
not necessary to uncompress.
*md5sums (array)*::
This array contains an MD5 hash for every source file specified in the
source array (in the same order). makepkg will use this to verify source
file integrity during subsequent builds. To easily generate md5sums, run
``makepkg -g >> PKGBUILD''. If desired, move the md5sums line to an
appropriate location.
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
Alternative integrity checks that makepkg supports; these all behave
similar to the md5sums option described above. To enable use and generation
of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
linkman:makepkg.conf[5].
*groups (array)*::
An array of symbolic names that represent groups of packages, allowing
you to install multiple packages by requesting a single target. For
example, one could install all KDE packages by installing the 'kde' group.
*arch (array)*::
Defines on which architectures the given package is available (e.g.
`arch=('i686' 'x86_64')`). Packages that contain no architecture specific
files may use arch=('any').
*backup (array)*::
A space-delimited array of filenames, without preceding slashes, that
should be backed up if the package is removed or upgraded. This is
commonly used for packages placing configuration files in /etc. See
Handling Config Files in linkman:pacman[8] for more information.
*depends (array)*::
An array of packages that this package depends on to run. Packages in
this list should be surrounded with single quotes and contain at least
the package name. Entries can also include a version requirement of the
form 'name<>version', where <> is one of five comparisons: >= (greater
than or equal to), <= (less than or equal to), = (equal to), > (greater
than), or < (less than).
*makedepends (array)*::
An array of packages that this package depends on to build, but are not
needed at runtime. Packages in this list follow the same format as
depends.
*optdepends (array)*::
An array of packages (and accompanying reasons) that are not essential for
base functionality, but may be necessary to make full use of the contents
of this package. optdepends are currently for informational purposes only
and are not utilized by pacman during dependency resolution. The format
for specifying optdepends is:
optdepends=('fakeroot: for makepkg usage as normal user')
*conflicts (array)*::
An array of packages that will conflict with this package (i.e. they
cannot both be installed at the same time). This directive follows the
same format as depends. Versioned conflicts are also supported.
*provides (array)*::
An array of ``virtual provisions'' that this package provides. This allows
a package to provide dependencies other than its own package name. For
example, the dcron package can provide 'cron', which allows packages to
depend on 'cron' rather than 'dcron OR fcron'.
Versioned provisions are also possible, in the 'name=version' format.
For 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.
*replaces (array)*::
An array of packages that this package should replace, and can be used
to handle renamed/combined packages. For example, if the 'j2re' package
is renamed to 'jre', this directive allows future upgrades to continue
as expected even though the package has moved. Sysupgrade is currently
the only pacman operation that utilizes this field, a normal sync will
not use its value.
*options (array)*::
This array allows you to override some of makepkg's default behavior
when building packages. To set an option, just include the option name
in the options array. To reverse the default behavior, place an ``!'' at
the front of the option. Only specify the options you specifically want
to override, the rest will be taken from linkman:makepkg.conf[5].
*NOTE:* 'force' is a special option only used in a linkman:PKGBUILD[5],
do not use it unless you know what you are doing.
*strip*;;
Strip symbols from binaries and libraries. If you frequently
use a debugger on programs or libraries, it may be helpful to
disable this option.
*docs*;;
Save doc directories. If you wish to delete doc directories,
specify `!docs` in the array.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to
remove them.
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress man and info pages with gzip.
*ccache*;;
Allow the use of ccache during build. More useful in its negative
form `!ccache` with select packages that have problems building
with ccache.
*distcc*;;
Allow the use of distcc during build. More useful in its negative
form `!distcc` with select packages that have problems building
with distcc.
*makeflags*;;
Allow the use of user-specific makeflags during build as specified
in linkman:makepkg.conf[5]. More useful in its negative form
`!makeflags` with select packages that have problems building with
custom makeflags such as `-j2` (or higher).
*force*;;
Force the package to be upgraded by a pacman system upgrade
operation, even if the version number would normally not trigger
such an upgrade. This is useful when the version numbering scheme
of a package changes (or is alphanumeric). See linkman:pacman[8] for
more information on version comparisons.
build() Function
----------------
In addition to the above directives, the optional build() bash function usually
comprises the remainder of the PKGBUILD. This is directly sourced and executed
by makepkg, so anything that bash or the system has available is available for
use here. The function is run in `bash -e` mode, meaning any command that exits
with a non-zero status will cause the function to exit. Be sure any exotic
commands used are covered by `makedepends`.
All of the above variables such as `pkgname` and `pkgver` are available for use
in the build function. In addition, makepkg defines three variables for your
use during the build and install process. These three variables are as follows:
*startdir*::
This contains the absolute path to the directory where the PKGBUILD was
located, which is usually the output of `$(pwd)` when makepkg is started.
*srcdir*::
This points to the directory where makepkg extracts or copies all source
files.
*pkgdir*::
This points to the directory where makepkg bundles the installed package
(this directory will become the root directory of your built package).
If you create any variables of your own in the build function, it is
recommended to use the bash `local` keyword to scope the variable to inside
the build function.
package() Function
------------------
An optional package() function can be specified in addition to the build()
function. This function is run immediately after the build() function. The
function is run in `bash -e` mode, meaning any command that exits with a
non-zero status will cause the function to exit. When specified in combination
with the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
will be limited to running the packaging stage. An existing build() function
will be run as the user calling makepkg.
Package Splitting
-----------------
makepkg supports building multiple packages from a single PKGBUILD. This is
achieved by assigning an array of package names to the `pkgname` directive.
Each split package uses a corresponding packaging function with name
`package_foo()`, where `foo` is the name of the split package.
All options and directives for the split packages default to the global values
given within the PKGBUILD. However, some of these can be overridden within each
split package's packaging function. The following variables can be overridden:
`pkgver`, `pkgrel`, `pkgdesc`, `arch`, `license`, `groups`, `depends`,
`optdepends`, `provides`, `conflicts`, `replaces`, `backup`, `options`,
`install` and `changelog`.
An optional global directive is available when building a split package:
*pkgbase*::
The name used to refer to the group of packages in the output of makepkg
and in the naming of source-only tarballs. If not specified, the first
element in the `pkgname` array is used. The variable is not allowed to
begin with a hyphen.
Install/Upgrade/Remove Scripting
--------------------------------
Pacman has the ability to store and execute a package-specific script when it
installs, removes, or upgrades a package. This allows a package to configure
itself after installation and perform an opposite action upon removal.
The exact time the script is run varies with each operation:
*pre_install*::
script is run right before files are extracted. One argument is passed:
new package version.
*post_install*::
script is run right after files are extracted. One argument is passed:
new package version.
*pre_upgrade*::
script is run right before files are extracted. Two arguments are passed
in the following order: new package version, old package version.
*post_upgrade*::
script is run after files are extracted. Two arguments are passed
in the following order: new package version, old package version.
*pre_remove*::
script is run right before files are removed. One argument is passed:
old package version.
*post_remove*::
script is run right after files are removed. One argument is passed:
old package version.
To use this feature, create a file such as 'pkgname.install' and put it in the
same directory as the PKGBUILD script. Then use the install directive:
install=pkgname.install
The install script does not need to be specified in the source array. A
template install file is available in '{pkgdatadir}' as 'proto.install' for
reference with all of the available functions defined.
Development Directives
----------------------
makepkg supports building development versions of packages without having to
manually update the pkgver in the PKGBUILD. This was formerly done using the
separate utility 'versionpkg'. In order to utilize this functionality, your
PKGBUILD must use correct variable names depending on the SCM being fetched
from.
*CVS*::
The generated pkgver will be the date the package is built.
*_cvsroot*;;
The root of the CVS repository.
*_cvsmod*;;
The CVS module to fetch.
*SVN*::
The generated pkgver will be the latest SVN revision number.
*_svntrunk*;;
The trunk of the SVN repository.
*_svnmod*;;
The SVN module to fetch.
*Git*::
The generated pkgver will be one formatted by the 'git-describe'
command, with '-' characters converted to '_' characters.
*_gitroot*;;
The URL (all protocols supported) to the GIT repository.
*_gitname*;;
GIT tag or branch to use.
*Mercurial*::
The generated pkgver will be the hg tip revision number.
*_hgroot*;;
The URL of the mercurial repository.
*_hgrepo*;;
The repository to follow.
*Darcs*::
The generated pkgver will be the date the package is built.
*_darcstrunk*;;
URL to the repository trunk.
*_darcsmod*;;
Darcs module to use.
*Bazaar*::
The generated pkgver will be the latest Bazaar revision number (revno).
*_bzrtrunk*;;
URL to the bazaar repository.
*_bzrmod*;;
Bazaar module to use.
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 ABS tree.
[source,sh]
-------------------------------
include::PKGBUILD-example.txt[]
-------------------------------
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
include::footer.txt[]

133
doc/alpm-hooks.5.asciidoc Normal file
View file

@ -0,0 +1,133 @@
alpm-hooks(5)
=============
NAME
----
alpm-hooks - alpm hook file format
SYNOPSIS
--------
--------
[Trigger] (Required, Repeatable)
Operation = Install|Upgrade|Remove (Required, Repeatable)
Type = Path|Package (Required)
Target = <Path|PkgName> (Required, Repeatable)
[Action] (Required)
Description = ... (Optional)
When = PreTransaction|PostTransaction (Required)
Exec = <Command> (Required)
Depends = <PkgName> (Optional)
AbortOnFail (Optional, PreTransaction only)
NeedsTargets (Optional)
--------
DESCRIPTION
-----------
libalpm provides the ability to specify hooks to run before or after
transactions based on the packages and/or files being modified. Hooks consist
of a single '[Action]' section describing the action to be run and one or more
'[Trigger]' section describing which transactions it should be run for.
Hooks are read from files located in the system hook directory
+{datarootdir}/libalpm/hooks+, and additional custom directories specified in
linkman:pacman.conf[5] (the default is +{sysconfdir}/pacman.d/hooks+). The
file names are required to have the suffix ".hook". Hooks are run in
alphabetical order of their file name, where the ordering ignores the suffix.
TRIGGERS
--------
Hooks must contain at least one '[Trigger]' section that determines which
transactions will cause the hook to run. If multiple trigger sections are
defined the hook will run if the transaction matches *any* of the triggers.
*Operation =* Install|Upgrade|Remove::
Select the type of operation to match targets against. May be specified
multiple times. Installations are considered an upgrade if the package or
file is already present on the system regardless of whether the new package
version is actually greater than the currently installed version. For Path
triggers, this is true even if the file changes ownership from one package
to another. Required.
*Type =* Path|Package::
Select whether targets are matched against transaction packages or files.
See CAVEATS for special notes regarding Path triggers. 'File' is a deprecated
alias for 'Path' and will be removed in a future release. Required.
*Target =* <path|package>::
The path or package name to match against the active transaction.
Paths refer to the files in the package archive; the installation root
should *not* be included in the path. Shell-style glob patterns are
allowed. It is possible to invert matches by prepending a target with an
exclamation mark. May be specified multiple times. Required.
ACTIONS
-------
*Description =* ...::
An optional description that describes the action being taken by the
hook for use in front-end output.
*Exec =* <command>::
Command to run. Command arguments are split on whitespace. Values
containing whitespace should be enclosed in quotes. Required.
*When =* PreTransaction|PostTransaction::
When to run the hook. Required.
*Depends =* <package>::
Packages that must be installed for the hook to run. May be specified
multiple times.
*AbortOnFail*::
Causes the transaction to be aborted if the hook exits non-zero. Only
applies to PreTransaction hooks.
*NeedsTargets*::
Causes the list of matched trigger targets to be passed to the running hook
on 'stdin'.
OVERRIDING HOOKS
----------------
Hooks may be overridden by placing a file with the same name in a higher
priority hook directory. Hooks may be disabled by overriding them with
a symlink to '/dev/null'.
EXAMPLES
--------
--------
# Force disks to sync to reduce the risk of data corruption
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = *
[Action]
Depends = coreutils
When = PostTransaction
Exec = /usr/bin/sync
--------
CAVEATS
-------
There are situations when path triggers may act in unexpected ways. Hooks are
triggered using the file list of the installed, upgraded, or removed package.
When installing or upgrading a file that is extracted with a '.pacnew'
extension, the original file name is used in triggering the hook. When
removing a package, all files owned by that package can trigger a hook whether
or not they were actually present on the file system before package removal.
PostTransaction hooks will *not* run if the transaction fails to complete for
any reason.
include::footer.asciidoc[]

View file

@ -0,0 +1,7 @@
table th, table td {
padding: 0.2em 1em;
}
table td p.table {
margin: 0;
}

View file

@ -1,5 +1,5 @@
## linkman: macro
# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf
# Inspired by/borrowed from the Git source tree at Documentation/asciidoc.conf
#
# Usage: linkman:command[manpage-section]
#
@ -17,7 +17,11 @@ plus=&#43;
caret=&#94;
startsb=&#91;
endsb=&#93;
backslash=&#92;
tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
ifdef::backend-docbook[]
[linkman-inlinemacro]
@ -46,7 +50,7 @@ ifdef::backend-docbook[]
template::[header-declarations]
<refentry>
<refentryinfo>
<date>{pacman_date}</date>
<date>{localdate}</date>
</refentryinfo>
<refmeta>
<refentrytitle>{mantitle}</refentrytitle>

36
doc/footer.asciidoc Normal file
View file

@ -0,0 +1,36 @@
See the pacman website at https://archlinux.org/pacman/[] for current
information on pacman and its related tools.
Bugs
----
Bugs? You must be kidding; there are no bugs in this software. But if we
happen to be wrong, please report them to the issue tracker at
link:https://gitlab.archlinux.org/pacman/pacman/-/issues[] with specific
information such as your command-line, the nature of the bug, and even
the package database if it helps.
Authors
-------
Current maintainers:
* Allan McRae <allan@archlinux.org>
* Andrew Gregory <andrew.gregory.8@gmail.com>
* Morgan Adamiec <morganamilo@archlinux.org>
Past major contributors:
* Judd Vinet <jvinet@zeroflux.org>
* Aurelien Foret <aurelien@archlinux.org>
* Aaron Griffin <aaron@archlinux.org>
* Dan McGee <dan@archlinux.org>
* Xavier Chantry <shiningxc@gmail.com>
* Nagy Gabor <ngaba@bibl.u-szeged.hu>
* Dave Reisner <dreisner@archlinux.org>
* Eli Schwartz <eschwartz@archlinux.org>
For additional contributors, use `git shortlog -s` on the pacman.git
repository.

View file

@ -1,30 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
See the pacman website at http://www.archlinux.org/pacman/[] for current
information on pacman and its related tools.
Bugs
----
Bugs? You must be kidding, there are no bugs in this software. But if we
happen to be wrong, send us an email with as much detail as possible to
mailto:pacman-dev@archlinux.org[].
Authors
-------
Current maintainers:
* Dan McGee <dan@archlinux.org>
* Xavier Chantry <shiningxc@gmail.com>
* Aaron Griffin <aaron@archlinux.org>
Past contributors:
* Judd Vinet <jvinet@zeroflux.org>
* Aurelien Foret <aurelien@archlinux.org>
See the 'AUTHORS' file for additional contributors.

258
doc/index.asciidoc Normal file
View file

@ -0,0 +1,258 @@
Pacman Home Page
================
A simple library-based package manager.
Introduction
------------
pacman is a utility which manages software packages in Linux. It uses simple
compressed files as a package format, and maintains a text-based package
database (more of a hierarchy), just in case some hand tweaking is necessary.
pacman does not strive to "do everything." It will add, remove and upgrade
packages in the system, and it will allow you to query the package database for
installed packages, files and owners. It also attempts to handle dependencies
automatically and can download packages from a remote server.
History
~~~~~~~
Version 2.0 of pacman introduced the ability to sync packages (the '\--sync'
option) with a master server through the use of package databases. Prior to
this, packages would have to be installed manually using the '\--add' and
'\--upgrade' operations.
Version 3.0 was the switch to a two-part pacman -- a back-end named libalpm
(library for Arch Linux Package Management) and the familiar pacman front-end.
Speed in many cases was improved, along with dependency and conflict resolution
being able to handle a much wider variety of cases. The switch to a
library-based program should also make it easier in the future to develop
alternative front ends.
Version 4.0 added package signing and verification capabilities to the entire
makepkg/repo-add/pacman toolchain via GnuPG and GPGME.
Version 5.0 added support for pre/post-transaction hooks and sync database file
list operations.
Version 6.0 added support for parallel downloads.
Documentation
-------------
Man Pages
~~~~~~~~~
There are several man pages available for the programs, utilities, and
configuration files dealing with pacman.
* linkman:alpm-hooks[5]
* linkman:BUILDINFO[5]
* linkman:PKGBUILD[5]
* linkman:libalpm[3]
* linkman:makepkg[8]
* linkman:makepkg-template[1]
* linkman:makepkg.conf[5]
* linkman:pacman[8]
* linkman:pacman-key[8]
* linkman:pacman-conf[8]
* linkman:pacman.conf[5]
* linkman:repo-add[8]
* linkman:vercmp[8]
Changelog
~~~~~~~~~
For a good idea of what is going on in pacman development, take a look at the
link:https://gitlab.archlinux.org/pacman/pacman[Git summary page] for the
project.
See the most recent
link:https://gitlab.archlinux.org/pacman/pacman/-/blob/master/NEWS[NEWS]
file for a not-as-frequently-updated list of changes. However, this should
contain the biggest changes in a format more concise than the commit log.
Releases
--------
[frame="none",grid="none",options="autowidth",cols="3*a"]
|======
|
[frame="topbot",grid="none",options="header,autowidth"]
!======
!Version !Date
!7.0.0 !2024-07-14
!6.1.0 !2024-03-04
!6.0.1 !2021-09-04
!6.0.0 !2021-05-20
!6.0.0alpha1 !2020-12-04
!5.2.1 !2019-11-01
!5.2.0 !2019-10-21
!5.1.3 !2019-03-01
!5.1.2 !2018-12-25
!5.1.1 !2018-07-27
!5.1.0 !2018-05-28
!5.0.2 !2017-06-03
!5.0.1 !2016-02-23
!5.0.0 !2016-01-30
!4.2.1 !2015-02-20
!4.2.0 !2014-12-19
!4.1.2 !2013-06-18
!4.1.1 !2013-05-07
!4.1.0 !2013-04-01
!4.1.0rc1 !2013-03-09
!4.0.3 !2012-04-07
!4.0.2 !2012-02-11
!4.0.1 !2011-11-20
!4.0.0 !2011-10-13
!4.0.0rc2 !2011-09-22
!4.0.0rc1 !2011-08-11
!3.5.4 !2011-08-10
!3.5.3 !2011-06-07
!3.5.2 !2011-04-18
!3.5.1 !2011-03-23
!3.5.0 !2011-03-16
!3.4.3 !2011-01-22
!3.4.2 !2010-12-29
!3.4.1 !2010-09-03
!======
|
[frame="topbot",grid="none",options="header,autowidth"]
!======
!Version !Date
!3.4.0 !2010-06-16
!3.3.3 !2009-11-10
!3.3.2 !2009-10-05
!3.3.1 !2009-09-22
!3.3.0 !2009-08-02
!3.2.2 !2009-01-05
!3.2.1 !2008-08-26
!3.2.0 !2008-07-30
!3.1.4 !2008-04-01
!3.1.3 !2008-03-06
!3.1.2 !2008-02-20
!3.1.1 !2008-01-20
!3.1.0 !2008-01-09
!3.0.6 !2007-09-16
!3.0.5 !2007-06-17
!3.0.4 !2007-05-08
!3.0.3 !2007-04-28
!3.0.2 !2007-04-23
!3.0.1 !2007-04-04
!3.0.0 !2007-03-25
!2.9.8 !2006-02-02
!2.9.7 !2005-09-16
!2.9.7-TEST3 !2005-09-11
!2.9.7-TEST2 !2005-09-07
!2.9.7-TEST !2005-08-19
!2.9.6 !2005-06-10
!2.9.5 !2005-01-11
!2.9.4 !2004-12-20
!2.9.3 !2004-12-19
!2.9.2 !2004-09-25
!2.9.1 !2004-09-25
!2.9 !2004-09-18
!2.8.4 !2004-08-23
!2.8.3 !2004-08-04
!======
|
[frame="topbot",grid="none",options="header,autowidth"]
!======
!Version !Date
!2.8.2 !2004-07-22
!2.8.1 !2004-07-17
!2.8 !2004-07-03
!2.7.9 !2004-04-30
!2.7.8 !2004-04-29
!2.7.7 !2004-04-15
!2.7.6 !2004-04-04
!2.7.5 !2004-03-02
!2.7.4 !2004-02-18
!2.7.3 !2004-02-07
!2.7.2 !2004-01-04
!2.7.1 !2003-12-21
!2.7 !2003-11-25
!2.6.4 !2003-10-17
!2.6.3 !2003-10-01
!2.6.2 !2003-09-29
!2.6.1 !2003-09-15
!2.6 !2003-09-03
!2.5.1 !2003-07-12
!2.5 !2003-05-30
!2.4.1 !2003-04-19
!2.4 !2003-04-11
!2.3.2 !2003-03-17
!2.3.1 !2003-03-14
!2.3 !2003-02-27
!2.2 !2002-12-11
!2.1 !2002-09-16
!2.0 !2002-08-09
!1.23 !2002-04-30
!1.22 !2002-04-12
!1.21 !2002-04-03
!1.2 !2002-03-18
!1.1 !2002-03-10
!1.0 !2002-02-25
!======
|======
Source code for releases since moving to gitlab is available at
link:https://gitlab.archlinux.org/pacman/pacman/-/releases[].
Source code for historical releases is available at
link:https://sources.archlinux.org/other/pacman/[]. To install, download the newest
available source tarball, unpack it in a directory, and run the three magic
commands:
$ meson build
$ ninja -C build
# ninja -C build install
You may wish to read the options presented by `meson` in order to
set appropriate paths and build options that are correct for your system.
Development
-----------
Mailing List
~~~~~~~~~~~~
There is a mailing list devoted to pacman development, hosted by Arch Linux.
link:https://lists.archlinux.org/listinfo/pacman-dev/[Subscribe] or
link:https://lists.archlinux.org/pipermail/pacman-dev/[view the archives].
Source Code
~~~~~~~~~~~
Development of pacman is currently done in Git. The central repository is
hosted by Arch Linux, although some of the developers have their own trees (ask
on the above mailing lists if you are interested in finding the locations of
these trees).
The current development tree can be fetched with the following command:
git clone https://gitlab.archlinux.org/pacman/pacman.git
which will fetch the full development history into a directory named pacman.
You can browse the source as well using
link:https://gitlab.archlinux.org/pacman/pacman/[gitlab].
If you are interested in hacking on pacman, it is highly recommended you join
the mailing list mentioned above, as well as take a quick glance at our
link:HACKING.html[HACKING] document.
link:submitting-patches.html[submitting-patches] is also a recommended read.
Not as familiar with code as you'd like to be, but still want to help out? If
you speak a foreign language, you can help by either creating or updating a
translation file for your native language. Instructions can be found in
link:translation-help.html[translation-help].
Bugs
----
If you find bugs (which is quite likely), please report them to the issue
tracker at link:https://gitlab.archlinux.org/pacman/pacman/-/issues[] with
specific information such as your command-line, the nature of the bug, and even
the package database if it helps.
Copyright
---------
pacman is Copyright (C) 2006-2025 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

@ -1,200 +0,0 @@
Pacman Home Page
================
A simple library-based package manager.
Introduction
------------
pacman is a utility which manages software packages in Linux. It uses simple
compressed files as a package format, and maintains a text-based package
database (more of a hierarchy), just in case some hand tweaking is necessary.
pacman does not strive to "do everything." It will add, remove and upgrade
packages in the system, and it will allow you to query the package database for
installed packages, files and owners. It also attempts to handle dependencies
automatically and can download packages from a remote server.
History
~~~~~~~
Version 2.0 of pacman introduced the ability to sync packages (the `--sync`
option) with a master server through the use of package databases. Prior to
this, packages would have to be installed manually using the `--add` and
`--upgrade` operations.
Version 3.0 was the switch to a two-part pacman- a backend named libalpm
(library for Arch Linux Package Management), and the familiar pacman frontend.
Speed in many cases was improved, along with dependency and conflict resolution
being able to handle a much wider variety of cases. The switch to a
library-based program should also make it easier in the future to develop
alternative front ends.
Documentation
-------------
Manpages
~~~~~~~~
There are several manpages available for the programs, utilities, and
configuration files dealing with pacman.
* linkman:PKGBUILD[5]
* linkman:libalpm[3]
* linkman:makepkg[8]
* linkman:makepkg.conf[5]
* linkman:pacman[8]
* linkman:pacman.conf[5]
* linkman:repo-add[8]
Changelog
~~~~~~~~~
For a good idea of what is going on in pacman development, take a look at the
link:http://projects.archlinux.org/?p=pacman.git[Gitweb] summary
page for the project.
See the most recent
link:http://projects.archlinux.org/?p=pacman.git;a=blob_plain;f=NEWS;hb=HEAD[NEWS]
file for a not-as-frequently-updated list of changes. However, this should
contain the biggest changes in a format more concise than the commit log.
Releases
--------
`------------`-------
Date Version
---------------------
2010-06-16 v3.4.0
2009-11-10 v3.3.3
2009-10-05 v3.3.2
2009-09-22 v3.3.1
2009-08-02 v3.3.0
2009-01-05 v3.2.2
2008-08-26 v3.2.1
2008-07-30 v3.2.0
2008-04-01 v3.1.4
2008-03-06 v3.1.3
2008-02-20 v3.1.2
2008-01-20 v3.1.1
2008-01-09 v3.1.0
2007-09-16 v3.0.6
2007-06-17 v3.0.5
2007-05-08 v3.0.4
2007-04-28 v3.0.3
2007-04-23 v3.0.2
2007-04-04 v3.0.1
2007-03-25 v3.0.0
2006-02-02 v2.9.8
2005-09-16 v2.9.7
2005-06-10 v2.9.6
2005-01-11 v2.9.5
2004-12-19 v2.9.4
2004-12-18 v2.9.3
2004-09-25 v2.9.2
2004-09-24 v2.9.1
2004-09-18 v2.9
---------------------
Source code for all releases is available at
link:ftp://ftp.archlinux.org/other/pacman/[]. To install, download the newest
available source tarball, unpack it in a directory, and run the three magic
commands:
$ ./configure
$ make
# make install
You may wish to read the options presented by `./configure --help` in order to
set appropriate paths and build options that are correct for your system.
Development
-----------
Mailing List
~~~~~~~~~~~~
There is a mailing list devoted to pacman development, hosted by Arch Linux.
link:http://www.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
link:http://www.archlinux.org/pipermail/pacman-dev/[view the archives].
Source Code
~~~~~~~~~~~
Development of pacman is currently done in GIT. The central repository is
hosted by Arch Linux, although some of the developers have their own trees (ask
on the above mailing lists if you are interested in finding the locations of
these trees).
The current development tree can be fetched with the following command:
git clone git://projects.archlinux.org/pacman.git pacman
which will fetch the full development history into a directory named pacman.
You can browse the source as well using
link:http://projects.archlinux.org/?p=pacman.git[Gitweb].
If you are interested in hacking on pacman, it is highly recommended you join
the mailing list mentioned above, as well as take a quick glance at our
link:HACKING.html[HACKING] document.
link:submitting-patches.html[submitting-patches] is also a recommended read.
Not as familiar with code as you'd like to be, but still want to help out? If
you speak a foreign language, you can help by either creating or updating a
translation file for your native language. Instructions can be found in
link:translation-help.html[translation-help].
Other Utilities
~~~~~~~~~~~~~~~
Although the package manager itself is quite simple, many scripts have been
developed that help automate building and installing packages. These are used
extensively in link:http://archlinux.org[Arch Linux]. Most of these utilities
are available in the Arch Linux projects
link:http://projects.archlinux.org/[Gitweb browser].
Utilities available:
* link:http://projects.archlinux.org/?p=abs.git[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
* link:http://projects.archlinux.org/?p=devtools.git[devtools] - tools to assist in packaging and dependency checking
* link:http://projects.archlinux.org/?p=namcap.git[namcap] - a package analysis utility written in python
* link:http://projects.archlinux.org/?p=pacbuild.git[pacbuild] - a package building system utilizing a daemon
* link:http://projects.archlinux.org/?p=srcpac.git[srcpac] - a bash build-from-source pacman wrapper
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
such as your commandline, the nature of the bug, and even the package database
if it helps.
You can also post a bug to the Archlinux bug tracker
link:http://bugs.archlinux.org/index.php?project=3[Flyspray]. Be sure to file
bugs under the Pacman project.
Pacman/libalpm in the Wild
--------------------------
Although Arch Linux is the primary user of pacman and libalpm, other
distributions and projects also use pacman as a package management tool. In
addition, there have been several projects started to provide a frontend GUI to
pacman and/or libalpm.
Arch derivatives:
* link:http://archie.dotsrc.org/[Archie] - Arch Live on steroids
* link:http://www.faunos.com/[FaunOS] - A portable, fully integrated operating system based on Arch Linux
* link:http://larch.berlios.de/[larch] - A live CD/DVD/USB-stick construction kit for Arch Linux
Other distributions:
* link:http://www.delilinux.org/[DeLi Linux] - "Desktop Light" Linux, a Linux distribution for old computers
* link:http://www.frugalware.org/[Frugalware Linux] - A general purpose Linux distribution for intermediate users (pacman is forked and maintained separately)
Pacman/libalpm frontends:
* link:http://shaman.iskrembilen.com/[Shaman] - A GUI frontend using Qt and libalpm
Copyright
---------
pacman is Copyright (C) 2006-2010 Pacman Development Team
<pacman-dev@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.
/////
vim: set ts=2 sw=2 syntax=asciidoc et:
/////

View file

@ -1,39 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
libalpm(3)
==========
Name
----
libalpm - Arch Linux Package Management (ALPM) library
Synopsis
--------
For ease of access, the libalpm manual has been split up into several sections.
*TODO:* Yes, this man page needs a lot of work. Once we get around to doing
good Doxygen documentation, it will improve. We promise.
*alpm_databases*:: Database Functions
*alpm_interface*:: Interface Functions
*alpm_list*:: List Functions
*alpm_log*:: Logging Functions
*alpm_misc*:: Miscellaneous Functions
*alpm_packages*:: Package Functions
*alpm_sync*:: Sync Functions
*alpm_trans*:: Transaction Functions
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring libalpm using the
'pacman.conf' file.
See Also
--------
linkman:pacman[8], linkman:makepkg[8], linkman:pacman.conf[5]
include::footer.txt[]

View file

@ -0,0 +1,118 @@
makepkg-template(1)
===================
Name
----
makepkg-template - package build templating utility
Synopsis
--------
'makepkg-template' [options]
Description
-----------
'makepkg-template' is a script to ease the work of maintaining multiple similar
PKGBUILDs. It allows you to move most of the code from the PKGBUILD into a
template file and uses markers to allow in-place updating of existing PKGBUILDs
if the template has been changed.
Template files can contain any code allowed in a PKGBUILD. You can think of
them like external files included with "." or "source", but they will be
inlined into the PKGBUILD by 'makepkg-template' so you do not depend on the
template file when building the package.
Markers are bash comments in the form of:
# template start; key=value; key2=value2; ...
and
# template end;
Currently used keys are: name (mandatory) and version. Template names are limited to
alphanumerics, "@", "+", ".", "-", and "_". Versions are limited to numbers and ".".
For initial creation there is a one line short cut which does not need an end marker:
# template input; key=value;
Using this short-cut will result in 'makepkg-template' replacing it with start
and end markers and the template code on the first run.
Template files should be stored in one directory and filenames should be
"$template_name-$version.template" with a symlink "$template_name.template"
pointing to the most recent template. If the version is not set in the marker,
'makepkg-template' will automatically use the target of "$template_name.template",
otherwise the specified version will be used. This allows for easier
verification of untrusted PKGBUILDs if the template is trusted. You verify the
non-template code and then use a command similar to this:
diff -u <(makepkg-template -o -) PKGBUILD
Template files may also contain markers leading to nested templates in the
resulting PKGBUILD. If you use markers in a template, please set the version
you used/tested with in the start/input marker so other people can properly
recreate from templates.
Options
-------
*-p, \--input* <build script>::
Read the package script `build script` instead of the default.
*-o, \--output* <build script>::
Write the updated file to `build script` instead of overwriting the input file.
*-n, \--newest*::
Always use the newest available template file.
*\--template-dir* <dir>::
Change the dir where we are looking for template files. This option may be
given multiple times in which case files found in directory given last will
take precedence.
Example PKGBUILD
----------------
pkgname=perl-config-simple
pkgver=4.58
pkgrel=1
pkgdesc="simple configuration file class"
arch=('any')
license=('PerlArtistic' 'GPL')
depends=('perl')
source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
sha256sums=('dd9995706f0f9384a15ccffe116c3b6e22f42ba2e58d8f24ed03c4a0e386edb4')
_distname="Config-Simple"
# template start; name=perl-module; version=1.0;
_distdir="${_distname}-${pkgver}"
url="https://metacpan.org/release/${_distname}"
options+=('!emptydirs')
build() {
cd "$srcdir/$_distdir"
perl Makefile.PL INSTALLDIRS=vendor
make
}
check() {
cd "$srcdir/$_distdir"
make test
}
package() {
cd "$srcdir/$_distdir"
make DESTDIR="$pkgdir" install
}
# template end;
See Also
--------
linkman:makepkg[8], linkman:PKGBUILD[5]
include::footer.asciidoc[]

382
doc/makepkg.8.asciidoc Normal file
View file

@ -0,0 +1,382 @@
makepkg(8)
==========
Name
----
makepkg - package build utility
Synopsis
--------
'makepkg' [options] [ENVVAR=value] [ENVVAR+=value] ...
Description
-----------
'makepkg' is a script to automate the building of packages. The requirements for
using the script are a build-capable *nix platform and a custom build script
for each package you wish to build (known as a PKGBUILD). See
linkman:PKGBUILD[5] for details on creating your own build scripts.
The advantage to a script-based build is that the work is only done once. Once
you have the build script for a package, 'makepkg' will do the rest: download and
validate source files, check dependencies, configure the build-time settings,
build the package, install the package into a temporary root, make
customizations, generate meta-info, and package the whole thing up for pacman
to use.
NOTE: 'makepkg' uses your current locale by default and does not unset it when
building packages. If you wish to share your build output with others when
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
your logs and output are not localized.
Options
-------
*-A, \--ignorearch*::
Ignore a missing or incomplete arch field in the build script. This is
for rebuilding packages from source when the PKGBUILD may be slightly
outdated and not updated with an `arch=('yourarch')` field.
*-c, \--clean*::
Clean up leftover work files and directories after a successful build.
*\--config* <file>::
Use an alternate configuration file instead of the +{sysconfdir}/makepkg.conf+
default.
*-d, \--nodeps*::
Do not perform any dependency checks. This will let you override and
ignore any dependencies required. There is a good chance this option
will break the build process if all of the dependencies are not
installed.
*-e, \--noextract*::
Do not extract source files or run the prepare() function (if present);
use whatever source already exists in the $srcdir/ directory. This is
handy if you want to go into $srcdir/ and manually patch or tweak code,
then make a package out of the result. Keep in mind that creating a
patch may be a better solution to allow others to use your PKGBUILD.
*\--verifysource*::
For each source file in the source array of PKGBUILD, download the file
if required and perform the integrity checks. No extraction or build is
performed. Dependencies specified in the PKGBUILD will not be handled
unless `--syncdeps` is used. Useful for performing subsequent offline
builds.
*-f, \--force*::
makepkg will not build a package if a built package already exists in
the `PKGDEST` (set in linkman:makepkg.conf[5]) directory, which may
default to the current directory. This allows the built package to be
overwritten.
*-g, \--geninteg*::
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.
This output can be redirected into your PKGBUILD for source validation
using "`makepkg -g >> PKGBUILD`".
*--skipinteg*::
Do not perform any integrity checks (checksum and PGP) on source files.
*\--skipchecksums*::
Do not verify checksums of source files.
*\--skippgpcheck*::
Do not verify PGP signatures of source files.
*-h, \--help*::
Output syntax and command line options.
*--holdver*::
When using VCS sources (linkman:PKGBUILD[5]) any currently checked out source
will not be updated to the latest revision.
*-i, \--install*::
Install or upgrade the package after a successful build using
linkman:pacman[8].
*-L, \--log*::
Enable logging. This will use the *tee* program to send the output of each
of the PKGBUILD functions to both the console and to a text file in the
build directory named `pkgbase-pkgver-pkgrel-arch-<function>.log`.
As mentioned above, the logs will be localized so you may want to set your
locale accordingly if sharing the log output with others.
*-m, \--nocolor*::
Disable color in output messages.
*-o, \--nobuild*::
Download and extract files, run the prepare() function, but do not build
them. Useful with the '\--noextract' option if you wish to tweak the files
in $srcdir/ before building.
*-p* <buildscript>::
Read the package script `buildscript` instead of the `PKGBUILD` default;
see linkman:PKGBUILD[5]. The `buildscript` must be located in the directory
makepkg is called from.
*-r, \--rmdeps*::
Upon successful build, remove any dependencies installed by makepkg
during dependency auto-resolution and installation when using `-s`.
*-R, \--repackage*::
Repackage contents of the package without rebuilding the package. This
is useful if you forgot, for example, a dependency or install file in your
PKGBUILD and the build itself will not change.
*-s, \--syncdeps*::
Install missing dependencies using pacman. When build-time or run-time
dependencies are not found, pacman will try to resolve them. If
successful, the missing packages will be downloaded and installed.
*-S, \--source*::
Do not actually build the package, but build a source-only tarball that
does not include sources that can be fetched via a download URL. This is
useful for passing a single tarball to another program such as a chroot,
remote builder, or a tarball upload. Because integrity checks are verified,
all source files of the package need to be present or downloadable.
*-V, \--version*::
Display version information.
*-C, \--cleanbuild*::
Clean build artifacts from previous runs of makepkg in the current
directory by removing $srcdir before building the package.
*-D* <dir>, *\--dir* <dir> ::
Change to directory <dir> before reading the PKGBUILD or doing anything else.
*\--allsource*::
Do not actually build the package, but build a source-only tarball that
includes all sources, including those that are normally downloaded via
makepkg. This is useful for passing a single tarball to another program
such as a chroot or remote builder. It will also satisfy requirements of
the GPL when distributing binary packages.
*\--check*::
Run the check() function in the PKGBUILD, overriding the setting in
linkman:makepkg.conf[5].
*\--noarchive*::
Do not create the archive at the end of the build process. This can be
useful to test the package() function or if your target distribution does
not use pacman.
*\--nocheck*::
Do not run the check() function in the PKGBUILD or handle the checkdepends.
*\--noprepare*::
Do not run the prepare() function in the PKGBUILD.
*\--noverify*::
Do not run the verify() function in the PKGBUILD.
*\--sign*::
Sign the resulting package with gpg, overriding the setting in
linkman:makepkg.conf[5].
*\--nosign*::
Do not create a signature for the built package.
*\--key* <key>::
Specify a key to use when signing packages, overriding the GPGKEY setting
in linkman:makepkg.conf[5]. If not specified in either location, the
default key from the keyring will be used.
*\--noconfirm*::
(Passed to pacman) Prevent pacman from waiting for user input before
proceeding with operations.
*\--needed*::
(Passed to pacman) Tell pacman not to reinstall a target if it is already
up-to-date. (used with '-i' / '\--install').
*\--asdeps*::
(Passed to pacman) Install packages as non-explicitly installed (used
with '-i' / '\--install').
*\--noprogressbar*::
(Passed to pacman) Prevent pacman from displaying a progress bar;
useful if you are redirecting makepkg output to file.
*\--packagelist*::
List the package filenames that would be produced without building. Listed
package filenames include PKGDEST and PKGEXT.
*\--printsrcinfo*::
Generate and print the SRCINFO file to stdout.
Additional Features
-------------------
makepkg supports building development versions of packages without having to
manually update the pkgver in the PKGBUILD. This was formerly done using the
separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
set up a development PKGBUILD.
Reproducibility
---------------
makepkg is designed to be compatible with
link:https://reproducible-builds.org/docs/[Reproducible Builds]. If the
**SOURCE_DATE_EPOCH** environment variable is set, it will be exported to
subprocesses, and source and package file modification times and package
metadata will be unified based on the timestamp specified.
If the **SOURCE_DATE_EPOCH** environment variable is not set, makepkg will use
its own start date for internal use, but will not unify source file timestamps
before building.
Environment Variables
---------------------
**MAKEPKG_LIBRARY**="/path/to/directory"::
Use an alternative libmakepkg path instead of the {libmakepkgdir} default.
**PACMAN**::
The command that will be used to check for missing dependencies and to
install and remove packages. Pacman's '-Qq', '-Rns', '-S', '-T', and '-U'
operations must be supported by this command. If the variable is not
set or empty, makepkg will fall back to `pacman'.
**MAKEPKG_CONF=**"/path/to/file"::
Use an alternate config file instead of the +{sysconfdir}/makepkg.conf+
default.
**MAKEPKG_GIT_CONFIG=**"/path/to/file"::
Use an alternate config file for Git instead of the
+{sysconfdir}/makepkg.d/gitconfig+ default. makepkg always prevents Git
from loading any other config files.
**PKGDEST=**"/path/to/directory"::
Directory where the resulting packages will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**SRCDEST=**"/path/to/directory"::
Directory where the downloaded sources will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**SRCPKGDEST=**"/path/to/directory"::
Directory where source package files will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**LOGDEST=**"/path/to/directory"::
Directory where generated log files will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**PACKAGER=**"John Doe <john@doe.com>"::
String to identify the creator of the resulting package. Overrides
the corresponding value defined in linkman:makepkg.conf[5].
**BUILDDIR=**"/path/to/directory"::
Directory where the package will be built. Overrides the corresponding
value defined in linkman:makepkg.conf[5].
**CARCH=**"(i686|x86_64)"::
Force build for a specific architecture. Useful for cross-compiling.
Overrides the corresponding value defined in linkman:makepkg.conf[5].
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
Sets the compression used when making compiled or source packages.
Overrides the corresponding value defined in linkman:makepkg.conf[5].
**GNUPGHOME=**"/path/to/directory"::
Directory where the gpg keyring for signing the built package is stored.
**GPGKEY=**"keyid"::
Specify a key to use when signing packages, overriding the GPGKEY setting
in linkman:makepkg.conf[5].
**SOURCE_DATE_EPOCH=**"<date>"::
Used for link:https://reproducible-builds.org/docs/[Reproducible Builds].
**BUILDTOOL=**"<name>"::
The name of a tool ecosystem used to set up the build environment. Used for
defining a spec for reproducible builds, e.g. the linkman:makepkg.conf[5]
used.
**BUILDTOOLVER=**"<version>"::
The version of the '$BUILDTOOL' used.
**MAKEPKG_LINT_PKGBUILD=**0::
Setting to 0 disables PKGBUILD linting within makepkg. Useful on systems
with slow bash subshell operations, or on PKGBUILDs with extreme amounts of
package splitting.
Configuration
-------------
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
'makepkg.conf' file.
Errors
------
On exit, makepkg will return one of the following error codes.
0::
Normal exit condition.
1::
Unknown cause of failure.
2::
Error in configuration file.
3::
User specified an invalid option.
4::
Error in user-supplied function in PKGBUILD.
5::
Failed to create a viable package.
6::
A source or auxiliary file specified in the PKGBUILD is
missing.
7::
The PKGDIR is missing.
8::
Failed to install dependencies.
9::
Failed to remove dependencies.
10::
User attempted to run makepkg as root.
11::
User lacks permissions to build or install to a given
location.
12::
Error parsing PKGBUILD.
13::
A package has already been built.
14::
The package failed to install.
15::
Programs necessary to run makepkg are missing.
16::
Specified GPG key does not exist or failed to sign package.
17::
The local repository is not a clone of the source repository
specified in PKGBUILD.
See Also
--------
linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8]
include::footer.asciidoc[]

View file

@ -1,200 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
makepkg(8)
==========
Name
----
makepkg - package build utility
Synopsis
--------
makepkg [options]
Description
-----------
makepkg is a script to automate the building of packages. The requirements for
using the script are a build-capable \*nix platform and a custom build script
for each package you wish to build (known as a PKGBUILD). See
linkman:PKGBUILD[5] for details on creating your own build scripts.
The advantage to a script-based build is that the work is only done once. Once
you have the build script for a package, makepkg will do the rest: download and
validate source files, check dependencies, configure the build-time settings,
build the package, install the package into a temporary root, make
customizations, generate meta-info, and package the whole thing up for pacman
to use.
NOTE: makepkg uses your current locale by default and does not unset it when
building packages. If you wish to share your build output with others when
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
your logs and output are not localized.
Options
-------
*\--asroot*::
Allow makepkg to run as root. This is for security purposes as it is
normally dangerous to do so. This will also disable use of fakeroot and
sudo.
*-A, \--ignorearch*::
Ignore a missing or incomplete arch field in the build script. This is
for rebuilding packages from source when the PKGBUILD may be slightly
outdated and not updated with an `arch=('yourarch')` field.
*-c, \--clean*::
Clean up leftover work files and directories after a successful build.
*-C, \--cleancache*::
Removes all cached source files from the directory specified in `SRCDEST`
in linkman:makepkg.conf[5].
*--config* <`/path/to/config`>::
Use an alternate config file instead of the `/etc/makepkg.conf` default;
*-d, \--nodeps*::
Do not perform any dependency checks. This will let you override and
ignore any dependencies required. There is a good chance this option
will break the build process if all of the dependencies are not
installed.
*-e, \--noextract*::
Do not extract source files; use whatever source already exists in the
src/ directory. This is handy if you want to go into src/ and manually
patch or tweak code, then make a package out of the result. Keep in mind
that creating a patch may be a better solution to allow others to use
your PKGBUILD.
*-f, \--force*::
makepkg will not build a package if a built package already exists in
the `PKGDEST` (set in linkman:makepkg.conf[5]) directory, which may
default to the current directory. This allows the built package to be
overwritten.
*--forcever*::
This is a hidden option that should *not* be used unless you really know
what you are doing. makepkg uses this internally when calling itself to
set the new development pkgver of the package.
*-g, \--geninteg*::
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
This output can be redirected into your PKGBUILD for source validation
using "`makepkg -g >> PKGBUILD`".
*--skipinteg*::
Do not perform any integrity checks, just print a warning instead.
*-h, \--help*::
Output syntax and command line options.
*\--holdver*::
Useful when building development versions of packages. Prevents makepkg
from automatically bumping the pkgver to the latest revision number in
the package's development tree.
*-i, \--install*::
Install or upgrade the package after a successful build using
linkman:pacman[8].
*-L, \--log*::
Enable makepkg build logging. This will use the *tee* program to send
output of the `build()` function to both the console and to a text file in
the build directory named `pkgname-pkgver-pkgrel-arch.log`. As mentioned
above, the build log will be localized so you may want to set your locale
accordingly if sharing the log output with others.
*-m, \--nocolor*::
Disable color in output messages.
*-o, \--nobuild*::
Download and extract files only, but do not build them. Useful with the
`\--noextract` option if you wish to tweak the files in src/ before
building.
*-p* <`buildscript`>::
Read the package script `buildscript` instead of the `PKGBUILD` default;
see linkman:PKGBUILD[5].
*-r, \--rmdeps*::
Upon successful build, remove any dependencies installed by makepkg
during dependency auto-resolution and installation when using `-s`.
*-R, \--repackage*::
Repackage contents of the package without rebuilding the package. This
is useful if you forgot a depend or install file in your PKGBUILD and
the build itself will not change.
*-s, \--syncdeps*::
Install missing dependencies using pacman. When build-time or run-time
dependencies are not found, pacman will try to resolve them. If
successful, the missing packages will be downloaded and installed.
*\--allsource*::
Do not actually build the package, but build a source-only tarball that
includes all sources, including those that are normally download via
makepkg. This is useful for passing a single tarball to another program
such as a chroot or remote builder. It will also satisfy requirements of
the GPL when distributing binary packages.
*\--source*::
Do not actually build the package, but build a source-only tarball that
does not include sources that can be fetched via a download URL. This is
useful for passing a single tarball to another program such as a chroot,
remote builder, or a tarball upload. Because integrity checks are verified,
all source files of the package need to be present or downloadable.
*\--pkg <`list`>*::
Only build listed packages from a split package. The use of quotes is
necessary when specifying multiple packages. e.g. `--pkg "pkg1 pkg3"`
*\--noconfirm*::
(Passed to pacman) Prevent pacman from waiting for user input before
proceeding with operations.
*\--noprogressbar*::
(Passed to pacman) Prevent pacman from displaying a progress bar;
useful if you are redirecting makepkg output to file.
Additional Features
-------------------
makepkg supports building development versions of packages without having to
manually update the pkgver in the PKGBUILD. This was formerly done using the
separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
set up a development PKGBUILD.
Environment Variables
---------------------
*PACMAN*::
The command that will be used to check for missing dependencies and to
install and remove packages. Pacman's -Qq, -Rns, -S, -T, and -U
operations must be supported by this command. If the variable is not
set or empty, makepkg will fall back to `pacman'.
**PKGDEST=**"/path/to/folder"::
Folder where the resulting packages will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**SRCDEST=**"/path/to/folder"::
Folder where the downloaded sources will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
Configuration
-------------
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
'makepkg.conf' file.
See Also
--------
linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8]
include::footer.txt[]

312
doc/makepkg.conf.5.asciidoc Normal file
View file

@ -0,0 +1,312 @@
makepkg.conf(5)
===============
Name
----
makepkg.conf - makepkg configuration file
Synopsis
--------
{sysconfdir}/makepkg.conf, $XDG_CONFIG_HOME/pacman/makepkg.conf, ~/.makepkg.conf
Description
-----------
Configuration options for makepkg are stored in makepkg.conf. This file is
sourced so you can include any special compiler flags you wish to use. This is
helpful when building for different architectures or with different
optimizations. However, only the variables described below are exported to the
build environment.
NOTE: This does not guarantee that all package Makefiles will use your exported
variables. Some of them are non-standard.
The system-wide configuration file is found in {sysconfdir}/makepkg.conf.
Specific additions (e.g. build flags for additional languages) can be placed
in {sysconfdir}/makepkg.conf.d/*.conf.
Individual options can be overridden (or added to) on a per-user basis in
$XDG_CONFIG_HOME/pacman/makepkg.conf or ~/.makepkg.conf, with the former
taking priority.
The default file is fairly well commented, so it may be easiest to simply
follow directions given there for customization.
Options
-------
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
Sets the download agents used to fetch source files specified with a URL in
the linkman:PKGBUILD[5] file. Options can be specified for each command as
well, and any protocol can have a download agent. Any spaces in option
arguments are required to be escaped to avoid being split. Several
examples are provided in the default makepkg.conf.
+
If present, `%u` will be replaced with the download URL. Otherwise, the
download URL will be placed on the end of the command. If present, `%o` will
be replaced with the local file name, plus a ``.part'' extension, which allows
makepkg to handle resuming file downloads.
**VCSCLIENTS=(**\'protocol::package' ...**)**::
Sets the packages required to fetch version controlled source files. When
required, makepkg will check that these packages are installed or are included
in the `depends` or `makedepends` arrays in the PKGBUILD.
**CARCH=**"carch"::
Specifies your computer architecture; possible values include such things
as ``i686'', ``x86_64'', ``ppc'', etc. This should be automatically set on
installation.
**CHOST=**"chost"::
A string such as ``i686-pc-linux-gnu''; do not touch this unless you know what
you are doing. This can be commented out by most users if desired.
**NPROC=**""::
Sets the number of processors to use for parallel jobs in makepkg.
Note: this does not affect parallelization of tasks during ``build()`` and
related functions.
**CPPFLAGS=**"cppflags"::
Flags used for the C preprocessor; see CFLAGS for more information.
**CFLAGS=**"cflags"::
Flags used for the C compiler. This is a key part to the use of makepkg.
Usually several options are specified, and the most common string resembles
something like this: ``-march=i686 -O2 -pipe''. Another useful option may
be `-mcpu` in place of `-march`. Read gcc(1) for more details on the wide
variety of compiler flags available.
**CXXFLAGS=**"cxxflags"::
Flags used for the C++ compiler; see CFLAGS for more info.
**LDFLAGS=**"ldflags"::
Flags used for the linker. Several options may be specified with common
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.
**DEBUG_CFLAGS=**"debug_cflags"::
Additional compiler flags appended to `CFLAGS` for use in debugging. Usually
this would include: ``-g''. Read gcc(1) for more details on the wide
variety of compiler flags available.
**DEBUG_CXXFLAGS=**"debug_cxxflags"::
Debug flags used for the C++ compiler; see DEBUG_CFLAGS for more info.
**BUILDENV=(**!distcc !color !ccache check !sign**)**::
This array contains options that affect the build environment; the defaults
are shown here. All options should always be left in the array; to enable
or disable an option, simply remove or add an ``!'' at the front of the
option. If an option is specified multiple times, the final value takes
precedence. Each option works as follows:
*distcc*;;
Use the distributed C/C++/ObjC compiler to spread compilation among
multiple machines. If this is enabled, `DISTCC_HOSTS` must be specified
as well.
*color*;;
Colorize output messages, making output easier to read.
*ccache*;;
Use ccache to cache compilation by default. This allows for faster
compiles if you are continuously recompiling the same packages. It can
be disabled for individual packages by placing `!ccache` in the
PKGBUILD options array.
*check*;;
Run the check() function if present in the PKGBUILD. This can be
enabled or disabled for individual packages through the use of
makepkg's '\--check' and '\--nocheck' options, respectively.
*sign*;;
Generate a PGP signature file using GnuPG. This will execute 'gpg
\--detach-sign' on the built package to generate a detached
signature file, using the GPG agent, if it is available. The signature
file will be the entire file name of the package with a ``.sig''
extension.
**DISTCC_HOSTS=**"host1 ..."::
If using DistCC, this is used to specify a space-delimited list of hosts
running in the DistCC cluster. In addition, you will want to modify your
`MAKEFLAGS`.
**BUILDDIR=**"/path/to/directory"::
If this value is not set, packages will, by default, be built in
subdirectories of the directory that makepkg is called from. This
option allows setting the build location to another directory.
Incorrect use of `$startdir` in a PKGBUILD may cause building with
this option to fail.
**GPGKEY=**""::
Specify a key to use for GPG signing instead of the default key in the
keyring. Can be overridden with makepkg's '\--key' option.
**OPTIONS=(**!strip docs libtool staticlibs emptydirs ...**)**::
This array contains options that affect default packaging. They are
equivalent to options that can be placed in the PKGBUILD; the defaults are
shown here. All options should always be left in the array; to enable or
disable an option, simply remove or add an ``!'' at the front of the
option. If an option is specified multiple times, the final value takes
precedence. Each option works as follows:
*strip*;;
Strip symbols from binaries and libraries. If you frequently use a
debugger on programs or libraries, it may be helpful to disable this
option.
*docs*;;
Save doc directories. If you wish to delete doc directories, specify
`!docs` in the array. The directories affected are specified by the
`DOC_DIRS` variable.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to remove
them.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
remove them, if they have a shared counterpart.
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress manual (man and info) pages with gzip. The directories
affected are specified by the `MAN_DIRS` variable.
*purge*;;
Remove files specified by the `PURGE_TARGETS` variable from the
package.
*debug*;;
Add the user-specified debug flags as specified in DEBUG_CFLAGS and
DEBUG_CXXFLAGS to their counterpart buildflags. Creates a separate
package containing the debug symbols when used with `strip'.
*lto*;;
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
affects both generation and checking. The current valid options are:
`ck`, `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, and `b2`.
**STRIP_BINARIES=**"--strip-all"::
Options to be used when stripping binaries. See linkman:strip[1]
for details.
**STRIP_SHARED=**"--strip-unneeded"::
Options to be used when stripping shared libraries or PIE executables.
See linkman:strip[1] for details.
**STRIP_STATIC=**"--strip-debug"::
Options to be used when stripping static libraries. See linkman:strip[1]
for details.
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
If `zipman` is specified in the `OPTIONS` array, this variable will
instruct makepkg where to look to compress manual (man and info)
pages. If you build packages 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.
**DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**::
If `!docs` is specified in the `OPTIONS` array, this variable will
instruct makepkg where to look to remove docs. If you build packages
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
useful for index files that are added by multiple packages.
**DBGSRCDIR=**"/usr/src/debug"::
If `strip` and `debug` are specified in the `OPTIONS` array, this variable
will instruct makepkg where to place source files for installed binaries.
The binaries will be modified to link this directory for the debugger
search path.
**PKGDEST=**"/path/to/directory"::
If this value is not set, packages will, by default, be placed in the
current directory (location of the linkman:PKGBUILD[5]). Many people
like to keep all their packages in one place so this option allows
for this behavior. A common location is ``/home/packages''.
**SRCDEST=**"/path/to/directory"::
If this value is not set, downloaded source files will only be stored
in the current directory. Many people like to keep all source files in
a central location for easy cleanup, so this path can be set here.
**SRCPKGDEST=**"/path/to/directory"::
If this value is not set, source package files will be stored in
in the current directory. Many people like to keep all source package files
in a central location for easy cleanup, so this path can be set here.
**LOGDEST=**"/path/to/directory"::
If this value is not set, log files are written to the current
directory. This centralizes the log location, facilitating cleanup
and compression.
**PACKAGER=**"John Doe <john@example.com>"::
This value is used when querying a package to see who was the builder.
The given format is required for PGP key lookup through WKD.
It is recommended to change this to your name and email address.
**COMPRESSGZ=**"(gzip -c -f -n)"::
**COMPRESSBZ2=**"(bzip2 -c -f)"::
**COMPRESSXZ=**"(xz -c -z -)"::
**COMPRESSZST=**"(zstd -c -z -)"::
**COMPRESSLZO**"(lzop -q)"::
**COMPRESSLRZ=**"(lrzip -q)"::
**COMPRESSLZ4=**"(lz4 -q)"::
**COMPRESSZ=**"(compress -c -f)"::
**COMPRESSLZ=**"(lzip -c -f)"::
Sets the command and options used when compressing compiled or source
packages in the named format.
**PKGEXT=**"{pkgext}", **SRCEXT=**"{srcext}"::
Sets the compression used when making compiled or source packages.
Valid suffixes are `.pkg` or `.src` (for PKGEXT and SRCEXT respectively)
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
check for the presence of sudo(8) and su(1) in turn, and try the first one
it finds.
+
If present, `%c` will be replaced with the shell-quoted form of the command
to run. Otherwise, the command to run is appended to the auth command.
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
include::footer.asciidoc[]

View file

@ -1,203 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
makepkg.conf(5)
===============
Name
----
makepkg.conf - makepkg configuration file
Synopsis
--------
{sysconfdir}/makepkg.conf, ~/.makepkg.conf
Description
-----------
Configuration options for makekpg are stored in makepkg.conf. This file is
sourced, so you can include any special compiler flags you wish to use. This is
helpful for building for different architectures, or with different
optimizations. However, only the variables described below are exported to the
build environment.
NOTE: This does not guarantee that all package Makefiles will use your exported
variables. Some of them are non-standard.
The default file is fairly well commented, so it may be easiest to simply
follow directions given there for customization.
Options
-------
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
Sets the download agents used to fetch source files specified with a URL in
the linkman:PKGBUILD[5] file. Options can be specified for each command as
well, and any protocol can have a download agent. Several examples are provided
in the default makepkg.conf.
+
If present, `%u` will be replaced with the download URL. Otherwise, the
download URL will be placed on the end of the command. If present, `%o` will
be replaced with the local filename, plus a ``.part'' extension, which allows
makepkg to handle resuming file downloads.
**CARCH=**"carch"::
Specifies your computer architecture; possible values include such things
as ``i686'', ``x86_64'', ``ppc'', etc. This should be automatically set on
installation.
**CHOST=**"chost"::
A string such as ``i686-pc-linux-gnu'', do not touch unless you know what
you are doing. This can be commented out by most users if desired.
**CFLAGS=**"cflags"::
Flags used for the C compiler. This is a key part to the use of makepkg.
Usually several options are specified, and the most common string resembles
something like this: ``-march=i686 -O2 -pipe''. Another useful option may
be `-mcpu` in place of `-march`. Read gcc(1) for more details on the wide
variety of compiler flags available.
**CXXFLAGS=**"cxxflags"::
Flags used for the C++ compiler; see CFLAGS for more info.
**LDFLAGS=**"ldflags"::
Flags used for the linker. Several options may be specified with common
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
available linker flags.
**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.
**BUILDENV=(**fakeroot !distcc color !ccache**)**::
This array contains options that affect the build environment, the defaults
are shown here. All options should always be left in the array; to enable
or disable an option simply remove or place an ``!'' at the front of the
option. Each works as follows:
*fakeroot*;;
Allow building packages as a non-root user. This is highly recommended.
*distcc*;;
Use the distributed C/C++/ObjC compiler to spread compilation among
multiple machines. If this is enabled, `DISTCC_HOSTS` must be specified
as well.
*color*;;
Colorize output messages, making output easier to read.
*ccache*;;
Use ccache to cache compilation by default. This allows for faster
compiles if you are continuously recompiling the same packages. It can
be disabled for individual packages by placing `!ccache` in the
PKGBUILD options array.
**DISTCC_HOSTS=**"host1 ..."::
If using DistCC, this is used to specify a space-delimited list of hosts
running in the DistCC cluster. In addition, you will want to modify your
`MAKEFLAGS`.
**OPTIONS=(**strip !docs libtool emptydirs zipman**)**::
This array contains options that affect the default packaging. They are
equivalent to options that can be placed in the PKGBUILD; the defaults are
shown here. All options should always be left in the array; to enable or
disable an option simply remove or place an ``!'' at the front of the
option. Each works as follows:
*strip*;;
Strip symbols from binaries and libraries. If you frequently use a
debugger on programs or libraries, it may be helpful to disable this
option.
*docs*;;
Save doc directories. If you wish to delete doc directories, specify
`!docs` in the array. The directories affected are specified by the
`DOC_DIRS` variable.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to remove
them.
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress manual (man and info) pages with gzip. The directories
affected are specified by the `MAN_DIRS` variable.
*purge*;;
Remove files specified by the `PURGE_TARGETS` variable from the
package.
**INTEGRITY_CHECK=(**check1 ...**)**::
File integrity checks to use. Multiple checks may be specified; this
affects both generation and checking. The current valid options are:
`md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
**STRIP_BINARIES=**"--strip-all"::
Options to be used when stripping binaries. See linkman:strip[1]
for details.
**STRIP_SHARED=**"--strip-unneeded"::
Options to be used when stripping shared libraries. See linkman:strip[1]
for details.
**STRIP_STATIC=**"--strip-debug"::
Options to be used when stripping static libraries. See linkman:strip[1]
for details.
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
If `zipman` is specified in the OPTIONS array, this variable will
instruct makepkg where to look to compress manual (man and info)
pages. If you build packages 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.
**DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**::
If `!docs` is specified in the OPTIONS array, this variable will
instruct makepkg where to look to remove docs. If you build packages
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.
**STRIP_DIRS=(**bin lib sbin usr/{bin,lib} ...**)**::
If `strip` is specified in the OPTIONS array, this variable will
instruct makepkg where to look to for files to strip. If you build
packages 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.
**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
useful for index files that are added by multiple packages.
**PKGDEST=**"/path/to/folder"::
If this value is not set, packages will by default be placed in the
current directory (location of the linkman:PKGBUILD[5]). Many people
like to keep all their packages in one place so this option allows
this behavior. A common location is ``/home/packages''.
**SRCDEST=**"/path/to/folder"::
If this value is not set, downloaded source files will only be stored
in the current directory. Many people like to keep all source files in
a central location for easy cleanup, so this path can be set here.
**SRCPKGDEST=**"/path/to/folder"::
If this value is not set, source package files will be stored in
PKGDEST. Many people like to keep all source package files in
a central location for easy cleanup, so this path can be set here.
**PACKAGER=**"John Doe <john@example.com>"::
This value is used when querying a package to see who was the builder.
It is recommended you change this to your name and email address.
*PKGEXT*, *SRCEXT*::
Do not touch these unless you know what you are doing.
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
include::footer.txt[]

157
doc/meson.build Normal file
View file

@ -0,0 +1,157 @@
manpages = [
{ 'name': 'alpm-hooks.5' },
{ 'name': 'pacman.8' },
{ 'name': 'makepkg.8' },
{ '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' },
{ 'name': 'BUILDINFO.5' },
{ 'name': 'pacman-conf.8' },
]
sitepages = [
{ 'name': 'submitting-patches' },
{ 'name': 'translation-help' },
{ 'name': 'HACKING', 'source': '../HACKING' },
{ 'name': 'index' },
]
asciidoc_conf = join_paths(meson.current_source_dir(), 'asciidoc.conf')
asciidoc_opts = [
'-f', asciidoc_conf,
'-a', 'pacman_version="@0@"'.format(PACKAGE_VERSION),
'-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),
'-a', 'rootdir=@0@'.format(ROOTDIR),
'-a', 'libmakepkgdir=@0@'.format(LIBMAKEPKGDIR),
]
html_targets = []
html_files = []
foreach page : manpages
manpage = page['name']
htmlpage = '@0@.html'.format(manpage)
input = '@0@.asciidoc'.format(manpage)
section = page['name'].split('.')[-1]
mandirn = join_paths(MANDIR, 'man' + section)
custom_target(
manpage,
command : [
A2X,
'--no-xmllint',
'-d', 'manpage',
'-f', 'manpage',
'--xsltproc-opts', '-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0',
'-D', '@OUTDIR@',
'--asciidoc-opts', ' '.join(asciidoc_opts),
'@INPUT@',
],
input : input,
output : [manpage],
depend_files : [
asciidoc_conf,
] + page.get('extra_depends', []),
install : true,
install_dir : mandirn,
)
endforeach
foreach page: manpages + sitepages
manpage = page['name']
htmlpage = '@0@.html'.format(manpage)
input = page.get('source', '@0@.asciidoc'.format(manpage))
html = custom_target(
htmlpage,
command : [
ASCIIDOC,
] + asciidoc_opts + [
'-a', 'linkcss',
'-a', 'toc',
'-a', 'icons',
'-a', 'max-width=960px',
'-a', 'stylesheet=asciidoc-override.css',
'-o', '@OUTPUT@',
'@INPUT@',
],
input : input,
output : [htmlpage],
depend_files : [
asciidoc_conf,
'asciidoc-override.css',
] + page.get('extra_depends', []),
build_by_default : false,
install : false,
)
html_targets += [html]
html_files += [htmlpage]
endforeach
run_target('html',
command : ['/bin/true'],
depends : html_targets)
custom_target(
'website.tar.gz',
command : [
'bsdtar', 'czf', '@OUTPUT@',
'-C', meson.current_build_dir(),
] + html_files + [
'-C', meson.current_source_dir(),
'asciidoc-override.css',
'-C', '/etc/asciidoc/stylesheets/',
'asciidoc.css',
'-C', '/etc/asciidoc/javascripts/',
'asciidoc.js',
'-C', '/etc/asciidoc/',
'images',
],
output : ['website.tar.gz'],
build_by_default : false,
depends : html_targets,
)
meson.add_install_script(MESON_MAKE_SYMLINK,
'repo-add.8',
join_paths(MANDIR, 'man8/repo-remove.8'))
meson.add_install_script(MESON_MAKE_SYMLINK,
'alpm-hooks.5',
join_paths(MANDIR, 'man5/pacman-hooks.5'))
doxygen = find_program('doxygen', required : get_option('doxygen'))
if doxygen.found() and not get_option('doxygen').disabled()
doxyconf = configuration_data()
doxyconf.set('INPUT_DIRECTORY', meson.current_source_dir())
doxyconf.set('OUTPUT_DIRECTORY', meson.current_build_dir())
doxyfile = configure_file(
input : 'Doxyfile.in',
output : 'Doxyfile',
configuration : doxyconf,
install : false)
custom_target(
'doxygen',
input : doxyfile,
output : ['man3'],
command : [doxygen, doxyfile],
build_by_default : true,
install : true,
install_dir : MANDIR)
endif

View file

@ -0,0 +1,67 @@
pacman-conf(8)
==============
Name
----
pacman-conf - query pacman's configuration file
Synopsis
--------
'pacman-conf' [options] [<directive> ...]
'pacman-conf' (--repo-list|--help|--version)
Description
-----------
'pacman-conf' is a utility for parsing the 'pacman' configuration file
and returning script-friendly output. It is designed to properly handle
non-trivial configuration features such as variable interpolation and
the use of the Include directive, and guarantees that it will return the
same configuration values which 'pacman' itself would use.
'pacman-conf' will output the fully-resolved contents of the
configuration file by default, or, if provided with the name of a
configuration directive, output the contents of the given directive alone.
Options
-------
*-c, \--config* <path>::
Specify an alternate configuration file.
*-R, \--rootdir* <path>::
Specify an alternate installation root (default is `/`).
*-r, \--repo* <repository>::
Query options for a specific repository.
*-v, \--verbose*::
Always shown directive names.
*-l, \--repo-list*::
List configured repositories.
*-h, \--help*::
Output syntax and command line options.
*-V, \--version*::
Display version and exit.
Examples
--------
pacman-conf -r core Usage::
Show the value of the Usage configuration option for core repository.
pacman-conf HoldPkg::
Show the value of the HoldPkg configuration option.
See Also
--------
linkman:pacman.conf[5]
include::footer.asciidoc[]

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[]

151
doc/pacman-key.8.asciidoc Normal file
View file

@ -0,0 +1,151 @@
pacman-key(8)
=============
Name
----
pacman-key - manage pacman's list of trusted keys
Synopsis
--------
'pacman-key' [options] operation [targets]
Description
-----------
'pacman-key' is a wrapper script for GnuPG used to manage pacman's keyring, which
is the collection of PGP keys used to check signed packages and databases. It
provides the ability to import and export keys, fetch keys from keyservers and
update the key trust database.
More complex keyring management can be achieved using GnuPG directly combined with
the '\--homedir' option pointing at the pacman keyring (located in
+{sysconfdir}/pacman.d/gnupg+ by default).
Invoking pacman-key consists of supplying an operation with any potential
options and targets to operate on. Depending on the operation, a 'target' may
be a valid key identifier, filename, or directory.
Operations
----------
*-a, \--add*::
Add the key(s) contained in the specified file or files to pacman's
keyring. If a key already exists, update it.
*-d, \--delete*::
Remove the key(s) identified by the specified keyid(s) from pacman's
keyring.
*-e, \--export*::
Export key(s) identified by the specified keyid(s) to 'stdout'. If no keyid
is specified, all keys will be exported.
*\--edit-key*::
Present a menu for key management task on the specified keyid(s). Useful
for adjusting a keys trust level.
*-f, \--finger*::
List a fingerprint for each specified keyid, or for all known keys if no
keyids are specified.
*-h, \--help*::
Output syntax and command line options.
*\--import*::
Imports keys from `pubring.gpg` into the public keyring from the specified
directories.
*\--import-trustdb*::
Imports ownertrust values from `trustdb.gpg` into the shared trust database
from the specified directories.
*\--init*::
Ensure the keyring is properly initialized and has the required access
permissions.
*-l, \--list-keys*::
Lists all or specified keys from the public keyring.
*\--list-sigs*::
Same as '\--list-keys', but the signatures are listed too.
*\--lsign-key*::
Locally sign the given key. This is primarily used to root the web of trust
in the local private key generated by '\--init'.
*\--nocolor*::
Disable colored output from pacman-key.
*-r, \--recv-keys*::
Equivalent to '\--recv-keys' in GnuPG.
*\--refresh-keys*::
Equivalent to '\--refresh-keys' in GnuPG.
*\--populate*::
Reload the default keys from the (optionally provided) keyrings in
+{keyringdir}+. For more information, see
<<PK,Providing a Keyring for Import>> below.
*-u, \--updatedb*::
Equivalent to '\--check-trustdb' in GnuPG. This operation can be specified with
other operations.
*-V, \--version*::
Displays the program version.
*-v, \--verify*::
Assume that the first argument is a signature and verify it. If a second
argument is provided, it is the file to be verified.
+
With only one argument given, assume that the signature is a detached
signature, and look for a matching data file to verify by stripping the file
extension. If no matching data file is found, fall back on GnuPG semantics and
attempt to verify a file with an embedded signature.
Options
-------
*\--config* <file>::
Use an alternate configuration file instead of the +{sysconfdir}/pacman.conf+
default.
*\--gpgdir* <dir>::
Set an alternate home directory for GnuPG. If unspecified, the value is
read from +{sysconfdir}/pacman.conf+.
*\--keyserver* <keyserver>::
Use the specified keyserver if the operation requires one. This will take
precedence over any keyserver option specified in a `gpg.conf`
configuration file. Running '\--init' with this option will set the default
keyserver if one was not already configured.
Providing a Keyring for Import[[PK]]
------------------------------------
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 +{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
\--export-ownertrust' output. This file will inform the user which keys a user
needs to verify and sign to build a local web of trust, in addition to
assigning provided owner trust values.
Also optionally, the file `foo-revoked` can be provided containing a list of
revoked key IDs for that keyring. Revoked is defined as "no longer valid for
any signing", so should be used with prudence. A key being marked as revoked
will be disabled in the keyring and no longer treated as valid, so this always
takes priority over it's trusted state in any other keyring.
See Also
--------
linkman:pacman[8], linkman:pacman.conf[5]
include::footer.asciidoc[]

583
doc/pacman.8.asciidoc Normal file
View file

@ -0,0 +1,583 @@
pacman(8)
=========
Name
----
pacman - package manager utility
Synopsis
--------
'pacman' <operation> [options] [targets]
Description
-----------
Pacman is a package management utility that tracks installed packages on a Linux
system. It features dependency support, package groups, install and uninstall
scripts, and the ability to sync your local machine with a remote repository to
automatically upgrade packages. Pacman packages are a zipped tar format.
Since version 3.0.0, pacman has been the front-end to linkman:libalpm[3], the
``Arch Linux Package Management'' library. This library allows alternative
front-ends to be written (for instance, a GUI front-end).
Invoking pacman involves specifying an operation with any potential options and
targets to operate on. A 'target' is usually a package name, file name, URL, or
a search string. Targets can be provided as command line arguments.
Additionally, if stdin is not from a terminal and a single hyphen (-) is passed
as an argument, targets will be read from stdin.
Operations
----------
*-D, \--database*::
Operate on the package database. This operation allows you to modify
certain attributes of the installed packages in pacman's database. It
also allows you to check the databases for internal consistency.
See <<DO,Database Options>> below.
*-Q, \--query*::
Query the package database. This operation allows you to view installed
packages and their files, as well as meta-information about individual
packages (dependencies, conflicts, install date, build date, size). This
can be run against the local package database or can be used on
individual package files. In the first case, if no package names
are provided in the command line, all installed packages will be
queried. Additionally, various filters can be applied on the package
list. See <<QO,Query Options>> below.
*-R, \--remove*::
Remove package(s) from the system. Groups can also be specified to be
removed, in which case every package in that group will be removed.
Files belonging to the specified package will be deleted, and the
database will be updated. Most configuration files will be saved
with a '.pacsave' extension unless the '\--nosave' option is used.
See <<RO,Remove Options>> below.
*-S, \--sync*::
Synchronize packages. Packages are installed directly from the remote
repositories, including all dependencies required to run the packages. For
example, `pacman -S qt` will download and install qt and all the
packages it depends on. If a package name exists in more than one
repository, the repository can be explicitly specified to clarify the
package to install: `pacman -S testing/qt`. You can also specify version
requirements: `pacman -S "bash>=3.2"`. Quotes are needed, otherwise the
shell interprets ">" as redirection to a file.
+
In addition to packages, groups can be specified as well. For example, if
gnome is a defined package group, then `pacman -S gnome` will provide a
prompt allowing you to select which packages to install from a numbered list.
The package selection is specified using a space- and/or comma-separated list of
package numbers. Sequential packages may be selected by specifying the first
and last package numbers separated by a hyphen (`-`). Excluding packages is
achieved by prefixing a number or range of numbers with a caret (`^`).
+
Packages that provide other packages are also handled. For example, `pacman -S
foo` will first look for a foo package. If foo is not found, packages that
provide the same functionality as foo will be searched for. If any package is
found, it will be installed. A selection prompt is provided if multiple packages
providing foo are found.
+
You can also use `pacman -Su` to upgrade all packages that are out-of-date. See
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
to determine which packages need upgrading. This behavior operates as follows:
Alphanumeric:
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
+
Additionally, version strings can have an 'epoch' value defined that will
overrule any version comparison, unless the epoch values are equal. This is
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
greater than `1:3.6-1`.
*-T, \--deptest*::
Check dependencies; this is useful in scripts such as makepkg to check
installed packages. This operation will check each dependency specified and
return a list of dependencies that are not currently satisfied on the system.
This operation accepts no other options. Example usage: `pacman -T qt
"bash>=3.2"`.
*-U, \--upgrade*::
Upgrade or add package(s) to the system and install the required
dependencies from sync repositories. Either a URL or file path can be
specified. This is a ``remove-then-add'' process. See <<UO,Upgrade
Options>> below; also see <<HCF,Handling Config Files>> for an explanation
on how pacman takes care of configuration files.
*-F, \--files*::
Query the files database. This operation allows you to look for packages
owning certain files or display files owned by certain packages. Only
packages that are part of your sync databases are searched. See
<<FO,File Options>> below.
*-V, \--version*::
Display version and exit.
*-h, \--help*::
Display syntax for the given operation. If no operation was supplied,
then the general syntax is shown.
Options
-------
*-b, \--dbpath* <path>::
Specify an alternative database location (the default is
+{localstatedir}/lib/pacman+). This should not be used unless you know what
you are doing.
*NOTE*: If specified, this is an absolute path, and the root path is
not automatically prepended.
*-r, \--root* <path>::
Specify an alternative installation root (default is +{rootdir}+). This should
not be used as a way to install software into `/usr/local` instead of
`/usr`.
*NOTE*: If database path or log file are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*NOTE*: This option is not suitable for performing operations on a mounted
guest system. See '\--sysroot' instead.
*-v, \--verbose*::
Output paths such as the Root, Conf File, DB Path, Cache Dirs, etc.
*\--arch* <arch>::
Specify an alternate architecture.
*\--cachedir* <dir>::
Specify an alternative package cache location (the default is
+{localstatedir}/cache/pacman/pkg+). Multiple cache directories can be
specified, and they are tried in the order they are passed to pacman.
*NOTE*: This is an absolute path, and the root path is not automatically
prepended. If DownloadUser is set in linkman:pacman.conf[5], then the
specified user must have permission to access the cache directory.
*\--color* <when>::
Specify when to enable coloring. Valid options are 'always', 'never', or
'auto'. 'always' forces colors on; 'never' forces colors off; and 'auto' only
automatically enables colors when outputting onto a tty.
*\--config* <file>::
Specify an alternate configuration file.
*\--debug*::
Display debug messages. When reporting bugs, this option is recommended
to be used.
*\--gpgdir* <dir>::
Specify a directory of files used by GnuPG to verify package signatures
(the default is +{sysconfdir}/pacman.d/gnupg+). This directory should contain
two files: `pubring.gpg` and `trustdb.gpg`. `pubring.gpg` holds the public keys
of all packagers. `trustdb.gpg` contains a so-called trust database, which
specifies that the keys are authentic and trusted. *NOTE*: This is an absolute
path, and the root path is not automatically prepended.
*\--hookdir* <dir>::
Specify a alternative directory containing hook files (the default is
+{sysconfdir}/pacman.d/hooks+). Multiple hook directories can be specified
with hooks in later directories taking precedence over hooks in earlier
directories. *NOTE*: This is an absolute path, and the root path is not
automatically prepended.
*\--logfile* <file>::
Specify an alternate log file. This is an absolute path, regardless of
the installation root setting.
*\--noconfirm*::
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
this unless you want to run pacman from a script.
*\--confirm*::
Cancels the effects of a previous '\--noconfirm'.
*\--disable-download-timeout*::
Disable defaults for low speed limit and timeout on downloads. Use this
if you have issues downloading files with proxy and/or security gateway.
*\--sysroot* <dir>:: Specify an alternative system root. This path will be
prepended to all other configuration directories and any repository servers
beginning with `file://`. Any paths or URLs passed as targets will not be
modified. This allows mounted guest systems to be properly operated on.
*\--disable-sandbox*::
Disable the default sandbox applied to the process downloading files on Linux
systems. Useful if experiencing landlock related failures while downloading
files when running a Linux kernel that does not support this feature.
Transaction Options (apply to '-S', '-R' and '-U')
--------------------------------------------------
*-d, \--nodeps*::
Skips dependency version checks. Package names are still checked. Normally,
pacman will always check a package's dependency fields to ensure that all
dependencies are installed and there are no package conflicts in the
system. Specify this option twice to skip all dependency checks.
*\--assume-installed* <package=version>::
Add a virtual package "package" with version "version" to the transaction
to satisfy dependencies. This allows disabling the specific dependency checks
without affecting all dependency checks. To disable all dependency
checking, see the '\--nodeps' option.
*\--dbonly*::
Adds/removes the database entry only, leaving all files in place.
*\--noprogressbar*::
Do not show a progress bar when downloading files. This can be useful
for scripts that call pacman and capture the output.
*\--noscriptlet*::
If an install scriptlet exists, do not execute it. Do not use this
unless you know what you are doing.
*-p, \--print*::
Only print the targets instead of performing the actual operation (sync,
remove or upgrade). Use '\--print-format' to specify how targets are
displayed. The default format string is "%l", which displays URLs with
'-S', file names with '-U', and pkgname-pkgver with '-R'.
*\--print-format* <format>::
Specify a printf-like format to control the output of the '\--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, "%m" for
md5sum, "%n" for pkgname, "%p" for packager, "%v" for pkgver, "%l" for
location, "%r" for repository, "%s" for size, "%C" for checkdepends,
"%D" for depends, "%G" for groups, "%H" for conflicts, "%L" for
licenses, "%M" for makedepends, "%O" for optional depends, "%P" for
provides and "%R" for replaces.
Implies '\--print'.
Upgrade Options (apply to '-S' and '-U')[[UO]]
----------------------------------------------
*-w, \--downloadonly*::
Retrieve all packages from the server, but do not install/upgrade anything.
*\--asdeps*::
Install packages non-explicitly; in other words, fake their install reason
to be installed as a dependency. This is useful for makepkg and other
build-from-source tools that need to install dependencies before building
the package.
*\--asexplicit*::
Install packages explicitly; in other words, fake their install reason to
be explicitly installed. This is useful if you want to mark a dependency
as explicitly installed so it will not be removed by the '\--recursive'
remove operation.
*\--ignore* <package>::
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.
*\--ignoregroup* <group>::
Directs pacman to ignore upgrades of all packages in 'group', even if
there is one available. Multiple groups can be specified by
separating them with a comma.
*\--needed*::
Do not reinstall the targets that are already up-to-date.
*\--overwrite* <glob>::
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already
installed and match 'glob', this option will cause all those files to be
overwritten. Using '\--overwrite' will not allow overwriting a directory
with a file or installing packages with conflicting files and directories.
Multiple patterns can be specified by separating them with a comma. May be
specified multiple times. Patterns can be negated, such that files
matching them will not be overwritten, by prefixing them with an
exclamation mark. Subsequent matches will override previous ones. A leading
literal exclamation mark or backslash needs to be escaped.
Query Options (apply to '-Q')[[QO]]
-----------------------------------
*-c, \--changelog*::
View the ChangeLog of a package if it exists.
*-d, \--deps*::
Restrict or filter output to packages installed as dependencies. This
option can be combined with '-t' for listing real orphans - packages that
were installed as dependencies but are no longer required by any
installed package.
*-e, \--explicit*::
Restrict or filter output to explicitly installed packages. This option
can be combined with '-t' to list explicitly installed packages that
are not required by any other package.
*-g, \--groups*::
Display all packages that are members of a named group. If a name is not
specified, list all grouped packages.
*-i, \--info*::
Display information on a given package. The '-p' option can be used if
querying a package file instead of the local database. Passing two
'\--info' or '-i' flags will also display the list of backup files and
their modification states.
*-k, \--check*::
Check that all files owned by the given package(s) are present on the
system. If packages are not specified or filter flags are not provided,
check all installed packages. Specifying this option twice will perform
more detailed file checking (including permissions, file sizes, and
modification times) for packages that contain the needed mtree file.
*-l, \--list*::
List all files owned by a given package. Multiple packages can be
specified on the command line.
*-m, \--foreign*::
Restrict or filter output to packages that were not found in the sync
database(s). Typically these are packages that were downloaded manually
and installed with '\--upgrade'.
*-n, \--native*::
Restrict or filter output to packages that are found in the sync
database(s). This is the inverse filter of '\--foreign'.
*-o, \--owns* <file>::
Search for packages that own the specified file(s). The path can be
relative or absolute, and one or more files can be specified.
*-p, \--file*::
Signifies that the package supplied on the command line is a file and
not an entry in the database. The file will be decompressed and queried.
This is useful in combination with '\--info' and '\--list'.
*-q, \--quiet*::
Show less information for certain query operations. This is useful when
pacman's output is processed in a script. Search will only show package
names and not version, group, and description information; owns will
only show package names instead of "file is owned by pkg" messages; group
will only show package names and omit group names; list will only show
files and omit package names; check will only show pairs of package names
and missing files; a bare query will only show package names
rather than names and versions.
*-s, \--search* <regexp>::
Search each locally-installed package for names or descriptions that
match `regexp`. When including multiple search terms, only packages
with descriptions matching ALL of those terms are returned.
*-t, \--unrequired*::
Restrict or filter output to print only packages neither required nor
optionally required by any currently installed package. Specify this
option twice to include packages which are optionally, but not directly,
required by another package.
*-u, \--upgrades*::
Restrict or filter output to packages that are out-of-date on the local
system. Only package versions are used to find outdated packages;
replacements are not checked here. This option works best if the sync
database is refreshed using '-Sy'.
Remove Options (apply to '-R')[[RO]]
------------------------------------
*-c, \--cascade*::
Remove all target packages, as well as all packages that depend on one
or more target packages. This operation is recursive and must be used
with care, since it can remove many potentially needed packages.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system, the database is checked to see if the
file should be renamed with a '.pacsave' extension.
*-s, \--recursive*::
Remove each target specified including all of their dependencies, provided
that (A) they are not required by other packages; and (B) they were not
explicitly installed by the user. This operation is recursive and analogous
to a backwards '\--sync' operation, and it helps keep a clean system without
orphans. If you want to omit condition (B), pass this option twice.
*-u, \--unneeded*::
Removes targets that are not required by any other packages.
This is mostly useful when removing a group without using the '-c' option,
to avoid breaking any dependencies.
Sync Options (apply to '-S')[[SO]]
----------------------------------
*-c, \--clean*::
Remove packages that are no longer installed from the cache as well as
currently unused sync databases to free up disk space. When pacman
downloads packages, it saves them in a cache directory. In addition,
databases are saved for every sync DB you download from and are not
deleted even if they are removed from the configuration file
linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
packages that are no longer installed; use two to remove all files
from the cache. In both cases, you will have a yes or no option to
remove packages and/or unused downloaded databases.
+
If you use a network shared cache, see the 'CleanMethod' option in
linkman:pacman.conf[5].
*-g, \--groups*::
Display all the members for each package group specified. If no group
names are provided, all groups will be listed; pass the flag twice to
view all groups and their members.
*-i, \--info*::
Display information on a given sync database package. Passing two '\--info'
or '-i' flags will also display those packages in all repositories that
depend on this package.
*-l, \--list*::
List all packages in the specified repositories. Multiple repositories
can be specified on the command line.
*-q, \--quiet*::
Show less information for certain sync operations. This is useful when
pacman's output is processed in a script. Search will only show package
names and not repository, version, group, and description information; list
will only show package names and omit databases and versions; group will
only show package names and omit group names.
*-s, \--search* <regexp>::
This will search each package in the sync databases for names or
descriptions that match `regexp`. When you include multiple search
terms, only packages with descriptions matching ALL of those terms will
be returned.
*-u, \--sysupgrade*::
Upgrades all packages that are out-of-date. Each currently-installed
package will be examined and upgraded if a newer package exists. A
report of all packages to upgrade will be presented, and the operation
will not proceed without user confirmation. Dependencies are
automatically resolved at this level and will be installed/upgraded if
necessary.
+
Pass this option twice to enable package downgrades; in this case, pacman will
select sync packages whose versions do not match with the local versions. This
can be useful when the user switches from a testing repository to a stable one.
+
Additional targets can also be specified manually, so that '-Su foo' will do a
system upgrade and install/upgrade the "foo" package in the same operation.
*-y, \--refresh*::
Download a fresh copy of the master package databases '(repo.db)' from the
server(s) defined in linkman:pacman.conf[5]. This should typically be used
each time you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y'
flags will force a refresh of all package databases, even if they appear to
be up-to-date.
Database Options (apply to '-D')[[QO]]
--------------------------------------
*\--asdeps* <package>::
Mark a package as non-explicitly installed; in other words, set their install
reason to be installed as a dependency.
*\--asexplicit* <package>::
Mark a package as explicitly installed; in other words, set their install
reason to be explicitly installed. This is useful if you want to keep a
package installed even when it was initially installed as a dependency
of another package.
*-k, \--check*::
Check the local package database is internally consistent. This will
check all required files are present and that installed packages have
the required dependencies, do not conflict and that multiple packages
do not own the same file. Specifying this option twice will perform
a check on the sync databases to ensure all specified dependencies
are available.
*-q, \--quiet*::
Suppress messages on successful completion of database operations.
File Options (apply to '-F')[[FO]]
----------------------------------
*-y, --refresh*::
Download fresh package file databases '(repo.files)' from the server.
Use twice to force a refresh even if databases are up to date.
*-l, \--list*::
List the files owned by the queried package.
*-x, --regex*::
Interpret each query as a regular expression.
*-q, \--quiet*::
Show less information for certain file operations. This is useful when
pacman's output is processed in a script, however, you may want to use
'--machinereadable' instead.
*--machinereadable*::
Print each match in a machine readable output format. The format is
'repository\0pkgname\0pkgver\0path\n' with '\0' being the NULL character
and '\n' a linefeed.
Handling Config Files[[HCF]]
----------------------------
Pacman uses the same logic as 'rpm' to determine action against files that are
designated to be backed up. During an upgrade, three MD5 hashes are used for
each backup file to determine the required action: one for the original file
installed, one for the new file that is about to be installed, and one for the
actual file existing on the file system. After comparing these three hashes, the
following scenarios can result:
original=X, current=X, new=X::
All three files are the same, so overwrites are not an issue. Install the
new file.
original=X, current=X, new=Y::
The current file is the same as the original, but the new one differs.
Since the user did not ever modify the file, and the new one may contain
improvements or bug fixes, install the new file.
original=X, current=Y, new=X::
Both package versions contain the exact same file, but the one on the
file system has been modified. Leave the current file in place.
original=X, current=Y, new=Y::
The new file is identical to the current file. Install the new file.
original=X, current=Y, new=Z::
All three files are different, so install the new file with a '.pacnew'
extension and warn the user. The user must then manually merge any
necessary changes into the original file.
original=NULL, current=Y, new=Z::
The package was not previously installed, and the file already exists on the
file system. Install the new file with a '.pacnew' extension and warn the
user. The user must then manually merge any necessary changes into the
original file.
Examples
--------
pacman -Ss ne.hack::
Search for regexp "ne.hack" in package database.
pacman -S gpm::
Download and install gpm including dependencies.
pacman -U /home/user/ceofhack-0.6-1-x86_64.pkg.tar.gz::
Install ceofhack-0.6-1 package from a local file.
pacman -Syu::
Update package list and upgrade all packages afterwards.
pacman -Syu gpm::
Update package list, upgrade all packages, and then install gpm if it
wasn't already installed.
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring pacman using the
'pacman.conf' file.
See Also
--------
linkman:alpm-hooks[5], linkman:libalpm[3], linkman:makepkg[8],
linkman:pacman.conf[5]
include::footer.asciidoc[]

View file

@ -1,428 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
pacman(8)
=========
Name
----
pacman - package manager utility
Synopsis
--------
'pacman' <operation> [options] [packages]
Description
-----------
Pacman is a package management utility that tracks installed packages on a Linux
system. It features dependency support, package groups, install and uninstall
hooks, and the ability to sync your local machine with a remote ftp server to
automatically upgrade packages. Pacman packages are a zipped tar format.
Since version 3.0.0, pacman has been the frontend to linkman:libalpm[3], the
``Arch Linux Package Management'' library. This library allows alternative
front ends to be written (for instance, a GUI front end).
Operations
----------
*-D, \--database*::
Modify the package database. This options allows you to modify certain
attributes of the installed packages in pacman's database. At the
moment, you can only change the install reason using '\--asdeps' and
'\--asexplicit' options.
*-Q, \--query*::
Query the package database. This operation allows you to view installed
packages and their files, as well as meta-information about individual
packages (dependencies, conflicts, install date, build date, size). This
can be run against the local package database or can be used on
individual '.tar.gz' packages. In the first case, if no package names
are provided in the command line, all installed packages will be
queried. Additionally, various filters can be applied on the package
list. See <<QO,Query Options>> below.
*-R, \--remove*::
Remove package(s) from the system. Groups can also be specified to be
removed, in which case every package in that group will be removed.
Files belonging to the specified package will be deleted, and the
database will be updated. Most configuration files will be saved
with a `.pacsave` extension unless the '\--nosave' option is used.
See <<RO,Remove Options>> below.
*-S, \--sync*::
Synchronize packages. Packages are installed directly from the ftp
servers, including all dependencies required to run the packages. For
example, `pacman -S qt` will download and install qt and all the
packages it depends on. If a package name exists in more than one repo, the
repo can be explicitly specified to clarify the package to install:
`pacman -S testing/qt`. You can also specify version requirements:
`pacman -S "bash>=3.2"`. (Quotes are needed, otherwise your shell
interprets ">" as redirection to file.)
+
In addition to packages, groups can be specified as well. For example, if
gnome is a defined package group, then `pacman -S gnome` will install every
package in the gnome group, as well as the dependencies of those packages.
+
Packages which provide other packages are also handled. For example, `pacman -S
foo` will first look for a foo package. If foo is not found, packages which
provide the same functionality as foo will be searched for. If any package is
found, it will be installed.
+
You can also use `pacman -Su` to upgrade all packages that are out of date. See
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
to determine which packages need upgrading. This behavior operates as follows:
Alphanumeric:
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
*-T, \--deptest*::
Check dependencies; this is useful in scripts such as makepkg to check
installed packages. This operation will check each dependency specified and
return a list of those which are not currently satisfied on the system.
This operation accepts no other options. Example usage: `pacman -T qt
"bash>=3.2"`.
*-U, \--upgrade*::
Upgrade or add package(s) to the system and install the required
dependencies from sync repos. Either a URL or file path can be
specified. This is a ``remove-then-add'' process. See <<UO,Upgrade
Options>> below; also see <<HCF,Handling Config Files>> for an explanation
on how pacman takes care of config files.
*-V, \--version*::
Display version and exit.
*-h, \--help*::
Display syntax for the given operation. If no operation was supplied
then the general syntax is shown.
Options
-------
*\--asdeps*::
Install packages non-explicitly; in other words, fake their install reason
to be installed as a dependency. This is useful for makepkg and other
build from source tools that need to install dependencies before building
the package.
*\--asexplicit*::
Install packages explicitly; in other words, fake their install reason to
be explicitly installed. This is useful if you want to mark a dependency
as explicitly installed so it will not be removed by the '\--recursive'
remove operation.
*-b, \--dbpath* <'path'>::
Specify an alternative database location (a typical default is
``/var/lib/pacman''). This should not be used unless you know what you are
doing. *NOTE*: if specified, this is an absolute path and the root path is
not automatically prepended.
*-d, \--nodeps*::
Skips all dependency checks. Normally, pacman will always check a
package's dependency fields to ensure that all dependencies are
installed and there are no package conflicts in the system.
*-f, \--force*::
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already
installed, this option will cause all those files to be overwritten.
This option should be used with care, ideally not at all.
*-r, \--root* <'path'>::
Specify an alternative installation root (default is ``/''). This should
not be used as a way to install software into ``/usr/local'' instead of
``/usr''. This option is used if you want to install a package on a
temporary mounted partition which is "owned" by another system.
*NOTE*: if database path or logfile are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*-v, \--verbose*::
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
*\--debug*::
Display debug messages. When reporting bugs, this option is recommended
to be used.
*\--cachedir* <'dir'>::
Specify an alternative package cache location (a typical default is
``/var/cache/pacman/pkg''). Multiple cache directories can be specified,
and they are tried in the order they are passed to pacman. *NOTE*: this
is an absolute path, the root path is not automatically prepended.
*\--config* <'file'>::
Specify an alternate configuration file.
*\--logfile* <'file'>::
Specify an alternate log file. This is an absolute path, regardless of
the installation root setting.
*\--noconfirm*::
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
this unless you want to run pacman from a script.
*\--noprogressbar*::
Do not show a progress bar when downloading files. This can be useful
for scripts that call pacman and capture the output.
*\--noscriptlet*::
If an install scriptlet exists, do not execute it. Do not use this
unless you know what you are doing.
*\--arch* <'arch'>::
Specify an alternate architecture.
*-p, \--print*::
Only print the targets instead of performing the actual operation (sync,
remove or upgrade). Use '\--print-format' to specify how targets are
displayed. The default format string is "%l", which displays url with '-S',
filename with '-U' and pkgname-pkgver with '-R'.
*\--print-format* <'format'>::
Specify a printf-like format to control the output of the '\--print'
operation. The possible are attributes are : %n for pkgname, %v for pkgver, %l
for location, %r for repo and %s for size.
Query Options[[QO]]
-------------------
*-c, \--changelog*::
View the ChangeLog of a package. Not every package will provide one but
it will be shown if available.
*-d, \--deps*::
Restrict or filter output to packages installed as dependencies. This
option can be combined with '-t' for listing real orphans- packages that
were installed as dependencies but are no longer required by any
installed package. ('-Qdt' is equivalent to the pacman 3.0.X '-Qe'
option.)
*-e, \--explicit*::
Restrict or filter output to packages explicitly installed. This option
can be combined with '-t' to list top-level packages- those packages
that were explicitly installed but are not required by any other
package. ('-Qet' is equivalent to the pacman 2.9.X '-Qe' option.)
*-g, \--groups*::
Display all packages that are members of a named group. If a name is not
specified, list all grouped packages.
*-i, \--info*::
Display information on a given package. The '-p' option can be used if
querying a package file instead of the local database. Passing two
'\--info' or '-i' flags will also display the list of backup files and
their modification states.
*-k \--check*::
Check that all files owned by the given package(s) are present on the
system. If packages are not specified or filter flags are not provided,
check all installed packages.
*-l, \--list*::
List all files owned by a given package. Multiple packages can be
specified on the command line.
*-m, \--foreign*::
Restrict or filter output to packages that were not found in the sync
database(s). Typically these are packages that were downloaded manually
and installed with '\--upgrade'.
*-o, \--owns* <'file'>::
Search for the package that owns file. The path can be relative or
absolute.
*-p, \--file*::
Signifies that the package supplied on the command line is a file and
not an entry in the database. The file will be decompressed and queried.
This is useful in combination with '\--info' and '\--list'.
*-q, \--quiet*::
Show less information for certain query operations. (This is useful when
pacman's output is processed in a script.) Search will only show package
names and not version, group, and description information; owns will
only show package names instead of "file is owned by pkg" messages; group
will only show package names and omit group names; list will only show
files and omit package names; check will only show pairs of package names
and missing files; a bare query will only show package names
rather than names and versions.
*-s, \--search* <'regexp'>::
This will search each locally-installed package for names or
descriptions that match `regexp`. When you include multiple search
terms, only packages with descriptions matching ALL of those terms will
be returned.
*-t, \--unrequired*::
Restrict or filter output to packages not required by any currently
installed package.
*-u, \--upgrades*::
Restrict or filter output to packages that are out of date on the local
system. (Only package versions are used to find outdated packages,
replacements are not checked here.) This option works best if the sync
database is refreshed using '-Sy'.
Remove Options[[RO]]
--------------------
*-c, \--cascade*::
Remove all target packages, as well as all packages that depend on one
or more target packages. This operation is recursive, and must be used
with care since it can remove many potentially needed packages.
*-k, \--dbonly*::
Removes the database entry only. Leaves all files in place.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system the database is checked to see if the
file should be renamed with a ``.pacsave'' extension.
*-s, \--recursive*::
Remove each target specified including all of their dependencies, provided
that (A) they are not required by other packages; and (B) they were not
explicitly installed by the user. This operation is recursive and analogous
to a backwards '\--sync' operation, and helps keep a clean system without
orphans. If you want to omit condition (B), pass this option twice.
*-u, \--unneeded*::
Removes the targets that are not required by any other packages.
This is mostly useful when removing a group without using the '-c' option,
to avoid breaking any dependencies.
Sync Options[[SO]]
------------------
*-c, \--clean*::
Remove packages that are no longer installed from the cache as well as
currently unused sync databases to free up disk space. When pacman
downloads packages, it saves them in a cache directory. In addition,
databases are saved for every sync DB you download from, and are not
deleted even if they are removed from the configuration file
linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
packages that are no longer installed; use two to remove all packages
from the cache. In both cases, you will have a yes or no option to
remove packages and/or unused downloaded databases.
+
If you use a network shared cache, see the 'CleanMethod' option in
linkman:pacman.conf[5].
*-g, \--groups*::
Display all the members for each package group specified. If no group
names are provided, all groups will be listed; pass the flag twice to
view all groups and their members.
*-i, \--info*::
Display information on a given sync database package. Passing two '\--info'
or '-i' flags will also display those packages in all repositories that
depend on this package.
*-l, \--list*::
List all packages in the specified repositories. Multiple repositories
can be specified on the command line.
*-q, \--quiet*::
Show less information for certain sync operations. (This is useful when
pacman's output is processed in a script.) Search will only show package
names and not repo, version, group, and description information; list
will only show package names and omit databases and versions; group will
only show package names and omit group names.
*-s, \--search* <'regexp'>::
This will search each package in the sync databases for names or
descriptions that match `regexp`. When you include multiple search
terms, only packages with descriptions matching ALL of those terms will
be returned.
*-u, \--sysupgrade*::
Upgrades all packages that are out of date. Each currently-installed
package will be examined and upgraded if a newer package exists. A
report of all packages to upgrade will be presented and the operation
will not proceed without user confirmation. Dependencies are
automatically resolved at this level and will be installed/upgraded if
necessary. Pass this option twice to enable package downgrade; in this
case pacman will select sync packages whose version does not match with
the local version. This can be useful when the user switches from a testing
repo to a stable one. Additional targets can also be specified manually, so
that '-Su foo' will do a system upgrade and install/upgrade the foo package in
the same operation.
*-w, \--downloadonly*::
Retrieve all packages from the server, but do not install/upgrade
anything.
*-y, \--refresh*::
Download a fresh copy of the master package list from the server(s)
defined in linkman:pacman.conf[5]. This should typically be used each time
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
will force a refresh of all package lists even if they are thought to be up
to date.
*\--needed*::
Don't reinstall the targets that are already up-to-date.
*\--ignore* <'package'>::
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.
*\--ignoregroup* <'group'>::
Directs pacman to ignore upgrades of all packages in 'group' even if
there is one available. Multiple groups can be specified by
separating them with a comma.
Upgrade Options[[UO]]
--------------------
*-k, \--dbonly*::
Adds the database entries for the specified packages but do not install any
of the files. On an upgrade operation, the existing package and all files
will be removed and the database entry for the new package will be added.
Handling Config Files[[HCF]]
----------------------------
Pacman uses the same logic as rpm to determine action against files that are
designated to be backed up. During an upgrade, 3 md5 hashes are used for each
backup file to determine the required action: one for the original file
installed, one for the new file that's about to be installed, and one for the
actual file existing on the filesystem. After comparing these 3 hashes, the
follow scenarios can result:
original=X, current=X, new=X::
All three files are the same, so overwrites are not an issue Install the
new file.
original=X, current=X, new=Y::
The current file is the same as the original but the new one differs.
Since the user did not ever modify the file, and the new one may contain
improvements or bugfixes, install the new file.
original=X, current=Y, new=X::
Both package versions contain the exact same file, but the one on the
filesystem has been modified. Leave the current file in place.
original=X, current=Y, new=Y::
The new file is identical to the current file. Install the new file.
original=X, current=Y, new=Z::
All three files are different, so install the new file with a '.pacnew'
extension and warn the user. The user must then manually merge any
necessary changes into the original file.
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring pacman using the
'pacman.conf' file.
See Also
--------
linkman:pacman.conf[5], linkman:makepkg[8], linkman:libalpm[3]
include::footer.txt[]

382
doc/pacman.conf.5.asciidoc Normal file
View file

@ -0,0 +1,382 @@
pacman.conf(5)
==============
Name
----
pacman.conf - pacman package manager configuration file
Synopsis
--------
{sysconfdir}/pacman.conf
Description
-----------
Pacman, using linkman:libalpm[3], will attempt to read pacman.conf each time it
is invoked. This configuration file is divided into sections or repositories.
Each section defines a package repository that pacman can use when searching
for packages in '\--sync' mode. The exception to this is the options section,
which defines global options.
Comments are only supported by beginning a line with the hash (#) symbol.
Comments cannot begin in the middle of a line.
Example
-------
--------
#
# pacman.conf
#
[options]
NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab
[core]
Include = /etc/pacman.d/core
[custom]
Server = file:///home/pkgs
--------
NOTE: Each directive must be in CamelCase. If the case isn't respected, the
directive won't be recognized. For example. noupgrade or NOUPGRADE will not
work.
Options
-------
*RootDir =* /path/to/root/dir::
Set the default root directory for pacman to install to. This option is
used if you want to install a package on a temporary mounted partition
which is "owned" by another system, or for a chroot install.
*NOTE*: If database path or log file are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*DBPath =* /path/to/db/dir::
Overrides the default location of the toplevel database directory. The
default is +{localstatedir}/lib/pacman/+. Most users will not need to set
this option. *NOTE*: if specified, this is an absolute path and the root
path is not automatically prepended.
*CacheDir =* /path/to/cache/dir::
Overrides the default location of the package cache directory. The
default is +{localstatedir}/cache/pacman/pkg/+. Multiple cache directories can be
specified, and they are tried in the order they are listed in the config
file. If a file is not found in any cache directory, it will be downloaded
to the first cache directory with write access. *NOTE*: this is an absolute
path, the root path is not automatically prepended.
*HookDir =* /path/to/hook/dir::
Add directories to search for alpm hooks in addition to the system hook
directory (+{datarootdir}/libalpm/hooks/+). The default is
+{sysconfdir}/pacman.d/hooks+. Multiple directories can be specified with
hooks in later directories taking precedence over hooks in earlier
directories. *NOTE*: this is an absolute path, the root path is not
automatically prepended. For more information on the alpm hooks, see
linkman:alpm-hooks[5].
*GPGDir =* /path/to/gpg/dir::
Overrides the default location of the directory containing configuration
files for GnuPG. The default is +{sysconfdir}/pacman.d/gnupg/+.
This directory should contain two files: `pubring.gpg` and `trustdb.gpg`.
`pubring.gpg` holds the public keys of all packagers. `trustdb.gpg`
contains a so-called trust database, which specifies that the keys are
authentic and trusted.
*NOTE*: this is an absolute path, the root path is not automatically
prepended.
*LogFile =* /path/to/log/file::
Overrides the default location of the pacman log file. The default
is +{localstatedir}/log/pacman.log+. This is an absolute path and the root directory
is not prepended.
*HoldPkg =* package ...::
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
pacman will ask for confirmation before proceeding. Shell-style glob
patterns are allowed.
*IgnorePkg =* package ...::
Instructs pacman to ignore any upgrades for this package when performing
a '\--sysupgrade'. Shell-style glob patterns are allowed.
*IgnoreGroup =* group ...::
Instructs pacman to ignore any upgrades for all packages in this
group when performing a '\--sysupgrade'. Shell-style glob patterns are
allowed.
*Include =* /path/to/config/file::
Include another configuration file. This file can include repositories or
general configuration options. Wildcards in the specified paths will get
expanded based on linkman:glob[7] rules.
*Architecture =* auto &| i686 &| x86_64 | ...::
If set, pacman will only allow installation of packages with the given
architectures (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
use the system architecture, provided via ``uname -m''. If unset, no
architecture checks are made. *NOTE*: Packages with the special
architecture 'any' can always be installed, as they are meant to be
architecture independent.
*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
``.part'' extension, which allows programs like wget to do file resumes
properly.
+
This option is useful for users who experience problems with built-in
HTTP/FTP support, or need the more advanced proxy support that comes with
utilities like wget.
*NoUpgrade =* file ...::
All files listed with a `NoUpgrade` directive will never be touched during
a package install/upgrade, and the new files will be installed with a
'.pacnew' extension.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them. Shell-style glob patterns
are allowed. It is possible to invert matches by prepending a file with
an exclamation mark. Inverted files will result in previously blacklisted
files being whitelisted again. Subsequent matches will override previous
ones. A leading literal exclamation mark or backslash needs to be escaped.
*NoExtract =* file ...::
All files listed with a `NoExtract` directive will never be extracted from
a package into the filesystem. This can be useful when you don't want part
of a package to be installed. For example, if your httpd root uses an
'index.php', then you would not want the 'index.html' file to be extracted
from the 'apache' package.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them. Shell-style glob patterns
are allowed. It is possible to invert matches by prepending a file with
an exclamation mark. Inverted files will result in previously blacklisted
files being whitelisted again. Subsequent matches will override previous
ones. A leading literal exclamation mark or backslash needs to be escaped.
*CleanMethod =* KeepInstalled &| KeepCurrent::
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
packages that are no longer installed (not present in the local database).
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
any sync database).
The second behavior is useful when the package cache is shared among
multiple machines, where the local databases are usually different, but the
sync databases in use could be the same. If both values are specified,
packages are only cleaned if not installed locally and not present in any
known sync database.
*SigLevel =* ...::
Set the default signature verification level. For more information, see
<<SC,Package and Database Signature Checking>> below.
*LocalFileSigLevel =* ...::
Set the signature verification level for installing packages using the "-U"
operation on a local file. Uses the value from SigLevel as the default.
*RemoteFileSigLevel =* ...::
Set the signature verification level for installing packages using the "-U"
operation on a remote file URL. Uses the value from SigLevel as the default.
*UseSyslog*::
Log action messages through syslog(). This will insert log entries into
+{localstatedir}/log/messages+ or equivalent.
*Color*::
Automatically enable colors only when pacman's output is on a tty.
*NoProgressBar*::
Disables progress bars. This is useful for terminals which do
not support escape characters.
*CheckSpace*::
Performs an approximate check for adequate available disk space before
installing packages.
*VerbosePkgLists*::
Displays name, version and size of target packages formatted
as a table for upgrade, sync and remove operations.
*DisableDownloadTimeout*::
Disable defaults for low speed limit and timeout on downloads. Use this
if you have issues downloading files with proxy and/or security gateway.
*ParallelDownloads =* ...::
Specifies number of concurrent download streams. The value needs to be a
positive integer. If this config option is not set then only one download
stream is used (i.e. downloads happen sequentially).
*DownloadUser =* username::
Specifies the user to switch to for downloading files. If this config
option is not set then the downloads are done as the user running pacman.
*DisableSandbox*::
Disable the default sandbox applied to the process downloading files on Linux
systems. Useful if experiencing landlock related failures while downloading
files when running a Linux kernel that does not support this feature.
Repository Sections
-------------------
Each repository section defines a section name and at least one location where
the packages can be found. The section name is defined by the string within
square brackets (the two above are 'core' and 'custom'). Repository names
must be unique and the name 'local' is reserved for the database of installed
packages. Locations are defined with the 'Server' directive and follow a URL
naming structure. If you want to use a local directory, you can specify the
full path with a ``file://'' prefix, as shown above.
A common way to define DB locations utilizes the 'Include' directive. For each
repository defined in the configuration file, a single 'Include' directive can
contain a file that lists the servers for that repository.
--------
[core]
# use this server first
Server = ftp://ftp.archlinux.org/$repo/os/$arch
# next use servers as defined in the mirrorlist below
Include = /etc/pacman.d/mirrorlist
--------
The order of repositories in the configuration files matters; repositories
listed first will take precedence over those listed later in the file when
packages in two repositories have identical names, regardless of version
number.
*Include =* path::
Include another config file. This file can include repositories or
general configuration options. Wildcards in the specified paths will get
expanded based on linkman:glob[7] rules.
*CacheServer =* url::
A full URL to a location where the packages, and signatures (if
available) for this repository can be found. Cache servers will be tried
before any non-cache servers, will not be removed from the server pool for
404 download errors, and will not be used for database files.
*Server =* url::
A full URL to a location where the database, packages, and signatures (if
available) for this repository can be found.
+
During parsing, pacman will define the `$repo` variable to the name of the
current section. This is often utilized in files specified using the 'Include'
directive so all repositories can use the same mirrorfile. pacman also defines
the `$arch` variable to the first (or only) value of the `Architecture` option,
so the same mirrorfile can even be used for different architectures.
*SigLevel =* ...::
Set the signature verification level for this repository. For more
information, see <<SC,Package and Database Signature Checking>> below.
*Usage =* ...::
Set the usage level for this repository. This option takes a list of tokens
which must be at least one of the following:
*Sync*;;
Enables refreshes for this repository.
*Search*;;
Enables searching for this repository.
*Install*;;
Enables installation of packages from this repository during a '\--sync'
operation.
*Upgrade*;;
Allows this repository to be a valid source of packages when performing
a '\--sysupgrade'.
*All*;;
Enables all of the above features for the repository. This is the default
if not specified.
+
Note that an enabled repository can be operated on explicitly, regardless of the Usage
level set.
Package and Database Signature Checking[[SC]]
---------------------------------------------
The 'SigLevel' directive is valid in both the `[options]` and repository
sections. If used in `[options]`, it sets a default value for any repository
that does not provide the setting.
* If set to *Never*, no signature checking will take place.
* If set to *Optional* , signatures will be checked when present, but unsigned
databases and packages will also be accepted.
* If set to *Required*, signatures will be required on all packages and
databases.
Alternatively, you can get more fine-grained control by combining some of
the options and prefixes described below. All options in a config file are
processed in top-to-bottom, left-to-right fashion, where later options override
and/or supplement earlier ones. If 'SigLevel' is specified in a repository
section, the starting value is that from the `[options]` section, or the
built-in system default as shown below if not specified.
The options are split into two main groups, described below. Terms used such as
``marginally trusted'' are terms used by GnuPG, for more information please
consult linkman:gpg[1].
When to Check::
These options control if and when signature checks should take place.
*Never*;;
All signature checking is suppressed, even if signatures are present.
*Optional* (default);;
Signatures are checked if present; absence of a signature is not an
error. An invalid signature is a fatal error, as is a signature from a
key not in the keyring.
*Required*;;
Signatures are required; absence of a signature or an invalid signature
is a fatal error, as is a signature from a key not in the keyring.
What is Allowed::
These options control what signatures are viewed as permissible. Note that
neither of these options allows acceptance of invalid or expired
signatures, or those from revoked keys.
*TrustedOnly* (default);;
If a signature is checked, it must be in the keyring and fully trusted;
marginal trust does not meet this criteria.
*TrustAll*;;
If a signature is checked, it must be in the keyring, but is not
required to be assigned a trust level (e.g., unknown or marginal
trust).
Options in both groups can additionally be prefixed with either *Package* or
*Database*, which will cause it to only take effect on the specified object
type. For example, `PackageTrustAll` would allow marginal and unknown trust
level signatures for packages.
The built-in default is the following:
--------
SigLevel = Optional TrustedOnly
--------
Using Your Own Repository
-------------------------
If you have numerous custom packages of your own, it is often easier to generate
your own custom local repository than install them all with the '\--upgrade'
option. All you need to do is generate a compressed package database in the
directory with these packages so pacman can find it when run with '\--refresh'.
repo-add /home/pkgs/custom.db.tar.gz /home/pkgs/*.pkg.tar.gz
The above command will generate a compressed database named
'/home/pkgs/custom.db.tar.gz'. Note that the database must be of the form
'\{treename\}.db.tar.{ext}', where '\{treename\}' is the name of the section
defined in the configuration file and '\{ext\}' is a valid compression type as
documented in linkman:repo-add[8]. That's it! Now configure your custom section
in the configuration file as shown in the config example above. Pacman will now
use your package repository. If you add new packages to the repository,
remember to re-generate the database and use pacman's '\--refresh' option.
For more information on the repo-add command, see ``repo-add \--help'' or
linkman:repo-add[8].
See Also
--------
linkman:pacman[8], linkman:libalpm[3]
include::footer.asciidoc[]

View file

@ -1,226 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
pacman.conf(5)
==============
Name
----
pacman.conf - pacman package manager configuration file
Synopsis
--------
{sysconfdir}/pacman.conf
Description
-----------
Pacman, using linkman:libalpm[3], will attempt to read pacman.conf each time it
is invoked. This configuration file is divided into sections or repositories.
Each section defines a package repository that pacman can use when searching
for packages in '\--sync' mode. The exception to this is the options section,
which defines global options.
Example
-------
--------
#
# pacman.conf
#
[options]
NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab
[core]
Include = /etc/pacman.d/core
[custom]
Server = file:///home/pkgs
--------
NOTE: Each directive must be in CamelCase. If the case isn't respected, the
directive won't be recognized. For example. noupgrade or NOUPGRADE will not
work.
Options
-------
*RootDir =* path/to/root::
Set the default root directory for pacman to install to. This option is
used if you want to install a package on a temporary mounted partition
which is "owned" by another system, or for a chroot install.
*NOTE*: If database path or logfile are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*DBPath =* path/to/db/dir::
Overrides the default location of the toplevel database directory. A
typical default is ``/var/lib/pacman/''. Most users will not need to set
this option. *NOTE*: if specified, this is an absolute path and the root
path is not automatically prepended.
*CacheDir =* path/to/cache/dir::
Overrides the default location of the package cache directory. A typical
default is ``/var/cache/pacman/pkg/''. Multiple cache directories can be
specified, and they are tried in the order they are listed in the config
file. If a file is not found in any cache directory, it will be downloaded
to the first cache directory with write access. *NOTE*: this is an absolute
path, the root path is not automatically prepended.
*LogFile =* '/path/to/file'::
Overrides the default location of the pacman log file. A typical default
is ``/var/log/pacman.log''. This is an absolute path and the root directory
is not prepended.
*HoldPkg =* package ...::
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
pacman will ask for confirmation before proceeding.
*IgnorePkg =* package ...::
Instructs pacman to ignore any upgrades for this package when performing
a '\--sysupgrade'.
*SyncFirst =* package ...::
Instructs pacman to check for newer version of these packages before any
sync operation. The user will have the choice to either cancel the current
operation and upgrade these packages first or go on with the current
operation. This option is typically used with the 'pacman' package.
*NOTE*: when a `SyncFirst` transaction takes place, no command line flags
(e.g. '\--force') are honored. If this is not ideal, disabling `SyncFirst`
and performing a manual sync of the involved packages may be required.
*IgnoreGroup =* group ...::
Instructs pacman to ignore any upgrades for all packages in this
group when performing a '\--sysupgrade'.
*Include =* path::
Include another config file. This file can include repositories or
general configuration options. Wildcards in the specified paths will get
expanded based on linkman:glob[7] rules.
*Architecture =* auto | i686 | x86_64 | ...::
If set, pacman will only allow installation of packages of the given
architecture (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
use the system architecture, provided by in ``uname -m''. If unset, no
architecture checks are made. *NOTE*: packages with the special
architecture 'any' can always be installed, as they are meant to be
architecture independent.
*XferCommand =* /path/to/command %u::
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
``.part'' extension, which allows programs like wget to do file resumes
properly.
+
This option is useful for users who experience problems with built-in
http/ftp support, or need the more advanced proxy support that comes with
utilities like wget.
*NoUpgrade =* file ...::
All files listed with a `NoUpgrade` directive will never be touched during
a package install/upgrade, and the new files will be installed with a
'.pacnew' extension.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them.
*NoExtract =* file ...::
All files listed with a `NoExtract` directive will never be extracted from
a package into the filesystem. This can be useful when you don't want part
of a package to be installed. For example, if your httpd root uses an
'index.php', then you would not want the 'index.html' file to be extracted
from the 'apache' package.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them.
*CleanMethod =* KeepInstalled | KeepCurrent::
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
packages that are no longer installed (not present in the local database).
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
any sync database).
The second behavior is useful when the package cache is shared among
multiple machines, where the local databases are usually different, but the
sync databases in use could be the same.
*UseSyslog*::
Log action messages through syslog(). This will insert log entries into
``/var/log/messages'' or equivalent.
*ShowSize*::
Display the size of individual packages for '\--sync' and '\--query' modes.
*UseDelta*::
Download delta files instead of complete packages if possible. Requires
the xdelta3 program to be installed.
*TotalDownload*::
When downloading, display the amount downloaded, download rate, ETA,
and completed percentage of the entire download list rather
than the percent of each individual download target. The progress
bar is still based solely on the current file download.
Repository Sections
-------------------
Each repository section defines a section name and at least one location where
the packages can be found. The section name is defined by the string within
square brackets (the two above are 'current' and 'custom'). Locations are
defined with the 'Server' directive and follow a URL naming structure. If you
want to use a local directory, you can specify the full path with a ``file://''
prefix, as shown above.
A common way to define DB locations utilizes the 'Include' directive. For each
repository defined in the configuration file, a single 'Include' directive can
contain a file that lists the servers for that repository.
--------
[core]
# use this repository first
Server = ftp://ftp.archlinux.org/core/os/arch
# next use servers as defined in the mirrorlist below
Include = /etc/pacman.d/mirrorlist
--------
During parsing, pacman will define the `$repo` variable to the name of the
current section. This is often utilized in files specified using the 'Include'
directive so all repositories can use the same mirrorfile. pacman also defines
the `$arch` variable to the value of `Architecture`, so the same mirrorfile can
even be used for different architectures.
--------
Server = ftp://ftp.archlinux.org/$repo/os/$arch
--------
The order of repositories in the configuration files matters; repositories
listed first will take precedence over those listed later in the file when
packages in two repositories have identical names, regardless of version
number.
Using Your Own Repository
-------------------------
If you have numerous custom packages of your own, it is often easier to generate
your own custom local repository than install them all with the '\--upgrade'
option. All you need to do is generate a compressed package database in the
directory with these packages so pacman can find it when run with '\--refresh'.
repo-add /home/pkgs/custom.db.tar.gz /home/pkgs/*.pkg.tar.gz
The above command will generate a compressed database named
'/home/pkgs/custom.db.tar.gz'. Note that the database must be of the form
'{treename}.db.tar.gz', where '{treename}' is the name of the section defined in
the configuration file. That's it! Now configure your custom section in the
configuration file as shown in the config example above. Pacman will now use your
package repository. If you add new packages to the repository, remember to
re-generate the database and use pacman's '\--refresh' option.
For more information on the repo-add command, see ``repo-add \--help'' or
linkman:repo-add[8].
See Also
--------
linkman:pacman[8], linkman:libalpm[3]
include::footer.txt[]

95
doc/repo-add.8.asciidoc Normal file
View file

@ -0,0 +1,95 @@
repo-add(8)
==========
Name
----
repo-add - package database maintenance utility
Synopsis
--------
'repo-add' [options] <path-to-db> <package> [<package> ...]
'repo-remove' [options] <path-to-db> <packagename> [<packagename> ...]
Description
-----------
'repo-add' and 'repo-remove' are two scripts to help build a package database for
packages built with linkman:makepkg[8] and installed with linkman:pacman[8].
'repo-add' will update a package database by reading a built package file.
Multiple packages to add can be specified on the command line.
If a matching ``.sig'' file is found alongside a package file, the signature
will automatically be embedded into the database.
'repo-remove' will update a package database by removing the package name
specified on the command line. Multiple packages to remove can be specified
on the command line.
A package database is a tar file, optionally compressed. Valid extensions are
``.db'' followed by an archive extension of ``.tar'', ``.tar.bz2'',
``.tar.gz'', ``.tar.lrz'', ``.tar.lz'', ``.tar.lz4'', ``.tar.lzo'',
``.tar.xz'', ``.tar.zst'' or ``.tar.Z''. The file does not need to exist, but
all parent directories must exist.
Common Options
--------------
*-q, \--quiet*::
Force this program to keep quiet and run silently except for warning and
error messages.
*-s, \--sign*::
Generate a PGP signature file using GnuPG. This will execute `gpg
--detach-sign` on the generated database to generate a detached
signature file, using the GPG agent if it is available. The signature file
will be the entire filename of the database with a ``.sig'' extension.
*-k, \--key* <key>::
Specify a key to use when signing packages. Can also be specified using
the GPGKEY environment variable. If not specified in either location, the
default key from the keyring will be used.
*-v, \--verify*::
Verify the PGP signature of the database before updating the database.
If the signature is invalid, an error is produced and the update does not
proceed.
*\--nocolor*::
Remove color from 'repo-add' and 'repo-remove' output.
*-R, \--remove*::
Remove old package files from the disk when updating or removing their
entry in the database.
*-w, \--wait-for-lock*::
Wait for the lock file to be acquired. If unset, command will fail with
exit code 2 if acquiring the lock fails. If set, it will retry to acquire
lock until success.
repo-add Options
----------------
*-n, \--new*::
Only add packages that are not already in the database. Warnings will be
printed upon detection of existing packages, but they will not be re-added.
*\--include-sigs*::
Include package PGP signatures in the repository database (if available)
Example
-------
'repo-add' foo.db.tar.xz <pkg1> [<pkg2> ...]
This creates two separate databases; a smaller database ``foo.db.tar.xz'' used by
pacman and a large database containing package file lists ``foo.files.tar.xz'' for
use by other utilities. While pacman can use the large database (if renamed with a
db.tar* extension), there is currently no additional benefit for the larger download.
See Also
--------
linkman:makepkg[8], linkman:pacman[8]
include::footer.asciidoc[]

View file

@ -1,42 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
repo-add(8)
==========
Name
----
repo-add - package database maintenance utility
Synopsis
--------
repo-add [-q] <path-to-db> <package1> [<package2> ...]
repo-remove [-q] <path-to-db> <packagename> [<packagename2> ...]
Description
-----------
repo-add and repo-remove are two scripts to help build a package database for
packages built with linkman:makepkg[8] and installed with linkman:pacman[8].
repo-add will update a package database by reading a built package file.
Multiple packages to add can be specified on the command line.
repo-remove will update a package database by removing the package name
specified on the command line. Multiple packages to remove can be specified
on the command line.
Options
-------
*-q, \--quiet*::
Force this program to keep quiet and run silent except for warning and
error messages.
See Also
--------
linkman:makepkg[8], linkman:pacman[8]
include::footer.txt[]

View file

@ -8,65 +8,68 @@ please try to follow as much as you can.
NOTE: Some of this is paraphrased from the kernel documentation's
"SubmittingPatches" file.
Getting the most recent source
------------------------------
Patches need to be submitted in GIT format and are best if they are against the
Patches need to be submitted in Git format and are best if they are against the
latest version of the code. There are several helpful tutorials for getting
started with GIT if you have not worked with it before.
started with Git if you have not worked with it before.
* http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
* http://wiki.archlinux.org/index.php/Super_Quick_Git_Guide
* https://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
* https://wiki.archlinux.org/index.php/Super_Quick_Git_Guide
The pacman code can be fetched using the following command:
git clone git://projects.archlinux.org/pacman.git
git clone https://gitlab.archlinux.org/pacman/pacman.git
Before making large changes
---------------------------
--
* Discuss your idea
There is nothing worse that spending time making a change only for it to be
rejected immediately. Ensure ideas are discussed beforehand to avoid
disappointment. Appropriate locations for discussion are the issue tracker
on gitlab, or the pacman-dev mailing list. Transient discussion channels
such as IRC are not appropriate.
--
Creating your patch
-------------------
--
* use `git commit -s` for creating a commit of your changes.
* Use `git commit -s` for creating a commit of your changes.
The -s allows you to credit yourself by adding a "Signed Off By" line to
indicate who has "signed" the patch - who has approved it.
Signed-off-by: Aaron Griffin <aaron@archlinux.org>
Signed-off-by: Aaron Griffin <aaron@archlinux.org>
Please use your real name and email address. Feel free to "scramble" the
address if you're afraid of spam.
* Describe your patch.
It helps if you describe the overview and goals of the patch in the git commit
It helps if you describe the overview and goals of the patch in the git commit
log. This allows others to see what you intended so as to compare it to what
was actually done, and allows better feedback.
* Use `git format-patch` to create patches.
Your commit message will be shown above the patch by default when you will use
`git-format-patch`, including the signoff line.
--
Submitting your patch
---------------------
--
* Send the patch to the pacman-dev mailing list
* Submit patches with a gitlab merge request
The mailing list is the primary queue for review and acceptance. Here you
will get feedback, and let me know the details of your patch.
The pacman gitlab instance is the primary queue for review and acceptance.
Here you will get feedback, and let the reviewers know the details of your
patch.
* No MIME, no links, no compression, no attachments. Just plain text.
Patches should be contained in the actual body of the email. There are many
reasons for this. First, it makes them easier to read with any mail reader,
it allows easier review "at a glance", and most importantly, it allows people
to comment on exact lines of the patch in reply emails.
`git send-email` allows you to send git formatted patches in plain text easily
and is the preferred method for submission to the mailing list.
--
@ -86,13 +89,9 @@ looked at it yet.
* Respond to feedback
When you do get feedback, it usually merits a response, whether this be a
resubmit of the patch with corrections or a follow-up email asking for
clarifications. When neither of these occurs, don't expect your patch to see
resubmission of the patch with corrections or a follow-up email asking for
clarifications. When neither of these occurs, don't expect your patch to get
further review. The all-volunteer staff don't have time to fix up patches that
aren't their own.
--
/////
vim: set ts=2 sw=2 syntax=asciidoc et:
/////

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

@ -0,0 +1,159 @@
Pacman - Translating
====================
This document is here to guide you in helping translate pacman messages,
libalpm messages, and the manual pages for the entire pacman package.
We are currently using https://app.transifex.com/[Transifex] as the translation
platform for pacman and libalpm. You will need to sign up for an account there
and then register with a translation team on the
https://explore.transifex.com/toofishes/archlinux-pacman/[pacman project page].
NOTE: This may be old information due to our switch to Transifex, but the
gettext website is a very useful guide to read before embarking on translation
work, as it describes many of the commands in more detail than I will here:
https://www.gnu.org/software/gettext/manual/html_node/gettext.html[].
Translating Messages
--------------------
Overview
~~~~~~~~
There are two separate message catalogs in pacman: one for the back-end
(libalpm) and one for the front-end (pacman and scripts). These correspond to
the `lib/libalpm/po` and `po` directories in the pacman source, respectively.
Translation message files are a specially formatted text file containing the
original message and the corresponding translation. These po files can then
either be hand-edited, or modified with a tool such as poedit, gtranslator or
kbabel. Using a translation tool tends to make the job easier.
Please read up on Transifex usage using the
https://help.transifex.com/[Transifex Help] if you are not familiar.
Transifex provides a command-line client to help with translations. Here is
an example set of commands if you have a source code checkout and are not
worried about any local translations being overwritten. The .tx/ directory is
checked into the git repository so is preconfigured with the two project
resources (See `tx status` output for a quick overview).
tx pull -f
poedit po/<mylang>.po
poedit lib/libalpm/po/<mylang>.po
tx push -t -l <mylang>
Or to just push one of the two available resources:
tx push -r archlinux-pacman.pacman-pot -t -l <mylang>
tx push -r archlinux-pacman.libalpm-pot -t -l <mylang>
See the <<Notes,Notes>> section for additional hints on translating.
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@lists.archlinux.org[pacman-dev]
mailing list asking for translations. An announcement in Transifex is also made,
which reaches everyone that is member of the translation team.
At this time, the latest `.po` language files will be made available at the
Transifex project page. Each language will have three files available (libalpm,
pacman and pacman-scripts). Translators interested in helping are encouraged to use the
features of Transifex to let others know they are currently translating their
language.
Once a translator has completed the translation offline (*OR* realizes they do not have
time to finish), please upload your progress back to the Transifex site.
NOTE: Please upload your translations as soon as possible - this will give other
speakers of your language time to review your translations and update them as
necessary.
Incremental Updates
~~~~~~~~~~~~~~~~~~~
If you have more advanced needs you will have to get a copy of the pacman
repository.
git clone https://gitlab.archlinux.org/pacman/pacman.git
Next, you will need to configure the build environment. From the base directory,
run:
meson setup . build
If any required dependencies are missing, please install. After that,
update the template translation (.pot) files to the latest state of
the source code by running:
meson compile -C build pacman-scripts-pot pacman-pot libalpm-pot
We need to first update the main message catalog file. Navigate into either
the `lib/libalpm/po`, `scripts/po` or `src/pacman/po` directory depending
on which translation you wish to work on first, and execute the following
command to update your specific language's translation file
(replace `lang_code` with your language code e.g. 'pt_BR', and `pot_file`
with `libalpm.pot`, `pacman.pot` or `pacman-scripts.pot`):
msgmerge --update --previous <lang_code>.po <pot_filename>.pot
At this point, you can do the translation. To submit your changes, either email
the new `.po` file to the mailing-list with *[translation]* in the subject, or
submit a Git-formatted patch (please do not include any `.pot` file changes).
As a shortcut, all translation files (including `.pot` files) can be updated
with the following command:
./build-aux/update-po
Adding a New Language
~~~~~~~~~~~~~~~~~~~~~
Making a new language is not too hard, but be sure to follow all the steps.
You will have to do the following steps in both the `lib/libalpm/po/` and `po/`
directories, substituting where appropriate. First, edit the `LINGUAS` file and
add your new language code at the bottom. Next, run the following command,
substituting `libalpm.pot` or `pacman.pot` for potfile depending on which
directory you are currently working in:
msginit -l <lang_code> -o <lang_code>.po -i <potfile>
You can then also add your language code to the end of the `LINGUAS` file
located in each po directory.
Look at the current message files for more guidance if necessary. Once you
create the new language file, you may need to slightly modify the headers;
try to make them look similar to the other .po file headers. In addition, for
all new translations we would strongly recommend using UTF-8 encoding.
Notes[[Notes]]
~~~~~~~~~~~~~~
msgid and msgstr 'variables' can be on as many lines as necessary. Line breaks
are ignored; if you need a literal line break, use an `\n` in your string. The
following two translations are equivalent:
msgstr "This is a test translation"
msgstr ""
"This is a test translation"
If you want to test the translation (copy the .po file you want to test,
you may ignore the rest), replacing `<lang_code>` accordingly:
meson compile -C build pacman-scripts-gmo pacman-gmo libalpm-gmo
cp ./build/lib/libalpm/po/<lang_code>/LC_MESSAGES/libalpm.mo /usr/share/locale/<lang_code>/LC_MESSAGES/libalpm.mo
cp ./build/scripts/po/<lang_code>/LC_MESSAGES/pacman-scripts.mo /usr/share/locale/<lang_code>/LC_MESSAGES/pacman-scripts.mo
cp ./build/src/pacman/po/<lang_code>/LC_MESSAGES/pacman.mo /usr/share/locale/<lang_code>/LC_MESSAGES/pacman.mo
Translating Manpages
--------------------
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@lists.archlinux.org[].

View file

@ -1,149 +0,0 @@
Pacman - Translating
====================
This document is here to guide you in helping translate pacman messages,
libalpm messages, and the manpages for the entire pacman package.
A quick note- the gettext website is a very useful guide to read before
embarking on translation work, as it describes many of the commands in more
detail than I will here:
http://www.gnu.org/software/gettext/manual/html_node/gettext.html[]
In addition, this site presents a small tutorial that I found useful:
http://oriya.sarovar.org/docs/gettext/[]
Translating Messages
--------------------
Overview
~~~~~~~~
There are two separate message catalogs in pacman- one for the backend
(libalpm) and one for the frontend (pacman and scripts). These correspond to
the `lib/libalpm/po` and `po` directories in the pacman source, respectively.
Translation message files are a specially formatted text file containing the
original message and the corresponding translation. These po files can then
either be hand edited, or modified with a tool such as poedit, gtranslator or
kbabel. Using a translation tool tends to make the job easier.
See the <<Notes,Notes>> section for additional hints on translating.
Pre-release Updates
~~~~~~~~~~~~~~~~~~~
A week or two before each release, the codebase will go into a string freeze
and an email will be sent by the 'translation lieutenant' to the
mailto:pacman-dev@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.
At this time, the `.po` language files will be made available at a URL
specified in the email. Each language will have two files available (backend
and frontend). Translators interested in helping are encouraged to send a
follow-up message to the mailing list stating exactly what they intend to
translate so efforts are not duplicated on the same language.
Once a translator has completed the translation (*OR* realizes they do not have
time to finish), please email the `.po` files back to the list with a subject
such as '[translation] Updated German translation'. At this point, the
'translation lieutenant' will gather the translations together for inclusion in
the upcoming release.
NOTE: Please email your translations back to the list as soon as possible- this
will give other speakers of your language time to review your translations and
update them as necessary.
For those familiar with GIT, you may wish to follow the procedure outlined
below as another alternative.
Incremental Updates
~~~~~~~~~~~~~~~~~~~
If you have more advanced needs you will have to get a copy of the pacman
repository.
git clone git://projects.archlinux.org/pacman.git pacman
Next, you will need to run `./autogen.sh` and `./configure` in the base
directory to generate the correct Makefiles. At this point, all necessary
make targets will be generated and we can begin updating the translation
files.
We need to first update the main message catalog file. Navigate into either the
`lib/libalpm/po` or `po` directory depending on which translation you wish to
work on first, and execute the following command. If you are working in the
`po/` tree, replace 'libalpm.pot' with 'pacman.pot':
make libalpm.pot-update
Next, update your specific language's translation file:
make <po file>-update
At this point, you can do the translation. To submit your changes, either email
the new `.po` file to the mailing-list with *[translation]* in the subject, or
submit a GIT-formatted patch (please do not include any `.pot` file changes).
As a shortcut, all translation files (including `.pot` files) can be updated
with the following command:
make update-po
Adding a New Language
~~~~~~~~~~~~~~~~~~~~~
Making a new language is not too hard, but be sure to follow all the steps.
You will have to do the following steps in both the `lib/libalpm/po/` and `po/`
directories, substituting where appropriate. First, edit the `LINGUAS` file and
add your new language code at the bottom. Next, run the following command,
substituting 'libalpm.pot' or 'pacman.pot' for potfile depending on which
directory you are currently working in:
msginit -l <lang code> -o <lang code>.po -i <potfile>
You can then also add your language code to the end of the `LINGUAS` file
located in each po directory.
Look at the current message files for more guidance if necessary. Once you
create the new language file, you may need to slightly modify the headers;
try to make them look similar to the other .po file headers. In addition, for
all new translations we would strongly recommend using UTF-8 encoding.
Notes[[Notes]]
~~~~~~~~~~~~~~
msgid and msgstr 'variables' can be on as many lines as necessary. Line breaks
are ignored- if you need a literal line break, use an `\n` in your string. The
following two translations are equivalent:
msgstr "This is a test translation"
msgstr ""
"This is a test translation"
If you want to test the translation (for example, the frontend one):
rm *.gmo stamp-po
make
cp <lang code>.gmo /usr/share/locale/<lang code>/LC_MESSAGES/pacman.mo
Translating Manpages
--------------------
There are currently no efforts underway to include translated manpages in the
pacman codebase. However, this is not to say translations are unwelcome. If
someone has experience with i18n manpages and how to best include them with our
source, please contact the pacman-dev mailing list at
mailto:pacman-dev@archlinux.org[].
Some community efforts have been made to translate manpages, and these can be
found in the link:http://aur.archlinux.org[AUR] (Arch User Repository). Please
check there first before undergoing a translation effort to ensure you are not
duplicating efforts.
/////
vim: set ts=2 sw=2 syntax=asciidoc et:
/////

72
doc/vercmp.8.asciidoc Normal file
View file

@ -0,0 +1,72 @@
vercmp(8)
=========
Name
----
vercmp - version comparison utility
Synopsis
--------
'vercmp' [-h] [--help] <version1> <version2>
Description
-----------
'vercmp' is used to determine the relationship between two given version
numbers. It outputs values as follows:
* < 0 : if ver1 < ver2
* = 0 : if ver1 == ver2
* > 0 : if ver1 > ver2
Version comparison operates as follows:
Alphanumeric:
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
Additionally, version strings can have an 'epoch' value defined that will
overrule any version comparison, unless the epoch values are equal. This is
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
greater than `1:3.6-1`.
Keep in mind that the 'pkgrel' is only compared if it is available on both
versions given to this tool. For example, comparing `1.5-1` and `1.5` will
yield 0; comparing `1.5-1` and `1.5-2` will yield < 0 as expected. This is
mainly for supporting versioned dependencies that do not include the 'pkgrel'.
Options
-------
*-h, \--help*::
Display summary of the available return codes. Must be the first option
specified.
Examples
--------
$ vercmp 1 2
-1
$ vercmp 2 1
1
$ vercmp 2.0-1 1.7-6
1
$ vercmp 2.0 2.0-13
0
$ vercmp 4.34 1:001
-1
See Also
--------
linkman:pacman[8], linkman:makepkg[8], linkman:libalpm[3]
include::footer.asciidoc[]

View file

@ -1,34 +0,0 @@
dist_sysconf_DATA = makepkg.conf pacman.conf
EXTRA_DIST = makepkg.conf.in pacman.conf.in
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(dist_sysconf_DATA)
#### Taken from the autoconf scripts Makefile.am ####
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-e 's|@PKGEXT[@]|$(PKGEXT)|g' \
-e 's|@SRCEXT[@]|$(SRCEXT)|g' \
-e 's|@STRIP_BINARIES[@]|$(STRIP_BINARIES)|g' \
-e 's|@STRIP_SHARED[@]|$(STRIP_SHARED)|g' \
-e 's|@STRIP_STATIC[@]|$(STRIP_STATIC)|g' \
-e 's|@CARCH[@]|$(CARCH)|g' \
-e 's|@CHOST[@]|$(CHOST)|g' \
-e 's|@ARCHSWITCH[@]|$(ARCHSWITCH)|g' \
-e 's|@CARCHFLAGS[@]|$(CARCHFLAGS)|g' \
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
$(dist_sysconf_DATA): Makefile
@echo ' ' GEN $@;
@rm -f $@ $@.tmp
@$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
@mv $@.tmp $@
makepkg.conf: $(srcdir)/makepkg.conf.in
pacman.conf: $(srcdir)/pacman.conf.in
# vim:set ts=2 sw=2 noet:

View file

@ -0,0 +1,18 @@
#!/hint/bash
#
# @sysconfdir@/makepkg.conf.d/fortran.conf
#
#########################################################################
# FORTRAN LANGUAGE SUPPORT
#########################################################################
# Flags used for the Fortran compiler, similar in spirit to CFLAGS. Read
# linkman:gfortran[1] for more details on the available flags.
#FFLAGS="-O2 -pipe"
#FCFLAGS="$FFLAGS"
# Additional compiler flags appended to `FFLAGS` and `FCFLAGS` for use in debugging. Usually
# this would include: ``-g''. Read linkman:gfortran[1] for more details on the wide
# variety of compiler flags available.
#DEBUG_FFLAGS="-g"

View file

@ -0,0 +1,17 @@
#!/hint/bash
#
# @sysconfdir@/makepkg.conf.d/rust.conf
#
#########################################################################
# RUST LANGUAGE SUPPORT
#########################################################################
# Flags used for the Rust compiler, similar in spirit to CFLAGS. Read
# linkman:rustc[1] for more details on the available flags.
#RUSTFLAGS="-C opt-level=3"
# Additional compiler flags appended to `RUSTFLAGS` for use in debugging.
# Usually this would include: ``-C debuginfo=2''. Read linkman:rustc[1] for
# more details on the available flags.
#DEBUG_RUSTFLAGS="-C debuginfo=2"

View file

@ -1,3 +1,4 @@
#!/hint/bash
#
# @sysconfdir@/makepkg.conf
#
@ -8,16 +9,25 @@
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
'http::/usr/bin/wget -c -t 3 --waitretry=3 -O %o %u'
'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate -O %o %u'
'rsync::/usr/bin/rsync -z %u %o'
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')
# Other common tools:
# /usr/bin/snarf
# /usr/bin/lftpget -c
# /usr/bin/curl
# /usr/bin/wget
#-- The package required by makepkg to download VCS sources
# Format: 'protocol::package'
VCSCLIENTS=('bzr::breezy'
'fossil::fossil'
'git::git'
'hg::mercurial'
'svn::subversion')
#########################################################################
# ARCHITECTURE, COMPILE FLAGS
@ -26,52 +36,66 @@ DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
CARCH="@CARCH@"
CHOST="@CHOST@"
#-- Exclusive: will only run on @CARCH@
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
CFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
#NPROC=2
#-- Compiler and Linker Flags
#CPPFLAGS=""
#CFLAGS="-O2 -pipe"
#CXXFLAGS="-O2 -pipe"
#LDFLAGS=""
#LTOFLAGS="-flto"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
#DEBUG_CFLAGS="-g"
#DEBUG_CXXFLAGS="-g"
#########################################################################
# BUILD ENVIRONMENT
#########################################################################
#
# Defaults: BUILDENV=(fakeroot !distcc color !ccache)
# Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign)
# A negated environment option will do the opposite of the comments below.
#
#-- fakeroot: Allow building packages as a non-root user
#-- distcc: Use the Distributed C/C++/ObjC compiler
#-- color: Colorize output messages
#-- ccache: Use ccache to cache compilation
#-- check: Run the check() function if present in the PKGBUILD
#-- sign: Generate PGP signature file
#
BUILDENV=(fakeroot !distcc color !ccache)
BUILDENV=(!distcc color !ccache check !sign)
#
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
#DISTCC_HOSTS=""
#
#-- Specify a directory for package building.
#BUILDDIR=/tmp/makepkg
#########################################################################
# GLOBAL PACKAGE OPTIONS
# These are default values for the options=() settings
#########################################################################
#
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
# 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 in STRIP_DIRS
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- 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 emptydirs zipman purge)
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto !autodeps)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
#-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(ck)
#-- Options to be used when stripping binaries. See `man strip' for details.
STRIP_BINARIES="@STRIP_BINARIES@"
#-- Options to be used when stripping shared libraries. See `man strip' for details.
@ -82,10 +106,12 @@ STRIP_STATIC="@STRIP_STATIC@"
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Directories to be searched for the strip option (if strip is specified)
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
#-- Files to be removed from all packages (if purge is specified)
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
@ -99,17 +125,37 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Log files: specify a fixed directory where all log files will be placed
#LOGDEST=/home/makepkglogs
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>"
#-- Specify a key to use for package signing
#GPGKEY=""
#########################################################################
# COMPRESSION DEFAULTS
#########################################################################
#
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -z -q -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)
#########################################################################
# EXTENSION DEFAULTS
#########################################################################
#
# WARNING: Do NOT modify these variables unless you know what you are
# doing.
#
PKGEXT='@PKGEXT@'
SRCEXT='@SRCEXT@'
# vim: set ft=sh ts=2 sw=2 et:
#########################################################################
# OTHER
#########################################################################
#
#-- Command used to run pacman as root, instead of trying sudo and su
PACMAN_AUTH=()

View file

@ -13,11 +13,11 @@
#DBPath = @localstatedir@/lib/pacman/
#CacheDir = @localstatedir@/cache/pacman/pkg/
#LogFile = @localstatedir@/log/pacman.log
#GPGDir = @sysconfdir@/pacman.d/gnupg/
#HookDir = @sysconfdir@/pacman.d/hooks/
HoldPkg = pacman glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst = pacman
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#XferCommand = /usr/bin/curl -C - %u > %o
#CleanMethod = KeepInstalled
Architecture = auto
@ -28,11 +28,20 @@ Architecture = auto
#NoUpgrade =
#NoExtract =
# Misc options (all disabled by default)
# Misc options
#UseSyslog
#ShowSize
#UseDelta
#TotalDownload
#Color
#NoProgressBar
CheckSpace
#VerbosePkgLists
ParallelDownloads = 5
#DownloadUser = alpm
#DisableSandbox
# PGP signature checking
#SigLevel = Optional
#LocalFileSigLevel = Optional
#RemoteFileSigLevel = Optional
#
# REPOSITORIES
@ -58,6 +67,7 @@ Architecture = auto
# servers immediately after the header and they will be used before the
# default mirrors.
#[core]
#SigLevel = Required
#Server = ftp://ftp.example.com/foobar/$repo/os/$arch/
# The file referenced here should contain a list of 'Server = ' lines.
#Include = @sysconfdir@/pacman.d/mirrorlist
@ -65,5 +75,5 @@ Architecture = auto
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#Server = file:///home/custompkgs
#SigLevel = Optional TrustAll
#Server = file:///home/packages

View file

@ -1,507 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-10-14.15
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# 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
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
posix_glob=
posix_mkdir=
# Desired mode of installed file.
mode=0755
chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
shift
shift
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
done
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix=/ ;;
-*) prefix=./ ;;
*) prefix= ;;
esac
case $posix_glob in
'')
if (set -f) 2>/dev/null; then
posix_glob=true
else
posix_glob=false
fi ;;
esac
oIFS=$IFS
IFS=/
$posix_glob && set -f
set fnord $dstdir
shift
$posix_glob && set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dst"; then
$doit $rmcmd -f "$dst" 2>/dev/null \
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|| {
echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
} || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -2,3 +2,4 @@
.libs
*.lo
*.la
libalpm.pc

View file

@ -1,52 +0,0 @@
AUTOMAKE_OPTIONS = gnu
SUBDIRS = po
lib_LTLIBRARIES = libalpm.la
include_HEADERS = alpm_list.h alpm.h
DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
AM_CFLAGS = -pedantic -D_GNU_SOURCE
if ENABLE_VISIBILITY_CC
if DARWIN
AM_CFLAGS += -fvisibility=hidden
else
AM_CFLAGS += -fvisibility=internal
endif
endif
if ENABLE_GNU89_INLINE_CC
AM_CFLAGS += -fgnu89-inline
endif
libalpm_la_SOURCES = \
add.h add.c \
alpm.h alpm.c \
alpm_list.h alpm_list.c \
backup.h backup.c \
be_files.c \
be_package.c \
cache.h cache.c \
conflict.h conflict.c \
db.h db.c \
delta.h delta.c \
deps.h deps.c \
dload.h dload.c \
error.c \
graph.h \
group.h group.c \
handle.h handle.c \
log.h log.c \
md5.h md5.c \
package.h package.c \
remove.h remove.c \
sync.h sync.c \
trans.h trans.c \
util.h util.c \
version.c
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
libalpm_la_LIBADD = $(LTLIBINTL)
# vim:set ts=2 sw=2 noet:

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/*
* add.h
*
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2025 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
@ -17,15 +17,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALPM_ADD_H
#define _ALPM_ADD_H
#ifndef ALPM_ADD_H
#define ALPM_ADD_H
#include "db.h"
#include "alpm_list.h"
#include "trans.h"
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db);
int _alpm_upgrade_packages(alpm_handle_t *handle);
#endif /* _ALPM_ADD_H */
/* vim: set ts=2 sw=2 noet: */
#endif /* ALPM_ADD_H */

View file

@ -1,7 +1,7 @@
/*
* alpm.c
*
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2025 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>
@ -21,70 +21,115 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#ifdef HAVE_LIBCURL
#include <curl/curl.h>
#endif
#include <errno.h>
#include <pwd.h>
/* libalpm */
#include "alpm.h"
#include "alpm_list.h"
#include "handle.h"
#include "log.h"
#include "util.h"
/* Globals */
enum _pmerrno_t pm_errno SYMEXPORT;
/** \addtogroup alpm_interface Interface Functions
* @brief Functions to initialize and release libalpm
* @{
*/
/** Initializes the library. This must be called before any other
* functions are called.
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_initialize(void)
alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
alpm_errno_t *err)
{
ASSERT(handle == NULL, RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1));
alpm_errno_t myerr;
const char *lf = "db.lck";
char *hookdir;
size_t hookdirlen, lockfilelen;
struct passwd const *pw = NULL;
alpm_handle_t *myhandle = _alpm_handle_new();
handle = _alpm_handle_new();
if(handle == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
if(myhandle == NULL) {
goto nomem;
}
if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) {
goto cleanup;
}
if((myerr = _alpm_set_directory_option(dbpath, &(myhandle->dbpath), 1))) {
goto cleanup;
}
/* to concatenate myhandle->root (ends with a slash) with SYSHOOKDIR (starts
* with a slash) correctly, we skip SYSHOOKDIR[0]; the regular +1 therefore
* disappears from the allocation */
hookdirlen = strlen(myhandle->root) + strlen(SYSHOOKDIR);
MALLOC(hookdir, hookdirlen, goto nomem);
snprintf(hookdir, hookdirlen, "%s%s", myhandle->root, &SYSHOOKDIR[1]);
myhandle->hookdirs = alpm_list_add(NULL, hookdir);
/* set default database extension */
STRDUP(myhandle->dbext, ".db", goto nomem);
lockfilelen = strlen(myhandle->dbpath) + strlen(lf) + 1;
MALLOC(myhandle->lockfile, lockfilelen, goto nomem);
snprintf(myhandle->lockfile, lockfilelen, "%s%s", myhandle->dbpath, lf);
if(_alpm_db_register_local(myhandle) == NULL) {
myerr = myhandle->pm_errno;
goto cleanup;
}
#ifdef HAVE_LIBCURL
curl_global_init(CURL_GLOBAL_ALL);
myhandle->curlm = curl_multi_init();
#endif
myhandle->parallel_downloads = 1;
/* set default sandboxuser */
ASSERT((pw = getpwuid(0)) != NULL, myerr = errno; goto cleanup);
STRDUP(myhandle->sandboxuser, pw->pw_name, goto nomem);
#ifdef ENABLE_NLS
bindtextdomain("libalpm", LOCALEDIR);
#endif
return(0);
}
return myhandle;
/** Release the library. This should be the last alpm call you make.
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_release(void)
{
ALPM_LOG_FUNC;
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(alpm_db_unregister_all() == -1) {
return(-1);
nomem:
myerr = ALPM_ERR_MEMORY;
cleanup:
_alpm_handle_free(myhandle);
if(err) {
*err = myerr;
}
_alpm_handle_free(handle);
handle = NULL;
return(0);
return NULL;
}
/** @} */
/* check current state and free all resources including storage locks */
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
{
CHECK_HANDLE(myhandle, return -1);
ASSERT(myhandle->trans == NULL, RET_ERR(myhandle, ALPM_ERR_TRANS_NOT_NULL, -1));
/** @defgroup alpm_misc Miscellaneous Functions
* @brief Various libalpm functions
*/
_alpm_handle_unlock(myhandle);
_alpm_handle_free(myhandle);
/* Get the version of library */
const char SYMEXPORT *alpm_version(void) {
return(LIB_VERSION);
return 0;
}
/* vim: set ts=2 sw=2 noet: */
const char SYMEXPORT *alpm_version(void)
{
return LIB_VERSION;
}
int SYMEXPORT alpm_capabilities(void)
{
return 0
#ifdef ENABLE_NLS
| ALPM_CAPABILITY_NLS
#endif
#ifdef HAVE_LIBCURL
| ALPM_CAPABILITY_DOWNLOADER
#endif
#ifdef HAVE_LIBGPGME
| ALPM_CAPABILITY_SIGNATURES
#endif
| 0;
}

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/*
* alpm_list.c
*
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2025 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
@ -20,32 +20,19 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
/* Note: alpm_list.{c,h} are intended to be standalone files. Do not include
* any other libalpm headers.
*/
/* libalpm */
#include "alpm_list.h"
/* check exported library symbols with: nm -C -D <lib> */
#define SYMEXPORT __attribute__((visibility("default")))
#define SYMHIDDEN __attribute__((visibility("internal")))
/**
* @addtogroup alpm_list List Functions
* @brief Functions to manipulate alpm_list_t lists.
*
* These functions are designed to create, destroy, and modify lists of
* type alpm_list_t. This is an internal list type used by libalpm that is
* publicly exposed for use by frontends if desired.
*
* @{ */
/* Allocation */
/**
* @brief Free a list, but not the contained data.
*
* @param list the list to free
*/
void SYMEXPORT alpm_list_free(alpm_list_t *list)
{
alpm_list_t *it = list;
@ -57,80 +44,77 @@ void SYMEXPORT alpm_list_free(alpm_list_t *list)
}
}
/**
* @brief Free the internal data of a list structure.
*
* @param list the list to free
* @param fn a free function for the internal data
*/
void SYMEXPORT alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
{
alpm_list_t *it = list;
while(it) {
if(fn && it->data) {
fn(it->data);
if(fn) {
while(it) {
if(it->data) {
fn(it->data);
}
it = it->next;
}
it = it->next;
}
}
/* Mutators */
/**
* @brief Add a new item to the end of the list.
*
* @param list the list to add to
* @param data the new item to be added to the list
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
{
alpm_list_t *ptr, *lp;
alpm_list_append(&list, data);
return list;
}
ptr = calloc(1, sizeof(alpm_list_t));
alpm_list_t SYMEXPORT *alpm_list_append(alpm_list_t **list, void *data)
{
alpm_list_t *ptr;
ptr = malloc(sizeof(alpm_list_t));
if(ptr == NULL) {
return(list);
return NULL;
}
ptr->data = data;
ptr->next = NULL;
/* Special case: the input list is empty */
if(list == NULL) {
if(*list == NULL) {
*list = ptr;
ptr->prev = ptr;
return(ptr);
} else {
alpm_list_t *lp = alpm_list_last(*list);
lp->next = ptr;
ptr->prev = lp;
(*list)->prev = ptr;
}
lp = alpm_list_last(list);
lp->next = ptr;
ptr->prev = lp;
list->prev = ptr;
return(list);
return ptr;
}
alpm_list_t SYMEXPORT *alpm_list_append_strdup(alpm_list_t **list, const char *data)
{
alpm_list_t *ret;
char *dup;
if((dup = strdup(data)) && (ret = alpm_list_append(list, dup))) {
return ret;
} else {
free(dup);
return NULL;
}
}
/**
* @brief Add items to a list in sorted order.
*
* @param list the list to add to
* @param data the new item to be added to the list
* @param fn the comparison function to use to determine order
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn)
{
if(!fn || !list) {
return(alpm_list_add(list, data));
return alpm_list_add(list, data);
} else {
alpm_list_t *add = NULL, *prev = NULL, *next = list;
add = calloc(1, sizeof(alpm_list_t));
add = malloc(sizeof(alpm_list_t));
if(add == NULL) {
return(list);
return list;
}
add->data = data;
@ -146,43 +130,32 @@ alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_
add->prev = list->prev; /* list != NULL */
add->next = list;
list->prev = add;
return(add);
return add;
} else if(next == NULL) { /* another special case: add last element */
add->prev = prev;
add->next = NULL;
prev->next = add;
list->prev = add;
return(list);
return list;
} else {
add->prev = prev;
add->next = next;
next->prev = add;
prev->next = add;
return(list);
return list;
}
}
}
/**
* @brief Join two lists.
* The two lists must be independent. Do not free the original lists after
* calling this function, as this is not a copy operation. The list pointers
* passed in should be considered invalid after calling this function.
*
* @param first the first list
* @param second the second list
*
* @return the resultant joined list
*/
alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
{
alpm_list_t *tmp;
if (first == NULL) {
return(second);
if(first == NULL) {
return second;
}
if (second == NULL) {
return(first);
if(second == NULL) {
return first;
}
/* tmp is the last element of the first list */
tmp = first->prev;
@ -193,28 +166,26 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
/* set the back reference to the tail */
second->prev = tmp;
return(first);
return first;
}
/**
* @brief Merge the two sorted sublists into one sorted list.
*
* @param left the first list
* @param right the second list
* @param fn comparison function for determining merge order
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right,
alpm_list_fn_cmp fn)
{
alpm_list_t *newlist, *lp;
alpm_list_t *newlist, *lp, *tail_ptr, *left_tail_ptr, *right_tail_ptr;
if (left == NULL)
if(left == NULL) {
return right;
if (right == NULL)
}
if(right == NULL) {
return left;
}
if (fn(left->data, right->data) <= 0) {
/* Save tail node pointers for future use */
left_tail_ptr = left->prev;
right_tail_ptr = right->prev;
if(fn(left->data, right->data) <= 0) {
newlist = left;
left = left->next;
}
@ -226,8 +197,8 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
newlist->next = NULL;
lp = newlist;
while ((left != NULL) && (right != NULL)) {
if (fn(left->data, right->data) <= 0) {
while((left != NULL) && (right != NULL)) {
if(fn(left->data, right->data) <= 0) {
lp->next = left;
left->prev = lp;
left = left->next;
@ -240,71 +211,98 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
lp = lp->next;
lp->next = NULL;
}
if (left != NULL) {
if(left != NULL) {
lp->next = left;
left->prev = lp;
tail_ptr = left_tail_ptr;
}
else if (right != NULL) {
else if(right != NULL) {
lp->next = right;
right->prev = lp;
tail_ptr = right_tail_ptr;
}
else {
tail_ptr = lp;
}
/* Find our tail pointer
* TODO maintain this in the algorithm itself */
lp = newlist;
while(lp && lp->next) {
lp = lp->next;
}
newlist->prev = lp;
newlist->prev = tail_ptr;
return(newlist);
return newlist;
}
/**
* @brief Sort a list of size `n` using mergesort algorithm.
*
* @param list the list to sort
* @param n the size of the list
* @param fn the comparison function for determining order
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn)
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n,
alpm_list_fn_cmp fn)
{
if (n > 1) {
alpm_list_t *left = list;
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
alpm_list_t *right = lastleft->next;
/* terminate first list */
lastleft->next = NULL;
if(n > 1) {
size_t half = n / 2;
size_t i = half - 1;
alpm_list_t *left = list, *lastleft = list, *right;
left = alpm_list_msort(left, n/2, fn);
right = alpm_list_msort(right, n - (n/2), fn);
while(i--) {
lastleft = lastleft->next;
}
right = lastleft->next;
/* tidy new lists */
lastleft->next = NULL;
right->prev = left->prev;
left->prev = lastleft;
left = alpm_list_msort(left, half, fn);
right = alpm_list_msort(right, n - half, fn);
list = alpm_list_mmerge(left, right, fn);
}
return(list);
return list;
}
/**
* @brief Remove an item from the list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param fn the comparison function for searching
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data)
alpm_list_t SYMEXPORT *alpm_list_remove_item(alpm_list_t *haystack,
alpm_list_t *item)
{
alpm_list_t *i = haystack, *tmp = NULL;
if(haystack == NULL || item == NULL) {
return haystack;
}
if(item == haystack) {
/* Special case: removing the head node which has a back reference to
* the tail node */
haystack = item->next;
if(haystack) {
haystack->prev = item->prev;
}
item->prev = NULL;
} else if(item == haystack->prev) {
/* Special case: removing the tail node, so we need to fix the back
* reference on the head node. We also know tail != head. */
if(item->prev) {
/* i->next should always be null */
item->prev->next = item->next;
haystack->prev = item->prev;
item->prev = NULL;
}
} else {
/* Normal case, non-head and non-tail node */
if(item->next) {
item->next->prev = item->prev;
}
if(item->prev) {
item->prev->next = item->next;
}
}
return haystack;
}
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack,
const void *needle, alpm_list_fn_cmp fn, void **data)
{
alpm_list_t *i = haystack;
if(data) {
*data = NULL;
}
if(needle == NULL) {
return(haystack);
return haystack;
}
while(i) {
@ -312,164 +310,103 @@ alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needl
i = i->next;
continue;
}
tmp = i->next;
if(fn(i->data, needle) == 0) {
/* we found a matching item */
if(i == haystack) {
/* Special case: removing the head node which has a back reference to
* the tail node */
haystack = i->next;
if(haystack) {
haystack->prev = i->prev;
}
i->prev = NULL;
} else if(i == haystack->prev) {
/* Special case: removing the tail node, so we need to fix the back
* reference on the head node. We also know tail != head. */
if(i->prev) {
/* i->next should always be null */
i->prev->next = i->next;
haystack->prev = i->prev;
i->prev = NULL;
}
} else {
/* Normal case, non-head and non-tail node */
if(i->next) {
i->next->prev = i->prev;
}
if(i->prev) {
i->prev->next = i->next;
}
}
haystack = alpm_list_remove_item(haystack, i);
if(data) {
*data = i->data;
}
i->data = NULL;
free(i);
i = NULL;
break;
} else {
i = tmp;
i = i->next;
}
}
return(haystack);
return haystack;
}
/**
* @brief Remove a string from a list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_remove_str(alpm_list_t *haystack,
const char *needle, char **data)
{
return(alpm_list_remove(haystack, (const void *)needle,
(alpm_list_fn_cmp)strcmp, (void **)data));
return alpm_list_remove(haystack, (const void *)needle,
(alpm_list_fn_cmp)strcmp, (void **)data);
}
/**
* @brief Create a new list without any duplicates.
*
* This does NOT copy data members.
*
* @param list the list to copy
*
* @return a new list containing non-duplicate items
*/
alpm_list_t SYMEXPORT *alpm_list_remove_dupes(const alpm_list_t *list)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
if(!alpm_list_find_ptr(newlist, lp->data)) {
newlist = alpm_list_add(newlist, lp->data);
if(alpm_list_append(&newlist, lp->data) == NULL) {
alpm_list_free(newlist);
return NULL;
}
}
lp = lp->next;
}
return(newlist);
return newlist;
}
/**
* @brief Copy a string list, including data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t SYMEXPORT *alpm_list_strdup(const alpm_list_t *list)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
newlist = alpm_list_add(newlist, strdup(lp->data));
if(alpm_list_append_strdup(&newlist, lp->data) == NULL) {
FREELIST(newlist);
return NULL;
}
lp = lp->next;
}
return(newlist);
return newlist;
}
/**
* @brief Copy a list, without copying data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t SYMEXPORT *alpm_list_copy(const alpm_list_t *list)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
newlist = alpm_list_add(newlist, lp->data);
if(alpm_list_append(&newlist, lp->data) == NULL) {
alpm_list_free(newlist);
return NULL;
}
lp = lp->next;
}
return(newlist);
return newlist;
}
/**
* @brief Copy a list and copy the data.
* Note that the data elements to be copied should not contain pointers
* and should also be of constant size.
*
* @param list the list to copy
* @param size the size of each data element
*
* @return a copy of the original list, data copied as well
*/
alpm_list_t SYMEXPORT *alpm_list_copy_data(const alpm_list_t *list,
size_t size)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
void *newdata = calloc(1, size);
void *newdata = malloc(size);
if(newdata) {
memcpy(newdata, lp->data, size);
newlist = alpm_list_add(newlist, newdata);
if(alpm_list_append(&newlist, newdata) == NULL) {
free(newdata);
FREELIST(newlist);
return NULL;
}
lp = lp->next;
} else {
FREELIST(newlist);
return NULL;
}
}
return(newlist);
return newlist;
}
/**
* @brief Create a new list in reverse order.
*
* @param list the list to copy
*
* @return a new list in reverse order
*/
alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
{
const alpm_list_t *lp;
alpm_list_t *newlist = NULL, *backup;
if(list == NULL) {
return(NULL);
return NULL;
}
lp = alpm_list_last(list);
@ -478,185 +415,157 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
list->prev = NULL;
while(lp) {
newlist = alpm_list_add(newlist, lp->data);
if(alpm_list_append(&newlist, lp->data) == NULL) {
alpm_list_free(newlist);
list->prev = backup;
return NULL;
}
lp = lp->prev;
}
list->prev = backup; /* restore tail pointer */
return(newlist);
return newlist;
}
/* Accessors */
/**
* @brief Get the first element of a list.
*
* @param list the list
*
* @return the first element in the list
*/
inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
{
if(list) {
return((alpm_list_t*)list);
} else {
return(NULL);
}
}
/**
* @brief Return nth element from list (starting from 0).
*
* @param list the list
* @param n the index of the item to find (n < alpm_list_count(list) IS needed)
*
* @return an alpm_list_t node for index `n`
*/
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, int n)
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, size_t n)
{
const alpm_list_t *i = list;
while(n--) {
i = i->next;
}
return((alpm_list_t*)i);
return (alpm_list_t *)i;
}
/**
* @brief Get the next element of a list.
*
* @param node the list node
*
* @return the next element, or NULL when no more elements exist
*/
inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
{
if(node) {
return(node->next);
return node->next;
} else {
return(NULL);
return NULL;
}
}
inline alpm_list_t SYMEXPORT *alpm_list_previous(const alpm_list_t *list)
{
if(list && list->prev->next) {
return list->prev;
} else {
return NULL;
}
}
/**
* @brief Get the last item in the list.
*
* @param list the list
*
* @return the last element in the list
*/
alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
{
if(list) {
return(list->prev);
return list->prev;
} else {
return(NULL);
return NULL;
}
}
/**
* @brief Get the data member of a list node.
*
* @param node the list node
*
* @return the contained data, or NULL if none
*/
void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
{
if(node == NULL) return(NULL);
return(node->data);
}
/* Misc */
/**
* @brief Get the number of items in a list.
*
* @param list the list
*
* @return the number of list items
*/
int SYMEXPORT alpm_list_count(const alpm_list_t *list)
size_t SYMEXPORT alpm_list_count(const alpm_list_t *list)
{
unsigned int i = 0;
size_t i = 0;
const alpm_list_t *lp = list;
while(lp) {
++i;
lp = lp->next;
}
return(i);
return i;
}
/**
* @brief Find an item in a list.
*
* @param needle the item to search
* @param haystack the list
* @param fn the comparison function for searching (!= NULL)
*
* @return `needle` if found, NULL otherwise
*/
void SYMEXPORT *alpm_list_find(const alpm_list_t *haystack, const void *needle,
alpm_list_fn_cmp fn)
{
const alpm_list_t *lp = haystack;
while(lp) {
if(lp->data && fn(lp->data, needle) == 0) {
return(lp->data);
return lp->data;
}
lp = lp->next;
}
return(NULL);
return NULL;
}
/* trivial helper function for alpm_list_find_ptr */
static int ptr_cmp(const void *p, const void *q)
{
return(p != q);
return (p != q);
}
/**
* @brief Find an item in a list.
*
* Search for the item whose data matches that of the `needle`.
*
* @param needle the data to search for (== comparison)
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle)
void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack,
const void *needle)
{
return(alpm_list_find(haystack, needle, ptr_cmp));
return alpm_list_find(haystack, needle, ptr_cmp);
}
/**
* @brief Find a string in a list.
*
* @param needle the string to search for
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
const char *needle)
{
return((char *)alpm_list_find(haystack, (const void*)needle,
(alpm_list_fn_cmp)strcmp));
return (char *)alpm_list_find(haystack, (const void *)needle,
(alpm_list_fn_cmp)strcmp);
}
int SYMEXPORT alpm_list_cmp_unsorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn)
{
const alpm_list_t *l = left;
const alpm_list_t *r = right;
int *matched;
/* short circuiting length comparison */
while(l && r) {
l = l->next;
r = r->next;
}
if(l || r) {
return 0;
}
/* faster comparison for if the lists happen to be in the same order */
while(left && fn(left->data, right->data) == 0) {
left = left->next;
right = right->next;
}
if(!left) {
return 1;
}
matched = calloc(alpm_list_count(right), sizeof(int));
if(matched == NULL) {
return -1;
}
for(l = left; l; l = l->next) {
int found = 0;
int n = 0;
for(r = right; r; r = r->next, n++) {
/* make sure we don't match the same value twice */
if(matched[n]) {
continue;
}
if(fn(l->data, r->data) == 0) {
found = 1;
matched[n] = 1;
break;
}
}
if(!found) {
free(matched);
return 0;
}
}
free(matched);
return 1;
}
/**
* @brief Find the differences between list `left` and list `right`
*
* The two lists must be sorted. Items only in list `left` are added to the
* `onlyleft` list. Items only in list `right` are added to the `onlyright`
* list.
*
* @param left the first list
* @param right the second list
* @param fn the comparison function
* @param onlyleft pointer to the first result list
* @param onlyright pointer to the second result list
*
*/
void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn,
alpm_list_t **onlyleft, alpm_list_t **onlyright)
@ -668,7 +577,7 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
return;
}
while (l != NULL && r != NULL) {
while(l != NULL && r != NULL) {
int cmp = fn(l->data, r->data);
if(cmp < 0) {
if(onlyleft) {
@ -686,13 +595,13 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
r = r->next;
}
}
while (l != NULL) {
while(l != NULL) {
if(onlyleft) {
*onlyleft = alpm_list_add(*onlyleft, l->data);
}
l = l->next;
}
while (r != NULL) {
while(r != NULL) {
if(onlyright) {
*onlyright = alpm_list_add(*onlyright, r->data);
}
@ -701,15 +610,6 @@ void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
}
/**
* @brief Find the items in list `lhs` that are not present in list `rhs`.
*
* @param lhs the first list
* @param rhs the second list
* @param fn the comparison function
*
* @return a list containing all items in `lhs` not present in `rhs`
*/
alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
const alpm_list_t *rhs, alpm_list_fn_cmp fn)
{
@ -725,9 +625,26 @@ alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
alpm_list_free(left);
alpm_list_free(right);
return(ret);
return ret;
}
/** @} */
void SYMEXPORT *alpm_list_to_array(const alpm_list_t *list, size_t n,
size_t size)
{
size_t i;
const alpm_list_t *item;
char *array;
/* vim: set ts=2 sw=2 noet: */
if(n == 0) {
return NULL;
}
array = malloc(n * size);
if(array == NULL) {
return NULL;
}
for(i = 0, item = list; i < n && item; i++, item = item->next) {
memcpy(array + i * size, item->data, size);
}
return array;
}

View file

@ -1,7 +1,7 @@
/*
* alpm_list.h
*
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2025 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
@ -17,73 +17,379 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALPM_LIST_H
#define _ALPM_LIST_H
#ifndef ALPM_LIST_H
#define ALPM_LIST_H
#include <stdlib.h> /* size_t */
/* Note: alpm_list.{c,h} are intended to be standalone files. Do not include
* any other libalpm headers.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Linked list type used by libalpm.
* @ingroup libalpm
* @addtogroup libalpm_list libalpm_list(3)
* @brief Functions to manipulate alpm_list_t lists.
*
* These functions are designed to create, destroy, and modify lists of
* type alpm_list_t. This is an internal list type used by libalpm that is
* publicly exposed for use by frontends if desired.
*
* It is exposed so front ends can use it to prevent the need to reimplement
* lists of their own; however, it is not required that the front end uses
* it.
* @{
*/
typedef struct __alpm_list_t {
/** A doubly linked list */
typedef struct _alpm_list_t {
/** data held by the list node */
void *data;
/** pointer to the previous node */
struct __alpm_list_t *prev;
struct _alpm_list_t *prev;
/** pointer to the next node */
struct __alpm_list_t *next;
struct _alpm_list_t *next;
} alpm_list_t;
/** Frees a list and its contents */
#define FREELIST(p) do { alpm_list_free_inner(p, free); alpm_list_free(p); p = NULL; } while(0)
typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */
typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */
/** item deallocation callback.
* @param item the item to free
*/
typedef void (*alpm_list_fn_free)(void * item);
/** item comparison callback */
typedef int (*alpm_list_fn_cmp)(const void *, const void *);
/* allocation */
/** Free a list, but not the contained data.
*
* @param list the list to free
*/
void alpm_list_free(alpm_list_t *list);
/** Free the internal data of a list structure but not the list itself.
*
* @param list the list to free
* @param fn a free function for the internal data
*/
void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
/* item mutators */
/** Add a new item to the end of the list.
*
* @param list the list to add to
* @param data the new item to be added to the list
*
* @return the resultant list
*/
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
/**
* @brief Add a new item to the end of the list.
*
* @param list the list to add to
* @param data the new item to be added to the list
*
* @return the newly added item
*/
alpm_list_t *alpm_list_append(alpm_list_t **list, void *data);
/**
* @brief Duplicate and append a string to a list.
*
* @param list the list to append to
* @param data the string to duplicate and append
*
* @return the newly added item
*/
alpm_list_t *alpm_list_append_strdup(alpm_list_t **list, const char *data);
/**
* @brief Add items to a list in sorted order.
*
* @param list the list to add to
* @param data the new item to be added to the list
* @param fn the comparison function to use to determine order
*
* @return the resultant list
*/
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
/**
* @brief Join two lists.
* The two lists must be independent. Do not free the original lists after
* calling this function, as this is not a copy operation. The list pointers
* passed in should be considered invalid after calling this function.
*
* @param first the first list
* @param second the second list
*
* @return the resultant joined list
*/
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
/**
* @brief Merge the two sorted sublists into one sorted list.
*
* @param left the first list
* @param right the second list
* @param fn comparison function for determining merge order
*
* @return the resultant list
*/
alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
/**
* @brief Sort a list of size `n` using mergesort algorithm.
*
* @param list the list to sort
* @param n the size of the list
* @param fn the comparison function for determining order
*
* @return the resultant list
*/
alpm_list_t *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn);
/**
* @brief Remove an item from the list.
* item is not freed; this is the responsibility of the caller.
*
* @param haystack the list to remove the item from
* @param item the item to remove from the list
*
* @return the resultant list
*/
alpm_list_t *alpm_list_remove_item(alpm_list_t *haystack, alpm_list_t *item);
/**
* @brief Remove an item from the list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param fn the comparison function for searching
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data);
/**
* @brief Remove a string from a list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t *alpm_list_remove_str(alpm_list_t *haystack, const char *needle, char **data);
/**
* @brief Create a new list without any duplicates.
*
* This does NOT copy data members.
*
* @param list the list to copy
*
* @return a new list containing non-duplicate items
*/
alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list);
/**
* @brief Copy a string list, including data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t *alpm_list_strdup(const alpm_list_t *list);
/**
* @brief Copy a list, without copying data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t *alpm_list_copy(const alpm_list_t *list);
/**
* @brief Copy a list and copy the data.
* Note that the data elements to be copied should not contain pointers
* and should also be of constant size.
*
* @param list the list to copy
* @param size the size of each data element
*
* @return a copy of the original list, data copied as well
*/
alpm_list_t *alpm_list_copy_data(const alpm_list_t *list, size_t size);
/**
* @brief Create a new list in reverse order.
*
* @param list the list to copy
*
* @return a new list in reverse order
*/
alpm_list_t *alpm_list_reverse(alpm_list_t *list);
/* item accessors */
alpm_list_t *alpm_list_first(const alpm_list_t *list);
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n);
/**
* @brief Return nth element from list (starting from 0).
*
* @param list the list
* @param n the index of the item to find (n < alpm_list_count(list) IS needed)
*
* @return an alpm_list_t node for index `n`
*/
alpm_list_t *alpm_list_nth(const alpm_list_t *list, size_t n);
/**
* @brief Get the next element of a list.
*
* @param list the list node
*
* @return the next element, or NULL when no more elements exist
*/
alpm_list_t *alpm_list_next(const alpm_list_t *list);
/**
* @brief Get the previous element of a list.
*
* @param list the list head
*
* @return the previous element, or NULL when no previous element exist
*/
alpm_list_t *alpm_list_previous(const alpm_list_t *list);
/**
* @brief Get the last item in the list.
*
* @param list the list
*
* @return the last element in the list
*/
alpm_list_t *alpm_list_last(const alpm_list_t *list);
void *alpm_list_getdata(const alpm_list_t *entry);
/* misc */
int alpm_list_count(const alpm_list_t *list);
/**
* @brief Get the number of items in a list.
*
* @param list the list
*
* @return the number of list items
*/
size_t alpm_list_count(const alpm_list_t *list);
/**
* @brief Find an item in a list.
*
* @param needle the item to search
* @param haystack the list
* @param fn the comparison function for searching (!= NULL)
*
* @return `needle` if found, NULL otherwise
*/
void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
/**
* @brief Find an item in a list.
*
* Search for the item whose data matches that of the `needle`.
*
* @param needle the data to search for (== comparison)
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
void *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle);
/**
* @brief Find a string in a list.
*
* @param needle the string to search for
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
char *alpm_list_find_str(const alpm_list_t *haystack, const char *needle);
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
/**
* @brief Check if two lists contain the same data, ignoring order.
*
* Lists are considered equal if they both contain the same data regardless
* of order.
*
* @param left the first list
* @param right the second list
* @param fn the comparison function
*
* @return 1 if the lists are equal, 0 if not equal, -1 on error.
*/
int alpm_list_cmp_unsorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn);
/**
* @brief Find the differences between list `left` and list `right`
*
* The two lists must be sorted. Items only in list `left` are added to the
* `onlyleft` list. Items only in list `right` are added to the `onlyright`
* list.
*
* @param left the first list
* @param right the second list
* @param fn the comparison function
* @param onlyleft pointer to the first result list
* @param onlyright pointer to the second result list
*
*/
void alpm_list_diff_sorted(const alpm_list_t *left, const alpm_list_t *right,
alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright);
/**
* @brief Find the items in list `lhs` that are not present in list `rhs`.
*
* @param lhs the first list
* @param rhs the second list
* @param fn the comparison function
*
* @return a list containing all items in `lhs` not present in `rhs`
*/
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
/**
* @brief Copy a list and data into a standard C array of fixed length.
* Note that the data elements are shallow copied so any contained pointers
* will point to the original data.
*
* @param list the list to copy
* @param n the size of the list
* @param size the size of each data element
*
* @return an array version of the original list, data copied as well
*/
void *alpm_list_to_array(const alpm_list_t *list, size_t n, size_t size);
/* End of alpm_list */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* _ALPM_LIST_H */
/* vim: set ts=2 sw=2 noet: */
#endif /* ALPM_LIST_H */

View file

@ -1,7 +1,7 @@
/*
* backup.c
*
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2025 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>
@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
@ -32,82 +30,71 @@
#include "log.h"
#include "util.h"
/* split a backup string "file\thash" into two strings : file and hash */
static int backup_split(const char *string, char **file, char **hash)
/* split a backup string "file\thash" into the relevant components */
int _alpm_split_backup(const char *string, alpm_backup_t **backup)
{
char *str = strdup(string);
char *ptr;
char *str, *ptr;
STRDUP(str, string, return -1);
/* tab delimiter */
ptr = strchr(str, '\t');
ptr = str ? strchr(str, '\t') : NULL;
if(ptr == NULL) {
if(file) {
*file = str;
} else {
/* don't need our dup as the fname wasn't requested, so free it */
FREE(str);
}
return(0);
(*backup)->name = str;
(*backup)->hash = NULL;
return 0;
}
*ptr = '\0';
ptr++;
/* now str points to the filename and ptr points to the hash */
if(file) {
*file = strdup(str);
}
if(hash) {
*hash = strdup(ptr);
}
STRDUP((*backup)->name, str, FREE(str); return -1);
STRDUP((*backup)->hash, ptr, FREE((*backup)->name); FREE(str); return -1);
FREE(str);
return(1);
return 0;
}
char *_alpm_backup_file(const char *string)
{
char *file = NULL;
backup_split(string, &file, NULL);
return(file);
}
char *_alpm_backup_hash(const char *string)
{
char *hash = NULL;
backup_split(string, NULL, &hash);
return(hash);
}
/* Look for a filename in a pmpkg_t.backup list. If we find it,
* then we return the md5 hash (parsed from the same line)
/* Look for a filename in a alpm_pkg_t.backup list. If we find it,
* then we return the full backup entry.
*/
char *_alpm_needbackup(const char *file, const alpm_list_t *backup)
alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg)
{
const alpm_list_t *lp;
ALPM_LOG_FUNC;
if(file == NULL || backup == NULL) {
return(NULL);
if(file == NULL || pkg == NULL) {
return NULL;
}
/* run through the backup list and parse out the hash for our file */
for(lp = backup; lp; lp = lp->next) {
char *filename = NULL;
char *hash = NULL;
for(lp = alpm_pkg_get_backup(pkg); lp; lp = lp->next) {
alpm_backup_t *backup = lp->data;
/* no hash found */
if(!backup_split((char *)lp->data, &filename, &hash)) {
FREE(filename);
continue;
if(strcmp(file, backup->name) == 0) {
return backup;
}
if(strcmp(file, filename) == 0) {
FREE(filename);
return(hash);
}
FREE(filename);
FREE(hash);
}
return(NULL);
return NULL;
}
/* vim: set ts=2 sw=2 noet: */
void _alpm_backup_free(alpm_backup_t *backup)
{
ASSERT(backup != NULL, return);
FREE(backup->name);
FREE(backup->hash);
FREE(backup);
}
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
{
alpm_backup_t *newbackup;
CALLOC(newbackup, 1, sizeof(alpm_backup_t), return NULL);
STRDUP(newbackup->name, backup->name, goto error);
STRDUP(newbackup->hash, backup->hash, goto error);
return newbackup;
error:
free(newbackup->name);
free(newbackup);
return NULL;
}

View file

@ -1,7 +1,7 @@
/*
* backup.h
*
* Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2025 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
@ -17,15 +17,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALPM_BACKUP_H
#define _ALPM_BACKUP_H
#ifndef ALPM_BACKUP_H
#define ALPM_BACKUP_H
#include "alpm_list.h"
#include "alpm.h"
char *_alpm_backup_file(const char *string);
char *_alpm_backup_hash(const char *string);
char *_alpm_needbackup(const char *file, const alpm_list_t *backup);
int _alpm_split_backup(const char *string, alpm_backup_t **backup);
alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg);
void _alpm_backup_free(alpm_backup_t *backup);
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup);
#endif /* _ALPM_BACKUP_H */
/* vim: set ts=2 sw=2 noet: */
#endif /* ALPM_BACKUP_H */

196
lib/libalpm/base64.c Normal file
View file

@ -0,0 +1,196 @@
/*
* RFC 1521 base64 encoding/decoding
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* 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/>.
*/
/*
* Pacman Notes:
*
* Taken from the PolarSSL project at www.polarssl.org under terms of the
* GPL. This is from version 0.14.2 of the library, and has been modified
* as following, which may be helpful for future updates:
* * remove "polarssl/config.h" include
* * change include from "polarssl/base64.h" to "base64.h"
* * removal of SELF_TEST code
*/
#include <stdint.h>
#include "base64.h"
#if 0
static const unsigned char base64_enc_map[64] =
{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', '+', '/'
};
#endif
static const unsigned char base64_dec_map[128] =
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 62, 127, 127, 127, 63, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 127, 127,
127, 64, 127, 127, 127, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 127, 127, 127, 127, 127, 127, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 127, 127, 127, 127, 127
};
#if 0
/*
* Encode a buffer into base64 format
*/
int base64_encode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen )
{
size_t i, n;
int C1, C2, C3;
unsigned char *p;
if( slen == 0 )
return( 0 );
n = (slen << 3) / 6;
switch( (slen << 3) - (n * 6) )
{
case 2: n += 3; break;
case 4: n += 2; break;
default: break;
}
if( *dlen < n + 1 )
{
*dlen = n + 1;
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
}
n = (slen / 3) * 3;
for( i = 0, p = dst; i < n; i += 3 )
{
C1 = *src++;
C2 = *src++;
C3 = *src++;
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
*p++ = base64_enc_map[(((C2 & 15) << 2) + (C3 >> 6)) & 0x3F];
*p++ = base64_enc_map[C3 & 0x3F];
}
if( i < slen )
{
C1 = *src++;
C2 = ((i + 1) < slen) ? *src++ : 0;
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
if( (i + 1) < slen )
*p++ = base64_enc_map[((C2 & 15) << 2) & 0x3F];
else *p++ = '=';
*p++ = '=';
}
*dlen = p - dst;
*p = 0;
return( 0 );
}
#endif
/*
* Decode a base64-formatted buffer
*/
int base64_decode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen )
{
size_t i, n;
uint32_t j, x;
unsigned char *p;
for( i = j = n = 0; i < slen; i++ )
{
if( ( slen - i ) >= 2 &&
src[i] == '\r' && src[i + 1] == '\n' )
continue;
if( src[i] == '\n' )
continue;
if( src[i] == '=' && ++j > 2 )
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
if( src[i] > 127 || base64_dec_map[src[i]] == 127 )
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
if( base64_dec_map[src[i]] < 64 && j != 0 )
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
n++;
}
if( n == 0 )
return( 0 );
n = ((n * 6) + 7) >> 3;
if( *dlen < n )
{
*dlen = n;
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
}
for( j = 3, n = x = 0, p = dst; i > 0; i--, src++ )
{
if( *src == '\r' || *src == '\n' )
continue;
j -= ( base64_dec_map[*src] == 64 );
x = (x << 6) | ( base64_dec_map[*src] & 0x3F );
if( ++n == 4 )
{
n = 0;
if( j > 0 ) *p++ = (unsigned char)( x >> 16 );
if( j > 1 ) *p++ = (unsigned char)( x >> 8 );
if( j > 2 ) *p++ = (unsigned char)( x );
}
}
*dlen = p - dst;
return( 0 );
}

72
lib/libalpm/base64.h Normal file
View file

@ -0,0 +1,72 @@
/**
* \file base64.h
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* 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/>.
*/
#ifndef BASE64_H
#define BASE64_H
#include <string.h>
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010 /**< Output buffer too small. */
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012 /**< Invalid character in input. */
#if 0
/**
* \brief Encode a buffer into base64 format
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be encoded
*
* \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
* *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_encode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen );
#endif
/**
* \brief Decode a base64-formatted buffer
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be decoded
*
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
* correct. *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_decode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen );
#endif /* base64.h */

View file

@ -1,979 +0,0 @@
/*
* be_files.c
*
* Copyright (c) 2006 by Christian Hamar <krics@linuxforum.hu>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.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/>.
*/
#include "config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdint.h> /* intmax_t */
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
#include <time.h>
#include <limits.h> /* PATH_MAX */
#include <locale.h> /* setlocale */
/* libarchive */
#include <archive.h>
#include <archive_entry.h>
/* libalpm */
#include "db.h"
#include "alpm_list.h"
#include "cache.h"
#include "log.h"
#include "util.h"
#include "alpm.h"
#include "handle.h"
#include "package.h"
#include "delta.h"
#include "deps.h"
#include "dload.h"
static int checkdbdir(pmdb_t *db)
{
struct stat buf;
const char *path = _alpm_db_path(db);
if(stat(path, &buf) != 0) {
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
path);
if(_alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, -1);
}
} else if(!S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_WARNING, _("removing invalid database: %s\n"), path);
if(unlink(path) != 0 || _alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, -1);
}
}
return(0);
}
/* create list of directories in db */
static int dirlist_from_tar(const char *archive, alpm_list_t **dirlist)
{
struct archive *_archive;
struct archive_entry *entry;
if((_archive = archive_read_new()) == NULL)
RET_ERR(PM_ERR_LIBARCHIVE, -1);
archive_read_support_compression_all(_archive);
archive_read_support_format_all(_archive);
if(archive_read_open_filename(_archive, archive,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive,
archive_error_string(_archive));
RET_ERR(PM_ERR_PKG_OPEN, -1);
}
while(archive_read_next_header(_archive, &entry) == ARCHIVE_OK) {
const struct stat *st;
const char *entryname; /* the name of the file in the archive */
st = archive_entry_stat(entry);
entryname = archive_entry_pathname(entry);
if(S_ISDIR(st->st_mode)) {
char *name = strdup(entryname);
*dirlist = alpm_list_add(*dirlist, name);
}
}
archive_read_finish(_archive);
*dirlist = alpm_list_msort(*dirlist, alpm_list_count(*dirlist), _alpm_str_cmp);
return(0);
}
/* create list of directories in db */
static int dirlist_from_fs(const char *syncdbpath, alpm_list_t **dirlist)
{
DIR *dbdir;
struct dirent *ent = NULL;
struct stat sbuf;
char path[PATH_MAX];
dbdir = opendir(syncdbpath);
if (dbdir != NULL) {
while((ent = readdir(dbdir)) != NULL) {
char *name = ent->d_name;
size_t len;
char *entry;
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
continue;
}
/* stat the entry, make sure it's a directory */
snprintf(path, PATH_MAX, "%s%s", syncdbpath, name);
if(stat(path, &sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
continue;
}
len = strlen(name);
MALLOC(entry, len + 2, RET_ERR(PM_ERR_MEMORY, -1));
strcpy(entry, name);
entry[len] = '/';
entry[len+1] = '\0';
*dirlist = alpm_list_add(*dirlist, entry);
}
closedir(dbdir);
}
*dirlist = alpm_list_msort(*dirlist, alpm_list_count(*dirlist), _alpm_str_cmp);
return(0);
}
/* remove old directories from dbdir */
static int remove_olddir(const char *syncdbpath, alpm_list_t *dirlist)
{
alpm_list_t *i;
for (i = dirlist; i; i = i->next) {
const char *name = i->data;
char *dbdir;
size_t len = strlen(syncdbpath) + strlen(name) + 2;
MALLOC(dbdir, len, RET_ERR(PM_ERR_MEMORY, -1));
snprintf(dbdir, len, "%s%s", syncdbpath, name);
_alpm_log(PM_LOG_DEBUG, "removing: %s\n", dbdir);
if(_alpm_rmrf(dbdir) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not remove database directory %s\n"), dbdir);
free(dbdir);
RET_ERR(PM_ERR_DB_REMOVE, -1);
}
free(dbdir);
}
return(0);
}
/** Update a package database
*
* An update of the package database \a db will be attempted. Unless
* \a force is true, the update will only be performed if the remote
* database was modified since the last update.
*
* A transaction is necessary for this operation, in order to obtain a
* database lock. During this transaction the front-end will be informed
* of the download progress of the database via the download callback.
*
* Example:
* @code
* pmdb_t *db;
* int result;
* db = alpm_list_getdata(alpm_option_get_syncdbs());
* if(alpm_trans_init(0, NULL, NULL, NULL) == 0) {
* result = alpm_db_update(0, db);
* alpm_trans_release();
*
* if(result > 0) {
* printf("Unable to update database: %s\n", alpm_strerrorlast());
* } else if(result < 0) {
* printf("Database already up to date\n");
* } else {
* printf("Database updated\n");
* }
* }
* @endcode
*
* @ingroup alpm_databases
* @note After a successful update, the \link alpm_db_get_pkgcache()
* package cache \endlink will be invalidated
* @param force if true, then forces the update, otherwise update only in case
* the database isn't up to date
* @param db pointer to the package database to update
* @return 0 on success, > 0 on error (pm_errno is set accordingly), < 0 if up
* to date
*/
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
{
char *dbfile, *dbfilepath;
const char *dbpath, *syncdbpath;
alpm_list_t *newdirlist = NULL, *olddirlist = NULL;
alpm_list_t *onlynew = NULL, *onlyold = NULL;
size_t len;
int ret;
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
/* Verify we are in a transaction. This is done _mainly_ because we need a DB
* lock - if we update without a db lock, we may kludge some other pacman
* process that _has_ a lock.
*/
ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
len = strlen(db->treename) + strlen(DBEXT) + 1;
MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfile, "%s" DBEXT, db->treename);
dbpath = alpm_option_get_dbpath();
ret = _alpm_download_single_file(dbfile, db->servers, dbpath, force);
free(dbfile);
if(ret == 1) {
/* files match, do nothing */
pm_errno = 0;
return(1);
} else if(ret == -1) {
/* pm_errno was set by the download code */
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerrorlast());
return(-1);
}
syncdbpath = _alpm_db_path(db);
/* form the path to the db location */
len = strlen(dbpath) + strlen(db->treename) + strlen(DBEXT) + 1;
MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfilepath, "%s%s" DBEXT, dbpath, db->treename);
if(force) {
/* if forcing update, remove the old dir and extract the db */
if(_alpm_rmrf(syncdbpath) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not remove database %s\n"), db->treename);
RET_ERR(PM_ERR_DB_REMOVE, -1);
} else {
_alpm_log(PM_LOG_DEBUG, "database dir %s removed\n", _alpm_db_path(db));
}
} else {
/* if not forcing, only remove and extract what is necessary */
ret = dirlist_from_tar(dbfilepath, &newdirlist);
if(ret) {
goto cleanup;
}
ret = dirlist_from_fs(syncdbpath, &olddirlist);
if(ret) {
goto cleanup;
}
alpm_list_diff_sorted(olddirlist, newdirlist, _alpm_str_cmp, &onlyold, &onlynew);
ret = remove_olddir(syncdbpath, onlyold);
if(ret) {
goto cleanup;
}
}
/* Cache needs to be rebuilt */
_alpm_db_free_pkgcache(db);
checkdbdir(db);
ret = _alpm_unpack(dbfilepath, syncdbpath, onlynew, 0);
cleanup:
FREELIST(newdirlist);
FREELIST(olddirlist);
alpm_list_free(onlynew);
alpm_list_free(onlyold);
free(dbfilepath);
if(ret) {
RET_ERR(PM_ERR_SYSTEM, -1);
}
return(0);
}
static int splitname(const char *target, pmpkg_t *pkg)
{
/* the format of a db entry is as follows:
* package-version-rel/
* package name can contain hyphens, so parse from the back- go back
* two hyphens and we have split the version from the name.
*/
char *tmp, *p, *q;
if(target == NULL || pkg == NULL) {
return(-1);
}
STRDUP(tmp, target, RET_ERR(PM_ERR_MEMORY, -1));
p = tmp + strlen(tmp);
/* do the magic parsing- find the beginning of the version string
* by doing two iterations of same loop to lop off two hyphens */
for(q = --p; *q && *q != '-'; q--);
for(p = --q; *p && *p != '-'; p--);
if(*p != '-' || p == tmp) {
return(-1);
}
/* copy into fields and return */
if(pkg->version) {
FREE(pkg->version);
}
STRDUP(pkg->version, p+1, RET_ERR(PM_ERR_MEMORY, -1));
/* insert a terminator at the end of the name (on hyphen)- then copy it */
*p = '\0';
if(pkg->name) {
FREE(pkg->name);
}
STRDUP(pkg->name, tmp, RET_ERR(PM_ERR_MEMORY, -1));
free(tmp);
return(0);
}
int _alpm_db_populate(pmdb_t *db)
{
int count = 0;
struct dirent *ent = NULL;
struct stat sbuf;
char path[PATH_MAX];
const char *dbpath;
DIR *dbdir;
ALPM_LOG_FUNC;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
dbpath = _alpm_db_path(db);
dbdir = opendir(dbpath);
if(dbdir == NULL) {
return(0);
}
while((ent = readdir(dbdir)) != NULL) {
const char *name = ent->d_name;
pmpkg_t *pkg;
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
continue;
}
/* stat the entry, make sure it's a directory */
snprintf(path, PATH_MAX, "%s%s", dbpath, name);
if(stat(path, &sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
continue;
}
pkg = _alpm_pkg_new();
if(pkg == NULL) {
closedir(dbdir);
return(-1);
}
/* split the db entry name */
if(splitname(name, pkg) != 0) {
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
name);
_alpm_pkg_free(pkg);
continue;
}
/* duplicated database entries are not allowed */
if(_alpm_pkg_find(db->pkgcache, pkg->name)) {
_alpm_log(PM_LOG_ERROR, _("duplicated database entry '%s'\n"), pkg->name);
_alpm_pkg_free(pkg);
continue;
}
/* explicitly read with only 'BASE' data, accessors will handle the rest */
if(_alpm_db_read(db, pkg, INFRQ_BASE) == -1) {
_alpm_log(PM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
_alpm_pkg_free(pkg);
continue;
}
pkg->origin = PKG_FROM_CACHE;
pkg->origin_data.db = db;
/* add to the collection */
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
pkg->name, db->treename);
db->pkgcache = alpm_list_add(db->pkgcache, pkg);
count++;
}
closedir(dbdir);
db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
return(count);
}
/* Note: the return value must be freed by the caller */
static char *get_pkgpath(pmdb_t *db, pmpkg_t *info)
{
size_t len;
char *pkgpath;
const char *dbpath;
dbpath = _alpm_db_path(db);
len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3;
MALLOC(pkgpath, len, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(pkgpath, "%s%s-%s/", dbpath, info->name, info->version);
return(pkgpath);
}
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
char line[513];
int sline = sizeof(line)-1;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
if(info == NULL || info->name == NULL || info->version == NULL) {
_alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_db_read, skipping\n");
return(-1);
}
if(info->origin == PKG_FROM_FILE) {
_alpm_log(PM_LOG_DEBUG, "request to read database info for a file-based package '%s', skipping...\n", info->name);
return(-1);
}
/* bitmask logic here:
* infolevel: 00001111
* inforeq: 00010100
* & result: 00000100
* == to inforeq? nope, we need to load more info. */
if((info->infolevel & inforeq) == inforeq) {
/* already loaded this info, do nothing */
return(0);
}
_alpm_log(PM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
memset(line, 0, sline+1);
pkgpath = get_pkgpath(db, info);
if(access(pkgpath, F_OK)) {
/* directory doesn't exist or can't be opened */
_alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
info->name, info->version, db->treename);
goto error;
}
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
if(fgets(line, 256, fp) == NULL) {
break;
}
_alpm_strtrim(line);
if(strcmp(line, "%NAME%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
if(strcmp(_alpm_strtrim(line), info->name) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
if(strcmp(_alpm_strtrim(line), info->version) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%FILENAME%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
STRDUP(info->filename, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%DESC%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
STRDUP(info->desc, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%GROUPS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->groups = alpm_list_add(info->groups, linedup);
}
} else if(strcmp(line, "%URL%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
STRDUP(info->url, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%LICENSE%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->licenses = alpm_list_add(info->licenses, linedup);
}
} else if(strcmp(line, "%ARCH%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
STRDUP(info->arch, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%BUILDDATE%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
_alpm_strtrim(line);
char first = tolower((unsigned char)line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->builddate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
info->builddate = atol(line);
}
} else if(strcmp(line, "%INSTALLDATE%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
_alpm_strtrim(line);
char first = tolower((unsigned char)line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->installdate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
info->installdate = atol(line);
}
} else if(strcmp(line, "%PACKAGER%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
STRDUP(info->packager, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%REASON%") == 0) {
if(fgets(line, sline, fp) == NULL) {
goto error;
}
info->reason = (pmpkgreason_t)atol(_alpm_strtrim(line));
} else if(strcmp(line, "%SIZE%") == 0 || strcmp(line, "%CSIZE%") == 0) {
/* NOTE: the CSIZE and SIZE fields both share the "size" field
* in the pkginfo_t struct. This can be done b/c CSIZE
* is currently only used in sync databases, and SIZE is
* only used in local databases.
*/
if(fgets(line, sline, fp) == NULL) {
goto error;
}
info->size = atol(_alpm_strtrim(line));
/* also store this value to isize if isize is unset */
if(info->isize == 0) {
info->isize = info->size;
}
} else if(strcmp(line, "%ISIZE%") == 0) {
/* ISIZE (installed size) tag only appears in sync repositories,
* not the local one. */
if(fgets(line, sline, fp) == NULL) {
goto error;
}
info->isize = atol(_alpm_strtrim(line));
} else if(strcmp(line, "%MD5SUM%") == 0) {
/* MD5SUM tag only appears in sync repositories,
* not the local one. */
if(fgets(line, sline, fp) == NULL) {
goto error;
}
STRDUP(info->md5sum, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%REPLACES%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->replaces = alpm_list_add(info->replaces, linedup);
}
} else if(strcmp(line, "%FORCE%") == 0) {
info->force = 1;
}
}
fclose(fp);
fp = NULL;
}
/* FILES */
if(inforeq & INFRQ_FILES) {
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(fgets(line, 256, fp)) {
_alpm_strtrim(line);
if(strcmp(line, "%FILES%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->files = alpm_list_add(info->files, linedup);
}
} else if(strcmp(line, "%BACKUP%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->backup = alpm_list_add(info->backup, linedup);
}
}
}
fclose(fp);
fp = NULL;
}
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
fgets(line, 255, fp);
_alpm_strtrim(line);
if(strcmp(line, "%DEPENDS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
pmdepend_t *dep = _alpm_splitdep(_alpm_strtrim(line));
info->depends = alpm_list_add(info->depends, dep);
}
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->optdepends = alpm_list_add(info->optdepends, linedup);
}
} else if(strcmp(line, "%CONFLICTS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->conflicts = alpm_list_add(info->conflicts, linedup);
}
} else if(strcmp(line, "%PROVIDES%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->provides = alpm_list_add(info->provides, linedup);
}
}
}
fclose(fp);
fp = NULL;
}
/* DELTAS */
if(inforeq & INFRQ_DELTAS) {
snprintf(path, PATH_MAX, "%sdeltas", pkgpath);
if((fp = fopen(path, "r"))) {
while(!feof(fp)) {
fgets(line, 255, fp);
_alpm_strtrim(line);
if(strcmp(line, "%DELTAS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
pmdelta_t *delta = _alpm_delta_parse(line);
if(delta) {
info->deltas = alpm_list_add(info->deltas, delta);
}
}
}
}
fclose(fp);
fp = NULL;
}
}
/* INSTALL */
if(inforeq & INFRQ_SCRIPTLET) {
snprintf(path, PATH_MAX, "%sinstall", pkgpath);
if(access(path, F_OK) == 0) {
info->scriptlet = 1;
}
}
/* internal */
info->infolevel |= inforeq;
free(pkgpath);
return(0);
error:
free(pkgpath);
if(fp) {
fclose(fp);
}
return(-1);
}
int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info)
{
mode_t oldmask;
int retval = 0;
char *pkgpath = NULL;
if(checkdbdir(db) != 0) {
return(-1);
}
oldmask = umask(0000);
pkgpath = get_pkgpath(db, info);
if((retval = mkdir(pkgpath, 0755)) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s\n"),
pkgpath, strerror(errno));
}
free(pkgpath);
umask(oldmask);
return(retval);
}
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
mode_t oldmask;
alpm_list_t *lp = NULL;
int retval = 0;
int local = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL || info == NULL) {
return(-1);
}
pkgpath = get_pkgpath(db, info);
/* make sure we have a sane umask */
oldmask = umask(0022);
if(strcmp(db->treename, "local") == 0) {
local = 1;
}
/* DESC */
if(inforeq & INFRQ_DESC) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
fprintf(fp, "%%NAME%%\n%s\n\n"
"%%VERSION%%\n%s\n\n", info->name, info->version);
if(info->desc) {
fprintf(fp, "%%DESC%%\n"
"%s\n\n", info->desc);
}
if(info->groups) {
fputs("%GROUPS%\n", fp);
for(lp = info->groups; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->replaces) {
fputs("%REPLACES%\n", fp);
for(lp = info->replaces; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(local) {
if(info->force) {
fprintf(fp, "%%EPOCH%%\n"
"1\n\n");
}
if(info->url) {
fprintf(fp, "%%URL%%\n"
"%s\n\n", info->url);
}
if(info->licenses) {
fputs("%LICENSE%\n", fp);
for(lp = info->licenses; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->arch) {
fprintf(fp, "%%ARCH%%\n"
"%s\n\n", info->arch);
}
if(info->builddate) {
fprintf(fp, "%%BUILDDATE%%\n"
"%ld\n\n", info->builddate);
}
if(info->installdate) {
fprintf(fp, "%%INSTALLDATE%%\n"
"%ld\n\n", info->installdate);
}
if(info->packager) {
fprintf(fp, "%%PACKAGER%%\n"
"%s\n\n", info->packager);
}
if(info->isize) {
/* only write installed size, csize is irrelevant once installed */
fprintf(fp, "%%SIZE%%\n"
"%jd\n\n", (intmax_t)info->isize);
}
if(info->reason) {
fprintf(fp, "%%REASON%%\n"
"%u\n\n", info->reason);
}
} else {
if(info->size) {
fprintf(fp, "%%CSIZE%%\n"
"%jd\n\n", (intmax_t)info->size);
}
if(info->isize) {
fprintf(fp, "%%ISIZE%%\n"
"%jd\n\n", (intmax_t)info->isize);
}
if(info->md5sum) {
fprintf(fp, "%%MD5SUM%%\n"
"%s\n\n", info->md5sum);
}
}
fclose(fp);
fp = NULL;
}
/* FILES */
if(local && (inforeq & INFRQ_FILES)) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
if(info->files) {
fprintf(fp, "%%FILES%%\n");
for(lp = info->files; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->backup) {
fprintf(fp, "%%BACKUP%%\n");
for(lp = info->backup; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
fclose(fp);
fp = NULL;
}
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DEPENDS information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
if(info->depends) {
fputs("%DEPENDS%\n", fp);
for(lp = info->depends; lp; lp = lp->next) {
char *depstring = alpm_dep_compute_string(lp->data);
fprintf(fp, "%s\n", depstring);
free(depstring);
}
fprintf(fp, "\n");
}
if(info->optdepends) {
fputs("%OPTDEPENDS%\n", fp);
for(lp = info->optdepends; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->conflicts) {
fputs("%CONFLICTS%\n", fp);
for(lp = info->conflicts; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->provides) {
fputs("%PROVIDES%\n", fp);
for(lp = info->provides; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
fclose(fp);
fp = NULL;
}
/* INSTALL */
/* nothing needed here (script is automatically extracted) */
cleanup:
umask(oldmask);
free(pkgpath);
if(fp) {
fclose(fp);
}
return(retval);
}
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info)
{
int ret = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL || info == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
pkgpath = get_pkgpath(db, info);
ret = _alpm_rmrf(pkgpath);
free(pkgpath);
if(ret != 0) {
ret = -1;
}
return(ret);
}
/* vim: set ts=2 sw=2 noet: */

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