Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cargo-c for openSUSE:Factory checked in at 2023-01-04 17:50:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cargo-c (Old) and /work/SRC/openSUSE:Factory/.cargo-c.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cargo-c" Wed Jan 4 17:50:53 2023 rev:14 rq:1046285 version:0.9.15~git0.2d3044b Changes: -------- --- /work/SRC/openSUSE:Factory/cargo-c/cargo-c.changes 2022-07-05 12:27:41.593889664 +0200 +++ /work/SRC/openSUSE:Factory/.cargo-c.new.1563/cargo-c.changes 2023-01-04 17:51:08.473664762 +0100 @@ -1,0 +2,39 @@ +Mon Jan 02 15:45:48 UTC 2023 - a...@cryptomilk.org + +- Update to version 0.9.15~git0.2d3044b: + * Prepare for release + * Update to cargo-0.67 and clap-4 + * macos: Allow larger install_name entries + * Fix the new clippy lints + * Don't include version in soname ELF header if versioning is disabled + * Use get_many instead of values_of_lossy + * Use macos-12 for the macos runner + * Add job deps + * Generate paths relative to ${prefix} in the pkg-config file even if --libdir or --includedir are given + * Compact the main CI + * Fix more warnings in the main CI + * Use a custom release profile to strip binaries + * ci(deploy): Use musl abi for aarch64 linux binary, add i686 linux + * Remove msys2 test + * Update the example-project CI + * Make sure the supported rustc version is evident + * Use the default compiler to build a static binary for musl + * Save all the linux binaries + * Prepare for release + * Add pre-built ppc64le and aarch64 linux binaries + * Simplify the deploy script + * Fix new clippy lints + * Update to cargo-0.66 + * Use dtolnay/rust-toolchain + * Remove actions-rs/cargo + * Prepare for release + * add support for illumos + * Bump cargo version + * Prepare for release + * Bump cargo to 0.64 + * Install the windows DLL in the libdir if it is custom + * Fix typo on readme + * Bump the codecov action + * Add sonames on musl + +------------------------------------------------------------------- Old: ---- cargo-c-0.9.11~git0.41f5562.tar.xz New: ---- cargo-c-0.9.15~git0.2d3044b.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cargo-c.spec ++++++ --- /var/tmp/diff_new_pack.Emtsz7/_old 2023-01-04 17:51:10.633677492 +0100 +++ /var/tmp/diff_new_pack.Emtsz7/_new 2023-01-04 17:51:10.637677517 +0100 @@ -1,7 +1,7 @@ # # spec file for package cargo-c # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # Copyright (c) 2019 Andreas Schneider <a...@cryptomilk.org>. # # All modifications and additions to the file contributed by third parties @@ -20,7 +20,7 @@ %global rustflags -Clink-arg=-Wl,-z,relro,-z,now -C debuginfo=2 Name: cargo-c -Version: 0.9.11~git0.41f5562 +Version: 0.9.15~git0.2d3044b Release: 0 Summary: Helper to build and install c-like libraries from Rust License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Emtsz7/_old 2023-01-04 17:51:10.681677776 +0100 +++ /var/tmp/diff_new_pack.Emtsz7/_new 2023-01-04 17:51:10.685677799 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/lu-zero/cargo-c.git</param> <param name="versionformat">@PARENT_TAG@~git@TAG_OFFSET@.%h</param> <param name="scm">git</param> - <param name="revision">v0.9.11</param> + <param name="revision">v0.9.15</param> <param name="match-tag">*</param> <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param> <param name="versionrewrite-replacement">\1</param> ++++++ cargo-c-0.9.11~git0.41f5562.tar.xz -> cargo-c-0.9.15~git0.2d3044b.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/.github/workflows/deploy.yml new/cargo-c-0.9.15~git0.2d3044b/.github/workflows/deploy.yml --- old/cargo-c-0.9.11~git0.41f5562/.github/workflows/deploy.yml 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/.github/workflows/deploy.yml 2022-12-20 15:41:48.000000000 +0100 @@ -26,27 +26,17 @@ - uses: actions/checkout@v2 - name: Install stable - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: ${{ matrix.toolchain }} - override: true - name: Build cargo-c run: | - cargo build --release - - - name: Strip gnu binaries - if: matrix.conf == 'gnu' - run: | - strip "target\release\cargo-capi.exe" ` - "target\release\cargo-cbuild.exe" ` - "target\release\cargo-cinstall.exe" - + cargo build --profile release-strip - name: Create zip run: | - cd target/release + cd target/release-strip 7z a ../../cargo-c-windows-${{ matrix.conf }}.zip ` "cargo-capi.exe" ` "cargo-cbuild.exe" ` @@ -59,46 +49,39 @@ path: cargo-c-windows-${{ matrix.conf }}.zip linux-binaries: + strategy: + fail-fast: false + matrix: + target: + - i686-unknown-linux-musl + - x86_64-unknown-linux-musl + - powerpc64le-unknown-linux-gnu + - aarch64-unknown-linux-musl runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Install musl-tools - run: | - sudo apt-get install musl-tools - - - name: Install Rust stable and musl target - uses: actions-rs/toolchain@v1 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - target: x86_64-unknown-linux-musl - override: true - - name: Build openssl for musl + - name: Install cross run: | - OPENSSL_BIN=target/x86_64-unknown-linux-musl/release/build - git clone --depth 1 https://github.com/sfackler/rust-openssl - cd rust-openssl/openssl-sys - cargo build --target x86_64-unknown-linux-musl \ - --release \ - --features=vendored - mv ../$OPENSSL_BIN/openssl-sys-*/out/openssl-build/install/* \ - $GITHUB_WORKSPACE + cargo install cross --git https://github.com/cross-rs/cross - name: Build cargo-c run: | - export OPENSSL_LIB_DIR=$GITHUB_WORKSPACE/lib - export OPENSSL_INCLUDE_DIR=$GITHUB_WORKSPACE/include - cargo build --target x86_64-unknown-linux-musl --release + cross build --target ${{ matrix.target }} \ + --features=vendored-openssl \ + --profile release-strip - name: Create zip run: | - cd target/x86_64-unknown-linux-musl/release - strip cargo-capi cargo-cbuild cargo-cinstall - tar -czvf $GITHUB_WORKSPACE/cargo-c-linux.tar.gz \ + cd target/${{ matrix.target }}/release-strip + tar -czvf $GITHUB_WORKSPACE/cargo-c-${{ matrix.target }}.tar.gz \ cargo-capi \ cargo-cbuild \ cargo-cinstall @@ -107,7 +90,7 @@ uses: actions/upload-artifact@v2 with: name: cargo-c-linux-binaries - path: cargo-c-linux.tar.gz + path: cargo-c-${{ matrix.target }}.tar.gz macos-binaries: @@ -117,20 +100,17 @@ - uses: actions/checkout@v2 - name: Install stable - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true - name: Build cargo-c run: | - cargo build --features=cargo/vendored-openssl --release + cargo build --features=vendored-openssl --profile release-strip - name: Create zip run: | - cd target/release - strip cargo-capi cargo-cbuild cargo-cinstall + cd target/release-strip zip $GITHUB_WORKSPACE/cargo-c-macos.zip \ cargo-capi \ cargo-cbuild \ @@ -152,11 +132,9 @@ - uses: actions/checkout@v2 - name: Install stable - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true - name: Download zip files uses: actions/download-artifact@v2 @@ -170,7 +148,7 @@ with: files: | Cargo.lock - cargo-c-linux-binaries/cargo-c-linux.tar.gz + cargo-c-linux-binaries/*.tar.gz cargo-c-macos-binaries/cargo-c-macos.zip cargo-c-windows-msvc-binaries/cargo-c-windows-msvc.zip cargo-c-windows-gnu-binaries/cargo-c-windows-gnu.zip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/.github/workflows/example-project.yml new/cargo-c-0.9.15~git0.2d3044b/.github/workflows/example-project.yml --- old/cargo-c-0.9.11~git0.41f5562/.github/workflows/example-project.yml 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/.github/workflows/example-project.yml 2022-12-20 15:41:48.000000000 +0100 @@ -23,14 +23,12 @@ steps: - name: Clone Git repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable${{ matrix.toolchain-suffix }} - override: true - name: Install cargo-c applet run: | @@ -80,42 +78,3 @@ run: | make - example-project-msys2: - - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - - steps: - - name: Clone Git repository - uses: actions/checkout@v2 - - - name: Install MSYS2 - uses: msys2/setup-msys2@v2 - with: - install: >- - make - mingw-w64-x86_64-pkg-config - mingw-w64-x86_64-rust - # mingw-w64-x86_64-cargo-c - - # NB: cargo-c is available from the package mingw-w64-x86_64-cargo-c - # (https://packages.msys2.org/base/mingw-w64-cargo-c), - # which is the recommended way to use cargo-c on MSYS2. - # For testing purposes, we compile and install the latest version from the Git repo - # (which takes much longer than installing the MSYS2 package!): - - - name: Install cargo-c applet - run: | - cargo install --path . - - - name: Install C API for example project - working-directory: example-project - run: | - cargo cinstall --verbose --release --prefix /mingw64 --target x86_64-pc-windows-gnu - - - name: Test usage from C (using Makefile) - working-directory: example-project/usage-from-c - run: | - make diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/.github/workflows/rust.yml new/cargo-c-0.9.15~git0.2d3044b/.github/workflows/rust.yml --- old/cargo-c-0.9.11~git0.41f5562/.github/workflows/rust.yml 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/.github/workflows/rust.yml 2022-12-20 15:41:48.000000000 +0100 @@ -5,27 +5,20 @@ jobs: rustfmt-clippy: - name: Format and Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install stable - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true components: clippy, rustfmt - name: Run rustfmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: | + cargo fmt --all -- --check - name: Run clippy uses: actions-rs/clippy-check@v1 @@ -33,15 +26,17 @@ token: ${{ secrets.GITHUB_TOKEN }} args: --all -- -D warnings --verbose - - Ubuntu-Nightly: - - name: Ubuntu-Nightly - + coverage: + needs: arch-test + name: Code coverage runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Install toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable - name: Install grcov env: @@ -51,151 +46,50 @@ curl -L "$LINK/v$GRCOV_VERSION/grcov-x86_64-unknown-linux-gnu.tar.bz2" | tar xj -C $HOME/.cargo/bin - - name: Install nightly - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: llvm-tools-preview - - name: Set up MinGW uses: egor-tensin/setup-mingw@v2 with: platform: x64 cc: false - - name: Run cargo clean - run: | - cargo clean - - name: Run grcov id: coverage run: bash coverage.sh - name: Codecov upload - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: files: coverage.lcov - Ubuntu-Stable: - - name: Ubuntu-Stable - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --verbose - - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --verbose - - msvc-Nightly: - - name: msvc-Nightly - - runs-on: windows-latest - + arch-test: + needs: rustfmt-clippy + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-12] + toolchain: [nightly, stable] + include: + - toolchain: nightly-gnu + os: windows-latest + - toolchain: stable-gnu + os: windows-latest + + name: ${{matrix.os}}-${{matrix.toolchain}} + runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Install nightly - uses: actions-rs/toolchain@v1 + - name: Install ${{matrix.toolchain}} + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: nightly - override: true - - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-fail-fast - - msvc-Stable: - - name: msvc-Stable - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + toolchain: ${{matrix.toolchain}} - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --verbose - - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --verbose - - mingw-Nightly: - - name: mingw-Nightly - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install nightly-gnu - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-gnu - override: true + run: | + cargo build --verbose - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-fail-fast - - mingw-Stable: - - name: mingw-Stable - - runs-on: windows-latest + run: | + cargo test --verbose - steps: - - uses: actions/checkout@v2 - - name: Install stable-gnu - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable-gnu - override: true - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-fail-fast diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/Cargo.toml new/cargo-c-0.9.15~git0.2d3044b/Cargo.toml --- old/cargo-c-0.9.11~git0.41f5562/Cargo.toml 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/Cargo.toml 2022-12-20 15:41:48.000000000 +0100 @@ -1,6 +1,6 @@ [package] name = "cargo-c" -version = "0.9.11+cargo-0.63" +version = "0.9.15+cargo-0.67" authors = ["Luca Barbato <lu_z...@gentoo.org>"] description = "Helper program to build and install c-like libraries" license = "MIT" @@ -9,6 +9,7 @@ repository = "http://github.com/lu-zero/cargo-c" categories = ["command-line-utilities", "development-tools::cargo-plugins"] keywords = ["cargo", "cdylib"] +rust-version = "1.66" [[bin]] name = "cargo-capi" @@ -27,11 +28,11 @@ path = "src/bin/ctest.rs" [dependencies] -cargo = "0.63.1" +cargo = "0.67.0" cargo-util = "0.2" semver = "1.0.3" log = "0.4" -clap = { version="3.1", features=["color", "derive", "cargo"] } +clap = { version="4.0.29", features=["color", "derive", "cargo"] } regex = "1.5.6" cbindgen = "0.24.3" toml = "0.5" @@ -46,3 +47,7 @@ [features] default = [] vendored-openssl = ["cargo/vendored-openssl"] + +[profile.release-strip] +inherits = "release" +strip = "symbols" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/README.md new/cargo-c-0.9.15~git0.2d3044b/README.md --- old/cargo-c-0.9.11~git0.41f5562/README.md 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/README.md 2022-12-20 15:41:48.000000000 +0100 @@ -16,6 +16,9 @@ cargo install cargo-c ``` +The `rustc` version supported is the same as the one supported by the `cargo` version embedded in the package version, or as set in the +[rust-version](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) field. + You must have the **cargo** build [requirements](https://github.com/rust-lang/cargo#compiling-from-source) satisfied in order to build **cargo-c**: * `git` * `pkg-config` (on Unix, used to figure out the host-provided headers/libraries) @@ -145,21 +148,21 @@ # Copy the pre-generated data files found in {root_dir}/{from} to {datadir}/{to}/{matched subdirs} # If {from} is a single path instead of a glob, the destination is {datapath}/{to}. # datapath is {datadir}/{subdirectory} -assets = [{from="pattern/with/or/without/**/*", to="destination"}] +asset = [{from="pattern/with/or/without/**/*", to="destination"}] # Copy the pre-generated data files found in {OUT_DIR}/{from} to {includedir}/{to}/{matched subdirs} # If {from} is a single path instead of a glob, the destination is {datapath}/{to}. # datapath is {datadir}/{subdirectory} -generated = [{from="pattern/with/or/without/**/*", to="destination"] +generated = [{from="pattern/with/or/without/**/*", to="destination"}] [package.metadata.capi.install.include] # Copy the pre-generated includes found in {root_dir}/{from} to {includedir}/{to}/{matched subdirs} # If {from} is a single path instead of a glob, the destination is {includepath}/{to}. # includepath is {includedir}/{header.subdirectory} -assets = [{from="pattern/with/or/without/**/*", to="destination"}] +asset = [{from="pattern/with/or/without/**/*", to="destination"}] # Copy the pre-generated includes found in {OUT_DIR}/{from} to {includedir}/{to}/{matched subdirs} # If {from} is a single path instead of a glob, the destination is {includedpath}/{to}. # includepath is {includedir}/{header.subdirectory} -generated = [{from="pattern/with/or/without/**/*", to="destination"] +generated = [{from="pattern/with/or/without/**/*", to="destination"}] ``` ### Notes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/bin/capi.rs new/cargo-c-0.9.15~git0.2d3044b/src/bin/capi.rs --- old/cargo-c-0.9.11~git0.41f5562/src/bin/capi.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/bin/capi.rs 2022-12-20 15:41:48.000000000 +0100 @@ -18,7 +18,6 @@ let cli_test = subcommand_test("test"); let mut app = clap::command!() - .setting(AppSettings::DeriveDisplayOrder) .dont_collapse_args_in_usage(true) .allow_external_subcommands(true) .subcommand( @@ -56,7 +55,7 @@ } }; - if subcommand_args.is_present("version") { + if subcommand_args.flag("version") { println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); return Ok(()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/bin/cbuild.rs new/cargo-c-0.9.15~git0.2d3044b/src/bin/cbuild.rs --- old/cargo-c-0.9.11~git0.41f5562/src/bin/cbuild.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/bin/cbuild.rs 2022-12-20 15:41:48.000000000 +0100 @@ -7,14 +7,11 @@ use cargo_c::cli::subcommand_build; use cargo_c::config::*; -use clap::*; - fn main() -> CliResult { let mut config = Config::default()?; let subcommand = subcommand_build("cbuild", "Build the crate C-API"); let mut app = clap::command!() - .setting(AppSettings::DeriveDisplayOrder) .dont_collapse_args_in_usage(true) .allow_external_subcommands(true) .subcommand(subcommand); @@ -33,7 +30,7 @@ } }; - if subcommand_args.is_present("version") { + if subcommand_args.flag("version") { println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); return Ok(()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/bin/cinstall.rs new/cargo-c-0.9.15~git0.2d3044b/src/bin/cinstall.rs --- old/cargo-c-0.9.11~git0.41f5562/src/bin/cinstall.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/bin/cinstall.rs 2022-12-20 15:41:48.000000000 +0100 @@ -8,14 +8,11 @@ use cargo_c::config::config_configure; use cargo_c::install::cinstall; -use clap::*; - fn main() -> CliResult { let mut config = Config::default()?; let subcommand = subcommand_install("cinstall", "Install the crate C-API"); let mut app = clap::command!() - .setting(AppSettings::DeriveDisplayOrder) .dont_collapse_args_in_usage(true) .allow_external_subcommands(true) .subcommand(subcommand); @@ -34,7 +31,7 @@ } }; - if subcommand_args.is_present("version") { + if subcommand_args.flag("version") { println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); return Ok(()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/bin/ctest.rs new/cargo-c-0.9.15~git0.2d3044b/src/bin/ctest.rs --- old/cargo-c-0.9.11~git0.41f5562/src/bin/ctest.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/bin/ctest.rs 2022-12-20 15:41:48.000000000 +0100 @@ -13,7 +13,6 @@ let subcommand = subcommand_test("ctest"); let mut app = clap::command!() - .setting(AppSettings::DeriveDisplayOrder) .dont_collapse_args_in_usage(true) .allow_external_subcommands(true) .subcommand(subcommand); @@ -32,7 +31,7 @@ } }; - if subcommand_args.is_present("version") { + if subcommand_args.flag("version") { println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); return Ok(()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/build.rs new/cargo-c-0.9.15~git0.2d3044b/src/build.rs --- old/cargo-c-0.9.11~git0.41f5562/src/build.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/build.rs 2022-12-20 15:41:48.000000000 +0100 @@ -12,9 +12,8 @@ use cargo::ops::{self, CompileFilter, CompileOptions, FilterRule, LibRule}; use cargo::util::command_prelude::{ArgMatches, ArgMatchesExt, CompileMode, ProfileChecking}; use cargo::util::interning::InternedString; -use cargo::{CliError, CliResult, Config}; +use cargo::{CliResult, Config}; -use anyhow::Error; use cargo_util::paths::{copy, create, create_dir_all, open, read, read_bytes, write}; use semver::Version; @@ -80,7 +79,7 @@ } fn build_pc_file(name: &str, root_output: &Path, pc: &PkgConfig) -> anyhow::Result<()> { - let pc_path = root_output.join(&format!("{}.pc", name)); + let pc_path = root_output.join(format!("{}.pc", name)); let buf = pc.render(); write(pc_path, buf) @@ -346,7 +345,7 @@ } fn load_previous(&self) -> anyhow::Result<Cache> { - let mut f = open(&self.path())?; + let mut f = open(self.path())?; let mut cache_str = String::new(); f.read_to_string(&mut cache_str)?; let cache = toml::de::from_str(&cache_str)?; @@ -368,7 +367,7 @@ static_libs: self.static_libs.to_owned(), }; let buf = toml::ser::to_vec(&cache)?; - write(&self.path(), buf)?; + write(self.path(), buf)?; } Ok(()) @@ -793,7 +792,7 @@ use cargo::core::*; use cargo::CargoResult; -use cargo_util::{is_simple_exit_code, ProcessBuilder}; +use cargo_util::ProcessBuilder; impl Executor for Exec { fn exec( @@ -894,7 +893,7 @@ leaf_args.push("--print".into()); leaf_args.push("native-static-libs".into()); - if args.is_present("crt-static") { + if args.flag("crt-static") { leaf_args.push("-C".into()); leaf_args.push("target-feature=+crt-static".into()); } @@ -1008,12 +1007,9 @@ _ => vec!["staticlib", "cdylib"], }; - let libkinds = if args._is_valid_arg("library-type") { - args.values_of("library-type") - .map_or_else(default_kind, |v| v.collect::<Vec<_>>()) - } else { - default_kind() - }; + let libkinds = args + .get_many::<String>("library-type") + .map_or_else(default_kind, |v| v.map(String::as_str).collect::<Vec<_>>()); let only_staticlib = !libkinds.contains(&"cdylib"); let only_cdylib = !libkinds.contains(&"staticlib"); @@ -1029,7 +1025,7 @@ .as_path_unlocked() .to_path_buf() .join(PathBuf::from(target)) - .join(&profiles.get_dir_name()); + .join(profiles.get_dir_name()); let capi_feature = InternedString::new("capi"); @@ -1130,8 +1126,11 @@ .unwrap_or_else(|| PathBuf::from("dlltool")); // dlltool argument overwrites environment var - if args.value_of_os("dlltool").is_some() { - dlltool = args.value_of_os("dlltool").map(PathBuf::from).unwrap(); + if args.contains_id("dlltool") { + dlltool = args + .get_one::<String>("dlltool") + .map(PathBuf::from) + .unwrap(); } build_implib_file(ws, lib_name, &rustc_target, &root_output, &dlltool)?; @@ -1208,14 +1207,14 @@ compile_opts.target_rustc_args = None; let ops = ops::TestOptions { - no_run: args.is_present("no-run"), - no_fail_fast: args.is_present("no-fail-fast"), + no_run: args.flag("no-run"), + no_fail_fast: args.flag("no-fail-fast"), compile_opts, }; - let test_args = args.value_of("TESTNAME").into_iter(); - let test_args = test_args.chain(args.values_of("args").unwrap_or_default()); - let test_args = test_args.collect::<Vec<_>>(); + let test_args = args.get_one::<String>("TESTNAME").into_iter(); + let test_args = test_args.chain(args.get_many::<String>("args").unwrap_or_default()); + let test_args = test_args.map(String::as_str).collect::<Vec<_>>(); use std::ffi::OsString; @@ -1226,7 +1225,7 @@ let builddir = static_lib_path.parent().unwrap(); cflags.push("-I"); - cflags.push(&builddir); + cflags.push(builddir); cflags.push(" "); // We push the full path here to work around macos ld not supporting the -l:{filename} syntax @@ -1239,18 +1238,5 @@ std::env::set_var("INLINE_C_RS_CFLAGS", cflags); - let err = ops::run_tests(ws, &ops, &test_args)?; - match err { - None => Ok(()), - Some(err) => { - let context = anyhow::format_err!("{}", err.hint(ws, &ops.compile_opts)); - let e = match err.code { - // Don't show "process didn't exit successfully" for simple errors. - Some(i) if is_simple_exit_code(i) => CliError::new(context, i), - Some(i) => CliError::new(Error::from(err).context(context), i), - None => CliError::new(Error::from(err).context(context), 101), - }; - Err(e) - } - } + ops::run_tests(ws, &ops, &test_args) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/build_targets.rs new/cargo-c-0.9.15~git0.2d3044b/src/build_targets.rs --- old/cargo-c-0.9.11~git0.41f5562/src/build_targets.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/build_targets.rs 2022-12-20 15:41:48.000000000 +0100 @@ -61,7 +61,7 @@ libkinds: &[&str], capi_config: &CApiConfig, ) -> anyhow::Result<BuildTargets> { - let pc = targetdir.join(&format!("{}.pc", &capi_config.pkg_config.filename)); + let pc = targetdir.join(format!("{}.pc", &capi_config.pkg_config.filename)); let include = if capi_config.header.enabled { let mut header_name = PathBuf::from(&capi_config.header.name); header_name.set_extension("h"); @@ -82,29 +82,30 @@ | ("dragonfly", _) | ("netbsd", _) | ("android", _) - | ("haiku", _) => { - let static_lib = targetdir.join(&format!("lib{}.a", lib_name)); - let shared_lib = targetdir.join(&format!("lib{}.so", lib_name)); + | ("haiku", _) + | ("illumos", _) => { + let static_lib = targetdir.join(format!("lib{}.a", lib_name)); + let shared_lib = targetdir.join(format!("lib{}.so", lib_name)); (shared_lib, static_lib, None, None) } ("macos", _) | ("ios", _) => { - let static_lib = targetdir.join(&format!("lib{}.a", lib_name)); - let shared_lib = targetdir.join(&format!("lib{}.dylib", lib_name)); + let static_lib = targetdir.join(format!("lib{}.a", lib_name)); + let shared_lib = targetdir.join(format!("lib{}.dylib", lib_name)); (shared_lib, static_lib, None, None) } ("windows", env) => { let static_lib = if env == "msvc" { - targetdir.join(&format!("{}.lib", lib_name)) + targetdir.join(format!("{}.lib", lib_name)) } else { - targetdir.join(&format!("lib{}.a", lib_name)) + targetdir.join(format!("lib{}.a", lib_name)) }; - let shared_lib = targetdir.join(&format!("{}.dll", lib_name)); + let shared_lib = targetdir.join(format!("{}.dll", lib_name)); let impl_lib = if env == "msvc" { - targetdir.join(&format!("{}.dll.lib", lib_name)) + targetdir.join(format!("{}.dll.lib", lib_name)) } else { - targetdir.join(&format!("{}.dll.a", lib_name)) + targetdir.join(format!("{}.dll.a", lib_name)) }; - let def = targetdir.join(&format!("{}.def", lib_name)); + let def = targetdir.join(format!("{}.def", lib_name)); (shared_lib, static_lib, Some(impl_lib), Some(def)) } _ => unimplemented!("The target {}-{} is not supported yet", os, env), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/cli.rs new/cargo-c-0.9.15~git0.2d3044b/src/cli.rs --- old/cargo-c-0.9.11~git0.41f5562/src/cli.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/cli.rs 2022-12-20 15:41:48.000000000 +0100 @@ -1,44 +1,45 @@ +use std::ffi::{OsStr, OsString}; use std::path::PathBuf; -use cargo::util::command_prelude::AppExt; -use cargo::util::command_prelude::{multi_opt, opt}; +use cargo::util::command_prelude::CommandExt; +use cargo::util::command_prelude::{flag, multi_opt, opt}; use cargo::util::{CliError, CliResult}; use cargo_util::{ProcessBuilder, ProcessError}; -use clap::{Arg, ArgMatches, Command, CommandFactory, Parser}; +use clap::{Arg, ArgAction, ArgMatches, Command, CommandFactory, Parser}; // TODO: convert to a function using cargo opt() #[allow(dead_code)] #[derive(Clone, Debug, Parser)] struct Common { /// Path to directory where target should be copied to - #[clap(long = "destdir", parse(from_os_str))] + #[clap(long = "destdir")] destdir: Option<PathBuf>, /// Directory path used to construct default values of /// includedir, libdir, bindir, pkgconfigdir - #[clap(long = "prefix", parse(from_os_str))] + #[clap(long = "prefix")] prefix: Option<PathBuf>, /// Path to directory for installing generated library files - #[clap(long = "libdir", parse(from_os_str))] + #[clap(long = "libdir")] libdir: Option<PathBuf>, /// Path to directory for installing generated headers files - #[clap(long = "includedir", parse(from_os_str))] + #[clap(long = "includedir")] includedir: Option<PathBuf>, /// Path to directory for installing generated executable files - #[clap(long = "bindir", parse(from_os_str))] + #[clap(long = "bindir")] bindir: Option<PathBuf>, /// Path to directory for installing generated pkg-config .pc files - #[clap(long = "pkgconfigdir", parse(from_os_str))] + #[clap(long = "pkgconfigdir")] pkgconfigdir: Option<PathBuf>, /// Path to directory for installing read-only data (defaults to {prefix}/share) - #[clap(long = "datarootdir", parse(from_os_str))] + #[clap(long = "datarootdir")] datarootdir: Option<PathBuf>, /// Path to directory for installing read-only application-specific data /// (defaults to {datarootdir}) - #[clap(long = "datadir", parse(from_os_str))] + #[clap(long = "datadir")] datadir: Option<PathBuf>, - #[clap(long = "dlltool", parse(from_os_str))] + #[clap(long = "dlltool")] /// Use the provided dlltool when building for the windows-gnu targets. dlltool: Option<PathBuf>, #[clap(long = "crt-static")] @@ -46,39 +47,37 @@ crt_static: bool, } -fn base_cli() -> Command<'static> { +fn base_cli() -> Command { Common::command() .allow_external_subcommands(true) - .arg(opt("version", "Print version info and exit").short('V')) + .arg(flag("version", "Print version info and exit").short('V')) + .arg(flag("list", "List installed commands")) + .arg(opt("explain", "Run `rustc --explain CODE`").value_name("CODE")) .arg( opt( "verbose", "Use verbose output (-vv very verbose/build.rs output)", ) .short('v') - .multiple_occurrences(true) + .action(ArgAction::Count) .global(true), ) - .arg(opt("quiet", "No output printed to stdout").short('q')) + .arg_quiet() .arg( opt("color", "Coloring: auto, always, never") .value_name("WHEN") .global(true), ) - .arg(opt("frozen", "Require Cargo.lock and cache are up to date").global(true)) - .arg(opt("locked", "Require Cargo.lock is up to date").global(true)) - .arg(opt("offline", "Run without accessing the network").global(true)) - .arg( - multi_opt("config", "KEY=VALUE", "Override a configuration value") - .global(true) - .hide(true), - ) + .arg(flag("frozen", "Require Cargo.lock and cache are up to date").global(true)) + .arg(flag("locked", "Require Cargo.lock is up to date").global(true)) + .arg(flag("offline", "Run without accessing the network").global(true)) + .arg(multi_opt("config", "KEY=VALUE", "Override a configuration value").global(true)) .arg( Arg::new("unstable-features") .help("Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details") .short('Z') .value_name("FLAG") - .multiple_occurrences(true) + .action(ArgAction::Append) .global(true), ) .arg_jobs() @@ -103,7 +102,7 @@ .arg_build_plan() } -pub fn subcommand_build(name: &str, about: &'static str) -> Command<'static> { +pub fn subcommand_build(name: &'static str, about: &'static str) -> Command { base_cli() .name(name) .about(about) @@ -115,7 +114,7 @@ ) .global(true) .ignore_case(true) - .possible_values(&["cdylib", "staticlib"]), + .value_parser(["cdylib", "staticlib"]), ) .arg_release("Build artifacts in release mode, with optimizations") .arg_package_spec_no_all( @@ -132,7 +131,7 @@ ) } -pub fn subcommand_install(name: &str, about: &'static str) -> Command<'static> { +pub fn subcommand_install(name: &'static str, about: &'static str) -> Command { base_cli() .name(name) .about(about) @@ -144,7 +143,7 @@ ) .global(true) .ignore_case(true) - .possible_values(&["cdylib", "staticlib"]), + .value_parser(["cdylib", "staticlib"]), ) .arg(opt("debug", "Build in debug mode instead of release mode")) .arg_release( @@ -164,7 +163,7 @@ ) } -pub fn subcommand_test(name: &str) -> Command<'static> { +pub fn subcommand_test(name: &'static str) -> Command { base_cli() .trailing_var_arg(true) .name(name) @@ -172,7 +171,7 @@ .arg( Arg::new("args") .help("Arguments for the test binary") - .multiple_values(true) + .num_args(0..) .last(true), ) .arg_release("Build artifacts in release mode, with optimizations") @@ -187,10 +186,15 @@ pub fn run_cargo_fallback(subcommand: &str, subcommand_args: &ArgMatches) -> CliResult { let cargo = std::env::var("CARGO_C_CARGO").unwrap_or_else(|_| "cargo".to_owned()); - let mut args = vec![subcommand]; + let mut args = vec![OsStr::new(subcommand)]; - args.extend(subcommand_args.values_of("").unwrap_or_default()); - let err = match ProcessBuilder::new(&cargo).args(&args).exec_replace() { + args.extend( + subcommand_args + .get_many::<OsString>("") + .unwrap_or_default() + .map(OsStr::new), + ); + let err = match ProcessBuilder::new(cargo).args(&args).exec_replace() { Ok(()) => return Ok(()), Err(e) => e, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/config.rs new/cargo-c-0.9.15~git0.2d3044b/src/config.rs --- old/cargo-c-0.9.11~git0.41f5562/src/config.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/config.rs 2022-12-20 15:41:48.000000000 +0100 @@ -15,21 +15,23 @@ pub fn config_configure(config: &mut Config, args: &ArgMatches) -> CliResult { let arg_target_dir = &args.value_of_path("target-dir", config); let config_args: Vec<_> = args - .values_of("config") + .get_many::<String>("config") .unwrap_or_default() - .map(String::from) + .map(|s| s.to_owned()) .collect(); config.configure( - args.occurrences_of("verbose") as u32, - args.is_present("quiet"), - args.value_of("color"), - args.is_present("frozen"), - args.is_present("locked"), - args.is_present("offline"), + args.verbose(), + args.flag("quiet"), + args.get_one::<String>("color").map(String::as_str), + args.flag("frozen"), + args.flag("locked"), + args.flag("offline"), arg_target_dir, &args - .values_of_lossy("unstable-features") - .unwrap_or_default(), + .get_many::<String>("unstable-features") + .unwrap_or_default() + .map(|s| s.to_owned()) + .collect::<Vec<String>>(), &config_args, )?; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/install.rs new/cargo-c-0.9.15~git0.2d3044b/src/install.rs --- old/cargo-c-0.9.11~git0.41f5562/src/install.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/install.rs 2022-12-20 15:41:48.000000000 +0100 @@ -89,7 +89,8 @@ | ("dragonfly", _) | ("netbsd", _) | ("android", _) - | ("haiku", _) => LibType::So, + | ("haiku", _) + | ("illumos", _) => LibType::So, ("macos", _) | ("ios", _) => LibType::Dylib, ("windows", _) => LibType::Windows, _ => unimplemented!("The target {}-{} is not supported yet", os, env), @@ -243,11 +244,18 @@ lib.install(capi_config, shared_lib, &install_path_lib)?; } LibType::Windows => { - let install_path_bin = append_to_destdir(destdir.as_deref(), &paths.bindir); - create_dir_all(&install_path_bin)?; - let lib_name = shared_lib.file_name().unwrap(); - copy(shared_lib, install_path_bin.join(lib_name))?; + + if capi_config.library.install_subdir.is_none() { + let install_path_bin = append_to_destdir(destdir.as_deref(), &paths.bindir); + create_dir_all(&install_path_bin)?; + + copy(shared_lib, install_path_bin.join(lib_name))?; + } else { + // We assume they are plugins, install them in the custom libdir path + copy(shared_lib, install_path_lib.join(lib_name))?; + } + let impl_lib = build_targets.impl_lib.as_ref().unwrap(); let impl_lib_name = impl_lib.file_name().unwrap(); copy(impl_lib, install_path_lib.join(impl_lib_name))?; @@ -276,36 +284,36 @@ impl InstallPaths { pub fn new(_name: &str, args: &ArgMatches, capi_config: &CApiConfig) -> Self { - let destdir = args.value_of_os("destdir").map(PathBuf::from); + let destdir = args.get_one::<PathBuf>("destdir").map(PathBuf::from); let prefix = args - .value_of_os("prefix") + .get_one::<PathBuf>("prefix") .map(PathBuf::from) .unwrap_or_else(|| "/usr/local".into()); let libdir = args - .value_of_os("libdir") + .get_one::<PathBuf>("libdir") .map(PathBuf::from) .unwrap_or_else(|| prefix.join("lib")); let includedir = args - .value_of_os("includedir") + .get_one::<PathBuf>("includedir") .map(PathBuf::from) .unwrap_or_else(|| prefix.join("include")); let datarootdir = args - .value_of_os("datarootdir") + .get_one::<PathBuf>("datarootdir") .map(PathBuf::from) .unwrap_or_else(|| prefix.join("share")); let datadir = args - .value_of_os("datadir") + .get_one::<PathBuf>("datadir") .map(PathBuf::from) .unwrap_or_else(|| datarootdir.clone()); let subdir_name = PathBuf::from(&capi_config.header.subdirectory); let bindir = args - .value_of_os("bindir") + .get_one::<PathBuf>("bindir") .map(PathBuf::from) .unwrap_or_else(|| prefix.join("bin")); let pkgconfigdir = args - .value_of_os("pkgconfigdir") + .get_one::<PathBuf>("pkgconfigdir") .map(PathBuf::from) .unwrap_or_else(|| libdir.join("pkgconfig")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/pkg_config_gen.rs new/cargo-c-0.9.15~git0.2d3044b/src/pkg_config_gen.rs --- old/cargo-c-0.9.11~git0.41f5562/src/pkg_config_gen.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/pkg_config_gen.rs 2022-12-20 15:41:48.000000000 +0100 @@ -131,11 +131,23 @@ pc.prefix = install_paths.prefix.clone(); // TODO: support exec_prefix - if args.is_present("includedir") { - pc.includedir = install_paths.includedir.clone(); + if args.contains_id("includedir") { + if let Ok(suffix) = install_paths.includedir.strip_prefix(&pc.prefix) { + let mut includedir = PathBuf::from("${prefix}"); + includedir.push(suffix); + pc.includedir = includedir; + } else { + pc.includedir = install_paths.includedir.clone(); + } } - if args.is_present("libdir") { - pc.libdir = install_paths.libdir.clone(); + if args.contains_id("libdir") { + if let Ok(suffix) = install_paths.libdir.strip_prefix(&pc.prefix) { + let mut libdir = PathBuf::from("${prefix}"); + libdir.push(suffix); + pc.libdir = libdir; + } else { + pc.libdir = install_paths.libdir.clone(); + } } pc } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cargo-c-0.9.11~git0.41f5562/src/target.rs new/cargo-c-0.9.15~git0.2d3044b/src/target.rs --- old/cargo-c-0.9.11~git0.41f5562/src/target.rs 2022-07-04 09:24:35.000000000 +0200 +++ new/cargo-c-0.9.15~git0.2d3044b/src/target.rs 2022-12-20 15:41:48.000000000 +0100 @@ -71,23 +71,37 @@ if os == "android" { lines.push(format!("-Wl,-soname,lib{}.so", lib_name)); - } else if env != "musl" - && (os == "linux" - || os == "freebsd" - || os == "dragonfly" - || os == "netbsd" - || os == "haiku") + } else if os == "linux" + || os == "freebsd" + || os == "dragonfly" + || os == "netbsd" + || os == "haiku" + || os == "illumos" { - lines.push(format!("-Wl,-soname,lib{}.so.{}", lib_name, major)); + if capi_config.library.versioning { + lines.push(format!("-Wl,-soname,lib{}.so.{}", lib_name, major)); + } else { + lines.push(format!("-Wl,-soname,lib{}.so", lib_name)); + } } else if os == "macos" || os == "ios" { - let install_ver = if major == 0 { - format!("{}.{}", major, minor) + let line = if capi_config.library.versioning { + let install_ver = if major == 0 { + format!("{}.{}", major, minor) + } else { + format!("{}", major) + }; + format!("-Wl,-install_name,{1}/lib{0}.{5}.dylib,-current_version,{2}.{3}.{4},-compatibility_version,{5}", + lib_name, libdir.display(), major, minor, patch, install_ver) } else { - format!("{}", major) + format!( + "-Wl,-install_name,{1}/lib{0}.dylib", + lib_name, + libdir.display() + ) }; - let line = format!("-Wl,-install_name,{1}/lib{0}.{5}.dylib,-current_version,{2}.{3}.{4},-compatibility_version,{5}", - lib_name, libdir.display(), major, minor, patch, install_ver); - lines.push(line) + lines.push(line); + // Enable larger LC_RPATH and install_name entries + lines.push("-Wl,-headerpad_max_install_names".to_string()); } else if os == "windows" && env == "gnu" { // This is only set up to work on GNU toolchain versions of Rust lines.push(format!( ++++++ vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/cargo-c/vendor.tar.xz /work/SRC/openSUSE:Factory/.cargo-c.new.1563/vendor.tar.xz differ: char 26, line 1