Commit Graph

1359 Commits

Author SHA1 Message Date
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
0788cd1f42 xbps-{create,rindex}: use zstd by default.
Closes #35
2020-02-22 09:27:46 +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
sineemore
701132071d xbps-install: show overall download progress 2020-02-19 00:28:40 +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
Duncan Overbruck
0d90534236
libxbps: ABI/API break due to hash function changes 2020-02-10 13:32:17 +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
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
7d934c9290
xbps-create: fix two issues detected by lgtm 2020-02-07 17:16:47 +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
Piotr Wójcik
4a06cb41b1 bin/xbps-checkvers: mistake in manpage 2020-01-30 08:01:12 +01:00
Piotr Wójcik
2d3ed8db19 bin/xbps-checkvers: align help text with spaces 2020-01-25 13:21:18 +01:00
Piotr Wójcik
cd0f81d68c bin/xbps-checkvers: list removed templates 2020-01-25 13:21:18 +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
Duncan Overbruck
c98d732d9c
bin/xbps-fetch: add a mode that prints sha256sums of downloaded files 2020-01-18 16:44:31 +01:00
Duncan Overbruck
6794077efd
Add noextract configuration option
Closes #208
Fixes #165
2020-01-18 15:51:13 +01:00
Juan RP
850ba2d416
Revert the repodata signature stuff. 2020-01-06 14:56:01 +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
Juan RP
b4fdc39e67
Revert "Sign repodata"
This reverts commit 04194f44c8.
2020-01-06 14:31:40 +01:00
Juan RP
d68ff7ebf0
xbps-install: fix --reproducable.
The 'repository' obj also needs to be skipped to be fully
reproducable between different repositories.

Updated the test case accordingly.
2019-12-29 16:31:23 +01:00
Juan RP
b05f4b4db5 xbps-install: added --reproducible long option.
If set, enables reproducible mode in pkgdb.

Added a new test case.
2019-12-29 11:02:51 +01:00
Juan RP
d1c93bed52
xbps-rindex: stop adding the "build-date" pkg obj.
This was just setting the current date when the pkg
is being added to the repository index.

It does not make any sense, so get rid of it completely.

This "build-date" string obj needs to be added via
xbps-create(1) not xbps-rindex(1)!

Another step towards reproducability (#55)
2019-12-29 09:57:54 +01:00
Juan RP
6210955010 xbps-create: fix memleak introduced in 0f3ed2067c 2019-12-27 23:15:21 +01:00
Juan RP
67707657a4 xbps-create: always sanitize gathered symlinks.
Added a new test case.

Close #199
2019-12-27 23:15:21 +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
Juan RP
34a1ab51d0
xbps-checkvers: version cache file.
We do not want obsolete files from previous versions, so that
we version the filename of that working version.
2019-12-27 18:23:46 +01:00
Juan RP
64aeabf3f6
xbps-checkvers: restore previous behaviour after 7a220b37db.
The '%n' pkgname fmt option still needs to be the sourcepkg
for xbps-src to work with no additional changes.

This restores previous behaviour, and uses binpkg's pkgname
while checking for pkgdb/repo.
2019-12-27 18:04:53 +01:00
Juan RP
7a220b37db xbps-checkvers: use binpkg's pkgname rather than srcpkgs.
Up until now `xbps-checkvers` would only check for the
real sourcepkg, this broke detection of binary packages
that are subpkgs.

Added a new test case.

Close #192
2019-12-27 12:24:16 +01:00
Juan RP
0e1482917a
Fix maybe-uninitialized warnings detected by LTO. 2019-12-27 10:53:10 +01:00
Mohamad Barbar
66b856fa77 xbps-install: don't prompt when all pkgs on hold. 2019-12-14 13:23:31 +01:00
Doan Tran Cong Danh
36a7ddd4ae xbps-uchroot: document end of options argument
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-24 12:28:45 +01:00
Doan Tran Cong Danh
be06a3b578 xbps-uunshare: document end of options argument
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-24 12:28:45 +01:00
Piotr Wójcik
ae26a83ad2 Preserve meta-index data on change of signing key 2019-11-02 11:53:14 +01:00
Piotr Wójcik
4e3d4d2287 Don't assume repodata is signed when has index-meta.plist 2019-11-02 11:53:14 +01:00
Piotr Wójcik
381b7b7600 Sign index-meta 2019-11-02 11:53:14 +01:00
Piotr Wójcik
b4e93a95bf Turn off repodata signing 2019-11-02 11:53:14 +01:00
Piotr Wójcik
04194f44c8 Sign repodata 2019-11-02 11:53:14 +01:00
Juan RP
9ebe82fdc3
xbps-checkvers: fix a warning with glibc.
found by @q66

main.c:195:8: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result]
2019-10-27 09:13:46 +01:00
Duncan Overbruck
7b4a925302 bin/xbps-rindex: better error handling for writing repodata archives
This fixes issues when writes fail (as example if the disk is full),
where xbps would create empty repodata or stagedata archives.
2019-10-25 23:36:44 +02:00
Duncan Overbruck
04d5554ed2 bin/xbps-create: better error handling for writing archives
This fixes issues where if xbps-create creates a new archive on a full
disk, it will write an incomplete archive and then later fails to be
read by xbps-rindex.
2019-10-25 23:36:44 +02:00
Duncan Overbruck
1d460bc793 bin/xbps-checkvers: make distdir absolute
Fixes void-linux/xbps#133
2019-08-05 15:36:27 +02:00
Juan RP
d927517327
xbps-fbulk: do not make assert() change program behaviour.
... otherwise if NDEBUG is set chdir() is skipped completely.
2019-07-06 08:37:47 +02:00
Juan RP
702d64c517
xbps-checkvers/Makefile: re-add -Wno-deprecated-declarations.
... it's still necessary due to readdir_r() with glibc.
2019-07-03 02:15:41 +02:00
Juan RP
9addb5e64e
Get rid of some old disabled warnings. 2019-07-03 01:26:07 +02:00
Juan RP
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Juan RP
bb96486b12
xbps-install: make sure to call xbps_end() before exiting. 2019-06-27 08:02:19 +02:00
Johannes Brechtmann
44692f28d8 bin/xbps-install: update_pkg return EEXIST if package is up to date
makes 58509996aa work for
xbps-install -u <pkg>
2019-06-27 07:54:11 +02:00
Duncaen
7b728f5ac0 bin/xbps-remove: fix skipping executing orphans transaction 2019-06-26 22:24:47 +02:00
Juan RP
83aa486f6b
xbps-remove: skip trans if all pkgs were not found.
Restores behaviour with xbps<0.54.
2019-06-25 10:32:02 +02:00
Juan RP
41b2cec356
xbps-*: use xbps_pkgdb_update() correctly.
xbps-{alternatives,pkgdb,reconfigure}: xbps_pkgdb_update()
has been fixed to flush when told so, and we don't need
to update the in-memory copy because we are exiting.
2019-06-22 18:50:40 +02:00
Juan RP
58509996aa
xbps-install: skip trans if all pkgs are installed or uptodate.
Fixes an issue pointed out by @Johnnynator
2019-06-21 19:19:09 +02:00
Juan RP
13172c22fc
xbps-install: only print num of downloaded pkgs with -D. 2019-06-21 16:26:08 +02:00
Juan RP
589a96a50e
xbps-install: with -D there are no pkgs to install/update/configure/remove. 2019-06-21 16:06:42 +02:00
Juan RP
fe943eb7d2
xbps-install(1): added -D, --download-only.
Added `-D, --download-only` flag to allow downloading
packages to the cache without attempting to install them.

Contributed by Toyam Cox via #9

Adapted to master by yours truly.

Close #9
2019-06-21 15:57:25 +02:00
Juan RP
4f717dc597 xbps-install(1): added -I, --ignore-file-conflicts.
If set it will continue with the transaction and will
just print what are the conflicting files without returning
EEXIST.

This is a temporary solution for void where there are still
some packages with conflicting files (qt5-host-tools vs qt5-tools-devel).

With input by @duncaen
2019-06-21 15:31:04 +02:00
Juan RP
288cff37f8
xbps-install: return 0 if pkg is already installed or uptodate.
Before this change xbps-install could return EEXIST
when the package is already installed, or already up-to-date.

Return 0 if such condition happens, and only return EEXIST
if there's a file conflict.

Close #51
2019-06-21 11:06:45 +02:00
Duncaen
9c300a93d1 bin/xbps-checkvers: fix --format long form 2019-06-21 00:32:30 +02:00
Juan RP
2c6e0c28d4
xbps-checkvers.1: tweaks 2019-06-20 15:25:14 +02:00
Juan RP
071db09d3e
xbps-alternatives.1: proper credit. 2019-06-20 12:56:17 +02:00
Juan RP
6390817d7e
xbps-rindex.1: proper credit. 2019-06-20 11:44:45 +02:00
Juan RP
2df0778fcd
xbps-pkgdb.1: proper credit. 2019-06-20 11:42:30 +02:00
Juan RP
b0abcd4997
xbps-checkvers.1: proper credit. 2019-06-20 11:42:09 +02:00
Duncaen
ebb61edb16 bin/xbps-fetch: restore old behaviour for output file 2019-06-20 11:32:12 +02:00
Juan RP
e7738555b2
xbps-uhelper: restore compat.
Add 'digest' and 'fetch' actions again for compatibility,
but don't mention them in usage().

This way previous versions of xbps-src (that don't require xbps-0.54)
still work without changes.
2019-06-20 10:53:30 +02:00
Juan RP
e083440b70
xbps-checkvers: always initialize repourl. 2019-06-19 14:00:54 +02:00
Juan RP
2d1d6245b8
xbps-checkvers.1: update default fmt. 2019-06-19 13:30:57 +02:00
Juan RP
27634afd21
xbps-checkvers: change default output fmt to "%n %r %s %t %R". 2019-06-19 13:27:08 +02:00
Juan RP
0727d9a53a
xbps-checkvers: implement --format %R (repository).
Close #128
2019-06-19 13:07:42 +02:00
Juan RP
b12b72e151
xbps-install/state_cb.c: minor tweaks. 2019-06-18 21:17:44 +02:00
Duncaen
a19c659616 bin/xbps-install: add the transaction_file states 2019-06-18 19:54:22 +02:00
Duncaen
91e428d54d bin/xbps-create: record file size in files.plist 2019-06-18 19:54:22 +02:00
Juan RP
eddd2cd602 xbps-checkvers: stop abusing assert().
assert() must not change program behaviour.

It's unlikely that xbps_dictionary_set_cstring() fails, but even
so proplib will report it, so no need to run it via assert().
2019-06-18 18:49:29 +02:00
Juan RP
286193515c xbps-rindex/repoflush.c: pass correct filename to unlink(). 2019-06-18 18:49:29 +02:00
Juan RP
8018f53e0a xbps-rindex/repoflush.c: stop abusing assert().
assert() must not change the program behaviour.

Make sure fchmod() and rename() succeed properly and
fail gracefully otherwise.
2019-06-18 18:49:29 +02:00
Juan RP
042ab422b2 xbps-dgraph/main.c: simplify logic.
Thanks to clang-analyzer for reporting a dead assignment
that lead me to rework the logic.
2019-06-18 18:49:29 +02:00
Juan RP
5f68687cbb bin/xbps-install/main.c: fix dead assignment.
Found by clang-analyzer.

Bug Summary

File: bin/xbps-install/main.c
Warning: line 246, column 5
Value stored to 'rv' is never read
2019-06-18 18:49:29 +02:00
Juan RP
daf65b0767 bin/xbps-install/main.c: fix dead assignment.
Found by clang-analyzer.

Bug Summary

File: bin/xbps-install/main.c
Warning: line 259, column 5
Value stored to 'rv' is never read
2019-06-18 18:49:29 +02:00
Juan RP
0ee0aaa395 xbps-pkgdb/check_pkg_alternatives.c: dead store.
Reported by clang-analyzer.
2019-06-18 18:49:29 +02:00
Juan RP
b6a13945e0 xbps: restore default repodata compression format (gzip/zlib).
Any compression format from that list is supported without
additional changes: gzip, bzip2, lz4, xz, zstd.

This is for repository data and binary packages.

Close #122
2019-06-18 18:37:19 +02:00
Duncaen
3677986c7e bin/xbps-checkvers: store character returned by fgetc in int
The character has to be checked for EOF (-1), otherwise with
architectures that use unsigned char by default this breaks at
compile and runtime.

https://github.com/void-linux/xbps/issues/123
2019-06-18 15:04:47 +02:00
Juan RP
f5f7f6b5a3
xbps-rindex: fix comment, zstd is set by default. 2019-06-17 08:22:43 +02:00
Juan RP
6c1759862e
xbps-rindex: added --compression option and set zstd by default.
Multiple compression formats are now supported for repodata,
none, gzip, bzip2, xz, lz4 and zstd.
2019-06-17 07:24:05 +02:00
Juan RP
ab9a587d34
xbps-create: added support for lz4 and zstd compression formats. 2019-06-17 07:12:18 +02:00
Duncaen
1037a77000 xbps-checkvers: grow buffer if necessary instead of free/malloc for every file 2019-06-15 23:50:50 +02:00
Duncaen
323ca2f95a xbps-checkvers: cleanup and check strdup errors 2019-06-15 23:50:50 +02:00
Duncaen
49cc70de9a xbps-checkvers: rewrite check_reverts without malloc 2019-06-15 23:50:50 +02:00
Duncaen
e495f84954 xbps-checkvers: set rcv->fname when loading from cache 2019-06-15 23:50:50 +02:00
Duncaen
3805fd5297 xbps-checkvers: use proplib data structures and add cache file 2019-06-15 23:50:50 +02:00
Duncaen
26cc209225 xbps-checkvers: remove magic buffer and use fwrite for %t format 2019-06-15 23:50:50 +02:00
Duncaen
dfa6e80d13 xbps-checkvers: add %t format to get requested template name from path (ie subpackage) 2019-06-15 23:50:50 +02:00
Duncaen
db2eb29cbc xbps-checkvers: add --format 2019-06-15 23:50:50 +02:00
Duncaen
5dfaf5c075 xbps-checkvers: allow files argument to be paths or package name 2019-06-15 23:50:50 +02:00