ci: Rework build/test dependency install

Now that `ci/installdeps.sh` gracefully exits if run as non-root,
we can fold the cargo bits into the our build scripts and avoid
invoking both of them.

However, now we need to split test deps to separate file because
we won't have `cargo` in the main cosa pod.  This also fixes a FIXME.

Steal the `grep` invocation from cosa and make it a declarative
text file so we can have comments per package etc.
This commit is contained in:
Colin Walters 2021-02-16 18:15:21 +00:00 committed by OpenShift Merge Robot
parent d7b75f8459
commit c48e8bfad3
11 changed files with 32 additions and 27 deletions

View File

@ -50,8 +50,7 @@ parallel insttests: {
""") """)
} }
stage("Install Deps") { stage("Install Deps") {
// really, we just need test deps, but meh... shwrap("ci/install-test-deps.sh")
shwrap("ci/installdeps.sh")
} }
stage("Kola") { stage("Kola") {
// TODO upstream this into coreos-ci-lib // TODO upstream this into coreos-ci-lib
@ -86,7 +85,7 @@ compose: {
unstash 'rpms' unstash 'rpms'
stage("Install Deps") { stage("Install Deps") {
shwrap(""" shwrap("""
ci/installdeps.sh # really, we just need test deps, but meh... ci/install-test-deps.sh
dnf install -y *.rpm # install our built rpm-ostree dnf install -y *.rpm # install our built rpm-ostree
""") """)
} }

View File

@ -6,7 +6,6 @@ set -xeuo pipefail
dn=$(dirname $0) dn=$(dirname $0)
. ${dn}/libbuild.sh . ${dn}/libbuild.sh
${dn}/install-extra-builddeps.sh
${dn}/installdeps.sh ${dn}/installdeps.sh
# make it clear what rustc version we're compiling with (this is grepped in CI) # make it clear what rustc version we're compiling with (this is grepped in CI)
rustc --version rustc --version

View File

@ -5,7 +5,6 @@ set -xeuo pipefail
dn=$(dirname $0) dn=$(dirname $0)
. ${dn}/libbuild.sh . ${dn}/libbuild.sh
${dn}/install-extra-builddeps.sh
${dn}/installdeps.sh ${dn}/installdeps.sh
env NOCONFIGURE=1 ./autogen.sh env NOCONFIGURE=1 ./autogen.sh
scan-build ./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc scan-build ./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc

View File

@ -8,7 +8,6 @@ dn=$(dirname $0)
git fetch origin --tags git fetch origin --tags
git submodule update --init --recursive git submodule update --init --recursive
ci/installdeps.sh ci/installdeps.sh
ci/install-extra-builddeps.sh
# Our primary CI build goes via RPM rather than direct to binaries # Our primary CI build goes via RPM rather than direct to binaries
# to better test that path, including our vendored spec file, etc. # to better test that path, including our vendored spec file, etc.
# The RPM build expects pre-generated bindings, so do that now. # The RPM build expects pre-generated bindings, so do that now.

View File

@ -1,13 +1 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# cxx.rs (cxxbridge) isn't packaged in Fedora today. Both it and cbindgen generate
# source code, which we vendor along with our dependent crates into release
# tarballs. Note in the future it's likely we stop using cbindgen entirely in
# favor of cxx.rs.
set -euo pipefail
CXX_VER=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "cxx").version')
time cargo install cxxbridge-cmd --version "${CXX_VER}"
CBINDGEN_VER=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "cbindgen").version')
time cargo install cbindgen --version "${CBINDGEN_VER}"

6
ci/install-test-deps.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
dn=$(dirname $0)
. ${dn}/libbuild.sh
deps=$(grep -v '^#' "${dn}"/testdeps.txt)
pkg_install ${deps}

View File

@ -6,6 +6,18 @@ set -xeuo pipefail
dn=$(dirname $0) dn=$(dirname $0)
. ${dn}/libbuild.sh . ${dn}/libbuild.sh
# cxx.rs (cxxbridge) isn't packaged in Fedora today. Both it and cbindgen generate
# source code, which we vendor along with our dependent crates into release
# tarballs. Note in the future it's likely we stop using cbindgen entirely in
# favor of cxx.rs.
CXX_VER=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "cxx").version')
time cargo install cxxbridge-cmd --version "${CXX_VER}"
CBINDGEN_VER=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "cbindgen").version')
time cargo install cbindgen --version "${CBINDGEN_VER}"
# Everything below here uses dnf/yum; we don't try to use
# sudo for you right now. (Though hopefully you're building
# in an unprivileged podman container at least)
if [ -n "${SKIP_INSTALLDEPS:-}" ] || test $(id -u) != 0; then if [ -n "${SKIP_INSTALLDEPS:-}" ] || test $(id -u) != 0; then
exit 0 exit 0
fi fi
@ -13,9 +25,5 @@ fi
# we have the canonical spec file handy so just builddep from that # we have the canonical spec file handy so just builddep from that
# XXX: use --allowerasing as a temporary hack to ease the migration to libmodulemd2 # XXX: use --allowerasing as a temporary hack to ease the migration to libmodulemd2
time dnf builddep --spec -y packaging/rpm-ostree.spec.in --allowerasing time dnf builddep --spec -y packaging/rpm-ostree.spec.in --allowerasing
# Mostly dependencies for tests; TODO move these into the spec file
# and also put them in the cosa buildroot (or another container)
pkg_install ostree{,-devel,-grub2} createrepo_c /usr/bin/jq python3-pyyaml \
libubsan libasan libtsan elfutils fuse sudo python3-gobject-base \
selinux-policy-devel selinux-policy-targeted python3-createrepo_c \
rsync python3-rpm parallel clang rustfmt-preview distribution-gpg-keys

8
ci/testdeps.txt Normal file
View File

@ -0,0 +1,8 @@
# Dependencies for our test suites, i.e. ./tests/compose and
# ./tests/vmcheck.
createrepo_c
/usr/bin/jq
python3-pyyaml
libubsan libasan libtsan elfutils fuse sudo python3-gobject-base
selinux-policy-devel selinux-policy-targeted python3-createrepo_c
rsync python3-rpm parallel distribution-gpg-keys

View File

@ -5,5 +5,4 @@ dn=$(dirname $0)
. ${dn}/libbuild.sh . ${dn}/libbuild.sh
ci/installdeps.sh ci/installdeps.sh
ci/install-extra-builddeps.sh
ci/build.sh ci/build.sh

View File

@ -98,7 +98,7 @@ AS_IF([test -z "$cargo"], [AC_MSG_ERROR([cargo is required for --enable-rust])])
AC_PATH_PROG([rustc], [rustc]) AC_PATH_PROG([rustc], [rustc])
AS_IF([test -z "$rustc"], [AC_MSG_ERROR([rustc is required for --enable-rust])]) AS_IF([test -z "$rustc"], [AC_MSG_ERROR([rustc is required for --enable-rust])])
dnl See comment in install-extra-builddeps.sh dnl See comment in installdeps.sh
AM_CONDITIONAL(BUILDOPT_PREBUILT_BINDINGS, [test -f rpmostree-rust-prebuilt.h]) AM_CONDITIONAL(BUILDOPT_PREBUILT_BINDINGS, [test -f rpmostree-rust-prebuilt.h])
AC_MSG_CHECKING(whether to build in debug mode) AC_MSG_CHECKING(whether to build in debug mode)

View File

@ -60,7 +60,7 @@ open(checksum_file, "w").write(json.dumps(j))' $crate_subdir
tar --transform="s,^,${PKG_VER}/," -rf ${TARFILE_TMP} * .cargo/ tar --transform="s,^,${PKG_VER}/," -rf ${TARFILE_TMP} * .cargo/
) )
# And finally, vendor generated code. See install-extra-builddeps.sh # And finally, vendor generated code. See installdeps.sh
# and Makefile-rpm-ostree.am for more. # and Makefile-rpm-ostree.am for more.
(cd ${srcdir} (cd ${srcdir}
cp rpmostree-rust{,-prebuilt}.h cp rpmostree-rust{,-prebuilt}.h