Cleanup of pacman_deptest()
Clean up some left over code from http://projects.archlinux.org/git/gitweb.cgi?p=pacman.git;a=commitdiff;h=7653bb93997f52848b54ab80868cd6da52808a75 Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
7ec2e088ec
commit
5e68e9d451
4 changed files with 21 additions and 11 deletions
|
@ -357,6 +357,7 @@ pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss);
|
||||||
pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
|
pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
|
||||||
const char *alpm_dep_get_name(pmdepmissing_t *miss);
|
const char *alpm_dep_get_name(pmdepmissing_t *miss);
|
||||||
const char *alpm_dep_get_version(pmdepmissing_t *miss);
|
const char *alpm_dep_get_version(pmdepmissing_t *miss);
|
||||||
|
const char *alpm_depend_get_name(pmdepend_t *dep);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File conflicts
|
* File conflicts
|
||||||
|
|
|
@ -766,4 +766,16 @@ const char SYMEXPORT *alpm_dep_get_version(pmdepmissing_t *miss)
|
||||||
|
|
||||||
return miss->depend.version;
|
return miss->depend.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_depend_get_name(pmdepend_t *dep)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(dep != NULL, return(NULL));
|
||||||
|
|
||||||
|
return dep->name;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|
|
@ -294,7 +294,7 @@ get_downloadclient() {
|
||||||
check_deps() {
|
check_deps() {
|
||||||
[ $# -gt 0 ] || return
|
[ $# -gt 0 ] || return
|
||||||
|
|
||||||
pmout=$(pacman $PACMAN_OPTS -T $*)
|
pmout=$(pacman $PACMAN_OPTS -T "$@")
|
||||||
ret=$?
|
ret=$?
|
||||||
if [ $ret -eq 127 ]; then #unresolved deps
|
if [ $ret -eq 127 ]; then #unresolved deps
|
||||||
echo "$pmout"
|
echo "$pmout"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
extern config_t *config;
|
extern config_t *config;
|
||||||
|
|
||||||
|
/* TODO: This should use _alpm_checkdeps() */
|
||||||
int pacman_deptest(alpm_list_t *targets)
|
int pacman_deptest(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
@ -52,20 +53,16 @@ int pacman_deptest(alpm_list_t *targets)
|
||||||
alpm_list_t *j, *provides;
|
alpm_list_t *j, *provides;
|
||||||
|
|
||||||
target = alpm_list_getdata(i);
|
target = alpm_list_getdata(i);
|
||||||
|
|
||||||
/* splitdep modifies the string... we'll compensate for now */
|
|
||||||
char *saved_target = NULL;
|
|
||||||
saved_target = calloc(strlen(target)+1, sizeof(char));
|
|
||||||
strncpy(saved_target, target, strlen(target));
|
|
||||||
|
|
||||||
dep = alpm_splitdep(target);
|
dep = alpm_splitdep(target);
|
||||||
|
|
||||||
pkg = alpm_db_get_pkg(alpm_option_get_localdb(), target);
|
pkg = alpm_db_get_pkg(alpm_option_get_localdb(),
|
||||||
|
alpm_depend_get_name(dep));
|
||||||
if(pkg && alpm_depcmp(pkg, dep)) {
|
if(pkg && alpm_depcmp(pkg, dep)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
} else {
|
} else {
|
||||||
/* not found, can we find anything that provides this in the local DB? */
|
/* not found, can we find anything that provides this in the local DB? */
|
||||||
provides = alpm_db_whatprovides(alpm_option_get_localdb(), target);
|
provides = alpm_db_whatprovides(alpm_option_get_localdb(),
|
||||||
|
alpm_depend_get_name(dep));
|
||||||
for(j = provides; j; j = alpm_list_next(j)) {
|
for(j = provides; j; j = alpm_list_next(j)) {
|
||||||
pmpkg_t *pkg;
|
pmpkg_t *pkg;
|
||||||
pkg = alpm_list_getdata(j);
|
pkg = alpm_list_getdata(j);
|
||||||
|
@ -78,10 +75,10 @@ int pacman_deptest(alpm_list_t *targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) {
|
if(!found) {
|
||||||
printf("%s\n", saved_target);
|
printf("%s\n", target);
|
||||||
retval = 127;
|
retval = 127;
|
||||||
}
|
}
|
||||||
free(saved_target);
|
free(dep);
|
||||||
}
|
}
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue