libxbps: if XBPS_FLAG_VERBOSE is set print to stdout some info about binary

packages found in repositories and its dependencies.
This commit is contained in:
Juan RP 2010-05-18 23:04:14 +02:00
parent 855a1d505e
commit 2be6a7b1bc
2 changed files with 54 additions and 24 deletions

View File

@ -36,8 +36,8 @@ store_dependency(prop_dictionary_t master, prop_dictionary_t depd,
{
prop_dictionary_t dict;
prop_array_t array;
const char *pkgname;
int rv = 0;
const char *pkgname, *pkgver;
int flags = xbps_get_flags(), rv = 0;
pkg_state_t state = 0;
assert(master != NULL);
@ -49,6 +49,9 @@ store_dependency(prop_dictionary_t master, prop_dictionary_t depd,
if (!prop_dictionary_get_cstring_nocopy(depd, "pkgname", &pkgname))
return errno;
if (!prop_dictionary_get_cstring_nocopy(depd, "pkgver", &pkgver))
return errno;
dict = prop_dictionary_copy(depd);
if (dict == NULL)
return errno;
@ -96,6 +99,9 @@ store_dependency(prop_dictionary_t master, prop_dictionary_t depd,
prop_object_release(dict);
return EINVAL;
}
if (flags & XBPS_FLAG_VERBOSE)
printf("\n Added package '%s' into the transaction (%s).\n",
pkgver, repoloc);
return 0;
}
@ -245,7 +251,7 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
pkg_state_t state = 0;
const char *reqpkg, *reqvers, *pkg_queued, *repo_pkgver;
char *pkgname;
int rv = 0;
int flags = xbps_get_flags(), rv = 0;
iter = prop_array_iterator(array);
if (iter == NULL)
@ -261,6 +267,9 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
rv = EINVAL;
break;
}
if (flags & XBPS_FLAG_VERBOSE)
printf(" Requires dependency '%s': ", reqpkg);
/*
* Check if required dep is satisfied and installed.
*/
@ -271,11 +280,11 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
break;
} else if (rv == 1) {
/* Required pkg dependency is satisfied */
DPRINTF(("Dependency %s satisfied.\n", reqpkg));
if (flags & XBPS_FLAG_VERBOSE)
printf("satisfied and installed.\n");
rv = 0;
continue;
}
DPRINTF(("Dependency %s not installed.\n", reqpkg));
pkgname = xbps_get_pkgpattern_name(reqpkg);
if (pkgname == NULL) {
rv = EINVAL;
@ -310,8 +319,8 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
}
if (xbps_pkgpattern_match(pkg_queued,
__UNCONST(reqpkg))) {
DPRINTF(("Dependency %s already queued.\n",
pkgname));
if (flags & XBPS_FLAG_VERBOSE)
printf("queued in the transaction.\n");
free(pkgname);
continue;
}
@ -343,8 +352,8 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
free(pkgname);
continue;
} else {
DPRINTF(("Added missing dep %s (repo: %s).\n",
reqpkg, repoloc));
if (flags & XBPS_FLAG_VERBOSE)
printf("missing package in repository!\n");
free(pkgname);
continue;
}
@ -403,7 +412,6 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
DPRINTF(("store_dependency failed %s\n", reqpkg));
break;
}
DPRINTF(("Added reqdep %s (repo: %s)\n", reqpkg, repoloc));
/*
* If package was added in the missing_deps array, we
@ -430,7 +438,9 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
/*
* Iterate on required pkg to find more deps.
*/
DPRINTF(("Looking for rundeps on %s.\n", reqpkg));
if (flags & XBPS_FLAG_VERBOSE)
printf(" Finding dependencies for '%s':\n", reqpkg);
if ((rv = find_repo_deps(master, repo, repoloc,
curpkg_rdeps)) != 0) {
DPRINTF(("Error checking %s rundeps %s\n",
@ -448,8 +458,8 @@ xbps_repository_find_pkg_deps(prop_dictionary_t master, prop_dictionary_t pkg)
{
prop_array_t pkg_rdeps, missing_rdeps;
struct repository_pool *rpool;
const char *pkgname;
int rv = 0;
const char *pkgname, *pkgver;
int flags = xbps_get_flags(), rv = 0;
assert(master != NULL);
assert(pkg != NULL);
@ -461,10 +471,15 @@ xbps_repository_find_pkg_deps(prop_dictionary_t master, prop_dictionary_t pkg)
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
return errno;
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver))
return errno;
if ((rv = xbps_repository_pool_init()) != 0)
return rv;
DPRINTF(("Checking rundeps for %s.\n", pkgname));
if (flags & XBPS_FLAG_VERBOSE)
printf(" Finding required dependencies for '%s':\n", pkgver);
/*
* Iterate over the repository pool and find out if we have
* all available binary packages.

View File

@ -292,7 +292,7 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
prop_array_t unsorted;
struct repository_pool *rpool;
const char *repover, *instver;
int rv = 0;
int flags = xbps_get_flags(), rv = 0;
bool newpkg_found = false;
assert(pkgname != NULL);
@ -316,8 +316,9 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
rv = errno;
goto out;
}
DPRINTF(("Package %s not found in repo %s.\n",
pkgname, rpool->rp_uri));
if (flags & XBPS_FLAG_VERBOSE)
printf("Package '%s' not found in repository "
"'%s'.\n", pkgname, rpool->rp_uri);
} else if (pkgrd != NULL) {
/*
* Check if version in repository is greater than
@ -334,13 +335,17 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
goto out;
}
if (xbps_cmpver(repover, instver) > 0) {
DPRINTF(("Found %s-%s in repo %s.\n",
pkgname, repover, rpool->rp_uri));
if (flags & XBPS_FLAG_VERBOSE) {
printf("Found '%s-%s' in repository "
"'%s'.\n", pkgname, repover,
rpool->rp_uri);
}
newpkg_found = true;
break;
}
DPRINTF(("Skipping %s-%s in repo %s.\n",
pkgname, repover, rpool->rp_uri));
if (flags & XBPS_FLAG_VERBOSE)
printf("Skipping '%s-%s' from repository "
"'%s'.\n", pkgname, repover, rpool->rp_uri);
continue;
}
}
@ -411,8 +416,8 @@ xbps_repository_install_pkg(const char *pkg, bool bypattern)
prop_dictionary_t origin_pkgrd = NULL, pkgrd = NULL;
prop_array_t unsorted;
struct repository_pool *rpool;
const char *pkgname;
int rv = 0;
const char *pkgname, *pkgver;
int flags = xbps_get_flags(), rv = 0;
assert(pkg != NULL);
@ -436,8 +441,15 @@ xbps_repository_install_pkg(const char *pkg, bool bypattern)
rv = errno;
goto out;
}
} else if (pkgrd != NULL)
} else if (pkgrd != NULL) {
if (flags & XBPS_FLAG_VERBOSE) {
prop_dictionary_get_cstring_nocopy(pkgrd,
"pkgver", &pkgver);
printf("Found package '%s' (%s).\n",
pkgver, rpool->rp_uri);
}
break;
}
}
if (pkgrd == NULL) {
rv = EAGAIN;
@ -480,6 +492,9 @@ xbps_repository_install_pkg(const char *pkg, bool bypattern)
if ((rv = xbps_repository_find_pkg_deps(trans_dict, pkgrd)) != 0)
goto out;
if (flags & XBPS_FLAG_VERBOSE)
printf("\n");
/*
* Add required package dictionary into the unsorted deps dictionary,
* set package state as not yet installed.