Commit Graph

93 Commits

Author SHA1 Message Date
Juan RP
2830bbef6d package_remove: reset errno when a file does not exist (ENOENT).
To not propagate it later on... and also pass rv not errno to the
state callback function.
2015-12-01 08:31:05 +01:00
Juan RP
93b50bc4dc alternatives: preserve order while updating pkgs (thanks chris2/duncaen). 2015-11-17 16:32:12 +01:00
Juan RP
faeff38ca2 Alternatives framework (1/2) (WIP). 2015-10-18 10:38:35 +02:00
Juan RP
1774d17e40 Keep /usr/sbin if found as obsolete, it's a symlink in void. 2015-06-05 08:29:05 +02:00
Juan RP
769a997afb Introduce xbps_plist_{array,dictionary}_from_file().
Those are a wrapper around xbps_{array,dictionary}_internalize_from_zfile()
that prints a debugging msg when the plist file cannot be internalized.

Update xbps to use these wrappers.
2015-05-28 10:15:05 +02:00
Juan RP
a05e039cce Revert "Stop converting relative symlinks to absolute."
This reverts commit 9ae3638429.

This change is ok, but cannot be used right now because all existing
binpkgs were created with an old xbps-create(8).
2015-02-19 11:11:58 +01:00
Juan RP
9ae3638429 Stop converting relative symlinks to absolute.
There's no reason to make them absolute, simply store in the metadata
the target file as is. This vastly simplifies the code and makes all
test pass correctly.
2015-02-19 11:04:34 +01:00
Juan RP
67eba7d912 Improve detection of target file in relative symlinks.
If xbps-create(8) did not guess the target file of relative symlinks for
some reason, just compare the current symlink and what's stored as is,
without converting it to absolute.

This might happen with dangling relative symlinks or existing binary
packages that were not created with a newer xbps-create(8).
2015-02-19 10:24:24 +01:00
Juan RP
05f879ec09 Introduce xbps_symlink_target() and use it in two places.
This code is now shared by xbps-pkgdb and libxbps/xbps-remove.
2015-02-19 09:47:09 +01:00
Juan RP
1722635e08 Introduce xbps_sanitize_path() to fix #78 properly.
This removes multiple slashes of a path and returns you a buffer with
the sanitized string.
2015-02-18 15:12:39 +01:00
Juan RP
628a344560 libxbps: fix a memleak introduced in 1403826fa. 2015-02-17 16:39:04 +01:00
Juan RP
1403826fa6 libxbps: detect and remove properly symlinks with relative targets.
Close #78
2015-02-17 11:59:05 +01:00
Juan RP
5dba1108d1 lib/package_remove.c: simplify link relative check. 2014-10-25 10:32:58 +02:00
Juan RP
ff3960696f lib/package_remove.c: fix a memleak. 2014-10-25 08:08:04 +02:00
Juan RP
5fe3594cb5 Make sure that modified symlinks are preserved.
When removing a package, symlinks owned by this package that have been
modified should be preserved, unless the force flag is set via xbps-remove(8).
2014-10-25 06:43:30 +02:00
Juan RP
adc0643ee4 Fully switch to zplists. 2014-10-17 10:27:58 +02:00
Juan RP
1c20086896 Package remove: disable file owner checks if euid==0.
All package files even not owned by root should be removed, so make sure
that those checks return success while being root.

This fixes package removal for polkit, that had /etc/polkit/rules.d
files owned by the polkitd user.
2014-10-17 09:17:07 +02:00
Juan RP
2711b07b77 Fix package files removal with only read bit set.
The previous code was checking incorrectly if the file had the write
bit set, and this is wrong because a package could have files with
only the read bit set (0444).
2014-09-28 13:33:15 +02:00
Juan RP
01dbb968dd Welcome pkgdb-0.38. 2014-09-11 00:12:12 +02:00
Juan RP
e92e86c2db Share code to show pre-remove/post-install msgs. 2014-07-27 17:39:24 +02:00
Juan RP
a28046332f Implemented support for pre-remove and post-install messages.
Close #44
2014-07-27 11:24:49 +02:00
Juan RP
0e7e2c0148 lib/package_remove.c: typo fix. 2014-05-22 10:49:01 +02:00
Juan RP
350852bf76 lib/package_remove.c: avoid many small heap allocs and simplify. 2014-05-22 10:42:27 +02:00
Juan RP
4530c79bb2 Make sure that root symlinks in void are never removed or detected as obsoletes.
Added/improved test cases to detect those conditions work as expected.
2014-03-31 10:16:18 +02:00
Juan RP
56786ed315 xbps_remove_pkg: misc debugging tweaks. 2014-03-13 21:07:44 +01:00
Juan RP
0416b067d0 Use a POSIX lock for pkgdb and only issue pkgdb writes in exact points.
- Rather than using a POSIX named semaphore use a POSIX lock (lockf(3))
for pkgdb for writers. Writers that cannot acquire the pkgdb lock will
get EAGAIN rather then being blocked.

- Due to using a file lock we cannot write the pkgdb every time a package
is being unpacked, configured or removed. Instead pkgdb is only written
at the end of a specific point in the transaction (unpack, configure, remove)
or via xbps_pkgdb_unlock().
2014-03-04 14:37:10 +01:00
Juan RP
9101241b20 Fix pkg symlink removal introduced in the two phase package removal feature. 2014-02-26 10:05:19 +01:00
Juan RP
f74bf1c1c8 New custom configuration file format that does not need confuse. 2014-02-25 16:42:52 +01:00
Juan RP
596a8c199f Improve two phase pkg removal: do the check for all entry types. 2014-02-09 12:53:15 +01:00
Juan RP
61fa9b8c7e Improve package removal by using a two phase approach: check and removal. 2014-02-09 11:54:49 +01:00
Juan RP
292be5c420 Make sure that all symlinks in a package are removed, not just dangling symlinks. 2014-01-12 17:10:07 +01:00
Juan RP
35e4182250 Fully remove the obsolete softreplace code. 2013-12-25 11:12:52 +01:00
Juan RP
dce26db1de libxbps: pkg remove: never remove base symlinks in the root directory.
The /bin, /sbin, /lib, /lib32, /lib64, /var/run symlinks should never be removed
in Void, so be safe and ignore the removal of them.

Added another test to the testsuite to verify its correctness.
2013-11-28 10:27:36 +01:00
Juan RP
d0380d5cd2 lib/package_remove.c: add a bit of debugging if pkg wasn't found in pkgdb. 2013-11-17 11:33:16 +01:00
Juan RP
42c0766c00 Get rid of libfetch and proplib external dependencies.
The list of required external deps is now confuse, libarchive and openssl.

libxbps now includes a wrapper for proplib prefixed with xbps_ rather than prop_.
2013-06-20 10:26:12 +02:00
Juan RP
9d80524a34 Minor optimization: no need to check if obj is NULL, prop_object_type() does that already. 2013-06-14 12:22:29 +02:00
Juan RP
99be698979 Use a single file to store repository data.
This is just the starting point to extend repositories with PGP signatures.
2013-06-10 10:28:39 +02:00
Juan RP
0a1859987a Respect automatic-install mode from pkgdb in transaction updates.
Also simplify register/unregister and remove useless state definitions.
2013-03-07 10:03:59 +01:00
Juan RP
7c1a0ac3e8 New pkgdb (0.21) and repo index (1.7) format, see NEWS for info. 2013-03-05 04:08:42 +01:00
Juan RP
eb61aabca8 xbps_remove_pkg: fix a double free. 2013-02-19 14:58:56 +01:00
Juan RP
a8e8e8fd5d xbps_remove_pkg: ignore ELOOP in realpath() when checking symlinks.
Probably it is a broken symlink, so we don't have to care about it.
2013-02-04 16:35:15 +01:00
Juan RP
b5bb1debe4 Partial revert of 5d59a15faf.
Error out if "pre-remove" script action fails, otherwise package is
removed but its files are still there (ouch).
2013-01-14 14:01:35 +01:00
Juan RP
5d59a15faf libxbps: even if executing a pre-remove action fails, continue removing pkg.
This is no reason to stop removing a pkg, so just continue and fully
remove the pkg.
2012-12-29 07:13:49 +01:00
Juan RP
0f22579a34 libxbps: fixed regression executing "pre-remove" action in installed pkgs. 2012-12-28 10:42:13 +01:00
Juan RP
f45352dbf8 Added support for dynamic generation of revdeps for installed packages. 2012-11-30 17:40:52 +01:00
Juan RP
63c1883201 Major API/ABI cleanup bringing performance improvements and fixes.
These are the core interfaces in the new API:

rpool - Interface to interact with the repository pool.
rindex - Interface to interact with repository indexes.
pkgdb - Interface to interact with local packages.
transaction - Interface to interact with a transaction.

This also brings new repository index format, making the index file
per architecture and being incompatible with previous versions.

The transaction frequency flush option has been removed, and due to
the nature of package states it was causing more harm than good.

More changes coming soon, but the API shall remain stable from now on.
2012-11-30 07:11:51 +01:00
Juan RP
85c0641cc8 xbps_{configure,remove}_pkg: do not use meta cache when executing scripts.
This fixes executing INSTALL/REMOVE scripts with the right version currently
installed, i.e kernel post-install failed to execute correctly its kernel
hooks due to passing a wrong version.
2012-11-26 23:25:41 +01:00
Juan RP
0edba07106 xbps_remove_pkg: fix dbg printf args. 2012-11-19 14:45:09 +01:00
Juan RP
34ae90f1c3 xbps_remove_pkg: force pkgdb flush after unregister. 2012-11-19 14:40:41 +01:00
Juan RP
5397dd4937 xbps_remove_pkg: handle all cases where pkg meta plist is unavail. 2012-11-19 14:08:01 +01:00