summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_package.c
Commit message (Collapse)AuthorAge
* Move documentation for public package function to alpm.hRémy Oudompheng2011-04-09
|
* Don't generate filelist unless we are going to use itDan McGee2011-02-16
| | | | | | | We throw it away if !full, so no need to waste time creating the list in the first place. Signed-off-by: Dan McGee <dan@archlinux.org>
* Avoid a memmove by advancing value pointerDan McGee2011-02-11
| | | | | | | | | | | | In packages, our description file contains: key = value is here type entries, and we passed "key " and " value is here" to our strtrim function, causing us to always memmove the value portion to remove the space. Since this is a throwaway buffer, do the advancing on our own before trimming to save the need to shift memory around; "value is here" will now be passed and strtrim will be responsible for trailing whitespace. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix locale.h/setlocale inclusion with --disable-nlsDan McGee2011-02-01
| | | | | | | | | Noted in FS#22697. When I factored out _alpm_parsedate() into a common function, I didn't move the <locale.h> include properly, causing a build failure when NLS is disabled and this header isn't automatically included everywhere. Signed-off-by: Dan McGee <dan@archlinux.org>
* Ignore known but unused package descfile fieldsDan McGee2011-01-28
| | | | | | | | We explicitly place 'pkgbase' (and used to place 'force') fields inside PKGINFO files, so ignore them silently instead of printing an error for them. Also make the error message for unknown keys actually contain the key. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove epoch as an independent fieldDan McGee2011-01-21
| | | | | | | | | | | | | | Instead, go the same route we have always taken with version-release in libalpm and treat it all as one piece of information. Makepkg is the only script that knows about epoch as a distinct value; from there on out we will parse out the components as necessary. This makes the code a lot simpler as far as epoch handling goes. The downside here is that we are tossing some compatibility to the wind; packages using force will have to be rebuilt with an incremented epoch to keep their special status. Signed-off-by: Dan McGee <dan@archlinux.org>
* Small fix to download size lookup and a loggerDan McGee2011-01-11
| | | | | | | | These were just two small things I came across today and found could be fixed or helpful, so I've added them and I'm not sure what else to bundle them with. commit_count++ Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/be_package.c: fix small memleakXavier Chantry2011-01-07
| | | | | | | | | | file_pkg_ops can be a static struct like in other backends, we just need to initialize it at some point. Dan: add initialization flag. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Refactor old date parsing into single methodDan McGee2011-01-07
| | | | | | | We've managed to duplicate this four times at this point, so make it a method in util.c instead. Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright years for 2011Allan McRae2011-01-07
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Declare all local functions staticAllan McRae2010-12-30
| | | | | | | | | | | | All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures. Fixes all warnings with -Wmissing-{declarations,prototypes}. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Overhaul archive fgets functionDan McGee2010-12-21
| | | | | | | | | | | | | | | | | | | | | | | | The old function was written in a time before we relied on it for nearly every operation. Since then, we have switched to the archive backend and now fast parsing is a big deal. The former function made a per-character call to the libarchive archive_read_data() function, which resulted in some 21 million calls in a typical "load all sync dbs" operation. If we instead do some buffering of our own and read the blocks directly, and then find our newlines from there, we can cut out the multiple layers of overhead and go from archive to parsed data much quicker. Both users of the former function are switched over to the new signature, made easier by the macros now in place in the sync backend parsing code. Performance: for a `pacman -Su` (no upgrades available), _alpm_archive_fgets() goes from being 29% of the total time to 12% The time spent on the libarchive function being called dropped from 24% to 6%. This pushes _alpm_pkg_find back to the title of slowest low-level function. Signed-off-by: Dan McGee <dan@archlinux.org>
* Always specify arguement type in function delcarationsAllan McRae2010-12-20
| | | | | | | | Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* When setting package name, set hash value as wellDan McGee2010-12-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge desc and depends files in local dbAllan McRae2010-12-12
| | | | | | | | | | | | Whenever depends is needed from the local db, so is desc. The only disadvantage to merging them is the additional time taken to read the depends entries when they are not needed. As depends is in general relatively small, the additional time taken to read it in will be negligable. Also, merging these files will speed up local database access due to less file seeks. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix a few problems reported by clang-analyzerXavier Chantry2010-12-12
| | | | | | | One missing NULL-check and 3 dead assignments. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* be_package: read force entry and convert to epochXavier Chantry2010-10-14
| | | | | | | | We still need to read force entry in epoch-aware pacman, so that when we install an old force package, EPOCH gets written to the local db. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add epoch support to pacman/libalpmDan McGee2010-10-13
| | | | | | | This will allow for better control of what was previously the 'force' option in a PKGBUILD and transferred into the built package. Signed-off-by: Dan McGee <dan@archlinux.org>
* Move changelog functions to callback structDan McGee2010-10-13
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Complete rework of package accessor logicDan McGee2010-10-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hopefully we've finally arrived at package handling nirvana, or at least this commit will get us a heck of a lot closer. The former method of getting the depends list for a package was the following: 1. call alpm_pkg_get_depends() 2. this method would check if the package came from the cache 3. if so, ensure our cache level is correct, otherwise call db_load 4. finally return the depends list Why did this suck? Because getting the depends list from the package shouldn't care about whether the package was loaded from a file, from the 'package cache', or some other system which we can't even use because the damn thing is so complicated. It should just return the depends list. So what does this commit change? It adds a pointer to a struct of function pointers to every package for all of these 'package operations' as I've decided to call them (I know, sounds completely straightforward, right?). So now when we call an alpm_pkg_get-* function, we don't do any of the cache logic or anything else there- we let the actual backend handle it by delegating all work to the method at pkg->ops->get_depends. Now that be_package has achieved equal status with be_files, we can treat packages from these completely different load points differently. We know a package loaded from a zip file will have all of its fields populated, so we can set up all its accessor functions to be direct accessors. On the other hand, the packages loaded from the local and sync DBs are not always fully-loaded, so their accessor functions are routed through the same logic as before. Net result? More code. However, this code now make it roughly 52 times easier to open the door to something like a read-only tar.gz database backend. Are you still reading? I'm impressed. Looking at the patch will probably be clearer than this long-winded explanation. Signed-off-by: Dan McGee <dan@archlinux.org> [Allan: rebase and adjust] Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix some whitespace issuesAllan McRae2010-08-23
| | | | | | | | The combination of tabs and spaces is annoying in any editor that does not use a tab width of 2 spaces. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Clarify testing within conditional statementsAllan McRae2010-06-21
| | | | | | | | | Follow the HACKING guidelines and always use != 0 or == 0 rather than negation within conditional statements to improve clarity. Most of these are !strcmp usages which is the example of what not to do in the HACKING document. Signed-off-by: Allan McRae <allan@archlinux.org>
* Bump copyright dates to 2010Dan McGee2010-03-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* cygwin fix : use unsigned char for ctype functionXavier Chantry2009-10-11
| | | | | | | | | | | | See http://www.nabble.com/-PATCH-RFA--Distinguish-between-EOF-and-character-with-value-0xff-td23161772.html#a23188494 cygwin 1.7 actually displays a warning when using signed char with the ctype function, so that compilation fails when using -Wall -Werror. So we just cast all arguments to unsigned char. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* int typing: s/unsigned short/int/ in libalpmDan McGee2009-10-11
| | | | | | | | | | After our recent screwup with size_t and ssize_t in the download code, I found the `-Wsign-conversion` flag to GCC to see if we were doing anything else boneheaded. I didn't find anything quite as bad, but we did have some goofups- most of our public unsigned methods would return -1 on error, which is a bit odd in an unsigned context. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add makepkgopt to be_package.cNagy Gabor2009-09-14
| | | | | | | | | After commit 774c252 the --debug output shows 5-6 "syntax error..." lines for each package. After this patch pacman recognizes makepkgopt as a valid key, but doesn't do anything. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright headers and messagesDan McGee2009-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix non-C style comments in libalpmGerardo Exequiel Pozzi2009-05-11
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dan McGee <dan@archlinux.org>
* Don't display filename on -Qip operation.Xavier Chantry2008-06-04
| | | | | | | | | | | | | Some previous commits apparently broke the get_filename function for package loaded with pkg_load (on a -Qip operation) because this field was no longer filled. Now pkg_load fills it. But the -Qip operation needs to be run like this : -Qip <filename>, so the filename is already known. There is no need to display it again. Besides, on a normal -Qi operation, the filename is not displayed either because this information is not stored in the local database. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Simplify _alpm_pkg_new()Dan McGee2008-05-13
| | | | | | | | Any real call of this function doesn't specify a name or version ahead of time, so just kill that functionality off. Now to remove those dummy packages... Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove errant include of error.hDan McGee2008-05-13
| | | | | | | This doesn't exist anymore, the header file was removed a while back in commit 4c872594da321aa406cfb306c32c94ce2929d59e. Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2008-05-11
| | | | | | Conflicts: lib/libalpm/package.c - comment location moved to be_package.c
* Refactor pkg_load/parse_descfile into a new backend fileDan McGee2008-05-11
alpm_pkg_load() and parse_descfile() are specific to getting information from package files, just as other code is specific to getting information into or out of a package database. Move this code out of package.c, which should eventually only contain operators on the pmpkg_t struct that do not depend at all on where the data came from. Signed-off-by: Dan McGee <dan@archlinux.org>