This recognizes any "[version]" line as introducing the information for
another version, which doesn't have one of the trust levels [curr], [prev]
or [test], and so isn't automatically selected when setup is

Since the value of <version> carries no meaning, it might make more sense
to mandate the use of a specific string like "[also]" or "[other]", or
perhaps "[prev-1]", "[prev-2]", etc.

I have written a corresponding patch to genini

Setup already does all the neccessary sorting in version order etc. to
use these additional versions.

2011-04-24  Jon TURNEY  <[email protected]>

        * PackageTrust.h (trusts): Add TRUST_OTHER.
        * inilex.ll: tokenize any other [version] as the T_OTHER token.
        * iniparse.yy: Add T_OTHER token and set package trust
        to TRUST_OTHER when it is used.

Signed-off-by: Jon TURNEY <[email protected]>
---
 PackageTrust.h |    2 +-
 inilex.ll      |    1 +
 iniparse.yy    |    3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/PackageTrust.h b/PackageTrust.h
index 3e6801d..4904705 100644
--- a/PackageTrust.h
+++ b/PackageTrust.h
@@ -20,10 +20,10 @@
 typedef enum
 {
   TRUST_UNKNOWN,
+  TRUST_OTHER,
   TRUST_PREV,
   TRUST_CURR,
   TRUST_TEST,
-  NTRUST
 }
 trusts;
 
diff --git a/inilex.ll b/inilex.ll
index b119049..5dfbe3b 100644
--- a/inilex.ll
+++ b/inilex.ll
@@ -116,6 +116,7 @@ STR [!a-zA-Z0-9_./:\+~-]+
 "[test]"               return T_TEST;
 "[exp]"                        return T_TEST;
 "[prev]"               return T_PREV;
+"["{STR}"]"            return T_OTHER;
 
 "("                    return OPENBRACE;
 ")"                    return CLOSEBRACE;
diff --git a/iniparse.yy b/iniparse.yy
index c8332ff..cd2d66e 100644
--- a/iniparse.yy
+++ b/iniparse.yy
@@ -41,7 +41,7 @@ void add_correct_version();
 %token SETUP_TIMESTAMP SETUP_VERSION PACKAGEVERSION INSTALL SOURCE SDESC LDESC
 %token CATEGORY DEPENDS REQUIRES
 %token APATH PPATH INCLUDE_SETUP EXCLUDE_PACKAGE DOWNLOAD_URL
-%token T_PREV T_CURR T_TEST
+%token T_PREV T_CURR T_TEST T_OTHER
 %token MD5 INSTALLEDSIZE MAINTAINER PRIORITY
 %token DESCTAG DESCRIPTION FILESIZE ARCHITECTURE SOURCEPACKAGE MD5LINE 
 %token RECOMMENDS PREDEPENDS
@@ -95,6 +95,7 @@ singleitem /* non-empty */
  | T_PREV NL                   { iniBuilder->buildPackageTrust (TRUST_PREV); }
  | T_CURR NL                   { iniBuilder->buildPackageTrust (TRUST_CURR); }
  | T_TEST NL                   { iniBuilder->buildPackageTrust (TRUST_TEST); }
+ | T_OTHER NL                  { iniBuilder->buildPackageTrust (TRUST_OTHER); }
  | PRIORITY STRING NL          { iniBuilder->buildPriority ($2); }
  | INSTALLEDSIZE STRING NL     { iniBuilder->buildInstalledSize ($2); }
  | MAINTAINER STRING NL                { iniBuilder->buildMaintainer ($2); }
-- 
1.7.4

Reply via email to