Commit Graph

87 Commits

Author SHA1 Message Date
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
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
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
8e0a94d5cc xbps-repo: use xbps_repository_pool_find_pkg(). 2011-01-18 14:57:25 +01:00
Juan RP
6051eb29ab Added another bunch of compiler warnings and fix code. 2011-01-15 11:59:44 +01:00
Juan RP
057deb180c xbps-repo: report the errno string when a repository cannot be added and fix a NULL pointer deref. 2010-12-25 02:35:11 +01:00
Juan RP
5b101eae2b xbps-repo: fix a memleak in the 'add' target. 2010-12-24 05:43:00 +01:00
Juan RP
57453d1926 xbps-{bin,repo}: use strlcpy(). 2010-12-24 05:31:37 +01:00
Juan RP
45b4fada3d xbps-repo: fix a memleak in the 'show' target. 2010-12-24 05:29:39 +01:00
Juan RP
f2c33b0b08 xbps-repo: fix a memleak in the 'find-files' target. 2010-12-24 05:21:49 +01:00
Juan RP
b017f6d024 xbps-repo: fix the 'genindex' target due to 0.7.0 API changes. 2010-12-16 11:37:31 +01:00
Juan RP
ece608a080 xbps-repo(8): implemented 'find-files' target. 2010-12-15 15:14:44 +01:00
Juan RP
60c37406c1 xbps-repo: zero out allocated mem to avoid garbage in the 'search' target. 2010-12-04 10:31:17 +01:00
Juan RP
237991fd79 xbps-bin: added -F flag for the remove target.
Unless it's set, packages that are dependencies of other installed packages
won't be removed. This flag overrides this behaviour and forces the package removal.

While being here, misc cleanups.
2010-12-03 17:36:07 +01:00
Juan RP
98a2034fcf Also show the conflicts object if available and simplify the code. 2010-12-03 06:37:01 +01:00
Juan RP
940e077fb4 Improvements for xbps-{bin,repo}.
- Indent properly with the longest "pkgver" object while listing or searching
  for packages.
- Also match strings in the short description object while searching for
  packages in xbps_repo.
2010-11-24 16:37:30 +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
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
8e764dca60 xbps-repo: put back sanitize_url() and improve the implementation. 2010-05-20 14:45:12 +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
8b222fd093 xbps-repo/index.c: fix a typo. 2010-05-18 23:06:27 +02:00
Juan RP
754ec6ebb1 xbps-repo: fix genindex target to not return error when a package is already
registered in the index.
2010-05-18 02:42:21 +02:00
Juan RP
401d197c06 xbps-repo(8): improved the 'search' target to also match substrings
in package/version tuples.
2010-05-12 05:04:35 +02:00
Juan RP
1b44e18b35 Remove asciidoc build dependency, use troff manpages directly. 2010-05-03 21:50:34 +02:00
Juan RP
59693bf505 Update manpages for new XBPS project locations. 2010-05-02 11:36:17 +02:00
Juan RP
2d68c5fb20 xbps-repo(8): fixed the 'search' target to also match patterns against
its description, and not only from the package/version touple.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428214659-lz1au5hjg80h4j37
2010-04-28 23:46:59 +02:00
Juan RP
7976ac3707 xbps-repo/index.c: fix warnings found by clang.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428211333-wi7id42b9ol7g2ae
2010-04-28 23:13:33 +02:00
Juan RP
a5d8d486ea xbps-repo: show a warning when a repository has been already added.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100427160215-pi2urhu9xzeblv71
2010-04-27 18:02:15 +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
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
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
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
6c29fe7514 xbps-repo: search target: also report exact matches by pkgname.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100114000654-tnrtvi1ymy2iveyx
2010-01-14 01:06:54 +01:00
Juan RP
536fb8a86e xbps-repo/util.c: bump copyright year.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100113160523-8f0blxmmep2hn44e
2010-01-13 17:05:23 +01:00
Juan RP
b225a8d243 xbps-repo/util.c: simplify show_pkg_files().
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100113155750-bwxwc47h2ncqf8pt
2010-01-13 16:57:50 +01:00
Juan RP
02c0c569a3 xbps-{bin,repo}.8.txt: s/SYNOPSYS/SYNOPSIS/
--HG--
extra : convert_revision : juan%40juan-desktop-20091218121933-hgss4vyhyaoj3pbn
2009-12-18 13:19:33 +01:00
Juan RP
b0b00cf1ff xbps-repo: when adding local repos always create XBPS_META_PATH.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091206082938-4adrlgkbsz6lsz5y
2009-12-06 09:29:38 +01:00
Juan RP
20ec9c3b6d Fixed typos in xbps-{bin,repo} manpages.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091202061945-kpgqqrc9pgriosb3
2009-12-02 07:19:45 +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
bfa9858277 xbps-bin, xbps-repo: show the "essential" and "replaces" objs values
in the 'show' target.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091130102023-3ureuzorr96fj7by
2009-11-30 11:20:23 +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
8b3b5c9d1a xbps-bin, xbps-repo: use xbps_pkgdep_match() for the search target.
This provides csh style shell pattern.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128045200-4rymuqm90rzmgiaw
2009-11-28 05:52:00 +01:00
Juan RP
3855ee582a xbps-repo: add -c flag to set cachedir, update manpage.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128025616-fe43609n1rosmt6u
2009-11-28 03:56:16 +01:00