summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2018-07-19Revert "makepkg: use the `declare` builtin when backing up variables to eval"Allan McRae
This reverts commit 9e52a36794552b77ecf26f7f34b226d096978f1e. 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-06-18makepkg: don't print per-pkgname debug packagesEli Schwartz
In commit 9a4d61622066d5d30c649f1c958b26526a4ceddf 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-18Fix signing of debug packagesAllan McRae
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-18makepkg: fix initialization when extracting arraysDave Reisner
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-18Add missing sha224 sums in man page and lintingmorganamilo
Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-06-18makepkg: fix erroneous $BUILDDIR when $startdir is not an absolute pathEli Schwartz
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-18makepkg: Don't use parameterless returnJan Alexander Steffens (heftig)
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-18makepkg: fix the --nocolor option being broken when passed to pacman -UEli Schwartz
In commit 8ff03868a37b1f9c447784ae2fd639a49e426399 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-18makepkg: Clear ERR trap before trying to restore itJan Alexander Steffens (heftig)
$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-18libmakepkg/lint_pkgbuild: squelch syntax error when a pkgname is emptyEli Schwartz
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-18makepkg: do not chmod $BUILDDIR itself after checking for its existenceEli Schwartz
In commit d8717a6a9666ec80c8645d190d6f9c7ab73084ac 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-18libmakepkg/lint_pkgbuild: permit versioned optdependsEli Schwartz
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-18libmakepkg: when checking for write permissions, handle pre-existing dirsEli Schwartz
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-18makepkg: remove unused variable forgotten when moving to parseoptsEli Schwartz
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-18makepkg: update help text to describe --packagelist's new behaviorEli Schwartz
In commit d8591dd3418d55c5736022ef003891fc03b953e0 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-05-28Pull updated translations from TransifexAllan McRae
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-16Fix using run_pacman to invoke -Qi with sudoEli Schwartz
In commit 5698d7b66daa2a0bc99cab7a989cef1c806c3bf6 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-15Pull translations from Transifex and regenerateAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14Remove all modelines from the projectEli Schwartz
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-12libmakepkg: Support file 5.33's application/x-pie-executableJan Alexander Steffens (heftig)
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-12util/pkgbuild: fix broken indentationAndrew Gregory
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12Fix regression that broke repo-add aborting on failuresEli Schwartz
In commit cb0f2bd0385f447e045e2b2aab9ffa55df3c2d8a the changes from commit 81d233b79345d05d5bf17a4b2844085e14f9ee36 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-12libmakepkg/integrity: determine what is a signature preferring local filenameEli Schwartz
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-12bash_completion.in - consider option "-n --native" in operation "-Q --query"Simon Linden
Signed-off-by: Simon Linden <xhi2018@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-12Append architecture information to 'installed' elements in .BUILDINFORobin Broda
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-12Add pkgarch to .BUILDINFORobin Broda
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-12libmakepkg: don't save/set/restore extglob in bash [[ testsEli Schwartz
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-12libmakepkg: only save the shellopts we needEli Schwartz
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-12libmakepkg/lint_pkgbuild: fix regression in linting ↵Eli Schwartz
depends=(foo=$epoch:$pkgver-$pkgrel) In commit 91b72cc386ca03241791748da5da2b150c724ace 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-12remove unneeded break argument from option parsingRafael Ascensão
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-04-30makepkg: Fix listing of uninstalled depsAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29Initial translation preparation for pacman-5.1Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29Import updated translations from TransifexAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-04-29Update POTFILES.inAllan McRae
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-29libmakepkg/lint_pkgbuild: lint depends/etc. as if they are pkgnameEli Schwartz
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-29libmakepkg/util/pkgbuild.sh: fix missing extglobEli Schwartz
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-03-18makepkg --packagelist: fix listing debug packages with makepkg.confEli Schwartz
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-15makepkg: use the `declare` builtin when backing up variables to evalEli Schwartz
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-15libmakepkg: Add basic rules to lint makepkg.conf variablesEli Schwartz
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-15libmakepkg/integrity: fix regression that broke --installEli Schwartz
In commit c6b04c04653ba9933fe978829148312e412a9ea7 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-15makepkg: avoid false "Signing package(s)" msg when signing is disabledEli Schwartz
Followup on c6b04c04653ba9933fe978829148312e412a9ea7 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-14makepkg: refactor checking for write permissions into a utility functionEli Schwartz
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-14Added gpg-agent.conf to disable the gnupg scdaemonEric Renfro via pacman-dev
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-14Update coyrights for 2018Allan McRae
make update-copyright OLD=2017 NEW=201 Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14makepkg: set umask 0022 again after syncing depsFelix Glaser
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-14Fix linting of whitespace in pkgverRikard Falkeborn
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-14makepkg: use localized date stringsYen Chi Hsuan
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-14makepkg --packagelist: just list the built package files we will buildEli Schwartz
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-01-19pacman-key: do not set a default keyserverEli Schwartz
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-19Fix usage of install_packageEli Schwartz
In commit ab2be5794de8a57426ec3fc0f631cc766a0b8227 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>