summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* removed the condition in alpm_db_set_servers since FREELIST is NULL safeBarbu Paul - Gheorghe2012-08-07
| | | | | Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2012-08-07
|\
| * Print repo being search for replaces in debug outputAllan McRae2012-08-07
| | | | | | | | | | | | | | | | Given the message is repeated for each repo, it is a good idea to print the repo name in the output. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | coding style fixesFlorian Pritz2012-08-07
| | | | | | | | | | Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Split _alpm_filelist_operation functionAllan McRae2012-08-02
| | | | | | | | | | | | | | | | | | To improve conflict checking, we will need to make these functions diverge to an extent where having two separate functions will be preferable. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@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>
* | Merge branch 'maint'Dan McGee2012-08-01
|\|
| * Add more debug logging to dir_belongsto_pkg() functionDan McGee2012-08-01
| | | | | | | | | | | | Now that we pass in the handle, we might as well add logging. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Fix wrong parameter name in alpm_db_update's signatureBarbu Paul - Gheorghe2012-08-01
| | | | | | | | Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
* | util: fix line length calc in _alpm_archive_fgetsDave Reisner2012-08-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 74274b5dc347ba70 which added the real_line_size to the buffer struct didn't properly account for what happens when archive_fgets has to loop more than once to find the end of a line. In most cases, this isn't a problem, but could potentially cause a longer line such as PGP signature to be improperly read. This patch fixes the oversight and focuses on only calculating the line length when we hit the end of line marker. The effective length is then calculated via pointer arithmetic as: (start_of_last_read + read_length) - start_of_line Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | lib/conflict: use a binary search within filelistsDave Reisner2012-08-01
| | | | | | | | | | | | | | | | | | | | Take advantage of the fact that our filelists are arrays sorted by filename with a known length and use a binary search. This should speed up file conflict checking, particularly when larger packages are involved. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | lib/be_local: ensure local filelists are sortedDave Reisner2012-08-01
| | | | | | | | | | | | | | This may very well be a no-op, but better safe than sorry. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | lib/be_package: use qsort instead of our own msortDave Reisner2012-08-01
| | | | | | | | | | | | | | | | | | | | On the assumption that these arrays are already mostly sorted, use the standard quicksort method to sort the files arrays. The files_msort function name is tweaked to give it a more general name to reflect this change. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2012-07-10
|\| | | | | | | | | Conflicts: etc/makepkg.conf.in
| * Check empty subdirectory ownershipAllan McRae2012-07-10
| | | | | | | | | | | | | | | | | | | | | | When checking if a package owns a directory, it is important to check not only that all the files in the directory are part of the package, but also if the directory is part of a package. This catches empty subdirectories during conflict checking for directory to file/symlink replacements. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Add conflict for replacing owned empty directoryAllan McRae2012-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two packages own an empty directory, pacman finds no conflict when one of those packages wants to replace the directory with a file or a symlink. When it comes to actually extracting the new file/symlink, pacman sees the directory is still there (we do not remove empty directories if they are owned by a package) and refuses to extract. Detect this potential conflict early and bail. Note that it is a _potential_ conflict and not a guaranteed one as the other package owning the directory could be updated or removed first which would remove the conflict. However, pacman currently can not sort package installation order to ensure this, so this conflict requires manual upgrade ordering. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | update comments referring to alpm_option_get_syncdbsDave Reisner2012-07-10
| | | | | | | | | | | | This function was renamed alpm_get_syncdbs as part of b488f229d. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | diskspace: log errors when opening the mount table failsDave Reisner2012-07-10
| | | | | | | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | diskspace: only load filesystem info on demandDave Reisner2012-06-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only load filesystem details for the mount points that we're actually going to write to. This reduces our syscall count considerably. In the case of installation, we would actually stat every mountpoint twice (an extra round for download diskspace) which means (on my system) a total of 60 syscalls to write to 3 partitions when installing the kernel package. This change reduces the 60 syscalls down to the expected 3. A slight debug output change is added here to discern between a mountpoint added to our linked list versus when we actually load the fs info. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | diskspace: dedupe code for loading FS usageDave Reisner2012-06-25
| | | | | | | | | | | | | | | | | | | | add mount_point_load_fsinfo() for platforms using getmntent(). Dan: move the #ifdef slightly so we don't have unused functions on certain platforms (e.g., OS X). Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | repo-add: add checkdepends informationAllan McRae2012-06-25
| | | | | | | | | | | | | | Similar to the case for makedepends, it is useful to be able to access this information without parsing a PKGBUILD. Signed-off-by: Allan McRae <allan@archlinux.org>
* | add line length parameter to _alpm_strip_newlineDave Reisner2012-06-25
| | | | | | | | | | | | | | | | | | If known, callers can pass the line size to this function in order to avoid an strlen call. Otherwise, they simply pass 0 and _alpm_strip_newline will do the call instead. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | add real_line_size to alpm_read_bufferDave Reisner2012-06-25
| | | | | | | | | | | | | | | | | | We inevitably call strlen() or similar on the line returned from _alpm_archive_fgets(), so include the line size of the interesting line in the struct. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | check proper variable for NULLDave Reisner2012-06-25
| | | | | | | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | diskspace: canonicalize path to download dirDave Reisner2012-06-25
| | | | | | | | | | | | | | With lazy loading in place, it's now quite obvious that we aren't necessarily checking the right mountpoint for necessary download space. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | libalpm/remove.c - add doxygenAndrew Gregory2012-05-21
| | | | | | | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | repo-add: add makedepends informationAllan McRae2012-05-20
| | | | | | | | | | | | | | | | | | This is useful for tools that automatically rebuild packages and thus require to generate a build order. These entries are skipped by pacman. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | fix -Wshadow warnings as reported by gcc 4.4.3Dave Reisner2012-05-20
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2012-05-20
|\| | | | | | | | | Conflicts: scripts/pacman-key.sh.in
| * Ensure pre_upgrade scriptlet gets old package versionDan McGee2012-05-04
| | | | | | | | | | | | | | | | This was accidentally broken in the refactor done in commit 73139ccb. Fixes FS#29371. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Convert ALLOC_FAIL macro into a functionDan McGee2012-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | be_local: use the right length value for filename in all casesDan McGee2012-04-29
| | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'dave/buildsys'Dan McGee2012-04-29
|\ \
| * | libalpm: add pkg-config fileDave Reisner2012-04-25
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Move short-lived realpath buffers to the stackDan McGee2012-04-29
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | 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>
* | | be_local: write all single-valued attributes firstDan McGee2012-04-24
|/ / | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2012-04-12
|\|
| * Fix issues with unintialized variable value usageDan McGee2012-04-09
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix a signed overflow error on i686 with GCC 4.7.0Dan McGee2012-04-08
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Various tweaks to support building with excessive GCC warning flagsDan McGee2012-04-08
| | | | | | | | | | | | | | | | | | 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>
* | buildsys: define warning CFLAGS in separate varDave Reisner2012-04-08
| | | | | | | | | | | | | | 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>
* | buildsys: cleanup gpgme compile time checkDave Reisner2012-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* | buildsys: use pkg-config for libcurl detectionDave Reisner2012-04-08
| | | | | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | buildsys: use pkg-config for libarchive detectionDave Reisner2012-04-08
| | | | | | | | | | | | This also introduces a versioned dependency of >=2.8.0. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | buildsys: use pkg-config for openssl detectionDave Reisner2012-04-08
| | | | | | | | Signed-off-by: Dave Reisner <dreisner@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>
* | Return more useful error codes on package open failuresDan McGee2012-04-07
| | | | | | | | | | | | | | | | 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>
* | Make selecting scriptlet shell workAllan McRae2012-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2012-04-07
|\| | | | | | | | | | | Conflicts: lib/libalpm/signing.c lib/libalpm/sync.c