diff options
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | MgaRepo/binrepo.py | 4 | ||||
-rw-r--r-- | MgaRepo/commands/maintdb.py | 2 | ||||
-rw-r--r-- | MgaRepo/svn.py | 67 | ||||
-rw-r--r-- | MgaRepo/util.py | 2 | ||||
-rwxr-xr-x | mgarepo | 2 | ||||
-rw-r--r-- | mgarepo.conf | 4 |
8 files changed, 40 insertions, 46 deletions
@@ -1,3 +1,6 @@ +* X +- use https: URLs by default + * 1.14.6 - add a progress bar for upload binaries - bash-completion: remove executable bit @@ -1,5 +1,5 @@ PACKAGE = mgarepo -VERSION = 1.14.6 +VERSION = 1.14.6 # NOTE: remember to update the version in mgarepo to match! .PHONY: all $(DIRS) clean clean: diff --git a/MgaRepo/binrepo.py b/MgaRepo/binrepo.py index d96507c..a66df09 100644 --- a/MgaRepo/binrepo.py +++ b/MgaRepo/binrepo.py @@ -58,7 +58,7 @@ def download_binary(topdir, sha1, filename): fmt = config.get("global", "download-command", "wget -c -O '$dest' $url") url = config.get("binrepo", "download_url", - "http://binrepo.mageia.org/") + "https://binrepo.mageia.org/") url = mirror.normalize_path(url + "/" + sha1) dest = os.path.join(topdir, 'SOURCES', filename) if os.path.exists(dest): @@ -88,7 +88,7 @@ def download_binaries(topdir): def binary_exists(sha1sum): dlurl = config.get("binrepo", "download_url", - "http://binrepo.mageia.org/") + "https://binrepo.mageia.org/") dlurl = mirror.normalize_path(dlurl + "/" + sha1sum) h = httplib2.Http() resp, content = h.request(dlurl, 'HEAD') diff --git a/MgaRepo/commands/maintdb.py b/MgaRepo/commands/maintdb.py index 920ff37..e3d54fe 100644 --- a/MgaRepo/commands/maintdb.py +++ b/MgaRepo/commands/maintdb.py @@ -33,7 +33,7 @@ def parse_options(): def maintdb(maintdb_args): host = config.get("maintdb", "host", "maintdb.mageia.org") if (maintdb_args[0] == 'get' and len(maintdb_args)>=2): - url = config.get("maintdb", "url", "http://maintdb.mageia.org/") + url = config.get("maintdb", "url", "https://maintdb.mageia.org/") import urllib.request try: page=urllib.request.urlopen(url + maintdb_args[1]) diff --git a/MgaRepo/svn.py b/MgaRepo/svn.py index 1730901..c0d587f 100644 --- a/MgaRepo/svn.py +++ b/MgaRepo/svn.py @@ -1,12 +1,13 @@ from MgaRepo import Error, SilentError, config -from MgaRepo.util import execcmd, get_auth -import sys +from MgaRepo.util import execcmd import os import re +import sys import time __all__ = ["SVN", "SVNLook", "SVNLogEntry"] + class SVNLogEntry: def __init__(self, revision, author, date): self.revision = revision @@ -17,36 +18,29 @@ class SVNLogEntry: def __lt__(self, other): return (self.date < other.date) - - def __eq__(self,other): + + def __eq__(self, other): return (self.date == other.date) + class SVN: def _execsvn(self, *args, **kwargs): - localcmds = ("add", "revert", "cleanup", "mv") + localcmds = frozenset(("add", "revert", "cleanup", "mv")) if not kwargs.get("show") and args[0] not in localcmds: args = list(args) args.append("--non-interactive") else: - if args[0] == "mv": - kwargs["geterr"] = False - else: - kwargs["geterr"] = True + kwargs["geterr"] = args[0] != "mv" kwargs["cleanerr"] = True if kwargs.get("xml"): + args = list(args) args.append("--xml") self._set_env() svn_command = config.get("global", "svn-command", "svn") cmdstr = svn_command + " " + " ".join(args) try: - if args[0] in ('info', 'checkout','log'): - kwargs['info'] = True - else: - kwargs['info'] = False - if args[0] in ('status','propedit'): - kwargs['noprefix'] = True - else: - kwargs['noprefix'] = False + kwargs["info"] = args[0] in ("info", "checkout", "log") + kwargs["noprefix"] = args[0] in ("status", "propedit") return execcmd(cmdstr, **kwargs) except Error as e: msg = None @@ -64,9 +58,7 @@ class SVN: # svn has already dumped error messages, we don't need to # do it too if msg: - sys.stderr.write("\n") - sys.stderr.write(msg) - sys.stderr.write("\n") + sys.stderr.write("\n" + msg + "\n") raise SilentError elif msg: raise Error("%s\n%s" % (e, msg)) @@ -76,8 +68,8 @@ class SVN: wrapper = "mgarepo-ssh" repsys = config.get("global", "mgarepo-cmd") if repsys: - dir = os.path.dirname(repsys) - path = os.path.join(dir, wrapper) + dirname = os.path.dirname(repsys) + path = os.path.join(dirname, wrapper) if os.path.exists(path): wrapper = path defaults = {"SVN_SSH": wrapper} @@ -101,8 +93,7 @@ class SVN: def _add_log(self, cmd_args, received_kwargs, optional=0): if (not optional or - "log" in received_kwargs or - "logfile" in received_kwargs): + "log" in received_kwargs or "logfile" in received_kwargs): ret = received_kwargs.get("log") if ret is not None: cmd_args.append("-m '%s'" % ret) @@ -114,14 +105,14 @@ class SVN: if not optional or "rev" in received_kwargs: ret = received_kwargs.get("rev") if isinstance(ret, str): - if not ret.startswith("{"): # if not a datespec + if not ret.startswith("{"): # if not a datespec try: ret = int(ret) except ValueError: raise Error("invalid revision provided") if ret: cmd_args.append("-r '%s'" % ret) - + def add(self, path, **kwargs): cmd = ["add", path + '@' if '@' in path else path] return self._execsvn_success(noauth=1, *cmd, **kwargs) @@ -182,7 +173,7 @@ class SVN: self._add_revision(cmd, kwargs) status, output = self._execsvn(local=True, *cmd, **kwargs) return output - + def propset(self, propname, value, targets, **kwargs): cmd = ["propset", propname, "'%s'" % value, targets] return self._execsvn_success(*cmd, **kwargs) @@ -202,7 +193,7 @@ class SVN: if line.startswith("Last Changed Rev: "): return int(line.split()[3]) return None - + def info(self, path, **kwargs): cmd = ["info", path + '@' if '@' in path else path] status, output = self._execsvn(local=True, noerror=True, *cmd, **kwargs) @@ -218,9 +209,9 @@ class SVN: info = {} for pair in pairs: if pair != ['']: - info[pair[0]]=pair[1] + info[pair[0]] = pair[1] return info - + def ls(self, path, **kwargs): cmd = ["ls", path + '@' if '@' in path else path] status, output = self._execsvn(*cmd, **kwargs) @@ -256,8 +247,8 @@ class SVN: cmd = ["switch"] if relocate: if oldurl is None: - raise Error("You must supply the old URL when "\ - "relocating working copies") + raise Error("You must supply the old URL when " + "relocating working copies") cmd.append("--relocate") cmd.append(oldurl) cmd.append(url) @@ -273,8 +264,8 @@ class SVN: return [x.split() for x in output.split()] return None - def merge(self, url1, url2=None, rev1=None, rev2=None, path=None, - **kwargs): + def merge(self, url1, url2=None, rev1=None, rev2=None, path=None, + **kwargs): cmd = ["merge"] if rev1 and rev2 and not url2: cmd.append("-r") @@ -341,7 +332,7 @@ class SVN: if status != 0: return None - revheader = re.compile("^r(?P<revision>[0-9]+) \| (?P<author>[^\|]+) \| (?P<date>[^\|]+) \| (?P<lines>[0-9]+) (?:line|lines)$") + revheader = re.compile(r"^r(?P<revision>[0-9]+) \| (?P<author>[^\|]+) \| (?P<date>[^\|]+) \| (?P<lines>[0-9]+) (?:line|lines)$") changedpat = re.compile(r"^\s+(?P<action>[^\s]+) (?P<path>[^\s]+)(?: \([^\s]+ (?P<from_path>[^:]+)(?:\:(?P<from_rev>[0-9]+))?\))?$") logseparator = "-"*72 linesleft = 0 @@ -388,14 +379,15 @@ class SVN: return log def mv(self, path, dest, message=None, **kwargs): - cmd = ["mv", path, dest, ] + cmd = ["mv", path, dest] if message: - cmd.append("-m '%s'"%message) + cmd.append("-m '%s'" % message) else: kwargs['show'] = True self._add_log(cmd, kwargs) return self._execsvn_success(*cmd, **kwargs) + class SVNLook: def __init__(self, repospath, txn=None, rev=None): self.repospath = repospath @@ -436,7 +428,6 @@ class SVNLook: line = line.rstrip() if not line: continue - entry = [None, None, None] changedata, changeprop, path = None, None, None if line[0] != "_": changedata = line[0] diff --git a/MgaRepo/util.py b/MgaRepo/util.py index 635319d..519c199 100644 --- a/MgaRepo/util.py +++ b/MgaRepo/util.py @@ -179,7 +179,7 @@ def rellink(src, dst): def maintdb_get(package): dlurl = config.get("maintdb", "url", - "http://maintdb.mageia.org/") + "https://maintdb.mageia.org/") dlurl = dlurl + "/" + package h = httplib2.Http() resp, content = h.request(dlurl, 'GET') @@ -4,7 +4,7 @@ from MgaRepo.command import * import getopt import sys -VERSION="1.14.4" +VERSION="1.14.6" HELP = """\ Usage: mgarepo COMMAND [COMMAND ARGUMENTS] diff --git a/mgarepo.conf b/mgarepo.conf index 932fa0d..d21dcf5 100644 --- a/mgarepo.conf +++ b/mgarepo.conf @@ -24,10 +24,10 @@ host = pkgsubmit.mageia.org default = Cauldron [binrepo] -download_url = http://binrepo.mageia.org/ +download_url = https://binrepo.mageia.org/ upload_host = binrepo.mageia.org [maintdb] host = maintdb.mageia.org -url = http://maintdb.mageia.org/ +url = https://maintdb.mageia.org/ |