mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-11 03:54:59 -05:00
reworked pacman_deptest()
This commit is contained in:
parent
0756af675d
commit
cda9c6671c
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
|||||||
ERR(NL, "no operation specified (use -h for help)\n");
|
ERR(NL, "no operation specified (use -h for help)\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
if(ret != 0) {
|
if(ret != 0 && pmo_d_vertest == 0) {
|
||||||
MSG(NL, "\n");
|
MSG(NL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +237,8 @@ void cleanup(int signum)
|
|||||||
int pacman_deptest(list_t *targets)
|
int pacman_deptest(list_t *targets)
|
||||||
{
|
{
|
||||||
PM_LIST *data;
|
PM_LIST *data;
|
||||||
|
list_t *i;
|
||||||
|
char *str;
|
||||||
|
|
||||||
if(targets == NULL) {
|
if(targets == NULL) {
|
||||||
return(0);
|
return(0);
|
||||||
@ -264,11 +266,20 @@ int pacman_deptest(list_t *targets)
|
|||||||
* where "dummy" is the package name, "version" its version, and every dep?
|
* where "dummy" is the package name, "version" its version, and every dep?
|
||||||
* the content of the "depends" field.
|
* the content of the "depends" field.
|
||||||
*/
|
*/
|
||||||
if(alpm_trans_addtarget("__dummy__|1.0-1|dep1|dep2|...") == -1) {
|
str = (char *)malloc(strlen("name=dummy|version=1.0-1")+1);
|
||||||
ERR(NL, "error: %s\n", alpm_strerror(pm_errno));
|
strcpy(str, "name=dummy|version=1.0-1");
|
||||||
|
for(i = targets; i; i = i->next) {
|
||||||
|
str = (char *)realloc(str, strlen(str)+8+strlen(i->data)+1);
|
||||||
|
strcat(str, "|depend=");
|
||||||
|
strcat(str, i->data);
|
||||||
|
}
|
||||||
|
if(alpm_trans_addtarget(str) == -1) {
|
||||||
|
FREE(str);
|
||||||
|
ERR(NL, "%s\n", alpm_strerror(pm_errno));
|
||||||
alpm_trans_release();
|
alpm_trans_release();
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
FREE(str);
|
||||||
|
|
||||||
if(alpm_trans_prepare(&data) == -1) {
|
if(alpm_trans_prepare(&data) == -1) {
|
||||||
PM_LIST *lp;
|
PM_LIST *lp;
|
||||||
@ -288,7 +299,7 @@ int pacman_deptest(list_t *targets)
|
|||||||
}
|
}
|
||||||
MSG(CL, "\n");
|
MSG(CL, "\n");
|
||||||
}
|
}
|
||||||
synctargs = list_add(synctargs, alpm_dep_getinfo(miss, PM_DEP_NAME));
|
synctargs = list_add(synctargs, strdup(alpm_dep_getinfo(miss, PM_DEP_NAME)));
|
||||||
}
|
}
|
||||||
alpm_list_free(data);
|
alpm_list_free(data);
|
||||||
break;
|
break;
|
||||||
@ -306,6 +317,11 @@ int pacman_deptest(list_t *targets)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(alpm_trans_release() == -1) {
|
||||||
|
ERR(NL, "%s", alpm_strerror(pm_errno));
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* attempt to resolve missing dependencies */
|
/* attempt to resolve missing dependencies */
|
||||||
/* TODO: handle version comparators (eg, glibc>=2.2.5) */
|
/* TODO: handle version comparators (eg, glibc>=2.2.5) */
|
||||||
if(ret == 126 && synctargs != NULL) {
|
if(ret == 126 && synctargs != NULL) {
|
||||||
@ -318,6 +334,11 @@ int pacman_deptest(list_t *targets)
|
|||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(alpm_trans_release() == -1) {
|
||||||
|
ERR(NL, "%s", alpm_strerror(pm_errno));
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user