update: the history of the package is CHANGELOG.md, from which the build writes debian/changelog, the build, publish and development scripts are in Python, and the development tools keep their settings and credentials in .lm-dev-config.
Release / release (push) Failing after 14m43s
Release / release (push) Failing after 14m43s
This commit is contained in:
1 parent
a7bfabcb89
commit
6911d16fa3
26 files changed
+1966
-2105
No files matched your search
+22
-20
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the next numbered dev build and publish it to a test project's repository: lm-dev-build.py.
|
||||
|
||||
The serial N in .dev-build.serial of the repository is that of the last dev build; each build that
|
||||
succeeds writes its own, one higher, and release.py writes 0 when it releases. The build's version
|
||||
is the newest changelog entry's with ~devN before its Debian revision, 0.41.0-1 becoming
|
||||
0.41.0~dev7-1, so the release of that entry is newer than all its dev builds. ./build.sh builds it
|
||||
The serial N, the setting LXD_DEV_BUILD_SERIAL (lm_dev.setting, 0 by default), is that of the last
|
||||
dev build; each build that succeeds writes its own, one higher, into .lm-dev-config/settings.json,
|
||||
and release.py writes 0 there when it releases. The build's version is the Debian version of the
|
||||
newest entry of CHANGELOG.md (bin/changelog.py) with ~devN before its revision, 0.41.0 (0.41.0-1)
|
||||
becoming 0.41.0~dev7-1, so the release of that entry is newer than all its dev builds. ./build.py builds it
|
||||
with CONTAINER_RUNTIME and DOCKER_CONTEXT from the environment; the build is moved to out/dev/,
|
||||
copied into the repository container of the project --project (LXD_PROJECT, lm-dev by default)
|
||||
made by lm-dev-lxd-project.py, and published there. The remote is the project's, read from
|
||||
@@ -13,20 +14,19 @@ made by lm-dev-lxd-project.py, and published there. The remote is the project's,
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lm_dev import PROJECT, ROOT, config_path, lxc_exec
|
||||
import changelog
|
||||
from lm_dev import PROJECT, ROOT, config_path, lxc_exec, save_setting, setting
|
||||
|
||||
SERIAL = ROOT / '.dev-build.serial'
|
||||
CHANGELOG = ROOT / 'debian-package' / 'debian' / 'changelog'
|
||||
CHANGELOG = ROOT / 'CHANGELOG.md'
|
||||
CONTROL = ROOT / 'debian-package' / 'debian' / 'control'
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT),
|
||||
parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT),
|
||||
help=f'the test project made by lm-dev-lxd-project.py, whose remote is used (LXD_PROJECT, '
|
||||
f'default {PROJECT})')
|
||||
args = parser.parse_args()
|
||||
@@ -35,19 +35,21 @@ def main():
|
||||
sys.exit(f'no {state_file}; create the project with lm-dev-lxd-project.py create')
|
||||
state = json.loads(state_file.read_text(encoding='utf-8'))
|
||||
|
||||
# The newest entry's first line is "package (version) distribution; urgency=...".
|
||||
match = re.match(r'(\S+) \(([^)]+)\)', CHANGELOG.read_text(encoding='utf-8'))
|
||||
if not match:
|
||||
sys.exit(f'no version in the first line of {CHANGELOG}')
|
||||
package, version = match.groups()
|
||||
number = int(SERIAL.read_text(encoding='utf-8').strip()) + 1 if SERIAL.is_file() else 1
|
||||
upstream, dash, revision = version.rpartition('-')
|
||||
dev = f'{upstream}~dev{number}-{revision}' if dash else f'{version}~dev{number}'
|
||||
try:
|
||||
found = changelog.entries(CHANGELOG.read_text(encoding='utf-8'))
|
||||
package = changelog.control_field(CONTROL.read_text(encoding='utf-8'), 'Source')
|
||||
except ValueError as error:
|
||||
sys.exit(f'{CHANGELOG}: {error}')
|
||||
if not found:
|
||||
sys.exit(f'{CHANGELOG} has no entry')
|
||||
number = int(setting('LXD_DEV_BUILD_SERIAL', 0)) + 1
|
||||
upstream, _, revision = changelog.debian_version(found[0]['version']).rpartition('-')
|
||||
dev = f'{upstream}~dev{number}-{revision}'
|
||||
|
||||
print(f'building {package} {dev}')
|
||||
if subprocess.run(['./build.sh', '--build-arg', f'DEB_VERSION={dev}'], cwd=ROOT).returncode != 0:
|
||||
if subprocess.run(['./build.py', '--build-arg', f'DEB_VERSION={dev}'], cwd=ROOT).returncode != 0:
|
||||
sys.exit(f'the build of {dev} failed; the serial stays {number - 1}')
|
||||
SERIAL.write_text(f'{number}\n', encoding='utf-8')
|
||||
save_setting('LXD_DEV_BUILD_SERIAL', number)
|
||||
|
||||
# The dev build leaves out/ to out/dev/, so out/ keeps the release builds.
|
||||
target = ROOT / 'out' / 'dev'
|
||||
|
||||
Reference in new issue
Block a user