cargo-bins / cargo-binstall

Binary installation for rust projects
GNU General Public License v3.0
1.62k stars 60 forks source link

`bin-dir configuration provided generates duplicate source path` #1886

Open pinage404 opened 3 months ago

pinage404 commented 3 months ago

Hello,

I'm trying to setup cargo-binstall

While trying, i put the hardcoded URL (i will use template when it works)

[package.metadata.binstall]
pkg-fmt = "bin"
pkg-url = "https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux"

Using this version on NixOS

cargo-binstall -V --verbose
cargo-binstall: 1.10.2
build-date: 1980-01-01
build-target: x86_64-unknown-linux-gnu
build-features: fancy_no_backtrace,git,pkg_config,rustls,trust_dns,zstd_thin
build-commit-hash: UNKNOWN
build-commit-date: UNKNOWN
rustc-version: 1.80.1
rustc-commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
rustc-llvm-version: 18.1

Running this command to check locally

cargo-binstall --manifest-path=. --targets x86_64-unknown-linux-gnu git-gamble --verbose

It gives this output

DEBUG using (/home/pinage404/.cargo) as cargo home
DEBUG Using install path: /home/pinage404/.cargo/bin
 INFO resolve: Resolving package: 'git-gamble'
DEBUG Reading crate git-gamble manifest at local path: .
DEBUG load_manifest_from_workspace_inner{workspace_path="." crate_name="git-gamble"}: Loading manifest of crate git-gamble from workspace: .
DEBUG load_manifest_from_workspace_inner{workspace_path="." crate_name="git-gamble"}: Loading from ./Cargo.toml, manifest.package.name = Some(
    "git-gamble",
)
DEBUG resolve: Building metadata for target: x86_64-unknown-linux-gnu
DEBUG resolve: Found metadata: PkgMeta { pkg_url: Some("https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux"), pkg_fmt: Some(Bin), bin_dir: None, signing: None, disabled_strategies: Some([]), overrides: {} }
DEBUG Failed to retrieve token from `gh auth token` err=Os { code: 2, kind: NotFound, message: "No such file or directory" }
DEBUG Failed to read git credential file
DEBUG Downloading from: 'https://raw.githubusercontent.com/cargo-bins/cargo-quickinstall/main/supported-targets'
DEBUG get_repo_info{self=Data { name: "git-gamble", version: "2.9.0", repo: Some("https://gitlab.com/pinage404/git-gamble"), repo_info: OnceCell { value: None } }}: Downloading from: 'https://gitlab.com/pinage404/git-gamble'
DEBUG get_repo_info{self=Data { name: "git-gamble", version: "2.9.0", repo: Some("https://gitlab.com/pinage404/git-gamble"), repo_info: OnceCell { value: None } }}:do_send_request{request=Request { method: HEAD, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("gitlab.com")), port: None, path: "/pinage404/git-gamble", query: None, fragment: None }, headers: {} } url=https://gitlab.com/pinage404/git-gamble}:new_resolver: Using system DNS resolver configuration
DEBUG get_repo_info{self=Data { name: "git-gamble", version: "2.9.0", repo: Some("https://gitlab.com/pinage404/git-gamble"), repo_info: OnceCell { value: None } }}:do_send_request{request=Request { method: HEAD, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("gitlab.com")), port: None, path: "/pinage404/git-gamble", query: None, fragment: None }, headers: {} } url=https://gitlab.com/pinage404/git-gamble}:new_resolver: Resolver configuration complete
DEBUG Sending installation report to quickinstall (https://warehouse-clerk-tmp.vercel.app/api/crate/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz)
DEBUG Downloading from: 'https://warehouse-clerk-tmp.vercel.app/api/crate/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz'
 WARN Failed to send quickinstall report for package git-gamble-2.9.0-x86_64-unknown-linux-gnu: Failed to download from remote: could not HEAD https://warehouse-clerk-tmp.vercel.app/api/crate/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz: HTTP status client error (402 Payment Required) for url (https://warehouse-clerk-tmp.vercel.app/api/crate/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz)
DEBUG get_repo_info{self=Data { name: "git-gamble", version: "2.9.0", repo: Some("https://gitlab.com/pinage404/git-gamble"), repo_info: OnceCell { value: None } }}: Resolved repo_info = RepoInfo {
    repo: Url {
        scheme: "https",
        cannot_be_a_base: false,
        username: "",
        password: None,
        host: Some(
            Domain(
                "gitlab.com",
            ),
        ),
        port: None,
        path: "/pinage404/git-gamble",
        query: None,
        fragment: None,
    },
    repository_host: GitLab,
    subcrate: None,
    is_private: false,
}
DEBUG render url template template=Template { items: [Text("https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux")], default: None } context=Context { name: "git-gamble", repo: Some("https://gitlab.com/pinage404/git-gamble"), target: "x86_64-unknown-linux-gnu", version: "2.9.0", archive_format: None, binary_ext: "", subcrate: None, url: None, .. }
DEBUG Checking for package at: 'https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux'
DEBUG Downloading from: 'https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux'
DEBUG Winning URL found! resolved=Resolved { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("gitlab.com")), port: None, path: "/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux", query: None, fragment: None }, pkg_fmt: Bin, archive_suffix: None, repo: Some("https://gitlab.com/pinage404/git-gamble"), subcrate: None, gh_release_artifact_url: None, is_repo_private: false }
DEBUG resolve: Downloading package url=https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux dst=/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta fmt=Bin
DEBUG resolve:and_extract{fmt=Bin path=/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta}: Downloading from: 'https://gitlab.com/api/v4/projects/pinage404%2Fgit-gamble/packages/generic/git-gamble-linux/2.9.0/git-gamble_v2.9.0_x86_64_linux'
DEBUG resolve:and_extract{fmt=Bin path=/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta}: Downloading and extracting to: '/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta'
DEBUG resolve:and_extract{fmt=Bin path=/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta}: Writing to `/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta`
DEBUG resolve:and_extract{fmt=Bin path=/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta}: Download OK, extracted to: '/home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta'
DEBUG resolve: extracted_files = ExtractedFiles(
    {
        "bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta": File,
        ".": Dir(
            {
                "bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta",
            },
        ),
    },
)
 WARN resolve: Error while downloading and extracting from fetcher gitlab.com: bin-dir configuration provided generates duplicate source path: /home/pinage404/.cargo/bin/cargo-binstallFDSddH/bin-git-gamble-x86_64-unknown-linux-gnu-GhCrateMeta
DEBUG Checking for package at: 'https://github.com/cargo-bins/cargo-quickinstall/releases/download/git-gamble-2.9.0/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz'
DEBUG Using GitHub API to check for existence of artifact, which will also cache the API response
DEBUG has_release_artifact{release=GhRelease { repo: GhRepo { owner: "cargo-bins", repo: "cargo-quickinstall" }, tag: "git-gamble-2.9.0" } artifact_name="git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz"}: Getting restful API: https://api.github.com/repos/cargo-bins/cargo-quickinstall/releases/tags/git-gamble-2.9.0
DEBUG has_release_artifact{release=GhRelease { repo: GhRepo { owner: "cargo-bins", repo: "cargo-quickinstall" }, tag: "git-gamble-2.9.0" } artifact_name="git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz"}: Downloading from: 'https://api.github.com/repos/cargo-bins/cargo-quickinstall/releases/tags/git-gamble-2.9.0'
DEBUG Downloading signature url=https://github.com/cargo-bins/cargo-quickinstall/releases/download/git-gamble-2.9.0/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz.sig
DEBUG into_bytes: Downloading from: 'https://github.com/cargo-bins/cargo-quickinstall/releases/download/git-gamble-2.9.0/git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz.sig'
DEBUG has_release_artifact{release=GhRelease { repo: GhRepo { owner: "cargo-bins", repo: "cargo-quickinstall" }, tag: "git-gamble-2.9.0" } artifact_name="git-gamble-2.9.0-x86_64-unknown-linux-gnu.tar.gz"}: return=Ok(None)
 WARN The package git-gamble v2.9.0 will be installed from source (with cargo)
Do you wish to continue? yes/[no]
? DEBUG run time: 9.69698435s
 WARN Installation cancelled

I don't know what should i do

Do you have any clue ?

NobodyXu commented 3 months ago

The error is from https://github.com/cargo-bins/cargo-binstall/blob/448bb02a7fb3bded10e371612519f0c07c920411/crates/binstalk/src/ops/resolve.rs#L397

I checked your repository, and you have two binaries in Cargo.toml, that's probably what triggers the bug.

NobodyXu commented 3 months ago

@pinage404 for your configuration I recommend a tarball/zip which contains all binaries.

Since none of the binary in Cargo.toml is optional, binstall expects all of them to be available.

I opened #1888 to improve how binstall handles this.

pinage404 commented 3 months ago

Interesting

The second binary is a work in progress and not really published yet

I don't know yet how i will solve the issue

NobodyXu commented 3 months ago

The second binary is a work in progress and not really published yet

You can just build it and put it in the tarball/zip, as long as it's there it should work.