Commit Graph

70 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
Duncan Overbruck
1f99a099e8
lib: run all post/purge-remove scripts at the end of the transaction 2021-06-26 18:41:37 +02:00
Duncan Overbruck
02367e3c00
lib: run pre-remove and pre-install scripts before unpacking 2021-06-26 18:41:37 +02:00
Duncan Overbruck
c94648630c
lib/transaction_commit.c: don't configure already unpacked packages early
This makes --unpack-only also skip the configure for currently unpacked
packages and configures unpacked packages together with all other
pckages.
2021-06-26 18:41:37 +02:00
Duncan Overbruck
ab3fb82a7f
lib: add binary package internalization step
- internalize scripts so we can use them before unpacking packages.
- moves some required metadata checks out of the package unpack stage
  so errors do not leave the system in a half unpacked state.

xbps_transaction_files will be changed later to use the loaded
files.plist instead of opening each binary package on its own again.
2021-06-26 18:41:37 +02:00
gt7-void
167289d590
Avoid file descriptor leakes (fix #303)
HTTP connections are cached for performance, but they end up being
leaked when running configure scripts. To avoid this, close the
connection cache after all downloads are finished.

Closes: #326 [via git-merge-pr]
2021-02-04 23:16:27 +01: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
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
Duncaen
143b13f9e6 lib/transaction_fetch.c: move fetch and verify binpkgs and make use of xbps_fetch_file_digest 2019-10-25 23:38:01 +02:00
Juan RP
fe943eb7d2
xbps-install(1): added -D, --download-only.
Added `-D, --download-only` flag to allow downloading
packages to the cache without attempting to install them.

Contributed by Toyam Cox via #9

Adapted to master by yours truly.

Close #9
2019-06-21 15:57:25 +02:00
Duncaen
29f1433afd lib/transaction_files.c: collect file installs/removals to correctly find obsoletes 2019-06-18 19:54:22 +02:00
Juan RP
9c4fa4909c libxbps: initialize locale correctly to handle UTF-8 filenames with musl.
This fixes unpacking of ca-certificates that wasn't unpacking the files
with UTF-8 characters correctly.
2015-12-11 09:59:16 +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
faeff38ca2 Alternatives framework (1/2) (WIP). 2015-10-18 10:38:35 +02:00
Juan RP
87fcc7d6a8 If pkg signature verification files, remove pkg archive and its signature file. 2015-06-04 09:59:52 +02:00
Juan RP
07e8330936 xbps-install(1): added -U --unpack-only to only unpack pkgs, skips configuration. 2015-06-03 11:15:11 +02:00
Juan RP
da74e3dd9e libxbps: stop and error out if pkg signature is not valid. 2015-05-09 06:27:03 +02:00
Juan RP
076b3f8c44 libxbps: add pkgs on hold mode to the transaction, but ignore them.
Those are there mostly to be shown by the clients and notify that
there's an update in repos that is being ignored.

Idea by @chneukirchen.
2015-01-28 12:07:47 +01:00
Juan RP
7dea05f507 xbps_pkgdb_update: added 3rd bool arg "update", not update in memory pkgdb.
If true, the in memory pkgdb dict will be updated with data from the on-disk pkgdb.
2015-01-10 19:42:09 +01:00
Juan RP
53c6a5d1d7 xbps_transaction_commit: if the pkg RSA signature is invalid print rval too. 2014-12-01 12:52:26 +01:00
Juan RP
c47beef740 xbps_transaction_commit: if pkg sha256 hash is invalid print rval. 2014-12-01 12:47:29 +01:00
Juan RP
09c630a825 lib/transaction_commit.c: CID 62740 (toctou) 2014-10-08 10:13:21 +02:00
Juan RP
ec438c36f9 Fix 1a19adf85c correctly. 2014-10-07 09:18:28 +02:00
Juan RP
1a19adf85c lib/transaction_commit.c: CID 62716 (argument cannot be negative) 2014-10-07 07:29:58 +02:00
Juan RP
598022a60b xbps_transaction_commit: add more debugging to know the unconfigured pkg reason. 2014-09-13 12:21:49 +02:00
Juan RP
18e0524287 libxbps: optimize rootdir access/creation by checking/creating it only once. 2014-05-27 10:02:01 +02:00
Juan RP
67b5ba0dc3 xbps_transaction_commit: add some more debugging. 2014-03-13 20:49:54 +01:00
Juan RP
62888d3103 xbps_transaction_commit: add some debugging in error paths. 2014-03-13 20:35:26 +01:00
Juan RP
0416b067d0 Use a POSIX lock for pkgdb and only issue pkgdb writes in exact points.
- Rather than using a POSIX named semaphore use a POSIX lock (lockf(3))
for pkgdb for writers. Writers that cannot acquire the pkgdb lock will
get EAGAIN rather then being blocked.

- Due to using a file lock we cannot write the pkgdb every time a package
is being unpacked, configured or removed. Instead pkgdb is only written
at the end of a specific point in the transaction (unpack, configure, remove)
or via xbps_pkgdb_unlock().
2014-03-04 14:37:10 +01:00
Juan RP
1ad01b952a xbps_transaction_commit: reset var value if binpkg/signature was downloaded successfully. 2014-02-24 11:35:28 +01:00
Juan RP
187d635447 xbps_transaction_commit: return error if downloading binpkg/signature fails. 2014-02-23 08:15:32 +01:00
Juan RP
fb5fb91fa3 lib/transaction_commit.c: fix a double free (reported by Hanspolo). 2014-01-28 20:51:57 +01:00
Juan RP
e9bc52a01b Fix #28 (Verification fails due to missing signature). 2014-01-21 10:06:48 +01:00
Juan RP
767566558c xbps_transaction_commit: initialize bool var to avoid unexpected branch. 2014-01-03 11:38:19 +01:00
Juan RP
35e4182250 Fully remove the obsolete softreplace code. 2013-12-25 11:12:52 +01:00
Juan RP
ec0d38c469 Implement per pkg RSA signatures and on-demand repository access. 2013-12-24 10:43:55 +01:00
Juan RP
010e5df415 lib/transaction_commit.c: add missing arg to xbps_dbg_printf(). 2013-08-29 15:49:23 +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
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
7c4f20ba89 lib/transaction_commit.c: fix a use-after-free in state cb (found by ojab). 2013-03-26 10:35:20 +01:00
Juan RP
5eddf04898 Ignore executing install/remove scripts if XBPS_TARGET_ARCH is set.
Instead a two stage approach is necessary when packages for target arch
are installed:

	- XBPS_TARGET_ARCH=arch xbps-install foo <- only unpack
	- xbps-reconfigure -a <- configure natively or via an emulator
2013-03-07 18:08:12 +01: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
d8769c4873 Workaround fix for 'xbps-install -yf xbps <-> xbps-git'. 2013-02-05 12:10:24 +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
e861cb5331 xbps_transaction_commit: add a dbg printf. 2012-11-19 14:38:06 +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
a77727887d Improvements for xbps_fetch_file and xbps_repository_sync_index.
xbps_fetch_file:
	- A temp file is created with .part extension to improve resuming.
	- Files are downloaded in cwd.
	- Switch to futimens(2) and fsync(2).

xbps_repository_sync_index:
	- Do not create local repodir in metadir if it already exists.
	- Simplify the code thanks to new xbps_fetch_file().
2012-11-11 11:29:49 +01: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
6a4de0127d libxbps: introduce the concept of "soft replace"; see the NEWS file. 2012-05-25 17:24:36 +02:00