[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 04/10: Issue 2550 - Update Element Hiding Helper dependency on buildtools to revision 9069f8de837b
David Prévot
taffit at moszumanska.debian.org
Fri Jan 22 01:02:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag pre-hg-git-0.8
in repository adblock-plus-element-hiding-helper.
commit 69cc0e999a6cfe95c6dc56b43f8d797612c54206
Author: Wladimir Palant <trev at adblockplus.org>
Date: Mon May 18 21:59:45 2015 +0200
Issue 2550 - Update Element Hiding Helper dependency on buildtools to revision 9069f8de837b
---
defaults/prefs.js | 4 ---
defaults/prefs.json | 8 ++++++
dependencies | 2 +-
ensure_dependencies.py | 78 +++++++++++++++++++++++++++++++++++++++++++-------
4 files changed, 76 insertions(+), 16 deletions(-)
diff --git a/defaults/prefs.js b/defaults/prefs.js
deleted file mode 100644
index a70669e..0000000
--- a/defaults/prefs.js
+++ /dev/null
@@ -1,4 +0,0 @@
-pref("extensions.elemhidehelper.selectelement_key", "Accel Shift K, Accel Shift S, Accel Shift F3");
-pref("extensions.elemhidehelper.showhelp", true);
-pref("extensions.elemhidehelper.acceptlocalfiles", false);
-pref("extensions.elemhidehelper.composer_defaultDomain", 3);
diff --git a/defaults/prefs.json b/defaults/prefs.json
new file mode 100644
index 0000000..c72c3d3
--- /dev/null
+++ b/defaults/prefs.json
@@ -0,0 +1,8 @@
+{
+ "defaults": {
+ "selectelement_key": "Accel Shift K, Accel Shift S, Accel Shift F3",
+ "showhelp": true,
+ "acceptlocalfiles": false,
+ "composer_defaultDomain": 3
+ }
+}
diff --git a/dependencies b/dependencies
index aeffecb..a115a2c 100644
--- a/dependencies
+++ b/dependencies
@@ -1,3 +1,3 @@
_root = hg:https://hg.adblockplus.org/ git:https://github.com/adblockplus/
_self = buildtools/ensure_dependencies.py
-buildtools = buildtools hg:be85e6094718f638dc5d870c8350478e58c179b0 git:021b78c35e9e19a81f6a3eb1449d868b4cfb828a
+buildtools = buildtools hg:9069f8de837b git:6ff8b4c
diff --git a/ensure_dependencies.py b/ensure_dependencies.py
index a6ae401..cec2bbe 100755
--- a/ensure_dependencies.py
+++ b/ensure_dependencies.py
@@ -14,6 +14,7 @@ import errno
import logging
import subprocess
import urlparse
+import argparse
from collections import OrderedDict
from ConfigParser import RawConfigParser
@@ -33,6 +34,10 @@ A dependencies file should look like this:
buildtools = buildtools hg:016d16f7137b git:f3f8692f82e5
"""
+SKIP_DEPENDENCY_UPDATES = os.environ.get(
+ "SKIP_DEPENDENCY_UPDATES", ""
+).lower() not in ("", "0", "false")
+
class Mercurial():
def istype(self, repodir):
return os.path.exists(os.path.join(repodir, ".hg"))
@@ -78,6 +83,9 @@ class Mercurial():
module = os.path.relpath(target, repo)
_ensure_line_exists(ignore_path, module)
+ def postprocess_url(self, url):
+ return url
+
class Git():
def istype(self, repodir):
return os.path.exists(os.path.join(repodir, ".git"))
@@ -93,7 +101,20 @@ class Git():
return subprocess.check_output(command, cwd=repo).strip()
def pull(self, repo):
+ # Fetch tracked branches, new tags and the list of available remote branches
subprocess.check_call(["git", "fetch", "--quiet", "--all", "--tags"], cwd=repo)
+ # Next we need to ensure all remote branches are tracked
+ newly_tracked = False
+ remotes = subprocess.check_output(["git", "branch", "--remotes"], cwd=repo)
+ for match in re.finditer(r"^\s*(origin/(\S+))$", remotes, re.M):
+ remote, local = match.groups()
+ with open(os.devnull, "wb") as devnull:
+ if subprocess.call(["git", "branch", "--track", local, remote],
+ cwd=repo, stdout=devnull, stderr=devnull) == 0:
+ newly_tracked = True
+ # Finally fetch any newly tracked remote branches
+ if newly_tracked:
+ subprocess.check_call(["git", "fetch", "--quiet", "origin"], cwd=repo)
def update(self, repo, rev):
subprocess.check_call(["git", "checkout", "--quiet", rev], cwd=repo)
@@ -103,6 +124,12 @@ class Git():
exclude_file = os.path.join(repo, ".git", "info", "exclude")
_ensure_line_exists(exclude_file, module)
+ def postprocess_url(self, url):
+ # Handle alternative syntax of SSH URLS
+ if "@" in url and ":" in url and not urlparse.urlsplit(url).scheme:
+ return "ssh://" + url.replace(":", "/", 1)
+ return url
+
repo_types = OrderedDict((
("hg", Mercurial()),
("git", Git()),
@@ -157,7 +184,7 @@ def read_deps(repodir):
def safe_join(path, subpath):
# This has been inspired by Flask's safe_join() function
- forbidden = set([os.sep, os.altsep]) - set([posixpath.sep, None])
+ forbidden = {os.sep, os.altsep} - {posixpath.sep, None}
if any(sep in subpath for sep in forbidden):
raise Exception("Illegal directory separator in dependency path %s" % subpath)
@@ -178,6 +205,11 @@ def ensure_repo(parentrepo, target, roots, sourcename):
if os.path.exists(target):
return
+ if SKIP_DEPENDENCY_UPDATES:
+ logging.warning("SKIP_DEPENDENCY_UPDATES environment variable set, "
+ "%s not cloned", target)
+ return
+
parenttype = get_repo_type(parentrepo)
type = None
for key in roots:
@@ -186,7 +218,15 @@ def ensure_repo(parentrepo, target, roots, sourcename):
if type is None:
raise Exception("No valid source found to create %s" % target)
- url = urlparse.urljoin(roots[type], sourcename)
+ postprocess_url = repo_types[type].postprocess_url
+ root = postprocess_url(roots[type])
+ sourcename = postprocess_url(sourcename)
+
+ if os.path.exists(root):
+ url = os.path.join(root, sourcename)
+ else:
+ url = urlparse.urljoin(root, sourcename)
+
logging.info("Cloning repository %s into %s" % (url, target))
repo_types[type].clone(url, target)
@@ -209,15 +249,21 @@ def update_repo(target, revisions):
return
resolved_revision = repo_types[type].get_revision_id(target, revision)
- if not resolved_revision:
- logging.info("Revision %s is unknown, downloading remote changes" % revision)
- repo_types[type].pull(target)
- resolved_revision = repo_types[type].get_revision_id(target, revision)
- if not resolved_revision:
- raise Exception("Failed to resolve revision %s" % revision)
-
current_revision = repo_types[type].get_revision_id(target)
+
if resolved_revision != current_revision:
+ if SKIP_DEPENDENCY_UPDATES:
+ logging.warning("SKIP_DEPENDENCY_UPDATES environment variable set, "
+ "%s not checked out to %s", target, revision)
+ return
+
+ if not resolved_revision:
+ logging.info("Revision %s is unknown, downloading remote changes" % revision)
+ repo_types[type].pull(target)
+ resolved_revision = repo_types[type].get_revision_id(target, revision)
+ if not resolved_revision:
+ raise Exception("Failed to resolve revision %s" % revision)
+
logging.info("Updating repository %s to revision %s" % (target, resolved_revision))
repo_types[type].update(target, resolved_revision)
@@ -229,6 +275,7 @@ def resolve_deps(repodir, level=0, self_update=True, overrideroots=None, skipdep
return
if level >= 10:
logging.warning("Too much subrepository nesting, ignoring %s" % repo)
+ return
if overrideroots is not None:
config["_root"] = overrideroots
@@ -278,8 +325,17 @@ def _ensure_line_exists(path, pattern):
if __name__ == "__main__":
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
- repos = sys.argv[1:]
+
+ parser = argparse.ArgumentParser(description="Verify dependencies for a set of repositories, by default the repository of this script.")
+ parser.add_argument("repos", metavar="repository", type=str, nargs="*", help="Repository path")
+ parser.add_argument("-q", "--quiet", action="store_true", help="Suppress informational output")
+ args = parser.parse_args()
+
+ if args.quiet:
+ logging.disable(logging.INFO)
+
+ repos = args.repos
if not len(repos):
- repos = [os.getcwd()]
+ repos = [os.path.dirname(__file__)]
for repo in repos:
resolve_deps(repo)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git
More information about the Pkg-mozext-commits
mailing list