Commit Graph

267 Commits

Author SHA1 Message Date
Juan RP
2e140cde7b xbps-bin.8: fix typo. 2011-02-05 11:29:18 +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
d25bc35711 xbps-bin::show_pkg_info() remove useless prop_object_type_t member. 2011-02-04 18:00:47 +01:00
Juan RP
40cf7bad32 xbps-repo: call xbps_end() in usage() before exit(3). 2011-02-04 16:24:22 +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
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
7b159d6f33 xbps-dgraph: parse the "provides" obj for virtual packages. 2011-01-31 16:40:33 +01:00
Juan RP
fca3d6b9bf Use xbps_{error,warn}_printf() everywhere. 2011-01-30 18:23:33 +01:00
Juan RP
243685507a xbps-bin: some cosmetic informative printfs. 2011-01-30 12:40:16 +01:00
Juan RP
89faf75db4 xbps-bin/remove.c: fix some comments. 2011-01-30 12:12:49 +01:00
Juan RP
f27b7557bc xbps-bin: there's no need to add objs in inverted order for -R. 2011-01-30 08:22:58 +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
7c8a89c968 xbps-repo(8): fix wrong sentence. 2011-01-29 17:48:13 +01:00
Juan RP
03b1b254cc xbps-bin::check.c: reset a var to avoid false positives. 2011-01-28 12:18:17 +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
080334da8b xbps-bin: make 'list' target without arguments to only show pkgs in "installed" state. 2011-01-27 14:45:40 +01:00
Juan RP
255f229a78 xbps-bin.8: fix a typo. 2011-01-27 14:44:39 +01:00
Juan RP
c952337fd4 xbps-bin(8): added -D option to only show the URL to download binary packages. 2011-01-27 14:36:33 +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
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
bc259ae720 xbps-{bin,repo}: use static const tables to parse objs in XBPS_PKGPROPS files. 2011-01-26 16:34:26 +01:00
Juan RP
ada7820312 xbps-bin: reset some static vars for correct indentation in output. 2011-01-25 17:52:04 +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
fd30feadcb xbps-bin/check.c: save some lines by using prop_object_type() directly. 2011-01-25 03:33:51 +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
6b4c6970a3 xbps-bin/question.c: use sizeof(). 2011-01-24 19:26:52 +01:00
Juan RP
0feae4fa20 xbps-uhelper: added 'getpkgdepversion' target. 2011-01-24 19:13:11 +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
81b6b62aef xbps-bin/fetch.c: use else if conditionals.
--HG--
branch : progress_callback
2011-01-22 13:08:36 +01:00
Juan RP
724c4a6f0a Added fetch.c for xbps-bin, with the fetch function callback.
--HG--
branch : progress_callback
2011-01-22 12:40:58 +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
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
0a8fabbfac xbps-bin: remove spurios chars in two printf()s. 2011-01-18 23:42:51 +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
a7886f62db xbps-bin: fix a memleak in the 'find-files' target. 2010-12-24 05:21:22 +01:00
Juan RP
e3b86d5ff6 xbps-dgraph: use PRIu64 to printf uint64_t from <inttypes.h>. 2010-12-23 17:23:14 +01:00
Juan RP
e01399c242 xbps-uhelper: added -d flag to enable debugging. 2010-12-18 10:26:12 +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
e6503b98cc xbps-uhelper: fix the 'unregister' target, wasn't updated for 0.7.0 API changes. 2010-12-16 00:25:53 +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
4f6e20c431 xbps-bin: zero out allocated mem to avoid garbage in the 'list' target. 2010-12-04 10:30:01 +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
b3c8a8ef5c Backed out changeset e82cc0e4b779
Otherwise the refcount in repository pool will initialize/release on every op.
2010-11-25 21:33:14 +01:00
Juan RP
c7f6f9f44a xbps-bin: there's no need to init repository pool. 2010-11-25 16:23:49 +01:00
Juan RP
2c72c81db0 xbps-bin: always check if the there are missing deps regardless of the errno value. 2010-11-25 10:58:44 +01:00
Juan RP
278a37a24a xbps-bin: fix for previous. 2010-11-24 16:39:14 +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
d2be842ce5 Fix and improve when there are missing deps in the transaction dictionary. 2010-11-23 23:17:04 +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
420225d414 xbps-dgraph: new utility to generate dot(1) graphs for package metadata properties. 2010-11-08 23:27:15 +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
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
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
8d998948ef xbps-bin.8: fixed two formatting errors. 2010-10-31 01:59:48 +02:00
Juan RP
210f2799fc xbps-bin(8): modify the 'list' target to accept an optional argument to
list packages in the specified state, so that you can list packages that
 need to be purged, configured and broken (will be used in the future).
2010-10-27 13:10:03 +02:00
Juan RP
ef7da88db1 xbps-bin(8): added a new target "find-files".
This new target 'find-files' can be used to find which installed
package(s) own a file. Exact matches like "/bin/mount" or patterns
like "/usr/lib/libb[ao]b\*" can be specified.
2010-10-27 00:25:02 +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
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
1fbc19959f xbps-bin: when replacing a pkg do not purge the old one, just remove it. 2010-05-12 07:47:40 +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
b8c9577df6 xbps-bin(8): added a new target 'show-orphans' that list all package
orphans currently installed.
2010-05-04 17:04:36 +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
b04a0230cd xbps-bin/check.c: remove dead code, fix warnings found by clang.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428211107-nvoflpkfkz37y3us
2010-04-28 23:11:07 +02:00
Juan RP
db685f280d xbps-bin/install.c: remove unused vars, found by clang.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428193336-61glbrl5rnjpby4p
2010-04-28 21:33:36 +02:00
Juan RP
8ec438e168 xbps-bin/main.c: remove unused var found by clang analyzer.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428163341-3b947nuva6l5pv85
2010-04-28 18:33:41 +02:00
Juan RP
11de88d122 xbps-bin/install.c: fix a NULL pointer dereference in error path, found by
the clang analyzer.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428163137-hs9ac0rm47sz9k14
2010-04-28 18:31:37 +02:00
Juan RP
e274585c3c xbps-bin(8): added -p flag to also purge packages for the 'remove'
and 'autoremove' targets, after successful removal.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428012613-e2wpzknmrxkjntsd
2010-04-28 03:26:13 +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
ad12302a69 xbps-uhelper: remove unused debug code.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100420123503-std182rf5dt59ccq
2010-04-20 14:35:03 +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
9bceb2adb7 xbps-bin: fixed the install target to work with pkgnames containing
multiple '-' characters, which resulted in incomplete pkgname.

The fix is to always append '>=0' if a pkgname is specified, and passing
a pkgpattern to xbps_repository_install_pkg().

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100226051333-od2siux4rmsa88m7
2010-02-26 06:13:33 +01:00
Juan RP
9f4b36292d xbps-bin: unset some bool vars while processing the transaction to avoid
wrong messages for preserve pkgs.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100217041941-wrvm86m0tc7ynlvu
2010-02-17 05:19:41 +01:00
Juan RP
83ab3fe977 xbps-bin/remove.c: set some pointers to NULL before checking them.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100128164423-i00yg3xp3nlsoh6j
2010-01-28 17:44:23 +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
375330a956 xbps-bin: print different msgs for pkgs marked as preserve and essential.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100125151648-s3d0zxaro5v5bh95
2010-01-25 16:16:48 +01:00
Juan RP
dae134cd48 xbps-bin/remove.c: simplify error paths.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100125151604-jwhoavlbdhr645df
2010-01-25 16:16:04 +01:00