summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-05-09 18:55:41 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-05-11 17:22:32 +0200
commite8fb1cdfdd13e45f2b3abbd57a28b57ae6137f14 (patch)
tree5b32d156d47a99921fedcdaad66471bf0a0293fa /apt-pkg
parent5f4fcd88bdabee993dd07244d2f0f8f3658c40f2 (diff)
sync TFRewrite*Order arrays with dpkg and dak
dpkg and dak know various field names and order them in their output, while we have yet another order and have to play catch up with them as we are sitting between chairs here and neither order is ideal for us, too. A little testcase is from now on supposed to help ensureing that we do not derivate to far away from which fields dpkg knows and orders.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/tagfile-order.c109
-rw-r--r--apt-pkg/tagfile.cc63
2 files changed, 112 insertions, 60 deletions
diff --git a/apt-pkg/tagfile-order.c b/apt-pkg/tagfile-order.c
new file mode 100644
index 000000000..10c61ab94
--- /dev/null
+++ b/apt-pkg/tagfile-order.c
@@ -0,0 +1,109 @@
+/* In this file is the order defined in which e.g. apt-ftparchive will write stanzas in.
+ Other commands might or might not use this. 'apt-cache show' e.g. does NOT!
+
+ The order we chose here is inspired by both dpkg and dak.
+ The testcase test/integration/test-apt-tagfile-fields-order intends to ensure that
+ this file isn't lacking (too far) behind dpkg over time. */
+
+static const char *iTFRewritePackageOrder[] = {
+ "Package",
+ "Package-Type",
+ "Architecture",
+ "Subarchitecture", // Used only by d-i
+ "Version",
+ "Revision", // Obsolete (warning in dpkg)
+ "Package-Revision", // Obsolete (warning in dpkg)
+ "Package_Revision", // Obsolete (warning in dpkg)
+ "Kernel-Version", // Used only by d-i
+ "Built-Using",
+ "Built-For-Profiles",
+ "Multi-Arch",
+ "Status",
+ "Priority",
+ "Class", // dpkg nickname for Priority
+ "Essential",
+ "Installer-Menu-Item", // Used only by d-i
+ "Section",
+ "Source",
+ "Origin",
+ "Maintainer",
+ "Original-Maintainer", // unknown in dpkg order
+ "Bugs",
+ "Config-Version", // Internal of dpkg
+ "Conffiles",
+ "Triggers-Awaited",
+ "Triggers-Pending",
+ "Installed-Size",
+ "Provides",
+ "Pre-Depends",
+ "Depends",
+ "Recommends",
+ "Recommended", // dpkg nickname for Recommends
+ "Suggests",
+ "Optional", // dpkg nickname for Suggests
+ "Conflicts",
+ "Breaks",
+ "Replaces",
+ "Enhances",
+ "Filename",
+ "MSDOS-Filename", // Obsolete (used by dselect)
+ "Size",
+ "MD5sum",
+ "SHA1",
+ "SHA256",
+ "SHA512",
+ "Homepage",
+ "Description",
+ "Tag",
+ "Task",
+ 0
+};
+static const char *iTFRewriteSourceOrder[] = {
+ "Package",
+ "Source", // dsc file, renamed to Package in Sources
+ "Format",
+ "Binary",
+ "Architecture",
+ "Version",
+ "Priority",
+ "Class", // dpkg nickname for Priority
+ "Section",
+ "Origin",
+ "Maintainer",
+ "Original-Maintainer", // unknown in dpkg order
+ "Uploaders",
+ "Dm-Upload-Allowed", // Obsolete (ignored by dak)
+ "Standards-Version",
+ "Build-Depends",
+ "Build-Depends-Arch",
+ "Build-Depends-Indep",
+ "Build-Conflicts",
+ "Build-Conflicts-Arch",
+ "Build-Conflicts-Indep",
+ "Testsuite",
+ "Homepage",
+ "Vcs-Browser",
+ "Vcs-Browse", // dak only (nickname?)
+ "Vcs-Arch",
+ "Vcs-Bzr",
+ "Vcs-Cvs",
+ "Vcs-Darcs",
+ "Vcs-Git",
+ "Vcs-Hg",
+ "Vcs-Mtn",
+ "Vcs-Svn",
+ "Directory",
+ "Package-List",
+ "Files",
+ "Checksums-Md5",
+ "Checksums-Sha1",
+ "Checksums-Sha256",
+ "Checksums-Sha512",
+ 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;
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 9c40c8c92..2f7900d93 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -623,71 +623,14 @@ APT_PURE unsigned int pkgTagSection::Count() const { /*{{{*/
return d->Tags.size() - 1;
}
/*}}}*/
+
+#include "tagfile-order.c"
+
// 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",
- "Original-Maintainer",
- "Architecture",
- "Source",
- "Version",
- "Revision", // Obsolete
- "Config-Version", // Obsolete
- "Replaces",
- "Provides",
- "Depends",
- "Pre-Depends",
- "Recommends",
- "Suggests",
- "Conflicts",
- "Breaks",
- "Conffiles",
- "Filename",
- "Size",
- "MD5sum",
- "SHA1",
- "SHA256",
- "SHA512",
- "MSDOS-Filename", // Obsolete
- "Description",
- 0};
-static const char *iTFRewriteSourceOrder[] = {"Package",
- "Source",
- "Binary",
- "Version",
- "Priority",
- "Section",
- "Maintainer",
- "Original-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)
{