Unable to determine project version info in multipass build environment


#1

I previously use the following override-pull scriptlet to generate the snap version:

	snapcraftctl pull

	upstream_version="$(
		git \
			describe \
			--always \
			--dirty=-d \
			--tags \
		| sed s/^v//
	)"

	packaging_revision="$(
		git \
			-C .. \
			describe \
			--abbrev=4 \
			--always \
			--match nothing \
			--dirty=-d
	)"

	snapcraftctl set-version \
		"${upstream_version}+pkg-${packaging_revision}"

However, when building the snap using the multipass build environment the script fails on the packaging_revision parameter assignment as the parts directory(/root/parts in the multipass VM) no longer reside in the VCS source tree(/root/project in the multipass VM).

Is there any way to get around this without any hacks and workarounds?


#2

Bumping topic…