Age | Commit message (Collapse) | Author |
|
Fully removes a package from the hash. Also unify prototype with
removal from an alpm_list_t, fixing issues when removing a package
from the pkgcache.
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Rehash without recreating the hash table list or reallocating the
memory for holding the list nodes.
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
While probably still not optimal in terms of everyday usage in
pacman, this reduces the absolute size increase to "more reasonable"
levels. For databases greater than 5000 in size, the minimum size
increase is used which is still on the order of a 10% increase.
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Check that the requested size of a pkghash is not beyond the maximum
prime. Also check for successful creation of a new hash before
rehashing.
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Since the sync database never changes size once we initialize it, we
allow it to be filled a bit more. This reduces the overall memory
footprint needed by the hash table.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This allows us to get through the rehash required by smoke001 and pass
all pactests. It is by no means the best or most efficient
implementation but it does do the job.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Read the package information for sync/local databases into a pmpkghash_t
structure.
Provide a alpm_db_get_pkgcache_list() method that returns the list from
the hash object. Most usages of alpm_db_get_pkgcache are converted to
this at this stage for ease of implementation. Review whether these are
better accessing the hash table directly at a later stage.
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
This works for both local and sync databases in slightly different ways. For
the local database, we can use the directory hard link count on the local/
folder. For sync databases, we use the archive size coupled with some
computed average per-package sizes to determine an estimate.
This is currently a dead assignment once calculated, but could be used to
set the initial size of a hash table.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Fixes bash-3.2 compatibility.
Thanks-to: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Missed in commit a88cb03a.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
The current behaviour, which is placing source packages in PKGDEST if
SRCPKGDEST is not set, is inconsistent with {SRC,PKG}DEST handling and
there is no real advantage in doing so.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
At least in FreeBSD, find always returns 0 if it finds stuff
(imagine that). It doesn't care about the exit status of whatever is
passed to -exec.
This patch makes the checks compatible with this behaviour.
Using xargs and not using grep directly because packages with too many
files would cause grep to complain about argument list being too long.
This should also fix the false positive in packages with no files.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Noted in FS#22697. When I factored out _alpm_parsedate() into a common
function, I didn't move the <locale.h> include properly, causing a build
failure when NLS is disabled and this header isn't automatically included
everywhere.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
-d skips checking the version of a dependency.
-dd skips the whole dependency check.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This flag allows to disable version checking in dependency resolving
code.
depcmp_tolerant respects the NODEPVERSION flag but we still keep the
original strict depcmp. The idea is to reduce the impact of the
NODEPVERSION flag by using it in fewer places.
I replaced almost all depcmp calls by depcmp_tolerant in deps.c (except
in the public find_satisfier used by deptest / pacman -T), but I kept
depcmp in sync.c and conflict.c
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
No reason to disallow this- it allows keeping even more packages around in
the cache. Test cases included for this case and to ensure the default
behavior is preserved.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
The first two are rather standard tests of our two available clean options,
and the third is attempting to test a reported bug (and failing to make the
given case fail).
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This will allow some tests to be added for cache cleaning.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
return codes were mixed up
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
It's likely that these interfaces will break sooner or later, now that
pacman no longer uses them.
So better force the two people who use them to migrate their code to the
new add_pkg/remove_pkg interface, which is very easy anyway.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
This function is used both for provision and group selection. Now the
database name will be displayed.
$ pacman -S base-devel
:: There are 11 members in group base-devel:
:: Repository testing
1) make
:: Repository core
2) autoconf 3) automake 4) bison 5) fakeroot 6) flex 7) gcc 8) libtool 9) m4 10) patch 11) pkg-config
Which ones do you want to install?
Enter a number (default=all):
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
Make use of parseindex like in multiselect, and loop until we get a
valid answer like in multiselect.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
Old interface is marked as deprecated:
int alpm_sync_target(char *target);
int alpm_sync_dbtarget(char *db, char *target);
int alpm_add_target(char *target);
int alpm_remove_target(char *target);
New recommended interface:
int alpm_add_pkg(pmpkg_t *pkg);
int alpm_remove_pkg(pmpkg_t *pkg);
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
Note that there is a behavior change here : if the same package name
appeared several times in the target list, the alpm_add_target interface
chooses the new package, while alpm_add_pkg returns PKG_DUP.
I don't see why we cannot unify the behavior of -S and -U, and just
choose one behavior that applies to both.
Otherwise, it's always possible to handle these different behaviors in
the frontend, it just requires more work.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
For consistency with alpm_add_pkg.
The new recommended interface is alpm_add_pkg / alpm_remove_pkg, all
others interfaces are deprecated.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
This uses the new public functions to handle targets from the frontend,
like it used to be :
1) alpm_find_dbs_satisfier to find (optionally versioned) package or
provision
2) alpm_find_grp_pkgs to find members for a groups
3) alpm_add_pkg to finally add the pmpkg_t from 1 or 2
Of course, this adds more code to the frontend, but it completely
deprecates sync_target and sync_dbtarget interfaces.
This all-in-one interfaces felt wrong and left no control to the
frontend. A good frontend should just use alpm_add_pkg, with pkg coming
from alpm_db_get_pkg (for normal targets), alpm_find_dbs_satisfier (for
versioned provisions) or alpm_find_grp_pkgs (for groups).
This also opens the way to provide a better group handling in pacman
without constraint from libalpm and callbacks.
In ignore006, only the retcode changes, because no package was found to
satisfy the target (the only possible package is ignored).
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
This group function is meant to help group handling from frontend : it
scans all dbs, handling ignored packages and duplicate members (the
first repo where a member is found has the priority).
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
This new function is meant to deprecate all existing
sync/add target functions :
int alpm_sync_target(char *target);
int alpm_sync_dbtarget(char *db, char *target);
int alpm_add_target(char *target);
Rather than dropping these 3 interfaces, it might be better to rewrite
them using alpm_add_pkg for now.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
This is a public interface for resolvedep. It looks nicer to expose it
this way rather than through sync_target.
This function can also be helpful for external tools as it should give
good results close to how pacman select a package for satisfying a given
dep.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
If there are multiple providers in one db, pacman used to just stop at
the first one (both during dependency resolution or for pacman -S
'provision' which uses the same code).
This adds a new conversation callback so that the user can choose which
provider to install. By default (user press enter or --noconfirm), the
first provider is still chosen, so for example the behavior of sync402
and 403 is preserved. But at least the user now has the possibility to
make the right choice in a manual run.
If one of the provider is already installed, it is picked for
reinstall/upgrade, so that provision 002/003 pactest now pass.
$ pacman -S community/smtp-server
:: There are 3 providers available for smtp-server:
1) courier-mta 2) esmtp 3) exim
Which one do you want to install?
Enter a number (default=1):
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
|
|
|
|
We were piecemeal passing fields from the test object in and it was getting
out of hand, and future work would have added yet another argument. Instead,
just pass the entire test object and entrust the rule to get what it needs.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Perform the cheap struct and string setup of the local DB at handle
initialization time to match the teardown we do when releasing the handle.
If the local DB is not needed, all real initialization is done lazily after
DB paths and other things have been configured anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
We explicitly place 'pkgbase' (and used to place 'force') fields inside
PKGINFO files, so ignore them silently instead of printing an error for
them. Also make the error message for unknown keys actually contain the key.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This will make a 404 a silent failure that returns an error code rather than
0 as was previously done, screwing up the logic used by pacman/libalpm to
allow moving onto the next server on a failed download. Fixes FS#22630.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Reported and fixed upstream, patching our version for now until a future
release fixes it:
* http://lists.gnu.org/archive/html/bug-libtool/2011-01/msg00007.html
* http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=286e87b1030c353d9cfc89dbb72d59e0391cb693
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
We were returning a package error code rather than a DB one, and we
would leak the archive memory if the database file didn't exist.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
We didn't have the proper dependencies specified for our scripts after
the move to *.in extensions, so a change to a file didn't trigger a
rebuild. Also remove old stuff from .gitignore.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Clean up some of the code by doing less string copying and printing. This is
accomplished by either doing it after we know we need it, or taking
advantage of the fact that some strings never change such as the root
directory prefix. Also, fix an issue where a file at the root level (e.g.
/foobar) could not be queried.
End result is a much faster user experience when combined with the
mbasename() changes. These timings are for looking up 113 files in /etc/,
some of which are owned and some which are not.
$ find /etc -maxdepth 1 -type f | xargs time pacman -Qo >/dev/null
6.10user 0.05system 0:06.17elapsed 99%CPU (0avgtext+0avgdata 131040maxresident)k
0inputs+0outputs (0major+9436minor)pagefaults 0swaps
$ find /etc -maxdepth 1 -type f | xargs time ./src/pacman/.libs/lt-pacman -Qo >/dev/null
0.86user 0.04system 0:00.92elapsed 99%CPU (0avgtext+0avgdata 131120maxresident)k
0inputs+0outputs (0major+9436minor)pagefaults 0swaps
I'll take a 600% increase in speed.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Rather than roll our own, use strrchr() instead, which glibc may have a
better implementation than the simple iteration method we were using.
Signed-off-by: Dan McGee <dan@archlinux.org>
|