Commit Graph

11 Commits

Author SHA1 Message Date
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
fba65ad9da xbps_transaction_store: ensure no multiple versions.
This change ensures that no multiple versions of the same pkg
are added to the transaction; if a new version of the same
package is being added as a dependency, compare stored
and current and use the greatest one.

This fixes the recent issue seen in the aarch64 builders, where
two versions of the same package were added to the transaction.

Added a new test case.
2020-02-14 08:41:35 +01:00
Duncan Overbruck
dca2223cb7
lib/transaction_store.c: store a copy in transaction packages array
This fixes multiple use after frees, found with AddressSanitizers.

* xbps_package_register: the pkgdb dictionary is replaced with
  the new one.
* xbps_pkgdb_update: here the pkgdb is externalized, freed and
  internalized.
2020-02-10 13:32:14 +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
d5e91cb7d8
xbps_transaction_store: fix memleak. 2020-01-06 12:47:13 +01:00
Juan RP
8081751f86 libxbps: print in verbose mode what pkgs are added to the transaction.
Useful to know why a transaction cannot be completed when there are
unresolved reverse dependencies.

Requested by @chris2.
2015-09-02 18:56:20 +02:00
Juan RP
1ebb245672 xbps_transaction_store: print repo too. 2015-02-05 10:26:53 +01:00
Juan RP
cbf1cfe0f5 libxbps: improve debug messages again. 2015-01-21 11:39:45 +01:00
Juan RP
627a5afaaf Make sure that automatic/manual installation modes are set as expected. 2014-10-20 07:59:06 +02:00
Juan RP
231582e671 libxbps: make sure to not add dups in transaction for remove. 2014-10-19 11:22:17 +02:00
Juan RP
fb868454b2 libxbps: make sure to not add dups in transaction for install/update. 2014-10-19 11:00:40 +02:00