Commit Graph

284 Commits

Author SHA1 Message Date
Dave Reisner d9cf14ff1d updpkgsums: use a throwaway build dir
This prevents updpkgsums from potentially dirtying an otherwise pristine
directory (likely $PWD) when makepkg creates the srclinks.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:33:07 +10:00
Dave Reisner 38b6de937c paccache: read default cachedir from pacman.conf
Implements FS#40738.
2014-09-15 09:27:21 +10:00
Maxim Andersson 8122fae51a paccache: add support for multiple cachedirs
Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com>
2014-09-15 09:27:07 +10:00
Allan McRae 79548e0d78 pacdiff: allow DIFFPROG to contain commandline options
Also use 'vim -d' as default diff viewer.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00
Pierre Neidhardt e5c714f501 pacsearch: factored -Ss and -Qs parts into one single function
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt cfde337b7b pacsearch: pattern arguments work as for pacman
Previously only one pattern was allowed.

  $ pacsearch foo bar
Search for packages containing 'foo bar'.

  $ pacman -Ss foo bar
Search for packages containing both 'foo' and 'bar'.

Note that removing the quotes from the call was not enough since
  $ pacsearch 'foo|bar'
would then fail.

Note the use of '--' to indicate the end of option parsing. This way we ensure
that input will always be valid and we need not input checks anymore.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt 894773eb5b pacsearch: fields are treated uniformly when printing
We include the leading space in the match for 'group' and 'installed'. This
allows us to remove the conditions when printing.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt e2fe052576 pacsearch: removed redundant sorting
Package are processed in the same order as pacman output, so there is no real
need to sort. This makes the code simpler and faster.

The only difference is that local packages will always be printed at the
end. Previously, they were printed before multilib for instance.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt fe961e6590 pacsearch: indexing by 'name version' instead of 'name'
In the old pacsearch, packages were identified uniquely by pkgfields[1], which
contained pkgname+pkgver. Since commit 4d13558 pkgver is stored in pkgfields[2],
and packages have been identified with pkgfields[1] only. Because of that
packages with a different version would appear once only.

This fixes the regression by identifying packages with both pkgfields[1] and
pkgfields[2].

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Pierre Neidhardt 08cddb4b4b pacsearch: removed useless comment
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Pierre Neidhardt e4f6edf237 pacsearch: CLI option to turn off colors
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt 1e07af1b0a pacsearch: using pacman color theme
No more per-repo coloring: this was not Arch-agnostic, and there is no
reasonable, simple way to color repos in a consistant manner with only 6 colors.

'local' is in red: this way we benefit from the pacman -Ss && pacman -Qs combo.

to_color subroutine: it takes an array instead of a string, this is faster and
simpler.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt fe19a0c58d pacsearch: colors are portable (ANSI) and have natural variable names
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt 15f4144e12 pacsearch: Explicitly extract group information
Also store pkgname and pkgver separately.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt 135d862eb6 pacsearch: localized output
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt 6fb2035dd0 pacsearch: more accurate help message
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Pierre Neidhardt c71efe6d62 pacsearch: Copyright year bump
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Florian Pritz cd2370754a Remove ts and sw from vim modeline when noet is set
Forcing vim users to view files with a tabstop of 2 seems really
unnecessary when noet is set. I find it much easier to read code with
ts=4 and I dislike having to override the modeline by hand.

Command run:
find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} +

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:19:25 +10:00
Allan McRae 3bb3b1555a Update copyright years for 2014
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +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
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 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
Allan McRae c69d71d55b contrib/pacdiff: error if diffprog is not found
FS#35936

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-15 12:40:53 +10:00
Andrew Gregory dfcf918763 remove executable bit on paclog-pkglist.sh.in
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-10-14 13:01:15 +10:00
Xyne 5ef0c3caa5 bacman: optionally include unmodified backup files when available
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Xyne 8561ad2256 bacman: update copyright information in version function
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Xyne ec15e859a4 bacman: pass unshifted arguments to fakeroot
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Aaron Lindsay 3f99cfba1b contrib: Unify quoting in error messages
This fixes error messages to display the contents of variables rather
than the variable name by replacing backticks with single quotes (m4
eats backticks). It also removes $"" localization from error messages to
eliminate security holes.

For instance, `rankmirrors nonexistent_file' will now display:
	'nonexistent_file' does not exist.
rather than:
	$1 does not exist.

Signed-off-by: Aaron Lindsay <aaron@aclindsay.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-18 14:28:03 +10:00
Jonathan Frazier 0f22bef8c3 pacdiff: provide an --output option to show any .pac* files
This is an option to just echo's the pacnews/pacsaves instead of merging
or removing them. This can be used to check the config status such as in
a cron job without modifying the system.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier 2d9dad5e14 pacdiff: make pacmandb search the default type.
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier a79661225a pacdiff: improve speed, accuracy finding active configs using pacmandb
This is a new search type, using -p or --pacmandb options. It reads
config file locations directly from the local pacman db. It will find
active configs anywhere they are defined in installed packages. It is
not dependant on outside configs such as updatedb.conf or scanning a
large set of directories for find.

This will find more pacnews than find when searching with the current
default of /etc, and it is faster than both find and updatedb when
searching the entire fs. When run directly after an update, the local db
is more likely to be cached than all files in /etc or / as other methods
read. This will increase performance further post upgrade.

After a package is removed and a pacsave is created, this method will
not find these pacsaves until the base config is added to the local db
again. These files have no influence in a working system and only take
up a few blocks of disk space.

Active configs need to be dealt with immediately to keep a system
working. pacsaves related to removed configs can remain for weeks or
months without problems. I would recommend occasionally running other
methods such as --locate to remove them.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier 15eea825e6 pacdiff: rework search type handling, add --find option
Change cmd tests to if (( USE_FIND ))... as it is cleaner.  All search
cmds have an option and a variable initialized to zero. The active option
should be set to 1.  Add a switch to exclude multiple search options.
set the default when all are equal to zero.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier b1b9ca01f0 pacdiff: add --nocolor option for the terminally challenged.
Allow colors to be disabled for use on broken/serial terminals.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier 05e954d2cd pacdiff: allow multiple separated options
loop over arguments, this will allow adding options such as --nocolor

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier bcde027091 pacdiff: clean up and reword --help
Clean up and reword --help
get rid of all the echos to make it easier to read in source.

Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier c4d8da4727 pacdiff: Search and give warnings for older pacsave.[0-9]* files
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-30 13:00:10 +10:00
Jonathan Frazier 9108bfe080 pacdiff: Add quit to found pacnew options
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-07-22 13:28:40 +10:00
Allan McRae 71328479f3 Merge branch 'maint' 2013-06-18 13:59:18 +10:00
Allan McRae c81615f38c contrib: update .gitignore
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 13:27:31 +10:00
Karol Blazewicz cd421c8383 pacscripts: Update for pacman changes
Changes to pacman mean that -Sp can be called without root permissions
and '-d' needs passed twice to completely ignore dependencies.

Signed-off-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 12:55:57 +10:00
Karol Blazewicz 85fde7038f pacscripts: don't read the whole package from cache
'-q' means "Exit as soon as each specified pattern or filename has
been matched." There is no reason to keep reading the whole package
from the cache when the install script has already been printed to
stdout.

Signed-off-by: Karol Błażewicz <karol.blazewicz at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 12:55:35 +10:00
Allan McRae 31d51052e1 checkupdates: Consistency in environmental variable name
Use CHECKUPDATES_DB rather than CHECKUPDATE_DB for consistency with the
script name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-18 12:53:26 +10:00
Allan McRae 4283199039 contrib/checkupdates: fix typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-16 16:36:20 +10:00
Allan McRae b7f8f5d26a paccache: make --help output look nice on 80 width terminal
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-06-06 13:47:32 +10:00
Allan McRae 84ac55b052 Merge branch 'maint' 2013-05-29 14:02:56 +10:00
William Giokas 090c4006d7 contrib: Remove harcoded /etc/pacman.conf
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 10:43:42 +10:00
Dave Reisner 8be08f7cae Revert "paccache: avoid subshell in calling runcmd"
su is terribad. In addition to reverting, this also removes support for
privilege escalation via su. If you want to use paccache as root and
fail to comprehend how much better sudo is than su, then run paccache
directly via su.

Fixes FS#35173.

This reverts commit 597286eb25.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-05-18 10:43:16 +10:00