summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2007-11-04Add a little const correctness fix to alpm_listDan McGee1-3/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-30When printing size_t, use %zdDan McGee3-5/+5
%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>
2007-10-30libalpm/handle.c: make realpath() call portableDan McGee1-4/+3
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>
2007-10-30Copy pmdelta_t objects in _alpm_pkg_dup()Dan McGee1-0/+2
This was forgotten in the original set of patches. CC: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-30Make general list copy functionDan McGee2-2/+25
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>
2007-10-29libalpm/delta: add const to most methodsDan McGee3-9/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29libalpm: introduce MALLOC and CALLOC macrosDan McGee11-78/+30
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>
2007-10-29Add some more debugging output to dep checking codeDan McGee2-6/+11
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-27Clean up LDADD usageDan McGee1-1/+0
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>
2007-10-27Explicitly cast void* to char* during printf callDan McGee1-4/+4
If we don't have an explicit cast, make fails during -Wall -Werror. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-27dependency error message fix in libalpm/remove.cNagy Gabor1-1/+1
Normally you must never see that error message. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-27Dependency error/log messages fixNagy Gabor2-8/+14
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>
2007-10-25Add alpm_dep_get_string methodNagy Gabor2-0/+35
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>
2007-10-24_alpm_depmiss_isin fixNagy Gabor1-2/+5
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>
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-23Ensure all localization stuff is correctly guardedDan McGee2-0/+5
Anything dealing with libintl and localization should be correctly guarded inside an ENABLE_NLS block on both the pacman and libalpm sides. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23Fix broken or missing includesDan McGee2-8/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23Fix invalid static scoping of strverscmpDan McGee2-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Add download size to target list.Nathan Jones2-0/+36
This displays the download size, taking into account delta files and cached files. This closes FS#4182. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Download delta files if UseDelta is set.Nathan Jones6-3/+271
Delta files will be used if the size is smaller than a percent (MAX_DELTA_RATIO) of the package size. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Refactor md5sum checking.Nathan Jones1-44/+89
This will allow deltas and packages to share the md5sum checking code. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Add pmdelta_t structure and functions to libalpm.Nathan Jones11-1/+380
Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-18libalpm/package.c : fix requiredby with multiple providers.Chantry Xavier1-5/+2
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>
2007-10-15libalpm/trans.c : fix a recently introduced breakage in scriptlets handling.Chantry Xavier1-6/+10
Commit 4853a4aad97fe36f9237ffb7356201adab507a1c used the tmpdir variable for checking the existence of /bin/sh, without resetting it. This caused /bin/sh to be deleted during the cleanup part, as soon as a scriptlet other than pre_upgrade or pre_install was executed. For example, on the first post_upgrade during a -Su. I introduced two variables : clean_tmpdir and restore_cwd, for deciding what should be done in the cleanup part. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-15libalpm/trans.c : remove the DBPath <-> RootDir dependence in runscriptlet.Chantry Xavier1-15/+21
This code assumed that DBPath was under RootDir, while this is not necessarily the case : pacman doesn't enforce anymore than DBPath is under RootDir. So now, all scriptlets will be put somewhere in RootDir/tmp/, so that when it chroots in RootDir, the scriptlets are still available inside the chroot. This also removes the need of normalizing both dbpath and rootdir, in order to do computation on the paths. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-15Updates to fix Doxygen documentation generationDan McGee3-9/+7
We had way too much going on with the Doxygen manpage generation. Clean it up quite a bit by removing directory manpages, using relative paths, not having a manpage for every single alpm function, and ensuring internal functions are not documented publicly. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09Add gcc format attribute to _alpm_log, catch a few bugs in the processDan McGee4-6/+8
This fixed a few of our formatted output strings that were broken before but never being checked. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09libalpm/package.c: ensure we use package name when loading packagesDan McGee1-4/+7
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>
2007-10-09Update usage of gcc __attribute__ flagsDan McGee2-2/+2
Change the default visibility of libalpm functions to internal instead of hidden- this allows for slightly better optimization because it tells GCC that the function can never be called outside of the current module (see http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html). Also added some attributes to the pacman print functions so that they check the format strings being passed to them. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09Clean up the scriptlet fork code a bit, honor the child return valueDan McGee1-3/+20
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09Fix backward compatibility with non-epoch builddatesDan McGee1-3/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-05Fail loudly is scriptlets cannot be run via /bin/shAaron Griffin1-0/+7
If /bin/sh is missing in the root directory, scriptlets cannot be executed, as we're explicitly calling it. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-29libalpm: Optimize/inline the md5 functionalityDan McGee2-29/+5
The md5 routines are one of the chokepoints of libalpm (main chokepoint being archive extraction). Although IO delay causes a lot of it, we can at least inline some of the md5 stuff as we aren't that concerned about space and eliminate quite a few function calls. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-29libalpm/deps.c: fix memleak found by valgrindDan McGee1-0/+1
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-28Minor "cannot remove" message cleanupAaron Griffin1-1/+2
The strings differed in quotes only, this way we have only one i18n string for translation Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Remove buildtype package accessor prototypeAaron Griffin1-1/+0
This was removed a while ago, but the prototype was still hanging out. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Support for localized times in metadataAaron Griffin5-23/+44
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-28Add 'full' parameter to alpm_pkg_loadDan McGee4-18/+30
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>
2007-09-28Update comments dealing with pkgext/dbext strippingDan McGee1-2/+1
pacman/callback.c already did the work I set out to do with this commit, so update the comments accordingly in the frontend and backend. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Remove package name dependency from libalpmDan McGee6-157/+55
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-28libalpm: Add newline to alpm log function outputDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-26Preliminary support for optdependsDan McGee4-1/+31
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-24libalpm/add.c: fix backup array issueDan McGee2-20/+26
As seen with the recent upgrade of pacman and the removal of the pacman.d/current mirrorlist, files that were formerly in the backup array get deleted upon their removal, which could be dangerous. Instead, we should use the combined backup array of the old and new package. This fix should address this issue in a relatively straightforward way. In addition, old files should be moved to pacsave locations as expected. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-24libalpm/remove.c: fix up arguments to unlink_fileDan McGee1-19/+15
Move the progressbar code out of unlink_file so we can pass half the args. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-23alpm: removed unused strtoupper wrapper, remove installeddate on parse_descfileDan McGee3-16/+0
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>
2007-09-23libalpm/package.c : fix for FS#8081, case sensitive comparisons in ↵Chantry Xavier1-17/+16
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>
2007-09-19libalpm/add.c : fix backup handling (2)Chantry Xavier1-2/+2
The mistake fixed in commit 26441cf65ca10d4bf218203df5db5e8a7270787b was actually done at two places. This fix the second one. Also remove one unnecessary newline introduced by commit d34b2c4ed84bc40f4a895846785481fad88116a2 Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-18libalpm/add.c : newline fix.Chantry Xavier1-2/+2
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-18Avoid segfaults whet calling alpm_option_get_* before initializationStefano Esposito1-19/+164
When calling a function of the alpm_option_get_* group, you get a segfault if you don't call alpm_initialize() first. With this patch those functions set pm_errno to PM_ERR_HANDLE_NULL and return an error value if handle == NULL. (Dan: modified to meet pacman coding standards) Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>