Commit graph

6531 commits

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