Commit Graph

61 Commits

Author SHA1 Message Date
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
Duncaen
4797dee468 lib/package_configure.c: fix memleak 2016-09-25 21:27:46 +02:00
Juan RP
1ed8551c08 xbps_configure_packages: ignore internal xbps objects.
Fixes an assertion triggered by `xbps-reconfigure -a`.
2015-10-31 15:03:26 +01:00
Juan RP
22ffc14026 Override and use a sane umask when performing pkg configuration.
Close #106
2015-06-28 05:14:02 +02:00
Juan RP
c8ecf4ac6c xbps-reconfigure(8): new option -i, --ignore to ignore pkgs with -a, --all.
-i, --ignore can be specified multiple times and can be used to
ignore configuration of those packages while configuration of all
packages is being performed.

Close #67
2014-12-09 13:10:48 +01:00
Juan RP
01dbb968dd Welcome pkgdb-0.38. 2014-09-11 00:12:12 +02:00
Juan RP
e92e86c2db Share code to show pre-remove/post-install msgs. 2014-07-27 17:39:24 +02:00
Juan RP
a28046332f Implemented support for pre-remove and post-install messages.
Close #44
2014-07-27 11:24:49 +02:00
Juan RP
4bc6ba2b1c lib/package_configure.c: fix use-after-free reported by clang. 2014-04-19 15:49:02 +02:00
Juan RP
cbbdc4c8bc xbps_configure_pkg: try to use pkgname if possible to configure a pkg.
In pwwka's case for some reason the transaction was trying to configure
'man-pages-3.62_1' while in pkgdb there was only 'man-pages-3.55_1'.

By using the pkgname the pkg stored in pkgdb will be configured, without
caring what version it is.
2014-03-13 21:28:31 +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
4d38311fbe xbps_configure_pkg: show/return proper return value in an error path. 2014-02-23 10:32:21 +01:00
Juan RP
5eea259c13 Remove the config.h kludge and override vasprintf detection via HAVE_VASPRINTF. 2014-01-20 18:50:33 +01: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
90b6803825 Introduce XBPS_STATE_CONFIGURE_DONE and use it in xbps-reconfigure(8). 2013-03-07 09:24:04 +01:00
Juan RP
301dfe0043 xbps_configure_pkg: fail gracefully if metadata cannot be read. 2013-03-05 17:20:29 +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
6a60bceb54 xbps_configure_pkg: set pkg state in our pkg dictionary from pkgdb.
Replacing a dictionary while the iterator is held invalidates this iterator, thus
breaking the loop.

Thanks to pancake for finding this issue.
2012-12-17 11:27:10 +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
85c0641cc8 xbps_{configure,remove}_pkg: do not use meta cache when executing scripts.
This fixes executing INSTALL/REMOVE scripts with the right version currently
installed, i.e kernel post-install failed to execute correctly its kernel
hooks due to passing a wrong version.
2012-11-26 23:25:41 +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
3e7f35bed1 xbps_configure_pkg: do not flush pkgdb if state hasn't been changed. 2012-10-26 10:24:26 +02: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
bfe7ab1c5a xbps_configure_pkg: simplify and remove "version" arg (API change).
The "version" argument (being optional) clearly is not needed and it
can be fully removed. This simplifies the internal implementation as well
as the API.
2012-04-10 10:02:27 +02:00
Juan RP
ef6d1adf91 xbps_set_pkg_state_installed: simplify (API change).
The third optional argument "pkgver" clearly is useless because we can
create it internally with "pkgname" and "version" arguments instead.

Also make the "version" argument mandatory.
2012-04-10 09:43:59 +02:00
Juan RP
4511e581b2 xbps_configure_pkg: improve error messages. 2012-03-31 10:08:52 +02:00
Juan RP
216673aa4a Fixed 'xbps-bin reconfigure all' regression added in 0.13. 2012-02-28 21:16:41 +01:00
Juan RP
a166d6a2a3 Simplify xbps_transaction_prepare()/commit() and related API changes.
- xbps_handle::transd -> new member with transaction dictionary.
- xbps_transaction_prepare: returns an int.
- xbps_transaction_commit: doesn't need any arg now.
- xbps_repository_pool_sync: doesn't need any arg now.
- xbps_pkgdb_update: removed xbps_handle * arg.
- xbps_transaction_missingdeps_get: removed, missing_deps array is in
  xbps_handle::transd("missing_deps") array object.
2012-01-22 10:00:46 +01:00
Juan RP
38db570c19 pkgdb: foreach_xxx_pkg_cb -> foreach_xxx_cb. 2012-01-21 10:30:20 +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
ab6d4a19f1 xbps_configure_packages: fix flush arg confusion. 2012-01-04 17:59:49 +01:00
Juan RP
a31c20e52a Make xbps_configure_pkg/packages accept a flush bool arg for frontends. 2012-01-04 17:41:36 +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
d7a32a7eca Introduce regpkgdb_foreach_reverse_pkg_cb, switch to regpkgdb_foreach_xxx. 2011-12-23 08:16:25 +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
c60ab726a3 xbps_configure_pkg: fix path to INSTALL script. 2011-12-15 14:46:59 +01:00
Juan RP
70e95786dc libxbps: pass xhp->conffile as last argument when execing INSTALL/REMOVE scripts. 2011-12-15 12:24:59 +01:00
Juan RP
b0ceeaa58e New configuration file via confuse: xbps.conf. 2011-12-15 11:19:20 +01:00
Juan RP
f3099fa2c6 Added success states for state_cb, move some descriptions to the client cb. 2011-11-25 09:44:49 +01:00
Juan RP
ab17573692 Split XBPS_FLAG_FORCE into CONFIGURE and REMOVE_FILES, bump XBPS_API_VERSION. 2011-11-24 11:50:53 +01:00
Juan RP
3ccfec7054 Improved callback/states support to make libxbps std{err,out} printf free.
This is a major API/ABI change, documentation has been updated accordingly.
2011-11-24 11:23:08 +01:00
Juan RP
86f1f18571 libxbps: revamped trans states/cb to be more generic, not just for transactions. 2011-11-11 09:41:48 +01:00
Juan RP
5ade2f37c7 libxbps: xbps_configure_pkg: ignore pkgs in config-files state. 2011-10-20 16:13:16 +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
6f783389dd Share transaction callbacks for xbps-{bin,repo}, reposync cb support. 2011-07-28 09:25:30 +02:00