Commit Graph

113 Commits

Author SHA1 Message Date
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
Juan RP
61d2ea8896 Rework Makefile files, fully parallel builds are now possible.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100118201826-q2zsyooicxi7lcfm
2010-01-18 21:18:26 +01:00
Juan RP
e11a1fe651 xbps_unpack_binary_pkg: fixed some bugs while upgrading essential pkgs.
* A package failed to be upgraded properly if current pkg contained
  INSTALL/REMOVE scripts, while the new one didn't have any of them.
  Fixed this by always removing current scripts if they exist.

* Essential pkgs are never removed (they are replaced) so the pre remove
  action target was never called, now it all works properly.

Bumped XBPS_RELVER because I consider these bugs so important.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100118184932-pdsb0djvf0swylm3
2010-01-18 19:49:32 +01:00
Juan RP
952e265b8f xbps_repository_pool_init: fix memleaks in error paths, found by cppcheck.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100117232650-qkg4zh4blx2mhy3d
2010-01-18 00:26:50 +01:00
Juan RP
a165d20193 Error and warning messages should go to stderr, make it so.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100115141916-tpg2rga1i4pm42kj
2010-01-15 15:19:16 +01:00
Juan RP
d2a093a401 xbps_repository_install_pkg: don't forget to release repository pool stuff.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100114175814-0bin80brsh13swbj
2010-01-14 18:58:14 +01:00
Juan RP
d8a025a56a xbps_repository_install_pkg: before adding pkg into the transaction,
check that it wasn't added before.

This change fixes and endless loop while doing the following:

$ xbps-bin install libXext libX11

where libX11 is a dependency of libXext and was already queued.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100114125713-o9vxzayz1tnhlt96
2010-01-14 13:57:13 +01:00
Juan RP
023841b060 Implemented blueprint 'install-pkg-by-pkgmatch' as specified in
https://blueprints.launchpad.net/xbps/+spec/install-pkg-by-pkgmatch

The implementation works as expected, it was easier that I thought.
Bump XBPS_RELVER because the API was changed slightly.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100114011431-xv5q6bgahm6v9dbq
2010-01-14 02:14:31 +01:00
Juan RP
15be7b43a4 xbps_pkgmatch: before checking pattern with csh_match(), try to see if
a full match with strcmp() is enough.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100114000042-ge4iajc9jownixhe
2010-01-14 01:00:42 +01:00
Juan RP
05bad9c0d5 xbps_remove_pkg: fix a memleak, thanks valgrind.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100113171003-aiome0xxe5l1f96a
2010-01-13 18:10:03 +01:00
Juan RP
3d3c92dcbc Install shlib with 755 perms to match what the world does.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100113155721-c8fb2cg7jfu30mp8
2010-01-13 16:57:21 +01:00
Juan RP
e404632f7e Sync fetch code with libfetch-2.27.
joerg@netbsd libfetch-2.27:
The connection sharing didn't handle the case of active transfers
correctly and tried to close the connection in that case (PR 42607).
Correctly check if there is a transfer going on and just leave the
connection alone in that case.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100111192421-5fddbsek3ayi9wm8
2010-01-11 20:24:21 +01:00
Juan RP
ec907d0646 Restructure the Makefiles, INET6 and SSL support in libfetch is now
mandatory, build executables as PIE objects.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100106101556-tqzwk80xpp0iz20t
2010-01-06 11:15:56 +01:00
Juan RP
d55391e2e9 Cleaned up the Makefiles, improve README about what's required.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091228151958-ehx17nupq3uckhhg
2009-12-28 16:19:58 +01:00
Juan RP
4be79d4535 xbps_register_pkg: if automatic-install obj is there, don't overwrite its value.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091224003242-9twye4isotebbips
2009-12-24 01:32:42 +01:00
Juan RP
7eea0f8e8e xbps-bin(8): implemented Launchpad blueprint "arbitrary-pkgname-args".
See https://blueprints.launchpad.net/xbps/+spec/arbitrary-pkgname-args.

The install, update and remove targets now accept a list of package
names that will be processed.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091222113736-0dawl4whvtdi5dj3
2009-12-22 12:37:36 +01:00
Juan RP
009c2131fc xbps_yesno/noyes: change the funcs to only accept "yes" or "no"
(case insensitive) answers rather than the short ones.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091222112759-0mnzjt3qcwp45ugn
2009-12-22 12:27:59 +01:00
Juan RP
6e863cbf45 lib/fetch/Makefile: ignore fstack-protector warnings.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091218122139-g4ljwb50cvnr8alj
2009-12-18 13:21:39 +01:00
Juan RP
f89e128a81 repository_sync_index.c: add missing sys/stat.h.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091218122054-bm5uchhrmubnfb0m
2009-12-18 13:20:54 +01:00
Juan RP
279219a348 xbps_unpack_binary_pkg: set INSTALL/REMOVE perms to 0750.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091211095846-kwszryu1wlho39eq
2009-12-11 10:58:46 +01:00
Juan RP
6c2a648510 repository_plist.c: fix lp bug #494905 "xbps build failure on x86_64".
fetchIO_read returns ssize_t not int, applied patch from submitter.
Thanks.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091210081328-cxkzuxjapaven6a3
2009-12-10 09:13:28 +01:00
Juan RP
eb885bbcc2 When executing the INSTALL/REMOVE scripts, always pass the UPDATE
value to them.

Bump XBPS_RELVER to 20091209.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091209151435-1yy9f7k2880tswz7
2009-12-09 16:14:35 +01:00
Juan RP
026dc6dbd9 xbps_unpack_binary_pkg: bail out if required metadata plist files aren't
found after processing 6 entries from the archive.

This to detect non-valid XBPS binary packages.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091207062422-fnwx9n0miq1nwadt
2009-12-07 07:24:22 +01:00
Juan RP
972af411d1 libxbps: share code for removing pkg files in remove.c and purge.c.
A new function has been created, xbps_remove_pkg_files() that accepts
a dictionary internalized from files.plist and a key to remove
links, dirs, files and conf_files.

As result of this, now when purging a package those directories that
were used in configuration files will also be removed if they are empty.

Bump XBPS_RELVER to 20091207.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091207053006-egw65u6y1jcuraje
2009-12-07 06:30:06 +01:00
Juan RP
f5744b0d3d xbps_remove_pkg: when removing dirs there is no need to look for
the "keep" obj anymore.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091207042711-g3raluagagj9b4au
2009-12-07 05:27:11 +01:00
Juan RP
b03a18ff84 xbps_unpack_binary_pkg: removed 2nd bool argument, look for a preserve object
to not remove files in removal or upgrades.

Bump XBPS_RELVER to 20091202.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091202053103-uby6hwu313pieafa
2009-12-02 06:31:03 +01:00
Juan RP
94bb169c88 Rename lib/repository_plist.c exported functions.
xbps_get_path_from_pkg_dict_repo -> xbps_repository_get_path_from_pkg_dict
xbps_get_pkg_plist_dict_from_repo -> xbps_repository_get_pkg_plist_dict
xbps_get_pkg_plist_dict_from_url -> xbps_repository_get_pkg_plist_dict_from_url

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091130113538-bji65cydf3bkwxkw
2009-11-30 12:35:38 +01:00
Juan RP
d90a248244 Rename struct repository_data to repository_pool.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091130112404-mlrt6x08thdvmrsn
2009-11-30 12:24:04 +01:00
Juan RP
91aeac4dad Rename some function from lib/repository* with more meaningful names.
xbps_unregister_repository() -> xbps_repository_register()
xbps_register_repository() -> xbps_repository_unregister()
xbps_find_deps_in_pkg() -> xbps_repository_find_pkg_deps()
xbps_prepare_pkg() -> xbps_repository_install_pkg()
xbps_find_new_pkg() -> xbps_repository_update_pkg()
xbps_find_new_packages() -> xbps_repository_update_allpkgs()
xbps_get_pkg_props() -> xbps_repository_get_transaction_dict()

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091130110846-5uaqxdhfo0kl0cqd
2009-11-30 12:08:46 +01:00
Juan RP
e4cda0e9cc Rename lib/sync_remote_pkgidx.c to repository_sync_index.c.
xbps_sync_repository_pkg_index() renamed to xbps_repository_sync_pkg_index().

--HG--
rename : lib/sync_remote_pkgidx.c => lib/repository_sync_index.c
extra : convert_revision : xtraeme%40gmail.com-20091130105325-75rr2xm1zpi8bjwh
2009-11-30 11:53:25 +01:00
Juan RP
7996aeba3f Rename lib/depends.c to repository_finddeps.c and lib/findpkg.c to
repository_findpkg.c.

--HG--
rename : lib/depends.c => lib/repository_finddeps.c
rename : lib/findpkg.c => lib/repository_findpkg.c
extra : convert_revision : xtraeme%40gmail.com-20091130103814-25tr08vkc73cqutu
2009-11-30 11:38:14 +01:00
Juan RP
45f1d7b70a xbps_sort_pkg_deps: add debugging, use xbps_pkgdep_match().
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091129045327-x2y95weqecbon4l4
2009-11-29 05:53:27 +01:00
Juan RP
bd9b545fc9 xbps_find_pkg_repo_deps: check if current pkg version in repo is
enough to satisfy the required rundep for a pkg!

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091129045232-ext4zxqrtsmbbqku
2009-11-29 05:52:32 +01:00
Juan RP
1a5d19dca2 Fix and improve how missing pkg dependencies are handled from repos.
- Use an array of strings to store the pkgdeps.
- While adding a missing pkgdep, check if it's already in the queue and
  new required version is greater, in that case replace with new one.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091129021735-5dqfucofny8slks2
2009-11-29 03:17:35 +01:00
Juan RP
a85073f6e8 xbps-repo: also print binpkg compression type in the show target.
Now it looks like:

$ xbps-repo show xbps-devel
Fetching info from: /storage/xbps/packages
Filename: xbps-devel-20091128.i686.xbps (size: 69K)
SHA256: 2c54a61fbd128097692edc19a7c17bfb10d93b3f055b04171cd1e4d97cde79df
Compression type: xz
Package: xbps-devel
Installed size: 216K
Maintainer: Juan RP [xtraeme@gmail.com]
Architecture: i686
Version: 20091128
Description: The XBPS package system (development branch)
 The XBPS package system. A new, fast, from scratch and simple
 binary package manager. This packages includes code from a development
 branch available from https://launchpad.net/xbps
$

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128051134-qzqqnwd76tcxgxb0
2009-11-28 06:11:34 +01:00
Juan RP
88ba635780 Split unpack.c config files and remove obsoletes code into its own files.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128044321-6kmhrrxggv2h681w
2009-11-28 05:43:21 +01:00
Juan RP
f3d2481c31 xbps-repo: if fetching info from remote repo for the 'show' and 'show-files'
targets and the binary package exists in cachedir, use it.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128022129-y6y2tr0vtvy2w745
2009-11-28 03:21:29 +01:00
Juan RP
21bea723f4 xbps_sync_repository_pkg_index: update comments.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128015352-2rdqhdod9r5fe1t1
2009-11-28 02:53:52 +01:00
Juan RP
e652de8d5a libxbps: remove unused xbps_check_pkg_file_hash().
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128015121-wxiy8y0ift5ykrdm
2009-11-28 02:51:21 +01:00
Juan RP
bf7ca100f6 xbps_unpack_binary_pkg: cosmetic changes.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128014936-0k9pmxox7igtlfmn
2009-11-28 02:49:36 +01:00
Juan RP
494504dbec Added support for a cachedir to store downloaded binpkgs.
libxbps:
 * Added xbps_set_cachedir() and xbps_get_cachedir(). By default it's
   set to /var/cache/xbps if not specified and it's always relative
   to the root directory.
 * Move mkpath() code from sync_remote_pkgidc.c into its own file mkpath.c
   to use it in another parts of the code.
 * Added xbps_get_binpkg_local_path(), that returns the local path to
   a binary package file, stored in cachedir or local repo.
 * Remote pkg index files are now stored directly in metadir/repodir,
   skipping the arch directory because binpkgs are now in cachedir.

xbps-bin:
 * Added -c flag to set the cachedir.
 * Check sha256 hashes in the download stage so that it can check
   a downloaded binpkg immediately once is stored.
 * If a binpkg doesn't match the hash it will be refetched.

Bump XBPS_RELVER to 20091128.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128013841-kkcvk07lsqdr26w8
2009-11-28 02:38:41 +01:00
Juan RP
0d0e6d06b1 xbps_repository_pool_init: if unexistent repos are registered,
ignore them but do not report any error.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091127005130-ut5dslafwnrg2pye
2009-11-27 01:51:30 +01:00
Juan RP
0173a28aa2 xbps_repository_pool_init: ignore invalid repositories if always there
is one that is working, otherwise report an error.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126204146-ikfwi8zvag1s3446
2009-11-26 21:41:46 +01:00
Juan RP
30fc7b050a xbps_find_pkg_installed_from_plist: if pkg is in 'config-files'
state, treat this as not installed and set errno to ENOENT.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126040107-zj0stff23hlta1d2
2009-11-26 05:01:07 +01:00
Juan RP
572068d3df xbps_get_path_from_pkg_dict_repo: adding rootdir wasn't correct for
a local repository, remove it.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126034026-gufqt4x1uwme5675
2009-11-26 04:40:26 +01:00
Juan RP
87a216fd11 Major changes in libxbps to implement caching in some cases.
libxbps:
 - Moved repolist code to lib/repository_pool.c.
 - Renamed xbps_{prepare,release}_repolist_data() to
   xbps_repository_pool_{init,release} respectively.
 - Moved regpkgdb dict code to lib/regpkgs_dictionary.c.
 - Renamed xbps_{prepare,release}_regpkgdb_dict() to
   xbps_regpkgs_dictionary_{init,release} respectively.
 - Use a global reference count for repository_pool and regpkgs_dictionary,
   this gives a substantial performance gain while looking for dependencies
   in repository pool, among other things.
 - Make xbps_find_pkg_* functions return errno and use it to detect
   for spurious errors in code using them.
 - Add code to detect when a dependency is already unpacked.

xbps-bin:
 - Do not set pkg state to unpacked in the transaction, it's set already
   while a package is unpacked.
 - While installing or updating packages, it now knows when a dependency
   is already unpacked and shows it as "unconfigured".

Bump XBPS_RELVER to 20091126.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126022250-uu8x0fa86l4scb5x
2009-11-26 02:22:50 +00:00
Juan RP
04d9ab2322 xbps_get_path_from_pkg_dict_repo: new function that returns a malloc'ed
string with the full path to a binary package file.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125042953-x2nhwi8kxg75ukyq
2009-11-25 04:29:53 +00:00
Juan RP
787416a0cd xbps_get_pkg_plist_dict_from_repo: split reading the pkg plist dict
from an url into a new function, xbps_get_pkg_plist_dict_from_url.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125025258-dnq0lstx67xj6w8t
2009-11-25 02:52:58 +00:00
Juan RP
c11094d5dd Added xbps_get_pkg_plist_dict_from_repo().
This function will fetch a requested plist file in a binary
package matching its 'pkgname' object by searching in repository pool.

This works in any kind of repository, local and remote. Some code
was Taken from NetBSD's pkg_install HEAD. Oh, and it's on-the-fly!
doesn't need to download the binpkg first!

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125020936-7uf2ncrf1692c5hz
2009-11-25 02:09:36 +00:00
Juan RP
164c661bcf xbps-repo: added 'show-deps' target to mimic xbps-bin(8).
As consequence of this, remove xbps_callback_array_iter_in_repolist().
Nowadays to iter over the repository pool we have a SIMPLEQ, this
allowed to simplify the code and remove some now unneeed stuff.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124104704-oyvrmb3tmd59w4e7
2009-11-24 10:47:04 +00:00