aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo
diff options
context:
space:
mode:
Diffstat (limited to 'MgaRepo')
-rw-r--r--MgaRepo/commands/getsrpm.py3
-rw-r--r--MgaRepo/commands/rpmlog.py7
-rw-r--r--MgaRepo/log.py25
-rw-r--r--MgaRepo/rpmutil.py5
4 files changed, 31 insertions, 9 deletions
diff --git a/MgaRepo/commands/getsrpm.py b/MgaRepo/commands/getsrpm.py
index 82bd626..5eb630b 100644
--- a/MgaRepo/commands/getsrpm.py
+++ b/MgaRepo/commands/getsrpm.py
@@ -30,6 +30,7 @@ Options:
-n Rename the package to include the revision number
-l Use subversion log to build rpm %changelog
-T FILE Template to be used to generate the %changelog
+ -F Do not use full name & email for packagers in %changelog
-M Do not use the mirror (use the main repository)
-h Show this message
--strict Check if the given revision contains changes in REPPKGURL
@@ -76,6 +77,8 @@ def parse_options():
parser.add_option("-n", dest="revname", action="store_true")
parser.add_option("-l", dest="svnlog", action="store_true")
parser.add_option("-T", dest="template", type="string", default=None)
+ parser.add_option("-F", dest="fullnames", default=True,
+ action="store_false")
parser.add_option("-M", "--no-mirror", action="callback",
callback=disable_mirror)
parser.add_option("--strict", dest="strict", default=False,
diff --git a/MgaRepo/commands/rpmlog.py b/MgaRepo/commands/rpmlog.py
index 2b62925..28d66f1 100644
--- a/MgaRepo/commands/rpmlog.py
+++ b/MgaRepo/commands/rpmlog.py
@@ -25,6 +25,7 @@ Options:
-p Append changelog found in .spec file
-s Sort changelog entries, even from the old log
-M Do not use the mirror (use the main repository)
+ -F Do not use full name & email for packagers where available
-h Show this message
Examples:
@@ -45,13 +46,15 @@ def parse_options():
action="store_true")
parser.add_option("-M", "--no-mirror", action="callback",
callback=disable_mirror)
+ parser.add_option("-F", dest="fullnames", default=True,
+ action="store_false")
opts, args = parser.parse_args()
if len(args) != 1:
raise Error("invalid arguments")
opts.pkgdirurl = layout.package_url(args[0])
return opts
-def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort):
+def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort, fullnames):
another = None
if usespec:
svn = SVN()
@@ -59,7 +62,7 @@ def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort):
rawspec = svn.cat(specurl, rev=revision)
spec, another = split_spec_changelog(StringIO(rawspec))
newlog = get_changelog(pkgdirurl, another=another, rev=revision,
- size=size, sort=sort, template=template, oldlog=oldlog)
+ size=size, sort=sort, template=template, oldlog=oldlog, fullnames=fullnames)
# make sure stdout support unicode, otherwise it'll croak when encountered
if not "UTF-8" in sys.stdout.encoding:
sys.stdout = open(sys.stdout.fileno(), mode="w", encoding="UTF-8")
diff --git a/MgaRepo/log.py b/MgaRepo/log.py
index 797c0a1..980429b 100644
--- a/MgaRepo/log.py
+++ b/MgaRepo/log.py
@@ -209,11 +209,12 @@ def group_revisions_by_author(currentlog):
emailpat = re.compile("(?P<name>.*?)\s*<(?P<email>.*?)>")
-
+usermap = {}
def get_author_name(author):
found = emailpat.match(config.get("users", author, author))
- name = ((found and found.group("name")) or author)
- email = ((found and found.group("email")) or author+"@mageia.org")
+ gold = emailpat.match(usermap.get(author,""))
+ name = ((found and found.group("name")) or (gold and gold.group("name")) or author)
+ email = ((found and found.group("email")) or (gold and gold.group("email")) or author+"@mageia.org")
return name, email
def parse_raw_date(rawdate):
@@ -560,9 +561,19 @@ def get_old_log(pkgdirurl):
chlog.seek(0)
return chlog
+def _map_user_names():
+ import urllib.request
+ if not usermap:
+ # This user map is from 2013-08-24, so it's rather dated, but sufficing for those listed...
+ f = urllib.request.urlopen("http://gitweb.mageia.org/software/infrastructure/svn-git-migration/plain/metadata/mageia-user-map.txt")
+ for user in f.read().decode("UTF-8").splitlines():
+ username, namemail = user.split(" = ")
+ usermap[username] = namemail
+ f.close()
+
def get_changelog(pkgdirurl, another=None, svn=True, rev=None, size=None,
submit=False, sort=False, template=None, macros=[], exported=None,
- oldlog=False):
+ oldlog=False, fullnames=False):
"""Generates the changelog for a given package URL
@another: a stream with the contents of a changelog to be merged with
@@ -587,6 +598,8 @@ def get_changelog(pkgdirurl, another=None, svn=True, rev=None, size=None,
"""
newlog = StringIO()
if svn:
+ if fullnames:
+ _map_user_names()
rawsvnlog = svn2rpm(pkgdirurl, rev=rev, size=size, submit=submit,
template=template, macros=macros, exported=exported)
newlog.write(rawsvnlog)
@@ -601,13 +614,15 @@ def get_changelog(pkgdirurl, another=None, svn=True, rev=None, size=None,
return newlog
def specfile_svn2rpm(pkgdirurl, specfile, rev=None, size=None,
- submit=False, sort=False, template=None, macros=[], exported=None):
+ submit=False, sort=False, template=None, macros=[], exported=None, fullnames=False):
with open(specfile, encoding = 'utf-8') as fi:
spec, oldchlog = split_spec_changelog(fi)
another = None
if config.getbool("log", "merge-spec", False):
another = oldchlog
sort = sort or config.getbool("log", "sort", False)
+ if fullnames:
+ _map_user_names()
chlog = get_changelog(pkgdirurl, another=another, rev=rev, size=size,
submit=submit, sort=sort, template=template, macros=macros,
exported=exported, oldlog=True)
diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py
index 1395133..a9dfa7b 100644
--- a/MgaRepo/rpmutil.py
+++ b/MgaRepo/rpmutil.py
@@ -87,7 +87,8 @@ def get_srpm(pkgdirurl,
template = None,
macros = [],
verbose = 0,
- strict = False):
+ strict = False,
+ fullnames = False):
svn = detectVCS(pkgdirurl)
tmpdir = tempfile.mktemp()
topdir = "_topdir %s" % tmpdir
@@ -136,7 +137,7 @@ def get_srpm(pkgdirurl,
if svnlog:
submit = not not revision
log.specfile_svn2rpm(pkgdirurl, spec, revision, submit=submit,
- template=template, macros=macros, exported=tmpdir)
+ template=template, macros=macros, exported=tmpdir, fullnames=fullnames)
for script in scripts:
#FIXME revision can be "None"
status, output = execcmd(script, tmpdir, spec, str(revision),