1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-11 11:55:12 -05:00
Commit Graph

20 Commits

Author SHA1 Message Date
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
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
Dave Reisner
92e20b508d contrib: remove executable bit from input files
There's no reason to make these executable, and this also mimics what we
do in the scripts/ subdir.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-30 17:37:29 -05:00
Lukas Fleischer
a77e638c77 contrib/*: Support the "--help" and "--version" options
Add "--help"/"-h" and "--version"/"-V" support to all contrib scripts.
Also, update scripts that used "-v" as a short option for "--version"
and use "-V" for the sake of consistency.

Additionally:

* Move version and usage messages to separate convenience functions in
  all scripts.

* Add a workaround to paccache to support "--help" and "--version". This
  should be replaced by a proper POSIX-compliant command line parser
  that supports long options in a future patch.

* Add a "$myver" variable to all scripts and use it whenever we refer to
  the program version (e.g. in version messages). Also, use the pacman
  version number everywhere instead of using a different versioning
  scheme for each contrib script. This is achieved by adding a
  "PACKAGE_VERSION" placeholder that is replaced by sed(1) when the
  script is built.

* Ensure we always return with exit status 0 if "--help" is used and
  return with exit status 1 if we display the usage message due to
  invalid arguments.

* Add "AUTOMAKE_OPTIONS = std-options" and add all scripts to
  "bin_SCRIPTS" to make `make installcheck` check that installed scripts
  actually support the "--help" and "--version" options.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:49:46 -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
06974ebf2f contrib/pacsearch: skip non-matching lines
This prevents some perl errors from popping up when pacman prints error
or warning messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:44:17 -05:00
Dan McGee
0f24390fe8 pkgsearch: handle non-matching lines gracefully
Before any non-matching line would trigger some perl warnings about
undefined variables. If a line doesn't match, just show it to the user
unprocessed; this is seen with warning and error messages pacman not so
helpfully emits on stdout rather than stderr.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 15:20:10 -06:00
Nezmer
bce3c8efc7 Add .in extension to files in contrib
This is needed If we want to use sysconfdir,localstatedir and other variables.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00