summaryrefslogtreecommitdiffstats
path: root/bin/tracker_data.py
diff options
context:
space:
mode:
authorSalvatore Bonaccorso <carnil@debian.org>2017-12-29 19:17:00 +0000
committerSalvatore Bonaccorso <carnil@debian.org>2017-12-29 19:17:00 +0000
commit6ab7f10fd0ec46356e2b430ace597c6211b48c15 (patch)
tree7f62d61253b4524bf47a7b4ffa1d39032f1ed815 /bin/tracker_data.py
parentbb601da51397343ca4552f9d0fb18d16ab3abc9e (diff)
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 git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@59027 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/tracker_data.py')
-rw-r--r--bin/tracker_data.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/tracker_data.py b/bin/tracker_data.py
index 3bbac16603..be99b6e963 100644
--- a/bin/tracker_data.py
+++ b/bin/tracker_data.py
@@ -45,14 +45,15 @@ def normalize_release(release):
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 @@ class TrackerData(object):
@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 @@ class TrackerData(object):
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:

© 2014-2024 Faster IT GmbH | imprint | privacy policy