summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
* libalpm: Search for replacers before literalsOlivier Brunel2013-03-07
| | | | | | | | | | | | | | | | | Since 882bff36 literals would be searched before replacers, resulting in a package being replaced by another not actually being replaced under certain conditions (e.g. they're both in the same repo). This change effectively reversed the expectations in test sync132. This patch switches the order back to replacers first, thus making sure if a package is replacing another one, the change will always happen, even if both are in the same repo. Note that a package replacing another one in a repo with higher priority will not be done, see FS#11737 and test sync1105 Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* libalpm: Fix installing update of a replaced packageOlivier Brunel2013-03-07
| | | | | | | | | During a sysupgrade, if a package is replaced by another, and an update for the former package is found (on another repo) the replaced package would be re-installed. Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Do not resolve every local package filelist on removeAllan McRae2013-03-07
| | | | | | | | | | Although technically correct, this results in my system taking ~30 seconds to resolve all filelists when removing a package that has a directory not owned by any package. The check for if any package own the empty directory is a rare enough occurance, and it will be even rarer when that directory has a directory symlink in its path, so just revert this at this stage. Signed-off-by: Allan McRae <allan@archlinux.org>
* add SYMEXPORT to alpm_filelist_containsAndrew Gregory2013-02-24
| | | | | | | | alpm_filelist_contains is listed in alpm.h and should be public but was not exported. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* dload: don't download sig if package is found in cacheDave Reisner2013-02-24
| | | | | | | Avoids the segfault seen in FS#33911. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Provide full path names in warning messagesRichard Pougnet2013-02-24
| | | | | | | Fix FS#31556 by printing filename instead of entryname. Thus, removing a lot of confusion from the output. Signed-off-by: Allan McRae <allan@archlinux.org>
* Perform limited conflict checking with --forceAllan McRae2013-02-24
| | | | | | | | | | | | Pacman currently bails when trying to extract a file over a directory when using --force. Instead of ignoring all conflict, perform the check and skip any file-file conflicts. Conflicts between directories and files are still flagged and cause the transation to abort. As a bonus, we now know about files changing packages when using --force, so we can skip removing them fixing upgrade046. Signed-off-by: Allan McRae <allan@archlinux.org>
* use resolved_path for filelist_containsAndrew Gregory2013-02-24
| | | | | | | | | | | alpm_filelist_contains was being used to search for resolved paths, but searching in the unresolved paths, causing it to miss matches. We always search unresolved paths and search the resolved paths if available because _alpm_filelist_resolve is not public and requires a context handle, so it can't be called from alpm_filelist_contains. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* return resolved paths from filelist_differenceAndrew Gregory2013-02-24
| | | | | | | | | | | We were comparing files based on resolved paths but returning the original file_t structures, which were not necessarily in the same order. The extra file_t information was only being used to determine if the file was a directory which can be accomplished by testing for a trailing slash, so just return the resolved path. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* return resolved paths from filelist_intersectionAndrew Gregory2013-02-24
| | | | | | | | | | We were comparing files based on resolved paths but returning the original file_t structures, which were not necessarily in the same order. The additional file_t information was never used, so just return the resolved path. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* use alpm_list_free on filelist intersectionAndrew Gregory2013-02-24
| | | | | | | | alpm_filelist_intersection returns a list of pointers to internal file_t struct's, so only the list itself should be freed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* fix off-by-one error in _alpm_filelist_resolveAndrew Gregory2013-02-16
| | | | | | | '/' should not be appended to the resolved root when root is "/". Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* fix style violationsAndrew Gregory2013-02-16
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* fix alpm_validation_t commentAndrew Gregory2013-02-16
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* find_fileconflicts: reduce path resolution callsAndrew Gregory2013-02-16
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* libalpm: never attempt to remove a mountpointDave Reisner2013-02-16
| | | | | | | | | | | | | | | | | | | | | | | Arch Linux typically runs into this with /sys when upgrading the filesystem package in build chroots, but LXC users might also run into this, since their /sys is shared from the host and must, for security reasons, be mounted RO. I've neglected to add any tests for this because they would require root in order to run. Current tests all pass with this patch and I've confirmed the desired behavior in a VM. Incidentally, the first hunk of this patch (skipping can_remove_file checks for directories) resolves the case of API mountpoints being removed since they eventually fall into unlink_file and fail with "contains files". However, this patch should still be the Right Thing To Do™, as we can't possibly remove a directory that is also a mountpoint. Signed-off-by: Dave Reisner <dreisner@archlinux.org> [Allan] Do not skip checking if directories can be removed. Instead test if directories are mountpoints in can_remove_file. Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix registering database with non-gpgme buildsAllan McRae2013-02-13
| | | | | | | | | | We record whether the default SigLevel is set in order to add upon it for the *FileSigLevel entries. When using the only valid value of "SigLevel = Never" with non-gpgme builds, we need to ignore the ALPM_SIG_PACKAGE_SET flag when determining if we have a valid value for the database SigLevel. Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix --without-gpgme buildAllan McRae2013-02-13
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add format attributes to all required functionsAllan McRae2013-02-13
| | | | | | | | | Fixes all clang warnings with -Wformat-literal. Also, fix genuine formating issue discovered once adding these attributes and add a cast to prevent a gcc warning. Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix compilation error on clangAllan McRae2013-02-13
| | | | | | | | This also lead me to notice that in _alpm_gpgme_checksig many things were not being cleaned up. Fix this by having CHECK_ERR goto gpg_error and make the required adjustments. Signed-off-by: Allan McRae <allan@archlinux.org>
* Skip reading sync db deltas files if UseDelta is unsetAllan McRae2013-02-09
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Import key if needed when installing package from fileAllan McRae2013-02-09
| | | | | | | | When installing a package with "pacman -U" that has a detached signature, check if the needed key is in the keyring and download if necessary. Signed-off-by: Allan McRae <allan@archlinux.org>
* Prompt to delete packages with signature failsAllan McRae2013-02-09
| | | | | | | Offer to remove the bad package when a signature fails to validate as is done for checksum failures. Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove retry path from signature validationAllan McRae2013-02-09
| | | | | | | | Now that the keyring is checked for all needed keys before the validation, we can not reach a point of a missing key when doing validity checks for sync operations. Signed-off-by: Allan McRae <allan@archlinux.org>
* Check keys are in keyring before package validationAllan McRae2013-02-09
| | | | | | | | | | | | Keys used to create signatures are checked for presence in the keyring before package validation is performed. Signed-off-by: Allan McRae <allan@archlinux.org> Conflicts: lib/libalpm/alpm.h Signed-off-by: Allan McRae <allan@archlinux.org>
* Make decode_signature available to the libraryAllan McRae2013-02-09
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add function to extract key id from signaturesAllan McRae2013-02-09
| | | | | | | This does not support all possibilities of RFC4880, but it does cover every key currently used in Arch Linux. Signed-off-by: Allan McRae <allan@archlinux.org>
* Move key importing into separate functionAllan McRae2013-02-09
| | | | | | | | This will be useful for checking the availablity of all keys before perfoming validation in sync operations and for downloading a needed key in upgrade operations. Signed-off-by: Allan McRae <allan@archlinux.org>
* Make key_in_keychain available in libraryAllan McRae2013-02-09
| | | | | | | In preparation for checking key presence and downloading needed keys before conflict checking. Signed-off-by: Allan McRae <allan@archlinux.org>
* inline libarchive compat wrappersDave Reisner2013-02-07
| | | | | | Suggested-by: Dan McGee <dan@archlinux.org> Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add configuration option for Upgrade operation SigLevelAllan McRae2013-02-07
| | | | | | | | | | | | | Add LocalFileSigLevel and RemoteFileSigLevel to control the signature checking for "pacman -U <file>" and "pacman -U <url>" operations respectively. The starting value for both these options is SigLevel, if it is specified in the [options] section, or the built-in system default. The specified values override and/or supplement this initial value. Note there is no distinction between setting "Required" and "PackageRequired" as there are no database options for Upgrade operations. Signed-off-by: Allan McRae <allan@archlinux.org>
* Restore libarchive 2.8.x compatibilityDan McGee2013-01-29
| | | | | | | | | | | We still call some of these 'deprecated' methods elsewhere, so this shouldn't present a problem. When we decide 2.x support is to be dropped, we should update all of the code to not call deprecated methods. Allan: Adjusted with respect to previous patches adding libarchive compatibilty layer. Signed-off-by: Allan McRae <allan@archlinux.org>
* Use libarchive compat header for relevant symbolsDave Reisner2013-01-29
| | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* add libarchive compatability objectDave Reisner2013-01-29
| | | | | | | | This allows us to support both libarchive 2.8.x as well as 3.x without deprecation warnings on compile. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* dload: pass back the effective URL to callers of _alpm_downloadDave Reisner2013-01-29
| | | | | | | | | | | I suspect that eventually we're going to end up returning a pointer to an allocated struct to describe the download result, but that's for another patch when the need arises... Fixes FS#33508. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Relax requirement of what constitutes a dead connectionLANGLOIS Olivier PIS -EXT2013-01-29
| | | | | | | | Users have hit issues behind corporate firewalls that initially throttle downloads to ~1B/sec. Signed-off-by: Olivier Langlois < olivier.pis.langlois@transport.alstom.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add caller prefix to alpm_logactionAndrew Gregory2013-01-28
| | | | | | | prefix defaults to "UNKOWN" if null or an empty string is provided. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add doxygen comments to conflict.cAndrew Gregory2013-01-28
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Make path to ldconfig configurableAllan McRae2013-01-28
| | | | | | | | | The FHS (2.3) says having ldconfig in /sbin is optional and it is usually located in /usr/sbin. So /sbin/ldconfig should not be hard coded in pacman. Instead, provide a configure option --with-ldconfig that defaults to the current path. Signed-off-by: Allan McRae <allan@archlinux.org>
* Revert execvp and related commitsAllan McRae2013-01-28
| | | | | | | | | This reverts commit 4a8c2852a887d2b1aaa43be3071ab586eb24b9e3. This reverts commit 993700bc6b12cd291544d2a22845f480e8a7925e. This reverts commit bb4d2b72c1d35ab9d65d632be0dcaf00cfa7d600. This reverts commit 60b192e3836a150eb6950ce52241efebbee00f11. Signed-off-by: Allan McRae <allan@archlinux.org>
* dload: avoid showing progress bars on some redirectsDave Reisner2013-01-17
| | | | | | | | | | | | | RFC 2616 doesn't forbid a 301 or 302 repsonse from having a body, and servers exist in the wild that show this behavior. In order to prevent pacman from showing a progress bar when we aren't actually downloading a package (and merely following one of these pain in the butt redirects), capture the server response code in the response header, rather than waiting to peel it off the handle after the download has finished. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Reported-by: Alexandre Filgueira <alexfilgueira@cinnarch.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Do not use full path for ldconfigAllan McRae2013-01-17
| | | | | | | | | | | The ldconfig binary is not guaranteed to be in /sbin. Change to calling just "ldconfig" rather than using the full path. This removed the check that the ldconfig binary exists. However, it is a reasonable assumption that it will exist if its configuration file does. Signed-off-by: Allan McRae <allan@archlinux.org>
* Use execvp for running programs in chrootAllan McRae2013-01-17
| | | | | | | This makes us more robust to utilities changing paths. There is no functional change when a full path is specified. Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix space between control structure and open parensGerardo Exequiel Pozzi2013-01-04
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix open braces styleGerardo Exequiel Pozzi2013-01-04
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix missing spaces in operatorsGerardo Exequiel Pozzi2013-01-04
| | | | | Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Allan McRae <allan@archlinux.org>
* Save backup files with extension .pacsave.nPang Yan Han2013-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach pacman to save backup files with extension .pacsave.n, where n is a positive integer. The current backup file shall be saved as <name>.pacsave, while existing .pacsave.n files will be renamed to <name>.pacsave.n+1 Example: 1. You have subversion installed in your local repo. /etc/conf.d/svnserve is a file to be backed up. It contains local modifications 2. You remove subversion from your repo. /etc/conf.d/svnserve is backed up as /etc/conf.d/svnserve.pacsave 2. You install subversion again 3. You edit /etc/conf.d/svnserve 4. You remove subversion. The existing /etc/conf.d/svnserve.pacsave is renamed to /etc/conf.d/svnserve.pacsave.1 and /etc/conf.d/svnserve is backed up as /etc/conf.d/svnserve.pacsave Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Rebased from original email and adjusted for util-common usage. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* Split common utility functions for libalpm and pacmanAllan McRae2013-01-04
| | | | | | | | | | | | There is duplicated code in the util.c files in the libalpm and pacman source code. Split this into a separate file so that it can be shared via a symlink. This prevents code divergence between the two code bases. Also, move mbasename and mdirname from pacman/util.c into util-common.c in preparation for the following patch that uses them to add an extension to pacsave files. Signed-off-by: Allan McRae <allan@archlinux.org>
* Use a defined constant in delta.c for num_matchesDan McGee2013-01-03
| | | | | | | This allows compiling in both clang and gcc without running into oddities regarding const vs. defined constant values. Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright year for 2013Allan McRae2013-01-03
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>