[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 00/12] Plannings for secure-testing repository migration to git



Hi Salvatore,
On Wed, Dec 27, 2017 at 11:32:53PM +0100, Salvatore Bonaccorso wrote:
> Hi Guido
> 
> Much appreciated you looked at the patchset!
> 
> On Wed, Dec 27, 2017 at 09:14:52PM +0100, Guido Günther wrote:
> > Hi,
> > On Wed, Dec 27, 2017 at 08:42:49PM +0100, Salvatore Bonaccorso wrote:
> > > This *preliminary* patchset for review is for the changes needed after
> > > we would switch from alioth to salsa for the secure-testing repository.
> > > While needing to do the svn to git conversion the opportunity was taken
> > > to rename the repository to security-tracker as the naming
> > > secure-testing was for historical reason when the testing security
> > > support arised.
> > 
> > This looks good! I applied your patches to my checkout I found some more
> > svn references in
> > 
> > * tracker 'latest_revision' method
> 
> Jupp that was what I mean that I need here some insights from a LTS
> member and how the script functions. 

Here's a patch also available at

       https://salsa.debian.org/agx/security-tracker/commit/805a2b5fe27f9812dc679c231ab4dd1a1c9613c1

>From 81025922f7037c4e3b86ac1aff9cd15432f42409 Mon Sep 17 00:00:00 2001
Message-Id: <81025922f7037c4e3b86ac1aff9cd15432f42409.1514457764.git.agx@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Thu, 28 Dec 2017 11:36:55 +0100
Subject: [PATCH] TrackerData: use git in instead of svn

Use git-ls-remote instead of svn-info to determine the head revision.
---
 bin/tracker_data.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/bin/tracker_data.py b/bin/tracker_data.py
index 3bbac16603..3aaefbe707 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-service.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:
-- 
2.15.1


Reply to: