commit: 01fe45522776507f8b9e5d973c2982f66d78b6db
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 22 17:12:53 2017 +0000
Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Sun Jan 22 17:12:53 2017 +0000
URL: https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=01fe4552
sync: add detail points to sync_versions
backend/lib/sync.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index 02e1116..22008ea 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -152,6 +152,12 @@ def sync_packages():
db.session.commit()
def sync_versions():
+ """Synchronize packages version data from packages.gentoo.org.
+
+ For each package that has not been updated in the last SYNC_BUFFER_SECS,
+ pull package information and refresh its description, maintainers,
+ versions and keywords.
+ """
cnt = 0
ts = datetime.utcfromtimestamp(time.time() - SYNC_BUFFER_SECS)
now = datetime.utcnow()
@@ -172,9 +178,12 @@ def sync_versions():
pkg = data.json()
print ("Updating package: %s" % package.full_name)
+
+ # 1. refresh description
if 'description' in pkg:
package.description = pkg['description']
+ # 2. refresh maintainers
maintainers = []
for maint in pkg.get('maintainers', []):
if 'email' not in maint or 'type' not in maint:
@@ -198,6 +207,12 @@ def sync_versions():
# Intentionally outside if 'maintainers' in pkg, because if there are
no maintainers in JSON, it's falled to maintainer-needed and we need to clean
out old maintainer entries
package.maintainers = maintainers # TODO: Retain order to know who is
primary; retain description associated with the maintainership
+
+ # TODO: 3. refresh versions
+
+ # TODO: 4. refresh keywords
+
+ # 5. mark package as refreshed
package.last_sync_ts = now
if not cnt % 100: