Commit Graph

5549 Commits

Author SHA1 Message Date
Olivier Brunel 9652c27710 alpm: Rename a variable for future clarity
We will be adding event structs in the following patches.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 21:58:30 +10:00
Allan McRae 31fcdec619 Fix pactest README
The --test option no longer exists.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Andrew Gregory e8ec7e54e5 remove useless continue
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Andrew Gregory 841c60f2b3 db.c: require unique database names
Allowing multiple databases with the same name causes conflicts as they
both point to the same database file but may use different servers,
usages, or siglevels.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Sébastien Luttringer 76a05e94c1 makepkg: fix consistency of downloaded sources permissions
Running 'makepkg -g' or 'makepkg' to download source files results in
different permissions on the files if the user has a non-default umask.

Put the umask definition at the "beginning" of the makepkg script to
ensure all files generated by makepkg have a 0022 umask.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Andrew Gregory 916c7085d8 alpm_sync_sysupgrade: skip packages being removed
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Allan McRae b847d1d8e7 Color output from pm_vasprintf
This makes sure warning and error messages from _alpm_log are colored.
Fixes FS#35160.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Jason St. John 9749fb033c Fix misspellings and some grammar issues in output of some pacman contrib scripts
Affected files:
-- contrib/bacman.sh.in
-- contrib/paccache.sh.in
-- contrib/pacdiff.sh.in
-- contrib/rankmirrors.sh.in

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Vasiliy Korchagin ae2c9bba5a pacdiff: do not remove pacfile after viewing
Automatically removing the file after viewing is not good if on viewing you
decide to deal with it later.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Jason St. John af2c0a1537 pacscripts: Improve error message when sudo binary is not found
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Wolfgang Bumiller 20127e732c Close file descirptor before fork
FreeBSD chroot(2) fails with EPERM when a directory file descriptor is open
with either `kern.chroot_allow_open_directories` being 0, or when the process
already is inside a chroot.  This is exposed in alpm_run_chroot that uses
opendir() to open a file descriptor to the current directory before doing
the forking and chrooting.  Since the file descriptor is not used in the
forked process, we close it.

Fixes FS#36161.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Allan McRae 759c48cd34 .gitignore: Add intl directory.
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:37 +10:00
Allan McRae 1340ed7925 paccache: clarify help output
The help output referred to variables in the script rather than what
they were labelled in the parameter argument.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-15 20:09:36 +10:00
Jason St. John a15fd48016 Improve --help switch output for pacman contrib and pacman scripts
Unify the formatting of the --help switch for pacman utils, if it exists.
All of the pacman utils will now output help text using the following
format:

  util-name (pacman) v<pacman version>

  one line description of util's purpose

  Usage: util-name [options]

    -b, --bar      whatever --bar does
    -f, --foo      whatever --foo does
    -h, --help     display this help message

Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2013-11-15 11:02:27 +10:00
Jason St. John 7bfaa358ea Replace "echo" command with "printf" in human_to_size_test.sh
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Jason St. John 1645dfd3d1 Fix typo in pacman-optimize
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Jason St. John 230bd5c2fd Fix whitespace and other formatting issues
This commit:
-- replaces space-based indents with tabs per the coding standards
-- removes extraneous whitespace (e.g. extra spaces between function args)
-- adds missing braces for a one-line if statement

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2013-11-15 11:02:27 +10:00
Jason St. John b7b3f9c5e7 Fix minor grammatical issues in doc/index.txt
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Andrew Gregory d78f45ae0c log important events from the backend
This ensures that important events will be logged and consistent
regardless of the frontend.  The need for global context in the event
callback is also removed.  The event is logged before any post_* scripts
run, so this also moves the post_* script output underneath the event in
the log.

Fixes FS#36504

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Andrew Gregory ea6aeef8ba Makefile.am: fix typo in LOG_DRIVER variable
Self-executing tests were not being run through the tap log driver.
This caused `make check` to ignore discrepancies between the expected
number of tests and the actual number of tests.

Also, fix some uncommented output from test scripts that could confuse
TAP parsers.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Allan McRae 0da98ec6ba Ignore makedepend and checkdepend entries when parsing .PKGINFO file
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Allan McRae 5273e38fb2 makepkg: move update_pkgver out of extract_sources
The extract_sources function should be just extracting sources.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:27 +10:00
Allan McRae da8cd388c4 Return zero from extract_file with local source file
The call to bsdtar to check if a file needs extracted returns 1 if it does
not.  We then propegate this return value accidentally which can cause
makepkg to report an error later on.  Explicitly return 0 in this case.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-15 11:02:12 +10:00
Andrew Gregory 57090d8cba alpm_handle: store lock file descriptor
There was a brief window between opening the file descriptor and
creating a stream to it.  If the process was interrupted during that
window the lock file would not be removed correctly.

The pid is no longer printed to the lock file as this was virtually
meaningless for lock files on NFS.

Fixes FS#35603

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Andrew Gregory af284d5fdb support ALPM_SIG_USE_DEFAULT for file siglevels
This brings file siglevels in line with how db siglevels are handled.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Jason St. John 88df07717d Remove spaces between the opening "if" and the opening parenthesis
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Jason St. John 14cc790c59 Use title case for a heading in HACKING; fix capitalization of "Vim" in HACKING
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Dave Reisner 0c180cb7cc version: fix formatting in file to RPM upstream
This reverts a portion of 86eefc1a3a.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:05 +10:00
Allan McRae fe824f87b9 makepkg: only remove static libraries if they have a shared version
It is fairly common that packages contain static libraries with no
shared counterpart.  These should not be removed with !staticlibs.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-08 09:28:02 +10:00
Allan McRae 5c5b28833c makepkg: Allow "static library" to be translated
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-11-01 15:48:03 +10:00
Andrew Gregory d5acf7a44a upgrade.c: use iterator variable
remote was being used to loop over itself, making the FREELIST
ineffective.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Andrew Gregory c3493360af deps.c: pass alpm_list** to _alpm_recursedeps
Improves consistency and makes it clear that targs will be modified by
_alpm_recursedeps.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Andrew Gregory 08191b13f2 check for -1 return value from getopt_long
getopt_long returns -1 when it has finished parsing all args.  A return
value of 0 indicates that a flag was set directly by getopt_long and
parsing should continue.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Andrew Gregory 1c5b94e6bb callback.c: check for negative xfered size
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:03 +10:00
Allan McRae b82a0d83ce makepkg: do not allow badly formatted arch lines
It appears there are a lot of packages with arch=('i686 x86_64')
floating around.  Quote the arch array when passing as a parameter
to detect such things.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Florian Pritz 6405ecb259 pacman -Si/-Qi: Autodetect best fitting file size unit
I've tracked this back to e223366 and it looks like this just forces KiB
because back then humanize_size didn't exist, but the size was just
divided by 1024 to keep it somewhat readable. When humanize_size got
introduced in 3c8a448 this was just carried over.

The unit detected for "Download Size" is reused for "Installed Size" to
make it easier to read.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Vladimir A. Nazarenko 7e767b7e90 Use getuid instead of geteuid
If someone gives the pacman binary setuid permissions, the geteuid check
allows it to start running but subsequently fail. As we do not support
setting pacman setuid, use getuid to check permissions instead.

FS#37174.

Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Andrew Gregory 8f5dbd5614 libalpm/db.c: default to ALPM_DB_USAGE_ALL
This allows existing front-ends other than pacman to continue working
normally.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Andrew Gregory a8285350cc makepkg: allow empty source arrays
Necessary for metapackages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Andrew Gregory c2134fde2b sortbydeps: include local pkgs in dep graph
Detecting indirect dependencies by traversing a package's entire
dependency tree is prohibitively slow for larger transactions.  Instead
add local packages to the dependency graph.  This additionally requires
delaying dependency ordering for sync operations so that removed
packages may be excluded from dependency detection.

tests/sync012.py was also updated to ensure that the dependency cycle
was actually detected.

Fixes FS#37380

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae 2194eddf30 Indicate ignored packages in -Qu output
Add "[ignored]" in the "pacman -Qu" output after packages that have their
upgrades ignored.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae 23923200c3 Expose alpm_pkg_should_ignore
This function is useful for frontends to annotate package upgrades
that will be ignored.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae d4ba5bdda6 repo-add.8: Provide example usage
Detail the current standard of generating two databases - with and
without the file list.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae d63313efe1 makepkg.8: Document remaining environmental variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae 49de11b340 makepkg.8: document environmental variables that affect gpg signing
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae 2d9e7dc2bc Fix detection of joint --native and --foreign usage
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae 70b2c5f5ef List signiture keyids in -Sii output
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Allan McRae c7f159c1c9 Make functions to decode a signature and extract keyid public
These are useful for frontends.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-31 16:20:02 +10:00
Dave Reisner 968486ecc0 makepkg: validate updated pkgver before replacement
Validate the new pkgver efore blindly ramming it into the PKGBUILD.
This gives us good feedback and prevents corrupting the PKGBUILD, e.g.

==> Starting pkgver()...
==> ERROR: pkgver is not allowed to contain colons, hyphens or whitespace.
==> ERROR: pkgver() generated an invalid version: a horse is not a pkgver

As an additional failsafe, exchange a valid for invalid character as
command separator in @SEDINPLACE@ expressions. For even more paranoia,
exit if sed fails for any reason.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Allan McRae e049bb8bd6 Ensure packages have a valid version
Currently you can manually create and then install a package with a
version not containing a pkgrel.  The created local database entry is
invalid as the directory name can not be split by _alpm_splitname due
to the assumtion of hyphens separating name-pkgver-pkgrel.

Ensure the package has a valid version when it is loaded. Fixes FS#35514.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00