Commit Graph

27 Commits

Author SHA1 Message Date
Foxlet
0f33859701 Fix namespace violation 2018-09-25 22:11:30 -04:00
Enno Boland
3431715d67 xbps-rindex: consider stage area when removing packages. 2016-03-21 10:50:25 +01:00
Juan RP
9a16283575 Introduce xbps_repo_{un,}lock() to serialize write access to repodata.
We use a simple file lock that is created with O_CREAT|O_EXCL.
This should fix the concurrency issues with multiple processes
running xbps-rindex -a/-c on the same repository/arch combo.
2015-03-25 12:00:59 +01:00
Juan RP
b23855f692 xbps_repo_close: only unlock the file lock if repo was opened as such.
If xbps_repo_open() was called with the lock arg set, xbps_repo_close()
will now unlock the repo file lock, without the need to set it.

This avoids the need to always unlock the file lock even if it wasn't
locked previously. This also introduceds an ABI/API break, but this
way it's cleaner.
2015-01-11 09:11:38 +01:00
Juan RP
b5713ecf12 bin/xbps-rindex/remove-obsoletes.c: resource leak (CID 62695) 2014-10-05 07:40:18 +02:00
Juan RP
73e81addba bin/xbps-rindex/remove-obsoletes.c: resource leak (CID 62707) 2014-10-05 07:34:15 +02:00
Juan RP
d7d749312d xbps-rindex: use xbps_binpkg_{arch,pkgver} for -r (remove-obsoletes).
This is magnituds faster than before; some results:

$ for f in 1 2 3; do time xbps-rindex -r /var/cache/xbps/ &>/dev/null; done

real 0m0.624s
user 0m2.163s
sys 0m0.032s

real 0m0.590s
user 0m2.159s
sys 0m0.023s

real 0m0.584s
user 0m2.144s
sys 0m0.039s

$ for f in 1 2 3; do time LD_PRELOAD=$PWD/lib/libxbps.so.2.0.0 ./bin/xbps-rindex/xbps-rindex -r /var/cache/xbps &>/dev/null; done

real 0m0.037s
user 0m0.030s
sys 0m0.010s

real 0m0.036s
user 0m0.032s
sys 0m0.007s

real 0m0.037s
user 0m0.035s
sys 0m0.006s
$
2014-09-05 21:07:07 +02:00
Juan RP
013731c502 Acquire/release a POSIX file lock on repository archives.
- xbps_repo_open() accepts a third argument (bool) to acquire a POSIX file
lock on the repository archive.
- xbps_repo_close() accepts a second argument (bool) to release a POSIX file
lock on the repository archive.

This avoids the issue of multiple xbps-rindex(8) processes being blocked
even for different repositories on the same architecture, resulting in
unnecessary contention.
2014-09-05 12:26:42 +02:00
Juan RP
98748bdcd1 bin/xbps-rindex/remove-obsoletes.c: also remove pkg signature files. 2013-12-24 12:02:33 +01:00
Juan RP
c91050fc35 xbps-rindex(8): added -v --verbose option (mainly for -r mode). 2013-10-10 10:43:01 +02:00
Juan RP
f3b0b19258 xbps-rindex: remove -c --clean mode and adapt to the new libxbps API.
- Removed -c --clean mode. It's not too useful and adds a considerable
  amount of gratuitous code. It takes almost the same time than
  adding all pkgs from scratch.

- When creating the repository data always add the meta plist at the
  2nd position in the archive, to optimize its access.

- Misc improvements.
2013-10-07 10:23:14 +02:00
Juan RP
8d5c48b861 Added support for the long awaited feature: RSA signed repositories. 2013-10-05 11:38:04 +02: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
2f9bd4f9a2 bin/xbps-rindex/remove-obsoletes.c: fix use-after-free. 2013-08-07 16:01:59 +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
db1efb3aa6 Relax memory requirements on 64bit platforms; fix two memleaks. 2013-06-12 10:04:10 +02:00
Juan RP
99be698979 Use a single file to store repository data.
This is just the starting point to extend repositories with PGP signatures.
2013-06-10 10:28: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
82a8263f37 xbps-rindex(8): fix crash in -r when a pkg cannot be removed. 2013-01-16 16:25:29 +01:00
Juan RP
bb877b0db7 xbps-rindex: -a does not remove outdated binpkgs anymore; use -r instead. 2012-12-15 11:13:32 +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
41f753248f xbps-rindex(8): remove obsoletes mode (-r) is now multithreaded. 2012-12-14 09:47:47 +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
b05ce9fe57 New utilities: xbps-{install,pkgdb,query,reconfigure,rindex} (WIP). 2012-11-02 15:04:25 +01:00