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
This commit is contained in:
Juan RP
2009-11-28 02:38:41 +01:00
parent 0d0e6d06b1
commit 494504dbec
9 changed files with 270 additions and 275 deletions

View File

@ -58,12 +58,12 @@ usage(void)
" show-revdeps\t<pkgname>\n"
" update\t\t<pkgname>\n"
" Options shared by all targets:\n"
" -c\t\t<cachedir>\n"
" -r\t\t<rootdir>\n"
" -v\t\tShows verbose messages\n"
" -V\t\tPrints the xbps release version\n"
" Options used by the (auto)remove and install target:\n"
" -f\t\tForce installation or removal of packages.\n"
" \t\tBeware with this option if you use autoremove!\n"
" -f\t\tBypasses the questions.\n"
"\n");
exit(EXIT_FAILURE);
}
@ -116,8 +116,11 @@ main(int argc, char **argv)
force = verbose = false;
while ((c = getopt(argc, argv, "CVfr:v")) != -1) {
while ((c = getopt(argc, argv, "Vcfr:v")) != -1) {
switch (c) {
case 'c':
xbps_set_cachedir(optarg);
break;
case 'f':
flags |= XBPS_FLAG_FORCE;
force = true;