summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
Commit message (Collapse)AuthorAge
* Set a missing pm_errno in _alpm_pkg_load()Nagy Gabor2008-03-01
| | | | | Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure DESC infolevel is loaded before checking pkg->filenameDan McGee2008-02-13
| | | | | | | | | | | This is the first step of fixing FS#9547. This should not break any existing code that may rely on this function behaving the way it did, and should be good for inclusion in a maint release. In addition, update pactest so it fills the FILENAME field in the DB entries it creates so we can move forward with a real fix to this issue. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix library interfaceDan McGee2008-01-11
| | | | | | | | | | | | Two functions defined in alpm.h were not marked with SYMEXPORT, causing linking errors if they were used. In addition, remove the incorrect use of the 'alpm_' prefix from an internal function and replace it with '_alpm_'. Fixes FS#9155. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove upgradedelay and all code associated with itDan McGee2008-01-08
| | | | | | | | It wasn't even implemented correctly, and it really doesn't have a use if packagers just do their job correctly anyway for a distro. Let's not try to solve a problem with the wrong solution now. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove unused date element from pmpkg_t structDan McGee2008-01-08
| | | | | | | We had an unused date element in the pmpkg_t struct (not builddate or installdate). Kill it off and fix the one function that was using it. Signed-off-by: Dan McGee <dan@archlinux.org>
* Small code cleanups with indents/spacesDan McGee2008-01-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove .FILELIST generation from makepkg (and elsewhere)Dan McGee2007-12-29
| | | | | | | | | | | | | | This is something pacman can do on its own straight from the archive, and we will reduce the chance of problems occurring becuase of inproper FILELIST generation as we have had in the past with special characters in filenames. Once we remove it from makepkg. we can remove any usage of it from all of our other tools, including pacman, pactest, and contrib/ utilities. Note that removing it from pacman uncovered a few other bugs anyway, so this was probably a good move. Signed-off-by: Dan McGee <dan@archlinux.org>
* Check for errors on descfile extractionDan McGee2007-12-16
| | | | | | | | | | | | | If /tmp was full during the early stages of package extraction, we were unable to extract the package description file with the call to archive_read_data_into_fd(archive, fd) becuase we never checked the return code. Add a check to ensure the extraction was successful and print and return an error if it was not instead of falling through to a possibly untrue error message. This should fix FS #8885. Signed-off-by: Dan McGee <dan@archlinux.org>
* Update GNU GPL boilerplate and copyright datesDan McGee2007-12-10
| | | | | | | 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>
* Improve changelog handling through addition of open/read/close functionsDan McGee2007-12-09
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Add missing header includes for setlocaleDan McGee2007-11-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove the IgnorePkg handling from alpm_pkg_compare_version.Chantry Xavier2007-11-18
| | | | | | | | 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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 pmdelta_t structure and functions to libalpm.Nathan Jones2007-10-19
| | | | | Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/package.c : fix requiredby with multiple providers.Chantry Xavier2007-10-18
| | | | | | | | | | | | | | | | | | The code didn't match the following comment : "A depends on B through n depends <=> A listed in B's requiredby n times" It stopped at n=1 with a break. I was surprised to see this case happens in real, that's how I noticed the bug: wine depends on both freeglut and glut, while freeglut provides glut. So when installing wine, the update_depends function listed wine twice in freeglut's requiredby. But the compute_requiredby function (used when installing freeglut, and used by testdb) listed wine only once in freeglut's requiredby. That made testdb unhappy. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/package.c: ensure we use package name when loading packagesDan McGee2007-10-08
| | | | | | | Some of the error messages in _alpm_pkg_load failed to use the pkgname value when printing, which made error messages rather hard to decode. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix backward compatibility with non-epoch builddatesDan McGee2007-10-08
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Support for localized times in metadataAaron Griffin2007-09-28
| | | | | | | | | | | | 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>
* Add 'full' parameter to alpm_pkg_loadDan McGee2007-09-28
| | | | | | | | | | | | | | | | | | | 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>
* Remove package name dependency from libalpmDan McGee2007-09-28
| | | | | | | | | | | | 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>
* Preliminary support for optdependsDan McGee2007-09-25
| | | | | | | | 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>
* alpm: removed unused strtoupper wrapper, remove installeddate on parse_descfileDan McGee2007-09-23
| | | | | | | installdate should never be present in a package descfile, so get rid of it. With the last commit, we also don't need the util strtoupper function. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/package.c : fix for FS#8081, case sensitive comparisons in ↵Chantry Xavier2007-09-23
| | | | | | | | | | | | parse_descfile. This fix FS#8081. The tr_TR locale has known issue with case insensitive comparisons, mostly because upper(i) != I. So the .PKGINFO files generated by makepkg MUST contain all keywords in lowercases now. This was already done, but was not mandatory. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* libalpm/package.c : add new alpm_pkg_compute_requiredby function.Chantry Xavier2007-09-11
| | | | Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* libalpm: add newlines to all strings passed to log callbackDan McGee2007-08-23
| | | | | | | | | 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>
* Post trial install changes, round oneDan McGee2007-08-21
| | | | | | | | | | | | | | 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>
* libalpm/add.c,trans.c : cleanup of requiredby handling.Nagy Gabor2007-08-20
| | | | | | | | | | | | | | | | | | | | This patch cleans up and fix the _alpm_trans_update_depends function and ensure that all requiredby fields are filled in case of multiple satisfiers (previously, the handling of mutliple satisfiers in that function was inconsistent). This makes a special case handling of requiredby in commit_single_pkg() obsolete, and so allows cleaning that code as well. Also fixed upgrade056 pactest because : 1) the requiredby fields were wrong, and this wouldn't happen with the fixed _alpm_trans_update_depends(). 2) this is a very unusual case anyway (and handling all corner cases combined to a broken database seems nearly impossible to achieve). References : http://www.archlinux.org/pipermail/pacman-dev/2007-July/008919.html http://www.archlinux.org/pipermail/pacman-dev/2007-July/008920.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Fix for FS 6404 and functionalize some cachedir handling stuffDan McGee2007-08-20
| | | | | | | | | 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>
* Remove support for SHA1 from pacman.Andrew Fyfe2007-08-16
| | | | | | | | 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>
* package.h: implement origin_data union in pmpkg_t structDan McGee2007-08-14
| | | | | | | | | | 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>
* Code cleanupDan McGee2007-08-14
| | | | | | | | 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>
* Reorder functions in libalpm/package.c for Doxygen purposesDan McGee2007-07-18
| | | | | | | Put all of the public functions at the top and inside the Doxygen packages group. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove versioncmp.{c,h}, clean up selective #ifdefsDan McGee2007-07-12
| | | | | | | | | 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>
* Remove 'buildtype' from libalpm and pacmanDan McGee2007-07-11
| | | | | | | | 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>
* Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee2007-07-10
| | | | | | | 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>
* Add top level hidden file code to package.cDan McGee2007-07-08
| | | | | | | This was already taken care of in add.c by commit 2ae043866045bbeef129a4b503ee1f5486545821, but was missed in package.c. Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow multiple CacheDirs to be specifiedDan McGee2007-06-09
| | | | | | | | | 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>
* Const correctness!Dan McGee2007-06-05
| | | | | | | | | 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>
* Move functions out of alpm.c to where they belongDan McGee2007-06-04
| | | | | | | | 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>
* Move DB and cache dirs away from there dependence on ROOTDIRDan McGee2007-05-31
| | | | | | | | | | | | | | | | | | | 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>
* Fix extraneous "ignoring upgrade" output on Ignore'd packagesChantry Xavier2007-05-18
| | | | | | | | Reorder package version checking so there is no output when a package is listed in IgnorePkg. Closes FS#7111 Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>