Commit Graph

78 Commits

Author SHA1 Message Date
Juan RP
08aa44602f xbps_array_foreach_cb_multi: fix incorrect array counter.
This fixes some races that could be seen when there's a
determined number of pkgs and CPU threads.
2019-04-19 22:57:42 +02:00
Enno Boland
bfd6b2e88e lib/plist.c: share workload more efficient between threads
Before this patch xbps had a constant slice count for every thread.
This resulted in unbalanced thread usage if the workload was
homogenous over the slices.

This patch replaces the naive slice count approach by spinlock based
reservation.
2018-07-02 13:18:23 +02:00
Juan RP
a9482027b2 xbps_array_foreach_cb_multi: handle the case of sysconf returning 0. 2015-11-26 07:18:14 +01: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
a6f128a578 lib/plist.c: CID 62704 (argument cannot be negative) 2014-10-05 13:22:28 +02:00
Juan RP
d95d5ba113 xbps_array_foreach_cb_multi: remove useless mutex. 2013-12-08 08:07:45 +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
4057e4961c Use C99 for loop initializers.
That means that a C99 compiler is now mandatory.
2013-09-15 10:06:49 +02:00
Juan RP
789165339a Drop useless/unused xbps_add_obj_to_{array,dict} functions. 2013-08-18 10:25:17 +02:00
Juan RP
49fa951836 xbps_array_foreach_cb: replace an assertion with a real test, for non working repos. 2013-07-27 20:01:23 +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
432067de48 Remove three unused API functions. 2013-07-27 06:12:59 +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
e844bc1ad5 xbps_callback_array_iter_reverse: initialize rv (fixes garbage return value). 2013-04-04 09:13:52 +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
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
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
d6735d5685 xbps_xasprintf: do not return NULL anymore; remove checks for this. 2012-11-11 09:37:27 +01:00
Juan RP
974b2fe8ad libxbps: simplify pkgdb_get_pkgd and find_pkg_dict_installed internals.
There's no need to prop_dictionary_copy the returned dictionary to
later have to free it again, just return directly the dictionary and
avoid the free(3)s.
2012-06-16 09:02:07 +02:00
Juan RP
3e9e87fc2a libxbps: require a pointer to xbps_handle in functions that need it.
This removes 2 global vars from lib/initend.c and easier to know
what functions require access to xbps_handle.
2012-06-14 08:22:11 +02:00
Juan RP
8b2c4ed47e xbps_dictionary_from_metadata_plist: if vpkg not found, look for a real pkg. 2012-04-13 09:23:35 +02:00
Juan RP
9bada162a1 New "metadir" member in xbps_handle to override default metadata dir. 2012-03-13 10:22:35 +01:00
Juan RP
6940505de9 regpkgdb rototill: renamed to pkgdb, improve the public API. 2012-01-20 11:10:52 +01:00
Juan RP
ffa48b2cf3 Fix xbps_configure_packages() by avoiding proplib iterators. 2012-01-16 14:41:16 +01:00
Juan RP
3b7491d29b Merged purge code in remove, configurable transaction regpkgdb flushing.
See the NEWS file for info.
2011-12-24 01:05:26 +01:00
Juan RP
b0ceeaa58e New configuration file via confuse: xbps.conf. 2011-12-15 11:19:20 +01:00
Juan RP
07d47ab09a libxbps: xbps_dictionary_from_metadata_plist: respect pkgname arg. 2011-10-30 08:01:25 +01:00
Juan RP
0a041cdd2e libxbps: new func xbps_array_replace_dict_by_name(array, dict, pkgname)
This function replaces a dictionary in an array matched by pkgname,
with the dictionary passed in as 2nd argument.
2011-10-19 00:37:36 +02:00
Juan RP
5642ffa86e New configuration scheme changes, round 1.
- Configuration file 'xbps-conf.plist' has been splitted off into
  two files: conf.plist and repositories.plist. By default they
  are stored in etc/xbps.
- Changed some members in xbps_handle struct, mostly to make it easy
  to change its value in {cache,root}dir and conffile.
- Made xbps_init() release proplib objects as soon as we don't need
  them, that way it uses 35% less of memory or in some cases even more.

There will be another commit that will implement to read new virtualpkg
settings by the user, as specified in:

	http://code.google.com/p/xbps/issues/detail?id=12
2011-10-17 12:37:15 +02:00
Juan RP
0f0c66fafb xbps_dictionary_from_metadata_plist: if pkgname not found try from a
virtual pkg.
2011-10-16 10:27:02 +02:00
Juan RP
508f119bc9 Moved install transaction code to libxbps, see NEWS file. 2011-07-27 17:13:54 +02:00
Juan RP
ce0b21a062 xbps_dictionary_from_metadata_plist: fix this with empty regpkgdb.plist.
If regpkgdb wasn't initialized it failed to properly internalize the
dictionary from the plist file.
2011-07-27 11:23:25 +02:00
Juan RP
e26b6e23e6 xbps-bin(8): make 'show{,-deps,-revdeps}' target work with virtual pkgs. 2011-07-25 16:40:34 +02:00
Juan RP
9673c4bd09 XBPS major changes in June 2011.
- A configuration file "xbps-conf.plist" replaces the (un)register target
  in xbps-repo(8) and (un)set-prop in xbps-bin(8). For now, you can set
  the repositories and prefered virtual packages.

- New package pattern matching code from NetBSD. Supports more ways of
  matching patterns in packages.

- Multiple bugs fixed in virtual packages related matching code.

--HG--
rename : LICENSE => COPYING
2011-06-04 13:37:53 +02:00
Juan RP
841c9e2d51 API/ABI break for June 2011.
Rename some functions to reflect its description a bit better.

--HG--
rename : lib/repository_plist.c => lib/plist_fetch.c
2011-06-01 09:37:32 +02:00
Juan RP
870ad18d58 xbps_init() now sets rootdir, cachedir and flags.
That means that the following functions were removed:
	- xbps_set_{cachedir,flags,rootdir}.
	- xbps_get_{cachedir,flags,rootdir}.

With this change fixed an obvious typo that made -c argument to not work,
and now the cache directory is an absolute path not relative to rootdir.
2011-02-21 17:42:47 +01:00
Juan RP
8803bfd7d8 Move plist find/remove functions into its own files. 2011-02-05 12:06:03 +01:00
Juan RP
f4cdbaf17d Move xbps_read_dict_from_archive_entry() and friends into its own file. 2011-02-05 11:57:13 +01:00
Juan RP
de296d8192 Added the concept of package properties in the API.
See the NEWS file and xbps-bin(8) for more information.
2011-02-05 11:25:04 +01:00
Juan RP
bb897da7b4 Fix an assertion. 2011-01-30 00:14:29 +01:00
Juan RP
5bbbb3c8fd xbps_find_pkg_in_*: search for virtual pkg before the real one. 2011-01-29 17:57:01 +01:00
Juan RP
241751f1b7 Added three new helper functions to the API.
xbps_find_pkg_in_array_by_name
xbps_find_pkg_in_array_by_pattern
xbps_remove_pkgname_from_array
2011-01-29 12:28:23 +01:00
Juan RP
463d182c49 When sorting packages also look for virtual packages.
A new function xbps_find_virtual_pkg_in_dict() has been made public
to the API to make this find duplicate packages in the transaction
when updating packages.
2011-01-28 20:56:28 +01:00
Juan RP
f7f3cfcb9c Performance improvements for xbps_find_pkg_in_dict_by_* and xbps_find_*_in_array(). 2011-01-28 12:11:43 +01:00
Juan RP
1cc45ee20f Fix two asserts. 2011-01-27 20:47:34 +01:00
Juan RP
faad0a6597 Make xbps_remove_pkg_from_* use shared code, and add another variant.
The functions have been renamed to really match what they do.
2011-01-27 18:22:57 +01:00
Juan RP
93e1a0a22c Performance improvements for xbps_find_pkg_in_dict_by_{name,pattern} with virtual pkgs. 2011-01-27 15:50:50 +01:00