Commit Graph

1028 Commits

Author SHA1 Message Date
Dave Reisner b1bb2eaa50 paccache: adopt size_to_human
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:46 -05:00
Dave Reisner a98fce0896 scripts/library: add size_to_human
This function is the reverse of human_to_size, and converts integer byte
sizes to human readable SI prefixed values.

A logical extension of this might be to mimic the formatter that pacman
uses and allow a second argument to be passed in which can coerce the
size, rather than reducing until the unit count is below 1024.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:34 -05:00
Dave Reisner ab8431c929 pkgdelta: use human_to_size to parse --min-pkg-size
Update the documentation accordingly to mention that users can expect
huamn readable sizes to be acceptable.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:28 -05:00
Dave Reisner b58489d29a scripts/library: add human_to_size
This is a bash wrapper around an awk function that parses human readable
sizes and returns their representative values in bytes, as a string. A
small test harness is added to validate the functionality.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-25 23:39:12 -05:00
Allan McRae e253968b4d repo-add: add checkdepends information
Similar to the case for makedepends, it is useful to be able to
access this information without parsing a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:08:15 -05:00
Allan McRae 81dd6ddf0c makepkg: install deps with --repackage
I have noticed that quite a number of packages fail with "makepkg -R"
when their (make)dependencies are not installed. Adjust makepkg to
check for dependencies when used with -R.  This can still be avoided
by using --nodeps/-d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:08:08 -05:00
Jeremy Huntwork d310b6f85c Allow wildcards in PURGE_TARGETS to match any type of file except for directories.
Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
2012-06-25 23:07:49 -05:00
Allan McRae 3a24e44206 makepkg: allow url to be overridden in split packages
This is already being used (despite not working...) in packages
in the Arch Linux repos.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:07:03 -05:00
Jeremy Huntwork 19c2347507 Portability fixes for makepkg
Allow makepkg to work correctly when used with find from busybox.
Fix handling of cross directory symlinks.

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:06:43 -05:00
Dave Reisner 7245bc8e8e pkgdelta: add missing --version longopt
This was missed in the switch to parseopts, and was caught by distcheck.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:02:05 -05:00
Allan McRae 1d32934769 Create repo-remove symlink in scripts dir
Fix the creation of the repo-remove symlink in the scripts/ dir
on building.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:00:41 -05:00
Allan McRae 9a76a458b8 makepkg: rework libdepends
Rewrite the handling of libdepends. The primary advantage are:
 - Moves functionality from write_pkginfo() to find_libdepends().
 - The order of the depends array in the PKGBUILD is kept in the package.
 - An unneeded libdepends is only a warning and not an error. This allows
   putting a libdepend on a library that is dlopened.
 - It is now modular so can be extended to library types other than
   ELF *.so.
 - Finding the list of libraries a package depends only occurs when a
   libdepend is specified in the depends array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-05-20 19:04:38 -05:00
Allan McRae 81bc390dc1 repo-add: add makedepends information
This is useful for tools that automatically rebuild packages and
thus require to generate a build order. These entries are skipped
by pacman.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 19:03:43 -05:00
Allan McRae 18e0a97209 makepkg: write makedepends into .PKGINFO
Currently there is no way to access the makedepends for a package
apart from parsing its PKGBUILD. Put these into the .PKGINFO file
with the idea of making them available in the repo dbs so that
automated build tools can readily determine build order.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 19:00:42 -05:00
Allan McRae 8abef73ba9 makepkg: Add CPPFLAGS support
Add CPPFLAGS support in addition to the current CFLAGS and CXXFLAGS.
This keeps compiler flags split up in the same logical way done
everywhere else.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 18:58:17 -05:00
Dan McGee 9f6a67fee7 Merge branch 'maint'
Conflicts:
	scripts/pacman-key.sh.in
2012-05-20 17:41:21 -05:00
Dave Reisner fc9002188b pacman-key: use mapfile over read
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-20 17:39:21 -05:00
Dave Reisner 9d3e59e311 makepkg: use mapfile where plausible
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-20 17:39:21 -05:00
Dave Reisner ceb2362209 pkgdelta: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:38:33 -05:00
Dave Reisner 5de465d63e pacman-key: test for content in keyring files
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 d1240f67ea.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 17:35:31 -05:00
Dan McGee 26abe8f600 Fix gettext usage in pkgdelta help instructions
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 11:27:36 -05:00
Dan McGee 2671581123 Update pacman-scripts message catalog
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 11:22:51 -05:00
Dan McGee 9e2078b179 pacman-key: clarify messages, s/keychain/keyring/
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-04 15:01:53 -05:00
Allan McRae 9d9c12e4e2 makepkg: fix package arch detection
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-30 20:48:59 -05:00
Florian Pritz 678bdfb0d0 pkgdelta/repo-add: quoting fixes
Finish the job on master; most of these were applied to maint already.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-04-29 21:56:57 -05:00
Dan McGee 8c7202ca19 Merge remote-tracking branch 'dave/buildsys' 2012-04-29 20:27:32 -05:00
Dave Reisner 9dd42dc0da makepkg: remove subshelling from check_option and friends
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-29 20:26:27 -05:00
Dave Reisner 8a9c666a8c makepkg: null terminate filenames to strip
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-29 20:26:11 -05:00
Dave Reisner 953415c86a rankmirrors: move to contrib/
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-24 20:33:08 -04:00
Allan McRae 242411a1b4 makepkg: Be more consistent with missing program message
Also prevent "sudo" and "su" from being translated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:59 -05:00
Allan McRae 22050f18f4 makepkg: treat list of packages to be installed as an array
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:54 -05:00
Allan McRae d38a1c02db makepkg: deal with overriden package arch properly
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-24 08:54:49 -05:00
Dave Reisner 03acea832a validate bash scripts with 'bash -n' during build.
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-24 09:54:06 -04:00
Dave Reisner b2a2a98297 pacman-key: lookup keys before receiving
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-24 08:46:13 -05:00
Dan McGee ca4f8687f7 Merge branch 'maint'
Conflicts:
	scripts/repo-add.sh.in
2012-04-24 08:44:11 -05:00
Dave Reisner 2d0a00b409 pacman-key: allow verification of multiple sig files
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-24 08:38:36 -05:00
Dave Reisner 00ab01e634 scripts/library: remove parse_options
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-24 08:38:36 -05:00
Dave Reisner 62dbf7ec43 scripts: avoid dumping usage on parser fail
Avoid letting the error message from parseopts get lost in the usage
output from pacman-key and makepkg (which is already verbose).
2012-04-24 08:38:36 -05:00
Dave Reisner f61f075b1c pacman-key: adopt parseopts for option parsing
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-24 08:38:36 -05:00
Dave Reisner 3f9cf8471f makepkg: allow specifying --pkg multiple times
Make this option additive, so that the following two operations are
equivalent:

  makepkg --pkg foo --pkg bar
  makepkg --pkg foo,bar
2012-04-24 08:38:36 -05:00
Dave Reisner d85c71865e makepkg: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner 8679cd68d8 scripts/library: introduce parseopts
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-24 08:38:36 -05:00
Dave Reisner 5f71570ec4 makepkg: restrict allowed characters in pkgname
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 18:14:45 -05:00
Florian Pritz 133d174e60 pkgdelta/repo-add: quoting fixes
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-20 18:03:54 -05:00
Florian Pritz 839953f111 pkgdelta: implement requirments for delta generation
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-20 18:00:06 -05:00
Florian Pritz 70d425c1d3 pkgdelta: rework option/argument parser
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 17:59:57 -05:00
Allan McRae 31091963ed makepkg: save and restore shopts when sourcing /etc/profile
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-08 21:52:42 -05:00
Dave Reisner 468270ce4f makepkg: complain when the buildfile isn't writeable
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-08 21:52:32 -05:00
Dave Reisner 8fe6791928 makepkg: catch errors sourcing files
create source_safe() function which temporarily disables extglob and
exits on error.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:26 -05:00
Dave Reisner dca10b062f makepkg: restrict usage of errexit to user functions
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-08 21:52:16 -05:00