Commit Graph

4922 Commits

Author SHA1 Message Date
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 1eb6a9cbfe configure: avoid linking against libssl
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-24 08:34:17 -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
Dave Reisner 0fc5aea027 contrib: remove pactree make rule
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-19 22:59:45 -05:00
Dave Reisner b9fc709c55 contrib: remove wget-xdelta from gitignore
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-19 22:59:30 -05:00
Dan McGee d7b728591a Merge branch 'maint' 2012-04-12 08:57:26 -05:00
Dan McGee 6a8e50a69e Remove SyncFirst option
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-12 08:55:49 -05:00
Dan McGee ded66fbb62 Fix issues with unintialized variable value usage
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-09 00:46:54 -05:00
Allan McRae 8fb1948cd0 Add more warning flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-09 00:03:32 -05:00
Dan McGee c27a946769 Fix a signed overflow error on i686 with GCC 4.7.0
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-08 22:32:49 -05:00
Dan McGee d158dde30c Merge remote-tracking branch 'dave/buildsys'
Oh god, what are we thinking thinking merging this. Hopefully this works with
only a few follow-up patches necessary.
2012-04-08 21:55:30 -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
Dan McGee 3a82885348 Merge branch 'maint' 2012-04-08 21:51:24 -05:00
Dave Reisner ca090e10d2 pacman-key: avoid use of tempfile in verify_sig
Use --status-fd rather than --status-file to keep this contained in a
pipeline.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:46:15 -05:00
Dan McGee b729ed0109 Add a new configure option for excessive compiler warning flags
This adds a bunch of warning flags to the list used when compiling.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 22:28:45 -04:00
Dan McGee a8a1b093eb Various tweaks to support building with excessive GCC warning flags
This fixes a bunch of small issues in order to enable a clean
successful build with a crazy number of GCC warning flags. A lot of
these changes are covered by -Wshadow, -Wformat-security, and
-Wstrict-overflow=5.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner ec91133e38 autoclean.sh: abide by POSIX shebang
Avoid non-POSIX brace expansion and rely on find to locate and destroy
files outside the root.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner 30ca48df4c buildsys: move autotools bloat to build-aux
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner 4b95967bd0 buildsys: move acinclude.m4 to m4/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner 5f77402577 buildsys: cleanup libtool and autoconf initialization
- Use LT_INIT over AC_PROG_LIBTOOL, as the latter is a deprecated alias
  for the former.
- Remove redundant macros which are called implicitly by LT_INIT.
- Remove unneeded AC_PROG_CXX call (we don't use c++ anywhere)
- Add AC_CONFIG_MACRO_DIR([m4]) -- not strictly necessary, but added for
  consistency with autogen.sh and Makefile.am

ref: http://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner 793eff3704 buildsys: define warning CFLAGS in separate var
Continue the trend of not touching the environment CFLAGS, ensuring that
the user always has the final say.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner 7fcb445f35 buildsys: use AC_DEFINE for CYGWIN macro
Instead of directly modifying CFLAGS, use config.h for its intended
purpose.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:45 -04:00
Dave Reisner cb5b66367d buildsys: cleanup gpgme compile time check
- handle gpgme libs and cflags separately rather than appending to
  CFLAGS and LDFLAGS
- be consistent in AC_LINK_IFELSE check for gpgme 1.3.0 (though this is
  irrelephant since we don't actually run)
- be consistent with usage of "have" and "with" variables (this
  actually ends up reducing SLOC)
- when voluntary detection fails, unset GPGME_CFLAGS and GPGME_LIBS
- when requested support fails the version check, complain about the min
  version.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 22:28:41 -04:00
Dave Reisner b2226ed11b buildsys: use pkg-config for libcurl detection
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner 059c572ca5 buildsys: use pkg-config for libarchive detection
This also introduces a versioned dependency of >=2.8.0.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner c5d951846d buildsys: use pkg-config for openssl detection
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner bcfc2155a0 buildsys: add pkg-config m4 macros
We'll need these for a small revamp to library detection.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 18:48:31 -04:00
Dave Reisner f053141c87 pacman-key: verify TRUST_ULTIMATE keys as good
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-08 17:43:53 -05:00
Dave Reisner 569876f930 makepkg: treat lib{provides,depends} returns as proper arrays
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-08 17:42:47 -05:00
Dave Reisner ecd6eddf13 makepkg: use proper array addition in libdeps
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:42:37 -05:00
Dave Reisner 87c4fb51a4 makepkg: add missing newline from libprovides output
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-08 17:41:02 -05:00
Florian Pritz 62e8812fb9 repo-remove: remove deltas file if it becomes empty
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:30:56 -05:00
Allan McRae 3be02aa27c Prefix alpm_pkgfrom_t members with ALPM_
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:29:55 -05:00
Dan McGee 42d408e0c2 Return more useful error codes on package open failures
Failure isn't always due to the package file location not existing;
permission issues can also play a part on something like a FUSE-based
filesystem inaccessible to root.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:29:11 -05:00
Allan McRae cb5ae428b6 Check minimum required gpgme version
We use interfaces first introduced in gpgme-1.3.0 so test we have
at least that version.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:28:28 -05:00
Allan McRae b5043dd6c3 Make selecting scriptlet shell work
The initial patch to implement this achieved nothing apart from
adding a configure option.  This patch makes that configure option
do what it advertises.

Note that specifing any shell apart from /bin/sh causes testsuite
failures as /bin/sh is the only shell in the testing environment.

Bug-found-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:56 -05:00
Allan McRae 923214497f makepkg: safely change directories
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-07 11:27:39 -05:00
Allan McRae 1917c845f7 makepkg: use printf rather than echo to output variable
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-07 11:27:23 -05:00
Allan McRae d11192c73a makepkg: the rhs in string comparisons should be quoted
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:08 -05:00
Matthew Monaco bb71d254e2 makepkg: devel_check(): cleanup for hg version
Use pushd/popd, quote args, handle some more errors
2012-04-07 11:26:44 -05:00