On Mon, 2020-06-29 at 15:32 +0100, Daniel P. Berrangé wrote:
On Mon, Jun 29, 2020 at 03:58:43PM +0200, Andrea Bolognani wrote:
> +for infile in templates/*
> +do
> + outfile="${infile##*/}.j2"
> + host="${outfile%%.*}"
> +
> + eval $("$LCITOOL" dockerfile "libvirt-$host" libvirt
--variables)
> +
> + sed -e "s|[@]PKGS@|$PKGS|g" \
> + -e "s|[@]CROSS_PKGS@|$CROSS_PKGS|g" \
> + -e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g" \
> + -e "s|[@]CPAN_PKGS@|$CPAN_PKGS|g" \
> + -e "s|[@]MAKE@|$MAKE|g" \
> + -e "s|[@]NINJA@|$NINJA|g" \
> + -e "s|[@]PYTHON@|$PYTHON|g" \
> + <"$infile" >"$outfile"
> +done
I feel like this should really be reduced to just:
$LCITOOL cirrusci libvirt-$host libvirt > $outfile
> + build_script:
> + - mkdir build
> + - cd build
> + - ../autogen.sh --prefix=$(pwd)/install-root
> + - $MAKE -j3
> + - $MAKE -j3 install
> + - $MAKE -j3 dist
This part can then be stored in ci/cirrus/build.yml since it is
common to freebsd & macos.
So now in gitlab-ci.yml we can just concatenate the two into a
temp file:
cat ci/cirrus/$NAME.yml ci/cirrus/build.yml > ci/cirrus/$NAME.yml.j2
cirrus-run ci/cirrus/$NAME.yml.j2
This avoids needing to store the same information in git twice.
Yeah, I don't like having to store the information twice in git, but
I'm also not a fan of having an lcitool subcommand that is tightly
coupled with the details of a specific CI service rather than dealing
with the more general problem of managing build environments.
I think I have an approach that can sit somewhere in the middle. Let
me give it a try.
--
Andrea Bolognani / Red Hat / Virtualization