Remove parser rules for undocumented syntax which store data which is never used.
Architecture: Binary: Conflicts: Description: Installed-Size: Pre-Depends: Priority: Provides: Recommends: Replaces: Suggests: Signed-off-by: Jon Turney <jon.tur...@dronecode.org.uk> --- IniDBBuilder.h | 11 ---- IniDBBuilderPackage.cc | 135 ------------------------------------------------- IniDBBuilderPackage.h | 11 ---- inilex.ll | 18 ------- iniparse.yy | 38 ++------------ package_meta.cc | 1 - package_meta.h | 13 +---- package_source.h | 13 +---- package_version.cc | 42 --------------- package_version.h | 8 ++- 10 files changed, 8 insertions(+), 282 deletions(-) diff --git a/IniDBBuilder.h b/IniDBBuilder.h index 7f0a616..b3f5c57 100644 --- a/IniDBBuilder.h +++ b/IniDBBuilder.h @@ -33,23 +33,12 @@ public: virtual void buildPackageTrust (int) = 0; virtual void buildPackageCategory (const std::string& ) = 0; virtual void buildBeginDepends () = 0; - virtual void buildBeginPreDepends () = 0; - virtual void buildPriority (const std::string& ) = 0; - virtual void buildInstalledSize (const std::string& ) = 0; - virtual void buildArchitecture (const std::string& ) = 0; virtual void buildInstallSize (const std::string& ) = 0; virtual void buildInstallSHA512 (unsigned char const[64]) = 0; virtual void buildSourceSHA512 (unsigned char const[64]) = 0; virtual void buildInstallMD5 (unsigned char const[16]) = 0; virtual void buildSourceMD5 (unsigned char const[16]) = 0; - virtual void buildBeginRecommends () = 0; - virtual void buildBeginSuggests () = 0; - virtual void buildBeginReplaces () = 0; - virtual void buildBeginConflicts () = 0; - virtual void buildBeginProvides () = 0; virtual void buildBeginBuildDepends () = 0; - virtual void buildBeginBinary () = 0; - virtual void buildDescription (const std::string& ) = 0; virtual void buildSourceName (const std::string& ) = 0; virtual void buildSourceNameVersion (const std::string& ) = 0; virtual void buildPackageListAndNode () = 0; diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc index d5a473b..582d249 100644 --- a/IniDBBuilderPackage.cc +++ b/IniDBBuilderPackage.cc @@ -205,51 +205,6 @@ IniDBBuilderPackage::buildBeginDepends () } void -IniDBBuilderPackage::buildBeginPreDepends () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a predepends statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cbpv.predepends(); -} - -void -IniDBBuilderPackage::buildPriority (const std::string& priority) -{ - cp->priority = priority; -#if DEBUG - Log (LOG_BABBLE) << "Package " << cp->name << " is " << priority << endLog; -#endif -} - -void -IniDBBuilderPackage::buildInstalledSize (const std::string& size) -{ - cbpv.source()->setInstalledSize (atoi(size.c_str())); -#if DEBUG - Log (LOG_BABBLE) << "Installed size for " << cp->name << " is " << cbpv.source()->installedSize() << endLog; -#endif -} - -/* TODO: we can multiple arch's for a given package, - and it may befor either source or binary, so we need to either set both - or track a third current package that points to whether we altering source - or binary at the moment - */ -void -IniDBBuilderPackage::buildArchitecture (const std::string &arch) -{ - cp->architecture = arch; -#if DEBUG - Log (LOG_BABBLE) << "Package " << cp->name << " is for " - << arch << " architectures." << endLog; -#endif -} - -void IniDBBuilderPackage::buildInstallSize (const std::string &size) { setSourceSize (*cbpv.source(), size); @@ -288,66 +243,6 @@ IniDBBuilderPackage::buildSourceMD5 (unsigned char const *md5) } void -IniDBBuilderPackage::buildBeginRecommends () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a recommends statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cbpv.recommends(); -} - -void -IniDBBuilderPackage::buildBeginSuggests () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a suggests statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cbpv.suggests(); -} - -void -IniDBBuilderPackage::buildBeginReplaces () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a replaces statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cbpv.replaces(); -} - -void -IniDBBuilderPackage::buildBeginConflicts () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a conflicts statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cbpv.conflicts(); -} - -void -IniDBBuilderPackage::buildBeginProvides () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a provides statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cbpv.provides(); -} - -void IniDBBuilderPackage::buildBeginBuildDepends () { #if DEBUG @@ -359,36 +254,6 @@ IniDBBuilderPackage::buildBeginBuildDepends () currentAndList = cspv.depends (); } - -void -IniDBBuilderPackage::buildBeginBinary () -{ -#if DEBUG - Log (LOG_BABBLE) << "Beginning of a Binary statement" << endLog; - dumpAndList (currentAndList, Log (LOG_BABBLE)); -#endif - currentSpec = NULL; - currentOrList = NULL; /* set by the build AndListNode */ - currentAndList = cspv.binaries (); -} - -void -IniDBBuilderPackage::buildDescription (const std::string& descline) -{ - if (cbpv) - { - cbpv.set_ldesc(cbpv.LDesc() + descline + "\n"); -#if DEBUG - Log (LOG_BABBLE) << "Description for " << cp->name << ": \"" << - descline << "\"." << endLog; -#endif - } - else - _feedback.warning ((std::string ("Attempt to set description for package") - + std::string(cp->name) - + "before creation of a version.").c_str()); -} - void IniDBBuilderPackage::buildSourceName (const std::string& name) { diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h index 5f65530..a97c53f 100644 --- a/IniDBBuilderPackage.h +++ b/IniDBBuilderPackage.h @@ -40,23 +40,12 @@ public: virtual void buildPackageCategory (const std::string& ); virtual void buildBeginDepends (); - virtual void buildBeginPreDepends (); - virtual void buildPriority (const std::string& ); - virtual void buildInstalledSize (const std::string& ); - virtual void buildArchitecture (const std::string& ); virtual void buildInstallSize (const std::string& ); virtual void buildInstallSHA512 (unsigned char const[64]); virtual void buildSourceSHA512 (unsigned char const[64]); virtual void buildInstallMD5 (unsigned char const[16]); virtual void buildSourceMD5 (unsigned char const[16]); - virtual void buildBeginRecommends (); - virtual void buildBeginSuggests (); - virtual void buildBeginReplaces (); - virtual void buildBeginConflicts (); - virtual void buildBeginProvides (); virtual void buildBeginBuildDepends (); - virtual void buildBeginBinary (); - virtual void buildDescription (const std::string&); virtual void buildMessage (const std::string&, const std::string&); virtual void buildSourceName (const std::string& ); virtual void buildSourceNameVersion (const std::string& ); diff --git a/inilex.ll b/inilex.ll index f4d53b1..e9100e2 100644 --- a/inilex.ll +++ b/inilex.ll @@ -42,8 +42,6 @@ static void ignore_line (void); %option yylineno %option never-interactive -%x descriptionstate - STR [!a-zA-Z0-9_./:\+~-]+ HEX [0-9a-f] B64 [a-zA-Z0-9_-] @@ -118,27 +116,16 @@ B64 [a-zA-Z0-9_-] "sdesc:" return SDESC; "ldesc:" return LDESC; "message:" return MESSAGE; -"Description:" BEGIN (descriptionstate); return DESCTAG; "Size:" return FILESIZE; "MD5sum:" return MD5LINE; "SHA512:" return SHA512LINE; -"Installed-Size:" return INSTALLEDSIZE; -"Architecture:" return ARCHITECTURE; "Source:" return SOURCEPACKAGE; -"Binary:" return BINARYPACKAGE; "Build-Depends:" return BUILDDEPENDS; "Build-Depends-Indep:" return BUILDDEPENDS; /* technicallyincorrect :[ */ "category:"|"Section:" return CATEGORY; -"Priority:" return PRIORITY; "requires:" return REQUIRES; "Depends:" return DEPENDS; -"Pre-Depends:" return PREDEPENDS; -"Recommends:" return RECOMMENDS; -"Suggests:" return SUGGESTS; -"Conflicts:" return CONFLICTS; -"Replaces:" return REPLACES; -"Provides:" return PROVIDES; ^{STR}":" ignore_line (); @@ -168,11 +155,6 @@ B64 [a-zA-Z0-9_-] [ \t\r]+ /* do nothing */; ^"#".*\n /* do nothing */; -<descriptionstate>[^\n]+ { yylval = new char [strlen(yytext) + 1]; - strcpy (yylval, yytext); - return STRTOEOL; } -<descriptionstate>\n { return NL; } -<descriptionstate>"\n"+ {BEGIN(INITIAL); return PARAGRAPH;} \n { return NL; } . { return *yytext;} diff --git a/iniparse.yy b/iniparse.yy index f8b949f..a544bce 100644 --- a/iniparse.yy +++ b/iniparse.yy @@ -41,14 +41,12 @@ void add_correct_version(); %token SETUP_TIMESTAMP SETUP_VERSION PACKAGEVERSION INSTALL SOURCE SDESC LDESC %token CATEGORY DEPENDS REQUIRES %token T_PREV T_CURR T_TEST T_OTHER -%token INSTALLEDSIZE PRIORITY %token MD5 MD5LINE SHA512 SHA512LINE -%token DESCTAG FILESIZE ARCHITECTURE SOURCEPACKAGE -%token RECOMMENDS PREDEPENDS -%token SUGGESTS CONFLICTS REPLACES PROVIDES PACKAGENAME STRTOEOL PARAGRAPH +%token FILESIZE SOURCEPACKAGE +%token PACKAGENAME %token COMMA OR NL AT %token OPENBRACE CLOSEBRACE EQUAL GT LT GTEQUAL LTEQUAL -%token BINARYPACKAGE BUILDDEPENDS +%token BUILDDEPENDS %token MESSAGE %token ARCH RELEASE @@ -98,9 +96,6 @@ singleitem /* non-empty */ | 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); } - | ARCHITECTURE packagearchspec NL { iniBuilder->buildArchitecture ($2); } | FILESIZE STRING NL { iniBuilder->buildInstallSize($2); } | MD5LINE MD5 NL { iniBuilder->buildInstallMD5 ((unsigned char *)$2); } | SHA512LINE SHA512 NL { iniBuilder->buildInstallSHA512 ((unsigned char *)$2); } @@ -108,28 +103,16 @@ singleitem /* non-empty */ | CATEGORY categories NL | INSTALL STRING STRING { iniBuilder->buildPackageInstall ($2); iniBuilder->buildInstallSize($3);} installchksum NL | SOURCE STRING STRING sourcechksum NL {iniBuilder->buildPackageSource ($2, $3);} - | PROVIDES { iniBuilder->buildBeginProvides(); } packagelist NL - | BINARYPACKAGE { iniBuilder->buildBeginBinary (); } packagelist NL - | CONFLICTS { iniBuilder->buildBeginConflicts(); } versionedpackagelist NL | DEPENDS { iniBuilder->buildBeginDepends(); } versionedpackagelist NL | REQUIRES { iniBuilder->buildBeginDepends(); } versionedpackagelistsp NL - | PREDEPENDS { iniBuilder->buildBeginPreDepends(); } versionedpackagelist NL - | RECOMMENDS { iniBuilder->buildBeginRecommends(); } versionedpackagelist NL - | SUGGESTS { iniBuilder->buildBeginSuggests(); } versionedpackagelist NL - | REPLACES { iniBuilder->buildBeginReplaces(); } versionedpackagelist NL | BUILDDEPENDS { iniBuilder->buildBeginBuildDepends(); } versionedpackagelist NL | MESSAGE STRING STRING NL { iniBuilder->buildMessage ($2, $3); } - | DESCTAG mlinedesc | error { yyerror (std::string("unrecognized line ") + stringify(yylineno) + " (do you have the latest setup?)"); } ; -packagearchspec: /* empty */ - | packagearchspec STRING { iniBuilder->buildArchitecture ($2); } - ; - categories: /* empty */ | categories STRING { iniBuilder->buildPackageCategory ($2); } ; @@ -152,21 +135,6 @@ versioninfo: /* empty */ | OPENBRACE STRING CLOSEBRACE { iniBuilder->buildSourceNameVersion ($2); } ; -mlinedesc: /* empty */ - | mlinedesc STRTOEOL NL { iniBuilder->buildDescription ($2); } - | mlinedesc STRTOEOL PARAGRAPH { iniBuilder->buildDescription ($2); } - ; - -packagelist /* non-empty */ - : packagelist COMMA { iniBuilder->buildPackageListAndNode(); } packageentry - | { iniBuilder->buildPackageListAndNode(); } packageentry - ; - -packageentry /* empty not allowed */ - : STRING { iniBuilder->buildPackageListOrNode($1); } - | packageentry OR STRING { iniBuilder->buildPackageListOrNode($3); } - ; - versionedpackagelist /* non-empty */ : { iniBuilder->buildPackageListAndNode(); } versionedpackageentry | versionedpackagelist listseparator { iniBuilder->buildPackageListAndNode(); } versionedpackageentry diff --git a/package_meta.cc b/package_meta.cc index 3923b13..0836187 100644 --- a/package_meta.cc +++ b/package_meta.cc @@ -97,7 +97,6 @@ packagemeta::packagemeta (packagemeta const &rhs) : curr (rhs.curr), exp (rhs.exp), desired (rhs.desired), - architecture (rhs.architecture), priority (rhs.priority), visited_(rhs.visited_) { diff --git a/package_meta.h b/package_meta.h index 3d6ccd2..f23073e 100644 --- a/package_meta.h +++ b/package_meta.h @@ -36,7 +36,7 @@ public: packagemeta (packagemeta const &); packagemeta (const std::string& pkgname) : name (pkgname), key(pkgname), user_picked (false), - architecture (), priority(), visited_(false) + visited_(false) { } @@ -142,17 +142,6 @@ public: /* What version does the user want ? */ packageversion desired; - /* What platform is this for ? - * i386 - linux i386 - * cygwin - cygwin for 32 bit MS Windows - * All - no binary code, or a version for every platform - */ - std::string architecture; - /* What priority does this package have? - * TODO: this should be linked into a list of priorities. - */ - std::string priority; - packagemessage message; /* can one or more versions be installed? */ diff --git a/package_source.h b/package_source.h index 997ccf8..9e68bdc 100644 --- a/package_source.h +++ b/package_source.h @@ -58,23 +58,13 @@ public: class packagesource { public: - packagesource ():size (0), canonical (0), base (0), filename (0), cached (), - _installedSize (0) + packagesource ():size (0), canonical (0), base (0), filename (0), cached () { memset (sha512sum, 0, sizeof sha512sum); sha512_isSet = false; }; /* how big is the source file */ size_t size; - /* how much space do we need to install this ? */ - virtual unsigned long installedSize () const - { - return _installedSize; - } - virtual void setInstalledSize (unsigned long size) - { - _installedSize = size; - } /* The canonical name - the complete path to the source file * i.e. foo/bar/package-1.tar.bz2 */ @@ -128,7 +118,6 @@ private: char *base; char *filename; std::string cached; - unsigned long _installedSize; }; #endif /* SETUP_PACKAGE_SOURCE_H */ diff --git a/package_version.cc b/package_version.cc index c7d9d24..5b4c6fc 100644 --- a/package_version.cc +++ b/package_version.cc @@ -247,48 +247,6 @@ packageversion::depends() const return &data->depends; } -vector <vector <PackageSpecification *> *> * -packageversion::predepends() -{ - return &data->predepends; -} - -vector <vector <PackageSpecification *> *> * -packageversion::recommends() -{ - return &data->recommends; -} - -vector <vector <PackageSpecification *> *> * -packageversion::suggests() -{ - return &data->suggests; -} - -vector <vector <PackageSpecification *> *> * -packageversion::replaces() -{ - return &data->replaces; -} - -vector <vector <PackageSpecification *> *> * -packageversion::conflicts() -{ - return &data->conflicts; -} - -vector <vector <PackageSpecification *> *> * -packageversion::provides() -{ - return &data->provides; -} - -vector <vector <PackageSpecification *> *> * -packageversion::binaries() -{ - return &data->binaries; -} - bool packageversion::picked () const { diff --git a/package_version.h b/package_version.h index 32700f0..edfd15a 100644 --- a/package_version.h +++ b/package_version.h @@ -118,9 +118,8 @@ public: void setSourcePackageSpecification (PackageSpecification const &); /* invariant: these never return NULL */ - std::vector <std::vector <PackageSpecification *> *> *depends(), *predepends(), - *recommends(), *suggests(), *replaces(), *conflicts(), *provides(), *binaries(); - const std::vector <std::vector <PackageSpecification *> *> *depends() const; + std::vector <std::vector <PackageSpecification *> *> *depends(); + const std::vector <std::vector <PackageSpecification *> *> *depends() const; bool picked() const; /* true if this version is to be installed */ void pick(bool, packagemeta *); /* trigger an install/reinsall */ @@ -187,8 +186,7 @@ public: virtual PackageSpecification & sourcePackageSpecification (); virtual void setSourcePackageSpecification (PackageSpecification const &); - std::vector <std::vector <PackageSpecification *> *> depends, predepends, recommends, - suggests, replaces, conflicts, provides, binaries; + std::vector <std::vector <PackageSpecification *> *> depends; virtual void pick(bool const &newValue) { picked = newValue;} bool picked; /* non zero if this version is to be installed */ -- 2.8.3