Commit Graph

38 Commits

Author SHA1 Message Date
Juan RP
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Juan RP
829c5835f1
alternatives: respect (and love) current provider.
Added a new test case to verify.

Close #126
2019-06-18 20:47:55 +02:00
Juan RP
cf4f0f4aa0 xbps_alternatives_register: fix a memleak.
Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
bcd80f2936 xbps_alternatives_register: update pkgdb alternatives dictionary.
... otherwise the entry might not be added to our array and won't
hit pkgdb.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
1c85083a94 lib/package_alternatives.c: update copyright.
Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
f06edd8850 xbps_alternatives_register: no need to check for 'alloc'.
Found by @huglovefan. Thanks.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
639ff2d642 xbps_alternatives_register: get rid of an unnecessary change.
Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
d189921818 xbps_alternatives_register: fix test case "more_entries_update".
Even if the alternatives group is already registered, we need
to create the symlinks from current pkg dictionary (repo).

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
f4f9bef6e5 xbps_alternatives_register: find and remove obsolete symlinks.
This fixes the new test case "less_entries_update" contributed
by @duncaen.

If "alternatives" dict from pkgdb differs from the one from repos,
find obsoletes and remove them.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
04f899c80f xbps_alternatives_unregister: fix removal of current provider.
Fix logic as found by @duncaen in #101.

Also set "first" when the entry is removed from the array.

Fixes #102

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
c29efcd13b xbps_alternatives_unregister: fix xbps_set_cb_state().
In the !current branch, "first" wasn't initialized so it displayed garbage:

Removing `pinentry-tty-1.1.0_5' ...
Removing 'pinentry' alternatives group symlink: pinentry
pinentry-tty-1.1.0_5: unregistered 'pinentry' alternatives group
Switched 'pinentry' alternatives group to 'p
o@�'
Creating 'pinentry' alternatives group symlink: pinentry -> /usr/bin/pinentry-tty
Removed file `/usr/bin/pinentry-tty'
Removed `pinentry-tty-1.1.0_5' successfully.

With my fix:

Removing `pinentry-tty-1.1.0_5' ...
Removing 'pinentry' alternatives group symlink: pinentry
pinentry-tty-1.1.0_5: unregistered 'pinentry' alternatives group
Switched 'pinentry' alternatives group to 'pinentry'
Creating 'pinentry' alternatives group symlink: pinentry -> /usr/bin/pinentry-tty
Removed file `/usr/bin/pinentry-tty'
Removed `pinentry-tty-1.1.0_5' successfully.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Duncaen
456f775e4d alternatives: don't switch unchanged alternative groups on removal
Closes: #82 [via git-merge-pr]
2019-04-22 14:51:32 +02:00
human
b502dc708a fix setting alternatives for packages with more than one group 2019-04-20 11:10:34 +02:00
Duncaen
3b04602cc6 lib/package_alternatives.c: cleanup create_symlinks 2016-09-05 16:03:41 +02:00
Duncaen
dd7a0d073b lib/package_alternatives.c: remove previous symlinks 2016-09-05 02:03:30 +02:00
Michael Gehring
3bfc7b5e6d alternatives: fix dirname() buffer reuse 2016-02-08 15:10:07 +01:00
Juan RP
93b50bc4dc alternatives: preserve order while updating pkgs (thanks chris2/duncaen). 2015-11-17 16:32:12 +01:00
Juan RP
15ab86c90d alternatives: fix a double free in error path. 2015-11-15 09:23:51 +01:00
Juan RP
9ef83cfa69 alternatives: handle dirname() returning ".". 2015-11-15 09:17:05 +01:00
Juan RP
b3c7d27c6b alternatives: fix creation of symlinks with unexistent dirs.
If an alternative needs to create /usr/bin/foo, and /usr/bin
does not exist, this directory must be created prior to create
the symlink.
2015-11-14 07:26:27 +01:00
Juan RP
da5ad3d052 lib/package_alternatives.c: fix builds on travis. 2015-11-10 12:05:20 +01:00
Enno Boland
ae44f32be2 lib/package_alternatives.c: fix memleak 2015-11-10 11:58:07 +01:00
Juan RP
0fced28044 lib/package_alternatives.c: error out if xbps_mkpath() fails.
... and ignore EEXIST for existing dirs.
2015-11-09 16:31:22 +01:00
Enno Boland
2927e58df2 lib/package_alternatives.c: fix style 2015-11-09 08:52:49 +01:00
Enno Boland
78e3bde269 lib/package_alternatives.c: Handle // cases. 2015-11-08 10:47:25 +01:00
Enno Boland
19a65158d9 lib/package_alternatives.c: get rid of goto in normpath. 2015-11-08 10:38:31 +01:00
Enno Boland
8bd2808108 lib/package_alternatives.c: fix wrong /. handling for normalizing paths. 2015-11-08 10:37:26 +01:00
Enno Boland
635db51c27 lib/package_alternatives.c: always use relative symlinks in alternatives
This commit adds relative link support to lib/package_alternatives.c.
Instead of creating absolute links, xbps will create relative links
to the target. This allows to follow links on systems even if the
aren't mounted on /.
2015-11-07 08:40:57 +01:00
Juan RP
9b0cde3267 xbps-alternatives: dangling symlinks are now supported. 2015-11-02 21:02:37 +01:00
Juan RP
f896b17ba7 alternatives: fix an assertion! 2015-10-31 14:19:50 +01:00
Juan RP
33a1bea633 alternatives: fix a warning. 2015-10-31 14:07:12 +01:00
Juan RP
512122da4c alternatives: really make relative symlinks this time. 2015-10-31 14:01:20 +01:00
Joey Gouly
b06ce15136 Allow relative symlinks in xbps-alternatives. 2015-10-31 11:54:01 +00:00
Juan RP
59a8d3d20e alternatives: skip dup alternative groups. 2015-10-31 11:47:58 +01:00
Juan RP
35718e676c Document alternatives in the API. 2015-10-30 13:18:32 +01:00
Juan RP
cb857dfc27 Alternatives framework for xbps (2/2).
See xbps-alternatives(1) for more information.

Thanks to all who helped to design this and for fixing grammar in
the manual page.
2015-10-30 12:24:46 +01:00
Juan RP
4e446968c5 alternatives: do not ignore symlink(2) return value.
This fixes the travisci warning seen with gcc.
2015-10-19 17:11:34 +02:00
Juan RP
faeff38ca2 Alternatives framework (1/2) (WIP). 2015-10-18 10:38:35 +02:00