? category.patch
Index: choose.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/choose.cc,v
retrieving revision 2.23
diff -u -p -r2.23 choose.cc
--- choose.cc	2001/05/27 19:43:52	2.23
+++ choose.cc	2001/06/13 02:50:34
@@ -87,8 +87,10 @@ headers[] = {
 #define NEW_COL 1
   { "Src?", 4, 0, 0 },
 #define SRC_COL 2
+  { "Category", 8, 0, 0 },
+#define CATEGORY_COL 3
   { "Package", 7, 0, 0 },
-#define PACKAGE_COL 3
+#define PACKAGE_COL 4
   { 0, 0, 0, 0 }
 };
 #define NUM_COLUMNS (sizeof (headers) / (sizeof (headers[0])) - 1)
@@ -188,6 +190,9 @@ paint (HWND hwnd)
       BitBlt (hdc, x + headers[SRC_COL].x, by, 11, 11,
 	      bitmap_dc, 0, 0, SRCCOPY);
 
+      if (package[i].category)
+	TextOut (hdc, x + headers[CATEGORY_COL].x, r, package[i].category, strlen (package[i].category));
+
       if (package[i].name)
 	TextOut (hdc, x + headers[PACKAGE_COL].x, r, package[i].name, strlen (package[i].name));
     }
@@ -440,7 +445,12 @@ best_trust (int p, int trust)
       ((package[p].info[t].install_exists && source == IDC_SOURCE_CWD) ||
        (package[p].info[t].install_exists == 0 &&
 	source == IDC_SOURCE_DOWNLOAD) || source == IDC_SOURCE_NETINST))
-    return t;
+    {
+      if (package[p].category && strcasecmp(package[p].category, "Required"))
+        return TRUST_NONE;
+      else
+	return t;
+    }
   if (extra[p].installed_file && extra[p].installed_ver == package[p].info[t].version)
     return TRUST_KEEP;
   return TRUST_NONE;
@@ -640,6 +650,7 @@ create_listview (HWND dlg, RECT *r)
       for (t = 0; t < NTRUST; t++)
 	note_width (dc, package[i].info[t].version, NEW_COL_SIZE_SLOP, NEW_COL);
       note_width (dc, package[i].name, 0, PACKAGE_COL);
+      note_width (dc, package[i].category, 0, CATEGORY_COL);
       note_width (dc, package[i].sdesc, 0, PACKAGE_COL);
     }
   note_width (dc, "keep", NEW_COL_SIZE_SLOP, NEW_COL);
@@ -648,7 +659,8 @@ create_listview (HWND dlg, RECT *r)
   headers[CURRENT_COL].x = HMARGIN/2;
   headers[NEW_COL].x = headers[CURRENT_COL].x + headers[CURRENT_COL].width + NEW_COL_SIZE_SLOP + HMARGIN;
   headers[SRC_COL].x = headers[NEW_COL].x + headers[NEW_COL].width + HMARGIN;
-  headers[PACKAGE_COL].x = headers[SRC_COL].x + headers[SRC_COL].width + HMARGIN;
+  headers[CATEGORY_COL].x = headers[SRC_COL].x + headers[SRC_COL].width + HMARGIN;
+  headers[PACKAGE_COL].x = headers[CATEGORY_COL].x + headers[CATEGORY_COL].width + HMARGIN;
 
   default_trust (lv, TRUST_CURR);
   set_full_list (lv, full_list);
@@ -1096,9 +1108,11 @@ do_choose (HINSTANCE h)
 			       : "unknown");
       const char *partial_list = ((extra[i].in_partial_list == 1) ? "yes" : "no");
 
-      log (LOG_BABBLE, "[%s] action=%s trust=%s installed=%s partial_list=%s src?=%s",
+      log (LOG_BABBLE, "[%s] action=%s trust=%s installed=%s partial_list=%s src?=%s"
+	   " category=%s",
 	   package[i].name, action, trust, installed,
-	   partial_list, package[i].srcaction == SRCACTION_NO ? "no" : "yes");
+	   partial_list, package[i].srcaction == SRCACTION_NO ? "no" : "yes", 
+	   package[i].category);
       for (int t = 0; t < NTRUST; t++)
 	{
 	  if (package[i].info[t].install)
Index: ini.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/ini.h,v
retrieving revision 2.7
diff -u -p -r2.7 ini.h
--- ini.h	2001/05/27 07:05:09	2.7
+++ ini.h	2001/06/13 02:50:34
@@ -57,6 +57,7 @@ typedef struct
   char *name;	/* package name, like "cygwin" */
   char *sdesc;	/* short description (replaces "name" if provided) */
   char *ldesc;	/* long description (multi-line) */
+  char *category; /* the category the package belongs to, like "required" or "XFree86" */
   int action;	/* ACTION_* - only NEW and UPGRADE get installed */
   int srcaction;/* SRCACTION_ */
   int trust;	/* TRUST_* (selects among info[] below) */
Index: inilex.l
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/inilex.l,v
retrieving revision 2.2
diff -u -p -r2.2 inilex.l
--- inilex.l	2001/05/30 01:38:41	2.2
+++ inilex.l	2001/06/13 02:50:34
@@ -47,6 +47,7 @@ STR	[a-zA-Z0-9_./+-]+
 "setup-timestamp:"	return SETUP_TIMESTAMP;
 "setup-version:"	return SETUP_VERSION;
 "version:"		return VERSION;
+"category:"		return CATEGORY;
 "install:"		return INSTALL;
 "source:"		return SOURCE;
 "sdesc:"		return SDESC;
Index: iniparse.y
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/iniparse.y,v
retrieving revision 2.6
diff -u -p -r2.6 iniparse.y
--- iniparse.y	2001/05/27 19:43:52	2.6
+++ iniparse.y	2001/06/13 02:50:34
@@ -43,7 +43,7 @@ extern int yylineno;
 %}
 
 %token STRING
-%token SETUP_TIMESTAMP SETUP_VERSION VERSION INSTALL SOURCE SDESC LDESC
+%token SETUP_TIMESTAMP SETUP_VERSION VERSION INSTALL SOURCE SDESC LDESC CATEGORY
 %token T_PREV T_CURR T_TEST T_UNKNOWN
 
 %%
@@ -81,6 +81,7 @@ lines
 
 simple_line
  : VERSION STRING		{ cpt->version = $2; }
+ | CATEGORY STRING		{ cp->category = $2; }
  | SDESC STRING			{ cp->sdesc = $2; }
  | LDESC STRING			{ cp->ldesc = $2; }
  | INSTALL STRING STRING	{ cpt->install = $2;
