Show dependencies in package menu.
PR: 7454 Submitted by: Stefan Eggers <seggers@semyam.dinoco.de>
This commit is contained in:
parent
2c39ae659c
commit
86784dbcd2
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: config.c,v 1.117 1999/01/30 22:15:36 jkh Exp $
|
||||
* $Id: config.c,v 1.118 1999/02/01 16:35:40 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -708,12 +708,12 @@ configPackages(dialogMenuItem *self)
|
||||
|
||||
/* Bring up the packages menu */
|
||||
pos = scroll = 0;
|
||||
index_menu(&top, &plist, &pos, &scroll);
|
||||
index_menu(&top, &top, &plist, &pos, &scroll);
|
||||
|
||||
if (plist.kids && plist.kids->name) {
|
||||
/* Now show the packing list menu */
|
||||
pos = scroll = 0;
|
||||
ret = index_menu(&plist, NULL, &pos, &scroll);
|
||||
ret = index_menu(&plist, &plist, NULL, &pos, &scroll);
|
||||
if (ret & DITEM_LEAVE_MENU)
|
||||
break;
|
||||
else if (DITEM_STATUS(ret) != DITEM_FAILURE) {
|
||||
|
@ -2,7 +2,7 @@ DISTRIBUTION INFORMATION
|
||||
------------------------
|
||||
|
||||
An ``X-'' prefixed before a distribution set means that the XFree86
|
||||
3.3.2.3 base distribution, libraries, manual pages, SVGA server and a
|
||||
3.3.3 base distribution, libraries, manual pages, SVGA server and a
|
||||
set of default fonts will be selected in addition to the set itself.
|
||||
If you select such a set, you will also be presented with a set of
|
||||
menus for customizing the selections to your desired X Window System
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: index.c,v 1.59 1998/12/22 12:31:25 jkh Exp $
|
||||
* $Id: index.c,v 1.60 1999/01/11 12:45:18 asami Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -46,7 +46,17 @@
|
||||
#define MAX_MENU 12
|
||||
#define _MAX_DESC 55
|
||||
|
||||
/* A structure holding the root, top and plist pointer at once */
|
||||
struct ListPtrs
|
||||
{
|
||||
PkgNodePtr root; /* root of tree */
|
||||
PkgNodePtr top; /* part of tree we handle */
|
||||
PkgNodePtr plist; /* list of selected packages */
|
||||
};
|
||||
typedef struct ListPtrs* ListPtrsPtr;
|
||||
|
||||
static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
|
||||
static void index_recorddeps(Boolean add, PkgNodePtr root, IndexEntryPtr ie);
|
||||
|
||||
/* Smarter strdup */
|
||||
inline char *
|
||||
@ -180,6 +190,8 @@ new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, ch
|
||||
tmp->descrfile = strip(_strdup(descr));
|
||||
tmp->maintainer = _strdup(maint);
|
||||
tmp->deps = _strdup(deps);
|
||||
tmp->depc = 0;
|
||||
tmp->installed = package_exists(name);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -267,6 +279,7 @@ int
|
||||
index_read(FILE *fp, PkgNodePtr papa)
|
||||
{
|
||||
char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[511];
|
||||
PkgNodePtr i;
|
||||
|
||||
while (index_parse(fp, name, pathto, prefix, comment, descr, maint, cats, deps) != EOF) {
|
||||
char *cp, *cp2, tmp[511];
|
||||
@ -283,6 +296,15 @@ index_read(FILE *fp, PkgNodePtr papa)
|
||||
/* Add to special "All" category */
|
||||
index_register(papa, "All", idx);
|
||||
}
|
||||
|
||||
/* Adjust dependency counts */
|
||||
for (i = papa->kids; i != NULL; i = i->next)
|
||||
if (strcmp(i->name, "All") == 0)
|
||||
break;
|
||||
for (i = i->kids; i != NULL; i = i->next)
|
||||
if (((IndexEntryPtr)i->data)->installed)
|
||||
index_recorddeps(TRUE, papa, i->data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -407,13 +429,20 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp)
|
||||
int
|
||||
pkg_checked(dialogMenuItem *self)
|
||||
{
|
||||
PkgNodePtr kp = self->data, plist = (PkgNodePtr)self->aux;
|
||||
ListPtrsPtr lists = (ListPtrsPtr)self->aux;
|
||||
PkgNodePtr kp = self->data, plist = lists->plist;
|
||||
int i;
|
||||
|
||||
i = index_search(plist, kp->name, NULL) ? TRUE : FALSE;
|
||||
if (kp->type == PACKAGE && plist)
|
||||
return i || package_exists(kp->name);
|
||||
else
|
||||
if (kp->type == PACKAGE && plist) {
|
||||
IndexEntryPtr ie = kp->data;
|
||||
int markD, markX;
|
||||
|
||||
markD = ie->depc > 0; /* needed as dependency */
|
||||
markX = i || ie->installed; /* selected or installed */
|
||||
self->mark = markX ? 'X' : 'D';
|
||||
return markD || markX;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -421,42 +450,57 @@ int
|
||||
pkg_fire(dialogMenuItem *self)
|
||||
{
|
||||
int ret;
|
||||
PkgNodePtr sp, kp = self->data, plist = (PkgNodePtr)self->aux;
|
||||
ListPtrsPtr lists = (ListPtrsPtr)self->aux;
|
||||
PkgNodePtr sp, kp = self->data, plist = lists->plist;
|
||||
|
||||
if (!plist)
|
||||
ret = DITEM_FAILURE;
|
||||
else if (kp->type == PACKAGE) {
|
||||
IndexEntryPtr ie = kp->data;
|
||||
|
||||
sp = index_search(plist, kp->name, NULL);
|
||||
/* Not already selected? */
|
||||
if (!sp) {
|
||||
if (!package_exists(kp->name)) {
|
||||
if (!ie->installed) {
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
index_recorddeps(TRUE, lists->root, ie);
|
||||
msgInfo("Added %s to selection list", kp->name);
|
||||
}
|
||||
else {
|
||||
else if (ie->depc == 0) {
|
||||
WINDOW *save = savescr();
|
||||
|
||||
if (!msgYesNo("Do you really want to delete %s from the system?", kp->name))
|
||||
if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name))
|
||||
msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name);
|
||||
else {
|
||||
ie->installed = 0;
|
||||
index_recorddeps(FALSE, lists->root, ie);
|
||||
}
|
||||
restorescr(save);
|
||||
}
|
||||
else
|
||||
msgConfirm("Warning: Package %s is needed by\n %d other installed package%s.",
|
||||
kp->name, ie->depc, (ie->depc != 1) ? "s" : "");
|
||||
}
|
||||
else {
|
||||
index_recorddeps(FALSE, lists->root, ie);
|
||||
msgInfo("Removed %s from selection list", kp->name);
|
||||
index_delete(sp);
|
||||
}
|
||||
ret = DITEM_SUCCESS;
|
||||
/* Mark menu for redraw if we had dependencies */
|
||||
if (strlen(ie->deps) > 0)
|
||||
ret |= DITEM_REDRAW;
|
||||
}
|
||||
else { /* Not a package, must be a directory */
|
||||
int p, s;
|
||||
|
||||
p = s = 0;
|
||||
index_menu(kp, plist, &p, &s);
|
||||
index_menu(lists->root, kp, plist, &p, &s);
|
||||
ret = DITEM_SUCCESS | DITEM_CONTINUE;
|
||||
}
|
||||
return ret;
|
||||
@ -473,8 +517,9 @@ pkg_selected(dialogMenuItem *self, int is_selected)
|
||||
}
|
||||
|
||||
int
|
||||
index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
{
|
||||
struct ListPtrs lists;
|
||||
int n, rval, maxname;
|
||||
int curr, max;
|
||||
PkgNodePtr kp;
|
||||
@ -482,6 +527,10 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
Boolean hasPackages;
|
||||
WINDOW *w;
|
||||
|
||||
lists.root = root;
|
||||
lists.top = top;
|
||||
lists.plist = plist;
|
||||
|
||||
hasPackages = FALSE;
|
||||
nitems = NULL;
|
||||
|
||||
@ -525,7 +574,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
SAFE_STRCPY(buf, kp->desc);
|
||||
if (strlen(buf) > (_MAX_DESC - maxname))
|
||||
buf[_MAX_DESC - maxname] = '\0';
|
||||
nitems = item_add(nitems, kp->name, buf, pkg_checked, pkg_fire, pkg_selected, kp, (int)plist, &curr, &max);
|
||||
nitems = item_add(nitems, kp->name, buf, pkg_checked, pkg_fire, pkg_selected, kp, (int)&lists, &curr, &max);
|
||||
++n;
|
||||
kp = kp->next;
|
||||
}
|
||||
@ -551,7 +600,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
|
||||
/* These need to be set to point at the found item, actually. Hmmm! */
|
||||
pos = scroll = 0;
|
||||
index_menu(menu, plist, &pos, &scroll);
|
||||
index_menu(root, menu, plist, &pos, &scroll);
|
||||
}
|
||||
else
|
||||
msgConfirm("Search string: %s yielded no hits.", cp);
|
||||
@ -612,7 +661,41 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended)
|
||||
}
|
||||
}
|
||||
/* Done with the deps? Load the real m'coy */
|
||||
if (DITEM_STATUS(status) == DITEM_SUCCESS)
|
||||
if (DITEM_STATUS(status) == DITEM_SUCCESS) {
|
||||
status = package_extract(dev, who->name, depended);
|
||||
if (DITEM_STATUS(status) == DITEM_SUCCESS)
|
||||
id->installed = 1;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
index_recorddeps(Boolean add, PkgNodePtr root, IndexEntryPtr ie)
|
||||
{
|
||||
char depends[1024], *space, *todo;
|
||||
PkgNodePtr found;
|
||||
IndexEntryPtr found_ie;
|
||||
|
||||
SAFE_STRCPY(depends, ie->deps);
|
||||
for (todo = depends; todo != NULL; ) {
|
||||
space = index(todo, ' ');
|
||||
if (space != NULL)
|
||||
*space = '\0';
|
||||
|
||||
if (strlen(todo) > 0) { /* only non-empty dependencies */
|
||||
found = index_search(root, todo, NULL);
|
||||
if (found != NULL) {
|
||||
found_ie = found->data;
|
||||
if (add)
|
||||
++found_ie->depc;
|
||||
else
|
||||
--found_ie->depc;
|
||||
}
|
||||
}
|
||||
|
||||
if (space != NULL)
|
||||
todo = space + 1;
|
||||
else
|
||||
todo = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.153 1999/01/20 12:31:43 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.154 1999/01/27 02:32:47 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -299,6 +299,8 @@ typedef struct _indexEntry { /* A single entry in an INDEX file */
|
||||
char *comment; /* one line description */
|
||||
char *descrfile; /* path to description file */
|
||||
char *deps; /* packages this depends on */
|
||||
int depc; /* how many depend on me */
|
||||
int installed; /* indicates if it is installed */
|
||||
char *maintainer; /* maintainer */
|
||||
} IndexEntry;
|
||||
typedef IndexEntry *IndexEntryPtr;
|
||||
@ -515,7 +517,7 @@ extern void globalsInit(void);
|
||||
|
||||
/* index.c */
|
||||
int index_read(FILE *fp, PkgNodePtr papa);
|
||||
int index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
|
||||
int index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
|
||||
void index_init(PkgNodePtr top, PkgNodePtr plist);
|
||||
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
|
||||
void index_sort(PkgNodePtr top);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: config.c,v 1.117 1999/01/30 22:15:36 jkh Exp $
|
||||
* $Id: config.c,v 1.118 1999/02/01 16:35:40 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -708,12 +708,12 @@ configPackages(dialogMenuItem *self)
|
||||
|
||||
/* Bring up the packages menu */
|
||||
pos = scroll = 0;
|
||||
index_menu(&top, &plist, &pos, &scroll);
|
||||
index_menu(&top, &top, &plist, &pos, &scroll);
|
||||
|
||||
if (plist.kids && plist.kids->name) {
|
||||
/* Now show the packing list menu */
|
||||
pos = scroll = 0;
|
||||
ret = index_menu(&plist, NULL, &pos, &scroll);
|
||||
ret = index_menu(&plist, &plist, NULL, &pos, &scroll);
|
||||
if (ret & DITEM_LEAVE_MENU)
|
||||
break;
|
||||
else if (DITEM_STATUS(ret) != DITEM_FAILURE) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.153 1999/01/20 12:31:43 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.154 1999/01/27 02:32:47 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -299,6 +299,8 @@ typedef struct _indexEntry { /* A single entry in an INDEX file */
|
||||
char *comment; /* one line description */
|
||||
char *descrfile; /* path to description file */
|
||||
char *deps; /* packages this depends on */
|
||||
int depc; /* how many depend on me */
|
||||
int installed; /* indicates if it is installed */
|
||||
char *maintainer; /* maintainer */
|
||||
} IndexEntry;
|
||||
typedef IndexEntry *IndexEntryPtr;
|
||||
@ -515,7 +517,7 @@ extern void globalsInit(void);
|
||||
|
||||
/* index.c */
|
||||
int index_read(FILE *fp, PkgNodePtr papa);
|
||||
int index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
|
||||
int index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
|
||||
void index_init(PkgNodePtr top, PkgNodePtr plist);
|
||||
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
|
||||
void index_sort(PkgNodePtr top);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: config.c,v 1.117 1999/01/30 22:15:36 jkh Exp $
|
||||
* $Id: config.c,v 1.118 1999/02/01 16:35:40 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -708,12 +708,12 @@ configPackages(dialogMenuItem *self)
|
||||
|
||||
/* Bring up the packages menu */
|
||||
pos = scroll = 0;
|
||||
index_menu(&top, &plist, &pos, &scroll);
|
||||
index_menu(&top, &top, &plist, &pos, &scroll);
|
||||
|
||||
if (plist.kids && plist.kids->name) {
|
||||
/* Now show the packing list menu */
|
||||
pos = scroll = 0;
|
||||
ret = index_menu(&plist, NULL, &pos, &scroll);
|
||||
ret = index_menu(&plist, &plist, NULL, &pos, &scroll);
|
||||
if (ret & DITEM_LEAVE_MENU)
|
||||
break;
|
||||
else if (DITEM_STATUS(ret) != DITEM_FAILURE) {
|
||||
|
@ -2,7 +2,7 @@ DISTRIBUTION INFORMATION
|
||||
------------------------
|
||||
|
||||
An ``X-'' prefixed before a distribution set means that the XFree86
|
||||
3.3.2.3 base distribution, libraries, manual pages, SVGA server and a
|
||||
3.3.3 base distribution, libraries, manual pages, SVGA server and a
|
||||
set of default fonts will be selected in addition to the set itself.
|
||||
If you select such a set, you will also be presented with a set of
|
||||
menus for customizing the selections to your desired X Window System
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: index.c,v 1.59 1998/12/22 12:31:25 jkh Exp $
|
||||
* $Id: index.c,v 1.60 1999/01/11 12:45:18 asami Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -46,7 +46,17 @@
|
||||
#define MAX_MENU 12
|
||||
#define _MAX_DESC 55
|
||||
|
||||
/* A structure holding the root, top and plist pointer at once */
|
||||
struct ListPtrs
|
||||
{
|
||||
PkgNodePtr root; /* root of tree */
|
||||
PkgNodePtr top; /* part of tree we handle */
|
||||
PkgNodePtr plist; /* list of selected packages */
|
||||
};
|
||||
typedef struct ListPtrs* ListPtrsPtr;
|
||||
|
||||
static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
|
||||
static void index_recorddeps(Boolean add, PkgNodePtr root, IndexEntryPtr ie);
|
||||
|
||||
/* Smarter strdup */
|
||||
inline char *
|
||||
@ -180,6 +190,8 @@ new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, ch
|
||||
tmp->descrfile = strip(_strdup(descr));
|
||||
tmp->maintainer = _strdup(maint);
|
||||
tmp->deps = _strdup(deps);
|
||||
tmp->depc = 0;
|
||||
tmp->installed = package_exists(name);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -267,6 +279,7 @@ int
|
||||
index_read(FILE *fp, PkgNodePtr papa)
|
||||
{
|
||||
char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[511];
|
||||
PkgNodePtr i;
|
||||
|
||||
while (index_parse(fp, name, pathto, prefix, comment, descr, maint, cats, deps) != EOF) {
|
||||
char *cp, *cp2, tmp[511];
|
||||
@ -283,6 +296,15 @@ index_read(FILE *fp, PkgNodePtr papa)
|
||||
/* Add to special "All" category */
|
||||
index_register(papa, "All", idx);
|
||||
}
|
||||
|
||||
/* Adjust dependency counts */
|
||||
for (i = papa->kids; i != NULL; i = i->next)
|
||||
if (strcmp(i->name, "All") == 0)
|
||||
break;
|
||||
for (i = i->kids; i != NULL; i = i->next)
|
||||
if (((IndexEntryPtr)i->data)->installed)
|
||||
index_recorddeps(TRUE, papa, i->data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -407,13 +429,20 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp)
|
||||
int
|
||||
pkg_checked(dialogMenuItem *self)
|
||||
{
|
||||
PkgNodePtr kp = self->data, plist = (PkgNodePtr)self->aux;
|
||||
ListPtrsPtr lists = (ListPtrsPtr)self->aux;
|
||||
PkgNodePtr kp = self->data, plist = lists->plist;
|
||||
int i;
|
||||
|
||||
i = index_search(plist, kp->name, NULL) ? TRUE : FALSE;
|
||||
if (kp->type == PACKAGE && plist)
|
||||
return i || package_exists(kp->name);
|
||||
else
|
||||
if (kp->type == PACKAGE && plist) {
|
||||
IndexEntryPtr ie = kp->data;
|
||||
int markD, markX;
|
||||
|
||||
markD = ie->depc > 0; /* needed as dependency */
|
||||
markX = i || ie->installed; /* selected or installed */
|
||||
self->mark = markX ? 'X' : 'D';
|
||||
return markD || markX;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -421,42 +450,57 @@ int
|
||||
pkg_fire(dialogMenuItem *self)
|
||||
{
|
||||
int ret;
|
||||
PkgNodePtr sp, kp = self->data, plist = (PkgNodePtr)self->aux;
|
||||
ListPtrsPtr lists = (ListPtrsPtr)self->aux;
|
||||
PkgNodePtr sp, kp = self->data, plist = lists->plist;
|
||||
|
||||
if (!plist)
|
||||
ret = DITEM_FAILURE;
|
||||
else if (kp->type == PACKAGE) {
|
||||
IndexEntryPtr ie = kp->data;
|
||||
|
||||
sp = index_search(plist, kp->name, NULL);
|
||||
/* Not already selected? */
|
||||
if (!sp) {
|
||||
if (!package_exists(kp->name)) {
|
||||
if (!ie->installed) {
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
index_recorddeps(TRUE, lists->root, ie);
|
||||
msgInfo("Added %s to selection list", kp->name);
|
||||
}
|
||||
else {
|
||||
else if (ie->depc == 0) {
|
||||
WINDOW *save = savescr();
|
||||
|
||||
if (!msgYesNo("Do you really want to delete %s from the system?", kp->name))
|
||||
if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name))
|
||||
msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name);
|
||||
else {
|
||||
ie->installed = 0;
|
||||
index_recorddeps(FALSE, lists->root, ie);
|
||||
}
|
||||
restorescr(save);
|
||||
}
|
||||
else
|
||||
msgConfirm("Warning: Package %s is needed by\n %d other installed package%s.",
|
||||
kp->name, ie->depc, (ie->depc != 1) ? "s" : "");
|
||||
}
|
||||
else {
|
||||
index_recorddeps(FALSE, lists->root, ie);
|
||||
msgInfo("Removed %s from selection list", kp->name);
|
||||
index_delete(sp);
|
||||
}
|
||||
ret = DITEM_SUCCESS;
|
||||
/* Mark menu for redraw if we had dependencies */
|
||||
if (strlen(ie->deps) > 0)
|
||||
ret |= DITEM_REDRAW;
|
||||
}
|
||||
else { /* Not a package, must be a directory */
|
||||
int p, s;
|
||||
|
||||
p = s = 0;
|
||||
index_menu(kp, plist, &p, &s);
|
||||
index_menu(lists->root, kp, plist, &p, &s);
|
||||
ret = DITEM_SUCCESS | DITEM_CONTINUE;
|
||||
}
|
||||
return ret;
|
||||
@ -473,8 +517,9 @@ pkg_selected(dialogMenuItem *self, int is_selected)
|
||||
}
|
||||
|
||||
int
|
||||
index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
{
|
||||
struct ListPtrs lists;
|
||||
int n, rval, maxname;
|
||||
int curr, max;
|
||||
PkgNodePtr kp;
|
||||
@ -482,6 +527,10 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
Boolean hasPackages;
|
||||
WINDOW *w;
|
||||
|
||||
lists.root = root;
|
||||
lists.top = top;
|
||||
lists.plist = plist;
|
||||
|
||||
hasPackages = FALSE;
|
||||
nitems = NULL;
|
||||
|
||||
@ -525,7 +574,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
SAFE_STRCPY(buf, kp->desc);
|
||||
if (strlen(buf) > (_MAX_DESC - maxname))
|
||||
buf[_MAX_DESC - maxname] = '\0';
|
||||
nitems = item_add(nitems, kp->name, buf, pkg_checked, pkg_fire, pkg_selected, kp, (int)plist, &curr, &max);
|
||||
nitems = item_add(nitems, kp->name, buf, pkg_checked, pkg_fire, pkg_selected, kp, (int)&lists, &curr, &max);
|
||||
++n;
|
||||
kp = kp->next;
|
||||
}
|
||||
@ -551,7 +600,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
|
||||
/* These need to be set to point at the found item, actually. Hmmm! */
|
||||
pos = scroll = 0;
|
||||
index_menu(menu, plist, &pos, &scroll);
|
||||
index_menu(root, menu, plist, &pos, &scroll);
|
||||
}
|
||||
else
|
||||
msgConfirm("Search string: %s yielded no hits.", cp);
|
||||
@ -612,7 +661,41 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended)
|
||||
}
|
||||
}
|
||||
/* Done with the deps? Load the real m'coy */
|
||||
if (DITEM_STATUS(status) == DITEM_SUCCESS)
|
||||
if (DITEM_STATUS(status) == DITEM_SUCCESS) {
|
||||
status = package_extract(dev, who->name, depended);
|
||||
if (DITEM_STATUS(status) == DITEM_SUCCESS)
|
||||
id->installed = 1;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
index_recorddeps(Boolean add, PkgNodePtr root, IndexEntryPtr ie)
|
||||
{
|
||||
char depends[1024], *space, *todo;
|
||||
PkgNodePtr found;
|
||||
IndexEntryPtr found_ie;
|
||||
|
||||
SAFE_STRCPY(depends, ie->deps);
|
||||
for (todo = depends; todo != NULL; ) {
|
||||
space = index(todo, ' ');
|
||||
if (space != NULL)
|
||||
*space = '\0';
|
||||
|
||||
if (strlen(todo) > 0) { /* only non-empty dependencies */
|
||||
found = index_search(root, todo, NULL);
|
||||
if (found != NULL) {
|
||||
found_ie = found->data;
|
||||
if (add)
|
||||
++found_ie->depc;
|
||||
else
|
||||
--found_ie->depc;
|
||||
}
|
||||
}
|
||||
|
||||
if (space != NULL)
|
||||
todo = space + 1;
|
||||
else
|
||||
todo = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.153 1999/01/20 12:31:43 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.154 1999/01/27 02:32:47 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -299,6 +299,8 @@ typedef struct _indexEntry { /* A single entry in an INDEX file */
|
||||
char *comment; /* one line description */
|
||||
char *descrfile; /* path to description file */
|
||||
char *deps; /* packages this depends on */
|
||||
int depc; /* how many depend on me */
|
||||
int installed; /* indicates if it is installed */
|
||||
char *maintainer; /* maintainer */
|
||||
} IndexEntry;
|
||||
typedef IndexEntry *IndexEntryPtr;
|
||||
@ -515,7 +517,7 @@ extern void globalsInit(void);
|
||||
|
||||
/* index.c */
|
||||
int index_read(FILE *fp, PkgNodePtr papa);
|
||||
int index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
|
||||
int index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
|
||||
void index_init(PkgNodePtr top, PkgNodePtr plist);
|
||||
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
|
||||
void index_sort(PkgNodePtr top);
|
||||
|
Loading…
Reference in New Issue
Block a user