[Secure-testing-commits] r59027 - bin
Salvatore Bonaccorso
carnil at moszumanska.debian.org
Fri Dec 29 19:17:00 UTC 2017
Author: carnil
Date: 2017-12-29 19:17:00 +0000 (Fri, 29 Dec 2017)
New Revision: 59027
Modified:
bin/tracker_data.py
Log:
TrackerData: use git in instead of svn
Use git-ls-remote instead of svn-info to determine the head revision.
v2: Adjust GIT_URL to the security-tracker.git repository
Modified: bin/tracker_data.py
===================================================================
--- bin/tracker_data.py 2017-12-29 19:16:59 UTC (rev 59026)
+++ bin/tracker_data.py 2017-12-29 19:17:00 UTC (rev 59027)
@@ -45,14 +45,15 @@
class TrackerData(object):
DATA_URL = "https://security-tracker.debian.org/tracker/data/json"
+ GIT_URL = "https://salsa.debian.org/security-tracker-team/security-tracker.git"
CACHED_DATA_PATH = "~/.cache/debian_security_tracker.json"
CACHED_REVISION_PATH = "~/.cache/debian_security_tracker.rev"
GET_REVISION_COMMAND = \
- "LC_ALL=C svn info svn://anonscm.debian.org/secure-testing|"\
- "awk '/^Revision:/ { print $2 }'"
+ "LC_ALL=C git ls-remote %s | awk '/HEAD$/ { print $1 }'" % GIT_URL
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data')
def __init__(self, update_cache=True):
+ self._latest_revision = None
self.cached_data_path = os.path.expanduser(self.CACHED_DATA_PATH)
self.cached_revision_path = os.path.expanduser(
self.CACHED_REVISION_PATH)
@@ -62,14 +63,14 @@
@property
def latest_revision(self):
- """Return the current revision of the SVN repository"""
+ """Return the current revision of the Git repository"""
# Return cached value if available
- if hasattr(self, '_latest_revision'):
+ if self._latest_revision is not None:
return self._latest_revision
- # Otherwise call out to svn to get the latest revision
+ # Otherwise call out to git to get the latest revision
output = subprocess.check_output(self.GET_REVISION_COMMAND,
shell=True)
- self._latest_revision = int(output)
+ self._latest_revision = output.strip()
return self._latest_revision
def _cache_must_be_updated(self):
@@ -78,7 +79,7 @@
self.cached_revision_path):
with open(self.cached_revision_path, 'r') as f:
try:
- revision = int(f.readline())
+ revision = f.read()
except ValueError:
revision = None
if revision == self.latest_revision:
More information about the Secure-testing-commits
mailing list