Commit Graph

68 Commits

Author SHA1 Message Date
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
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
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
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
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Juan RP
35ad10ccbd Fix 29765271e correctly.
xbps_find_virtualpkg_in_conf() needs to look at the vpkgs set up in
configuration files, not from those set by pkgdb.

As a result of this the two test cases that were failing yesterday are now
fixed.
2016-03-24 10:23:20 +01:00
Juan RP
29765271e9 xbps.d(5): 'virtualpkg' can now be used to map any pkg to another.
See NEWS for more information.
2016-03-23 12:46:52 +01:00
Juan RP
cbf1cfe0f5 libxbps: improve debug messages again. 2015-01-21 11:39:45 +01:00
Juan RP
bce27b968e xbps_find_*pkg_in_array: fix logic when transaction obj string matches. 2015-01-17 06:04:22 +01:00
Juan RP
9d582abe0f Fixed a regression with virtual packages declared via xbps.d(5).
Added a new test case to verify its correctness. Somehow virtual packages
declared via xbps.d(5) were not working correctly for dependencies.

This now works as expected with vpkgs declared with and without a version
component.
2015-01-05 16:04:22 +01:00
Juan RP
eee895c6d8 Fixed a regression in vpkgs and improve xbps.d(5) virtualpkg declarations.
See the NEWS file for more information.
2014-12-31 08:51:45 +01:00
Juan RP
c9514ad617 libxbps: fixed replaces/replace_vpkg test case. 2014-09-14 12:50:17 +02:00
Juan RP
39aca1bbc9 Implement shlib checks for all pkg revdeps in the transaction.
Added three new test cases to verify its correctness.
2014-09-12 11:49:34 +02:00
Juan RP
a3f2898ea6 Explicitly set errno to ENOENT when a pkg hasn't been found in array/dictionaries. 2014-05-17 12:36:02 +02:00
Juan RP
bb491e2667 libxbps: detect and ignore incorrect deps of a pkg if those are virtual pkgs. 2014-04-20 16:54:50 +02:00
Juan RP
a511292316 lib/plist_find.c: do not return a false positive while matching vpkgs. 2014-02-25 18:43:33 +01:00
Juan RP
f74bf1c1c8 New custom configuration file format that does not need confuse. 2014-02-25 16:42:52 +01:00
Juan RP
3f376998c2 lib/plist_find.c: remove a noisy/useless dbg printf. 2013-09-16 11:24:09 +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
6795e840d6 lib/plist_find.c: fix a memleak, misc cleanups. 2013-08-29 11:51:42 +02:00
Juan RP
4494e0554d lib/plist_find.c: typo in comment. 2013-06-27 16:26:19 +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
ee9b799822 Make sure that only 1 thread can inject the vpkg config files. 2013-06-14 12:31:43 +02:00
Juan RP
2c03e1c9a8 Read virtual pkg config files only when it's necessary. 2013-06-14 10:00:33 +02:00
Juan RP
db1efb3aa6 Relax memory requirements on 64bit platforms; fix two memleaks. 2013-06-12 10:04:10 +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
b9136c61c9 Use prop iterators when needed to retain the obj.
This could explain the strange issues seen in buildbot builds that
have been happening since 0.18; this should fix completely this.
2012-11-30 09:49:09 +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
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
068cab8d20 libxbps: performance improvements by caching the most accessed paths.
1- We can cache the result of the first xbps_pkgdb_init() when it fails
   and avoid the malloc/free/access from it.
2- We cache the uname(2) result into a private var in xbps_handle and
   use it in xbps_pkg_arch_match().

This improves performance by ~5% approx and it's close as it was before
introducing the repository index format 1.5.
2012-06-15 15:33:11 +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
c37026d4c6 libxbps: require an underscore in strings to detect correctly pkgname/version. 2012-06-05 10:58:39 +02:00
Juan RP
9441f9f14b libxbps: multiple random changes for overall performance increase. 2012-06-04 23:22:33 +02:00
Juan RP
fa73de309f libxbps: remove xbps_find_pkg_dict_from_plist_by_xxx (unused). 2012-06-04 21:34:21 +02:00
Juan RP
7289547432 Welcome "repository index format 1.5". See NEWS for information. 2012-05-31 16:29:56 +02:00
Juan RP
83bda174ab libxbps: make xbps_find_virtualpkg_* only look for virtual pkgs.
Before this commit they also looked for non virtual packages, which
is not what it was meant when those functions were added.
2012-04-12 11:57:21 +02:00
Juan RP
e698acf440 Make xbps_find_virtualpkg_conf_xxx private again, unused in test suite now. 2012-03-13 11:37:50 +01:00
Juan RP
749e03aa29 Make xbps_find_virtualpkg_conf_in_xxx_by_xxx part of the API and add kyua tests. 2012-03-12 17:51:50 +01:00
Juan RP
715990a1e5 Make xbps_find_virtualpkg_in_dict_by_xxx part of the API and add kyua tests. 2012-03-12 16:36:46 +01:00
Juan RP
6940505de9 regpkgdb rototill: renamed to pkgdb, improve the public API. 2012-01-20 11:10:52 +01:00
Juan RP
9a088937b5 Repository index 1.4 -- see NEWS file for info. 2012-01-19 12:26:40 +01:00
Juan RP
f2b05d6438 Improved pkg best matching in rpool, and support for exact pkgver matches.
- xbps_repository_pool_find_pkg in best match case, now returns the
  newest package version available in rpool.
- Added xbps_repository_pool_find_pkg_exact that returns a package
  by exact matching a pkgver.
- Removed xbps_handle_alloc(), the user is free to use memory
  allocated from heap or stack.
- Improved API documentation in preparation for 0.12.

Bumped XBPS_API_VERSION again.
2012-01-17 16:17:03 +01:00
Juan RP
beb7284681 xbps-repo: faster 'genindex' target implementation for index-files.plist. 2012-01-17 10:50:35 +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
b232ca1815 libxbps: cache regpkgdb just when it's needed not via xbps_init(). 2011-12-22 12:56:56 +01:00
Juan RP
b0ceeaa58e New configuration file via confuse: xbps.conf. 2011-12-15 11:19:20 +01:00
Juan RP
e7562fa72d libxbps: make xbps_find_*pkg_dict_installed only accept {INSTALL,UNPACK}ED states as valid ones. 2011-11-30 11:11:15 +01:00
Juan RP
c0ecb93410 libxbps: always force pkgpattern match in virtualpkgs from conf. 2011-11-17 12:59:36 +01:00
Juan RP
9fb3c38aa2 Extend assertions by checking passed in proplib type. 2011-10-19 16:53:38 +02:00