summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* Remove provide.c and provide.h .Chantry Xavier2007-11-17
| | | | | | | | | 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>
* Generalized alpm_list_find.Nagy Gabor2007-11-17
| | | | | | | | | | | | | The old alpm_list_find was renamed to alpm_list_find_ptr, and a new alpm_list_find was introduced, which uses the fn comparison-function parameter in its decision. Now both alpm_list_find_ptr (a new ptrcmp helper function was also added) and alpm_list_find_str are just an alpm_list_find call. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: made ptrcmp a static function] Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix memleak in _alpm_trans_free with package listsDan McGee2007-11-17
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: use FREELIST when possibleDan McGee2007-11-16
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* War on whitespaceDan McGee2007-11-16
| | | | | | Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: simplify sync db lastupdateDan McGee2007-11-16
| | | | | | | | | | | 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>
* Fix a would-be memleak with the new compute requiredby stuffDan McGee2007-11-15
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: change graph malloc to MALLOC macroDan McGee2007-11-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix alpm_list_copy_dataDan McGee2007-11-14
| | | | | | | | | | So I spent a good 4 hours tracking a bug down tonight due to alpm_list_copy_data not actually doing what I expected to do. We can't find the size of an object we don't know the type of, so rewrite it so we pass in the size explicitly. This was making _alpm_pkg_dup fail and causing all sorts of other issues. Signed-off-by: Dan McGee <dan@archlinux.org>
* Move alpm_splitdep usage to db_readDan McGee2007-11-14
| | | | | | | | | | | | | 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>
* Remove REQUIREDBY usage from libalpmDan McGee2007-11-14
| | | | | | | | | | | | 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>
* alpm_list_add == alpm_list_add_lastNagy Gabor2007-11-14
| | | | | | | | | | | | | | It's time to define that alpm_list_add(list, foo) adds 'foo' to the end of 'list' and returns with 'list', because: 1. list is a list, not a set. 2. sortbydeps _needs_ an alpm_list_add definition to work properly. As a first step, I used this definition in recursedeps. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: punctuation cleanup in commit message and code comments, added comment to alpm_list_add] Signed-off-by: Dan McGee <dan@archlinux.org>
* Enforce const correctness on dep functions and rewrite alpm_dep_get_stringDan McGee2007-11-13
| | | | | | | | 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>
* Fix display of -Qip output when a package file is givenDan McGee2007-11-13
| | | | | | | 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>
* Fix memleak with new alpm_list_reverse usageDan McGee2007-11-11
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Add a horrible little hack to get symlink001.py to pass againDan McGee2007-11-11
| | | | | | | | | | This really doesn't give us any regressions in behavior, so it is safe to do although quite ugly. Tell the conflict checking code to ignore symlinks to dirs so that they are not seen as conflicts. Hopefully this entire commit will get factored out soon enough. Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure list tail pointer is updated when we remove tail nodeDan McGee2007-11-11
| | | | | | | | Commit 2ee90ddae23dd86c68223c0d6c49f0b92d62429d did a special check to see if we were removing the head node, but not the tail node. Add a special case for the tail node to ensure all relevant pointers get updated. Signed-off-by: Dan McGee <dan@archlinux.org>
* Incorrect usage of alpm_db_whatprovides in sync.cNagy Gabor2007-11-11
| | | | | | | 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>
* libalpm: fix lstat wrapper to actually use newpathDan McGee2007-11-11
| | | | | | | | Commit b55abdce7aebb142ce79da3aa3645afe7693a3c4 introduced an lstat wrapper function that never dereferences paths with a trailing slash, but still called lstat on path instead of newpath. Oops! Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove unused and broken alpm_list_remove_node functionDan McGee2007-11-11
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Implement TotalDownload option.Nathan Jones2007-11-11
| | | | | | | | | | | | | | 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>
* Implement IgnoreGroup.Nathan Jones2007-11-11
| | | | | | | | | 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>
* Add IgnoreGroup and --ignoregroup option.Nathan Jones2007-11-11
| | | | | | | This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix some issues with localized dates/epoch usageDan McGee2007-11-08
| | | | | | | | | | | | | 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>
* Update Italian TranslationGiovanni Scafora2007-11-08
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Update en_GB translationJeff Bailes2007-11-07
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Add STRDUP macro to mirror MALLOC/CALLOCAaron Griffin2007-11-06
| | | | Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Maintain list tail pointers in the head nodeAaron Griffin2007-11-06
| | | | | | | | | | | | | | | | | | | | | | | | | List head nodes contain null 'prev' pointer, which we can (ab)use to maintain a back reference to the tail pointer of the list. While list additions are not _significantly_ improved, they are still sped up. Original $ time pacman -Qo /usr/bin/wtpt /usr/bin/wtpt is owned by lcms 1.17-2 real 0m3.623s user 0m1.883s sys 0m1.473s New $ time pacman -Qo /usr/bin/wtpt /usr/bin/wtpt is owned by lcms 1.17-2 real 0m2.006s user 0m0.263s sys 0m1.627s Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* libalpm/db.c: change two warnings to errorsDan McGee2007-11-05
| | | | | | | These two warnings really indicate failure, so the message they print should do so as well. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove the newline automatically added by alpm_logaction.Chantry Xavier2007-11-04
| | | | | | This way, _alpm_logaction behaves like _alpm_log, and gives more control. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* libalpm: use an lstat wrapper so we never dereference dir symlinksDan McGee2007-11-04
| | | | | | | | Linux lstat follows POSIX standards and dereferences a symlink pointing to a directory if there is a trailing slash. For purposes of libalpm, we don't want this so make a lstat wrapper that suppresses this behavior. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: open the logstream on demandDan McGee2007-11-04
| | | | | | | Don't open a stream to the logfile until necessary. This will allow us to catch any errors in opening the logfile instead of ignorning them. Signed-off-by: Dan McGee <dan@archlinux.org>
* Clean up usage of extern variablesDan McGee2007-11-04
| | | | | | | | Instead of declaring the extern variable in every *.c file, include it in the header file that makes sense. This means handle.h for the handle, and conf.h for the pacman side config object. Signed-off-by: Dan McGee <dan@archlinux.org>
* Readd scriptlet logging that got lost in an earlier commitDan McGee2007-11-04
| | | | | | | | | I broke scriptlet logging with ad691001e20272b794d2ed574b556f520e3555c0. 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>
* Add some more autoconf macros to filter our CFLAGS usageDan McGee2007-11-04
| | | | | | | | | | | Hopefully these new autoconf macros, with a little magic, will allow us to compile with any compiler and still choose the options we have available to us. Tested locally with gcc 4.2.2 and gcc 3.4.6; the latter doesn't support two of the items we previously had hardcoded in our CFLAGS. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add a little const correctness fix to alpm_listDan McGee2007-11-04
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* When printing size_t, use %zdDan McGee2007-10-29
| | | | | | | | %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>
* libalpm/handle.c: make realpath() call portableDan McGee2007-10-29
| | | | | | | BSD didn't support the NULL second argument GNU extension, so do it the old fashioned way. Signed-off-by: Dan McGee <dan@archlinux.org>
* Copy pmdelta_t objects in _alpm_pkg_dup()Dan McGee2007-10-29
| | | | | | | This was forgotten in the original set of patches. CC: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Make general list copy functionDan McGee2007-10-29
| | | | | | | | | Package dup needs to copy all members. Nathan had his implementation, but I generalized it to this new alpm_list function (and will use it in the next commit). CC: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/delta: add const to most methodsDan McGee2007-10-29
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: introduce MALLOC and CALLOC macrosDan McGee2007-10-29
| | | | | | | | | | | | | | | | | 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>
* Add some more debugging output to dep checking codeDan McGee2007-10-29
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Clean up LDADD usageDan McGee2007-10-26
| | | | | | | | We had a lot of unnecessary overstatements of libraries to include on linking, and autoconf/automake takes care of this for us. This also helps some compilation issues on other platforms. Signed-off-by: Dan McGee <dan@archlinux.org>
* Explicitly cast void* to char* during printf callDan McGee2007-10-26
| | | | | | If we don't have an explicit cast, make fails during -Wall -Werror. Signed-off-by: Dan McGee <dan@archlinux.org>
* dependency error message fix in libalpm/remove.cNagy Gabor2007-10-26
| | | | | | Normally you must never see that error message. Signed-off-by: Dan McGee <dan@archlinux.org>
* Dependency error/log messages fixNagy Gabor2007-10-26
| | | | | | | | | 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>
* Add alpm_dep_get_string methodNagy Gabor2007-10-25
| | | | | | | | 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>
* _alpm_depmiss_isin fixNagy Gabor2007-10-24
| | | | | | | | The old code used memcmp, which is not good for comparing strings: "pkgname"'\0''\0' should be equal to "pkgname"'\0''a' for example. The new code uses strcmp. Signed-off-by: Dan McGee <dan@archlinux.org>
* Print and typecast time_t correctlyDan McGee2007-10-23
| | | | | | | 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>