Browse Source

Auto merge of #2586 - str4d:release-script-build-progress, r=str4d

Add build progress to the release script if progressbar module is available

Install progressbar2 in your Python path to see the build progress.
pull/40/head^2
Homu 7 years ago
parent
commit
e797c7bdb1
  1. 10
      doc/release-process.md
  2. 56
      zcutil/make-release.py

10
doc/release-process.md

@ -40,6 +40,16 @@ process. If these were not anticipated correctly, this could block the
release, so if you suspect this is necessary, double check with the
whole engineering team.
## Release dependencies
The release script has the following dependencies:
- `help2man`
- `debchange` (part of the devscripts Debian package)
You can optionally install the `progressbar2` Python module with pip to have a
progress bar displayed during the build process.
## Release process
In the commands below, <RELEASE> and <RELEASE_PREV> are prefixed with a v, ie.

56
zcutil/make-release.py

@ -209,8 +209,27 @@ def patch_release_height(releaseheight):
@phase('Building...')
def build():
base_dir = os.getcwd()
depends_dir = os.path.join(base_dir, 'depends')
src_dir = os.path.join(base_dir, 'src')
nproc = sh_out('nproc').strip()
sh_log('./zcutil/build.sh', '-j', nproc)
sh_progress([
'Staging boost...',
'Staging libevent...',
'Staging zeromq...',
'Staging libgmp...',
'Staging libsodium...',
"Leaving directory '%s'" % depends_dir,
'config.status: creating libzcashconsensus.pc',
"Entering directory '%s'" % src_dir,
'httpserver.cpp',
'torcontrol.cpp',
'gtest/test_tautology.cpp',
'gtest/test_metrics.cpp',
'test/equihash_tests.cpp',
'test/util_tests.cpp',
"Leaving directory '%s'" % src_dir,
], './zcutil/build.sh', '-j', nproc)
@phase('Generating manpages.')
@ -348,8 +367,9 @@ def sh_out(*args):
def sh_log(*args):
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
try:
p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, stdin=None)
p = subprocess.Popen(args, stdout=PIPE, stderr=STDOUT, stdin=None)
except OSError:
logging.error('Error launching %r...', args)
raise
@ -362,6 +382,38 @@ def sh_log(*args):
raise SystemExit('Nonzero exit status: {!r}'.format(status))
def sh_progress(markers, *args):
try:
import progressbar
except:
sh_log(*args)
return
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
try:
p = subprocess.Popen(args, stdout=PIPE, stderr=STDOUT, stdin=None)
except OSError:
logging.error('Error launching %r...', args)
raise
pbar = progressbar.ProgressBar(max_value=len(markers))
marker = 0
pbar.update(marker)
logging.debug('Run (log PID %r): %r', p.pid, args)
for line in p.stdout:
logging.debug('> %s', line.rstrip())
for idx, val in enumerate(markers[marker:]):
if val in line:
marker += idx + 1
pbar.update(marker)
break
pbar.finish()
status = p.wait()
if status != 0:
raise SystemExit('Nonzero exit status: {!r}'.format(status))
class Version (object):
'''A release version.'''

Loading…
Cancel
Save