Commit Graph

3900 Commits

Author SHA1 Message Date
Dan McGee 11fb9c7674 Merge branch 'maint'
Conflicts:
	lib/libalpm/trans.c
	src/pacman/query.c
2011-05-19 17:17:32 -05:00
Dan McGee f2c4e7e552 Coding style cleanups; add a null check
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-19 16:59:53 -05:00
Dan McGee ba467779bb Ensure --print doesn't enable --noconfirm when not expected
This is at best a hack around the way we currently do our --print magic,
but at least prevents someone from shooting themselves in the foot as
indicated in FS#24287.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:52:49 -05:00
Dan McGee aec60e3782 Fix segfault when uninstalling broken backed-up symlink
Issue FS#24230. If a symlink is broken and included in the removal
process of a package, we blew up and segfaulted due to
alpm_compute_md5sum() returning NULL and then performing a strcmp()
operation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:50:13 -05:00
Dan McGee 93f02f5793 Add test for FS#24230, dead backup symlink removal
This currently causes a segfault, which is bad news.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:32:33 -05:00
Dan McGee 3000b6b473 pactest: treat symlinks with more respect
Don't call os.stat() when we should be using os.lstat(); this allows us
to actually test dead symlinks that don't have a corresponding file. Add
a new LINK_EXIST rule that complements FILE_EXIST for a similar purpose.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 11:31:26 -05:00
Dan McGee ac6f6b317a Transifex updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 10:19:21 -05:00
Dave Reisner b9a2318bec trans.c: create transaction prior to checking DB version
The addition of the DB version check introduces a lag time between the
lockfile creation and the transaction initialization. In cases where the
local DB is large enough and/or the user's disk is slow enough, this
time is significant enough that its possible for a user to send a SIGINT
and leave behind a db.lck file.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16 10:16:13 -05:00
Dan McGee 70cf4546d6 Don't balk on .sig files being invalid in package cache
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-10 17:39:22 -05:00
Dan McGee 2cd79bc853 Remove sync DB reregister check
It's your own damn fault if you do this, and this code is remnants from
an old time when we weren't very good at coding.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 15:26:19 -05:00
Dan McGee dd95c96b8a Rework config parsing to reduce variable duplication
This removes the need to strdup() the section name at every decent into
an Include statement, as well as having duplicate DB pointers around
that are never used independently.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 15:16:52 -05:00
Dan McGee 0fbdfd02dc Refactor VerifySig option value parsing into standalone method
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 15:01:35 -05:00
Dan McGee 6b308d89f9 Merge branch 'maint' 2011-05-05 13:25:10 -05:00
Dan McGee f2d696cd51 Don't null-check handle lists before setting
This needlessly prevents the easiest way available of clearing any of these
values. We can also do the same for the 'arch' value.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:46:42 -05:00
Dan McGee 42ab639bf7 Improve database server API
Currently we have one call that has all sorts of crazy behavior and doesn't
make a whole lot of sense. Go from one method to the normal four methods we
have for all of our other lists we use in the library to make it a lot
easier for a frontend to manipulate server lists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:31:09 -05:00
Dan McGee b14c5477e5 Ensure populate error return codes are consistent
It must be -1 to differentiate it from a number of packages loaded
count.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:10:51 -05:00
Dan McGee 3045f09ef4 Logging changes during DB load
The switch from FUNCTION to DEBUG was ill-advised inside the local
database load. Instead, add a DEBUG level logger to both local and sync
database loads that shows the number of packages processed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 12:08:59 -05:00
Dan McGee 73c74355ab Make config parsing a two-part affair
This ensures we call any alpm_option type functions before registering
databases, making sure all paths and other defaults (e.g. sig
verification levels) have been set first. This will ensure we can
continue to allow crazy config files where [options] doesn't come first.

The diffstat on this commit is misleading; view with
-w/--ignore-all-space to get a better idea of what needed to be touched.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 11:48:12 -05:00
Dan McGee bda208f823 Move parseconfig to conf.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 11:12:49 -05:00
Dan McGee d360153bc6 pactest: run with root in /tmp and clean up automatically
This moves the generated root/ directory into /tmp, or at least a path
returned by tempfile.mkdtemp(), by default. This can make test runs
significantly faster if done when /tmp is a tmpfs.

If you are debugging a failed test, use the new --keep-root option to
not clean up and pactest will print the location of the generated root/
test directory.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 11:12:26 -05:00
Dan McGee 47de7973fd dload: ensure we return success if we found files on any mirror
We were erroring out in the case where a first (possibly bogus) mirror
would cause the download process to return a failure code, even though
subsequent servers had the file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05 10:01:01 -05:00
Allan McRae 500a6f576d Dan broke my patch
Add a missing space.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-05-05 11:12:46 +10:00
Dan McGee 73553e60ec Fix incorrect memory allocation assignment
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 16:46:52 -05:00
Dan McGee 22b1338390 dload: make sure we never print a bogus error buffer
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 16:29:41 -05:00
Dan McGee 991bfb7cbf Merge branch 'maint' 2011-05-04 15:54:42 -05:00
Allan McRae 7680f46157 Deal with unused function parameters correctly
This started off removing the "(void)foo" hacks to work around
unused function parameters and ended up fixing every warning
generated by -Wunused-parameter.

Dan: rename to UNUSED.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:53:49 -05:00
Dan McGee c4fccfe3e6 pactree: make -Wwrite-strings friendly
Use a few structs to hold configuration values we change given certain
options so we can be const-correct with string assignment across the
board. Behavior should be completely unchanged.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:49:47 -05:00
Dan McGee e8a40526cb Fix warnings reported by -Wwrite-strings
These are places where we stuck a string constant in a variable not
marked as const.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:48:47 -05:00
Dan McGee c03faa32f3 Reduce duplicate signing debug code and fix logic condition
We had a lot of similar looking code that we can collapse down into a
function. This also fixes errors seen when turning on some gcc warnings
and implicitly casting away the const-ness of the string. Free the list
when we are done with it as well.

Also, fix a logic error where we should be checking with &&, not ||.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 15:46:18 -05:00
Allan McRae 8fd9037cfd makepkg: quote variable that may contain spaces
Prevents failures when $PKGDEST contains spaces (FS#24002)

Patch-by: Sebastien Duthil
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-02 10:04:36 -05:00
Allan McRae 9a127d8ed4 Update PKGBUILD example
Add quotes around $srcdir/$pkgdir (FS#23960) and use a package()
function.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-02 10:04:13 -05:00
Dan McGee 4758cfe33f Merge branch 'maint' 2011-04-29 16:05:59 -05:00
Dan McGee da24324e2d Transifex updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-29 16:04:13 -05:00
Matt Mooney 3ec723ddc7 pacman(8): grammar correction for relative clauses
Change "which" to "that" when used in a restrictive clause.
Replace usage of the relative prounoun "those" with a common noun for
added clarity.

Signed-off-by: Matt Mooney <mfm@muteddisk.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-29 15:58:59 -05:00
Matt Mooney 1b25cb80ba pacman(8): change "options" to "operation" when referring to -D
-D is an operation not an option.

Signed-off-by: Matt Mooney <mfm@muteddisk.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-04-29 15:58:32 -05:00
Dan McGee 9c552272e8 configure: add output showing what libraries will be used
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-27 16:59:08 -05:00
Dan McGee 97be2f0e0a Allow conditional compilation with GPGME
This makes it possible to omit usage of -lgpgme, just as we can do for
-lcurl and -lcrypto.

Thanks to Rémy Oudompheng for an initial stab at this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-27 16:58:58 -05:00
Dan McGee b7b3fc2386 signing: add more detail to unexpected signature count error
Do a quick loop and count of the returned data so we can show how many
signatures were parsed and read.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:50:06 -05:00
Dan McGee 1d7ad5d24b Enhance GPGME debug output
Add some lookup functions for nice names for the various types used by
the library, and remove some fields that are of little use to us in the
debug output. This should make looking at key loading and verification a
bit easier, especially in determining what makes up our good and bad
criteria.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee 4d63ebe2fb Perform package verification at package load time
Both md5sum verification and PGP verification can and should be done at
package load time. This allows verification to happen as early as
possible for packages provided by filename and loaded in the frontend,
and moves more stuff out of sync_commit that doesn't really belong
there. This should also set the stage for simplified parallel loading of
packages later down the road.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee 1cf79eb8c8 sync_commit: refactor out validate_deltas
More stuff going on in the pre-committing stage that can be in a static
method to make things a bit more clear.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee 2df1534b78 sync_commit: refactor out file downloads
This part is almost completely self-contained, except building the list
of delta filenames that we use later to check their md5sums. Refactor it
into a static method so we can bring most of the code in sync_commit
closer to the method name.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:34 -05:00
Dan McGee 225acbbff1 Rein in the complexity of the signature type
Given that we offer no transparency into the pmpgpsig_t type, we don't
really need to expose it outside of the library, and at this point, we
don't need it at all. Don't decode anything except when checking
signatures. For packages/files not from a sync database, we now just
read the signature file directly anyway.

Also push the decoding logic down further into the check method so we
don't need this hanging out in a less than ideal place. This will make
it easier to conditionally compile things down the road.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:33 -05:00
Dan McGee 31e55b8049 signing: let GPGME handle loading signatures from files
Rather than go through all the hassle of doing this ourselves, just let
GPGME handle the work by passing it a file handle.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:48:33 -05:00
Allan McRae a7d33d0c36 repo-add: update copyright message
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:44:52 -05:00
Allan McRae 1cb1b0a52c repo-add: document -k option
Also unify the usage output with that given by repo-add itself.

Dan: use 'options', not 'option(s)'.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:44:22 -05:00
Allan McRae 036f98575c repo-add: check for gpg early
Check for the presence of gpg as soon as we know we need it.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:43:43 -05:00
Allan McRae fade60088e repo-add: check for valid key when signing is requested
Follow the example of makepkg

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:43:25 -05:00
Denis A. Altoé Falqueto 59da64146d repo-add: add option to specify a different key to sign with
Add -k/--key option to specify a non-default key for signing
a package database.

Original-patch-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:43:01 -05:00
Allan McRae 2eab4ab033 repo-add: simplify usage message
Listing every option on the usage line becomes unweildly as more
options get added so simplify it. Also, provide a standard package
name in the repo-add example.

Dan: just use 'options' as we use elsewhere, not 'option(s)'.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24 10:41:52 -05:00