Commit Graph

239 Commits

Author SHA1 Message Date
Dan McGee 7249c08bdf Improve changelog handling through addition of open/read/close functions
Thanks to Allan for inspiring all this work on what was one little TODO item
in the codebase. :)

Change changelog handling so we can now dump a changelog from both installed
packages and package files (fixes FS#7371). We do this by moving all of the
machinery to the backend where it should have been in the first place.

The changelog reading is now done through a open/read/close interface
similar to the fopen/fread/fclose functions (can you guess how it is done?).
It is buffered by the frontend, so programs using the library can read as
much or as little as they want at a time.

Unfortunately, I could not implement a changelog_feof function due to some
shortcomings of libarchive. However, I left the stub code in there,
commented out, in case it becomes possible later or anyone wants to take a
stab at it.

Original-work-by: Allan McRae <mcrae_allan@hotmail.com>
Improved-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-09 11:33:08 -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
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
Dan McGee f5d2150e9d Remove -F/--freshen operation
This operation made sense in the days before sync DBs existed, but it no
longer has the same usefulness it once did.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-21 11:51:17 -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 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 65fb99133d Simple s/conflict/fileconflict/ renaming.
The names related to conflicts are misleading :
For dependencies conflicts, the type is pmdepmissing,
and the function names contain just "conflict".

For file conflicts, the type is pmconflict,
and some functions contained just "conflict", some others "fileconflict".

So this is the first step for improving the situation.
Original idea/patch from Nagy, but the patch already didn't apply anymore,
so I did it again.
The main difference is that I kept the conflictype, with the following renaming :

pmconflicttype_t -> pmfileconflicttype_t
PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET
PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:42:34 -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
Dan McGee 1b2817f539 Enforce const correctness on dep functions and rewrite alpm_dep_get_string
Add some const specifiers to the dep functions that can have them. In
addition, rewrite alpm_dep_get_string to use snprintf and cover all of
the bases (operators).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 00:13:05 -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 5c58b3d500 Add IgnoreGroup and --ignoregroup option.
This will be used in the next commit.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:44:26 -06:00
Dan McGee 006387828c Readd scriptlet logging that got lost in an earlier commit
I broke scriptlet logging with ad691001e2.
Readd more or less what was there before, although it still needs a lot of
work including hopefully rewriting it to a new event subsystem and having
it log to a seperate file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 11:27:41 -06: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
Nagy Gabor 0cff7c6bdf Add alpm_dep_get_string method
Public alpm_dep_get_string function is introduced, which converts a
pmdepend_t structure to printable string in %DEPENDS% format.  This
function is now used in pacman to print dependency error messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-25 07:10:08 -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 0c2cc108d3 Add pmdelta_t structure and functions to libalpm.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:21:44 -05:00
Dan McGee 0adedc536f Updates to fix Doxygen documentation generation
We had way too much going on with the Doxygen manpage generation. Clean it
up quite a bit by removing directory manpages, using relative paths, not
having a manpage for every single alpm function, and ensuring internal
functions are not documented publicly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-14 17:29:32 -05:00
Aaron Griffin f2f4ada1d6 Remove buildtype package accessor prototype
This was removed a while ago, but the prototype was still hanging out.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin 47622eef4d Support for localized times in metadata
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.

In the case of removal of text time support, this code will fail gracefully,
returning the start of the epoch for broken packages.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Dan McGee 219808714f Add 'full' parameter to alpm_pkg_load
In most cases, we want to fully scan a package when we load it, which serves
as a integrity verification check. However, there are times when it is only
desired to read the metadata and nothing else, so allow the caller of pkg_load
to choose the behavior they need.

This pays big dividends in speeding up pacman cache cleaning functionality.
Old (729 packages):
real    1m43.717s
user    1m20.785s
sys     0m2.993s
New (729 packages):
real    0m25.607s
user    0m19.389s
sys     0m0.543s

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee f7bbfe4052 Remove package name dependency from libalpm
Previously, package names must match a specified scheme or they will cause
pacman add operations to fail. This is not a very intelligent or necessary
way to act, so remove the dependency on the name of the package to be
installed and read all relevant information from the metadata instead.

This does have one causality to be addressed later- pacman cache cleaning
functionality, which has never been phenomenal, just lost most capability.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee fc0e83f05b Preliminary support for optdepends
Add some alpm functions for getting optdepends, have makepkg include them
in the PKGINFO file, and have a pacman -Qi operation display the raw string
as stored by libalpm.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-25 23:02:30 -05:00
Chantry Xavier b0aa510592 trans.c : reworking of transaction interruptions
My two previous hacks related to this part
(8038190c7c and
b15a5194d1) were caused by the lack of
understanding of a feature introduced a while ago:
Better control over CTRL-C interruptions -- do not leave the DB in an
inconsistent state (54008798ef).

Now I have been looking at this commit, and the added feature is indeed
interesting. The main problem I had with it is that it does a rather
unusual use of alpm_trans_release, which caused a few problems that I tried
to fix in a weird way. I think these problems were caused by the fact that
there weren't any difference between "interrupt transaction" and "release a
transaction which failed" actions from the alpm_trans_release POV.  So I
decided to add a new function instead, alpm_trans_interrupt, which is
called on Ctrl+C, and which only sets trans->state to STATE_INTERRUPTED so
that remove_commit and add_commit can exit cleanly at a safe moment. This
allowed me to revert my two previous hacks as well.

Also ensure we handle SIGINT correctly in all cases- if a transaction is
not ongoing, then we can free the transaction and exit quickly.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16 20:17:44 -05:00
Chantry Xavier 046c8a6819 Remove the DB consistency check from pacman and libalpm.
This reverts commit dfc85cb5f5
and b6f3fe6957.
This DB check is already in testdb (among others).

Also testdb now uses the db path set at make time by default,
so specifying the db path is optional.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16 20:10:18 -05:00
Stefano Esposito 27acdc2c94 make alpm_strerror binding friendly
I'm currently working on python bindings for alpm written in pyrex. While
working i found that declaring alpm_strerror as
	char * alpm_strerror (void)
instead of
	char * alpm_strerror (int err)

and then using pm_errno in the implementation instead of err, could make it
more bindings-friendly.

Dan: cleaned up and added void to declaration. Instead of replacing existing
function, add a new function called 'alpm_strerrorlast(void)'.

Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11 20:58:27 -05:00
Chantry Xavier f21c45c0dd libalpm/deps.c : export _alpm_checkdeps (-> alpm_checkdeps).
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11 20:42:03 -05:00
Chantry Xavier be32aa3004 libalpm/package.c : add new alpm_pkg_compute_requiredby function.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-11 20:41:54 -05:00
Travis Willard b6f89f03af separate local from sync dbs on filesystem
Introduce two new methods into the API - alpm_db_register_sync and
alpm_db_register_local, which replace the functionality of
alpm_db_register. db_register_local always returns the local DB, and
db_register_sync will always try to register a sync DB. This conceptually
separates the local DB from sync DBs in the code. Also updated the pacman
frontend to use the new functions. In addition, this changes the location
of all sync DBs in the filesystem from $DBPATH/$REPO to $DBPATH/sync/$REPO,
This removes the silly limitation that a sync DB couldn't be named 'local',
along with structurally separating sync DBs and the local DB in the
filesystem.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-26 23:44:32 -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 942175feaa Add const qualifier to md5_file and alpm_get_md5sum
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20 12:58:17 -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
Chantry Xavier ee977019e3 libalpm/db.c : add alpm_db_unregister_all.
This basically moves the code from alpm_release, which was mostly about
unregistering all databases, to a safer alpm_db_unregister_all.
This allows to avoid modifying the dbs_sync list while iterating over it,
and and also prevent alpm_release from looping infinitely when a database
can't be unregistered.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-16 11:08:17 -04:00
Chantry Xavier 99572ed8f6 new pmdepend_t / pmdepmissing_t accessors.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-16 09:21:13 -04:00
Dan McGee f0ea21cffc Ensure requiredby entries are removed during an upgrade
This fixes the failure of the requiredby004 pactest in a not so pretty way,
but it gets the job done. I purposely used the extremely long name of
PM_TRANS_TYPE_REMOVEUPGRADE to be both clear and in the hope that someone
else will figure out a better solution.

Original idea from Nagy Gabor, patch updated and cleaned for current code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-14 09:34:39 -04:00
Andrew Fyfe 5e68e9d451 Cleanup of pacman_deptest()
Clean up some left over code from
http://projects.archlinux.org/git/gitweb.cgi?p=pacman.git;a=commitdiff;h=7653bb93997f52848b54ab80868cd6da52808a75

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10 10:15:24 -04:00
Dan McGee 15e1ce2e70 Various small fixes as suggested by some static code checkers
I ran flawfinder and sparse over the pacman source code and found a few
things that were worth fixing (and were quick fixes).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-06 12:11:55 -04:00
Dan McGee 7daa6708d2 Remove lockfile configuration from frontend, make it job of libalpm
I previously introduced some patches to make just about every path in
pacman/libalpm configurable; doing this with the lockfile seemed a bit too
far and we really should just place the lockfile where it belongs- with the
DB that needs locking.

More details in this thread:
http://archlinux.org/pipermail/pacman-dev/2007-June/008499.html

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27 23:34:38 -04:00
Dan McGee ad691001e2 Remove scriptlet START and DONE commands that we don't use
The scriptlet calling had some unneeded complexity for the time being
which we aren't using here. Let's get rid of it until we find a good way
to implement it correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27 22:12:59 -04:00
Dan McGee 5e774d72b0 Remove some more diskspace checking holdover stuff
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-13 00:31:01 -04:00
Nagy Gabor 544bcbe664 Implement simple topological sort algorithm for sortbydeps
Based on the "depth first search" algorithm, for more infos visit:
http://en.wikipedia.org/wiki/Topological_sorting

The previous algorithm used by sortbydeps was too slow, and to work around
it the number of steps needed to get correct result was reduced greatly.
So it produced wrong results in several cases :
1) smoke001.py
2) http://bugs.archlinux.org/task/7229

More here: http://archlinux.org/pipermail/pacman-dev/2007-April/008057.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-10 22:13:58 -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
VMiklos dfc85cb5f5 Add a alpm_db_test() function to the backend for checking DB consistency
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:58:12 -04:00
Dan McGee 25c5b39d05 Fix up things after the last few changes
* Readd default logmask of ERROR and WARNING
* Remove DOWNLOAD log level as it no longer applies
* Add 'no targets' logic back in where it applies
* Switch some prints in parseconfig to ERROR

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:57:50 -04:00
Dan McGee a32ca90192 Remove logmask stuff from backend; switch logging callback to new pm_printf
Remove the logmask functionality from the backend as it has been moved to
the frontend, and change the logging callback function to use pm_printf.

In addition, make much better use of va_list- use the args list instead
of a arbitrarily chosen string to print to in the logging functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:57:50 -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 26e3db423a Merge branch 'alpm.c_cleanup' into frontend_config
Conflicts:

	lib/libalpm/alpm.c
2007-06-04 23:32:38 -04:00
Dan McGee 466b79bf8f Fix up outstanding parseconfig issues
The db variable was left unset when calling alpm_db_register, leading
to a failure to ever register a sync db. Also added a check to ensure
DBPath was set when trying to register a database.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -04:00
Dan McGee 358cc5804a Rip alpm_parse_config out of libalpm
Switch over to the new frontend parseconfig.

* Fix a few issues in parseconfig
* Remove unused callback upon database registration
* Remove conf file related errors from error.c/alpm.h

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -04:00
Dan McGee 64d36db5f4 Move functions out of alpm.c to where they belong
alpm.h is the only "publically viewable" file, so there is no reason to have
functions in alpm.c that belong in package.c, db.c, etc. Move the functions
where they belong and leave only the library init functions in alpm.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 22:52:04 -04:00
Nathan Jones 80237630af Change -z|--showsize flag to ShowSize pacman.conf option
Also cleaned up some duplicate printf lines related to the ShowSize option.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-01 11:00:39 -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 eeb38ef677 Remove 'removes' array from libalpm
We don't use this functionality for now, so get rid of it and the
functions associated with it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28 19:56:29 -04:00
Dan McGee 6a1dfdf292 Set the correct type on the log callback function
Somehow missed this earlier when changing everything to types.
unsigned short -> pmloglevel_t wherever necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 18:59:02 -04:00
Dan McGee c3ad8bd75f Make all paths and file locations configurable
Several important paths, file locations, and extensions were #define-d in the
source code instead of being configurable. This moves all of these to
the configure script where they can be picked upon running ./configure. We
may later want to make some of these even more visible and move them to
pacman.conf.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-30 15:55:58 -04:00
Dan McGee bbe55b5ce9 Doxygen fixups for libalpm
We haven't done a whole lot with Doxygen so far, so this updates some of the
things that have changed a lot- namely, the now public exposure of alpm_list.
All functions in this file have now been Doxygen commented, and a few other
things in alpm.c were fixed as well. In addition, the Doxygen config file
was updated.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-29 00:40:49 -04:00
Aaron Griffin bd55cf548c James Rosten <seinfeld90@gmail.com>
* Two new pactest test cases
* Fix some "required by" / "requires" output by unifying all "dependency types"
  to a single value (PM_DEP_TYPE_DEPEND)
2007-03-19 04:23:45 +00:00
Aaron Griffin 166ffc4f9e * Bug fix for makepkg dependency testing. This requires that we
expose alpm_splitdep and alpm_depcmp as public symbols
* Removed a duplicate strtrim for question responses
2007-03-07 07:45:30 +00:00
Dan McGee 5baba84397 * Added missing header include guards in md5.h and sha1.h.
* Some header cleanup on the pacman side of things - we had alpm.h instead
  alpm_list.h in a few headers.
* removed an extra slash in path-building snprintf in server.c.
2007-03-06 01:21:41 +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
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 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 dfb1f1e237 * Updated the README file
* Removed the handle->needles param.  It's not needed not that alpm_list_t is
  public
2007-02-12 04:45:21 +00:00
Aaron Griffin f8cd4858ca * I made "alpm_versioncmp" public a while back, without noticing this was already done (alpm_pkg_vercmp). I dropped this change, making versioncmp "private" again. (alpm_versioncmp -> _alpm_versioncmp, hidden symbol)
* Make alpm_get_upgrades use the same version check that -Su and -S use.
2007-02-09 21:08:10 +00:00
Aaron Griffin 7f1e75edf1 * Remove "RETRIEVE_LOCAL" trans event as libdownload handles local files 2007-02-09 16:02:20 +00:00
Aaron Griffin 41a8621ba0 * Fixed some missing error values in strerror
* Cleanup up some error enum values
* Revamped the 'pmserver_t' functionality.  Less allocation,
  removed a param and cleaned up some duplicate URL parsing
2007-02-09 10:10:49 +00:00
Aaron Griffin a94e22d924 Attempt to NOT remove packages on filesystem errors (like a read-only
filesystem). See FS#5887
2007-02-08 08:09:34 +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 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
Dan McGee 44dc48f10f slight line spacing/indent updates 2007-01-31 02:58:12 +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
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 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 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 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 3e608e7e85 * Improved mcheck output
* Added minor libalpm const correctness
* Mini-memory fixes
2006-11-08 08:14:29 +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 e21f4c8f2e Added PM_DLFNM_LEN define, via VMiklos
http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20061023154138-e2957-de4837230b091cbc2136306e1c55a4b79cc72fc8.gz
2006-10-24 04:33:40 +00:00
Aaron Griffin a719484f1e Reverted the "out of memory" error to 1 to prevent API changes.
This should be changed later, or at least everything fixed up.  Typically a 1
return indicates "an error occured" and some functions still might just return
error on failure.
2006-10-21 21:30:43 +00:00
Aaron Griffin 454cf699a5 More extern moving - keep extern decls in the headers makes for easier/better
reuse.
2006-10-21 01:38:59 +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 ac30eb2c1e Applied Frugalware patch from Christian Hamar alias krix <krics@linuxforum.hu>
for file-conflict progress bar
Also did some CVS cleanup, removing some of the autogenerated files that
shouldn't have been there
2006-10-15 23:54:43 +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
Aurelien Foret ddcfaa1f5a removed an uneeded error code (DB_UPTODATE) 2006-03-08 20:57:03 +00:00
Aurelien Foret 27be34c09b added a NOSCRIPLET flag to transactions (patch from VMiklos <vmiklos@frugalware.org>) 2006-03-07 18:17:03 +00:00
Aurelien Foret 1bd8f57a18 - changed flags type from char to int
- downloadonly implies FLAG_NOCONFLICTS
2006-03-04 15:33:44 +00:00
Aurelien Foret 7e9b70a208 added a FLAG_NOCONFLICT 2006-03-04 10:16:36 +00:00
Aurelien Foret dfa1a2a13a removed HoldPkg option (frontend only feature) 2006-03-02 20:12:11 +00:00
Aurelien Foret 6e76fd8af3 - merged db_open and db_create into one single function
- moved the .lastupdate support to the frontend
2006-02-15 22:51:28 +00:00
Aurelien Foret 5aa5142815 error codes cleanup 2006-02-07 22:01:50 +00:00
Aurelien Foret 298c1a8e97 added alpm_pkg_checkmd5sum() to check md5sums for package from the cache 2006-02-05 09:57:29 +00:00
Aurelien Foret 325e3b6b98 added a pmconflict_t structure to handle file conflicts 2006-02-05 09:27:26 +00:00
Aurelien Foret 18986b1805 reworked lock handling (patch from VMiklos <vmiklos@frugalware.fr>) 2006-01-26 22:16:57 +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 d42c6bdc49 removed unuseful error codes 2006-01-13 20:55:39 +00:00
Aurelien Foret 668e58626d added ALLDEPS transaction flag mainly to handle "makepkg -s" 2006-01-10 18:19:06 +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 f3a4197e34 code cleanup (mainly removed line spaces at the beginning of lines by tabulations) 2006-01-07 09:42:48 +00:00
Aurelien Foret 2c22045ba8 - fixed a regression with pacman 2.x (reworked patch from VMiklos <vmiklos@frugalware.org>):
if pacman is desiganted as a target in a sysupgrade operation, it should be able to upgrade itself first upon user request.
- removed uneeded sanity checks in alpm interface calls
- replaced printf by MSG in pacman
2006-01-06 14:00:03 +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 316cd2b573 code cleanup 2006-01-02 16:20:01 +00:00
Aurelien Foret db0df44598 code cleanup 2006-01-02 13:26:30 +00:00
Aurelien Foret 7df7ca1738 Allowed C++ usage (patch from VMiklos <vmiklos@frugalware.org>) 2005-12-28 10:38:12 +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
Aurelien Foret b2df466ffd fixed compilation warnings 2005-11-07 12:57:33 +00:00
Judd Vinet a1526a3e7d added first part of the autoconf stuff - patch from Christian Hamar <krics@linuxforum.hu> 2005-10-17 18:52:43 +00:00
Aurelien Foret 609466fdeb added PM_OPT_CACHEDIR library option 2005-10-10 20:41:35 +00:00
Aurelien Foret 6b7b9787d5 - more sanity checks
- alpm_pkg_free can now return an error code
2005-10-10 15:03:35 +00:00
Judd Vinet a36ded25eb added conversation callback support for transactions 2005-10-09 06:09:57 +00:00
Judd Vinet 6f75de92b5 added more error messages, enabled the db permission check in trans_commit 2005-10-08 23:40:49 +00:00
Aurelien Foret 0d6a2edaa8 Moved the REPLACES and FORCE package fields from DESC to DEPENDS db entry 2005-10-08 20:43:25 +00:00
Judd Vinet 5ef51b3e26 Merging in recent fixes/additions from 2.9.7 2005-10-07 23:29:49 +00:00
Aurelien Foret a26095f8fc event transaction callback rework to prepare the introduction of a conversation callback 2005-05-04 19:55:23 +00:00
Aurelien Foret 0069357006 updated REASON constants to be consistent with databases from pacman 2.9.x 2005-05-02 07:42:18 +00:00
Aurelien Foret cb0182160d renamed PM_ERR_INVALID_NAME to PM_ERR_PKG_INVALID_NAME 2005-04-17 10:01:22 +00:00
Aurelien Foret 6e5bbdb544 - general cleanup
- added alpm_trans_sysupgrade() function
- relocated some defines
2005-04-16 22:23:28 +00:00
Aurelien Foret e115a5829e - updated sync feature
- added 2 new transaction events
2005-04-13 19:59:04 +00:00
Aurelien Foret e59e963f1f reverted back to trans->packages instead of install and remove queues 2005-04-06 21:00:57 +00:00
Aurelien Foret 3b49720e39 updated structure names (PM_SYNCPKG), and added transaction queues (install & remove) 2005-04-06 18:29:17 +00:00
Aurelien Foret 80bae750cd - added 'lastupdate' field to pmdb_t
- added a new public function alpm_db_getinfo
- added a public parameter PM_PKG_DB for PM_PKG struct
2005-04-02 23:20:00 +00:00
Aurelien Foret 2bbf118842 added RESOLVEDEPS to the list of transaction events 2005-04-02 20:28:01 +00:00
Aurelien Foret 4d21e4f721 started the work on "pacman_sync" 2005-03-30 22:32:43 +00:00
Aurelien Foret cca46deb6f changed alpm_db_register() prototype 2005-03-29 20:52:22 +00:00
Aurelien Foret 95ea99e197 Turned pmdepmissing_t into an opaque structure 2005-03-29 20:31:03 +00:00
Aurelien Foret 8179f7cbaa - added db_setlastupdate to db.c
- moved db_update from db.c to alpm.c
2005-03-22 20:14:49 +00:00
Aurelien Foret 72c2439576 Added support for .lastupdate files (from pacman 2.9.1) 2005-03-20 09:22:03 +00:00
Aurelien Foret 2ce1105900 - added PM_EXT_PKG and PM_EXT_DB defines to alpm.h (taken from pacman 2.9.3)
- renamed ALPM_VERSION to PM_VERSION
2005-03-16 20:59:14 +00:00
Aurelien Foret d8cdd54a20 Moved log callback definition to alpm.h 2005-03-16 20:46:30 +00:00
Aurelien Foret 03558450c5 *** empty log message *** 2005-03-16 20:42:11 +00:00
Aurelien Foret 606c70fdc9 Added a db_update() function to manage sync databases updates.
The API provides a wrapper alpm_db_update().
2005-03-16 19:31:20 +00:00
Aurelien Foret 438f653ba6 Renamed PM_TRANS_CB_XXX to PM_TRANS_EVT_XXX 2005-03-15 18:41:02 +00:00
Judd Vinet d04baabafa Initial revision 2005-03-15 01:51:43 +00:00