This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 14/14] Add obsoletes: support
Note that we need separate depends and obsoletes nodelists
---
IniDBBuilderPackage.cc | 23 ++++++++++++++++++-----
IniDBBuilderPackage.h | 5 ++++-
inilex.ll | 1 +
iniparse.yy | 3 +++
libsolv.cc | 2 ++
libsolv.h | 1 +
package_db.cc | 1 +
7 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index b929c7e..4e92961 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -88,7 +88,9 @@ IniDBBuilderPackage::buildPackage (const std::string& _name)
cbpv.archive = packagesource();
currentSpec = NULL;
- currentNodeList = PackageDepends();
+ currentNodeList = NULL;
+ dependsNodeList = PackageDepends();
+ obsoletesNodeList = PackageDepends();
#if DEBUG
Log (LOG_BABBLE) << "Created package " << name << endLog;
#endif
@@ -208,8 +210,9 @@ IniDBBuilderPackage::buildBeginDepends ()
Log (LOG_BABBLE) << "Beginning of a depends statement " << endLog;
#endif
currentSpec = NULL;
- currentNodeList = PackageDepends();
- cbpv.requires = ¤tNodeList;
+ dependsNodeList= PackageDepends();
+ currentNodeList = &dependsNodeList;
+ cbpv.requires = &dependsNodeList;
}
void
@@ -219,11 +222,20 @@ IniDBBuilderPackage::buildBeginBuildDepends ()
Log (LOG_BABBLE) << "Beginning of a Build-Depends statement" << endLog;
#endif
currentSpec = NULL;
- currentNodeList = PackageDepends();
+ currentNodeList = NULL;
/* there is currently nowhere to store Build-Depends information */
}
void
+IniDBBuilderPackage::buildBeginObsoletes ()
+{
+ currentSpec = NULL;
+ obsoletesNodeList = PackageDepends();
+ currentNodeList = &obsoletesNodeList;
+ cbpv.obsoletes = &obsoletesNodeList;
+}
+
+void
IniDBBuilderPackage::buildSourceName (const std::string& _name)
{
// When there is a Source: line, that names a real source package
@@ -247,7 +259,8 @@ IniDBBuilderPackage::buildPackageListNode (const std::string & name)
Log (LOG_BABBLE) << "New node '" << name << "' for package list" << endLog;
#endif
currentSpec = new PackageSpecification (name);
- currentNodeList.push_back (currentSpec);
+ if (currentNodeList)
+ currentNodeList->push_back (currentSpec);
}
void
diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h
index 307d2b5..4e34680 100644
--- a/IniDBBuilderPackage.h
+++ b/IniDBBuilderPackage.h
@@ -57,6 +57,7 @@ public:
void buildBeginDepends ();
void buildBeginBuildDepends ();
+ void buildBeginObsoletes ();
void buildMessage (const std::string&, const std::string&);
void buildSourceName (const std::string& );
void buildSourceNameVersion (const std::string& );
@@ -83,7 +84,9 @@ private:
std::string message_id;
std::string message_string;
PackageSpecification *currentSpec;
- PackageDepends currentNodeList;
+ PackageDepends *currentNodeList;
+ PackageDepends dependsNodeList;
+ PackageDepends obsoletesNodeList;
SolverPool::addPackageData cbpv;
IniParseFeedback const &_feedback;
diff --git a/inilex.ll b/inilex.ll
index 13422b1..698775c 100644
--- a/inilex.ll
+++ b/inilex.ll
@@ -122,6 +122,7 @@ B64 [a-zA-Z0-9_-]
"category:"|"Section:" return CATEGORY;
"requires:" return REQUIRES;
[dD]"epends:" return DEPENDS;
+[oO]"bsoletes:" return OBSOLETES;
^{STR}":" ignore_line ();
diff --git a/iniparse.yy b/iniparse.yy
index 18ebe2a..3b74e36 100644
--- a/iniparse.yy
+++ b/iniparse.yy
@@ -45,6 +45,7 @@ extern int yylineno;
%token COMMA NL AT
%token OPENBRACE CLOSEBRACE EQUAL GT LT GTEQUAL LTEQUAL
%token BUILDDEPENDS
+%token OBSOLETES
%token MESSAGE
%token ARCH RELEASE
@@ -103,6 +104,8 @@ singleitem /* non-empty */
| DEPENDS { iniBuilder->buildBeginDepends(); } versionedpackagelist NL
| REQUIRES { iniBuilder->buildBeginDepends(); } versionedpackagelistsp NL
| BUILDDEPENDS { iniBuilder->buildBeginBuildDepends(); } versionedpackagelist NL
+ | OBSOLETES { iniBuilder->buildBeginObsoletes(); } versionedpackagelist NL
+
| MESSAGE STRING STRING NL { iniBuilder->buildMessage ($2, $3); }
| error NL { yyerror (std::string("unrecognized line ")
+ stringify(yylineno)
diff --git a/libsolv.cc b/libsolv.cc
index df0af3d..f509617 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -350,6 +350,8 @@ SolverPool::addPackage(const std::string& pkgname, const addPackageData &pkgdata
solvable->provides = repo_addid_dep(repo, solvable->provides, pool_rel2id(pool, solvable->name, solvable->evr, REL_EQ, 1), 0);
if (pkgdata.requires)
solvable->requires = makedeps(repo, pkgdata.requires);
+ if (pkgdata.obsoletes)
+ solvable->obsoletes = makedeps(repo, pkgdata.obsoletes);
/* a solvable can also store arbitrary attributes not needed for dependency
resolution, if we need them */
diff --git a/libsolv.h b/libsolv.h
index 43b37d2..be518e9 100644
--- a/libsolv.h
+++ b/libsolv.h
@@ -130,6 +130,7 @@ public:
PackageSpecification spkg;
SolvableVersion spkg_id;
PackageDepends *requires;
+ PackageDepends *obsoletes;
};
SolvableVersion addPackage(const std::string& pkgname,
diff --git a/package_db.cc b/package_db.cc
index f12afda..673e11a 100644
--- a/package_db.cc
+++ b/package_db.cc
@@ -113,6 +113,7 @@ packagedb::read ()
// we put our best guesses here...
data.vendor = "cygwin";
data.requires = NULL;
+ data.obsoletes = NULL;
data.sdesc = "";
data.ldesc = "";
data.stability = TRUST_CURR; // XXX: would be nice to get this correct as it effects upgrade decisions...
--
2.12.3