Commit Graph

92 Commits

Author SHA1 Message Date
Juan RP
2d7e3d7b1a
xbps_transaction_remove_pkg: fix a memleak.
Thanks valgrind
2020-02-08 20:12:11 +01:00
Juan RP
6010a24de6 libxbps: ABI/API break due to xbps_pkg{,pattern}_name changes.
The funcs xbps_pkg_name() and xbps_pkgpattern_name() were
using malloc(3) to return the result, until now.

They now have been changed to not allocate the result
via malloc, the caller is responsible to provide a buffer
at least of XBPS_NAME_SIZE (64).

If for whatever reason the pkgname can't be guessed,
returns false. This should avoid lots of small allocs
around libxbps.

New functions have the following prototype:

bool xbps_pkg_name(char *dst, size_t len, const char *pkg)
bool xbps_pkgpattern_name(char *dst, size_t len, const char *pkg)

as suggested by @duncaen.
2020-02-08 19:49:57 +01:00
Juan RP
6e6a9294a7
xbps-install: fix for -D foo (anything else than xbps). 2020-01-25 13:44:46 +01:00
Juan RP
bda4452016
xbps-install: improved -D,--download-only support.
Added support to download all dependencies even
if the euid does not have write perms to rootdir.

In this mode we only care if cachedir is writable,
rootdir access is not necessary.

This is really useful to download all binary packages
required by any number of packages as any regular
user to later perform off-line installations, i.e:

```
$ xbps-install -c $PWD/cachedir -yD xbps
...
$ tree cachedir
cachedir/
├── acl-2.2.53_1.x86_64-musl.xbps
├── acl-2.2.53_1.x86_64-musl.xbps.sig
├── attr-2.4.48_1.x86_64-musl.xbps
├── attr-2.4.48_1.x86_64-musl.xbps.sig
├── bzip2-1.0.8_1.x86_64-musl.xbps
├── bzip2-1.0.8_1.x86_64-musl.xbps.sig
├── ca-certificates-20190110_1.noarch.xbps
├── ca-certificates-20190110_1.noarch.xbps.sig
├── libarchive-3.4.1_1.x86_64-musl.xbps
├── libarchive-3.4.1_1.x86_64-musl.xbps.sig
├── libcrypto45-3.0.2_2.x86_64-musl.xbps
├── libcrypto45-3.0.2_2.x86_64-musl.xbps.sig
├── liblz4-1.9.2_1.x86_64-musl.xbps
├── liblz4-1.9.2_1.x86_64-musl.xbps.sig
├── liblzma-5.2.4_2.x86_64-musl.xbps
├── liblzma-5.2.4_2.x86_64-musl.xbps.sig
├── libressl-3.0.2_2.x86_64-musl.xbps
├── libressl-3.0.2_2.x86_64-musl.xbps.sig
├── libssl47-3.0.2_2.x86_64-musl.xbps
├── libssl47-3.0.2_2.x86_64-musl.xbps.sig
├── libtls19-3.0.2_2.x86_64-musl.xbps
├── libtls19-3.0.2_2.x86_64-musl.xbps.sig
├── libxbps-0.57.1_8.x86_64-musl.xbps
├── libxbps-0.57.1_8.x86_64-musl.xbps.sig
├── libzstd-1.4.4_1.x86_64-musl.xbps
├── libzstd-1.4.4_1.x86_64-musl.xbps.sig
├── musl-1.1.24_1.x86_64-musl.xbps
├── musl-1.1.24_1.x86_64-musl.xbps.sig
├── run-parts-4.9.1_1.x86_64-musl.xbps
├── run-parts-4.9.1_1.x86_64-musl.xbps.sig
├── xbps-0.57.1_8.x86_64-musl.xbps
├── xbps-0.57.1_8.x86_64-musl.xbps.sig
├── xbps-triggers-0.113_3.noarch.xbps
├── xbps-triggers-0.113_3.noarch.xbps.sig
├── zlib-1.2.11_3.x86_64-musl.xbps
└── zlib-1.2.11_3.x86_64-musl.xbps.sig

0 directories, 36 files
$
```

Inpired by #213
Closes #213
2020-01-25 13:05:46 +01:00
Juan RP
10075c28e5
libxbps: ignore indirect broken revdeps while updating xbps.
This fixes the long standing issue that has been a plague for
a long time.

See the test case for more information.
2020-01-04 13:01:28 +01:00
Juan RP
166caab986 Do not silently update xbps on any install/update transaction.
When there's a new xbps update, xbps-install(1) will now return
EBUSY (16) and a message (if dry-run disabled) explaining
how to proceed.

If there's an update and transaction does not contain xbps, it will
error out unless the 'xbps' pkg is the only target pkg, i.e:

	# xbps-install -Su
	# echo $?
	16

To update xbps, the only way to proceed is to explicitly declare
it as an update, i.e:

	# xbps-install -u xbps

The dry-run mode will still show there's an xbps update.

Modified the existing test cases to satisfy the new behaviour.

Closes #166
Closes #142
2019-12-27 21:35:40 +01:00
Duncan Overbruck
cb28e7959a Revert "lib/transaction_ops.c: remove updating all reverse dependencies"
This reverts commit 5e4d33a58f.
2019-08-05 11:48:11 +02:00
Duncaen
5e4d33a58f lib/transaction_ops.c: remove updating all reverse dependencies 2019-07-03 00:48:57 +02:00
Juan RP
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Juan RP
0f69773273
lib/transaction_ops.c: more debug. 2019-06-21 13:14:24 +02:00
Juan RP
6fe5bbc596 lib/transaction_ops.c: fix a dead assignment.
Found by clang-analyzer.

Bug Summary
File: lib/transaction_ops.c
Warning: line 274, column 4
Value stored to 'rv' is never read
2019-06-18 18:49:29 +02:00
Juan RP
b672e1a7f2
Improved "xbps auto-updating itself" behaviour.
Always check if there's a new xbps package version available
while *installing* or *updating* in any form.

This fixes the following scenario:

- xbps-0.53_10 is currently installed
- xbps-0.54_1 is available in repo
- xbps-install --update netbsd-wtf || xbps-install new-pkg || xbps-install --update

As expected any of the following scenarios in last cmd will use *this*
transaction to autoupdate xbps and its reverse dependencies.

Another transaction will be necessary to install or update the other unrelated
packages.

Added a new test case to verify this case and improve the other test
cases with more extensive checks.
2019-06-17 12:02:02 +02:00
Juan RP
c3b2d7ca53 libxbps: fix xbps autoupdate when its revdeps are up-to-date.
The current code was failing because while checking for updates
on its reverse dependencies, up-to-date versions were treated
as an error.

Added a new test case to verify that it works as expected.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-13 14:18:31 +02:00
Juan RP
108a165534 libxbps: try to update revdeps when installing or updating pkgs.
This fixes the cases where a pkg installation or update
could break its revdeps due to not satisfying dependencies.

When performing an install or update, xbps now always checks if
there are updates for its revdeps and get added to the transaction.

See the two new test cases for more information.
2019-05-14 23:34:53 +02:00
Juan RP
291faddf8c xbps now also updates revdeps of itself if there's an update.
Close https://github.com/void-linux/xbps/issues/77

Closes: #78 [via git-merge-pr]
2019-04-19 22:57:42 +02: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
8081751f86 libxbps: print in verbose mode what pkgs are added to the transaction.
Useful to know why a transaction cannot be completed when there are
unresolved reverse dependencies.

Requested by @chris2.
2015-09-02 18:56:20 +02:00
Juan RP
2216c84eca libxbps: continue updating all pkgs if xbps is uptodate. 2015-03-29 11:06:18 +02:00
Juan RP
83ade39960 xbps now autoupdates itself exclusively if there's an update.
That was added for 0.21, but for some reason that I cannot remember it was
disabled a bit later... looks like it's useful to have.
2015-03-29 09:56:28 +02:00
Juan RP
441f147f05 Fix reinstallation of pkgs in repolock mode.
At the time we've been searching for the pkg in a repo, no repos
were registered resulting in EINVAL. While here, if there's no
declared repos return ENOENT instead.
2015-03-05 21:23:58 +01:00
Juan RP
4922c808f4 Implemented feature #77 (Add package repository locked mode)
Close #77
2015-03-03 12:11:28 +01:00
Juan RP
0fc297a471 lib/transaction_ops.c: minor optimization. 2015-02-16 11:18:58 +01:00
Juan RP
d607655371 libxbps: globally check for unresolved reverse dependencies.
Close #46. See NEWS for more information.
2015-02-03 10:20:13 +01:00
Juan RP
076b3f8c44 libxbps: add pkgs on hold mode to the transaction, but ignore them.
Those are there mostly to be shown by the clients and notify that
there's an update in repos that is being ignored.

Idea by @chneukirchen.
2015-01-28 12:07:47 +01:00
Juan RP
5b522109f7 Replaced config/system {repo,preserve,virtualpkg}.d with a single directory.
See the NEWS file for more information.
2014-11-06 09:58:04 +01:00
Juan RP
627a5afaaf Make sure that automatic/manual installation modes are set as expected. 2014-10-20 07:59:06 +02:00
Juan RP
231582e671 libxbps: make sure to not add dups in transaction for remove. 2014-10-19 11:22:17 +02:00
Juan RP
fb868454b2 libxbps: make sure to not add dups in transaction for install/update. 2014-10-19 11:00:40 +02:00
Juan RP
ff189fd210 Replaced redundant dependency sorting code with a simpler implementation.
This fixes the issue found by "xbps-src bootstrap" when a package
without "provides" was declared as a virtual package.
2014-10-18 12:35:47 +02:00
Enno Boland
42f0152dce trans_find_pkg(): search for reverts match with correct pkgver 2014-09-28 22:22:20 +02:00
Enno Boland
50fb6c1605 rename xbps_pkgver_is_reverted to xbps_pkg_reverts 2014-09-23 13:54:06 +02:00
Enno Boland
cd9a9e78a8 lib/transaction_ops.c: trans_find_pkg will check the revert field too.
- if a package on the repo has a lower version than installed
  libxbps will check if this package reverts the one installed
  and downgrades to it if so.
2014-09-23 13:54:06 +02:00
Juan RP
c9514ad617 libxbps: fixed replaces/replace_vpkg test case. 2014-09-14 12:50:17 +02:00
Juan RP
30ea08e605 lib/transaction_ops.c: detect updates when an exact pkg version is set. 2014-09-11 11:13:20 +02:00
Juan RP
01dbb968dd Welcome pkgdb-0.38. 2014-09-11 00:12:12 +02:00
Juan RP
472f622f6f Finally fixed vpkg02 test (vpkg provider in transaction).
Rather than collecting dependencies for a pkg that has been added to the
transaction dictionary, do this for all pkgs in transaction once all
packages are already there.
2014-09-04 10:13:02 +02:00
Juan RP
7cef93ce07 Added support to replace vpkgs when the real pkgname matches any installed vpkg. 2014-08-22 12:44:18 +02:00
Juan RP
e35d2e9415 Revert "lib/transaction_ops.c: also check conflicts for pkgs without rdeps."
This reverts commit e308097af5.

package conflicts are checked in xbps_transaction_prepare() already.
2014-07-12 16:25:12 +02:00
Juan RP
e308097af5 lib/transaction_ops.c: also check conflicts for pkgs without rdeps. 2014-07-12 09:41:37 +02:00
Juan RP
61a1d33995 xbps-install(8): implemented single pkg updates without -u, --update.
The -u, --update is now only necessary to perform full system updates.

Close #35 (https://github.com/voidlinux/xbps/issues/35)
2014-05-27 11:33:45 +02:00
Juan RP
98a3723902 Respect installation mode also on reinstall (and downgrade). 2014-01-15 16:17:41 +01:00
Juan RP
f09eab62cd Fix #18. An ATF test-case will be imported in a while. 2013-11-01 18:05:11 +01:00
Juan RP
776b94e6bc Remove PackagesOnHold from xbps.conf; use xbps-pkgdb -m hold|unhold instead.
To put a package on hold mode:
	$ xbps-pkgdb -m hold foo

To unhold the package:
	$ xbps-pkgdb -m unhold foo

To list packages on hold mode:
	$ xbps-query -H

This also close #12 from github.
2013-08-12 14:46:54 +02: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
db1efb3aa6 Relax memory requirements on 64bit platforms; fix two memleaks. 2013-06-12 10:04:10 +02:00
Juan RP
dbf4bb184e xbps_transaction_remove_pkg: fix uninitialized argument value reported by scan-build. 2013-04-04 09:22:40 +02:00
Juan RP
0845d6cae3 xbps_transaction_remove_pkg: handle correctly target pkg. 2013-03-11 12:13:02 +01:00
Juan RP
50ea03df2a Revert code to update xbps independently; I'll use another way to implement this. 2013-03-08 09:44:57 +01: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