scripts: sercomm-pid: add bmips support
[openwrt/staging/stintel.git] / scripts / dl_github_archive.py
index 1e91e2899896521786e00bef86efd5e74729ec40..328d588e781262a1fc3f30fcf3ce725fa0c92705 100755 (executable)
@@ -133,7 +133,7 @@ class Path(object):
     def tar(path, subdir, into=None, ts=None):
         """Pack ``path`` into tarball ``into``."""
         # --sort=name requires a recent build of GNU tar
-        args = ['tar', '--numeric-owner', '--owner=0', '--group=0', '--sort=name']
+        args = ['tar', '--numeric-owner', '--owner=0', '--group=0', '--sort=name', '--mode=a-s']
         args += ['-C', path, '-cf', into, subdir]
         envs = os.environ.copy()
         if ts is not None:
@@ -177,7 +177,7 @@ class GitHubCommitTsCache(object):
     def set(self, k, v):
         """Update timestamp with ``k``."""
         fileno = os.open(self.cachef, os.O_RDWR | os.O_CREAT)
-        with os.fdopen(fileno, 'wb+') as f:
+        with os.fdopen(fileno, 'w+') as f:
             try:
                 fcntl.lockf(fileno, fcntl.LOCK_EX)
                 self._cache_init(f)
@@ -203,11 +203,11 @@ class GitHubCommitTsCache(object):
             ts = ent[0]
             updated = ent[1]
             line = '{0} {1} {2}\n'.format(k, ts, updated)
-            fout.write(line.encode('utf-8'))
+            fout.write(line)
 
 
 class DownloadGitHubTarball(object):
-    """Download and repack archive tarabll from GitHub.
+    """Download and repack archive tarball from GitHub.
 
     Compared with the method of packing after cloning the whole repo, this
     method is more friendly to users with fragile internet connection.
@@ -220,7 +220,7 @@ class DownloadGitHubTarball(object):
 
      - GitHub archives do not contain source codes for submodules.
 
-     - GitHub archives seem to respect .gitattributes and ignore pathes with
+     - GitHub archives seem to respect .gitattributes and ignore paths with
        export-ignore attributes.
 
     For the first two issues, the method will fail loudly to allow fallback to