summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp8
-rw-r--r--gentoobrowse-api/service/sql/maintenance/ebuildInsert.sql6
-rw-r--r--gentoobrowse-api/service/sql/maintenance/ebuildUpdate.sql6
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<int64_t>([this,dbc,&ecp,&fn] (auto ebuildId) {
- fprintf(stderr, "Created ebuild %ld for %s\n", ebuildId, fn.c_str());
+ m->forEachRow<int64_t, bool>([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<int64_t>([this,dbc,&ecp,&fn] (auto ebuildId) {
- fprintf(stderr, "Updated ebuild %ld for %s\n", ebuildId, fn.c_str());
+ m->forEachRow<int64_t, bool>([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
+ )