summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_files.c
AgeCommit message (Collapse)AuthorFilesLines
2008-01-11Use dynamic string allocation in package structuresDan McGee1-91/+103
This also affects all structures with static strings, such as depmiss, conflict, etc. This should help a lot with memory usage, and hopefully make things a bit more "idiot proof". Currently our pactest pass/fail rate is identical before and after this patch. This is not to say it is a perfect patch- I have yet to pull valgrind out. However, this should be quite safe to use in all situations from here on out, and we can start plugging the memleaks. Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-02Remove gettext calls from debug-level messagesDan McGee1-1/+2
These used FUNCTION output level and not DEBUG, so I didn't catch them way back when I removed those gettext calls. Remove them now (which exposed a nice little memory access error elsewhere in the code). This should have a slight speedup effect on the code too as we no longer have to make the gettext call even when these messages aren't printed. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Update GNU GPL boilerplate and copyright datesDan McGee1-3/+1
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-20Add missing header includes for setlocaleDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17War on whitespaceDan McGee1-5/+5
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16libalpm: simplify sync db lastupdateDan McGee1-23/+19
Legacy code is hitting the trash here. Remove unnecessary _alpm_time2string time storage abstraction in favor of just writing the time_t value to the disk. The only drawback is that everyone's sync DBs will have to be updated at least once so that the lastupdate values are stored right. :) Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-15Move alpm_splitdep usage to db_readDan McGee1-2/+6
Holy inefficient batman! For a pacman -Qt operation (when we are using compute_requiredby and not database entries), splitdep was being called ~1.3 million times on my local database. By splitting when we read the DB, we drop this number to around 1700 and save a LOT of time in doing so (a 5x increase in pacman -Qt speed here). Note that the depends alpm_list_t in the package struct is no longer a string list, but a list of pmdepent_t objects. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-15Remove REQUIREDBY usage from libalpmDan McGee1-11/+0
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-13Fix display of -Qip output when a package file is givenDan McGee1-0/+4
Too many fields were being shown on -Qip output, and sizes were not always correct (-Qi and -Qip output on the same package did not agree). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-09Fix some issues with localized dates/epoch usageDan McGee1-0/+4
Commit 47622eef4dd8fd86a0aa0e3ebdb7b33f7c9d6804 introduced localized times in the metadata by way of storing the UNIX epoch value instead of a hard coded date string. However, it missed a few things: * If we weren't in the C/POSIX/en_US locale, the date parsing would fail as it tried to use the abbreviations of the locale being used. Fix this by switching the LC_TIME value before we parse a date. * We used ctime to print the date value, which is always the C locale string. Instead, use strftime to print a localized date string. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23Print and typecast time_t correctlyDan McGee1-4/+3
The recommended C99 way to print the value of a time_t is to cast it to uintmax_t or intmax_t. Do this to ensure compatability with all platforms. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Add pmdelta_t structure and functions to libalpm.Nathan Jones1-0/+19
Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-29libalpm/be_files: Fix outdated code setting path for lastupdate fileDan McGee1-2/+2
The code for setting the lastupdate file path still referenced both the root and dbpath, when we should only be using dbpath. Fix it. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Support for localized times in metadataAaron Griffin1-8/+30
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-28Remove package name dependency from libalpmDan McGee1-2/+41
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-26Preliminary support for optdependsDan McGee1-0/+11
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-17Remove the DB consistency check from pacman and libalpm.Chantry Xavier1-32/+0
This reverts commit dfc85cb5f516ffbcff557522e9703c5c7d88b047 and b6f3fe6957d0206485eac98fb2120578b75d0058. 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-08-24libalpm: add newlines to all strings passed to log callbackDan McGee1-17/+17
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-16Remove support for SHA1 from pacman.Andrew Fyfe1-10/+1
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-08-14Code cleanupDan McGee1-36/+0
Remove the commented desc_localized stuff, we can find it later in version control. Also remove some unnecessary includes of the stat header and use -fstack-protector-all which is a bit more broad. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-12Remove some more conditional include stuffDan McGee1-3/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-12Remove 'buildtype' from libalpm and pacmanDan McGee1-9/+0
Remove unused buildtype field from pmpkg_t struct and anything associated with it, as it is unused at the moment. If we need to readd it, it is an easy revert of this commit. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee1-9/+13
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-06-09be_files.c: Fix compilation bug since I removed unnecessary LOG_STR_LENDan McGee1-6/+7
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09Add a alpm_db_test() function to the backend for checking DB consistencyVMiklos1-0/+31
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Const correctness!Dan McGee1-2/+2
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-05Move functions out of alpm.c to where they belongDan McGee1-1/+0
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-05-18Continue scanning when an invalid DB entry is foundAaron Griffin1-1/+3
Fix for FS#7133 - when DB scanning finds an invalid named entry, scanning is currently aborted. Instead we will simply skip it and find the next valid package. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-04-29Remove STRNCPY macro from libalpmDan McGee1-2/+2
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 FREEPKG macro and correctly type _alpm_pkg_freeDan McGee1-1/+1
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-22Clarify some English messages as suggested by Nagy Gabor. I even did the hardDan McGee1-3/+1
work of fixing these in the translation files, and I removed a few fuzzys while doing so. If any more patches for translations come, try to do it against these files.
2007-03-12* Noted a misspelling for later (after we are not in string freeze).v3.0.0-rc2Dan McGee1-0/+2
2007-03-12* Fix wrong filesize being recorded to local DB. Reported by Andreas Radke.Dan McGee1-1/+2
2007-03-12* Removed ${CFLAGS} from Makefile.am(s) as it was causing all CFLAGS to beDan McGee1-1/+6
duplicated. * Updated the util Makefile.am to link with the proper libalpm.la. * Fixed bitmasking issues in be_files.c and db.h. * Rankmirrors updates from James Rosten (with some cleaning up of my own). KeyboardInterrupts are now handled gracefully.
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee1-2/+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-2/+2
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* handle changes: callbacks should check handle first, as there's a fewAaron Griffin1-1/+1
occasions where some alpm stuff could be used without initializing the library (vercmp is one). TODO make these functions (handle accessors) better by returning "library not initialized" instead of failing. * Removed NoUpgrade lines from pacman.conf - we need to test this! * Re-corrected the lib targets for src/util/* * make dist seems to have updated the po files
2007-03-03Big commit this time:Aaron Griffin1-6/+11
* 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-02-28* Unifying placement of REPLACES in desc file, as pacman2 does. We'll worryDan McGee1-11/+10
about bigger DB changes later, but lets not screw anything up for release. * Removed some weird uses of "not ... ==" usage in pactest- correct me if I'm wrong, but isn't "!=" a lot more clean and concise? * Print description of failed tests in the pactest summary. This could get dirty with a lot of failed tests though, so watch out.
2007-02-26* Enforce const char* params when using stringsAaron Griffin1-1/+1
* 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-22* Cleaned up some debug outputAaron Griffin1-1/+0
* Fixed a segfault in the conflict checking code * Added an automatic failure in the case of -A/-U for a replacement of an existing package. This requires a large amount of work and is postponed for now. Example: If ncmpc is installed, pacman -U /path/to/ncmpc-svn.pkg.tar.gz will fail with and appropriate error message
2007-02-21* Fixed inconsistency of args- _alpm_db_read, _alpm_db_write.Dan McGee1-3/+3
2007-02-21* Re-added a compare function for syncpkg's - it was removed without thinkingAaron Griffin1-2/+4
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-13Removed desc_localized for the time being. We don't have localizedAaron Griffin1-20/+31
descriptions, nor do we actually build them with the newest makepkg. The actual implementation in here seems like it could be done better, and it soaks a large amount of CPU time according to profilers.
2007-02-07Spruced up the TODOs a bit, got rid of some of them since a lot of it wasDan McGee1-3/+2
duplicate anyway. Also removed the last of the ORE tags and replaced them with TODOs.
2007-01-31Fix corrupt DB entry handling when loading package entries.Aaron Griffin1-52/+59
* scan loops no longer abort on corrupt entries * reloading a cache package (and discovering it corrupt) no longer prints 2 messages and uses the pre-build "remove from package cache" function NOTE: The TODOs in there are important for later w.r.t. cleaning up corrupt DB entries but there are some logical complexities with doing so, so I'm holding off for now.
2007-01-31Debug logging changes:Aaron Griffin1-1/+1
* 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-30K. Piche <kevin.piche@cgi.com>Aaron Griffin1-0/+20
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere