Commit Graph

54 Commits

Author SHA1 Message Date
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
6b6b394686
lib: keep pkgdb props on updates in the proper place.
Improve f906f5a83d
2020-04-22 12:20:38 +02:00
Juan RP
f906f5a83d xbps_register_pkg: keep stored props in pkgdb on updates.
I noticed that while updating a pkg that is on hold
or in repolock mode, does not keep those properties.

Always set those props in the new pkg dictionary to respect
this behaviour. If there's a pkg on hold and you update it,
you want to keep it in this state unless you tell it to change.

Added new test case to verify.
2020-04-22 12:00:26 +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
Duncan Overbruck
0d90534236
libxbps: ABI/API break due to hash function changes 2020-02-10 13:32:17 +01:00
Duncan Overbruck
aa4d726dca
lib/package_register.c: make sure to error out if copy fails 2020-02-10 13:32:17 +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
66bea965dc
xbps_register_pkg: switch to localtime_r(3).
lgtm suggested that localtime() is not reentrant,
so that we now use localtime_r() instead.

lgtm reports 0 alerts after this change, yay.
2020-02-08 13:34:57 +01:00
Juan RP
d68ff7ebf0
xbps-install: fix --reproducable.
The 'repository' obj also needs to be skipped to be fully
reproducable between different repositories.

Updated the test case accordingly.
2019-12-29 16:31:23 +01:00
Juan RP
95a3ba651f libxbps: added XBPS_FLAG_INSTALL_REPRO for xbps_handle::flags.
If set, enable reproducible mode; skips adding the
"install-date" obj into pkgdb.
2019-12-29 11:02:51 +01:00
Juan RP
e902619220 Remove empty self replaced pkg arrays from pkgdb. 2014-09-14 18:16:43 +02:00
Juan RP
ac2c517bd7 Fixed install/update tests on pkgs with no files. 2014-09-14 18:04:10 +02:00
Juan RP
2b7c4d568a Remove pkg self replacement from pkgdb; this must not be propagated. 2014-09-13 18:14:04 +02:00
Juan RP
d67f8bdc8c xbps_register_pkg: do not modify the transaction pkg dictionary, use a copy instead.
Due to not using a copy the replace tests were failing at the configure phase,
because the "transaction" object was removed.
2014-09-13 13:31:56 +02:00
Juan RP
01dbb968dd Welcome pkgdb-0.38. 2014-09-11 00:12:12 +02:00
Juan RP
4070255529 pkgdb: added "repository-origin" obj to know its origin repository. 2014-05-11 10:03:17 +02: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
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
0a1859987a Respect automatic-install mode from pkgdb in transaction updates.
Also simplify register/unregister and remove useless state definitions.
2013-03-07 10:03:59 +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
178a6b58ae Remove another transaction obj from pkgdb and make xbps-pkgdb catch it. 2013-02-07 17:49:28 +01:00
Juan RP
f45352dbf8 Added support for dynamic generation of revdeps for installed packages. 2012-11-30 17:40:52 +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
34bd49f85a New pkg metadata structure for 0.18. See the NEWS file for info. 2012-11-16 16:55:35 +01:00
Juan RP
310e619ea3 Remove unnecessary variable assignments reported by cppcheck. 2012-11-06 09:28:34 +01:00
Juan RP
9e11ea950a Do not inherit unneeded objs from trans dictionary onto pkg's pkgdb dictionary. 2012-10-25 09:29:56 +02:00
Juan RP
2f1e975607 Added "install-date" object to pkg's pkgdb dictionary, make xbps-bin(8) print it. 2012-07-11 12:19:39 +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
791f1d40b2 xbps_handle: remove debug, install_*, syslog_enabled members.
Replaced by definitions that can be set to xbps_handle::flags.
2012-01-22 10:52:35 +01:00
Juan RP
6940505de9 regpkgdb rototill: renamed to pkgdb, improve the public API. 2012-01-20 11:10:52 +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
caaba09295 xbps_register_pkg: fix by adding pkgd into regpkgdb array. 2011-12-28 09:21:01 +01:00
Juan RP
a7f3a56e19 Make xbps_(un)register_pkg() accept a boolean arg to flush regpkgdb on success. 2011-12-28 05:57:04 +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
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
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
9fb3c38aa2 Extend assertions by checking passed in proplib type. 2011-10-19 16:53:38 +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
ead8d2460f libxbps: respect reqdby obj when replacing a pkg with a virtual pkg.
Reverse dependencies weren't respected when replacing a pkg with
another pkg that is providing a virtual pkg for the former.

This resulted in reversedeps being completely lost when new pkg
is installed.
2011-10-15 16:43:27 +02:00
Juan RP
508f119bc9 Moved install transaction code to libxbps, see NEWS file. 2011-07-27 17:13:54 +02:00
Juan RP
9673c4bd09 XBPS major changes in June 2011.
- A configuration file "xbps-conf.plist" replaces the (un)register target
  in xbps-repo(8) and (un)set-prop in xbps-bin(8). For now, you can set
  the repositories and prefered virtual packages.

- New package pattern matching code from NetBSD. Supports more ways of
  matching patterns in packages.

- Multiple bugs fixed in virtual packages related matching code.

--HG--
rename : LICENSE => COPYING
2011-06-04 13:37:53 +02:00
Juan RP
ef28101203 xbps_register_pkg: remove 'automatic' boolean argument.
It should be provided in the proplib dictionary with key 'automatic-install'.
This fixes a regression not respecting the 'automatic-install' value stored
in regpkgdb.
2011-04-11 14:42:06 +02:00
Juan RP
8191a1511c Make it possible to overwrite the "automatic-install" pkg object via xbps_init().
Two new booleans were added to struct xbps_handle: install_reason_{auto,manual}.
The backend is able to force auto or manual installation for a package (and
dependencies that were installed/updated) by setting to true any of those
booleans. Bump XBPS_RELVER.
2011-02-26 11:11:45 +01:00
Juan RP
870ad18d58 xbps_init() now sets rootdir, cachedir and flags.
That means that the following functions were removed:
	- xbps_set_{cachedir,flags,rootdir}.
	- xbps_get_{cachedir,flags,rootdir}.

With this change fixed an obvious typo that made -c argument to not work,
and now the cache directory is an absolute path not relative to rootdir.
2011-02-21 17:42:47 +01:00
Juan RP
faad0a6597 Make xbps_remove_pkg_from_* use shared code, and add another variant.
The functions have been renamed to really match what they do.
2011-01-27 18:22:57 +01:00
Juan RP
9797030306 xbps_register_pkg: also copy the provides object for virtual packages. 2011-01-26 18:42:28 +01:00
Juan RP
efea94bec6 Fixed API documentation comments for doxygen. 2011-01-19 00:31:22 +01:00