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

3352 Commits

Author SHA1 Message Date
Dan McGee
d6a9436143 Add three clean cache tests
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>
2011-01-31 09:37:20 -06:00
Dan McGee
2d5ec02d7c pactest: allow checking for cache file existence
This will allow some tests to be added for cache cleaning.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Xavier Chantry
ed1aef7bc5 libalpm: fix db_update documentation
return codes were mixed up

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:36:30 -06:00
Dan McGee
2e1b5c96a6 Call count() once in callback
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 13:34:51 -06:00
Xavier Chantry
e263cf7231 alpm: drop old target interfaces
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>
2011-01-29 19:40:08 +01:00
Xavier Chantry
05f2abfba9 select_display: per-database output
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>
2011-01-29 19:40:08 +01:00
Xavier Chantry
2dd53e50de pacman: improve select-question
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>
2011-01-29 19:40:07 +01:00
Xavier Chantry
00fec5e250 pacman/sync: implement interactive group selection
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:07 +01:00
Xavier Chantry
2a90dbe3a8 alpm: deprecate old interface
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>
2011-01-29 19:39:06 +01:00
Xavier Chantry
eed7ba92e8 pacman/remove: switch to new alpm_remove_pkg interface
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:39:05 +01:00
Xavier Chantry
4a72c0964a pacman/upgrade: switch to new interface
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>
2011-01-29 19:33:16 +01:00
Xavier Chantry
953e0d48d7 alpm: new alpm_remove_pkg interface
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>
2011-01-29 19:33:16 +01:00
Xavier Chantry
f2fcf7eeb1 pacman/sync: rewrite target handling
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>
2011-01-29 19:33:16 +01:00
Xavier Chantry
1767a569c6 alpm: add alpm_find_grp_pkgs
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>
2011-01-29 19:33:16 +01:00
Xavier Chantry
fb7e1b4b9b alpm: new alpm_add_pkg interface
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>
2011-01-29 19:33:15 +01:00
Xavier Chantry
b8590ed634 alpm/dep: add alpm_find_dbs_satisfier
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>
2011-01-29 19:33:15 +01:00
Xavier Chantry
4097c98c1e Add interactive provider selection
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>
2011-01-29 19:33:15 +01:00
Dan McGee
ba97a22ce1 Merge branch 'maint' 2011-01-29 12:16:11 -06:00
Dan McGee
ce089e1b97 pactest: pass entire test to rule.check()
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>
2011-01-29 12:15:15 -06:00
Dan McGee
ef86da97f5 Remove need to explicitly register the local DB
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>
2011-01-29 12:13:56 -06:00
Dan McGee
9b876fff09 Ignore known but unused package descfile fields
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>
2011-01-28 17:34:06 -06:00
Thomas Bächler
272f7cf25e libalpm: Fix a missing "nicht" (not) in German translation.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 16:41:21 -06:00
Dan McGee
f95080884c Enable failure on server error for curl download command
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>
2011-01-28 12:00:00 -06:00
Dan McGee
7f93f0620c Fix libtool performance regression with many arguments
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>
2011-01-28 11:42:35 -06:00
Dan McGee
fe76c353af Fix memory leak and error code in DB reading
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>
2011-01-24 21:46:42 -06: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
Dan McGee
d6a997ee38 Update contrib/ Makefile
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>
2011-01-24 15:19:14 -06:00
Dan McGee
27e8f06e03 Query fileowner performance improvements
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>
2011-01-22 16:34:42 -06:00
Dan McGee
4d291508c2 Improve mbasename performance
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>
2011-01-22 16:34:42 -06:00
Dan McGee
d16a5ae7dd Merge branch 'backup-status' 2011-01-22 16:32:34 -06:00
Dan McGee
6e71922e6c Add a few new provides tests
These deal with already-installed packages and how they should be the
preferred provider in cases where provider selection now occurs. A few
involve multiple sync repos.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
a99e7272b8 pactest: sort repos by alpha order in config file
The order was non-deterministic before, and just happened to work for
sync023.py as it was written. Ensure there is some sort of predictable
ordering.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
b3d71bf7d0 pactest: use new-style python classes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
cda7d7847f Be smarter about failure to read backup file contents
Instead of always printing MISSING, we can switch on the errno value set by
access() and print a more useful string. In this case, handle files we can't
read by printing UNREADABLE, print MISSING on ENOENT, and print UNKNOWN for
anything else. Fixes FS#22546.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:38:34 -06:00
Dan McGee
c91bd3dda9 Mark backup status strings as untranslated
And also change "Not Modified" -> "UNMODIFIED" for consistency. This makes
it a lot easier to machine-parse this and not worry about locale
differences.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:25:45 -06:00
Dan McGee
61864e1f6f Refactor backup file status check into separate function
This will make it a lot easier to use this stuff elsewhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:25:21 -06:00
Dan McGee
32727efc38 pactest: revamp modified logic
Remove all logic dealing with PKG_MODIFIED as this rule no longer exists.
This removes a bunch of unnecessary stat and checksum logic that most of the
time we were never even using. Also update the file modified checks to mark
every file created using mkfile() with an older time so any modified checks
will just work without hacks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:19:21 -06:00
Dan McGee
5699f2c94c Modify all pactests to not use PKG_MODIFIED
All conditions that this particular rule tested are better served by using a
more specific rule, whether that be checking a package version or whether
files inside the package have changed or still exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:19:17 -06:00
Dan McGee
2a3b5e40bc pactest: pylint changes for pmdb
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
8f711a7181 pactest: pylint changes for util
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
ff96649eeb pactest: pylint changes for pmtest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
d94346ede2 pactest: pylint changes for pmpkg
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
946f4af7f3 pactest: pylint changes for pmrule
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
2c6be06bba pactest: pylint changes for pmenv
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
505ad87e67 pactest: pylint changes for pactest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
0de314205f pactest: pylint changes for pmfile
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
36ea02cc48 Compute download size for sync packages only
Neither packages from files nor packages from the local database will ever
have a download size.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:11:29 -06:00
Dan McGee
c4332c8091 Merge branch 'maint' 2011-01-22 10:12:46 -06:00
Dan McGee
a97e28205a Update 3.4.3 release date
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:07:46 -06:00
Dan McGee
51175f31c4 Merge branch 'epoch-work' 2011-01-22 10:03:51 -06:00