Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Oct 2019 15:09:11 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports@FreeBSD.org
Subject:   USES=cargo vs. workspaces
Message-ID:  <zhie-58co-wny@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Some projects (e.g., Servo, Veloren) bundle several packages together.
When dependencies also bundle packages it confuses "git" override.
Any tips/workarounds that scale beyond 1 port?

For example,

  $ cat Makefile
  PORTNAME=	veloren
  DISTVERSIONSUFFIX=	v
  DISTVERSION=	0.3.0
  CATEGORIES=	games

  USES=		cargo
  USE_GITLAB=	yes
  GL_COMMIT=	ef049607e008223d6f9d8a021dd00e1eeef44b5e

  .sinclude "${.CURDIR}/Makefile.crates"
  .include <bsd.port.mk>

  $ make clean patch NO_CHECKSUM=
  $ make cargo-crates >Makefile.crates
  $ make makesum

  $ make clean all
  [...]
  ===>  Configuring for veloren-0.3.0
  error: failed to load source for a dependency on `conrod_core`

  Caused by:
    Unable to update WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4

  Caused by:
    found a virtual manifest at `WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4/Cargo.toml` instead of a package manifest
  *** Error code 101

  Stop.

After the override `conrod_core` package path points to a directory with
multiple packages defined via workspaces. If the path is refined to
point to a subdirectory (where [package] is defined) then build moves on
to the next error.

  $ rg -t toml conrod_core $(make -V WRKSRC)
  WRKSRC/Cargo.lock
  421:name = "conrod_core"
  2962: "conrod_core 0.63.0 (git+https://gitlab.com/veloren/conrod.git)",
  3245:"checksum conrod_core 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "<none>"

  WRKSRC/voxygen/Cargo.toml
  25:conrod_core = { path = "WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4/conrod_core" }

  $ cat $(make -V WRKDIR)/conrod-*/Cargo.toml
  [workspace]
  members = [
      "conrod_core",
      "conrod_derive",
      "backends/conrod_example_shared",
      "backends/conrod_winit",
      "backends/conrod_gfx",
      "backends/conrod_glium",
      "backends/conrod_piston",
      "backends/conrod_vulkano",
  ]

  $ sed -i.bak '/conrod_core/s,"\(.*\)","\1/conrod_core",' $(make -V WRKSRC)/voxygen/Cargo.toml
  $ diff $(make -V WRKSRC)/voxygen/Cargo.toml.bak $(make -V WRKSRC)/voxygen/Cargo.toml
  --- WRKSRC/voxygen/Cargo.toml.bak
  +++ WRKSRC/voxygen/Cargo.toml
  @@ -22,7 +22,7 @@ gfx_device_gl = { version = "0.16.1", optional = true
   gfx_window_glutin = "0.31.0"
   glutin = "0.21.0"
   winit = { version = "0.19.1", features = ["serde"] }
  -conrod_core = { path = "WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4" }
  +conrod_core = { path = "WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4/conrod_core" }
   conrod_winit = { path = "WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4" }
   euc = "0.3.0"

  $ make
  ===>  Configuring for veloren-0.3.0
  error: failed to load source for a dependency on `conrod_winit`

  Caused by:
    Unable to update WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4

  Caused by:
    found a virtual manifest at `WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4/Cargo.toml` instead of a package manifest
  *** Error code 101

  Stop.

Note, before and after the override the location of `conrod_core` was
ambiguous i.e., neither "package" nor subdirectory was specified.

  $ diff $(make -V WRKSRC)/voxygen/Cargo.toml{.dist,}
  [...]
  @@ -22,8 +22,8 @@ gfx_device_gl = { version = "0.16.1", optional = true 
   gfx_window_glutin = "0.31.0"
   glutin = "0.21.0"
   winit = { version = "0.19.1", features = ["serde"] }
  -conrod_core = { git = "https://gitlab.com/veloren/conrod.git" }
  -conrod_winit = { git = "https://gitlab.com/veloren/conrod.git" }
  +conrod_core = { path = "WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4" }
  +conrod_winit = { path = "WRKDIR/conrod-d603363488870eae9df91ba45ba795509c8a6ab4-d603363488870eae9df91ba45ba795509c8a6ab4" }
   euc = "0.3.0"

   # ECS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?zhie-58co-wny>