summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
Commit message (Collapse)AuthorAge
* do not rely on localdb for hook matchingAndrew Gregory2016-02-23
| | | | | | | | | | | | Relying on localdb to determine which trigger operations should match is completely broken for PostTransaction hooks because the localdb has already been updated. Store a copy of the old version of any packages being updated to use instead. Fixes FS#47996 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2016Allan McRae2016-01-04
| | | | | | make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright notices for 2015Allan McRae2015-02-01
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Merge branch 'maint'Allan McRae2014-12-27
|\
| * fix duplication of package sha256sumAllan McRae2014-12-27
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* | libalpm: Add accessors for the base fieldJohannes Löthberg2014-12-24
| | | | | | | | | | | | | | | | This commit adds the necessary accessor functions to get the PKGBASE of a package, forcing the desc file to be parsed. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* | libalpm: Parse and write PKGBASEsJohannes Löthberg2014-12-24
|/ | | | | | | | | | This commit adds support to libalpm to parse the pkgbase present in packages .PKGINFO files, writing the PKGBASE to the %BASE% section of the local DBs desc files and for parsing it again when loading the local DB Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_freeFlorian Pritz2014-09-30
| | | | Signed-off-by: Florian Pritz <bluewind@xinu.at>
* replace strdup with STRDUPAndrew Gregory2014-08-04
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove ts and sw from vim modeline when noet is setFlorian Pritz2014-01-28
| | | | | | | | | | | | Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Copy validation field in _alpm_pkg_dupAllan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Expose alpm_pkg_should_ignoreAllan McRae2013-10-31
| | | | | | | This function is useful for frontends to annotate package upgrades that will be ignored. Signed-off-by: Allan McRae <allan@archlinux.org>
* alpm_filelist: remove resolved_pathAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright year for 2013Allan McRae2013-01-03
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add public functions for accessing mtree dataAllan McRae2012-12-14
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add internal functions for reading mtree file from local dbAllan McRae2012-12-14
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Make alpm_pkg_find publicAllan McRae2012-12-14
| | | | | | This function is particularly useful, so make it public. Signed-off-by: Allan McRae <allan@archlinux.org>
* Add "Optional for" to package information outputAllan McRae2012-12-14
| | | | | | | | | Much like packages that require a give package are displayed in the "Required by" field of its information output, alos display packages that optionally require the package. Inspired-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* _alpm_filelist_resolve: use original filenames where possibleAndrew Gregory2012-12-14
| | | | | | | | If a filename isn't resolved, the original can be used instead of strdup()ing it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add resolved_path to alpm_filelist_tAllan McRae2012-12-14
| | | | | | | | Add an array to hold the resolved paths of the files in alpm_filelist_t. When the file name and its resolved file name are identical, the pointer to the original file name is used to avoid duplicate memory allocation. Signed-off-by: Allan McRae <allan@archlinux.org>
* Move filelist functions into separate source fileDan McGee2012-08-02
| | | | | | | | | We have a few of these and might as well gather them together. This also cleans up the code a bit by using an enum instead of integer values, as well as makes a "search for file in filelist" function public so frontends can do better than straight linear search of the filelists. Signed-off-by: Dan McGee <dan@archlinux.org>
* Pointer coding style cleanupsDan McGee2012-04-24
| | | | | | 'foo_type_t *variable' rather than 'foo_type_t* variable'. Signed-off-by: Dan McGee <dan@archlinux.org>
* Prefix alpm_pkgfrom_t members with ALPM_Allan McRae2012-04-07
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove _alpm_csumAllan McRae2012-03-08
| | | | | | | The enum alpm_pkgvalidation_t is essentially a more generic version of _alpm_csum, so use it instead. Signed-off-by: Allan McRae <allan@archlinux.org>
* Add information on how an installed package was validatedAllan McRae2012-03-08
| | | | | | | | | | | | | | | When installing a package, store information on which validation method was used and output this on "pacman -Qi" operations. e.g. Validated By : SHA256 Sum Possible values are Unknown, None, MD5 Sum, SHA256 Sum, Signature. Dan: just a few very minor tweaks. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Hook new optdepend structures upBenedikt Morbach2012-03-08
| | | | | | | | | No new behaviour introduced, everything should work exactly as before. Dan: refactored to use the single alpm_depend_t structure. Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright yearsAllan McRae2012-02-20
| | | | | | | Add 2012 to the copyright range for all libalpm and pacman source files. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* include config.h via MakefilesDave Reisner2011-12-21
| | | | | | | | | | | | | | | Ensures that config.h is always ordered correctly (first) in the includes. Also means that new source files get this for free without having to remember to add it. We opt for -imacros over -include as its more portable, and the added constraint by -imacros doesn't bother us for config.h. This also touches the HACKING file to remove the explicit mention of config.h as part of the includes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add helper function for duplicating depends listsDan McGee2011-11-30
| | | | | | | | | | We do this in several of the package duplication steps; add a helper function for doing so to reduce some of the repetitive code. Also add a free_deplist function for our repeated depend list free calls of both the data and the list. Signed-off-by: Dan McGee <dan@archlinux.org>
* add support for back end fnmatch'd optionsDave Reisner2011-11-13
| | | | | | | | | | | | | This is work originally provided by Sascha Kruse on FS#20360 with only minor adjustments to the implementation. It's been expanded to cover: NoUpgrade, NoExtract, IgnorePkg, IgnoreGroup. Adds tests ignore008, sync139, sync502, and sync503. Also satisfies FS#18988. Original-work-by: Sascha Kruse <knopwob@googlemail.com> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* invert iteration order for ignoregroupDave Reisner2011-11-11
| | | | | | | | | This is a simple change that allows comparions to be more in line with how other checks are done. It will be necessary for ensuing patchwork that implements fnmatch for comparing and assumes a specific argument ordering. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* Introduce alpm_time_t typeDan McGee2011-10-12
| | | | | | | | | | This will always be a 64-bit signed integer rather than the variable length time_t type. Dates beyond 2038 should be fully supported in the library; the frontend still lags behind because 32-bit platforms provide no localtime64() or equivalent function to convert from an epoch value to a broken down time structure. Signed-off-by: Dan McGee <dan@archlinux.org>
* Revert "libalpm: compare pkgname with strcoll"Dan McGee2011-09-27
| | | | | | | | | | | | | | | | | | | | This commit was made with the intent of displaying "correctly" sorted package lists to users. Here are some reasons I think this is incorrect: * It is done in the wrong place. If a frontend application wants to show a different order of packages dependent on locale, it should do that on its own. * Even if one wants a locale-specific order, almost all package names are all ASCII and language agnostic, so this different comparison makes little sense and may serve only to confuse people. * _alpm_pkg_cmp was unlike any other comparator function. None of the rest had any dependency on anything but the content of the structs being compared (e.g., they only used strcmp() or other basic comparison operators). This reverts commit 3e4d2c3aa65416487939148828afb385de2ee146. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove all usages of alpm_list_getdata() from the libraryDan McGee2011-09-20
| | | | | | No need for the indirection; just access ->data instead. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove const specifier from changelog_read() void parameterDan McGee2011-09-18
| | | | | | | | | | This shouldn't really be declared with const, and causes a compile error when -Wcast-qual is used. Remove the const specifier from the function specification and all implementations. Also fix one other trivial -Wcast-qual warning in _alpm_db_cmp(). Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove dead changelog_feof() codeDan McGee2011-09-18
| | | | | | | We never ended up using or really needing this; kill it for now knowing it is in git history if ever needed again. Signed-off-by: Dan McGee <dan@archlinux.org>
* More package operations cleanupDan McGee2011-09-02
| | | | | | | | Neither deltas nor filename attributes are ever present in the local database, so we can remove all of the indirection for accessing these attributes. Signed-off-by: Dan McGee <dan@archlinux.org>
* Clean up handling of size fieldsDan McGee2011-09-02
| | | | | | | | | | | | We currently have csize, isize, and size concepts, and sometimes the difference isn't clear. Ensure the following holds: * size (aka csize): always the compressed size of the package; available for everything except local packages (where it will return 0) * isize: always the installed size of the package; available for all three package types Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow access to package origin dataDan McGee2011-08-28
| | | | | | | Add new alpm_pkg_get_origin() method, use it in the front end now that the enum constants are publicly available. Signed-off-by: Dan McGee <dan@archlinux.org>
* Be more robust when copying package dataDan McGee2011-08-19
| | | | | | | | | | | | | | | | This changes the signature of _alpm_pkg_dup() to return an integer error code and provide the new package in a passed pointer argument. All callers are now more robust with checking the return value of this function to ensure a fatal error did not occur. We allow load failures to proceed as otherwise we have a chicken and egg problem- if a 'desc' local database entry is missing, the best way of restoring said file is `pacman -Sf --dbonly packagename`. This patch fixes a segfault that was occurring in this case. Fixes the segfault reported in FS#25667. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove usages of alpm_list_next() in backendDan McGee2011-08-18
| | | | | | | Another function call that can be replaced by a single pointer dereference. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove use of no-op accessor functions in libraryDan McGee2011-08-18
| | | | | | | | | The functions alpm_db_get_name(), alpm_pkg_get_name(), and alpm_pkg_get_version() are not necessary at all, so remove the calling and indirection when used in the backend, which makes things slightly more efficient and reduces code size. Signed-off-by: Dan McGee <dan@archlinux.org>
* Enhance and utilize database status flagsDan McGee2011-08-18
| | | | | | | | | | | | | | | | | | * Move is_local standalone field to status enum * Create VALID/INVALID flag pair * Create EXISTS/MISSING flag pair With these additional fields, we can be more intelligent with database loading and messages to the user. We now only warn once if a sync database does not exist and do not continue to try to load it once we have marked it as missing. The reason for the flags existing in pairs is so the unknown case can be represented. There should never be a time when both flags in the same group are true, but if they are both false, it represents the unknown case. Care is taken to always manipulate both flags at the same time. Signed-off-by: Dan McGee <dan@archlinux.org>
* Parse conflicts/provides/replaces at database load timeDan McGee2011-08-15
| | | | | | | | | | | | | | | | | | | | | | We did this with depends way back in commit c244cfecf654d3 in 2007. We can do it with these fields as well. Of note is the inclusion of provides even though only '=' is supported- we'll parse other things, but no guarantees are given as to behavior, which is more or less similar to before since we only looked for the equals sign. Also of note is the non-inclusion of optdepends; this will likely be resolved down the road. The biggest benefactors of this change will be the resolving code that formerly had to parse and reparse several of these fields; it only happens once now at load time. This does lead to the disadvantage that we will now always be parsing this information up front even if we never need it in the split form, but as these are uncommon fields and our parser is quite efficient it shouldn't be a big concern. Signed-off-by: Dan McGee <dan@archlinux.org>
* Validate the sha256sum if availableDan McGee2011-08-15
| | | | | | Adjust load_internal() to check the sha256sum value if we have it. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove checksum access indirectionDan McGee2011-08-15
| | | | | | | | | These items are never present in anything but sync databases, nor do we even try to load them from the local database. Remvoe the indirection meant to allow the caching layer to work since it will never do anything anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
* Load and allow access to sha256sumDan McGee2011-08-15
| | | | | | | | | This adds a field in the package struct for this checksum type as well as allowing access via the API to it. The frontend is now able to display any read value. Note that this does not implement any use or verification of the value internally. Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman/package: show presence of signature in in -SiDave Reisner2011-08-15
| | | | | | | | | adds a new API method: alpm_pkg_get_base64_sig [Dan: don't use a new header string in frontend] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Depend on name_hash being setDan McGee2011-08-09
| | | | | | | This is a fairly valid assumption at this point, or at least as good of one as assuming packages all have names. Signed-off-by: Dan McGee <dan@archlinux.org>