Title: [280663] trunk/Tools
Revision
280663
Author
jbed...@apple.com
Date
2021-08-04 14:29:09 -0700 (Wed, 04 Aug 2021)

Log Message

[check-github-mirror-integrity] Store remote cache in checkout
https://bugs.webkit.org/show_bug.cgi?id=228792
<rdar://problem/81527357>

Reviewed by Aakash Jain.

* Scripts/check-github-mirror-integrity: Use the local checkout to store the svn.webkit.org, if possible.
* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py:
(Svn.__init__): Allow caller to define cache path.
(Svn._cache_path): Deleted.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280662 => 280663)


--- trunk/Tools/ChangeLog	2021-08-04 21:22:39 UTC (rev 280662)
+++ trunk/Tools/ChangeLog	2021-08-04 21:29:09 UTC (rev 280663)
@@ -1,5 +1,20 @@
 2021-08-04  Jonathan Bedard  <jbed...@apple.com>
 
+        [check-github-mirror-integrity] Store remote cache in checkout
+        https://bugs.webkit.org/show_bug.cgi?id=228792
+        <rdar://problem/81527357>
+
+        Reviewed by Aakash Jain.
+
+        * Scripts/check-github-mirror-integrity: Use the local checkout to store the svn.webkit.org, if possible.
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py:
+        (Svn.__init__): Allow caller to define cache path.
+        (Svn._cache_path): Deleted.
+
+2021-08-04  Jonathan Bedard  <jbed...@apple.com>
+
         [check-github-mirror-integrity] Compare current time to canonical time
         https://bugs.webkit.org/show_bug.cgi?id=228787
         <rdar://problem/81524499>

Modified: trunk/Tools/Scripts/check-github-mirror-integrity (280662 => 280663)


--- trunk/Tools/Scripts/check-github-mirror-integrity	2021-08-04 21:22:39 UTC (rev 280662)
+++ trunk/Tools/Scripts/check-github-mirror-integrity	2021-08-04 21:29:09 UTC (rev 280663)
@@ -27,12 +27,19 @@
 import time
 
 from webkitpy import webkitscmpy
-from webkitscmpy import remote
+from webkitscmpy import local, remote
 
 
 def main():
+    cache_path = None
+    try:
+        repo = local.Scm.from_path(os.path.dirname(__file__))
+        cache_path = os.path.join(repo.root_path, '.git' if repo.is_git else '.svn', 'svn-webkit-org-cache.json')
+    except OSError:
+        pass
+
     mirror = remote.GitHub('https://github.com/WebKit/WebKit')
-    repository = remote.Svn('https://svn.webkit.org/repository/webkit')    
+    repository = remote.Svn('https://svn.webkit.org/repository/webkit', cache_path=cache_path)
 
     mirror_tip = mirror.commit(branch='main')
     canonical_tip = repository.commit(branch='trunk')

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (280662 => 280663)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2021-08-04 21:22:39 UTC (rev 280662)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2021-08-04 21:29:09 UTC (rev 280663)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='1.0.5',
+    version='1.0.6',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (280662 => 280663)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2021-08-04 21:22:39 UTC (rev 280662)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2021-08-04 21:29:09 UTC (rev 280663)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(1, 0, 5)
+version = Version(1, 0, 6)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('monotonic', Version(1, 5)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py (280662 => 280663)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py	2021-08-04 21:22:39 UTC (rev 280662)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py	2021-08-04 21:29:09 UTC (rev 280663)
@@ -46,7 +46,7 @@
     def is_webserver(cls, url):
         return True if cls.URL_RE.match(url) else False
 
-    def __init__(self, url, dev_branches=None, prod_branches=None, contributors=None, id=None):
+    def __init__(self, url, dev_branches=None, prod_branches=None, contributors=None, id=None, cache_path=None):
         if url[-1] != '/':
             url += '/'
         if not self.is_webserver(url):
@@ -59,6 +59,14 @@
             id=id or url.split('/')[-2].lower(),
         )
 
+        if not cache_path:
+            from webkitscmpy.mocks import remote
+            host = 'svn.{}'.format(self.URL_RE.match(self.url).group('host'))
+            if host in remote.Svn.remotes:
+                host = 'mock-{}'.format(host)
+            cache_path = os.path.join(tempfile.gettempdir(), host, 'webkitscmpy-cache.json')
+        self._cache_path = cache_path
+
         if os.path.exists(self._cache_path):
             try:
                 with self._cache_lock(), open(self._cache_path) as file:
@@ -194,15 +202,6 @@
     def tags(self):
         return self.list('tags')
 
-    @property
-    @decorators.Memoize()
-    def _cache_path(self):
-        from webkitscmpy.mocks import remote
-        host = 'svn.{}'.format(self.URL_RE.match(self.url).group('host'))
-        if host in remote.Svn.remotes:
-            host = 'mock-{}'.format(host)
-        return os.path.join(tempfile.gettempdir(), host, 'webkitscmpy-cache.json')
-
     def _cache_lock(self):
         return fasteners.InterProcessLock(os.path.join(os.path.dirname(self._cache_path), 'cache.lock'))
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to