Commit Graph

463 Commits

Author SHA1 Message Date
Juan RP
5847a11570 xbps_fetch_file: remove local file if bigger than remote and refetch. 2011-06-23 00:06:50 +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
12d488ec47 xbps_repository_pool_init: return errno value if a repo sync fails. 2011-06-22 10:54:06 +02:00
Juan RP
6fe2c61c59 xbps_init: missing argument in a printf. 2011-06-22 10:53:20 +02:00
Juan RP
e9fa37bc2f xbps_repository_sync_index: preserve errno in error path and add debug printfs. 2011-06-22 10:52:46 +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
092c832e6c mkpath: indent some comments. 2011-06-21 10:43:52 +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
3bd48a8521 lib/dewey.c: minor cosmetic changes. 2011-06-14 11:25:28 +02:00
Juan RP
cb7b44bc13 Rename property in conf file for virtual packages to "virtual-packages". 2011-06-04 11:30:21 +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
b2840a3f16 plist_fetch: add some debugging printfs to know when network access is working. 2011-06-04 16:05:19 +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
51bee11bfa Switch xbps_cmpver() to use NetBSD's dewey code. 2011-06-04 15:42:50 +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
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
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
d9eb0341cd Some dead stores and build fixes reported by LLVM 2.9. 2011-04-07 12:24:20 +02:00
Juan RP
6a91c2894e xbps_unpack_binary_pkg: fix wrong path to metadata files! 2011-03-04 10:48:39 +01:00
Juan RP
0452c7c9dd Fix a dup'ed word. 2011-03-03 17:56:18 +01: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
2c644c6587 Treat pkgs with NULL or empty requiredby arrays as orphans. 2011-02-26 11:08:58 +01:00
Juan RP
0435772097 Fix chdir(2) path in previous. 2011-02-25 11:21:12 +01:00
Juan RP
ce24ff488c xbps_file_exec: if chroot(2) returns EPERM, don't error out and try chdir(2).
This makes possible to install a base system with fakeroot (of course
some things won't probably work fully).
2011-02-25 11:17:13 +01:00
Juan RP
9759a62e3f Do not printf a warning if remove(3) returns EEXIST/ENOTEMPTY/EBUSY. 2011-02-25 10:51:43 +01:00
Juan RP
0a6299318e Revert revision 581: "Inline some very common functions in the API."
Some compilers yet don't support fully the inline C99 keyword and
there's little benefit anyway.
2011-02-24 15:48:50 +01:00
Juan RP
17be7bab81 configure: misc compiler flags fixes.
- Don't use -Wp, some compilers don't understand it. Simply use -D__BLAH___.
- Check for -Wl,--export-dynamic and if that fails try -rdynamic.
2011-02-24 15:33:53 +01:00
Juan RP
a252df4a8b xbps_humanize_number: increase by one the output digits. 2011-02-24 10:46:10 +01:00
Juan RP
e4c24e5fea xbps_read_dict_from_archive_entry: handle all erros returned by zlib's inflate(). 2011-02-24 10:00:21 +01:00
Juan RP
7c6119427c While installing a pkg, remove files with wrong hash before unpacking. 2011-02-24 00:24:11 +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
d357dfed90 Inline some very common functions in the API. 2011-02-23 17:27:51 +01:00
Juan RP
8baad7b5da Simplify setting pkg state in transaction's dictionary. 2011-02-23 17:14:33 +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
15d164c70a xbps_repository_{install,update}_pkg: respect pkg state in regpkgdb. 2011-02-22 10:31:16 +01:00
Juan RP
511dbffa9e Simplify find_pkg_in_array(). 2011-02-21 23:21:53 +01:00
Juan RP
bdfa81c29d package_unpack.c: fix a comment. 2011-02-21 17:57:46 +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
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
078f9f1cda Fixed finally another real case when updating and replacing pkgs. 2011-02-18 16:39:42 +01:00
Juan RP
8b58b88a5f xbps_repository_{install,update}_pkg: fixed a stupid logic error. 2011-02-18 16:37:16 +01:00
Juan RP
032f993a53 xbps_repository_pool_init: do not fail to internalize all repos when the first one fails.
If the first registered repo couldn't be internalized, all other repositories
were also failing because it returned error, so simply skip them and return
error when all them cannot be internalized.
2011-02-17 09:24:57 +01:00
Juan RP
d5c2a3266f Rename the transaction object key to "transaction" rater than "trans-action". 2011-02-05 12:21:04 +01:00
Juan RP
8803bfd7d8 Move plist find/remove functions into its own files. 2011-02-05 12:06:03 +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
ec7549fa04 xbps_sort_pkg_deps: change an assertion into a real check. 2011-02-04 16:17:47 +01:00
Juan RP
097b50b3c2 Fix all warnings found by clang analyzer as reported by ojab in issue 3. 2011-02-03 17:49:43 +01:00
Juan RP
0a26497b50 xbps_repository_update_allpkgs: return ENOENT if regpkgdb dict cannot be internalized. 2011-02-03 09:34:38 +01:00
Juan RP
692caea1cd xbps_get_pkg_state_*: if state object is not available return EINVAL. 2011-02-02 09:53:56 +01:00
Juan RP
927d7e0c5d xbps_repository_find_pkg_deps: improve a debug printf. 2011-02-01 17:32:25 +01:00
Juan RP
0e38b649ff xbps_get_pkg_state_installed: if pkg dictionary is not found return ENOENT. 2011-02-01 17:30:59 +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
da607becf9 Make some xbps_warn_printf dependent of XBPS_FLAG_VERBOSE. 2011-01-30 18:38:16 +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
e04f167d09 xbps_repository_pool_foreach: use SIMPLEQ_FOREACH_SAFE. 2011-01-30 15:09:18 +01:00
Juan RP
bdd48de67d xbps_sort_pkg_deps: use TAILQ_FOREACH_SAFE. 2011-01-30 14:42:17 +01:00
Juan RP
2492d98d13 xbps_purge_pkg: chdir to rootdir, check that REMOVE file exists and is executable. 2011-01-30 12:49:55 +01:00
Juan RP
b6b3bd799b xbps_purge_pkg: execute the "purge" action in REMOVE script (if found).
This replaces code for removing all directories installed by the
package and instead let's the package do whatever is ok in the REMOVE
script by executing the "purge" action.
2011-01-30 11:32:46 +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
bb897da7b4 Fix an assertion. 2011-01-30 00:14:29 +01:00
Juan RP
de034c28f5 xbps_find_pkg_orphans: simplify even more. 2011-01-29 18:34:50 +01:00
Juan RP
5bbbb3c8fd xbps_find_pkg_in_*: search for virtual pkg before the real one. 2011-01-29 17:57:01 +01:00
Juan RP
8d6eab5ac1 xbps_remove_obsoletes: make xbps_printf conditionalized with XBPS_FLAG_VERBOSE. 2011-01-29 16:26:17 +01:00
Juan RP
d7bafff252 xbps_requiredby_pkg_{add,remove}: simplify and make them aware of virtual pkgs. 2011-01-29 12:29:30 +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
298305c1d5 Make some xbps_printf()s conditioned on XBPS_FLAG_VERBOSE. 2011-01-29 01:55:52 +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
6e26332a2e A really faster dependency sorting algorithm, 60% faster approx!
Benchmarks before and after the code for installing
"xorg gnome xbmc vlc firefox epdfview":

OLD
-----------------
real	0m1.844s
user	0m1.841s
sys	0m0.003s

NEW
-----------------
real	0m0.873s
user	0m0.868s
sys	0m0.004s
2011-01-28 19:47:05 +01:00
Juan RP
af5d3a0653 xbps_repository_find_pkg_deps: do not recurse more than MAX_DEPTH times, return ELOOP. 2011-01-28 12:12:47 +01:00
Juan RP
f7f3cfcb9c Performance improvements for xbps_find_pkg_in_dict_by_* and xbps_find_*_in_array(). 2011-01-28 12:11:43 +01:00
Juan RP
4438fd1183 xbps_repository_find_pkg_deps: simplify even more and remove dead code. 2011-01-27 21:54:55 +01:00
Juan RP
bebad82316 repository_finddeps.c: remove useless code. 2011-01-27 21:12:42 +01:00
Juan RP
c58107bd27 xbps_repository_find_pkg_deps: fix stupid error by reusing a var. 2011-01-27 21:02:56 +01:00
Juan RP
176f5e3e40 xbps_sort_pkg_deps: use xbps_check_is_installed_pkg_by_name(). 2011-01-27 20:54:23 +01:00
Juan RP
1cc45ee20f Fix two asserts. 2011-01-27 20:47:34 +01:00
Juan RP
8a7bfe6cda xbps_repository_find_pkg_deps: simplify and handle an error case. 2011-01-27 18:23:32 +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
93e1a0a22c Performance improvements for xbps_find_pkg_in_dict_by_{name,pattern} with virtual pkgs. 2011-01-27 15:50:50 +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
6e8e5b830e repository_register.c: fix doxygen @file mark. 2011-01-27 12:44:32 +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
41341af135 Shared code for xbps_find_{string,pkgname,pkgpattern}_in_array(). 2011-01-27 03:05:22 +01:00
Juan RP
22d67bcfb9 Improve comments for dependency sorting. 2011-01-26 18:57:29 +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
4b3b50c6ef xbps_check_is_installed_pkg: simplify. 2011-01-26 18:41:57 +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
ac6fe51340 xbps_repository_find_pkg_deps: some performance optimizations. 2011-01-25 18:09:27 +01:00
Juan RP
563b6446f4 xbps_repository_pool_find_pkg: remove a debug printf that bothers me. 2011-01-25 17:52:59 +01:00
Juan RP
35aa4b9951 xbps_fetch_file: memset the stat(2) struct before using it. 2011-01-25 17:49:24 +01:00
Juan RP
a685c9ee41 xbps_sort_pkg_deps: exit from the loop immediately if all pkgs were sorted. 2011-01-25 16:04:37 +01:00
Juan RP
a47d030851 xbps_sort_pkg_deps: optimize one more time, it is 5% faster approx. 2011-01-25 14:56:37 +01:00
Juan RP
be5ff1d934 Don't build code with _GNU_SOURCE, use _XOPEN_SOURCE=500 instead.
_GNU_SOURCE is only now for xbps_xasprintf() if vasprintf is found,
and only for <stdio.h>, it's unset immediately once the header is included.
2011-01-25 13:00:23 +01:00
Juan RP
81fa8da4ce Check for vasprintf() and add a replacement if it wasn't found. 2011-01-25 12:39:05 +01:00
Juan RP
4bba48a6a0 Rename repository.c to repository_register.c.
--HG--
rename : lib/repository.c => lib/repository_register.c
2011-01-25 11:25:38 +01:00
Juan RP
008573e1eb Sprinkle a couple of assert(3)ions. 2011-01-25 04:14:33 +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
72d82a3a26 Simplify and share common code in xbps_repository_{update,install}_pkg(). 2011-01-24 18:49:24 +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
f6ab3a28c3 libxbps: simplify package states code.
--HG--
branch : progress_callback
2011-01-22 18:00:31 +01:00
Juan RP
27c2ca3732 xbps_pkgpattern_match: remove a wrong memset(3) call.
--HG--
branch : progress_callback
2011-01-22 17:25:37 +01:00
Juan RP
ef25792f90 Simplify xbps_find_orphan_packages() by not using a temporary SIMPLEQUEU.
--HG--
branch : progress_callback
2011-01-22 17:08:49 +01:00
Juan RP
08d30043a3 lib/mkpath.c: don't document this file, it's included in the util group.
--HG--
branch : progress_callback
2011-01-22 16:38:52 +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
9611f3e412 xbps_unpack_binary_pkg: rename fn callback arg to be shorter.
--HG--
branch : progress_callback
2011-01-22 12:56:33 +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
ab857595d7 Check that return value of snprintf(3) is not negative, rather than only -1. 2011-01-21 00:32:46 +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
274c8c432b lib/Makefile: build libxbps with --export-dynamic. 2011-01-19 14:31:30 +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
e2b55c90be regpkgdb_dictionary.c: bump copyright year for previous changes. 2011-01-18 20:21:35 +01:00
Juan RP
9180bfce23 libxbps: regpkgdb: use a mutex for {inc,dec}rementing the refcnt. 2011-01-18 20:18:27 +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
6d7121c5bd xbps_repository_get_pkg_plist_dict: use xbps_repository_pool_find_pkg(). 2011-01-18 15:19:27 +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
1125963da8 libxbps: simplify the algorithm for sorting deps in the transaction.
Rather than using a SIMPLEQ to copy the package dictionary and later on
adding all items into the sorted array, just add the pkg dictionary
into the sorted array directly and removing it from the unsorted array.

This reduces memory usage and greatly sorts all packages that aren't
installed automatically in the correct order in the transaction.

Also added a large comment explaining how the algorithm works and
what it is supposed to do and when.
2011-01-17 17:17:02 +01:00
Juan RP
3c4b375ecf Fixed a test in config file handling that made all conf_files not properly detected. 2011-01-16 16:55:01 +01:00
Juan RP
de590b8457 lib/Makefile: build -Wno-error for included libfetch for now. 2011-01-15 13:37:16 +01:00
Juan RP
6051eb29ab Added another bunch of compiler warnings and fix code. 2011-01-15 11:59:44 +01:00
Juan RP
d9001adbad configure: added --silent option to hide compilation details. 2011-01-15 10:49:35 +01:00
Juan RP
33c1a33912 Make configure detect required libraries to link. 2011-01-14 00:30:49 +01:00
Juan RP
57af8f9ee0 xbps_repository_get_pkg_plist_dict: avoid uninitialized var. 2011-01-12 17:15:23 +01:00
Juan RP
2206b27037 Added "--with-external-libfetch" to build against external libfetch. 2011-01-12 17:06:53 +01:00
Juan RP
d307226ee7 xbps_unpack_binary_pkg: fix a memleak and make all error paths go to a single point. 2010-12-25 02:38:30 +01:00
Juan RP
71878669da libxbps: fix a memleak when removing obsolete files in pkg upgrades. 2010-12-25 02:37:25 +01:00
Juan RP
f9d0a639f2 xbps_repository_pool_init: don't loop forever if repo pkg-index.plist files cannot be internalized. 2010-12-19 17:46:32 +01:00
Juan RP
bc28aa77d8 xbps_fetch_file: set a 30seconds timeout. 2010-12-18 10:19:09 +01:00
Juan RP
d2f5535162 lib/plist: no need to check against NULL if prop_object_type() is used. 2010-12-03 06:36:05 +01:00
Juan RP
d2be842ce5 Fix and improve when there are missing deps in the transaction dictionary. 2010-11-23 23:17:04 +01:00
Juan RP
99f3d846de xbps_purge_pkg: if state is not XBPS_PKG_STATE_CONFIG_FILES, just return 0. 2010-11-21 14:34:49 +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
175b1abf8f xbps_purge_all_pkgs: no need to check for pkg state because xbps_purge_pkg() does it too. 2010-11-08 12:20:44 +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
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
ab10cc3b15 xbps_find_pkg_dict_installed: dictionary MUST be copied before calling
xbps_regpkgs_dictionary_release(), otherwise it will be NULL.

Found by executing this function without initializing regpkgdb.
2010-11-08 01:37:53 +01:00
Juan RP
ec7cdde1e0 Misc cleanups and performance improvements.
- There's no need to check rval for prop_dictionary_get_*, we are sure the
  objects are there at prop_dictionary_set_* time.
- Avoid two chdir(2) calls per INSTALL/REMOVE run.
- Avoid using access(2) to check for existence of INSTALL/REMOVE scripts,
  just try to run the executable directly and check for ENOENT.
2010-11-06 06:44:00 +01:00
Juan RP
f8629652da Make xbps_file_*_exec() always chroot if uid==0 and /bin/sh (+x, relative) exists. 2010-11-06 06:40:19 +01:00
Juan RP
74500381ff lib/Makefile: remove dup values. 2010-11-04 03:48:23 +01:00
Juan RP
99d38bf176 Rename some files in the library to better describe what they do.
--HG--
rename : lib/config_files.c => lib/package_config_files.c
rename : lib/configure.c => lib/package_configure.c
rename : lib/orphans.c => lib/package_orphans.c
rename : lib/purge.c => lib/package_purge.c
rename : lib/register.c => lib/package_register.c
rename : lib/remove.c => lib/package_remove.c
rename : lib/remove_obsoletes.c => lib/package_remove_obsoletes.c
rename : lib/requiredby.c => lib/package_requiredby.c
rename : lib/state.c => lib/package_state.c
rename : lib/unpack.c => lib/package_unpack.c
2010-11-03 20:08:33 +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
9c60862e0f Pass LDFLAGS after the objects when creating the sharedlib, otherwise
-Wl,--as-needed will think that zlib is not needed.
2010-11-02 07:40:14 +01:00
Juan RP
8051232e82 libxbps: xbps_repository_unregister(): in remote repositories, also
remove the pkg index file and its directory.
2010-10-29 09:10:41 +02:00
Juan RP
49a356df81 xbps_get_pkg_index_plist: fix a memleak. 2010-10-29 08:21:56 +02:00
Juan RP
c49bd80e20 fetch/ftp.c: fix a cast that caught clang via -Wcast-qual. 2010-10-27 00:17:08 +02:00
Juan RP
418ee6eec4 Remove empty dirs while removing obsolete files. 2010-10-27 00:15:59 +02:00
Juan RP
8534b79ffc Prepare for going-to-be-released 0.6.1.
Includes the following change:

* When replacing a package that is going to be updated in the transaction
   do not remove it, just overwrite its files and continue. The updated
   package will find that old files didn't match the SHA256 hash and will
   skip them. This solves the issue of new package updates requiring new
   dependencies with files that were previously stored in the old version.
   For example gtk+-2.20 containing gdk-pixbuf, and gtk+-2.22 requiring
   gdk-pixbuf externally.
2010-10-23 18:09:35 +02:00
Juan RP
bd37736d89 Import and merge libfetch-2.31 from NetBSD pkgsrc. 2010-06-02 23:44:25 +02:00
Juan RP
1bcf9de67a xbps_[gs]et_cachedir(): ensure we don't copy more than buffer's size including NUL. 2010-05-20 15:10:36 +02:00
Juan RP
3038fbed2d lib/repository_finddeps.c: change var names to be more descriptive, add
some more verbose messages.
2010-05-20 07:21:24 +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
2be6a7b1bc libxbps: if XBPS_FLAG_VERBOSE is set print to stdout some info about binary
packages found in repositories and its dependencies.
2010-05-18 23:04:14 +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
fed78b9d6f libxbps: bah do not ignore ENOENT when running INSTALL/REMOVE scripts. 2010-05-18 13:40: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
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
a79d7b5884 lib/Makefile: proplib sources need -Wno-stack-protector. 2010-05-11 13:37:21 +02:00
Juan RP
9fe20ccbc8 Also link libxbps to libpthread as it's required now. 2010-05-04 14:57:08 +02:00
Juan RP
af3a2788aa Provide stubs for htobe{32,64}() and be32toh() macros if they aren't defined on Linux.
Tested and verified by Jimmy on xbps@googlegroups.com.
2010-05-04 14:36:32 +02:00
Juan RP
af6949cc43 Apply the commit from portableproplib's git master:
commit b2975842aba26df9b9885ff56b2ff182eda06152
Author: Juan RP <xtraeme@gmail.com>
Date:   Thu Apr 29 18:23:15 2010 +0200

    Remove some dead code found by the LLVM's clang static analyzer.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100429162412-gq0on6wybpoaazgg
2010-04-29 18:24:12 +02:00
Juan RP
28f997bdf7 libxbps: fixed all warnings found by clang.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428213056-p1b7bh0llq8393r0
2010-04-28 23:30:56 +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
9efe430e7c portableproplib can now be built with -Wextra and -Werror, but still needs
-Wno-cast-qual and -Wno-unused-parameter.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100421090458-gh2f2soq8jz25c3x
2010-04-21 11:04:58 +02:00
Juan RP
4bef22e190 Add change from portableproplib's git master to fix a warning with -Wextra:
commit 1296cfff2dd84a09f973bd446a75d5b92001506d
Author: Juan RP <xtraeme@gmail.com>
Date:   Wed Apr 21 05:47:34 2010 +0200

    prop_object: add cast for -Wextra.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100421034857-oxkoa87srg5olsrx
2010-04-21 05:48:57 +02:00
Juan RP
ea0d37a104 Incorporate a commit from portableproplib's git master to fix two warnings:
commit 72e03f757660ed295f81315d871e51abe22df9dd
Author: Juan RP <xtraeme@gmail.com>
Date:   Wed Apr 21 05:07:53 2010 +0200

    Add a cast that fixes a warning in the new zlib code.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100421030905-ixl5tj2to573xnxz
2010-04-21 05:09:05 +02:00
Juan RP
19af2f4af4 xbps_read_dict_from_archive_entry: added support to uncompress plist files in archives.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100421030437-6ihj6lw9vcwy2csp
2010-04-21 05:04:37 +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
fa9d8c718a lib/register.c: add some DPRINTFs.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100313083102-cz4hwmd94uuh5awv
2010-03-13 09:31:02 +01:00
Juan RP
2daffcc768 Avoid endless loop while sorting dependencies due to missing packages.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100129034440-c1c9q0o5b0r1hhh2
2010-01-29 04:44:40 +01:00
Juan RP
df5b800366 Improve previous and only overwrite files while upgrading packages in the
unpack phase.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100128152108-vfs98fe3wvtort4s
2010-01-28 16:21:08 +01: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
920db08f5c lib/remove.c: bump copyright year for previous change.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100125072838-shechb5lff4y3zyk
2010-01-25 08:28:38 +01:00
Juan RP
1c4d43306a xbps-bin(8): if -f is set, remove files and configuration files even
if its hash doesn't match for the remove and purge targets respectively.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100125070948-841kw2r4knz2793e
2010-01-25 08:09:48 +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
0ebff2c636 lib/plist.c: fix an assertion.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100125011444-xzvixcod832ione4
2010-01-25 02:14:44 +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
49134b3e62 xbps_find_orphan_packages: improve doxygen documentation.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100123052934-bq05edsd09x3pgds
2010-01-23 06:29:34 +01:00
Juan RP
97266fa921 lib/unpack.c: improve doxygen description.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100123051605-ojcxt8uz91hg1h4k
2010-01-23 06:16:05 +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
4b0c08ebcf xbps_unpack_binary_pkg: multiple fixes and improvements.
- Don't write any archive entry to disk unless the package metadata
  plist files are found.
- Always check for the package metadata plist files in the first 4
  entries, if they aren't found stop the unpacking... invalid archive.
- Don't check for removing INSTALL/REMOVE scripts on each iteration when
  extracting, just check it once before the loop.
- Add doxygen comments and related stuff.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100122225639-wameh8ls94bkm68h
2010-01-22 23:56:39 +01:00
Juan RP
65f241a081 xbps_repository_get_pkg_plist_dict_from_url: stop processing the archive
once that 4 entries are checked for the plist file.

Processing 6 entries is too much, we can be sure that plist file will
always be in the first 4 entries.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100122225433-u440x01bf8io3vd3
2010-01-22 23:54:33 +01:00