summaryrefslogtreecommitdiff
path: root/test/pacman/tests
Commit message (Collapse)AuthorAge
* add --overwrite option to ignore file conflictsAndrew Gregory2017-04-12
| | | | | | | | | | Allows for safer, more fine-grained control for overwriting files than --force's all-or-nothing approach. Implements FS#31549. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict: skip dir children when replacing a fileAndrew Gregory2017-01-04
| | | | | | | | | | | | | When replacing a file with a directory, any files under that directory do not need to be checked for conflicts. This prevents possible false-positive conflicts where the file being replaced is a symlink. We were already skipping the directory children when the file was owned by the previous version of a package being upgraded. This extends that to other packages being removed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* extract db files with dbonlyAndrew Gregory2017-01-04
| | | | | | | | | | | Some database files (install, mtree, and changelog) are extracted directly from the package, but DBONLY was skipping extraction altogether, causing those files to be missing after the transaction. Fixes #52052 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix memory leak in remove_notify_needed_optdependsAllan McRae2016-09-03
| | | | | | | Also add pactest which captures this leak when run under valgrind. Reported-by: Sergey Petrenko Signed-off-by: Allan McRae <allan@archlinux.org>
* recursedeps: include cyclic dependenciesAndrew Gregory2016-08-30
| | | | | | | | | | | | | | Cyclic dependencies (A depends on B, B depends on A) were not selected because neither package could be removed individually, so can_remove_package would always return false for both. By preselecting all dependencies then filtering back out any dependencies still required by any packages that will not be uninstalled, groups of unneeded cyclic dependencies can be found. Fixes FS#41031 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Print replacements when using -SupAllan McRae2016-05-05
| | | | | | | | | When printing a list of URLs of packages to be updated, pacman was ignoring any replacements that would be made in the update process. Fixes FS#35812 Signed-off-by: Allan McRae <allan@archlinux.org>
* do not rely on localdb for hook matchingAndrew Gregory2016-02-23
| | | | | | | | | | | | Relying on localdb to determine which trigger operations should match is completely broken for PostTransaction hooks because the localdb has already been updated. Store a copy of the old version of any packages being updated to use instead. Fixes FS#47996 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* only remove pacnew file if it is newAndrew Gregory2016-02-21
| | | | | | | | | | | Check if we overwrote an exiting pacnew file before unlinking it. Otherwise, updating to a version with an unchanged file would delete existing pacnew files. FS#47993 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* test version range restrictions corner caseDominik Fischer2016-01-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test introduced herein illustrates a behavior that may be unexpected to package writers. It creates a package "pkg3" that is configured to depend on a "dependency" which version is between 3 and 4, inclusive. Two other packages are already present, providing "dependency" in version 2 and 5, respectively. So, the situation looks roughly like this: pkg1 pkg3 pkg2 provides depends on provides | <------------> | version __________2____________3____________4____________5___________... This seems to be enough to satisfy pacman when installing "pkg3". From an iterative standpoint, this is completely logical: First, the requirement "dependency>=3" is checked. There is a package that satisfies this restriction, it is called "pkg2". Afterwards, "dependency<=4" is covered in the same way by "pkg1". Nonetheless, what a package writer intends when specifying depends=('dependency>=3' 'dependency<=4') is most probably that pacman should only allow this package to be installed when there indeed is a package present that provides a version of "dependency" that lies _between_ 3 and 5. Signed-off-by: Dominik Fischer <d dot f dot fischer at web dot de> Signed-off-by: Allan McRae <allan@archlinux.org>
* skip conflicts resolved by file replacementAndrew Gregory2015-12-05
| | | | | | | | | | | When replacing a file with a directory, any files inside the new directory cannot possibly exist on the filesystem and can be skipped. This allows cross-package symlink-to-directory transitions when there are files with the same name under both the symlinked directory and the new directory. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Detect potential conflict when symlink to directory is changing to directoryAllan McRae2015-12-05
| | | | | | | | | When a symlink to a directory is changing to a directory, any package file inside the new directory can create an unexpected conflict with the filesystem. Reported by Neofytos and Luca from Chakra. Signed-off-by: Allan McRae <allan@archlinux.org>
* hooks: pass matched targets to hooksAndrew Gregory2015-11-28
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* allow arguments in hook Exec fieldsAndrew Gregory2015-11-28
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add hook testsAndrew Gregory2015-10-18
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* sortbydeps: skip local packages being updatedAndrew Gregory2015-09-19
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* remove: use strcmp for files in skip_removeAndrew Gregory2015-03-03
| | | | | | | | | Paths from noupgrade, the transaction skip_remove, and package backup lists were combined into a single list matched using fnmatch causing paths with glob characters to match unrelated files. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Merge branch 'maint'Allan McRae2015-02-12
|\
| * sync200.py.in: remove unused substitutionAndrew Gregory2015-02-12
| | | | | | | | | | | | | | | | | | | | LIBCURL was never set in the Makefile so XferCommand was always being set in the test file. This removes the only substitution in our test files which will prevent the TESTS file from being rebuilt every time configure is run. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* | remove support for .pacorig filesAndrew Gregory2015-01-21
|/ | | | | | | | Leave user files in place and save new config files with a .pacnew extension. This reduces the complexity of file extraction and respects the principle that pacman shouldn't modify files it didn't create. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* remove.c: honor inverted patterns in noupgradeAndrew Gregory2014-12-18
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add --assume-installed optionFlorian Pritz2014-09-30
| | | | | | This allows to ignore specific dependencies. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* check_pkg_fast: check file typeAndrew Gregory2014-08-03
| | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* add test for file type check with -QkAndrew Gregory2014-08-03
| | | | | | | | | | If a directory has been replaced by a symlink, -Qk currently stats the symlink target rather than the symlink itself and doesn't check that the actual file type matches the package file list. This will make it difficult to discover errors once 4.2 is released and replacing directories with symlinks is no longer supported. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* Add test case for the perl 5.20 dependency breakageFlorian Pritz2014-06-10
| | | | | | | This test currently fails. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* remove.c: downgrade TRANS_DUP_TARGET to warningAndrew Gregory2014-05-07
| | | | | | | Matches the behavior for sync packages. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pmdb.py: change siglevel name to RequiredAndrew Gregory2014-05-04
| | | | | | | | | "Always" is not a valid siglevel. sign002.py was succeeding because pacman failed to parse the resulting config file rather than a failed signature check. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman: use exit status 0 for --help and --versionAndrew Gregory2014-01-30
| | | | | | | The user requesting usage or version information is not an error. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove ts and sw from vim modeline when noet is setFlorian Pritz2014-01-28
| | | | | | | | | | | | Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add the unit tests for -Qk and -Qkk that are possible now.Jeremy Heiner2014-01-06
| | | | | | | | | | | | | | | | | | The -Qk test (001) validates the existence of the package files (which were installed to the filesystem by the framework because the package was added to the "local" db). The -Qkk test (002) does not validate any file's properties - it can only check that the pacman run produces the expected warning message saying that the package lacks an mtree. Further tests will require modifications to the testing framework to allow intentional damage to the filesystem and generating an mtree. Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> [Allan] Make warning message detection more specific Signed-off-by: Allan McRae <allan@archlinux.org>
* trans_prepare: always sort trans->remove by depsAndrew Gregory2013-12-19
| | | | | | | | Packages can be removed during a sync transaction either directly or due to conflicts and need to be sorted. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* pacman -Si/-Qi: Autodetect best fitting file size unitFlorian Pritz2013-10-31
| | | | | | | | | | | | | I've tracked this back to e223366 and it looks like this just forces KiB because back then humanize_size didn't exist, but the size was just divided by 1024 to keep it somewhat readable. When humanize_size got introduced in 3c8a448 this was just carried over. The unit detected for "Download Size" is reused for "Installed Size" to make it easier to read. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* sortbydeps: include local pkgs in dep graphAndrew Gregory2013-10-31
| | | | | | | | | | | | | | | | Detecting indirect dependencies by traversing a package's entire dependency tree is prohibitively slow for larger transactions. Instead add local packages to the dependency graph. This additionally requires delaying dependency ordering for sync operations so that removed packages may be excluded from dependency detection. tests/sync012.py was also updated to ensure that the dependency cycle was actually detected. Fixes FS#37380 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add parens around tuples in Python list comprehensions.Jeremy Heiner2013-10-14
| | | | | | | Reported by 2to3: optional in Python 2, but required in 3. Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Use Python's "range" instead of deprecated "xrange".Jeremy Heiner2013-10-14
| | | | | | | | | | | | | Reported by 2to3. Python 3 throws out the old range, renames the old xrange to be the new range, leaving no xrange. A shim could be used, but using the less efficient version does not have a noticeable impact on the run time. This observed (lack of an) effect is as described in the Python 2 docs for xrange. The largest range created is only 1000 elements big, and the memory cost of those ranges is negligible when compared to that of all the pmpkg instances created. Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add make target for TESTSAndrew Gregory2013-10-14
| | | | | | | | | | | | | This causes make to update TESTS when tests are added (or updated). For simplicity, this changes TESTS from a single multi-line list to individually appending each test file. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> [Allan: use C locale for sorting] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* TESTS: add missing testsAndrew Gregory2013-09-19
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* libalpm: introduce a usage level for reposDave Reisner2013-09-04
| | | | | | | | | | | | | | | | This defines a level of interest a user has in a repository. These are described by the bitmask flags in the alpm_db_usage_t enum: ALPM_DB_USAGE_SEARCH: repo is valid for searching ALPM_DB_USAGE_INSTALL: repo is valid for installs (e.g. -S pkg) ALPM_DB_USAGE_UPGRADE: repo is valid for sysupgrades ALPM_DB_USAGE_ALL: all of the above are valid Explicitly listing the contents of a repo will always be valid, and the repo will always be refreshed appropriately on sync operations. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: fix directory ownership checkAndrew Gregory2013-08-21
| | | | | | | | | * append "/" to directories before searching package file lists * use lstat over stat so symlinks aren't resolved * fix the inverted check for stat's return value Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* integrate tests with automakeAndrew Gregory2013-08-21
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* query006: only set expectfailure on 32-bit systemsAndrew Gregory2013-08-21
| | | | | | | | Use the architecture of the python interpreter running the test to detect 32bit systems. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove setlocale usage from the backendAllan McRae2013-07-30
| | | | | | | | Using setlocale in the backend is bound to lead to frontend issues and we have have been using epoch in our databases since April 2007 (commit 47622eef). Remove support for old style times. Signed-off-by: Allan McRae <allan@archlinux.org>
* deps.c: check for indirect deps when orderingAndrew Gregory2013-06-26
| | | | | | | | | | | | | | | | | | | | On upgrades, indirect dependencies were not being detected if there was a dependency in between them that was not part of the transaction. For example, with the dependency chain: pkg1 -> pkg2 -> pkg3, if pkg1 and pkg3 are being upgraded but not pkg2 pacman would not order pkg1 and pkg3 properly. This was particularly problematic when replacements were involved because the replaced package(s) would be removed at the start of the transaction. If an install script required the replacer and lacked a direct dependency, it could fail. Fixes FS#32764. Partially fixes FS#23011. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* improve dir->file transition conflict resolutionAndrew Gregory2013-06-03
| | | | | | | | | | | | | | | | | Packages removed due to conflicts are always removed at the beginning of the transaction and as such can be included in the check for whether all owners of a directory will be removed in a transaction. Installed versions of packages being upgraded, other than the one with the conflict, cannot be used because our transaction ordering is not intelligent enough to ensure that they are removed prior to the installation of the conflicted package. Also, return false from dir_belongsto_pkgs on errors. Previously, we simply continued which could return true even if we were unable to actually establish that the package owned the entire tree. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* extract_single_file: consolidate symlink casesAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: check for file -> dir replacementsAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: exclude trailing slash from file pathAndrew Gregory2013-06-03
| | | | | | | | | After the initial checks, we either use the path as a directory and have to append the trailing slash anyway or use it as a file in which case the trailing slash should be excluded. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* conflict.c: do not ignore symlink<->dir conflictsAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* alpm_filelist: remove resolved_pathAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* update tests for symlink support removalAndrew Gregory2013-06-03
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove ALPM_QUESTION_LOCAL_NEWERConnor Behan2013-04-24
| | | | | | | | | Remove a question that hasn't been used since the 3.0 days. To prevent us from having an ugly enum of questions that is missing a bitmask, this changes the API of the hidden --ask option. Signed-off-by: Connor Behan <connor.behan@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>