Commit Graph

5890 Commits

Author SHA1 Message Date
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
Olivier Brunel cfaff6e0c1 Add events on pacnew/pacsave/pacorig file creation
ALPM still adds a warning to the log, but doesn't emit an event about
said warning, instead using a specific event to let the frontend what
happened/how to inform the user.

Note that there are 2 cases for installing a .pacnew file, to not
overwrite user changes and because file is in NoUpgrade. In the later case
the warning was a bit different: it happened before and said "extracting"
instead of "installed." Now both happen after and are phrased the same.

Signed-off-by: Olivier Brunel <jjk@jjacky.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
Steven Noonan bf79c02440 makepkg: implement support for stripping kernel modules
I noticed when I built a kernel package with options 'strip' and 'debug' that
the debug package was missing the debug information for the kernel modules.
This patch adds kernel modules to the targets for 'strip' and is compatible
with the split-out debug information packages.

v2: Correct logic error -- did a 'continue' after the 2nd-level case statement
    instead of in the default case.
v3: Oops, forgot to terminate outer case. Ran this version through the test
    suite and all tests passed.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Andrew Gregory 9bfd6ff275 restrict transaction package origins
This moves the "wrong args" error up from trans_commit to add_pkg when
used with a local pkg and adds the error for remove_pkg when used with
a sync pkg, which currently just removes the db entry.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel bd3d1a17c2 Add events _PKGDOWNLOAD_{START, DONE, FAILED}
These will be emmitted when download a package file from a repository,
indicating that the download starts, and whether it was successfull or
not.

Note that when multiple servers are available, no event is emmitted when
switching to another server.

(This doesn't apply to alpm_fetch_pkgurl(), but since it is called by
the frontend, it shouldn't have problems knowing when the download
starts and when it ends.)

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel 01cc55a1f4 Add events ALPM_EVENT_RETRIEVE_{DONE, FAILED}
To go along with RETRIEVE_START, one other event will be emmitted once
the downloads are done: RETRIEVE_DONE if all files were successfully
downloaded, else RETRIEVE_FAILED.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel cd793c5ab7 Remove log_cb, add ALPM_EVENT_LOG instead
When ALPM emits a log message, it still goes through _alpm_log() but
instead of calling a specific log callback, it goes as an event.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel 28dbd5551e Update the event callback
Instead of using two void* arguments for all events, we now send one
pointer to an alpm_event_t struct. This contains the type of event that
was triggered.

With this information, the pointer can then be typecasted to the
event-specific struct in order to get additional arguments.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Florian Pritz b6f6a165c4 be_local: Use alpm_greedy_grow
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz 5acfa65ffb be_package: Build the file list from MTREE if possible
This greatly speeds up file list generation times by avoiding
uncompressing the whole package.

pacman -S base with a deliberate file conflict:
before: 9.1 seconds
after:  2.2 seconds

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz 8e60adc916 be_package: Refactor code adding a file to the files list
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz 11fb1d30f4 be_package: Refactor handling of simple path checks
This is used to deduplicate code when using the mtree as the file list
source.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz 42f4a5081e util: Add _alpm_realloc() and _alpm_greedy_grow()
These will be used in the following patches.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz f27fad9b89 Check if a file is in the package's file list before extracting
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Andrew Gregory a7da2a47c3 _alpm_sync_prepare: fix unresolvable packages leak
If the user opted not to remove the unresolvable packages from the
transaction, the list was neither free'd nor saved to the transaction to
be free'd in trans_release.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-08 09:55:35 +10:00
Pierre Neidhardt 0deeb9991c pactree: removed 'provision' from linear output
Linear output is especially useful when piped to other commands, e.g.

  $ pactree -lu pacman | pacman -Qqkk -

The above command would previously show errors on packages with provisions.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 14:21:07 +10:00
Andrew Gregory b9601b1e59 alpm: export *_free functions
Front-ends should be able to free memory that alpm hands them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:48:37 +10:00
Andrew Gregory 953808a9ee pmtest: add memory check to tests with valgrind
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:45:11 +10:00
Andrew Gregory 4763341ea1 pmrule: add FILE_EMPTY rule
Succeeds if the specified path is a file and is empty.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:44:38 +10:00
Allan McRae 1601532a53 Give groups display text singular and plural forms
Reported on transifex

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 09:01:38 +10:00
Allan McRae 8014dc648f makepkg: remove unneeded "|| true"
makepkg only aborts on errors during PKGBUILD functions so the remaining
"|| true" statements are unneeded.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 17:37:58 +10:00
Allan McRae b449878fea makepkg: Fix typo in variable name
It turns out that you should refer to variables by their actual name...
Introduced in commit a521cea9.

FS#38414.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 17:31:51 +10:00
Rafael Ferreira 236f1795e9 Do not remove source code references in PO/POT files
FS#34240.  This is useful for translators and has little cost to us since
we moved to transifex for translations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:32:55 +10:00
Lars Gustäbel 47a4741a3c Prevent makepkg creating armored signatures
If the user has "armor" in thier gpg.conf, makepkg will create an
ascii-armored signature. Use --no-armor in the gpg call to avoid.

FS#38503.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:30:59 +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 f5299d1752 makepkg.conf(5): Fix and improve grammar and spelling issues
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:29 +10:00
Jason St. John 6268e66efa Remove ChangeLog.proto and move important info to PKGBUILD(5)
The change log prototype should be distribution determined.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:12:27 +10:00
Jason St. John ccabeafb3d makepkg.conf(5): Add missing backticks around vars, and use single quotes around "gpg" command
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:11:47 +10:00
Jason St. John 3dc87ec59a proto: Remove recommendation of "makepkg -g" in comments
This recommendation encouraged the practice of not checking the checksums
provided upstream.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:11:47 +10:00
Maxime Gauduin edce7555a6 Add PKGBUILD-vcs.proto
This PKGBUILD proto covers the newly introduced VCS capabilities of
pacman. It serves as a replacement for the current bzr, git, hg and svn
protos found in ABS.

Signed-off-by: Maxime Gauduin <alucryd@gmail.com>

[Allan: add to Makefile.am]
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:11:32 +10:00
Andrew Gregory aa4d3298fb table_display: free memory on errors
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:22:27 +10:00
Andrew Gregory c2edd31eae _alpm_resolvedeps: free targ inside loop
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:12:06 +10:00
Andrew Gregory fac9ac6c40 sync_prepare: manually set pm_errno
_alpm_resolvedeps resets pm_errno to 0 by calling alpm_checkdeps.
Whenever the last call succeeded, pm_errno was not properly set,
preventing pacman from properly handling the error and leaking
additional memory.  We know pm_errno should be ALPM_ERR_UNSATISFIED_DEPS
if resolvedeps has failed, so just set it manually.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:02:31 +10:00
Andrew Gregory 4d68092e2f dump_pkg_full: fix optionalfor memory leak
alpm_pkg_compute_optional returns a generated list that needs to be
free'd.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:46:58 +10:00
Andrew Gregory 6be08f76f6 local_db_populate: initialize empty pkgcache
If the db directory did not exist when local_db_populate was called, the
pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:45:53 +10:00
Silvan Jegen 819b4cd54e Move NULL check before dereference
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen 77da9dc974 Another NULL check removed
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen cb8eae24c9 Another unneeded NULL check removed
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen d895cae16c Remove unneeded NULL check
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:24 +10:00
Andrew Gregory aabb7c3cdd pacman: use exit status 0 for --help and --version
The user requesting usage or version information is not an error.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:12:00 +10:00