Commit Graph

271 Commits

Author SHA1 Message Date
Chantry Xavier 594f1fbbb1 alpm_list : change the alpm_list_find* to return the matching item.
alpm_list_find and alpm_list_find_ptr will now return a void *, and
alpm_list_find_str will return a char *, instead of an int.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 18:12:41 -06:00
Chantry Xavier 250331a636 Add new --needed option for -S.
During a pacman operation such as a group install, pacman can ask several
questions such as "local version is up to date. Upgrade anyway?". They are
usually all answered either by yes or by no:
* yes when you want to reinstall all the targets.
* no when you only want to install the missing ones (either because you are
installing a group, or because you are copying a pacman -S line from wiki or
whatever).

So instead of asking this question for each target, it is now now configured
with a flag.  Yes will be the default -S behavior, No will be achieved with
the --needed flag.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 11:14:13 -06:00
Chantry Xavier 22c2043160 Minor fixes in sync.c and deps.c.
* memleak found by Nagy in checkdeps
* an useless line found by Nagy in resolvedeps
* data wasn't set to the missing dependencies in sync_prepare
* use the MALLOC macro in resolvedeps

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01 11:10:22 -06:00
Nagy Gabor 7d37d9278d Fix for sync1003 and sync1004 pactests
checkdeps and resolvedeps now take both a remove list and an install list as
arguments, allowing dependencies to be calculated correctly.

This broke the sync990 pactest, but this pactest used dependencies and
provides in an unusual way, so it has been changed.

Dan: the sync990 pactest was just plain wrong. It didn't satisfy the
dependencies correctly, so should never have succeeded.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: some variable renaming, clarification in commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 15:29:37 -06:00
Chantry Xavier 8d9ee923ec Fix several memleaks, mostly related to errors handling.
* The frontend calls alpm_trans_prepare(&data), and in case of errors,
receive the missing dependencies / conflicts / etc in the data pointer.
It apparently needs to free this structure totally with :
alpm_list_free_inner(data, free)
alpm_list_free(data)

So I added alpm_list_free_inner(data, free) in
pacman/{sync.c,remove.c,add,c}

* in _alpm_sync_prepare, the deps and asked lists were not freed in case
of errors (unresolvable conflicts).
Besides the code for handling this case was duplicated.

* in _alpm_remove_commit, free was used instead of alpm_list_free for
newfiles.

* newline fix in pacman/sync.c

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 14:01:19 -06:00
Chantry Xavier 8bee526d28 Fix a memleak in _alpm_sync_free.
An alpm_list_free call was missing.
Also make use of alpm_list_free_inner in both _alpm_sync_free and
_alpm_trans_free.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 14:00:38 -06:00
Chantry Xavier 83fa6aa289 Remove duplicated get_upgrades function, use sysupgrade instead.
The alpm_get_upgrades was exactly the same as find_replacements +
_alpm_sync_sysupgrade, except that it automatically made the eventual
replacements, without asking the user : Replace %s with %s/%s? [Y/n]

The replace question, asked in find_replacements. can now be skipped by
using a NULL trans argument, so that we get the same behavior as with
alpm_get_upgrades.

So alpm_db_get_upgrades() can now be replaced by
alpm_sync_sysupgrade(db_local, syncdbs).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-21 00:05:05 -06:00
Nagy Gabor 84ebf82319 Versioned provisions.
This patch introduces versioned provisions in "provision 1.0-1" format.
_alpm_db_whatprovides was modified accordingly (added sync500.py),
alpm_depcmp was modified accordingly (add043.py passes now; added add044.py
and add045.py).

Notes:
alpm_db_search now uses the whole versioned %PROVIDES% string in its search.
debug logging was simplified in alpm_depcmp.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xavier: fixed a few typos, duplicate const strings with strdup before
modifying them, put some debugging back in alpm_depcmp, minor code cleanups
(var/function renaming), added a note in PKGBUILD man page.]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: made strcmp checks clearer, added a comment]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18 20:05:51 -06:00
Nagy Gabor 2aa7e69da9 Add the pmconflict_t type.
pmdepmissing_t was used for two totally different things :
missing dependencies, and dependency conflicts.
So this patch simply adds a type for dep conflicts,
and convert the code to use it.

This fix the TODO in conflict.c :
/* TODO WTF is a 'depmissing' doing indicating a conflict? */

Additionally, the code in conflict.c now eliminates the duplicated conflicts.
If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored.

However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too.
This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:42:39 -06:00
Chantry Xavier 8f824e70bb Remove the IgnorePkg handling from alpm_pkg_compare_version.
And check the IgnorePkg handling is done correctly in the other places.
For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning),
but -S will install ignored packages anyway, because it was asked explicitly.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:37:16 -06:00
Chantry Xavier c8be7540a5 Remove provide.c and provide.h .
This file only contained one private function : _alpm_db_whatprovides .
And the public alpm_db_whatprovides was in db.c , so I moved everything there.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: updated POTFILES.in as well]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17 09:50:05 -06:00
Dan McGee 2322909703 War on whitespace
Run the kernel's cleanfile script on all of our source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 20:18:45 -06:00
Dan McGee 7219326dd4 Remove REQUIREDBY usage from libalpm
Instead of using the often-busted REQUIREDBY entries in the pacman database,
compute them each time they are required. This should help many things:

1. Simplify the codebase
2. Prevent future database corruption
3. Ensure when we do use requiredby, it is always correct
4. Shrink the pmpkg_t memory overhead

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 18:49:50 -06:00
Nagy Gabor b6b3b0135e Incorrect usage of alpm_db_whatprovides in sync.c
The old code thought that alpm_db_whatprovides returns with a list of strings (package names).
 Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:56:50 -06:00
Nathan Jones 8ec27835f4 Implement TotalDownload option.
Setting this option will change the download progress to show the amount
downloaded, download rate, ETA, and download percent of the entire
download list rather than per each individual file.

The progress bar is still based on the completion of the current file
regardless if the TotalDownload option is set.

This closes FS#7205.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:46:13 -06:00
Nathan Jones 3312de65e6 Implement IgnoreGroup.
This option acts as if IgnorePkg was set on each package in the group.

This closes FS#1592.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:44:30 -06:00
Dan McGee 6aeda5fbff When printing size_t, use %zd
%d was used, which worked for Linux and FreeBSD. Not so for Darwin. The
warning was probably spat out when compiling on x68_64 as well, but no
developers use this architecture as their primary one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 23:32:58 -05:00
Dan McGee 6cf8a5137e libalpm/delta: add const to most methods
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 01:28:13 -05:00
Dan McGee cc754bc6e3 libalpm: introduce MALLOC and CALLOC macros
These macros take the place of the common 4 or 5 line blocks of code we had
in most places that called malloc or calloc. This should reduce some code
duplication and make memory allocation more standard in libalpm.

Highlights:
* Note that the MALLOC macro actually uses calloc, this is just for safety
  so that memory is initialized to 0. This can be easily changed in one
  place.
* One malloc call was completely eliminated- it made more sense to do it
  on the stack.
* The use of RET_ERR in public functions (mainly the alpm_*_new functions)
  was standardized, this makes sense so pm_errno is set.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 01:00:52 -05:00
Dan McGee fe3a461703 Add some more debugging output to dep checking code
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 00:01:17 -05:00
Nagy Gabor d903fc607e Dependency error/log messages fix
The old code used only the depend.name in messages, which might have not
been informative. The new code uses the whole dependency string in
%DEPENDS% format.

(Dan: slight English clarification in one of the messages)
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 18:54:21 -05:00
Nathan Jones f5b77eb989 Add download size to target list.
This displays the download size, taking into account delta files and
cached files.

This closes FS#4182.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:30:06 -05:00
Nathan Jones e472e80c08 Download delta files if UseDelta is set.
Delta files will be used if the size is smaller than a percent
(MAX_DELTA_RATIO) of the package size.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:29:17 -05:00
Nathan Jones 520db578da Refactor md5sum checking.
This will allow deltas and packages to share the md5sum checking code.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:24:24 -05:00
Dan McGee 6db0562b8d Add gcc format attribute to _alpm_log, catch a few bugs in the process
This fixed a few of our formatted output strings that were broken before
but never being checked.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 21:25:52 -05:00
Dan McGee 5c9eec5570 libalpm: add newlines to all strings passed to log callback
This allows us to remove the hack in the frontend where we added a newline
to everything coming out of the pm_printf functions, and instead let the
developer put newlines where they want them. This should be the last hangover
of that auto-newline stuff.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-23 22:26:55 -04:00
Dan McGee c22e381a8b Post trial install changes, round one
A bunch of changes related to my first "real" install of pacman-git into
/usr/local and trying to use it.

* Shift some uses of free -> FREE in libalpm.
* Move stat and sanity checks of config paths into libalpm from the
  config and argument parsing in pacman.c.
* Fix issue where dbpath still was not defined early enough due to its
  requirement for being used in alpm_db_register. This should be rewritten
  so it doesn't have this dependency, but this will work for now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21 21:28:05 -04:00
Dan McGee 17d9122e01 Fix for FS 6404 and functionalize some cachedir handling stuff
In order to best resolve bug 6404, move some cachedir handling stuff out of
sync.c and into util.c and create two new functions: filecache_find and
filecache_setup. sync.c was rewritten to use these, and alpm_fetch_pkgurl
now also uses these routines.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20 15:23:46 -04:00
Chantry Xavier f81e619974 libalpm/sync.c : don't go back on STATE_PREPARED when committing fails.
In my opinion, a commiting transaction that failed isn't equivalent
to a prepared transaction.
Some things could have been done in the meantime.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-17 14:46:27 -04:00
Andrew Fyfe 1cb6d80631 Clean up MD5 code.
* Move alpm md5 functions to lib/libalpm/util.c
	* Remove unneeded includes for md5.h
	* Replace md5 implementation with one from http://www.xyssl.org

Dan: clean up XySSL code by removing parts we don't use, and add a note
saying what changed.
Dan: fix alpm_get_md5sum, off by one error on the malloc call and other
small things.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 13:17:33 -04:00
Andrew Fyfe ba67fdae63 Remove support for SHA1 from pacman.
There's no need for a second hashing algorithm. MD5 serves the purpose
of verifying that a package file hasn't been corrupted during download.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 11:30:38 -04:00
Dan McGee a65ad4efc1 package.h: implement origin_data union in pmpkg_t struct
We were using a void *data element in pmpkg_t before, which is unsafe by its
nature of being untyped. Reimplement data as origin_data being a union that
can hold either a path to a package file or a pointer to a cache database,
and make the other necesary updates in the code to reflect this. See package.h
for details.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-14 10:14:35 -04:00
Nagy Gabor 0d00f7095f libalpm/sync.c : two memleak fixes in _alpm_sync_prepare.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-20 10:37:24 -04:00
Chantry Xavier b0c064d59b libalpm/sync.c : fix DEPENDSONLY flag handling.
I didn't like the patch proposed by Nagy for the sync1002 pactest here:
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008971.html

So here is another attempt of fixing it.
In case of the DEPENDSONLY flag :
1) pass an empty list to resolvedeps instead of the list of targets
2) empty the trans->packages targets list before adding the resolved deps.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-20 10:34:28 -04:00
Dan McGee a1e57cbec8 Add --asdeps option to pacman
This replaces the former -D operation that was undocumented and rather
hacky. It can be used with add, upgrade, or sync transactions and will affect
all packages installed. Should close FS #7193.

Also tell makepkg to use this new flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-15 12:46:02 -04:00
Nagy Gabor c2920033d0 libalpm/deps.c : cleanup + little fix for resolvedeps.
The resolvedeps function was a bit negligent, as showed by the sync011 pactest.
Reference :
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008782.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-15 10:37:38 -04:00
Nagy Gabor ce1fb07436 libalpm/sync.c : ldconfig is run twice.
remove _alpm_ldconfig call from _alpm_sync_commit,
since sync operation causes an upgrade transaction,
where ldconfig is already run.

Reference:
http://www.archlinux.org/pipermail/pacman-dev/2007-April/008132.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-14 01:12:18 -04:00
Dan McGee 20f73d6299 Remove versioncmp.{c,h}, clean up selective #ifdefs
Remove versioncmp.c by moving all functions to locations that make sense.

Move replacement functions (for building without glibc) into util.c where
they belong, and do proper checks for them instead of using __sun__, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-12 15:20:43 -04:00
Dan McGee ea1fef69ad Remove gettext calls from all PM_LOG_DEBUG messages
There is no real reason to burden our translators with these messages, as
anyone helping to debug these will probably want them in English.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10 14:24:58 -04:00
Dan McGee 4906e15d0d Remove gettext from any alpm_logaction calls
We shouldn't translate log messages to pacman.log so it is consistant and
can be parsed by other tools. Remove all gettext _() around these strings.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-09 13:44:48 -04:00
Dan McGee cd3a636813 Remove unnecessary and extra includes
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-01 20:22:42 -04:00
Nagy Gabor da66bedf4f Remove unnecessary trans parameter from _alpm_checkdeps
The trans parameter was never used, so remove it.

Signed-off-by: Nagy Gabor <ngaba@petra.hos.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-26 11:43:02 -04:00
Dan McGee dde7b6f87a Attempt to clean up _alpm_sync_prepare
This function is an absolute disaster, so we'll take it one step at a time
here. This was a quick once-over of the whole thing, trying to straighten
out some of the spaghetti code and fix some mistakes that others found.

We are now down to two failing pactests again: sync300 and upgrade051.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-10 23:17:19 -04:00
Chantry Xavier 8588b4823b Ensure correct and consistent usage of depmiss
See comment from Nagy here :
http://www.archlinux.org/pipermail/pacman-dev/2007-April/008134.html
This also makes easier correct usage of checkdeps in sync.c,
which fixes sync901 pactest (and so bug 6057).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-10 21:41:06 -04:00
Dan McGee 35a794c2ed Allow multiple CacheDirs to be specified
This should hopefully allow multiple cache dirs to be specified in
pacman.conf and/or on the command line, and allow pacman to test
each one for the package file. The first one found to be writeable is
used as the download cache.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 13:03:25 -04:00
Dan McGee f7912e9dc6 Const correctness!
Add some 'const' keywords all over the code to make it a bit more strict on
what you can and can't do with data. This is especially important when we
return pointers to the pacman frontend- ideally this would always be
untouchable data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05 17:34:33 -04:00
Dan McGee ed13ac2cc8 Remove freespace checking code
This code depends on /etc/mtab existance, which is not very reliable in all
cases, especially in a chroot or non-Linux environment. Dump it for now
until we can find a better way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-02 13:17:26 -04:00
Dan McGee 7bd2ff6851 Move DB and cache dirs away from there dependence on ROOTDIR
This change allows us to use all autoconf specified paths, most notably
$(localstatedir). It is quite a change and touches a lot of files, as
all references to the DB and cache were done with the ROOTDIR as a prefix.

* add --lock command-line option to pacman to specify the location of the
  lockfile (this can now be specified at configure time by setting the
  $localstatedir path).
* Rip quite a few settings out of configure.ac as they are now picked by
  setting the paths during configure or make.
* Fix bug with /tmp fallback for sync downloads not working correctly
  (related to root location, now the system tmp dir is used).
* Simplified the parameters to some libalpm functions, and added get/set
  for the new lockfile option.
* Renamed several of the DEFS to names without the PM_ prefix.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-31 02:51:28 -04:00
Dan McGee 2bcecbd62c Remove unnecessary casts on malloc and elsewhere
We had many unnecessary casts, most of them dealing with malloc and
other memory allocations. The variable type should take care of it;
no need to do it explicitly. In addition, I caught a const error while
removing the casts.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14 03:16:55 -04:00
Aaron Griffin 1213212c31 Fix IgnorePkg handling with replacement packages
Allow IgnorePkg (or --ignore) to work for _either_ side of a
replacement.  For example, if 'foo' is set to replace 'bar',
ignoring either package will skip this replacement.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-05-09 23:11:39 -05:00
Dan McGee 8bbb5dd078 libalpm util.c and util.h cleanup
* Remove some unnecessary conditional compiling in util.h- move the
  functions tha required it to trans.c (along with a bunch of new header
  includes).
* Clean up util.h a bit- remove some header includes, remove universal
  libarchive include and only put it in the files that need it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29 12:47:02 -04:00
Dan McGee a58e17a1d7 Remove STRNCPY macro from libalpm
Replaced calls to the STRNCPY macro with the actual strncpy function, and
pacman passes all pactests.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29 12:03:09 -04:00
Dan McGee a57b2f233f Remove FREELISTPTR macro
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28 03:54:25 -04:00
Dan McGee a3491224df Remove FREEPKG macro and correctly type _alpm_pkg_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28 02:59:58 -04:00
Dan McGee 3cf8a333d0 Remove FREEGRP macro and correctly type _alpm_grp_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 20:38:54 -04:00
Dan McGee ec7d6955b8 Remove FREESYNC macro and correctly type _alpm_sync_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 14:53:01 -04:00
Dan McGee db9e10f142 Remove FREETRANS macro and correctly type _alpm_trans_free
Remove an unnecessary macro, and get rid of the void pointer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 14:29:23 -04:00
Dan McGee 75efcbbff6 Clean up gettext on the libalpm side
Remove inclusion of libintl.h from all files, because we can do it once
in util.c where the _() macro is defined.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 19:39:53 -04:00
Dan McGee 4a0aac3862 Fix --ignore behavior on sysupgrade
* --ignore was being ignored (haha) on sysupgrade when a package was listed
  as being a force upgrade. This adds a prompt to the user in this case asking
  what to do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-28 00:35:17 -04:00
Aaron Griffin 941c23025c * Fix asking the user to upgrade when using -Sp
* More significant error messages when -Qo fails
* Potential fix for reported error that pacman indicates corrupt packages
  when space is full on the cache dir
2007-03-21 03:08:19 +00:00
Aaron Griffin 9b08a5aa97 * Fix pacman -Se which installs depends only, as it was broken
(Is this useful to anyone?)
2007-03-20 02:36:21 +00:00
Dan McGee 869e81e1cf This commit looks much more monumental than it is. Almost all just #include
reordering and adding ones that were forgotten (noticed when trying to
compile after reordering).

* Updated the HACKING file to include information on #include usage.
* print -> vprint in "making dir" function in pactest.
2007-03-05 22:13:33 +00:00
Aaron Griffin cdb46ef3fa * Fixed a whole mess of extra '/' pathing issues when a different root is
specified
* Use db->path when appropriate
* Commented out the FAKEROOT checks in libalpm.  This should never ever be done.
  TODO test this quite a bit, as this will never cause the transactions to fail
  if RW operations are requested... right now it is totally up to the front end
  to decide when to fail
* Use realpath() to canonicalize the root path when specified, so
  _alpm_makepath() doesn't freak out
* Fixed some output/indent of MDFile and SHAFile algorithms
* More efficient sprintf() usage in MDFile/SHAFile
* Added real error output to _alpm_makepath
2007-03-04 09:08:54 +00:00
Dan McGee 8178c2f986 * Maybe that call to _alpm_trans_update_depends was necessary. Added it back
in but did it right by duplicating the package first.
2007-03-04 01:22:57 +00:00
Aaron Griffin 7f5dada885 Big commit this time:
* Moved entirely to alpm_pkg_get_* accessors, to read data on demand
* Mostly removed the INFRQ_ parameters from outside the be_files backend (making
  the backend more extensible in the long run)
* packages created from _alpm_db_scan now have the db and origin set (making
  accessors actually work for these packages)
* removed _alpm_db_ensure_pkgcache

* totally revamped the _alpm_checkconflicts function, making it cleaner and
  easier to read (and thus fix in the long run) - maintainable code ftw
  NOTE: feel free to rename the functions... I couldn't think of anything better

* removed an extra loop in sync.c:find_replacements - no sense in looping over
  an entire DB while strcmp'ing the name, when we have get_pkgfromcache

Other:
* package struct "license" -> "licenses"
* Created _alpm_sync_find (duplicate code in some places, find_pkginsync
* Minor const correctness changes along the way
* fixed a couple extra '/' pathing issues (non-issues really)
* removed a duplicate pkg_cmp function
2007-03-03 08:13:59 +00:00
Dan McGee efca1cc010 * Modified values of INFRQ_* options so we start at 0x01 and not 0x00. This
allows for the same bit operators to be used across the board on pkg_get
  operations.
* Changed name of INFRQ_NONE -> INFRQ_BASE to more clearly reflect what it
  does (loads pkg name and version).
* Added a few missing things on package functions, such as SYMEXPORT and
  ALPM_LOG_FUNC.
* Slight updates to pmenv to print 'pass' and 'fail' instead of 'passed' and
  'failed'. Keeps output a bit more concise.
* Fixed a doxygen comment spelling error. :P
2007-03-01 19:07:38 +00:00
Aaron Griffin 8fbdd03cce * Enforce const char* params when using strings
* Unified some functions names "package" -> "pkg" for consistency
* Removed the goofy 'faketarget' stuff used for dep testing
* Renamed alpm_pkg_isin -> alpm_pkg_find
* Renamed alpm_db_readpkg -> alpm_db_get_pkg
2007-02-26 08:38:48 +00:00
Aaron Griffin faad70aa54 * Too much debugging output in the alpm_pkg_compare_versions function
* Using the wrong info level for replacements
2007-02-23 07:53:25 +00:00
Aaron Griffin d584d8c068 * Modified the handling and output w.r.t. IgnorePkg entries. -Sy always ignores
these packages, but -S explicitly asks for confirmation.
2007-02-23 02:10:56 +00:00
Aaron Griffin 436f36c76b * Re-added a compare function for syncpkg's - it was removed without thinking
properly
* Error when re-reading the DB for replacements, wrong info level
* Removed an duplicate debug message "checking for package replacements"
* Check ignorepkg for REAL upgrades...
* Properly check the NOSAVE flag
* some unlink_file (remove.c) cleanup
* fix indent level on handle.c
* Force libalpm paths to end with a '/' char
* Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t)
* Added some debug output to cache and db scanning

** All pactest tests succeed again, yay **
2007-02-21 06:44:14 +00:00
Aaron Griffin 103dbb9fd1 * Refactored conflict checking within packages. Profiling from Dan showed an
unbelievable amount of strcmp() calls (25 million) due to the list searching.
  This has been reimplemented with a set-intersection scheme, due to the fact
  that file lists are always ordered. - NEEDS TESTING
* Minor clean up, "globalized" the str_cmp helper to match the alpm comparison
  signature, so we can use it elsewhere.
2007-02-13 08:15:38 +00:00
Aaron Griffin 6c5066471c Cleanup and more debug info for alpm_pkg_compare_versions 2007-02-07 05:57:28 +00:00
Aaron Griffin 67ea493ec2 Attempt to unify the -S and -Su version comparissons for when a package is newer
See FS#5388
2007-02-06 17:39:32 +00:00
Aaron Griffin 63000584b6 Implemented a crappy version of -Qu (query upgrades). This simply outputs the
packages to be upgraded in a -Su operation.  Much of the code is duplicated from
sync.c.
TODO: move the implementation to upgrades.c, and reimplement the sync_sysupgrade
function in terms of this:
    trans->packages = alpm_get_upgrades();
2007-02-04 08:26:52 +00:00
Aaron Griffin 616620ad5c * Minor output fix (move colon so it's not part of the URL)
* Added ldconfig on --sync operations too
2007-02-01 03:31:46 +00:00
Aaron Griffin 670319c2fb Debug logging changes:
* The --debug params were goofy.  New setup allows --debug without params,
  --debug=<level> where level 1=debug output, 2=debug and download output,
  3=debug, download, and function tracing output.  This seems more sane to me.
* Removed PM_LOG_FLOW1 and PM_LOG_FLOW2.  They were just confusing.  When adding
  new functions, it is near impossible to determin if your output should be
  "flow1" or "flow2" without tracking all the way up the call chain.  Rarely
  would one ever say "ok, lets just show "flow2" output.  These have both been
  replaced with PM_LOG_DEBUG
* Removed the need for the root parameter on alpm_initialize. it is now
  defaulted to PM_ROOT just like dbpath and cachedir.  This allows alpm to be
  initialized BEFORE option parsing in the front end, saving us some duplicate
  variables in the frontend.
* Cleaned up front end variables due to early alpm_initialize call.
2007-01-31 06:10:21 +00:00
Aaron Griffin da648bc24c K. Piche <kevin.piche@cgi.com>
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere
2007-01-30 08:14:10 +00:00
Aaron Griffin 195e30e8aa K. Piche <kpiche@rogers.com>
* gcc visiblity changes

Also modified _alpm_versioncmp -> alpm_versioncmp (public function) as per K.
Piche's suggestions
2007-01-30 07:47:19 +00:00
Dan McGee 1799afc9c1 Discussed on IRC for a bit, this makes the following changes for clarity:
* alpm_list_is_in    --> alpm_list_find
* alpm_list_is_strin --> alpm_list_find_str
* Flip parameters of both functions to be inline with rest of alpm_list.

First commit, woohoo.
2007-01-30 03:46:33 +00:00
Aaron Griffin 1b61cc8c69 This mainly deals with code clarity- removing currently unneeded
optimizations in order to make the code much more readable and
type-checkable. Every enum in the library now has it's own type that
should be used instead of the generic 'unsigned char'. In addition,
several #define statements dealing with constants were converted to
enums.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2007-01-24 03:02:53 +00:00
Aaron Griffin 6167017264 Preliminary checkin for alpm_list conversion
* renamed pmlist_t -> alpm_list_t
* made alpm_list_t a public type (alpm_list.h header)
* removed additional storage for registered DBs in pacman source
* some code cleanup
* removed duplicate (pm)list_display functions from pacman source
* misc code cleanup
2007-01-19 09:28:44 +00:00
Aaron Griffin 86b136bb59 Dan McGee <dpmcgee@gmail.com>
* Removed some unnecessary headers and library links
* Made things static if possible
* Cleaned up makefiles a bit
* Fixed some old comments in the code
* Fixed some errors the static code checker splint pointed out
* Backwards arguments in a memset call in _alpm_db_read (could have been worse)
* Other various small fixes

Other:
* Default to 80 columns when getcols cannot determine display width
* Removal of ._install as a valid install file in packages
2007-01-18 16:52:57 +00:00
Aaron Griffin 043a49701f * bug fix FS#6100 - fix --print-uris output 2007-01-03 08:05:13 +00:00
Aaron Griffin 61d03cc345 * Missing error label in sync.c
* Additional debug output for db_write
2007-01-02 22:29:48 +00:00
Aaron Griffin 07c1309009 * Removed latest fix from TODO.autoconf
* Attempted fix for FS#6100 - "-Spd foo" failure
* Beginning of refactoring from Dan McGee <dpmcgee@gmail.com>
2006-12-29 17:04:58 +00:00
Aaron Griffin e3aace4a4d Cleanup from Dan McGee <dpmcgee@gmail.com> and Jürgen Hötzel <juergen@hoetzel.info>
* configure swig check
* misc libalpm cleanup
2006-12-22 19:38:55 +00:00
Aaron Griffin 08dca1593f * Cosmetic changes and typo fixes
* IgnorePkg and --ignore work again
* Partial changes to support removal of conflicts for -U and -A (INCOMPLETE)
2006-12-01 09:32:29 +00:00
Aaron Griffin 9918d43ab9 * Fixed some error output for "-Sd" and "-Rsc" dealing with missing/ignored
depends
* Added valgrind suppression file
2006-11-24 07:01:27 +00:00
Aaron Griffin 986409f9bd * Completed getinfo api changes (pmmissing_t, pmtrans_t, etc)
* Modified some dependancy checking
* Changed "performing local database upgrade" message to be more clear
* Change 'usize' to 'isize' in database files
* Scriptlet output is now sent to pacman's log file
* Limited some debugging output to be more clear
2006-11-22 09:03:41 +00:00
Aaron Griffin aa1c0ba9f8 * repo-add script - to add entries to a db file directly from package data (no PKGBUILD)
* libalpm api changes - move from a _getinfo(p, WHAT_WE_WANT) scheme to a
  typesafe _get_what_we_want(p) scheme [not 100% complete yet]
* some const correctness changes
* removal of PM_* types in alpm.h in favor of the pm*_t types used throughout
  libalpm
2006-11-20 09:10:23 +00:00
Aaron Griffin 00ce9ea739 * Initial changes to gensync - makepkg changes were not checked in from another
machine - still pending
* Addition of _alpm_pkg_makefilename to simplify the with/without -ARCH prefix
  scheme we're going with for the interim
2006-11-15 07:50:37 +00:00
Aaron Griffin 7d6161ccc3 * has_archname changes
* makepkg attempt at multiple file integrity checks
* honor "force" option on -S packages (not just -Su)
2006-11-14 17:26:19 +00:00
Aaron Griffin 4470e5ce01 * Numerous mini valgrind fixes.
* Addition of hacky architecture check in the _splitname function
* Removal of libfetch from the archlinux proper - it has been renamed to
  libdownload and can be found at http://phraktured.net/libdownload
* Merge of _some_ of the Frugalware makepkg change - this may still be
  incomplete
* Removal of libftp from cvs proper
* PKGBUILD manpage now says 'PKGBUILD' instead of FrugalBuild (he he)
2006-11-14 07:58:42 +00:00
Aaron Griffin 3bf918dc4e Fixed pacman -U:
* Accidental database read of a file-based package (whoops)
    * Proper fetching of url-based -U or -A
Removed some newlines from _alpm_log calls, to make debug output more concise
2006-11-01 06:30:47 +00:00
Aaron Griffin af2fb3324a Numerous changes:
*   Furthered the "lazy caching" to force the pkgcache to read nothing
    (INFRQ_NONE) by default.  Anything requiring package data should now check
    the infolevel of each package and attempt to update it.  This could be
    ironed out a bit more later (by using the front-end get_info function
*   Switched to libfetch.  Drastic changes to the download code and the callback
    progress bar functions.  Also fixed the return value of
    _alpm_downloadfiles_forreal.  Downloading now supports http, ftp, https, and
    files urls, along with 'mtime's and numerous other fancy features from
    libfetch.
2006-10-31 06:39:59 +00:00
Aaron Griffin 1568fd98d8 Minor changes:
* Moved the pmhandle_t extern decl around
    * Fixed a doxygen complaint
2006-10-21 01:27:35 +00:00
Aaron Griffin 7131b7ac87 A handful of minor changes:
* Removed the PMList typedef, in favor of the same naming scheme other
      structs use 'pmlist_t'
    * Added a time stamp on debug output, to make it more informational
    * Moved alpm_db_register to _alpm_db_register, making the public function
      not take a callback parameter
2006-10-20 06:26:55 +00:00
Aaron Griffin d37ad04873 Merged frugalware changes (too many to list). Also added some config file
handling changes (support [sections] to carry over to included files - this
helps with backwards compatibility with existing pacman config files)
2006-10-15 19:31:03 +00:00
Judd Vinet cf6da173f6 removed libtar support in favour of libarchive 2006-09-28 20:51:33 +00:00
Judd Vinet bb787e26ee first stage of i18n stuff from VMiklos 2006-05-15 02:19:57 +00:00
Aurelien Foret a08a9896c9 code cleanup 2006-03-09 19:12:09 +00:00
Aurelien Foret 7e9b70a208 added a FLAG_NOCONFLICT 2006-03-04 10:16:36 +00:00
Aurelien Foret 5261c7fafb code cleanup 2006-03-02 19:04:40 +00:00
Aurelien Foret 0b4ab2c0a8 added ERROR logs in case of malloc failures (patch from VMiklos <vmiklos@frugalware.org>) 2006-03-01 07:51:00 +00:00
Aurelien Foret 16ff7cfa8e improved _alpm_list_free handling 2006-02-22 20:49:33 +00:00
Aurelien Foret 3f9ddf262d skipped conflict resolution for targets removed from transaction set 2006-02-22 19:49:06 +00:00
Aurelien Foret be39f49a54 prepend library function names with _alpm (helped with the patch from VMiklos <vmiklos@frugalware.org>)
added log and event callbacks to sync_commit internal transactions
2006-02-17 22:35:26 +00:00
Aurelien Foret a2d1b58210 code cleanup 2006-02-16 23:05:52 +00:00
Aurelien Foret 58a7e85534 - db_write: add support to write both local and sync entries
- code cleanup
2006-02-16 21:02:39 +00:00
Aurelien Foret 8061874991 - reworked debug messages
- synchro with pacman 2.9.8
2006-02-11 19:01:56 +00:00
Aurelien Foret c5aca9529f code factorization: take 2 2006-02-07 21:33:09 +00:00
Aurelien Foret bbb48a85f0 code factorization 2006-02-07 19:08:02 +00:00
Aurelien Foret ad3baca0f4 - sync_prepare: fixed a case where a conflict should be removed from the target list
- avoided possible duplicates in target list (patch from VMiklos <vmiklos@frugalware.org>)
- added more debug logs
2006-02-05 09:15:20 +00:00
Judd Vinet f3c5f9b4d1 Search through package provides if no literal matches are found when scanning for targets with -S 2006-01-28 04:48:51 +00:00
Aurelien Foret fc8be93314 resolvedeps: return the depmiss info to the frontend in case of failure 2006-01-21 18:28:38 +00:00
Aurelien Foret cf94007aed more code cleanup yet 2006-01-18 22:37:16 +00:00
Aurelien Foret 510d57b577 even more code cleanup 2006-01-17 21:18:33 +00:00
Aurelien Foret 6e5a62dd12 more code cleanup 2006-01-16 22:27:09 +00:00
Aurelien Foret 6dd2ecf4fa pulled out conflict checkings from checkdeps() in its own function: checkconflicts() 2006-01-15 15:55:16 +00:00
Aurelien Foret 83839f9513 sync_prepare: added a missing chunk of code for dependency checks of packages elected for removal 2006-01-14 15:08:01 +00:00
Aurelien Foret aeb0133974 sysupgrade: skip version cmp for pkg elected for removal (patch from VMiklos <vmiklos@frugalware.org>) 2006-01-14 08:14:55 +00:00
Aurelien Foret 851dd3d16b improved log and debug messages 2006-01-13 20:46:01 +00:00
Aurelien Foret 36730a711b - added 2 more ORE tags (to be reviewed) in the replace/conflict sync code
- code cleanup
2006-01-11 12:56:38 +00:00
Aurelien Foret 540d3d49b2 code cleanup 2006-01-10 22:08:53 +00:00
Aurelien Foret 668e58626d added ALLDEPS transaction flag mainly to handle "makepkg -s" 2006-01-10 18:19:06 +00:00
Aurelien Foret fd6ce1f4cb - merged pkg_new and pkg_dummy functions
- renamed _alpm_log_action to _alpm_logaction
2006-01-09 20:16:00 +00:00
Aurelien Foret 77be3f53e9 removed all code related to PM_SYNC_TYPE_DEPEND 2006-01-07 20:05:10 +00:00
Aurelien Foret 86e5c8bc06 sync_commit can now return conflicting files with a trans_prepare like data structure (patch from VMiklos <vmiklos@frugalware.org>) 2006-01-07 18:42:44 +00:00
Aurelien Foret e405204915 removed a restriction: the data parameter of XXX_prepare functions can be NULL 2006-01-07 18:25:28 +00:00
Aurelien Foret 02694534be Fixed a regression in the conflict handling code 2006-01-07 18:01:26 +00:00
Aurelien Foret bde9d69636 added more debug logs in the sync conflict/replace code 2006-01-07 17:59:26 +00:00
Aurelien Foret f3a4197e34 code cleanup (mainly removed line spaces at the beginning of lines by tabulations) 2006-01-07 09:42:48 +00:00
Aurelien Foret 6c3657b702 removed a misleading PM_ERR_XXX occurrence 2006-01-06 23:26:02 +00:00
Aurelien Foret db8a5e3586 - sync: populates *data when a conflict can't be resolved
- add: code cleanup
2006-01-06 22:58:01 +00:00
Aurelien Foret 45720f32e9 fixed the usage of 4 list_is_in calls (should have been list_is_strin) 2006-01-06 20:47:26 +00:00
Aurelien Foret 5fc2e009dc - started to rename list_XXX calls to _alpm_list_XXX
- fixed 2 compilation warnings
2006-01-05 21:49:42 +00:00
Aurelien Foret 7858f4c9b4 - fix for sync conflicts (patch from VMiklos <vmiklos@frugalware.org>)
- sync code cleanup
- added the deps check for targets to be removed in sync_prepare()
2006-01-05 20:53:41 +00:00
Aurelien Foret f48aced5b2 code cleanup 2006-01-02 21:33:58 +00:00
Aurelien Foret 5839652c41 code cleanup 2006-01-02 20:28:46 +00:00
Judd Vinet 96de3501ab patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSION 2006-01-02 19:55:35 +00:00
Aurelien Foret 15bc6e5508 removed some overlapping pm_errno assignments 2006-01-01 12:42:33 +00:00
Judd Vinet 6bd15469b1 renamed rpmvercmp to versioncmp, added some fixes from isteve@bofh.cz 2005-12-26 16:48:37 +00:00
Judd Vinet 58c9d5d663 applied first try at sync conflict handling (VMiklos) plus a couple changes 2005-12-26 06:40:29 +00:00
Judd Vinet f762464630 added Doxyfile 2005-11-21 22:14:32 +00:00
Aurelien Foret fffe7a8ef4 fixed wrong prototype usage for trans_new() 2005-11-07 13:00:22 +00:00
Judd Vinet cebc7ace60 fixed a segfault that occured in special cases when propagating requiredby fields during package replacements 2005-10-21 18:53:40 +00:00
Aurelien Foret 609466fdeb added PM_OPT_CACHEDIR library option 2005-10-10 20:41:35 +00:00
Judd Vinet b3450fbe0d removed debug stmt 2005-10-09 18:48:39 +00:00
Judd Vinet a36ded25eb added conversation callback support for transactions 2005-10-09 06:09:57 +00:00
Aurelien Foret 8ffb82a691 Code update to make use of PKG_FULLNAME_LEN 2005-10-08 21:36:47 +00:00