Commit Graph

194 Commits

Author SHA1 Message Date
Juan RP
104bec27e5 libxbps: handle the case to replace a vpkg with a pkg with same name.
This for example fixes reinstalling jpeg and libjpeg-turbo multiple
times. Also if the "automatic-install" obj is in the pkg to be
replaced, copy it to the new pkg to be preserved.

Bumped XBPS_API_VERSION.
2011-10-16 10:28:03 +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
c3395a2f3b Bump XBPS_API_VERSION for last libxbps change. 2011-10-12 09:28:50 +02:00
Juan RP
3c61de45aa xbps_api.h: fix xbps_transaction_cb_data::repourl descr. 2011-08-18 10:42:37 +02:00
Juan RP
ba5913cbb9 libxbps: [unpack] only extract files if they have been modified. 2011-08-01 12:35:47 +02:00
Juan RP
2857214afa libxbps: improve returned errnos for repository API functions.
- xbps_repository_update_packages: return ENOENT if regpkgdb is NULL
  (no packages currently registered).
- xbps_repository_update_packages: return EEXIST if no updates are
  available.
- xbps_repository_pool: return ENOTSUP if no repositories were
  registered.
- make xbps-{bin,repo} handle ENOTSUP errors.
2011-07-29 11:17:34 +02:00
Juan RP
5e390b8839 Introduce new pkg state: half-unpacked.
Packages in this state shall be re-installed and re-unpacked because its
files weren't unpacked properly.
2011-07-28 16:25:01 +02:00
Juan RP
6f783389dd Share transaction callbacks for xbps-{bin,repo}, reposync cb support. 2011-07-28 09:25:30 +02:00
Juan RP
d7d077a377 xbps_api.h: fixed some comments. 2011-07-27 23:18:25 +02:00
Juan RP
508f119bc9 Moved install transaction code to libxbps, see NEWS file. 2011-07-27 17:13:54 +02:00
Juan RP
e26b6e23e6 xbps-bin(8): make 'show{,-deps,-revdeps}' target work with virtual pkgs. 2011-07-25 16:40:34 +02:00
Juan RP
59ddc58187 xbps_api.h: fix descr in xbps_cmpver(). 2011-07-22 18:05:21 +02:00
Juan RP
17829cd6b4 libxbps: add xbps_find_virtualpkg_in_array_by_{name,pattern} and use it. 2011-07-15 18:45:38 +02:00
Juan RP
33d6d2e166 libxbps: API/ABI break changes to fix issues with virtual packages.
Please see the NEWS file for info about this commit.
2011-07-15 18:22:58 +02:00
Juan RP
f6476e210c libxbps: do not loop forever on errors while syncing a remote repo. 2011-07-14 00:13:25 +02:00
Juan RP
0a2abb3f3d xbps-repo(8): 'search' target is now case insensitive.
Along with this change, compat code has been added (from NetBSD)
for systems that don't have it. The compat code has been reorganized
to be in a common place and its prototypes in compat.h.

The configure scripts checks if strcasestr() is available, and
uses compat code if not found.

This fixes issue #2 on github.com/vanilla/xbps.
2011-07-09 10:50:44 +02:00
Juan RP
f897ffa431 Do not redefine strlc{at,py} prototypes. 2011-06-29 12:16:04 +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
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
0bc77f86fa xbps_pkg_epoch is not supported anymore with NetBSD's dewey. 2011-06-14 11:26:00 +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
2d6140f65b Rename: xbps_read_dict_from_archive_entry() -> xbps_dictionary_from_archive_entry(). 2011-06-02 09:54:59 +02:00
Juan RP
841c9e2d51 API/ABI break for June 2011.
Rename some functions to reflect its description a bit better.

--HG--
rename : lib/repository_plist.c => lib/plist_fetch.c
2011-06-01 09:37:32 +02:00
Juan RP
cfa637db48 Repository package index format 1.2.
The pkg index now stores all package objects from props.plist, so that
xbps-repo(8) doesn't have to access the target binpkg anymore.
2011-05-27 17:32:42 +02:00
Juan RP
1f998e246f Bump XBPS_RELVER for previous change. 2011-04-11 15:18:44 +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
7e4118a6e2 Added xbps_get_file_hash_from_dict(), returns the sha256 string obj in a dictionary. 2011-02-24 00:21:40 +01:00
Juan RP
a306cebc96 xbps_set_pkg_state_installed: added two new optional arguments: version and pkgver.
This can be used to avoid some rare cases where the pkg dictionary is regpkgdb
is in a state where code can be faulty if those objects are not found.
2011-02-22 11:09:39 +01:00
Juan RP
c4db906a1f xbps_api.h: fix some comments. 2011-02-21 18:00:44 +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
8d5a1ad0a3 xbps_api_impl.h: remove function name arguments in prototypes. 2011-02-21 14:04:57 +01:00
Juan RP
afe0f3e2f0 Make the xbps_handle struct const internally. 2011-02-21 14:03:08 +01:00
Juan RP
7ddd409b90 xbps_api.h: fix a comment. 2011-02-21 13:42:36 +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
078f9f1cda Fixed finally another real case when updating and replacing pkgs. 2011-02-18 16:39:42 +01:00
Juan RP
f4cdbaf17d Move xbps_read_dict_from_archive_entry() and friends into its own file. 2011-02-05 11:57:13 +01:00
Juan RP
de296d8192 Added the concept of package properties in the API.
See the NEWS file and xbps-bin(8) for more information.
2011-02-05 11:25:04 +01:00
Juan RP
fdc496e8f1 Added xbps_repository_pkg_replaces() to handle pkg "replaces" in the transaction.
The frontend (in that case xbps-bin(8)) is only responsible to remove
those packages that have the "trans-action" string object set to "remove".
2011-02-01 01:21:54 +01:00
Juan RP
ec15af17a0 Update queue.h with latest NetBSD's version. 2011-01-30 15:08:57 +01:00
Juan RP
7da33469cc xbps-bin(8): added -R option to recursively remove pkgs that were instaled automatically. 2011-01-30 08:08:34 +01:00
Juan RP
0277d5b103 Bump XBPS_RELVER for today's changes. 2011-01-29 17:16:25 +01:00
Juan RP
241751f1b7 Added three new helper functions to the API.
xbps_find_pkg_in_array_by_name
xbps_find_pkg_in_array_by_pattern
xbps_remove_pkgname_from_array
2011-01-29 12:28:23 +01:00
Juan RP
463d182c49 When sorting packages also look for virtual packages.
A new function xbps_find_virtual_pkg_in_dict() has been made public
to the API to make this find duplicate packages in the transaction
when updating packages.
2011-01-28 20:56:28 +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
1c21a98545 Rename some symbols in repository_plist.c.
xbps_repository_get_pkg_plist_dict_from_url -> xbps_repository_plist_find_pkg_dict_from_url
xbps_repository_get_pkg_plist_dict -> xbps_repository_plist_find_pkg_dict
2011-01-27 13:53:33 +01:00
Juan RP
e4259c2889 xbps_api.h: fix xbps_register_pkg() doc. 2011-01-27 13:27:26 +01:00
Juan RP
69512d4da7 Rename xbps_find_pkg_from_plist to xbps_find_pkg_dict_from_plist_by_name. 2011-01-27 12:41:49 +01:00
Juan RP
26701d3bf3 Rename a few symbols for clarity.
xbps_check_is_installed_pkg -> xbps_check_is_installed_pkg_by_pattern
xbps_check_is_installed_pkgname -> xbps_check_is_installed_pkg_by_name
xbps_check_is_repo_string_remote -> xbps_check_is_remote_uri_remote
2011-01-27 12:34:13 +01:00
Juan RP
628a6cebf7 Rename xbps_find_orphan_packages() to xbps_find_pkg_orphans(). 2011-01-27 12:19:05 +01:00
Juan RP
f06a605854 Implemented support for virtual packages.
The patch adds 150 lines approximately. It is implemented by modifying
xbps_find_pkg_in_dict_by_name() and xbps_find_pkg_in_dict_by_pattern().

When no dictionary is returned if tries to find a virtual package by
looking at the "provides" array object, if found.
2011-01-26 18:05:43 +01:00
Juan RP
082efc3535 Added xbps_callback_array_iter() and use it in xbps-bin to list missing pkgdeps. 2011-01-25 02:55:34 +01:00
Juan RP
61fbf17bb9 xbps_api.h: fix some comments. 2011-01-25 02:11:45 +01:00
Juan RP
0bb0838982 Start moving code from repository_find* to transaction_*.
--HG--
rename : lib/sortdeps.c => lib/transaction_sortdeps.c
2011-01-24 16:55:58 +01:00
Juan RP
7d3e17b86b Document xbps_humanize_number() in the API.
--HG--
branch : progress_callback
2011-01-22 14:37:07 +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
84b578b0e4 libxbps: modify xbps_get_binpkg_repo_uri() to accept repository URL as 2nd arg. 2011-01-20 16:41:49 +01:00
Juan RP
6f8b2ca33a libxbps: simplify how configuration files are handled, use cached values if possible. 2011-01-20 02:55:40 +01:00
Juan RP
3a303755c7 xbps_api.h: fix API comments for refcnts. 2011-01-19 11:32:20 +01:00
Juan RP
efea94bec6 Fixed API documentation comments for doxygen. 2011-01-19 00:31:22 +01:00
Juan RP
2adaf610e7 libxbps: xbps_yesno/noyes() are only used in xbps-bin(8), remove from API. 2011-01-18 23:45:12 +01:00
Juan RP
992e8c6a14 libxbps::xbps_humanize_number(): use common values and hide implementation details from API.
So now its prototype is the following:

int xbps_humanize_number(char *buf, int64_t bytes)

It is a wrapper around NetBSD's humanize_number(3) which uses 6 digits for max
length, HN_AUTOSCALE and HN_NOSPACE|HN_DECIMAL. All users have been updated.
2011-01-18 23:10:07 +01:00
Juan RP
fe15380e1b libxbps: modify the API, new func xbps_get_binpkg_repo_uri().
This function replaces xbps_repository_get_path_from_pkg_dict() and
xbps_get_binpkg_local_path(). It takes a pkg dictionary as returned
by a repository pkg index or a transaction dictionary and returns
a string with the full path to the binary pkg, either in local
repos, cachedir or remote repos.

Update all code to use this function... sorry I broke ABI compatiblity.
2011-01-18 18:21:55 +01:00
Juan RP
503afdd48d libxbps: extend the API, new func: xbps_repository_pool_find_pkg.
prop_dictionary_t xbps_repository_pool_find_pkg(const char *pkg, bool bypattern, bool best)

This function iterates over the repository pool and returns a pkg
dictionary matching its pkgname if "bypattern" is false, otherwise
if "pkg" matches the pkgdep pattern. If "best" is true, it will look
in all repos and will return the newer version, otherwise the first one
that matches the arguments specified.

With this addition supporting many small registered repos is cheap, because
it checks by-package rather than by-package-list. This also helped to removed
some duplicated code and fix some rare bugs.

Bump XBPS_RELVER to 20110118.
2011-01-18 14:44:39 +01:00
Juan RP
3482e68491 configure: make symbol visibility dependent in the configure test, misc changes. 2011-01-15 12:21:38 +01:00
Juan RP
2401e72b8a Remove DPRINTF macro, unused. 2010-12-03 17:30:02 +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
Juan RP
ffc255b715 Starting to clean up the public API, move private stuff into xbps_api_impl.h. 2010-11-13 03:18:58 +01:00
Juan RP
3b931475c0 Make xbps_read_dict_from_archive_entry() private to libxbps, as it's only used internally. 2010-11-10 15:08:21 +01:00
Juan RP
0584c01088 Better describe xbps_find_pkg_from_plist(). 2010-11-08 11:49:29 +01:00
Juan RP
c3afb4f4fb New function: xbps_get_pkg_dict_from_metadata_plist.
This function returns and internalized dictionary from a package's metadata
plist file as specified by its arguments.

Update all code to use it where appropiate.
2010-11-08 03:14:41 +01:00
Juan RP
25ebcd53f8 xbps_api.h: update comments for @private funcs. 2010-11-08 02:12:03 +01:00
Juan RP
679833156a Always release the object dictionary returned by xbps_find_pkg_dict_installed().
Document this in the public API header and update all code accordingly.
2010-11-08 02:02:35 +01:00
Juan RP
756a5ec654 xbps_api.h: improve description for some defs. 2010-11-08 00:50:19 +01:00
Juan RP
8ef8d86c12 Some changes for the XBPS libfetch's frontend code.
1) Raise the cache connection settings to more sane defaults (8->6, 16->2).
2) Introduce xbps_fetch_unset_cache_connection() to drop the caches.
2010-11-03 12:23:57 +01:00
Juan RP
d64815403e Increment XBPS_RELVER for 0.6.1. 2010-10-23 18:12:54 +02:00
Juan RP
4b8f85382e Bump XBPS_RELVER for changes that will go to 0.6.0. 2010-06-02 23:50:44 +02:00
Juan RP
eb645d2974 xbps_api.h: do not rely on sys/cdefs.h, fix up some comments. 2010-05-20 04:49:53 +02:00
Juan RP
8f20f4c0c6 libxbps: use OpenSSL SHA256, 5x faster xbps_get_file_hash() implementation.
* libxbps: improved xbps_get_file_hash() to mmap(2) rather than read(2)
  the file we have to process. With mmap'ed files the hash can be
  processed 5x faster than before, or even more in some cases.

* libxbps: switch to OpenSSL SHA256 implementation and remove the one
  previously used. It's faster and OpenSSL is required for libfetch so
  there is not point in using it.
2010-05-20 02:43:56 +02:00
Juan RP
f888b582f9 Added a configure script to emulate GNU autoconf and related changes.
Changes included in this set:

 * Added strlcat() and strlcpy() from OpenBSD, always use them if the
   system does not have them built in.
 * Changed an array of PATH_MAX size allocated in the stack, to a dynamically
   allocated buffer from heap. This should reduce memory usage a bit.
 * Simplify code that implemented a homegrown realpath(3) implementation,
   simply use realpath(3).
 * If compiler supports -fstack-protector, build all code with
   -D_FORTIFY_SOURCE=2 and --param ssp-buffer-size=1 so that all
   buffers are protected.
2010-05-19 22:38:27 +02:00
Juan RP
c4e9d86630 libxbps::xbps_remove_obsoletes(): reset a var to 0 in non fatal errors! 2010-05-18 15:33:27 +02:00
Juan RP
bb220904b7 Bump XBPS_RELVER. 2010-05-18 13:41:51 +02:00
Juan RP
76ca32e76f libxbps: some random bugfixes.
* libxbps: while running INSTALL/REMOVE scripts, do not fail if a script
  returns ENOENT but the script exists; that means the script did not match
  the expected action on its switch statement and the fact can be simply
  ignored.

* libxbps: while upgrading packages and searching for obsolete files,
  do not remove the files that did not match previous SHA256 hash. Also,
  only remove obsolete dangling symlinks.
2010-05-18 07:46:27 +02:00
Juan RP
e22df5580b Bump XBPS_RELVER for last change. 2010-05-11 13:47:14 +02:00
Juan RP
17b7651137 libxbps: change the epoch char to ':' to differentiate the starting char in pkgname.
Added xbps_get_pkg_epoch(), to get the epoch version string.
2010-05-11 13:38:35 +02:00
Juan RP
b77bebe03a xbps_repository_register(): if repository already exists return EEXIST.
Bump XBPS_RELVER to 20100427.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100427160125-3vid17cb7fy4v3gd
2010-04-27 18:01:25 +02:00
Juan RP
9d4f44b776 Bump XBPS_RELVER to 20100420 for compressed gzip plist files support.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100420130449-wym9iuth418ysehp
2010-04-20 15:04:49 +02:00
Juan RP
6256b34ccc Some changes that will appear in 0.5.0:
* Add proplib-0.4.1 source and use it in XBPS. This is to avoid
   an external dependency, so that we depend on the features of the
   internal library. This also means that proplib is not required anymore.

 * Added support to read/write gzip compressed plists by default, thanks
   to proplib-0.4 that gained new functionality.

That means that from now, XBPS will be able to write compressed gzip
plist files for all metadata related work. This will vastly reduce
bandwidth required for fetching remote repo's pkg index file and
binary packages.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100420122238-zcb85rudt9p34e10
2010-04-20 14:22:38 +02:00
Juan RP
61dde1ac02 Always overwrite files while unpacking, this makes the "essential" obj obsolete.
This helps to catch upgrade problems and simplifies some parts of the code.
Bumped XBPS_RELVER because xbps_remove_pkg() has been changed.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100128150850-gcs93su38t6moydn
2010-01-28 16:08:50 +01:00
Juan RP
17d87b3559 Repair upgrades of preserve packages, i.e kernel.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100125052754-6xri8lfmykhof5dz
2010-01-25 06:27:54 +01:00
Juan RP
088baa7699 Add defs for default fetch cache connection limits and use them in
xbps_fetch_cache_connection() if 0 is passed as argument.

xbps-bin: enable fetch cached connection when downloading binpkgs.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100124153156-4updprik11nwi7c1
2010-01-24 16:31:56 +01:00
Juan RP
801785cbab Add xbps_fetch_set_cache_connection() to set libfetch's cache connection limits.
Use it in xbps_fetch_file(), by default set with 8 and 16.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100124144829-hqsr2bl6uflf0nhu
2010-01-24 15:48:29 +01:00
Juan RP
03e8fa53d9 Merge libfetch-2.30 from NetBSD's pkgsrc.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100124144753-ni487x8m7r05847b
2010-01-24 15:47:53 +01:00
Juan RP
a0b5e9e83a Rework Makefiles one more time.
- use printf to print commands rather than echo, which it may not have
  support for escape sequences (-e).
- Remove DESTDIR from SBINDIR, MANDIR, LIBDIR and INCLUDEDIR so that
  you can override it.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100124125958-8mscedj5ntf288jd
2010-01-24 13:59:58 +01:00
Juan RP
823fe6d67c Don't export xbps_get_remote_repo_string() to the API, it's only
used internally in the library.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100123051334-8ndutg9gqfljff3p
2010-01-23 06:13:34 +01:00
Juan RP
31f821669f Add infrastructure changes to build the API documentation.
doxygen and graphviz are required. It's disabled by default, use
the BUILD_API_DOCS make(1) argument to enable it.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100123013719-pkk3a3823cx09v8l
2010-01-23 02:37:19 +01:00
Juan RP
dac80a3fa2 libxbps: improve doxygen documentation, still not finished.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100122225955-8jd0006rtgjnvl13
2010-01-22 23:59:55 +01:00
Juan RP
c0b280c118 Mega-commit to document the API with doxygen.
Some changes were made to the API when making the documentation:

- A few exported functions are now hidden, because they were only used
  internally in the library.
- A few exported symbols were renamed to document them better than
  previously.
- Cosmetic changes all along the way, as well as some fixes here and there.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100121021019-onbsivlrhdb7t3ou
2010-01-21 03:10:19 +01:00