Commit Graph

39 Commits

Author SHA1 Message Date
classabbyamp
79f29ed53e bin/xbps-pkgdb: use -errno values for error states
...when checking a package. This will give more relevant information
than before, removes a message that is misleading in many cases, and
allows for some minor simplification.

before:
```
$ doas xbps-pkgdb runit-void; echo $?
ERROR: runit-void: hash mismatch for /etc/runit/2.
ERROR: runit-void: files check FAILED.
Failed to check `runit-void': Operation not permitted
1
```

after:
```
$ doas xbps-pkgdb runit-void; echo $?
ERROR: runit-void: hash mismatch for /etc/runit/2.
ERROR: runit-void: files check FAILED.
1
```

this does not change the behaviour of `xbps-pkgdb -a`
2023-05-30 21:20:05 +02:00
classabbyamp
1271a3dbed bin/: use xbps logging functions more 2023-02-11 14:23:51 +01:00
Duncan Overbruck
9efba6749f
lib: remove xhp argument from xbps_plist_{array,dictionary}_from_file 2022-12-24 14:29:24 +01:00
Duncan Overbruck
44cd938115
Revert "Use shared LICENSE file for all xbps code."
This reverts commit be7d8cfaf1.

This commit missed some previous copyrights mentioned,
in general I think its better to have this per-file to
follow who wrote what and when.
2020-04-29 14:12:10 +02:00
Juan RP
be7d8cfaf1
Use shared LICENSE file for all xbps code. 2020-04-24 11:44:19 +02:00
Duncan Overbruck
0d90534236
libxbps: ABI/API break due to hash function changes 2020-02-10 13:32:17 +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
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Duncaen
bd616aa901 xbps-pkgdb: add alternatives check
Closes #66
2019-04-20 11:07:00 +02:00
Foxlet
0f33859701 Fix namespace violation 2018-09-25 22:11:30 -04: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
c4ed1b5845 xbps-pkgdb: if pkg metafile cannot be internalized print a proper errmsg. 2015-05-28 09:44:01 +02:00
Juan RP
42831b97d4 xbps-pkgdb: add two assertions. 2015-05-28 09:41:00 +02:00
Juan RP
c712c99ced xbps-pkgdb: exit with error if any test fails. 2015-02-26 12:01:20 +01:00
Juan RP
adc0643ee4 Fully switch to zplists. 2014-10-17 10:27:58 +02:00
Juan RP
960c3fdcdf bin/xbps-pkgdb/check.c: CID 62721 (argument cannot be negative) 2014-10-07 07:25:25 +02:00
Juan RP
ba0cdabe1e bin/xbps-pkgdb/check.c: fix assertion due to double free. 2014-09-27 12:22:13 +02:00
Juan RP
e32f7f4909 xbps-pkgdb: unfix previous, pkg metafile must be internalized. 2014-09-11 08:04:51 +02:00
Juan RP
bd2bb98fa7 xbps-pkgdb: update for pkgdb-0.38. 2014-09-11 08:00:37 +02:00
Juan RP
01dbb968dd Welcome pkgdb-0.38. 2014-09-11 00:12:12 +02: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
023484ca0b Introduce xbps_{array,pkgdb}_foreach_cb_multi() and use it where appropiate.
In some tasks the single threaded implementation outperms the multithreaded
one. Use it where it really makes a difference. The _multi() routines do not
spawn any thread if _SC_NPROCESSORS_ONLN == 1.

Bump XBPS_API_VERSION.
2013-09-17 16:30:13 +02:00
Juan RP
a039330f3c Misc cleanups: use __attribute__((__unused__)); remove dead code. 2013-08-29 10:45:30 +02:00
Juan RP
0c7701f2bc Introduce xbps_array_foreach_cb() and use it in random code.
This routine will spawn a thread per core to process N items stored
in the specified array, the last thread gets the remainder of items left.

Results have shown that xbps benefits if there is a considerable amount
of items and number of threads being spawned.

Use it in xbps_pkgdb_foreach_cb(), xbps-pkgdb(8), xbps-query(8)
and xbps-rindex(8).

On UP systems there's no overhead because pthread(3) is not used at all.

WIP! investigate if it can be used in libxbps (xbps_rpool_foreach()),
and finish conversion of xbps-rindex(8) -c.
2013-07-27 09:47:16 +02:00
Juan RP
09e116b7f0 xbps_api.h -> xbps.h 2013-06-20 12:31:02 +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
15b2258b77 xbps-pkgdb: fix issue #9 (remove old code that broke pkgdb mem vs disk comparisions). 2013-05-16 17:16:39 +02: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
e2176ec4b6 bin: no point in cleaning up resources when it's exiting... 2012-12-14 11:58:30 +01:00
Juan RP
338c0d549f xbps-pkgdb: fixed some memleaks. 2012-12-14 06:04:58 +01:00
Juan RP
33a8150a98 xbps-pkgdb: checking all pkgs with -a/--all is now multithreaded. 2012-12-14 03:31:24 +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
78cd625c28 xbps-pkgdb: fixed symlinks check; this now detects modified symlinks correctly. 2012-11-19 21:12:04 +01:00
Juan RP
c899572bd4 xbps-pkgdb: don't forget to update pkgdb; some printf fixes. 2012-11-17 18:25:18 +01:00
Juan RP
e763f154a0 xbps-pkgdb: simplify the check code; make the reqby check work again. 2012-11-17 17:43:54 +01:00
Juan RP
b0fab7a3ee Implemented a cache to get pkg dicts from metadir.
This improves xbps-pkgdb -a marginally, but still seems to be a bit slow.
2012-11-16 21:50:52 +01:00
Juan RP
34bd49f85a New pkg metadata structure for 0.18. See the NEWS file for info. 2012-11-16 16:55:35 +01:00
Juan RP
b05ce9fe57 New utilities: xbps-{install,pkgdb,query,reconfigure,rindex} (WIP). 2012-11-02 15:04:25 +01:00