Commit Graph

19 Commits

Author SHA1 Message Date
Duncan Overbruck
de484e9369
lib: change xbps_dbg_printf to not require xbps_handle
This allows to simplify a lot of code by not having to pass around
the xbps handle everywhere just to print some debug information.
2022-12-24 14:29:23 +01:00
Piotr Wójcik
d744b4b238 xbps-install: exclude hold packages from total download size 2022-06-21 13:40:45 +00: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
Juan RP
7d8247ae56
Multiple changes to pkgs on hold mode.
- Added transaction stats for pkgs on hold.

- Always add packages on hold to the transaction dictionary,
  its type will be set to XBPS_TRANS_HOLD.

- Changed xbps_transaction_update_pkg() to have a new "force"
  bool argument to force an update with a pkg on hold.

- As discussed in #274 with @Duncaen the only way to update a
  pkg on hold is by using `-f`, i.e `xbps-install -f foo`.

Closes #265
Closes #274
2020-04-23 06:03:56 +02:00
Juan RP
24bbfffba1
xbps_transaction_prepare: fix stats for removals. 2020-02-25 08:43:52 +01:00
Juan RP
f9ccd9b627 xbps_transaction_prepare: set transd stats correctly.
- if pkg trans type is UPDATE or REMOVE, don't set
  download stats, we don't need them.
- Simplify code.
2020-02-21 10:51:20 +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
4d6d328c62
xbps_transaction_prepare: fix for XBPS_FLAG_DOWNLOAD_ONLY.
We don't really care if all pkgs are on hold, so modify
logic to avoid this part and exit early.
2020-02-18 09:07:03 +01:00
Juan RP
1b9dc3cc4d
xbps_transaction_prepare: set "total-download-size" correctly.
- It was set only with XBPS_FLAG_DOWNLOAD_ONLY.
- Simplify the logic.

In response to #187 and #230
2020-02-18 08:34:41 +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
bda4452016
xbps-install: improved -D,--download-only support.
Added support to download all dependencies even
if the euid does not have write perms to rootdir.

In this mode we only care if cachedir is writable,
rootdir access is not necessary.

This is really useful to download all binary packages
required by any number of packages as any regular
user to later perform off-line installations, i.e:

```
$ xbps-install -c $PWD/cachedir -yD xbps
...
$ tree cachedir
cachedir/
├── acl-2.2.53_1.x86_64-musl.xbps
├── acl-2.2.53_1.x86_64-musl.xbps.sig
├── attr-2.4.48_1.x86_64-musl.xbps
├── attr-2.4.48_1.x86_64-musl.xbps.sig
├── bzip2-1.0.8_1.x86_64-musl.xbps
├── bzip2-1.0.8_1.x86_64-musl.xbps.sig
├── ca-certificates-20190110_1.noarch.xbps
├── ca-certificates-20190110_1.noarch.xbps.sig
├── libarchive-3.4.1_1.x86_64-musl.xbps
├── libarchive-3.4.1_1.x86_64-musl.xbps.sig
├── libcrypto45-3.0.2_2.x86_64-musl.xbps
├── libcrypto45-3.0.2_2.x86_64-musl.xbps.sig
├── liblz4-1.9.2_1.x86_64-musl.xbps
├── liblz4-1.9.2_1.x86_64-musl.xbps.sig
├── liblzma-5.2.4_2.x86_64-musl.xbps
├── liblzma-5.2.4_2.x86_64-musl.xbps.sig
├── libressl-3.0.2_2.x86_64-musl.xbps
├── libressl-3.0.2_2.x86_64-musl.xbps.sig
├── libssl47-3.0.2_2.x86_64-musl.xbps
├── libssl47-3.0.2_2.x86_64-musl.xbps.sig
├── libtls19-3.0.2_2.x86_64-musl.xbps
├── libtls19-3.0.2_2.x86_64-musl.xbps.sig
├── libxbps-0.57.1_8.x86_64-musl.xbps
├── libxbps-0.57.1_8.x86_64-musl.xbps.sig
├── libzstd-1.4.4_1.x86_64-musl.xbps
├── libzstd-1.4.4_1.x86_64-musl.xbps.sig
├── musl-1.1.24_1.x86_64-musl.xbps
├── musl-1.1.24_1.x86_64-musl.xbps.sig
├── run-parts-4.9.1_1.x86_64-musl.xbps
├── run-parts-4.9.1_1.x86_64-musl.xbps.sig
├── xbps-0.57.1_8.x86_64-musl.xbps
├── xbps-0.57.1_8.x86_64-musl.xbps.sig
├── xbps-triggers-0.113_3.noarch.xbps
├── xbps-triggers-0.113_3.noarch.xbps.sig
├── zlib-1.2.11_3.x86_64-musl.xbps
└── zlib-1.2.11_3.x86_64-musl.xbps.sig

0 directories, 36 files
$
```

Inpired by #213
Closes #213
2020-01-25 13:05:46 +01:00
Juan RP
c81a2806ff xbps_transaction_prepare: optimize a bit.
If all packages in transaction are on hold, there's no
need to check for conflicts, shlibs, etc.

This makes `xbps-install -un` work faster on my system:
~0.450ms -> ~0.250ms

There's still room for more improvements :-)
2019-12-27 21:32:54 +01:00
Duncan Overbruck
f103b91663 Revert "lib/transaction_{revdeps,prepare}.c: try to update packages if necessary"
This reverts commit 0e950156fc.
2019-08-05 11:48:15 +02:00
Duncaen
0e950156fc lib/transaction_{revdeps,prepare}.c: try to update packages if necessary
`xbps_transaction_revdeps` will now try to add updates for packages to the
transaction if the dependency is not satisified anymore due to a package
install/update.

`xbps_transaction_prepare` will now check the return value of
`xbps_transaction_revdeps` and repeat the dependency resolution,
until `xbps_transaction_revdeps` returns 0, which means that it didn't
add any new packages to the transaction.
2019-07-03 00:48:57 +02:00
Juan RP
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Juan RP
2f1fd70a4e
xbps_transaction_prepare: initialize trans dict!
... otherwise it will always return ENXIO
2019-06-21 17:13:06 +02:00
Juan RP
c44e1f958d
lib/transaction_prepare.c: update for rename. 2019-06-21 10:48:17 +02:00
Juan RP
fcab44dbd3
lib/transaction_dictionary.c -> transaction_prepare.c. 2019-06-21 10:46:32 +02:00