Commit Graph

372 Commits

Author SHA1 Message Date
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
391f02ce10 Added some missing changes for previous.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126023256-oyfwnekdeu2h9zi8
2009-11-26 03:32:56 +01:00
Juan RP
5223b6d652 xbps-bin(8), xbps-repo(8): improve descr for some targets.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126022901-34bq1qnrdzeakmnc
2009-11-26 03:29:01 +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
fa7e3a3a7e xbps-repo: genindex: also remove the "conf_files" object.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125074221-iccaravanpovtjgd
2009-11-25 07:42:21 +00:00
Juan RP
b56b7e9f09 Bump XBPS_PKGINDEX_VERSION to 1.1 because some pkg objects were removed.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125043809-rsoiypyi3fvqpus1
2009-11-25 04:38:09 +00:00
Juan RP
4c1ae5d3d6 xbps-repo: improve genindex target, reorganize main.c file.
- genindex: use new recently added function, remove some objects from
  generated pkg dictionaries, they will be fetched remotely.
- moved some code from main.c into repository.c.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125043204-nbtdtaxkga3dad2h
2009-11-25 04:32:04 +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
3117c8b4ee xbps-repo(8): added 'show-files' target.
It will search for 'pkgname' and will print its list of files, by
searching it in repository pool. The first repo wins.

Bump XBPS_RELVER to 20091125.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125021556-n8p6atfbkuvb4doi
2009-11-25 02:15:56 +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
2693e54ef6 xbps-repo: genindex: optimization change.
While looking at the archive for the XBPS_PKGPROPS file, it's unlikely
that it will have it after reading 6 entries, so discard it completely
and show an error message.

The XBPS_PKGPROPS it's always there at index <= 4.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125001733-i46wnqdxp497km6s
2009-11-25 00:17:33 +00:00
Juan RP
00c458fca1 Update .bzrignore after last changes.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091125001716-y7qz9jyme0cr1cj3
2009-11-25 00:17:16 +00:00
Juan RP
4e7bb3b451 xbps-repo: genindex: print error msg if required dirs to store
binpkgs are not there.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124234531-a80dunrglt6st72i
2009-11-24 23:45:31 +00:00
Juan RP
7ca13ee7df xbps-uhelper: new bin that combines xbps-cmpver, xbps-digest,
xbps-fetch and xbps-pkgdb in one utility.

Bump XBPS_RELVER to 20091124-1.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124115947-hb9cp7vp3tyhq64o
2009-11-24 11:59:47 +00:00
Juan RP
ea882fca0b xbps-repo: make xbps_repo_addpkg_index() static.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124111123-1e8hxb9ry42oq9wr
2009-11-24 11:11:23 +00:00
Juan RP
3a65c45de3 Refactored shared code between xbps-bin(8) and xbps-repo(8).
- xbps-repo: move protos to defs.h and remove index.h and util.h.
- xbps-bin: move code that belongs to it from xbps-repo to show-info-files.c.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124110539-nsdjp0ajr7nn8pa3
2009-11-24 11:05:39 +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
Juan RP
c676622869 Some changes to know if a file was downloaded successfully or not.
Improved xbps-repo sync/add and xbps-fetch to print informative
messages when a transfer was not necessary because local/remote size
and/or mtime matched.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124050326-owez7140fdxwepuk
2009-11-24 05:03:26 +00:00
Juan RP
83f71f3d2b xbps_fetch_file: in refetch case, do nothing if local/remote size match.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124035440-qhbft4gqlgbgc554
2009-11-24 03:54:40 +00:00
Juan RP
4502155554 xbps-repo: explain in the manpage that outdated package files will
be removed automatically for the 'genindex' target.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124031605-q9yaklspw504ordq
2009-11-24 03:16:05 +00:00
Juan RP
dc68e31ad9 Bump XBPS_RELVER to 20091124 for xbps-repo genindex fix.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124030749-n313t2s3msc3p9nu
2009-11-24 03:07:49 +00:00
Juan RP
d7987e8e32 xbps-repo genindex: fix use after free, remove outdated binpkg files
by default.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124030606-3y34svrtnad21kgk
2009-11-24 03:06:06 +00:00
Juan RP
1c2fc20964 xbps_find_pkg_in_dict: return NULL if pkgname obj is not there.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124030132-m2wgi7p38voah0ol
2009-11-24 03:01:32 +00:00
Juan RP
fe468b2e90 xbps-bin: fix one more for previous commit.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091124003052-u6rkvnblvb83hrkv
2009-11-24 00:30:52 +00:00
Juan RP
01cbe9a63b xbps-bin: fix download local dir when fetching binpkgs from remote repos.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123235632-vbpn1br170fv73l3
2009-11-23 23:56:32 +00:00
Juan RP
bf82b6512d Extensively verified that all functions have its return value
checked for any spurious error, this should make the core more safer :-)

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123094651-5prw0bkqmt3y8h23
2009-11-23 09:46:51 +00:00
Juan RP
ea468f850f xbps_get_pkg_index_plist: use xbps_check_is_repo_string_remote().
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123070214-gu6soxr8uflkomam
2009-11-23 07:02:14 +00:00
Juan RP
13706cf0a5 xbps-repo: changed the 'sync' target to update from all registered
remote repositories, so remove its argument.

xbps_sync_repository_pkg_index:
 - create the local repo dir in XBPS_META_PATH.
 - also add the uri scheme (http://, https://, ftp://) in the created
   local directory and subst ':' also with an underscore.
 - do not create local repo directories unless the download pkg-index
   plist file is verified to be fetched correctly.

xbps_check_is_repo_string_remote:
  New function to check if a repo string is a remote repository, use
  it in all places where it was used before.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123042316-rmu4w3ehoxwh3iz8
2009-11-23 04:23:16 +00:00
Juan RP
a95aecaf70 Bump XBPS_RELVER to 20091123.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123002928-xylnivgum005nsvz
2009-11-23 00:29:28 +00:00
Juan RP
12cec6e707 xbps-pkgdb: don't forget to add the pkgver object in register target.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123002857-ntwcf91swcol7m9d
2009-11-23 00:28:57 +00:00
Juan RP
3de4aca129 xbps_register_pkg: check that required objs are there!
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123002823-o49jdxxwbgvo31us
2009-11-23 00:28:23 +00:00
Juan RP
3bb3858cfb xbps_find_pkg_repo_deps: don't propagate rv to next calls using it,
add some more debugging for future problems.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122234348-g8x4r7kqgnex30w6
2009-11-23 00:43:48 +01:00
Juan RP
3fcba399af xbps_find_pkg_repo_deps: if finding a dep failed for whatever reason,
stop immediately and return the appropiate error.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122205257-m1wta4fk85k1hv1w
2009-11-22 21:52:57 +01:00
Juan RP
4e89a28dda xbps_find_new_pkg: do not report incorrect debug printf.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122205215-gxrymbh0wzpujhoj
2009-11-22 21:52:15 +01:00
Juan RP
7af7ef40c9 xbps_get_pkgver_from_dict: return NULL if the object is not there.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122205119-ezkdj0sdju2ezoum
2009-11-22 21:51:19 +01:00
Juan RP
a3dca717ae Bump XBPS_RELVER to 20091122 for previous change.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122072408-wx4hna229tisx2yj
2009-11-22 08:24:08 +01:00
Juan RP
4f80bddbb2 xbps-repo: print error if pkg-index file cannot be fetched.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122060446-sc4na9qa2k2bk5f6
2009-11-22 07:04:46 +01:00
Juan RP
625b3df820 Removed outdated doc files.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122054748-1gidbo33c2c3e2j2
2009-11-22 06:47:48 +01:00
Juan RP
3d24672e58 Improve dependency matching via repos and use the "pkgver" object
in pkg dictionary to improve performance in some cases.

Bumped XBPS_RELVER to 20091121.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122041547-oywx4db75j8uttl3
2009-11-22 05:15:47 +01:00
Juan RP
71ea9d2d1f xbps_find_pkg_deps: simplify, fix multi-repo bug, add debugging.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091121061242-22ow43an9ksa8y0b
2009-11-21 07:12:42 +01:00
Juan RP
cf575b88c2 .bzrignore: add xbps-fetch bin.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091120210842-z3s10opl7vdp9c2u
2009-11-20 22:08:42 +01:00
Juan RP
56c5c38724 Fixed prog.mk rules that skipped the manpage.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091120210232-3874556kn824cgrt
2009-11-20 22:02:32 +01:00
Juan RP
308a25f302 xbps_unpack_binary_pkg: initialize a local var.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091119051042-0kyp37uo6puex4jt
2009-11-19 06:10:42 +01:00
Juan RP
db9ae90dd4 Improve make output similar to what recent GNU configure scripts do.
Also always build the static bins so that it's done in one pass,
that means that objects are PIC and built with SSP.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091119050337-hkdksjqxy9n7vy7m
2009-11-19 06:03:37 +01:00
Juan RP
9e062cec4f xbps-repo: do the right thing in some error paths.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091118231106-xxbg5oyvnojv1ykd
2009-11-19 00:11:06 +01:00