Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check failure when building in a clean chroot using a source archive (not Git clone) #336

Closed
alerque opened this issue Sep 19, 2023 · 2 comments

Comments

@alerque
Copy link

alerque commented Sep 19, 2023

My old bug report from Rome is still relevant:

rome/tools#4548

Presumably something is being assumed about the sources being a Git clone instead of being packages from the git archive tarball.

What happened?

cargo check fails.

Expected result

Sources should be self contained so git archive generated tarballs have everything needed to build and test.

@ematipico
Copy link
Member

Do you still experience the issue? I removed the check of the .git folder.

@alerque
Copy link
Author

alerque commented Oct 2, 2023

That does seem to have fixed the issue. For reference of anyone else landing on this from a search here is the PKGBUILD I used for testing:

PKGBUILD
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: pinks <aur at papepati dot page>

# Tests assume Git checkout, not source archive...
# https://github.com/biomejs/biome/issues/336
# BUILDENV+=(!check)
_sha=d53b1dbdfe2e89e47fafd9f6bc51542526eeee8f

pkgname=biome
pkgver=1.2.2
pkgrel=1
pkgdesc='Formatter, linter, and more for Javascript, Typescript, JSON, and CSS'
arch=(x86_64)
url=https://biomejs.dev
license=(MIT)
depends=(gcc-libs
         glibc)
makedepends=(cargo)
replaces=(rome)
# _archive="$pkgname-cli-v$pkgver"
# source=("https://github.com/biomejs/biome/archive/cli/v$pkgver/$_archive.tar.gz")
_archive="$pkgname-$_sha"
source=("https://github.com/biomejs/biome/archive/$_sha/$_archive.tar.gz")
sha256sums=('87ec0f701e55bc4acf1d0d2b0cb67c340563f4be1b126a7dac061c39d96b1c69')

prepare() {
	cd "$_archive/crates/${pkgname}_cli"
	cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
	cd "$_archive"
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	CFLAGS+=' -ffat-lto-objects'
	cargo build -p "${pkgname}_cli"  --frozen --release --all-features
}

check() {
	cd "$_archive"
	export RUSTUP_TOOLCHAIN=stable
	cargo test -p "${pkgname}_cli" --frozen --all-features
}

package() {
	cd "$_archive"
	install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}

That build d53b1db and it seems to work with official Arch build tooling (that builds in a clean chroot with only the specified dependencies) and passes the check() phase.

@alerque alerque closed this as completed Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants