Commit Graph

6326 Commits

Author SHA1 Message Date
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