summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2012-05-20Merge branch 'maint'Dan McGee
Conflicts: scripts/pacman-key.sh.in
2012-05-20pacman-key: use mapfile over readDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-20makepkg: use mapfile where plausibleDave Reisner
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-20pkgdelta: adopt parseopts for option parsingDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20pacman-key: test for content in keyring filesDave Reisner
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 d1240f67eab6. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20Fix gettext usage in pkgdelta help instructionsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20Update pacman-scripts message catalogDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-04pacman-key: clarify messages, s/keychain/keyring/Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-30makepkg: fix package arch detectionAllan McRae
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-29pkgdelta/repo-add: quoting fixesFlorian Pritz
Finish the job on master; most of these were applied to maint already. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-04-29Merge remote-tracking branch 'dave/buildsys'Dan McGee
2012-04-29makepkg: remove subshelling from check_option and friendsDave Reisner
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-29makepkg: null terminate filenames to stripDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24rankmirrors: move to contrib/Dave Reisner
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-24makepkg: Be more consistent with missing program messageAllan McRae
Also prevent "sudo" and "su" from being translated. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24makepkg: treat list of packages to be installed as an arrayAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24makepkg: deal with overriden package arch properlyAllan McRae
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-24validate bash scripts with 'bash -n' during build.Dave Reisner
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-24pacman-key: lookup keys before receivingDave Reisner
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-24Merge branch 'maint'Dan McGee
Conflicts: scripts/repo-add.sh.in
2012-04-24pacman-key: allow verification of multiple sig filesDave Reisner
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-24scripts/library: remove parse_optionsDave Reisner
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-24scripts: avoid dumping usage on parser failDave Reisner
Avoid letting the error message from parseopts get lost in the usage output from pacman-key and makepkg (which is already verbose).
2012-04-24pacman-key: adopt parseopts for option parsingDave Reisner
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-24makepkg: allow specifying --pkg multiple timesDave Reisner
Make this option additive, so that the following two operations are equivalent: makepkg --pkg foo --pkg bar makepkg --pkg foo,bar
2012-04-24makepkg: adopt parseopts for option parsingDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24scripts/library: introduce parseoptsDave Reisner
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-20makepkg: restrict allowed characters in pkgnameDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20pkgdelta/repo-add: quoting fixesFlorian Pritz
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-20pkgdelta: implement requirments for delta generationFlorian Pritz
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-20pkgdelta: rework option/argument parserFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08makepkg: save and restore shopts when sourcing /etc/profileAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-08makepkg: complain when the buildfile isn't writeableDave Reisner
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-08makepkg: catch errors sourcing filesDave Reisner
create source_safe() function which temporarily disables extglob and exits on error. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08makepkg: restrict usage of errexit to user functionsDave Reisner
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-08Merge branch 'maint'Dan McGee
2012-04-08pacman-key: avoid use of tempfile in verify_sigDave Reisner
Use --status-fd rather than --status-file to keep this contained in a pipeline. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08pacman-key: verify TRUST_ULTIMATE keys as goodDave Reisner
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-08makepkg: treat lib{provides,depends} returns as proper arraysDave Reisner
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-08makepkg: use proper array addition in libdepsDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08makepkg: add missing newline from libprovides outputDave Reisner
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-07repo-remove: remove deltas file if it becomes emptyFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07makepkg: safely change directoriesAllan McRae
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-07makepkg: use printf rather than echo to output variableAllan McRae
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-07makepkg: the rhs in string comparisons should be quotedAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07makepkg: devel_check(): cleanup for hg versionMatthew Monaco
Use pushd/popd, quote args, handle some more errors
2012-04-07makepkg: devel_check(): set newpkgver (cleanup)Matthew Monaco
The case structure allows the syntax to focus on what's actually being done here.
2012-04-07makepkg: devel_check(): consolidate common codeMatthew Monaco
2012-04-07makepkg: devel_check(): determine vcsMatthew Monaco
Rather than prioritizing an arbitrary VCS, collect all development directives. If there is more than one, give a warning and abort.
2012-04-07makepkg: remove unused variableMatthew Monaco
Signed-off-by: Dan McGee <dan@archlinux.org>