Commit graph

6550 commits

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