biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
13.94k stars 422 forks source link

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

Closed alerque closed 11 months ago

alerque commented 11 months ago

My old bug report from Rome is still relevant:

https://github.com/rome/tools/issues/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 commented 11 months ago

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

alerque commented 11 months ago

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 ```bash # Maintainer: Caleb Maclennan # Contributor: pinks # 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 d53b1dbdfe2e89e47fafd9f6bc51542526eeee8f 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.