summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2012-04-29Convert ALLOC_FAIL macro into a functionDan McGee4-8/+13
This path is rarely (read: never) taken in any normal run of the code, so injecting the fprintf() call everywhere with the macro is a bit overkill. Instead, add a lightweight _alpm_alloc_fail() function that gets called instead. This does have a reasonable effect on the size of the generated code; most places using the macros provided by util.c have their code size reduced. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29be_local: use the right length value for filename in all casesDan McGee1-2/+3
Increment the strlen() provided value by 1 for the NULL byte so we use the right value in all three places we later reference it. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29pkgdelta/repo-add: quoting fixesFlorian Pritz1-1/+1
Finish the job on master; most of these were applied to maint already. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-04-29Output "Packages" instead of "Targets"Allan McRae1-1/+1
Prefix the list of packages being installed/removed with "Packages" instead of "Targets" as they are package names by this stage. Fixes FS#23123. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29Merge remote-tracking branch 'dave/buildsys'Dan McGee16-72/+141
2012-04-29makepkg: remove subshelling from check_option and friendsDave Reisner1-58/+79
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 Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-29pacman/package.c: show checksums with -SiiDave Reisner1-1/+8
These were removed entirely by f34864cc9e, but some people (myself included) still find them useful. Revive these details, but "demote" them, so that they're only displayed when extra sync data is requested. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29Move short-lived realpath buffers to the stackDan McGee2-6/+2
There is little reason here to grab 4K from the heap only to return it a few lines later. Instead, just use the stack to hold the returned value saving ourselves the malloc/free cycle. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-25libalpm: add pkg-config fileDave Reisner4-0/+17
No one seems to do this "correctly", but for the sake of having an easy method of detecting the presence and version of libalpm on a given system, we provide a straightforward .pc file. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24Pointer coding style cleanupsDan McGee3-3/+3
'foo_type_t *variable' rather than 'foo_type_t* variable'. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24be_local: write all single-valued attributes firstDan McGee1-18/+20
There isn't a whole lot of reason other than code clarity for this, but it makes it a bit more obvious where multivalued attributes start. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24util/testdb: don't return crazy error valuesDan McGee1-4/+4
With some contrived examples, you could easily make testdb return a very high error count, which could easily overflow the 8-bit unsigned integer limit. Instead, simply return 1 or 0 based on whether errors were found. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24Split check steps in Makefile into multiple targetsDan McGee2-3/+15
This allows a `make -j4 check` invocation to actually run in parallel, even though 95% of our test suite time is currently dominated by pactest. It also allows running something like `make test-vercmp`. Also, add some targets to the .PHONY list that belong in it. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24rankmirrors: move to contrib/Dave Reisner5-6/+5
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 McRae1-1/+1
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 McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24makepkg: deal with overriden package arch properlyAllan McRae1-18/+33
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-24paccache: adopt parseopts for options parsingDave Reisner2-48/+73
Add longopts and update usage. This removes the TODO item and incorporates --help/--version into the standard option set. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24configure: require bash >= 4.1 at compile timeDave Reisner1-1/+17
We've unofficially agreed to raise our minimum supported bash version to 4.1, and since added features that require it. Additionally, an earlier commit adds a syntax check to the builds of scripts/ and contrib/ which could conceivably fail with an earlier shell. Therefore, make this a hard requirement of the build process. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24validate bash scripts with 'bash -n' during build.Dave Reisner2-0/+2
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-24contrib: rename bash scripts: .in -> .sh.inDave Reisner8-16/+15
For consistency with the scripts/ directory, ensure that all bash scripts use the same pre-build suffix. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24contrib: use a separate build rule for bash scriptsDave Reisner1-3/+14
Treat bash scripts separately from the others to allow for a different build rule, which is reused from the scripts/ subdir. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24pacman-key: lookup keys before receivingDave Reisner1-1/+40
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 McGee7-74/+143
Conflicts: scripts/repo-add.sh.in
2012-04-24Merge branch 'parse-opts'Dan McGee14-259/+505
2012-04-24makepkg.8: remove bold from --pkg's optargDave Reisner1-1/+1
Keep this in line with the rest of the manpages. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24pacman-key: allow verification of multiple sig filesDave Reisner2-6/+11
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 Reisner4-114/+1
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-24bash_completion: update for changes to pacman-keyDave Reisner1-5/+30
- only do file completion for options which expect files - add completion for possible key ids when a relevant operation is in COMPWORDS. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24scripts: avoid dumping usage on parser failDave Reisner2-2/+2
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 Reisner3-120/+135
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 Reisner2-2/+2
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 Reisner3-15/+16
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24scripts/library: introduce parseoptsDave Reisner8-2/+315
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-24configure: avoid linking against libsslDave Reisner1-1/+1
We're not linking to libssl, only libcrypto. -Wl,--as-needed will get rid of this, but there's no sense in checking for and linking against a library we don't need. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20makepkg: restrict allowed characters in pkgnameDave Reisner2-2/+8
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20pkgdelta/repo-add: quoting fixesFlorian Pritz2-48/+48
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 Pritz2-4/+60
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 Pritz1-18/+27
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-19contrib: remove pactree make ruleDave Reisner1-1/+0
This is a vestige leftover from the rewrite over a year ago in 622e7fdd4. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-19contrib: remove wget-xdelta from gitignoreDave Reisner1-1/+0
I removed this in ff713a51 over a year ago. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-12Merge branch 'maint'Dan McGee2-7/+8
2012-04-12Remove SyncFirst optionDan McGee11-268/+1
This has outlived its usefulness and causes more problems than it solves. It has historically only ever been used to install pacman first. That should not be needed given we provide the vercmp utility (which has no library dependencies) and so calling pacman in install scripts is a sign of poor packaging. Work-duplicated-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-09Fix issues with unintialized variable value usageDan McGee2-7/+8
Detected by clang scan-build static code analyzer. * Don't attempt to free an uninitialized gpgme key variable * Initialize answer variable before asking frontend a question * Pass by reference instead of value if uninitialized fields are possible in download signal handler code * Ensure we never call strlen() on NULL payload->remote_name value Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-09Add more warning flagsAllan McRae1-0/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-08Fix a signed overflow error on i686 with GCC 4.7.0Dan McGee1-4/+6
Not sure why this one wasn't showing up on x86_64, but this fixes the compile on i686. diskspace.c: In function 'calculate_removed_size': diskspace.c:247:4: error: assuming signed overflow does not occur when negating a division [-Werror=strict-overflow] cc1: all warnings being treated as errors Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08Merge remote-tracking branch 'dave/buildsys'Dan McGee24-343/+335
Oh god, what are we thinking thinking merging this. Hopefully this works with only a few follow-up patches necessary.
2012-04-08makepkg: save and restore shopts when sourcing /etc/profileAllan McRae1-0/+4
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-08makepkg: complain when the buildfile isn't writeableDave Reisner1-7/+7
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>