Commit Graph

139 Commits

Author SHA1 Message Date
Enno Boland
7485659687 libxbps: use strlcpy instead of strncpy 2014-05-13 11:58:51 +02:00
Enno Boland
295cfcea76 libxbps: insert space after conditionals 2014-05-13 11:44:49 +02:00
Enno Boland
152ec0354f libxbps: file including in xbps.conf supports relative paths. 2014-05-13 11:37:09 +02:00
Juan RP
1e273bf575 lib/initend.c: move prototype to the correct place. 2014-05-06 10:21:44 +02:00
Juan RP
42a569b05c lib/initend.c: add Enno Boland to copyright. 2014-05-06 09:29:26 +02:00
Enno Boland
e5d64d6319 lib/initend.c: include now supports file globbing. 2014-05-05 23:10:18 +02:00
Juan RP
dacbb2f22f Fixed some warnings reported by clang. 2014-04-20 10:02:54 +02:00
Juan RP
51bdbe41ac lib/initend.c: ignore -Wformat-nonliteral with clang. 2014-03-11 09:28:50 +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
f74bf1c1c8 New custom configuration file format that does not need confuse. 2014-02-25 16:42:52 +01:00
Juan RP
804a39c63b Added XBPS_ARCH environment var to override uname(2) machine result. 2014-01-09 11:41:25 +01:00
Juan RP
ae81cd1ea9 lib/initend.c: define _BSD_SOURCE for strlcpy() with musl. 2014-01-07 21:20:42 +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
2a21354a1c Make some reorganization in struct xbps_handle.
The variables to set cachedir, rootdir and metadir have been
changed to "array of chars", this way there are no extra allocations.

Update clients accordingly and bump API version.
2013-12-16 11:46:39 +01:00
Juan RP
4403caa434 Add repos set in xbps_handle::repositories to the top of the list.
That means that now xbps-install(8) and xbps-query(8) --repository
option does not override the repository list of a configuration file.
2013-12-04 16:59:15 +01:00
Juan RP
8882b0215f Redo how the repository keys are stored.
- Repository keys are now stored in a new directory on metadir (/var/db/xbps):

	<metadir>/key>

- Repository keys are stored with the hex fingerprint of its RSA
  public key in a plist dictionary:

	<metadir>/keys/xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.plist

- Drop xbps-rkeys(8) and merge its functionality into xbps-install(8) and
  xbps-query(8).

- xbps-query(8) -vL now shows some more details of remote repositories:

 3134 http://localhost:8000 (RSA signed, verified)
      Signed-by: Void Linux
      4096 60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d
   16 http://localhost:8000/nonfree (RSA signed, verified)
      Signed-by: Void Linux
      4096 60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d

Bump XBPS_API_VERSION.
2013-11-18 16:05:46 +01:00
Juan RP
a5ecaa493f New utility: xbps-rkeys(8) to manage RSA public keys. 2013-10-09 10:13:07 +02:00
Juan RP
5e1432f418 Added support to specify multiple repositories via cmdline (close #17). 2013-09-18 16:45:05 +02:00
Juan RP
4057e4961c Use C99 for loop initializers.
That means that a C99 compiler is now mandatory.
2013-09-15 10:06:49 +02:00
Juan RP
776b94e6bc Remove PackagesOnHold from xbps.conf; use xbps-pkgdb -m hold|unhold instead.
To put a package on hold mode:
	$ xbps-pkgdb -m hold foo

To unhold the package:
	$ xbps-pkgdb -m unhold foo

To list packages on hold mode:
	$ xbps-query -H

This also close #12 from github.
2013-08-12 14:46:54 +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
2c03e1c9a8 Read virtual pkg config files only when it's necessary. 2013-06-14 10:00:33 +02:00
Juan RP
5fd7565e6c xbps-install(8): -R now overrides the repository list set in a configuration file.
Now -R can be used independently if a configuration file exists or not.
2013-04-18 18:17:14 +02:00
Juan RP
dc900353e4 lib/initend.c: xbps_end: remove bogus assignment. 2013-04-04 10:07:19 +02: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
6c96fe32cc lib/initend.c: print dbg msg about successful vpkg conf files read. 2013-02-05 09:32:43 +01:00
Juan RP
90cde72283 Add support to switch arch via XBPS_TARGET_ARCH env var. 2013-02-03 09:45:03 +01:00
Juan RP
9cf104498e lib/initend.c: convert a noisy printf to dbg_printf. 2013-01-31 09:42:22 +01:00
Juan RP
71430b1566 lib/initend.c: print to stderr a meaningfull msg on error. 2013-01-15 13:14:06 +01:00
Juan RP
ea2f2c7297 Silence -Wformat-nonliteral warning with clang. 2013-01-04 10:35:00 +01:00
Juan RP
22adf99e40 Faster generation of dynamic reverse dependencies and do this exactly once. 2012-12-15 07:33:49 +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
7f577e005c metadir: replace uthash simply with a dictionary. 2012-11-21 23:07:38 +01:00
Juan RP
a311294f0a libxbps: added support to "inject" vpkg config files at initialization time. 2012-11-19 15:42:24 +01:00
Juan RP
bf2d97a067 xbps_init: simplify previous and use xbps_xasprintf(). 2012-11-19 12:15:32 +01:00
Juan RP
b894a5eca3 Accept relative rootdir via xbps_handle::rootdir (found by pancake). 2012-11-19 12:12:38 +01:00
Juan RP
46f7a808b4 xbps_metadir: use an hash table (via uthash): 15s vs 1m10s. 2012-11-18 02:38:24 +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
d6735d5685 xbps_xasprintf: do not return NULL anymore; remove checks for this. 2012-11-11 09:37:27 +01:00
Juan RP
54b6cc7ec1 xbps-{bin,repo}: add -B flag to set default repo if xbps.conf not found.
(cherry picked from commit 75eac1a1426040a833e0b10e208f2e55fa359532)
2012-09-29 19:10:48 +02:00
Juan RP
e370ff0625 libxbps: use a new bool in struct xbps_handle to track successful initialization.
(cherry picked from commit 03374950680f6a839b1ee2df8e3a4e1dfb110fa8)
2012-09-29 19:09:03 +02:00
Juan RP
c24ce8e4da libxbps: use memcpy in critical paths for performance, fixed some memleaks. 2012-06-18 10:43:05 +02:00
Juan RP
068cab8d20 libxbps: performance improvements by caching the most accessed paths.
1- We can cache the result of the first xbps_pkgdb_init() when it fails
   and avoid the malloc/free/access from it.
2- We cache the uname(2) result into a private var in xbps_handle and
   use it in xbps_pkg_arch_match().

This improves performance by ~5% approx and it's close as it was before
introducing the repository index format 1.5.
2012-06-15 15:33:11 +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
922ee1f1b6 libxbps: rename xbps_repository_pool_xxx to xbps_rpool_xxx. 2012-05-30 10:56:32 +02:00
Juan RP
28767f2ea8 Added support to put packages "on hold". 2012-05-08 09:19:43 +02:00
Juan RP
9bada162a1 New "metadir" member in xbps_handle to override default metadata dir. 2012-03-13 10:22:35 +01:00
Juan RP
af9bd15af7 xbps_init: set xhp->conffile to NULL if conf file cannot be read. 2012-03-05 17:33:36 +01:00
Juan RP
4b02a75629 xbps_init: fix a typo when checking for the configuration file. 2012-03-05 17:29:02 +01:00
Juan RP
cfae783f64 xbps_init: avoid using a global var. 2012-01-26 11:43:35 +01: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
d0e1477eeb Simplify xbps_end() and don't continue if xbps_init() did not succeed. 2012-01-17 16:56:17 +01:00
Juan RP
f2b05d6438 Improved pkg best matching in rpool, and support for exact pkgver matches.
- xbps_repository_pool_find_pkg in best match case, now returns the
  newest package version available in rpool.
- Added xbps_repository_pool_find_pkg_exact that returns a package
  by exact matching a pkgver.
- Removed xbps_handle_alloc(), the user is free to use memory
  allocated from heap or stack.
- Improved API documentation in preparation for 0.12.

Bumped XBPS_API_VERSION again.
2012-01-17 16:17:03 +01:00
Juan RP
0d44ae267c xbps_init: print xhp->conffile if set in a dbg printf. 2011-12-29 10:57:24 +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
36c79fc167 xbps_handle_alloc: use calloc to avoid using unitilizated value. 2011-12-22 21:47:32 +01:00
Juan RP
ca0905925f xbps_end: don't continue if we don't have a valid xbps_handle pointer. 2011-12-22 16:55:35 +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
5a892023f4 Be a bit more paranoid by checking allocs and expected types. 2011-12-22 08:23:11 +01:00
Juan RP
32fdb35c56 libxbps: make xh->cachedir to always use a full path after xbps_init(). 2011-12-15 14:24:10 +01:00
Juan RP
93e3603dcc xbps_init: use __UNCONST to shut up gcc's -Wcast-qual warnings. 2011-12-15 11:30:17 +01:00
Juan RP
b0ceeaa58e New configuration file via confuse: xbps.conf. 2011-12-15 11:19:20 +01:00
Juan RP
3f45f563be xbps-bin: syslog support, enabled by default. 2011-12-06 13:02: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
86f1f18571 libxbps: revamped trans states/cb to be more generic, not just for transactions. 2011-11-11 09:41:48 +01:00
Juan RP
662b5acc08 Implemented "New repository scheme and configuration file" from issue 16. 2011-11-07 20:28:35 +01:00
Juan RP
931a03b806 New configuration schemas changes, round 3.
struct xbps_handle::conffile has been renamed to confdir, and it now
expects the path to a directory, where the configuration files are
stored.

Change xbps-bin(8) and xbps-repo(8) along with its manpages to mention
that -C expects a directory.
2011-10-17 15:11:54 +02:00
Juan RP
08f7169eff New configuration scheme changes, round 2 (virtual pkgs).
- XBPS now expects to read individual virtual pkg settings from
  .plist files in PREFIX/etc/xbps/virtualpkg.d.wants.

This really implements the missing part in issue #12 in
googlecode: http://code.google.com/p/xbps/issues/detail?id=12
2011-10-17 14:24:30 +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
508f119bc9 Moved install transaction code to libxbps, see NEWS file. 2011-07-27 17:13:54 +02:00
Juan RP
74ce033d45 Don't initialize repository pool via xbps_init, instead in repository_pool public funcs.
That way we can avoid having to sync all remote repositories for any code
using xbps_init()!
2011-06-22 11:55:02 +02:00
Juan RP
6fe2c61c59 xbps_init: missing argument in a printf. 2011-06-22 10:53:20 +02:00
Juan RP
fbfa9c5960 New option in conffile to set libfetch's limit (seconds) in timed out connections. 2011-06-22 09:53:44 +02:00
Juan RP
ebae4fbfca xbps_init: fix logic. 2011-06-04 17:12:26 +02:00
Juan RP
5a355ed6d9 It's now possible to set rootdir, cachedir, and fetch caches in the conf file. 2011-06-04 17:08:44 +02:00
Juan RP
20c36d73ef xbps_init: don't panic if conf_dictionary cannot be internalized, just continue. 2011-06-04 15:51:32 +02:00
Juan RP
47e3a3f39b xbps_init: add a debug printf if repository array in conf file is empty. 2011-06-04 15:08:50 +02:00
Juan RP
36346a7ca0 xbps_init: add a debug printf. 2011-06-04 14:17:11 +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
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
afe0f3e2f0 Make the xbps_handle struct const internally. 2011-02-21 14:03:08 +01:00
Juan RP
22ae7aa2e8 Introduce struct xbps_handle and use it for xbps_init().
This structure sets up function callbacks for fetching files and
unpacking binary packages, as well as setting the debug boolean.

This way the affected functions (xbps_fetch_file() and
xbps_unpack_binary_pkg()) do not need to accept the fn cb pointers
and data as arguments.

Bump XBPS_RELVER.
2011-02-21 13:38:44 +01:00
Juan RP
5c7eaf2f92 xbps_warn_printf: fix previous and remove unused var. 2011-01-30 18:32:15 +01:00
Juan RP
42eb834e8d xbps_warn_printf: always print regardless of XBPS_FLAG_VERBOSE. 2011-01-30 18:31:36 +01:00
Juan RP
0cc4ba224e Update API documentation for recent changes.
--HG--
branch : progress_callback
2011-01-22 14:24:51 +01:00
Juan RP
984eae1578 Make xbps_fetch_file accept a callback to update its progress.
This also makes xbps_unpack_binary_pkg follow this convention by avoiding
static variables.

--HG--
branch : progress_callback
rename : bin/xbps-repo/util.c => bin/xbps-bin/util.c
2011-01-22 12:40:19 +01:00
Juan RP
8c2ccea435 WIP checkpoint for progress callbacks in the API.
At this moment I've only implemented the part for unpacking, other parts
will also use progress callbacks.

--HG--
branch : progress_callback
2011-01-21 17:16:58 +01:00
Juan RP
fdec663855 API clean up (part 2), plus misc changes and improvements.
- Rename regpkgs_dictionary to regpkgdb_dictionary to better describe what is is.
- Change some funcs in plist.c to return a boolean rather than int.
- Hide more internal funcs off the API.
- Simplify xbps_repository_update_pkg() and remove its second arg.
- Hide implementation details in xbps_repository_pool, now to iterate over the
  pool you have to use xbps_repository_pool_foreach and its struct
  repository_pool_index.
- Introduce xbps_{init,end}, to initialize/destroy some stuff in the library.
- Introduce xbps_dbg_printf to printf stuff for debugging purposes.
- xbps-{bin,repo}:  added -d arg to enable debugging output.
- Before checking if a config file needs to be installed or such, check that
  package contains the "conf_files" array.
- Remove obsolete dirs as well while updating packages.
- If transaction dictionary is ready remove the "missing_deps" array.

Bump XBPS_RELVER to 20101118.

--HG--
rename : lib/regpkgs_dictionary.c => lib/regpkgdb_dictionary.c
2010-11-19 13:40:13 +01:00