Commit Graph
100 Commits
Author SHA1 Message Date
Juan RP 4990a2dd91 lib/Makefile: bump LIBXBPS_MICRO. 2020-04-14 20:27:54 +02:00
Juan RP 70efe5c63a repo: introduce xbps_repo_release(), misc changes.
- xbps_repo_release(): new function to release all resources
  associated with a repository object.

- xbps_repo_close(): this now just closes the file descriptor
  associated with the archive and associated resources.

- repo_open_local: after getting the repository dictionaries,
  use xbps_repo_close() to release archive resources.

Bump XBPS_API_VERSION.
2020-04-14 20:27:54 +02:00
Juan RP b9fb5e1cc8 xbps-uchroot: support read-only bind mounts, misc improvements.
- Added -B src:dest (like -b) but this makes bind mounts in
  read-only mode.

- Get rid of setfsuid(), it's unnecessary.

- Make sure chrootdir is not '/', use realpath().

- Always set SECBIT_NOROOT, see capabilities(7).

- Do not mount recursively, right now this only mounts
  /dev (ro), /dev/shm (rw), /sys (ro) and /proc (ro).
  Previously any mount below any specific mount were recursively
  mounted in chrootdir.
2020-04-14 20:01:44 +02:00
Juan RP ae87662547 xbps-fbulk.1: sync with reality. 2020-04-14 19:57:23 +02:00
Juan RP da2c104d16 xbps-fbulk: calloc -> malloc.
No need to use calloc here because its members are initialized
later on.
2020-04-14 19:57:23 +02:00
Juan RP 5d81aec07f xbps-fbulk: create log files with txt extension. 2020-04-14 19:57:23 +02:00
Juan RP 4f8e07aa64 xbps-fbulk: parallel working implementation.
- Removed -a, this won't work due to dependency cycles between
  host/target.
- Do the process in two steps: collect deps and then build.
- Cleaned up the whole code.
2020-04-14 19:57:23 +02:00
Juan RP bfad1afff3 Prepare for 0.59.1. 2020-04-01 11:32:37 +02:00
Juan RP bd707acfee repo: fix a double free with invalid repodata.
Fixes #248

Added new test case to verify.
2020-03-31 18:36:04 +02:00
Juan RP 743e76938f xbps-install: fix regression in stats.
Updated packages will also be configured, so take this into
account in the stats.
2020-03-31 17:26:38 +02:00
Juan RP 0113b676ba tests: rename transaction_check_revdeps to make .gitignore effective. 2020-03-31 12:32:31 +02:00
Juan RP 0524b12f74 Revert "travis: needs coreutils for stat(1) (used in tests)."
This reverts commit 58baccc6fb.

Does not fix the real issue unfortunately
2020-03-31 11:53:10 +02:00
Juan RP 58baccc6fb travis: needs coreutils for stat(1) (used in tests). 2020-03-31 11:48:49 +02:00
Juan RP 40e14203f7 NEWS: release time! 2020-03-03 08:56:17 +01:00
Juan RP 7f0a5b5c38 xbps-fetch.1: bump date 2020-03-03 08:27:11 +01:00
Juan RP 57bf913d6c xbps-install.1: document TIMEOUT_CONNECTION. 2020-03-03 08:26:29 +01:00
Juan RP 593f0b5f28 NEWS: update for latest change 2020-03-03 08:19:04 +01:00
Juan RP df9b637ee5 NEWS: mention soname bump. 2020-03-02 14:34:21 +01:00
Juan RP 9dcc7b1066 NEWS: better grammar 2020-03-02 13:32:13 +01:00
Juan RP a7f8dee509 NEWS: update for 0.59. 2020-03-02 13:26:20 +01:00
Juan RP 24bbfffba1 xbps_transaction_prepare: fix stats for removals. 2020-02-25 08:43:52 +01:00
Juan RP 77c72f9c2c lib/plist_find.c: fix false positive detecting vpkgs.
If target pkg was matched via xbps_pkg_version(), it was
incorrectly accessing the first vpkg stored.
2020-02-24 10:22:52 +01:00
Juan RP cc601e1e91 xbps_repo_get_{virtual,}pkg: add debug on match. 2020-02-24 10:22:15 +01:00
Juan RP 657a717855 xbps_get_pkg_fulldeptree: switch to uthash.
There are still two users that can benefit from
uthash: transaction_files.c and xbps-fbulk.

cc @duncaen
2020-02-23 22:18:34 +01:00
Juan RP 6236d7ae41 xbps-query/search.c: use unsigned int and remove wrong cast. 2020-02-22 14:25:22 +01:00
Juan RP 68747a12e4 xbps-query: make -S (show mode) print all properties.
run_depends was being skipped, but there's not any reason
to skip this even if there's -x.

Just print any property available in its pkgdb dictionary.
2020-02-22 11:39:29 +01:00
Juan RP bc9fab5ee8 bin: use unsigned int rather than size_t.
unsigned int is a 32-bit value both on 32/64-bit targets.
2020-02-22 11:29:18 +01:00
Juan RP c031ee6945 bin: use size_t where applicable.
To make sure we don't get a negative value due to overflowing.
2020-02-22 11:18:57 +01:00
Juan RP 5a6709b560 xbps-install/transaction: fix for all_pkgs_on_hold.
If all pkgs are on hold in transaction skip stats
and return early.
2020-02-22 10:51:27 +01:00
Juan RP 33f26c4332 Makefile: get rid of useless info. 2020-02-22 09:54:11 +01:00
Juan RP 5270bc1209 README.md: mention zstd by default. 2020-02-22 09:27:46 +01:00
Juan RP 0788cd1f42 xbps-{create,rindex}: use zstd by default.
Closes #35
2020-02-22 09:27:46 +01:00
Juan RP 0005b3ecc0 tests: new test case for #234.
This checks that automatic-install obj in packages is properly
respected while performing recursive removal.
2020-02-22 08:42:58 +01:00
Juan RP c8d676f10e xbps_find_pkg_orphans: fix for #234
Make sure "automatic" bool is initialized to false before
checking its value. This way if xbps_dictionary_get_bool()
fails, "automatic" will be set to false.

Closes #234
2020-02-22 00:00:22 +01:00
Juan RP a16e695de7 configure: enable -Woverlength-strings, do not disable it! 2020-02-21 10:55:17 +01:00
Juan RP f9ccd9b627 xbps_transaction_prepare: set transd stats correctly.
- if pkg trans type is UPDATE or REMOVE, don't set
  download stats, we don't need them.
- Simplify code.
2020-02-21 10:51:20 +01:00
Juan RP 06c9891ae3 xbps_transaction_*: multiple performance improvements (v2).
This commit implements multiple performance improvements
to the transaction code:

- Don't process xbps_pkg_name() N times each time we access
  its package dictionary (via pkgdb or rpool), just do it once
  at xbps_pkgdb_init() time. At pkgdb init time, it just creates
  a property in pkgdb, "pkgname". At rpool time, each time a
  package is accessed, the "pkgname" string property is added.

- The package transaction dictionary contains the "transaction"
  object to know what's the pkg type. This has been changed to an
  uint8, this simplifies the logic and it's faster than checking
  a string object. See xbps_trans_type_t and xbps_transaction_pkg_type().

- Fixed the issue that was marked with XXX in transaction shlibs
  checking code. This has been fixed and improved and resources are
  now just freed as expected.

- Simplified random code all over the place, avoiding unnecessary
  allocations or operations.

- Rename some transaction files to have a better description.

This is my first rototill to the code in 2020.
2020-02-21 09:37:32 +01:00
Juan RP 4d6d328c62 xbps_transaction_prepare: fix for XBPS_FLAG_DOWNLOAD_ONLY.
We don't really care if all pkgs are on hold, so modify
logic to avoid this part and exit early.
2020-02-18 09:07:03 +01:00
Juan RP 1b9dc3cc4d xbps_transaction_prepare: set "total-download-size" correctly.
- It was set only with XBPS_FLAG_DOWNLOAD_ONLY.
- Simplify the logic.

In response to #187 and #230
2020-02-18 08:34:41 +01:00
Juan RP fba65ad9da xbps_transaction_store: ensure no multiple versions.
This change ensures that no multiple versions of the same pkg
are added to the transaction; if a new version of the same
package is being added as a dependency, compare stored
and current and use the greatest one.

This fixes the recent issue seen in the aarch64 builders, where
two versions of the same package were added to the transaction.

Added a new test case.
2020-02-14 08:41:35 +01:00
Juan RP 28154f488c xbps-uchroot: fix indentation 2020-02-13 09:06:29 +01:00
Juan RP 6ccee8fd5e xbps-uchroot: overlayfs fixes v2.
- Do not use nftw(3), this won't clean up the tree properly.
  Rather use scandir(3) with alphasort, like xbps-create(1).

- Don't drop privs in the parent to make sure that the
  temp overlayfs tree can be removed properly.

This fixes the issues while building go modules and others
with xbps-src.
2020-02-13 09:06:29 +01:00
Juan RP 3eed9bca59 xbps_array_foreach_cb_multi: use PTHREAD_MUTEX_INITIALIZER.
We use defaults, no need to use pthread_mutex_init().
2020-02-10 09:14:50 +01:00
Juan RP c460df6011 xbps_array_foreach_cb_multi: switch to a mutex.
There's no reason to use a spin lock.
2020-02-10 09:08:33 +01:00
Juan RP 8c930a47dd travis: disable tcc from build matrix.
tcc seems to cause more problems than benefits, so
get rid of it.
2020-02-10 09:07:33 +01:00
Juan RP 835834ff73 xbps_repo_open: fix memleak in error paths. 2020-02-10 09:07:00 +01:00
Juan RP 71a594f681 Revert "xbps-uchroot: make sure to cleanup tempdir with overlayfs."
This reverts commit f6a6385b42.

Does not work as expected, and does not fix the real issue
which is still not understood.
2020-02-08 20:43:23 +01:00
Juan RP c4019aa923 xbps_transaction_files: fixed another memleak.
Thanks valgrind
2020-02-08 20:22:42 +01:00
Juan RP 2d7e3d7b1a xbps_transaction_remove_pkg: fix a memleak.
Thanks valgrind
2020-02-08 20:12:11 +01:00
Juan RP 58217d412d xbps_transaction_files: fix a memleak.
Thanks valgrind!
2020-02-08 20:08:03 +01:00
Juan RP 460515bf41 lib/util.c: add assertions everywhere. 2020-02-08 20:00:56 +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 1cda3017c3 README.md: sort badges 2020-02-08 13:43:47 +01:00
Juan RP b23bff86d8 README.md: add repology xbps versions. 2020-02-08 13:42:39 +01:00
Juan RP bbf113c492 README.md: add LGTM project badges 2020-02-08 13:39:43 +01:00
Juan RP 66bea965dc xbps_register_pkg: switch to localtime_r(3).
lgtm suggested that localtime() is not reentrant,
so that we now use localtime_r() instead.

lgtm reports 0 alerts after this change, yay.
2020-02-08 13:34:57 +01:00
Juan RP 7d934c9290 xbps-create: fix two issues detected by lgtm 2020-02-07 17:16:47 +01:00
Juan RP 6ff9422134 configure: bump to 0.59 2020-02-07 10:11:11 +01:00
Juan RP 397f2b86e1 tests: new alternatives test case by @CameronNemo.
The test case has been provided by @CameronNemo via #185.
This is expected to fail currently.
2020-02-07 09:55:36 +01:00
Juan RP 732a0e6bdf alternatives: fixed replace_alternative_with_symlink test case.
Only 1 expected failure now!
2020-02-07 09:43:47 +01:00
Juan RP 94b56d7539 alternatives: do not remove symlinks if provider != target pkg.
This fixes the keep_provider_on_update test case, submitted
by @st3r4g via #219.

While checking for obsoletes make sure current provider
also matches the current target pkg.

Fixes #219
2020-02-07 09:16:57 +01:00
Juan RP 86ce5a2084 tests: new test case for alternatives by @st3r4g.
This currently reproduces the tar/bsdtar alternatives
issue that appeared recently in void.

This is expected to fail currently.

From #219
2020-02-07 07:51:01 +01:00
Juan RP 8d2aaff3e1 mk/prog.mk: fix warning with clang; use PROG_CFLAGS. 2020-02-06 09:48:43 +01:00
Juan RP 4c22511d17 configure: simplify 2020-02-06 09:48:30 +01:00
Juan RP 3a0ca77264 xbps-uchroot: stop remounting / unnecessarily.
The remount is done to use nosuid, but we can get
rid of the remount just because of this specific
option that does not have too much value for our
general usage (xbps-src).
2020-02-06 08:50:12 +01:00
Juan RP f6a6385b42 xbps-uchroot: make sure to cleanup tempdir with overlayfs.
Go modules seem to have too restrictive permissions on
its builddir, making xbps-uchroot(1) unable to remove
its directory tree due to insufficient permissions.

Run nftw() twice, the first run to set chmod 755, and
second run to remove the file.

Fixes `xbps-src -t` with any pkg that uses `build_style=go`.

This should avoid lots of temp dirs in the buildbot
builders while building go modules and others.
2020-02-04 13:17:26 +01:00
Juan RP 749bdabc83 tests/alternatives: set atf_expect_fail for unfixed issue. 2020-02-03 09:58:57 +01:00
Juan RP 5b43614e80 libxbps: fixed regression introduced in 0.58.
While looking for dependencies, we need to check
if xbps_rpool_get_pkg() returned a suitable match;
and then validate its result.

This fixes the update_and_install test case that
was reverted via #218.
2020-02-03 09:19:54 +01:00
Juan RP 2612cb9bbe Makefile: add target deps 2020-02-03 08:14:10 +01:00
Juan RP d86e8dde47 NEWS: correct date for 0.58. 2020-01-30 17:51:57 +01:00
Juan RP 9b476bf081 NEWS: 0.58: mention Mohamad Barbar. 2020-01-30 09:52:23 +01:00
Juan RP 96be14937b NEWS: 17 new test cases since 0.57.1; list contributors. 2020-01-30 09:51:02 +01:00
Juan RP 1fce2f7c1d NEWS: prepare for 0.58 (v2). 2020-01-30 09:37:36 +01:00
Juan RP ecc8e41dd6 NEWS: document 0.57.1; prepare for 0.58. 2020-01-30 09:12:34 +01:00
Juan RP 40dd4deb4d unpack: really skip current data on archive with noextract. 2020-01-26 10:35:40 +01:00
Juan RP 8a0c3032b7 xbps_find_pkg_orphans: improvements.
While checking for orphans in automatic mode (xbps-query -O,
xbps-remove -o) there's no need to generate a fulldeptree...
instead we need to iterate against pkgdb until no more orphans
are found.

See https://github.com/void-linux/xbps/issues/156#issuecomment-578473222

Also add some debugging that helped me to catch the issue
easily.

Closes #156
2020-01-26 07:40:25 +01:00
Juan RP ead62bdc7c xbps_remove_pkg: make sure pkgver is valid before use.
pkgver might contain garbage due to removal of
its ancestor object (the pkg dictionary).
2020-01-25 13:58:00 +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 ed5e481e77 xbps_transaction_package_replace: fix condition 2020-01-25 11:21:37 +01:00
Juan RP a29f4709d0 xbps_transaction_package_replace: ignore pkgs on hold. 2020-01-25 11:19:54 +01:00
Juan RP 31a8dd15d0 xbps_transaction_revdeps: simplify 2020-01-25 11:09:03 +01:00
Juan RP c6e0af44e8 xbps_transaction_shlibs: better interaction with on hold pkgs.
pkgs that are on hold mode should be ignored while collecting
required shlibs (shlib-requires).

Fixes #215
2020-01-25 10:23:06 +01:00
Juan RP 26b7864973 tests/hold: update hold_shlibs test case with exp behaviour. 2020-01-25 10:23:06 +01:00
Juan RP 76f8ca595b tests: rename downgrade_hold_test.sh to hold_test.sh.
Added new test case for https://github.com/void-linux/xbps/issues/215

This fails as expected right now because the fix is still
not there.
2020-01-25 10:23:06 +01:00
Juan RP ef9260a16e libxbps: fix for vpkg providers in multiple repos.
Added new test case by @st3r4g via #206

Closes #206
2020-01-18 12:50:59 +01:00
Juan RP 5ff3ab5c60 transaction_revdeps: do not skip pkgs that are being updated.
Modified the test case with changes by @duncaen.

Closes #205
2020-01-18 08:58:54 +01:00
Juan RP 7ff9041f2a tests: improved tests case for #205.
Again, can't reproduce the issue.
2020-01-12 05:03:54 +01:00
Juan RP cb5b80711c tests/install_test.sh: new test case by @duncaen via #205.
New test case written by @duncaen, with some tweaks from
myself to verify expected behaviour.

Close #205
2020-01-11 15:25:16 +01:00
Juan RP feece576b3 xbps_dbg_printf{,_append}: return if xhp is NULL.
assert() here was totally wrong, better to catch
this in all cases (NDEBUG does not change the behaviour).
2020-01-11 09:48:38 +01:00
Juan RP 615b6ce7e9 xbps_repo_fetch_remote: use XBPS_REPOIDX_META. 2020-01-06 15:09:16 +01:00
Juan RP 0abfe44954 xbps.h: XBPS_REPOIDX_SIG is gone 2020-01-06 15:02:25 +01:00
Juan RP 850ba2d416 Revert the repodata signature stuff. 2020-01-06 14:56:01 +01:00
Juan RP 4ddb335c8e Revert "Tests for signing metadata"
This reverts commit d785e7e483.
2020-01-06 14:52:39 +01:00
Juan RP 79321f3ff0 Revert "Verify index-meta for in-memory sync"
This reverts commit a1481cb285.
2020-01-06 14:52:06 +01:00
Juan RP e04cb2fa24 Revert "Read also unsigned index-meta"
This reverts commit 61ef5c3f8a.
2020-01-06 14:50:32 +01:00
Juan RP 8b2c62adfc Revert "Verify index-meta"
This reverts commit 09125769bd.
2020-01-06 14:48:39 +01:00
Juan RP 10b2f7b425 Revert "Preserve meta-index data on change of signing key"
This reverts commit ae26a83ad2.
2020-01-06 14:46:12 +01:00
Juan RP 2884fc3ab7 Revert "Don't assume repodata is signed when has index-meta.plist"
This reverts commit 4e3d4d2287.
2020-01-06 14:45:57 +01:00
Juan RP 68113a8fc0 Revert "Sign index-meta"
This reverts commit 381b7b7600.
2020-01-06 14:44:22 +01:00