Skip to content

Cargo errors out when build script is not checked into git repository #15174

Open
@msrd0

Description

Problem

I am trying to build an ArchLinux package. That means, the package build for ArchLinux is part of the git repository, but the actual source code gets downloaded from a tarball and placed into a subdirectory. Now I am trying to build probe-rs-tools 0.27.0 which has a build script. I got this funny output:

#12 20.41 ==> Starting build()...
#12 20.58 error: failed to determine package fingerprint for build script for probe-rs-tools v0.27.0 (/src/src/probe-rs-tools-0.27.0)
#12 20.58
#12 20.58 Caused by:
#12 20.58   failed to determine the most recently modified file in /src/src/probe-rs-tools-0.27.0
#12 20.58
#12 20.58 Caused by:
#12 20.58   failed to determine list of files in /src/src/probe-rs-tools-0.27.0
#12 20.58
#12 20.58 Caused by:
#12 20.58   did not expect repo at /src to be bare
#12 20.59 ==> ERROR: A failure occurred in build().
#12 20.59     Aborting...

The repository at /src is definitely not bare, but it definitely also does not contain any files within /src/src where the rust source code lives. I do not understand why cargo even cares about the VCS or searches beyond the topmost Cargo.toml which lives in /src/src.

Steps

git clone https://aur.archlinux.org/probe-rs.git
cd probe-rs
git checkout 84459d4de92d3b35619abe5568e30a1ea3d0ce6e
cat >Dockerfile <<EOF
FROM quay.io/archlinux/archlinux@sha256:bb6748109ed91bc0d6aad3293b339544ed626ed0cbc34d36e474068ea5af7665
SHELL ["/usr/bin/bash", "-exuo", "pipefail", "-c"]

RUN pacman -Sy --noconfirm git; \
	mkdir -p /src

COPY * /src/

RUN useradd -m -U aur \
 && chown -R aur:aur /src \
 && echo "aur ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/user

USER aur
WORKDIR /src

RUN makepkg --noconfirm --noarchive -s
EOF
docker build --progress=plain .

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.84.1 (66221abde 2024-11-19)
release: 1.84.1
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.12.0 (sys:0.4.74+curl-8.9.0 system ssl:OpenSSL/3.4.0)
os: Arch Linux 20250212.0.307741 [64-bit]

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-gitArea: anything dealing with gitA-rebuild-detectionArea: rebuild detection and fingerprintingC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions