Merge pull request #991 from mwhudson/installdeps-commit

install curtin at commit specified in snapcraft.yaml for CI
This commit is contained in:
Michael Hudson-Doyle 2021-07-07 08:35:54 +12:00 committed by GitHub
commit 89664a2446
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 13 deletions

3
.gitignore vendored
View File

@ -63,8 +63,9 @@ logs/*
venv venv
.pybuild .pybuild
# probert as its pulled externally, ignore top level only. # top level dependencies fetched from git, ignore top level only.
/probert/ /probert/
/curtin/
# installer isos # installer isos
*.iso *.iso

View File

@ -3,7 +3,7 @@
# #
NAME=subiquity NAME=subiquity
PYTHONSRC=$(NAME) PYTHONSRC=$(NAME)
PYTHONPATH=$(shell pwd):$(shell pwd)/probert PYTHONPATH=$(shell pwd):$(shell pwd)/probert:$(shell pwd)/curtin
PROBERTDIR=./probert PROBERTDIR=./probert
PROBERT_REPO=https://github.com/canonical/probert PROBERT_REPO=https://github.com/canonical/probert
DRYRUN?=--dry-run --bootloader uefi --machine-config examples/simple.json DRYRUN?=--dry-run --bootloader uefi --machine-config examples/simple.json
@ -25,7 +25,7 @@ install_deps:
sudo apt-get install -y python3-urwid python3-pyudev python3-nose python3-flake8 \ sudo apt-get install -y python3-urwid python3-pyudev python3-nose python3-flake8 \
python3-yaml python3-coverage python3-dev pkg-config libnl-genl-3-dev \ python3-yaml python3-coverage python3-dev pkg-config libnl-genl-3-dev \
libnl-route-3-dev python3-attr python3-distutils-extra python3-requests \ libnl-route-3-dev python3-attr python3-distutils-extra python3-requests \
python3-requests-unixsocket python3-jsonschema python3-curtin python3-apport \ python3-requests-unixsocket python3-jsonschema python3-apport \
python3-bson xorriso isolinux python3-aiohttp probert cloud-init ssh-import-id python3-bson xorriso isolinux python3-aiohttp probert cloud-init ssh-import-id
i18n: i18n:
@ -50,20 +50,23 @@ flake8:
@echo 'tox -e flake8' is preferred to 'make flake8' @echo 'tox -e flake8' is preferred to 'make flake8'
$(PYTHON) -m flake8 $(CHECK_DIRS) --exclude gettext38.py,contextlib38.py $(PYTHON) -m flake8 $(CHECK_DIRS) --exclude gettext38.py,contextlib38.py
unit: unit: gitdeps
python3 -m unittest discover python3 -m unittest discover
integration: integration: gitdeps
echo "Running integration tests..." echo "Running integration tests..."
./scripts/runtests.sh ./scripts/runtests.sh
check: unit integration check: unit integration
probert: curtin: snapcraft.yaml
@if [ ! -d "$(PROBERTDIR)" ]; then \ ./scripts/update-part.py curtin
git clone -q $(PROBERT_REPO) $(PROBERTDIR); \
(cd probert && $(PYTHON) setup.py build_ext -i); \ probert: snapcraft.yaml
fi ./scripts/update-part.py probert
(cd probert && $(PYTHON) setup.py build_ext -i);
gitdeps: curtin probert
schema: probert schema: probert
@$(PYTHON) -m subiquity.cmd.schema > autoinstall-schema.json @$(PYTHON) -m subiquity.cmd.schema > autoinstall-schema.json

View File

@ -13,4 +13,3 @@ requests
requests-unixsocket requests-unixsocket
yarl==1.5.1 # see https://github.com/aio-libs/aiohttp/issues/4972 yarl==1.5.1 # see https://github.com/aio-libs/aiohttp/issues/4972
aiohttp aiohttp
-e git+https://github.com/canonical/probert@b697ab779e7e056301e779f4708a9f1ce51b0027#egg=probert

View File

@ -11,6 +11,9 @@ ConditionPathExists=/dev/zfs
EOF EOF
cp -r /etc/systemd/system/zfs-mount.service.d/ /etc/systemd/system/zfs-share.service.d/ cp -r /etc/systemd/system/zfs-mount.service.d/ /etc/systemd/system/zfs-share.service.d/
systemctl daemon-reload systemctl daemon-reload
apt-get install -o APT::Get::Always-Include-Phased-Updates=true -y --no-install-recommends libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libsystemd-dev python3-distutils-extra pkg-config python3.5 python3-pip git lsb-release python3-setuptools gcc python3-dev python3-wheel curtin pep8 python3-pyflakes python3-bson make apt-get install -o APT::Get::Always-Include-Phased-Updates=true -y --no-install-recommends libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libsystemd-dev python3-distutils-extra pkg-config python3.5 python3-pip git lsb-release python3-setuptools gcc python3-dev python3-wheel pep8 python3-pyflakes python3-bson make
pip3 install -r requirements.txt pip3 install -r requirements.txt
python3 setup.py build
make gitdeps
PYTHONPATH=.:./curtin:./probert python3 setup.py build

40
scripts/update-part.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/python3
import os
import subprocess
import sys
import yaml
part = sys.argv[1]
def r(*args, **kw):
print('running', args)
subprocess.run(args, check=True, **kw)
def o(*args, **kw):
return subprocess.run(args, check=True, stdout=subprocess.PIPE).stdout
with open("snapcraft.yaml") as f:
config = yaml.safe_load(f)["parts"][part]
c = "master"
for k in "source-commit", "source-tag", "source-branch":
if k in config:
c = config[k]
break
if not os.path.isdir(part):
r('git', 'clone', config['source'], part)
expected = o('git', '-C', part, 'rev-parse', c)
actual = o('git', '-C', part, 'rev-parse', 'HEAD')
if expected != actual:
try:
r('git', '-c', 'advice.detachedHead=false', '-C', part, 'checkout', c)
except subprocess.CalledProcessError:
r('git', '-C', part, 'fetch', config['source'])
r('git', '-c', 'advice.detachedHead=false', '-C', part, 'checkout', c)