[Pcsclite-git-commit] [website] 03/05: Use GIT instead of SVN to find releases

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu May 14 12:02:02 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository website.

commit 696801c3863ecaad550f6c757de12e7b97e6be20
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu May 14 13:10:15 2015 +0200

    Use GIT instead of SVN to find releases
    
    The CCID source code is now in GIT. The script now uses git to find the
    first CCID release with support of each reader.
---
 matrix.py | 168 +++++++++++++++++++++++++++++++++++---------------------------
 update.sh |   6 +--
 2 files changed, 95 insertions(+), 79 deletions(-)

diff --git a/matrix.py b/matrix.py
index 11b84db..20fe7b3 100755
--- a/matrix.py
+++ b/matrix.py
@@ -28,6 +28,7 @@ import ConfigParser
 import templayer
 import time
 import re
+import subprocess
 from PIL import Image
 
 #pp = pprint.PrettyPrinter(indent=4)
@@ -280,75 +281,88 @@ def get_driver_version(readers):
     """
     set the 'release' field for each reader
     """
-    changelog = get_changelog()
+
+    # change to the git repository of CCID
+    old_dir = os.getcwd()
+    os.chdir("../CCID")
 
     for reader in readers.keys():
-        rev = get_driver_revision(reader, changelog)
+        rev = get_driver_revision(reader)
         readers[reader]['release'] = driver_revision_to_version(rev)
         if 'interface' in readers[reader]:
             readers[reader]['interface']['release'] = readers[reader]['release']
 
+    # come back to the previous directory
+    os.chdir(old_dir)
+
 
 def driver_revision_to_version(rev):
     """
-    convert a SVN revision in the first release containing this revision
+    convert a git timestamp in the first release after this timestamp
     """
+
+    # git --no-pager log --no-walk --tags --pretty=format:"%at %D"
+
     history = [
-        #[ SVN revision, CCID release ]
-        [273, "0.1.0"],
-        [342, "0.2.0"],
-        [423, "0.3.0"],
-        [467, "0.3.1"],
-        [552, "0.3.2"],
-        [697, "0.4.0"],
-        [703, "0.4.1"],
-        [1015, "0.9.0"],
-        [1018, "0.9.1"],
-        [1186, "0.9.2"],
-        [1400, "0.9.3"],
-        [1761, "0.9.4"],
-        [1911, "1.0.0"],
-        [2020, "1.0.1"],
-        [2135, "1.1.0"],
-        [2345, "1.2.0"],
-        [2363, "1.2.1"],
-        [2522, "1.3.0"],
-        [2692, "1.3.1"],
-        [2755, "1.3.2"],
-        [2796, "1.3.3"],
-        [2809, "1.3.4"],
-        [2842, "1.3.5"],
-        [2924, "1.3.6"],
-        [2985, "1.3.7"],
-        [3033, "1.3.8"],
-        [3208, "1.3.9"],
-        [3338, "1.3.10"],
-        [4347, "1.3.11"],
-        [4931, "1.3.12"],
-        [4979, "1.3.13"],
-        [5108, "1.4.0"],
-        [5430, "1.4.1"],
-        [5626, "1.4.2"],
-        [5688, "1.4.3"],
-        [5742, "1.4.4"],
-        [6032, "1.4.5"],
-        [6266, "1.4.6"],
-        [6349, "1.4.7"],
-        [6470, "1.4.8"],
-        [6507, "1.4.9"],
-        [6609, "1.4.10"],
-        [6660, "1.4.11"],
-        [6729, "1.4.12"],
-        [6766, "1.4.13"],
-        [6796, "1.4.14"],
-        [6847, "1.4.15"],
-        [6881, "1.4.16"],
-        [6916, "1.4.17"],
-        [6983, "1.4.18"]]
+        # [ GIT timestamp, CCID release ]
+        [1060726501, "0.1.0"],
+        [1061928960, "0.2.0"],
+        [1063196848, "0.3.0"],
+        [1064303696, "0.3.1"],
+        [1067984198, "0.3.2"],
+        [1076659101, "0.4.0"],
+        [1076762778, "0.4.1"],
+        [1081159012, "0.4.2"],
+        [1088604389, "0.9.0"],
+        [1088682159, "0.9.1"],
+        [1092602639, "0.9.2"],
+        [1110828981, "0.9.3"],
+        [1133120669, "0.9.4"],
+        [1141406512, "1.0.0"],
+        [1145719865, "1.0.1"],
+        [1155316857, "1.1.0"],
+        [1169236419, "1.2.0"],
+        [1169916486, "1.2.1"],
+        [1178788602, "1.3.0"],
+        [1195219620, "1.3.1"],
+        [1201030419, "1.3.2"],
+        [1202307990, "1.3.3"],
+        [1202481816, "1.3.4"],
+        [1203687747, "1.3.5"],
+        [1209559512, "1.3.6"],
+        [1212915681, "1.3.7"],
+        [1214580524, "1.3.8"],
+        [1227023130, "1.3.9"],
+        [1236440124, "1.3.10"],
+        [1248814370, "1.3.11"],
+        [1273312475, "1.3.12"],
+        [1275658182, "1.3.13"],
+        [1280928093, "1.4.0"],
+        [1291387287, "1.4.1"],
+        [1298412771, "1.4.2"],
+        [1301770030, "1.4.3"],
+        [1305276951, "1.4.4"],
+        [1318364453, "1.4.5"],
+        [1333728979, "1.4.6"],
+        [1340355220, "1.4.7"],
+        [1349609804, "1.4.8"],
+        [1358349113, "1.4.9"],
+        [1366116238, "1.4.10"],
+        [1371038152, "1.4.11"],
+        [1376343789, "1.4.12"],
+        [1381312852, "1.4.13"],
+        [1385402957, "1.4.14"],
+        [1392369588, "1.4.15"],
+        [1395587614, "1.4.16"],
+        [1402492197, "1.4.17"],
+        [1410625524, "1.4.18"],
+        [1431502500, "1.4.19"],
+            ]
+
     for release in history:
         if rev <= release[0]:
             return release[1]
-    return "SVN"
+    return "GIT"
 
 
 def get_changelog():
@@ -373,29 +387,35 @@ def get_changelog():
     return changelog
 
 
-def get_driver_revision(reader, changelog):
-    """
-    search a log line containing the reader string
-    """
+def get_driver_revision(reader):
+    # $ git log --pretty=format:%at iMONO.txt
+    # 1370002950
+    # 1229117957
+
+    # This number is the number of seconds since the epoch
+    # $ date -r 1229117957
+    # Fri Dec 12 22:39:17 CET 2008
+
     # second (or more) interface, remove the '_i1' extension
     if reader[:-1].endswith("_i"):
         reader = reader[:-3]
 
-    found = None
-    for line in changelog:
-        if reader in line:
-            found = line
-
-    if found:
-        result = re.search('\\* \\[r(\d*)\\]', found)
-        if result:
-            # revision is the inner matching pattern
-            return int(result.group(1))
-    else:
-        print "reader %s not found in ChangeLog" % reader
-        # fake SVN revision number high enough to be considered as
-        # unreleased
-        return 999999999
+    print reader
+    res = subprocess.check_output(['git', '--no-pager', 'log',
+                                   '--pretty=format:%at', "readers/" + reader])
+
+    # get a list of commit time stamps
+    commits = res.split('\n')
+    # last commit in list is the first in time
+    try:
+        first_commit = int(commits[-1])
+    except ValueError:
+        print
+        print "*** No commit found for reader:", reader
+        print
+        first_commit = 999999999
+
+    return first_commit
 
 
 def get_by_manufacturer(readers):
diff --git a/update.sh b/update.sh
index 58dd51c..07bb572 100755
--- a/update.sh
+++ b/update.sh
@@ -2,16 +2,12 @@
 
 set -e
 set -x
-rm -rf ccid/readers
-(cd ../trunk/Drivers/ccid/readers ; svn up ; svn2cl --include-rev)
-cp -r ../trunk/Drivers/ccid/readers ccid
-rm -rf ccid/readers/.svn
 
 ./matrix.py
 
 # update the supported_readers.txt file
 ./generate_supported_readers.py 
-mv supported_readers.txt ../trunk/Drivers/ccid/readers/
+mv supported_readers.txt ../CCID/readers/
 
 if [ $# -gt 0 ]
 then

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/website.git



More information about the Pcsclite-cvs-commit mailing list