whatprovides and splitdep were removed, so depcmp alone is quite useless
now without splitdep, and deptest is not flexible enough.
Introduce a new alpm_find_satisfier which is hopefully more flexible,
this should make implementation of deptest very easy, and also help alpm
tools such as pactree.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch is only meant for 3.4.x. It prepares the place for the future
epoch-aware release.
All force packages that get reinstalled or upgraded will get an EPOCH
entry in the local database, and thus the new pacman with epoch won't
reinstall them by mistake on the first -Su.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
If we have a corrupted database, a package can come through without an arch,
causing the code to blow up when making strcmp() calls. It might even be
possible with perfectly valid database entries lacking an 'arch =' line.
This behavior was seen as at least one of the problems in FS#21668.
Ensure pkgarch is not null before doing anything further.
Signed-off-by: Dan McGee <dan@archlinux.org>
Only occurs if no arguments were provided directly. Arguments can be
separated by any amount of valid whitespace. This allows for piping into
pacman from other programs or from itself, e.g.:
pacman -Qdtq | pacman -Rs
This is better than using xargs, as xargs will not reconnect stdin to
the terminal. The above operation performed using xargs would require
the --noconfirm flag to be passed to pacman.
Signed-off-by: Dave Reisner <d@falconindy.com>
when calling '-S repo/group', only group members in <repo> should should
be installed (group members in other repos are ignored)
Signed-off-by: Dan McGee <dan@archlinux.org>
* FS#19854 (--ignore is ignored with groups)
* http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html
(operation aborts when a package from a group is ignored/and user chooses
not to install it)
If a group member is ignored, we expect
a) a question whether to install
b) after saying 'no' to a), the ignored member not to be installed
c) all other group members to be installed
d) pacman to execute successfully
Signed-off-by: Dan McGee <dan@archlinux.org>
$ pacman -Rd kde-meta
Remove (15): kde-meta-kdewebdev-4.5-1 [0.00 MB] kde-meta-kdeutils-4.5-1 [0.00 MB]
kde-meta-kdetoys-4.5-1 [0.00 MB] kde-meta-kdesdk-4.5-1 [0.00 MB]
kde-meta-kdeplasma-addons-4.5-1 [0.00 MB] kde-meta-kdepim-4.5-1 [0.00 MB]
kde-meta-kdenetwork-4.5-1 [0.00 MB] kde-meta-kdemultimedia-4.5-1 [0.00 MB]
kde-meta-kdegraphics-4.5-1 [0.00 MB] kde-meta-kdegames-4.5-1 [0.00 MB]
kde-meta-kdeedu-4.5-1 [0.00 MB] kde-meta-kdebase-4.5-1 [0.00 MB]
kde-meta-kdeartwork-4.5-1 [0.00 MB] kde-meta-kdeadmin-4.5-1 [0.00 MB]
kde-meta-kdeaccessibility-4.5-1 [0.00 MB]
Total Removed Size: 0.06 MB
Do you want to remove these packages? [Y/n]
( 1/15) removing kde-meta-kdewebdev [------------------------] 100%
$ it stopped here..
On one side, libalpm did not initialize the progress bar at 0 percent.
So with meta-packages that have 0 files, there was only one progress bar
call with percent == 100.
On the other side, pacman callback kept track of the last percent that
it received. When there are only meta-packages, we always received only
100, so pacman believed the progress bar needed not update. Thus only
the first package was actually displayed.
A proper fix for the callback would be to keep track of last package
name to make sure the recorded prev percent applies.
But since we now specify that both Add and Remove should at least send
percent=0 at beginning and percent=100 at the end, there is no need
for that.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
We still need to read force entry in epoch-aware pacman, so that when we
install an old force package, EPOCH gets written to the local db.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Populate $cur and $prev with the new bash-completion 1.2 function,
_get_comp_words_by_ref.
_get_cword and _get_pword have been deprecated.
Signed-off-by: Carlos Diaz <839273@gmail.com>
This adds epoch support to pactest, while still producing packages and
database entries the same way makepkg and repo-add currently do in a
backward compatible fashion (still including the 'force' option).
Signed-off-by: Dan McGee <dan@archlinux.org>
Allow it to be a variable in the PKGBUILD as well as propagating it through
to the built package and the package database. We leave some backward
compatibility in place by placing the '%FORCE%' option in the database if
the package contains an epoch; this will be used by older versions of pacman
and more or less ignored by versions that use epoch.
Signed-off-by: Dan McGee <dan@archlinux.org>
This will allow for better control of what was previously the 'force' option
in a PKGBUILD and transferred into the built package.
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove unnecessary parsing of fields not found in local desc files.
Leave %FORCE% parsing as this likely will make an appearance in desc
files in the future.
Signed-off-by: Allan McRae <allan@archlinux.org>
The splitname function is a general utility function and so is better
suited to util.h. Rename it to _alpm_splitname to indicate it is an
internal libalpm function as was the case prior to splitting local and
sync db handling.
Signed-off-by: Allan McRae <allan@archlinux.org>
These functions are only needed by be_local and were only promoted
to db.{h,c} as part of the splitting of handling the local and sync
dbs. Move them into be_local.c and make them static again.
Signed-off-by: Allan McRae <allan@archlinux.org>
Clean-up the previous download location of the sync database and
any old extracted sync database directories which are unneeded
with the tar-db backend.
Signed-off-by: Allan McRae <allan@archlinux.org>
Read in list of packages for sync db from tar archive.
Breaks reading in _alpm_sync_db_read and a lot of pactests (which
is expected as they do not handle sync db in archives...).
Signed-off-by: Allan McRae <allan@archlinux.org>
Put the db_operations struct to use and completely split the handling
of the sync and local databases.
Signed-off-by: Allan McRae <allan@archlinux.org>
The file be_files.c is "split" to be_local.c and be_sync.c in order
to achieve separate handling of sync and local databases.
Some basic clean-up of functions that are only of use for local or
sync databases has been performed and some rough function renaming
in duplicated code has been performed to prevent compilation errors.
However, most of the clean-up and final separation of sync and local
db handling occurs in following patches.
Signed-off-by: Allan McRae <allan@archlinux.org>
BASH is defined when you are actually using bash during configure, which
sucks because it ends up being '/bin/sh', messing up all of our scripts.
Change the name of the variable we use in configure, and also ensure we get
a full path to the executable by using AC_PATH_PROGS rather than
AC_CHECK_PROGS. Finally, change the variable name everywhere we use it.
Signed-off-by: Dan McGee <dan@archlinux.org>
These will be needed for the handling of both local and sync database
caches, so put them in a common location.
Signed-off-by: Allan McRae <allan@archlinux.org>
Move splitname, checkdbdir, get_pkgpath into db.{h,c} as these will be
needed to parse both the local and sync databases during the initial
splitting. They will be moved out of db.{h,c} at to more appropriate
locations at a later stage.
Signed-off-by: Allan McRae <allan@archlinux.org>
It doesn't do a whole lot yet, but these type of operations will
potentially be different for the DBs we load.
Signed-off-by: Dan McGee <dan@archlinux.org>
Cache bullshit only has relevance to be_files, so move it there.
Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: BIG rebase]
Signed-off-by: Allan McRae <allan@archlinux.org>
Hopefully we've finally arrived at package handling nirvana, or at least
this commit will get us a heck of a lot closer. The former method of getting
the depends list for a package was the following:
1. call alpm_pkg_get_depends()
2. this method would check if the package came from the cache
3. if so, ensure our cache level is correct, otherwise call db_load
4. finally return the depends list
Why did this suck? Because getting the depends list from the package
shouldn't care about whether the package was loaded from a file, from the
'package cache', or some other system which we can't even use because the
damn thing is so complicated. It should just return the depends list.
So what does this commit change? It adds a pointer to a struct of function
pointers to every package for all of these 'package operations' as I've
decided to call them (I know, sounds completely straightforward, right?). So
now when we call an alpm_pkg_get-* function, we don't do any of the cache
logic or anything else there- we let the actual backend handle it by
delegating all work to the method at pkg->ops->get_depends.
Now that be_package has achieved equal status with be_files, we can treat
packages from these completely different load points differently. We know a
package loaded from a zip file will have all of its fields populated, so
we can set up all its accessor functions to be direct accessors. On the
other hand, the packages loaded from the local and sync DBs are not always
fully-loaded, so their accessor functions are routed through the same logic
as before.
Net result? More code. However, this code now make it roughly 52 times
easier to open the door to something like a read-only tar.gz database
backend.
Are you still reading? I'm impressed. Looking at the patch will probably be
clearer than this long-winded explanation.
Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: rebase and adjust]
Signed-off-by: Allan McRae <allan@archlinux.org>