Uploaded image for project: 'Red Hat Enterprise Linux AI'
  1. Red Hat Enterprise Linux AI
  2. RHELAI-3295

[python-wheel-build/fromager] fromager: vendor_rust behavior broken in workspaces with example code (eg cryptography)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • Fromager
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      [2778027179] Upstream Reporter: Pris Nasrat
      Upstream description:

        1. Summary

      vendoring breaks with error for docs file `cryptography-44.0.0/cryptography-44.0.0/docs/development/custom-vectors/aes-192-gcm-siv/verify-aes192gcmsiv/Cargo.toml`

      ```
      failed with error: current package believes it's in a workspace when it's not:
      ```

      I tried to add a patch that adds exclude to the workspace members but it looks as if the vendor rust behavior of fromager is not aware of workspaces

      ```
      excludes = [
      "docs/development/",
      ]
      ```

        1. Analysis

      Looking at the source fromager assumes any `Cargo.toml` in the source tree is included and does not honor workspace configuration as it just uses a glob. This seems brittle to projects using workspaces with example code in docs as cryptography have

      https://github.com/python-wheel-build/fromager/blob/acc45d3d17d77faa82a19ab6ced5aee068986c23/src/fromager/vendor_rust.py#L126

        1. Steps to reproduce

      Added a branch with the patch and an e2e test demonstrating here

      https://github.com/pnasrat/fromager/tree/vendor-cryptography-fails

      @dhellmann wondering what the right behavior to do here, I wonder if rust vendoring should be configurable at the top level of fromager maybe via an env variable as different rebuilders may want different behavior from fromager here.

        1. Logs

      <details>
      <summary>fromager log</summary>
      <br/>

      ```console
      cryptography: preparing source for cryptography==44.0.0 from /home/pnasrat/src/fromager/e2e-output/sdists-repo/downloads/cryptography-44.0.0.tar.gz
      cryptography: updating vendored rust dependencies in /home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0
      ['cargo', 'vendor', '--manifest-path=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/docs/development/custom-vectors/aes-192-gcm-siv/verify-aes192gcmsiv/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-cffi/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-keepalive/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-key-parsing/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-openssl/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-x509-verification/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-x509/Cargo.toml', '/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/vendor'] failed with error: current package believes it's in a workspace when it's not:
      current: /home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/docs/development/custom-vectors/aes-192-gcm-siv/verify-aes192gcmsiv/Cargo.toml
      workspace: /home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/Cargo.toml

      this may be fixable by adding `docs/development/custom-vectors/aes-192-gcm-siv/verify-aes192gcmsiv` to the `workspace.members` array of the manifest located at: /home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/Cargo.toml
      Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.

      0%| | 0/1 [00:00<?, ?pkg/s]
      ERROR: Command '['cargo', 'vendor', '--manifest-path=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/docs/development/custom-vectors/aes-192-gcm-siv/verify-aes192gcmsiv/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-cffi/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-keepalive/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-key-parsing/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-openssl/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-x509-verification/Cargo.toml', '--sync=/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/src/rust/cryptography-x509/Cargo.toml', '/home/pnasrat/src/fromager/e2e-output/work-dir/cryptography-44.0.0/cryptography-44.0.0/vendor']' returned non-zero exit status 101.
      + on_exit
      ```
      </details>

              cheimes@redhat.com Christian Heimes
              upstream-sync Upstream Sync
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: