summaryrefslogtreecommitdiff
path: root/lib/libalpm
AgeCommit message (Collapse)Author
2012-05-20fix -Wshadow warnings as reported by gcc 4.4.3Dave Reisner
Apparently gcc 4.7 has decided that -Wshadow warnings aren't worth reporting anymore even with the flag enabled. These were found on an Ubuntu 10.04 install. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20Merge branch 'maint'Dan McGee
Conflicts: scripts/pacman-key.sh.in
2012-05-04Ensure pre_upgrade scriptlet gets old package versionDan McGee
This was accidentally broken in the refactor done in commit 73139ccb. Fixes FS#29371. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29Convert ALLOC_FAIL macro into a functionDan McGee
This path is rarely (read: never) taken in any normal run of the code, so injecting the fprintf() call everywhere with the macro is a bit overkill. Instead, add a lightweight _alpm_alloc_fail() function that gets called instead. This does have a reasonable effect on the size of the generated code; most places using the macros provided by util.c have their code size reduced. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29be_local: use the right length value for filename in all casesDan McGee
Increment the strlen() provided value by 1 for the NULL byte so we use the right value in all three places we later reference it. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-29Merge remote-tracking branch 'dave/buildsys'Dan McGee
2012-04-29Move short-lived realpath buffers to the stackDan McGee
There is little reason here to grab 4K from the heap only to return it a few lines later. Instead, just use the stack to hold the returned value saving ourselves the malloc/free cycle. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-25libalpm: add pkg-config fileDave Reisner
No one seems to do this "correctly", but for the sake of having an easy method of detecting the presence and version of libalpm on a given system, we provide a straightforward .pc file. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24Pointer coding style cleanupsDan McGee
'foo_type_t *variable' rather than 'foo_type_t* variable'. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-24be_local: write all single-valued attributes firstDan McGee
There isn't a whole lot of reason other than code clarity for this, but it makes it a bit more obvious where multivalued attributes start. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-12Merge branch 'maint'Dan McGee
2012-04-09Fix issues with unintialized variable value usageDan McGee
Detected by clang scan-build static code analyzer. * Don't attempt to free an uninitialized gpgme key variable * Initialize answer variable before asking frontend a question * Pass by reference instead of value if uninitialized fields are possible in download signal handler code * Ensure we never call strlen() on NULL payload->remote_name value Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08Fix a signed overflow error on i686 with GCC 4.7.0Dan McGee
Not sure why this one wasn't showing up on x86_64, but this fixes the compile on i686. diskspace.c: In function 'calculate_removed_size': diskspace.c:247:4: error: assuming signed overflow does not occur when negating a division [-Werror=strict-overflow] cc1: all warnings being treated as errors Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08Various tweaks to support building with excessive GCC warning flagsDan McGee
This fixes a bunch of small issues in order to enable a clean successful build with a crazy number of GCC warning flags. A lot of these changes are covered by -Wshadow, -Wformat-security, and -Wstrict-overflow=5. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08buildsys: define warning CFLAGS in separate varDave Reisner
Continue the trend of not touching the environment CFLAGS, ensuring that the user always has the final say. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08buildsys: cleanup gpgme compile time checkDave Reisner
- handle gpgme libs and cflags separately rather than appending to CFLAGS and LDFLAGS - be consistent in AC_LINK_IFELSE check for gpgme 1.3.0 (though this is irrelephant since we don't actually run) - be consistent with usage of "have" and "with" variables (this actually ends up reducing SLOC) - when voluntary detection fails, unset GPGME_CFLAGS and GPGME_LIBS - when requested support fails the version check, complain about the min version. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08buildsys: use pkg-config for libcurl detectionDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08buildsys: use pkg-config for libarchive detectionDave Reisner
This also introduces a versioned dependency of >=2.8.0. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08buildsys: use pkg-config for openssl detectionDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-07Prefix alpm_pkgfrom_t members with ALPM_Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Return more useful error codes on package open failuresDan McGee
Failure isn't always due to the package file location not existing; permission issues can also play a part on something like a FUSE-based filesystem inaccessible to root. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Make selecting scriptlet shell workAllan McRae
The initial patch to implement this achieved nothing apart from adding a configure option. This patch makes that configure option do what it advertises. Note that specifing any shell apart from /bin/sh causes testsuite failures as /bin/sh is the only shell in the testing environment. Bug-found-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/signing.c lib/libalpm/sync.c
2012-04-07sync: fix crash on failed downloadsDave Reisner
Dan was right. This should have been FREE(), not free(). Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Updates from TransifexDan McGee
This encompasses a few languages that have had changes since 4.0.2 available on Transifex. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-28Update all translation filesDan McGee
Pull updates from transifex, run update-po on all files, fix a few errors, and push them back to Transifex. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-28signing: cope with gpg2's failure at lifeDave Reisner
For key searches only, gpg2 will fail to lookup any and all keys that are not prefixed with 0x. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/sync.c
2012-03-16Prefer fputs/fputc over fprintf when writing local databaseDan McGee
Using fputs should be faster as no format string parsing is required. It also prevents silly errors related to unescaped '%' signs, and removes the need to double them up in a lot of places. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16Extract a write_deps function from local database writingDan McGee
This reduces a lot of code duplication in the write function, which cleans it up a bit. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16Remove unnecessary path check from local databaseDan McGee
This removes a call to _alpm_local_db_pkgpath() as well as an access() call when reading the local database. This appears to be code from 2006 that has stuck around. We don't need it because: 1) We never use this path except to check it via access(); however, we are already in a readdir() loop so it exists, or at least did at the time of the call. 2) The fopen() and other calls will fail on accessing the database files anyway, and we need to check those for errors. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-14lib/sync: avoid unwanted unlink after download failDave Reisner
In case we have a mirror failure, unlink_on_fail would remain set, causing an interrupt in a successive download attempt to be wrongly unlinked. This also fixes a memory leak in the url member, as we would allocate over the previous, unfreed URL. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-14dload: reset payload filename members before downloadDave Reisner
To avoid conflicts on reusing a payload after a failed download, ensure that we reset the filename hints in the payload struct prior to the download operation. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-12Minor format-string related cleanupsDan McGee
We had one stubbed out so we didn't require a translation update, and the other is more a code style issue. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/be_package.c
2012-03-08Simplify package validation info output for sync packagesAllan McRae
Unify the output for local and sync packages by only printing a list of possible validation types for sync packages. This also has the advantage of not printing the very long sha256 checksum which line wrapped on a standard width terminal. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-08Remove _alpm_csumAllan McRae
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>
2012-03-08Add information on how an installed package was validatedAllan McRae
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>
2012-03-08Hook new optdepend structures upBenedikt Morbach
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>
2012-03-08Allow alpm_depend_t to have a descriptionDan McGee
This is the first step in parsing and handling optdepends. There is no behavior change introduced in this commit; however, depends that contain a ": " string will now be parsed as having a description and it will be stored in the depend structure. Later patches will utilize this new field as appropriate. This is heavily based on the work of Benedikt, who did something similar but introduced a new type for this rather than only a new field to the existing type. Heavily-influenced-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05Translation updates from TransifexDan McGee
* it updates to all translations * minor fr, pt_BR, de, lt, sk and uk updates * add new strings in pacman translation catalog Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05Fix a potential memory leak in filelist creationDan McGee
If we begin to create a file list when loading a package, but abort because of an error to one of our goto labels, the memory used to create the file list will leak. This is because we use a set of local variables to hold the data, and thus _alpm_pkg_free() cannot clean up for us. Use the file list struct on the package object as much as possible to keep state when building the file list, thus allowing _alpm_pkg_free() to clean up any partially built data. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-05Fix a memory leak when loading an invalid packageDan McGee
This is easily triggered via a `pacman -Sc` operation when it attempts to open a delta file as a package- we end up leaking loads of memory due to us never freeing the archive object. When you have upwards of 1200 delta files in your sync database directory, this results in a memory leak of nearly 1.5 MiB. Also fix another memory leak noticed at the same time- we need to call the internal _alpm_pkg_free() function, as without the origin data being set the public free function will do nothing. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Use "mode" in _alpm_makepath_modeAllan McRae
It seems that if we pass the permissions that we want the created directory to have, then we should probably use it... Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Merge branch 'maint'Dan McGee
Conflicts: contrib/pacsysclean.in src/pacman/conf.h
2012-02-20Update copyright yearsAllan McRae
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>
2012-02-20util: reduce pointer hell in _alpm_makepath_modeDave Reisner
Simplify the implementation: - allocate and manipulate a copy of the passed in path rather than building out a path as the while loop progresses - use simple pointer arithmetic to skip uninteresting cases - use mkdir(3)'s return value and errno to detect failure Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Print error message when to-be-downloaded file cannot be createdNagy Gabor
It can happen that the to-be-downloaded file cannot be created in cachedir. For example, I am an -Sup user, and it is comfortable to set --cachedir to /mnt/pendrive, which is a FAT filesystem, so files like capseo-1:0.3-2-i686.pkg.tar.xz cannot be downloaded to there. Before this patch, pacman didn't give clear output about what happens when the download code could not create the necessary file. This can be confusing with -Su. An example output: *** $ sudo pacman -S capseo bochs --cachedir /c/TEMP resolving dependencies... looking for inter-conflicts... Targets (2): bochs-2.4.6-1 capseo-1:0.3-2 Total Download Size: 0.61 MiB Total Installed Size: 2.61 MiB Proceed with installation? [Y/n] :: Retrieving packages from extra... warning: failed to retrieve some files from extra bochs-2.4.6-1-i686 611.5 KiB 118K/s 00:05 [------------------] 97% error: failed to commit transaction (unexpected error) Errors occurred, no packages were upgraded. *** After the patch, pacman will give more informative error message (and pm_errno is set properly): *** error: could not open file '/c/TEMP/capseo-1:0.3-2-i686.pkg.tar.xz.part': Invalid argument error: failed to commit transaction (failed to retrieve some files) *** Unfortunately, the "could not open file" error message is printed for every mirror (that can be dozens of lines), which is ugly, but at least informative... Without modifying the download logic (for example, by introducing -2 return value for _alpm_download() to indicate giving up), this ugliness cannot be eliminated. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Don't check diskspace when using --dbonlyDan McGee
Mostly a waste of time. Sure, we no longer make sure your pacman database partition has enough space, but if you are using this option you better know what you are doing anyway. Signed-off-by: Dan McGee <dan@archlinux.org> (cherry picked from commit ee969006056c86e88d5f179a7575d64f23d5b252)
2012-02-19diskspace: ensure we match only full path componentsDan McGee
If one had a mountpoint at '/e' (don't ask), a file being installed to '/etc' would map to it incorrectly. Ensure we do more than just prefix matching on paths by doing some more sanity checks once the simple strncmp() call succeeds. Signed-off-by: Dan McGee <dan@archlinux.org>