- for (int I = 1; I != argc; I++)
- {
- cout << "Merging in " << argv[I] << endl;
- File F(argv[I],File::ReadOnly);
- Gen.SelectFile(argv[I]);
- debListParser Parser(F);
- Gen.MergeList(Parser);
- }
+ case 1:
+ Flags |= Flag;
+ return true;
+
+ default:
+ _error->Warning("Unknown flag value: %s",string(Start,Stop).c_str());
+ return true;
+ }
+ return true;
+}
+ /*}}}*/
+
+// TFRewrite - Rewrite a control record /*{{{*/
+// ---------------------------------------------------------------------
+/* This writes the control record to stdout rewriting it as necessary. The
+ override map item specificies the rewriting rules to follow. This also
+ takes the time to sort the feild list. */
+
+/* The order of this list is taken from dpkg source lib/parse.c the fieldinfos
+ array. */
+static const char *iTFRewritePackageOrder[] = {
+ "Package",
+ "Essential",
+ "Status",
+ "Priority",
+ "Section",
+ "Installed-Size",
+ "Maintainer",
+ "Architecture",
+ "Source",
+ "Version",
+ "Revision", // Obsolete
+ "Config-Version", // Obsolete
+ "Replaces",
+ "Provides",
+ "Depends",
+ "Pre-Depends",
+ "Recommends",
+ "Suggests",
+ "Conflicts",
+ "Breaks",
+ "Conffiles",
+ "Filename",
+ "Size",
+ "MD5Sum",
+ "SHA1",
+ "SHA256",
+ "MSDOS-Filename", // Obsolete
+ "Description",
+ 0};
+static const char *iTFRewriteSourceOrder[] = {"Package",
+ "Source",
+ "Binary",
+ "Version",
+ "Priority",
+ "Section",
+ "Maintainer",
+ "Build-Depends",
+ "Build-Depends-Indep",
+ "Build-Conflicts",
+ "Build-Conflicts-Indep",
+ "Architecture",
+ "Standards-Version",
+ "Format",
+ "Directory",
+ "Files",
+ 0};
+
+/* Two levels of initialization are used because gcc will set the symbol
+ size of an array to the length of the array, causing dynamic relinking
+ errors. Doing this makes the symbol size constant */
+const char **TFRewritePackageOrder = iTFRewritePackageOrder;
+const char **TFRewriteSourceOrder = iTFRewriteSourceOrder;
+
+bool TFRewrite(FILE *Output,pkgTagSection const &Tags,const char *Order[],
+ TFRewriteData *Rewrite)
+{
+ unsigned char Visited[256]; // Bit 1 is Order, Bit 2 is Rewrite
+ for (unsigned I = 0; I != 256; I++)
+ Visited[I] = 0;
+
+ // Set new tag up as necessary.
+ for (unsigned int J = 0; Rewrite != 0 && Rewrite[J].Tag != 0; J++)
+ {
+ if (Rewrite[J].NewTag == 0)
+ Rewrite[J].NewTag = Rewrite[J].Tag;