summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-20Refactor md5sum checking.Nathan Jones1-44/+89
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-09Add gcc format attribute to _alpm_log, catch a few bugs in the processDan McGee1-2/+4
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-08-24libalpm: add newlines to all strings passed to log callbackDan McGee1-52/+52
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-22Post trial install changes, round oneDan McGee1-4/+4
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-20Fix for FS 6404 and functionalize some cachedir handling stuffDan McGee1-92/+31
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-17libalpm/sync.c : don't go back on STATE_PREPARED when committing fails.Chantry Xavier1-2/+0
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-16Clean up MD5 code.Andrew Fyfe1-1/+0
* 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-16Remove support for SHA1 from pacman.Andrew Fyfe1-12/+8
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-14package.h: implement origin_data union in pmpkg_t structDan McGee1-1/+1
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-07-20libalpm/sync.c : two memleak fixes in _alpm_sync_prepare.Nagy Gabor1-8/+3
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-20libalpm/sync.c : fix DEPENDSONLY flag handling.Chantry Xavier1-16/+9
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-15Add --asdeps option to pacmanDan McGee1-5/+1
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-15libalpm/deps.c : cleanup + little fix for resolvedeps.Nagy Gabor1-5/+2
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-14libalpm/sync.c : ldconfig is run twice.Nagy Gabor1-6/+0
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-12Remove versioncmp.{c,h}, clean up selective #ifdefsDan McGee1-1/+0
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-10Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee1-40/+42
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-09Remove gettext from any alpm_logaction callsDan McGee1-2/+2
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-02Remove unnecessary and extra includesDan McGee1-2/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-26Remove unnecessary trans parameter from _alpm_checkdepsNagy Gabor1-2/+2
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-11Attempt to clean up _alpm_sync_prepareDan McGee1-64/+56
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-11Ensure correct and consistent usage of depmissChantry Xavier1-52/+15
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-09Allow multiple CacheDirs to be specifiedDan McGee1-31/+70
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-05Const correctness!Dan McGee1-5/+5
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-02Remove freespace checking codeDan McGee1-11/+0
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-05-31Move DB and cache dirs away from there dependence on ROOTDIRDan McGee1-13/+14
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-14Remove unnecessary casts on malloc and elsewhereDan McGee1-7/+7
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-10Fix IgnorePkg handling with replacement packagesAaron Griffin1-1/+3
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-04-29libalpm util.c and util.h cleanupDan McGee1-3/+1
* 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-29Remove STRNCPY macro from libalpmDan McGee1-1/+1
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-28Remove FREELISTPTR macroDan McGee1-8/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28Remove FREEPKG macro and correctly type _alpm_pkg_freeDan McGee1-6/+13
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28Remove FREEGRP macro and correctly type _alpm_grp_freeDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove FREESYNC macro and correctly type _alpm_sync_freeDan McGee1-6/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove FREETRANS macro and correctly type _alpm_trans_freeDan McGee1-3/+6
Remove an unnecessary macro, and get rid of the void pointer. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Clean up gettext on the libalpm sideDan McGee1-1/+0
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-03-28Fix --ignore behavior on sysupgradeDan McGee1-5/+13
* --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-21* Fix asking the user to upgrade when using -SpAaron Griffin1-1/+1
* 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-20* Fix pacman -Se which installs depends only, as it was brokenAaron Griffin1-5/+11
(Is this useful to anyone?)
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee1-3/+5
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-04* Fixed a whole mess of extra '/' pathing issues when a different root isAaron Griffin1-5/+6
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* Maybe that call to _alpm_trans_update_depends was necessary. Added it backDan McGee1-1/+1
in but did it right by duplicating the package first.
2007-03-03Big commit this time:Aaron Griffin1-125/+130
* 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-01* Modified values of INFRQ_* options so we start at 0x01 and not 0x00. ThisDan McGee1-2/+2
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-02-26* Enforce const char* params when using stringsAaron Griffin1-4/+4
* 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-23* Too much debugging output in the alpm_pkg_compare_versions functionAaron Griffin1-7/+13
* Using the wrong info level for replacements
2007-02-23* Modified the handling and output w.r.t. IgnorePkg entries. -Sy always ignoresAaron Griffin1-21/+23
these packages, but -S explicitly asks for confirmation.
2007-02-21* Re-added a compare function for syncpkg's - it was removed without thinkingAaron Griffin1-20/+23
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-13* Refactored conflict checking within packages. Profiling from Dan showed anAaron Griffin1-2/+0
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-07Cleanup and more debug info for alpm_pkg_compare_versionsAaron Griffin1-2/+1
2007-02-06Attempt to unify the -S and -Su version comparissons for when a package is newerAaron Griffin1-31/+3
See FS#5388