Commit Graph

4779 Commits

Author SHA1 Message Date
Dave Reisner 4c5e7af32f delta: use regex substring matching
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-13 10:44:28 -06:00
Dan McGee 2a4df070c3 Merge branch 'maint' 2011-12-12 14:07:44 -06:00
Dan McGee 370c873be5 Calculate root length only once when checking for file conflicts
It is quite easy to hoist this potentially repeated computation out of
the loop; even if we don't end up using it, it is super cheap to do it
only once.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 13:05:10 -06:00
Dave Reisner 8c8f043717 lib/conflict: save strlen call by reusing snprintf return
The return should probably be checked to ensure its not longer than
PATH_MAX, but I have no idea what the correct behavior is when that
happens.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:56:48 -06:00
Dave Reisner 67290441b8 contrib/paccache: silence possible output from cd
If CDPATH is set, this could possibly write to stdout.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:52:40 -06:00
Dave Reisner 3d4656c020 code syntax cleanup
As per HACKING file, we use 'CTRL(' rather than 'CTRL ('

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:51:59 -06:00
Eric Bélanger b75fac5be3 pacsysclean: Add new contrib script
pacsysclean sort installed packages by decreasing installed size. It's
useful for finding large unused package when doing system clean-up. This
script is an improved version of other similar scripts posted on the
forums. Thanks goes to Dan for fixing and improving my original script.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:48:50 -06:00
Dave Reisner 5f0df42303 makepkg: split source elements when looking for sigs
Allows renamed .asc/.sig files to be still discovered by makepkg. This
is needed for a package such as PuTTY, which provides abnormally named
sig files (.DSA and .RSA) which are valid input for gpg --verify.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:47:46 -06:00
Dan McGee 1a1f5540a4 pacman: process all sync targets before exiting on error
If someone specifies a bogus line such as

    pacman -S baz adsf/boo base-devel

we are better off trying to process all targets and showing all relevant
errors before exiting. This is easier in -U and -R operations where we
aren't dealing with groups, but here we attempt to skip group selection
once we know a target has errored to avoid cluttering the output and
hiding the real problem.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Dan McGee 074cf4cb95 pacman: process all targets on upgrade operation
If an early target fails, we stopped processing the rest of the list. We
should continue all the way through and show relevant errors for each
target if possible, and error out only at the end.

We do process all targets to check for URLs first and will error out if
some could not be processed; we then do a second loop and try to load
each target specified on the command line.

This mirrors a patch by Allan to do the same for removal operations.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Allan McRae 62fa0c7d8d pacman: list all unknown targets on removal operation
On a removal operation, pacman currently reports an error for the
package that is not found in the database and then exists.  Adjust
so that all unknown packages are reported.

Before:
> pacman -R foo bar
error: 'foo': target not found

After:
> pacman -R foo bar
error: 'foo': target not found
error: 'bar': target not found

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Dan McGee 781af8f91b Use automake verbose helpers in custom make rules
This converts our script generation to use the built-in AM_V_GEN macro,
which honors the V= setting passed to make and allows one to see the
full command if they truly desire. The AM_V_at macro is also used in
place of an explicit @ so verbose-mode compiles show all commands being
run.

We can also use these two macros in doc generation to quiet it down to
the level we expect.

Other minor changes:
* a pointless test call is removed in test/pacman/tests/
* sed is used instead of dos2unix as we depend on it anyway
* consecutive chmod calls are reduced to a single call (e.g., '+x,a-x')

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-08 09:17:39 -06:00
Dan McGee dacda1f6b3 Make automake generate silent rules by default
This will require you to pass 'V=1' if you want the previous, more
verbose output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-08 09:15:41 -06:00
Dan McGee b5225165c0 Move items around in the alpm handle struct
This allows for the struct layout to have no empty spaces.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:05:02 -06:00
Dan McGee 86cb6e1f0f Slight local database files reading optimization
Since we know the length of the line, we can use this all the way
through and do a cheaper operation than strdup() by just invoking malloc
and memcpy directly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:04:14 -06:00
Lukas Fleischer 0e4946d559 scripts/*: Declare several constant variables read-only
Be more semantically accurate and avoid accidental overwriting of some
configuration variables that are considered to be constant.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:02:11 -06:00
Dan McGee a3a75e0a41 Merge branch 'maint' 2011-12-07 10:00:20 -06:00
Lukas Fleischer 1038e66964 contrib/*: Hardcode program names
Add a read-only variable "$myname" to every contrib script and hardcode
program names instead of relying on "$0". The variable name "$myname"
was chosen because it is already used in pacman and because we use
"$myver" to specify the program version in the official scripts.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 09:59:30 -06:00
Dan McGee 48188fbeee Add 'silent-rules' to automake setup in configure.ac
This is awesome, and I don't know why we haven't already done this. It
gives us the much more less verbose make output in a few different ways:

* If you run `make V=0`, you will get the quiet output.
* If you run `./configure --enable-silent-rules`, the quiet output is
  the default; verbose output can be had by passing V=1 to make.

    make[3]: Entering directory `/home/dmcgee/projects/pacman/lib/libalpm'
      CC     add.lo
      CC     be_local.lo
      CC     be_package.lo
      CC     be_sync.lo
      CC     delta.lo
    .....

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 09:59:27 -06:00
Dan McGee 6a1d3948a6 Use correct size in memset
We were using the size of a pointer, not the size of the whole
archive_read_buffer struct. Thanks to Clang/LLVM 3.0 and Allan/Dave in
IRC for finding this one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 23:21:56 -06:00
Dan McGee 17e0be9e6a repo-add: enforce maximum .sig file size
This prevents user error in adding a file generated via `gpg --sign`
rather than `--detach-sign`, for example. The same 16KiB limit is used
we use in our pacman download code.

The section is moved above the checksum generation to avoid presenting
info messages to the user if the signature isn't valid.

Addresses a shortcoming pointed out in FS#27453.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 10:48:47 -06:00
Dan McGee d85d0ddcfe Enforce signature download size limit on -U <url> operations
We had a 16 KiB limit on database signatures, we should do the same here
too to have a slight sanity check, even if we can't do so for the
package itself yet.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 10:07:05 -06:00
Lukas Fleischer 61ce2ca1bb contrib/paclist: Add "--help" command line parameter
Be consistent with all other contrib scripts and support the "--help"
command line switch. Fixes FS#27258.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05 09:22:12 -06:00
Dan McGee 1d98c6347c Merge branch 'maint' 2011-11-30 22:34:25 -06:00
Dave Reisner 5490cd6eb2 makepkg.5: fix typo s/tar,bz2/tar.bz2/
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:30:22 -06:00
Dave Reisner a521cea96f makepkg: avoid using comm for diff'ing package lists
Whereas comm will check inputs to see if they're sorted (and warn when
they aren't), grep doesn't even care about ordering. In this particular
instance -- neither do we. We're only interested that the two lists are
equivalent.

Fixes FS#26580.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee 15aa57d51b _alpm_ldconfig: return value from _alpm_run_chroot
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee d7f8838294 Add two new pactests for pacman upgrade behavior
Both currently marked as failing.

* sync303.py encapsulates the broken behavior reported in FS#27214.
* sync304.py shows how packages depending on a specific version of a
  package in SyncFirst can cause breakage of the dependency resolver.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee f5820c8bd6 Miscellaneous post-4.0.1 updates
Some late-arriving translation updates and add the correct dates to the
index.txt releases table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee 86b5b7aa42 Add helper function for duplicating depends lists
We do this in several of the package duplication steps; add a helper
function for doing so to reduce some of the repetitive code.

Also add a free_deplist function for our repeated depend list free calls
of both the data and the list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:26:52 -06:00
andrew.gregory.8@gmail.com 77af613efc added doxygen documentation
Made existing documentation more consistent and added
documentation where there was none. One function still
needs documentation and is marked with 'TODO'.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-22 00:31:10 -06:00
Dan McGee 96b3ba3470 Merge branch 'maint' 2011-11-20 21:40:50 -06:00
Florian Pritz 2141b7112d add key algo to import msg
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:40:19 -06:00
Florian Pritz 2f96067fe7 change gpg import message to resemble gpg --list-keys
Dan: const pointers, don't worry about bitfields.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:39:33 -06:00
Phillip Smith 5ba8b83b8b makepkg: add support for PACKAGER environment var
Add support for overriding configuration in /etc/makepkg.conf and
~/.makepkg.conf by setting the environment variable PACKAGER similar to
how SRCDEST and PKGDEST behave.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-11-20 21:36:30 -06:00
Allan McRae cb898be887 repo-add: Remove .tmp. prefix from output
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dan McGee 80868b0da6 repo-add: ensure database and signature files are always viewed in whole
This addresses a short but sweet race condition currently existing in
repo-add and repo-remove. We do the smart thing and zip the database to
a location in a temporary directory and not over the original database
directly. However, we then proceed to move this file directly from the
temporary directory to our final location, which is more than likely a
cross-filesystem move (/tmp on tmpfs) and thus non-atomic.

Instead, zip the file to the same directory, prefixing the filename with
'.tmp.'. We then move the file into place. This move is guaranteed to be
atomic, so any reader of the database file will get either the old
version, the new version, or ENOENT.

We also perform a hardlink if possible instead of a move when shifting
the old database out of the way to '.old'; this ensures there is no
chance of a database file not existing during the whole process.

Only one small race condition should now be present- when the database
has been fully moved into place and the signature has not, you may see a
mismatch. There seems to be no good way to address this, and it existed
before this patch.

A final note- if someone had locked-down permissions on the directory
that the database files are in (e.g., could only write to foo.db.tar.gz,
foo.db, foo.db.tar.gz.old, foo.db.old, and the lock file), this would
break.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dan McGee 6a9ed33055 repo-add: ensure path to LOCKFILE is always absolute
Given our semi-frequent use of pushd/popd, if we are in any directory
but the original and the database path given was relative, we won't
unlock the database file when cleaning up after an error.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dan McGee 507a2d15e6 Final changes before 4.0.1 release
* Add last-minute changes to NEWS
* Don't treat '_' or '_n' special in scripts when finding translatable
  strings; this breaks with one use of `read` and a dummy _ variable

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:29:46 -06:00
Dave Reisner b8ef22312b makepkg: trim trailing space from whitespace sensitive vars
This applies to pkgver, pkgrel, and epoch and ensures that any trailing
whitespace outside of the context of the variable declaration itself is
properly trimmed. The Bash parser will ignore this, and so should we.

We don't need to worry about leading space because it would force a
syntax error, or fail validation.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:17:43 -06:00
Dan McGee 2752932d19 Update alpm_errno_t type to non-enum version
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:53:34 -06:00
Dan McGee 919b604c29 Merge branch 'maint' 2011-11-16 14:51:17 -06:00
Dan McGee dee8144ce5 Add helper method for creating and opening archive object
This moves the common setup code of about 5 different callers into one
method. Error messages will now be common and shared in all places;
several paths did not have any messages at all before.

In addition, we now pick an ideal block size for the archive read based
off the larger value of our default buffer size or the st.st_blksize
field. For a filesystem such as NFS, this is often much larger than the
default 8192- values such as 32768 and 131072 are common.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:51:06 -06:00
Dan McGee c79c068fe9 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:45:25 -06:00
Dave Reisner ad09db3c55 makepkg.conf: disable motd printing for rsync DLAGENT
Fixes FS#26806.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:37:42 -06:00
Dan McGee 9363e7dc22 Allow sync_prepare to work in certain cases without sync databases
When doing a bare -U operation on a local package that doesn't pull in
any dependencies from the sync databases, we can get away with missing
database files. This makes the check conditional on no sync targets
found in the target list. This is not the prettiest code here so we have
a bit of hackish behavior required to straighten both the behavior and
the nonsensical error message out.

Addresses FS#26899.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:12:18 -06:00
Dan McGee f1ec3b9b10 Remove unnecessary casts in callback code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:11:03 -06:00
Allan McRae 37ff0f5658 Update documentation regarding signature extensions
Commit e7b56f48 allowed makepkg to handle pgp signatures with the
.sign extension.  Update the man page to reflect this.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 08:17:08 -06:00
Jonathan Conder a3f9399295 create a typedef for enum _alpm_errno_t
This is consistent with the other enums and structs, and should be
slightly more readable.

Signed-off-by: Jonathan Conder <jonno.conder@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-14 08:54:03 -06:00
Dan McGee c0ce10397a Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 22:21:02 -06:00