3 * Copyright (c) 2000, Red Hat, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * A copy of the GNU General Public License can be found at
13 * Written by DJ Delorie <dj@cygnus.com>
17 /* Parse the setup.ini files. inilex.l provides the tokens for this. */
22 #include "iniparse.hh"
23 #include "PackageTrust.h"
25 extern int yyerror (const std::string& s);
28 #include "IniDBBuilder.h"
30 #define YYERROR_VERBOSE 1
31 #define YYINITDEPTH 1000
34 IniDBBuilder *iniBuilder;
39 %token SETUP_TIMESTAMP
41 %token SETUP_MINIMUM_VERSION
47 %token REPLACE_VERSIONS
53 %token T_PREV T_CURR T_TEST T_OTHER
58 %token OPENBRACE CLOSEBRACE EQUAL GT LT GTEQUAL LTEQUAL
67 : setup_headers packageseparator packages
70 setup_headers: /* empty */
71 | setup_headers header
74 header /* non-empty */
75 : SETUP_TIMESTAMP STRING { iniBuilder->buildTimestamp ($2); } NL
76 | SETUP_VERSION STRING { iniBuilder->buildVersion ($2); } NL
77 | RELEASE STRING { iniBuilder->set_release ($2); } NL
78 | ARCH STRING { iniBuilder->set_arch ($2); } NL
79 | SETUP_MINIMUM_VERSION STRING { std::string e = iniBuilder->buildMinimumVersion ($2); if (!e.empty()) { yyerror(e); } } NL
83 | packages package packageseparator
86 packageseparator: /* empty */
90 package /* non-empty */
91 : packagename NL packagedata
94 packagename /* non-empty */
95 : AT STRING { iniBuilder->buildPackage ($2); }
96 | PACKAGENAME STRING { iniBuilder->buildPackage ($2); }
99 packagedata: /* empty */
100 | packagedata singleitem
103 singleitem /* non-empty */
104 : PACKAGEVERSION STRING NL { iniBuilder->buildPackageVersion ($2); }
105 | SDESC STRING NL { iniBuilder->buildPackageSDesc($2); }
106 | LDESC STRING NL { iniBuilder->buildPackageLDesc($2); }
107 | T_PREV NL { iniBuilder->buildPackageTrust (TRUST_PREV); }
108 | T_CURR NL { iniBuilder->buildPackageTrust (TRUST_CURR); }
109 | T_TEST NL { iniBuilder->buildPackageTrust (TRUST_TEST); }
110 | T_OTHER NL { iniBuilder->buildPackageTrust (TRUST_OTHER); }
111 | SOURCEPACKAGE source NL
112 | CATEGORY categories NL
113 | INSTALL STRING STRING MD5 NL { iniBuilder->buildPackageInstall ($2, $3, $4, hashType::md5); }
114 | INSTALL STRING STRING SHA512 NL { iniBuilder->buildPackageInstall ($2, $3, $4, hashType::sha512); }
115 | SOURCE STRING STRING MD5 NL {iniBuilder->buildPackageSource ($2, $3, $4, hashType::md5); }
116 | SOURCE STRING STRING SHA512 NL {iniBuilder->buildPackageSource ($2, $3, $4, hashType::sha512); }
117 | DEPENDS { iniBuilder->buildBeginDepends(); } versionedpackagelist NL
118 | REQUIRES { iniBuilder->buildBeginDepends(); } versionedpackagelistsp NL
119 | BUILDDEPENDS { iniBuilder->buildBeginBuildDepends(); } versionedpackagelist NL
120 | OBSOLETES { iniBuilder->buildBeginObsoletes(); } versionedpackagelist NL
121 | PROVIDES { iniBuilder->buildBeginProvides(); } versionedpackagelist NL
122 | CONFLICTS { iniBuilder->buildBeginConflicts(); } versionedpackagelist NL
123 | REPLACE_VERSIONS versionlist NL
125 | MESSAGE STRING STRING NL { iniBuilder->buildMessage ($2, $3); }
126 | error NL { yyerror (std::string("unrecognized line ")
127 + stringify(yylineno)
128 + " (do you have the latest setup?)");
132 categories: /* empty */
133 | categories STRING { iniBuilder->buildPackageCategory ($2); }
136 source /* non-empty */
137 : STRING { iniBuilder->buildSourceName ($1); } versioninfo
140 versioninfo: /* empty */
141 | OPENBRACE STRING CLOSEBRACE { iniBuilder->buildSourceNameVersion ($2); }
144 versionedpackagelist: /* empty */
145 | versionedpackageentry
146 | versionedpackagelist listseparator versionedpackageentry
149 versionedpackagelistsp /* non-empty */
150 : versionedpackageentry
151 | versionedpackagelistsp versionedpackageentry
154 listseparator /* non-empty */
159 versionedpackageentry /* non-empty */
160 : STRING { iniBuilder->buildPackageListNode($1); } versioncriteria
163 versioncriteria: /* empty */
164 | OPENBRACE operator STRING CLOSEBRACE { iniBuilder->buildPackageListOperatorVersion ($3); }
167 operator /* non-empty */
168 : EQUAL { iniBuilder->buildPackageListOperator (PackageSpecification::Equals); }
169 | LT { iniBuilder->buildPackageListOperator (PackageSpecification::LessThan); }
170 | GT { iniBuilder->buildPackageListOperator (PackageSpecification::MoreThan); }
171 | LTEQUAL { iniBuilder->buildPackageListOperator (PackageSpecification::LessThanEquals); }
172 | GTEQUAL { iniBuilder->buildPackageListOperator (PackageSpecification::MoreThanEquals); }
175 versionlist: /* empty */
176 | versionlist STRING { iniBuilder->buildPackageReplaceVersionsList ($2); }