Auto merge of #4450 - str4d:make-release-py3, r=daira
Updates to zcutil/make-release.py Finishes its migration to Python 3, and adds release process dependency checks.
This commit is contained in:
commit
8a2ab9fbda
|
@ -1,4 +1,4 @@
|
||||||
#! /usr/bin/env python2
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -9,7 +9,7 @@ import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
import unittest
|
import unittest
|
||||||
import random
|
import random
|
||||||
from cStringIO import StringIO
|
from io import StringIO
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,6 +77,11 @@ def parse_args(args):
|
||||||
|
|
||||||
# Top-level flow:
|
# Top-level flow:
|
||||||
def main_logged(release, releaseprev, releasefrom, releaseheight, hotfix):
|
def main_logged(release, releaseprev, releasefrom, releaseheight, hotfix):
|
||||||
|
verify_dependencies([
|
||||||
|
('help2man', None),
|
||||||
|
('debchange', 'devscripts'),
|
||||||
|
])
|
||||||
|
|
||||||
verify_tags(releaseprev, releasefrom)
|
verify_tags(releaseprev, releasefrom)
|
||||||
verify_version(release, releaseprev, hotfix)
|
verify_version(release, releaseprev, hotfix)
|
||||||
initialize_git(release, hotfix)
|
initialize_git(release, hotfix)
|
||||||
|
@ -107,6 +112,20 @@ def phase(message):
|
||||||
return deco
|
return deco
|
||||||
|
|
||||||
|
|
||||||
|
@phase('Checking release script dependencies.')
|
||||||
|
def verify_dependencies(dependencies):
|
||||||
|
for (dependency, pkg) in dependencies:
|
||||||
|
try:
|
||||||
|
sh_log(dependency, '--version')
|
||||||
|
except OSError:
|
||||||
|
raise SystemExit(
|
||||||
|
"Missing dependency {}{}".format(
|
||||||
|
dependency,
|
||||||
|
" (part of {} Debian package)".format(pkg) if pkg else "",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@phase('Checking tags.')
|
@phase('Checking tags.')
|
||||||
def verify_tags(releaseprev, releasefrom):
|
def verify_tags(releaseprev, releasefrom):
|
||||||
candidates = []
|
candidates = []
|
||||||
|
@ -403,7 +422,7 @@ def initialize_logging():
|
||||||
|
|
||||||
def sh_out(*args):
|
def sh_out(*args):
|
||||||
logging.debug('Run (out): %r', args)
|
logging.debug('Run (out): %r', args)
|
||||||
return subprocess.check_output(args)
|
return subprocess.check_output(args).decode()
|
||||||
|
|
||||||
|
|
||||||
def sh_log(*args):
|
def sh_log(*args):
|
||||||
|
@ -417,7 +436,7 @@ def sh_log(*args):
|
||||||
|
|
||||||
logging.debug('Run (log PID %r): %r', p.pid, args)
|
logging.debug('Run (log PID %r): %r', p.pid, args)
|
||||||
for line in p.stdout:
|
for line in p.stdout:
|
||||||
logging.debug('> %s', line.rstrip())
|
logging.debug('> %s', line.decode().rstrip())
|
||||||
status = p.wait()
|
status = p.wait()
|
||||||
if status != 0:
|
if status != 0:
|
||||||
raise SystemExit('Nonzero exit status: {!r}'.format(status))
|
raise SystemExit('Nonzero exit status: {!r}'.format(status))
|
||||||
|
@ -443,6 +462,7 @@ def sh_progress(markers, *args):
|
||||||
pbar.update(marker)
|
pbar.update(marker)
|
||||||
logging.debug('Run (log PID %r): %r', p.pid, args)
|
logging.debug('Run (log PID %r): %r', p.pid, args)
|
||||||
for line in p.stdout:
|
for line in p.stdout:
|
||||||
|
line = line.decode()
|
||||||
logging.debug('> %s', line.rstrip())
|
logging.debug('> %s', line.rstrip())
|
||||||
for idx, val in enumerate(markers[marker:]):
|
for idx, val in enumerate(markers[marker:]):
|
||||||
if val in line:
|
if val in line:
|
||||||
|
@ -557,6 +577,12 @@ class Version (object):
|
||||||
self.hotfix,
|
self.hotfix,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
return self._sort_tup() < other._sort_tup()
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self._sort_tup() == other._sort_tup()
|
||||||
|
|
||||||
|
|
||||||
class PathPatcher (object):
|
class PathPatcher (object):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#! /usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import re, os, os.path
|
import re, os, os.path
|
||||||
|
@ -110,7 +111,7 @@ def generate_release_note(version, prev, clear):
|
||||||
latest_tag = subprocess.Popen(['git describe --abbrev=0'], shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
|
latest_tag = subprocess.Popen(['git describe --abbrev=0'], shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
|
||||||
print("Previous release tag: ", latest_tag)
|
print("Previous release tag: ", latest_tag)
|
||||||
notes = subprocess.Popen(['git shortlog --no-merges {0}..HEAD'.format(latest_tag)], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
|
notes = subprocess.Popen(['git shortlog --no-merges {0}..HEAD'.format(latest_tag)], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
|
||||||
lines = notes.split('\n')
|
lines = notes.decode().split('\n')
|
||||||
lines = [alias_authors_in_release_notes(line) for line in lines]
|
lines = [alias_authors_in_release_notes(line) for line in lines]
|
||||||
temp_release_note = os.path.join(doc_dir, 'release-notes.md')
|
temp_release_note = os.path.join(doc_dir, 'release-notes.md')
|
||||||
with open(temp_release_note, 'r') as f:
|
with open(temp_release_note, 'r') as f:
|
||||||
|
|
Loading…
Reference in New Issue