From a959e1c7fe6f59bffb062ea8c871cf1c582bb511 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 24 Apr 2016 23:11:40 +0100 Subject: Include flag indicating if ebuild is highest version of package --- gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp | 8 ++++---- gentoobrowse-api/service/sql/maintenance/ebuildInsert.sql | 6 +++++- gentoobrowse-api/service/sql/maintenance/ebuildUpdate.sql | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 52c196b..3a6e409 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -119,8 +119,8 @@ namespace Gentoo { m->bindParamS(5, repoName); m->bindParamS(6, categoryName); m->bindParamS(7, packageName); - m->forEachRow([this,dbc,&ecp,&fn] (auto ebuildId) { - fprintf(stderr, "Created ebuild %ld for %s\n", ebuildId, fn.c_str()); + m->forEachRow([this,dbc,&ecp,&fn] (auto ebuildId, auto newest) { + fprintf(stderr, "Created ebuild %ld for %s (%s)\n", ebuildId, fn.c_str(), newest ? "yes" : "no"); this->perEbuildUpdates(dbc, ecp, ebuildId); }); } @@ -141,8 +141,8 @@ namespace Gentoo { m->bindParamS(4, (fn / 3).string()); // category m->bindParamS(5, matches.fetch(1)); // package m->bindParamS(6, matches.fetch(2)); // version - m->forEachRow([this,dbc,&ecp,&fn] (auto ebuildId) { - fprintf(stderr, "Updated ebuild %ld for %s\n", ebuildId, fn.c_str()); + m->forEachRow([this,dbc,&ecp,&fn] (auto ebuildId, auto newest) { + fprintf(stderr, "Updated ebuild %ld for %s (%s)\n", ebuildId, fn.c_str(), newest ? "yes" : "no"); this->perEbuildUpdates(dbc, ecp, ebuildId); }); } diff --git a/gentoobrowse-api/service/sql/maintenance/ebuildInsert.sql b/gentoobrowse-api/service/sql/maintenance/ebuildInsert.sql index 110b7c8..691efd9 100644 --- a/gentoobrowse-api/service/sql/maintenance/ebuildInsert.sql +++ b/gentoobrowse-api/service/sql/maintenance/ebuildInsert.sql @@ -6,4 +6,8 @@ WHERE c.categoryid = p.categoryid AND r.name = ? AND c.name = ? AND p.name = ? -RETURNING ebuildid +RETURNING ebuildid, NOT EXISTS ( + SELECT FROM gentoobrowse.ebuilds ve + WHERE ve.packageid = gentoobrowse.ebuilds.packageid + AND ve.versioninst > gentoobrowse.ebuilds.versioninst + ) diff --git a/gentoobrowse-api/service/sql/maintenance/ebuildUpdate.sql b/gentoobrowse-api/service/sql/maintenance/ebuildUpdate.sql index fc83417..891344c 100644 --- a/gentoobrowse-api/service/sql/maintenance/ebuildUpdate.sql +++ b/gentoobrowse-api/service/sql/maintenance/ebuildUpdate.sql @@ -10,4 +10,8 @@ AND r.name = ? AND c.name = ? AND p.name = ? AND e.version = ? -RETURNING ebuildid +RETURNING ebuildid, NOT EXISTS ( + SELECT FROM gentoobrowse.ebuilds ve + WHERE ve.packageid = e.packageid + AND ve.versioninst > e.versioninst + ) -- cgit v1.2.3