Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Nov 2019 21:08:11 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r517982 - head/Mk/Uses
Message-ID:  <201911192108.xAJL8B1d090730@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik
Date: Tue Nov 19 21:08:10 2019
New Revision: 517982
URL: https://svnweb.freebsd.org/changeset/ports/517982

Log:
  Mk/Uses/cargo.mk: Add CARGO_GIT_SUBDIR hook to provide hints for CARGO_USE_GIT*
  
  This is a workaround to add some manual "support" for Cargo projects
  that use workspaces where the current method of patching is not
  good enough as it causes the various Cargo.toml to point to the
  wrong directory.  With CARGO_GIT_SUBDIR maintainers can control the
  patching process a little and point things to the correct subdirectories.
  
  CARGO_GIT_SUBDIR=	<group>:<crate name>:<subdir under ${WRKSRC_group}>
  
  This is needed for alacritty 0.4.0-rc2 where the glutin sources are
  under ${WRKSRC_glutin}/glutin and not just ${WRKSRC_glutin}.  This
  causes the following issue:
  
  error: failed to load source for a dependency on `glutin`
  
  Caused by:
    Unable to update .../x11/alacritty/work/glutin-7e479d
  
  Caused by:
    found a virtual manifest at `.../x11/alacritty/work/glutin-7e479d/Cargo.toml` instead of a package manifest
  
  For glutin we would set CARGO_GIT_SUBDIR=glutin:glutin:glutin to
  work around this problem and point the build to
  .../x11/alacritty/work/glutin-7e479d/glutin instead.

Modified:
  head/Mk/Uses/cargo.mk

Modified: head/Mk/Uses/cargo.mk
==============================================================================
--- head/Mk/Uses/cargo.mk	Tue Nov 19 20:58:02 2019	(r517981)
+++ head/Mk/Uses/cargo.mk	Tue Nov 19 21:08:10 2019	(r517982)
@@ -212,14 +212,28 @@ cargo-extract:
 _CARGO_GIT_PATCH_CARGOTOML=
 .if ${CARGO_USE_GITHUB:tl} == "yes"
 .  for _group in ${GH_TUPLE:C@^[^:]*:[^:]*:[^:]*:(([^:/]*)?)((/.*)?)@\2@}
+.    if empty(CARGO_GIT_SUBDIR:M${_group}\:*)
 _CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
-	-e 's@git = "(https|http|git)://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}(\.git)?/?"@path = "${WRKSRC_${_group}}"@'
+	-e "s@git = ['\"](https|http|git)://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}(\.git)?/?[\"']@path = \"${WRKSRC_${_group}}\"@"
+.    else
+.      for _group2 _crate _subdir in ${CARGO_GIT_SUBDIR:M${_group}\:*:S,:, ,g}
+_CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
+	-e "/^${_crate} =/ s@git = ['\"](https|http|git)://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}(\.git)?/?[\"']@path = \"${WRKSRC_${_group}}/${_subdir}\"@"
+.	endfor
+.    endif
 .  endfor
 .endif
 .if ${CARGO_USE_GITLAB:tl} == "yes"
 .  for _group in ${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\8@:S/^://}
+.    if empty(CARGO_GIT_SUBDIR:M${_group}\:*)
 _CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
-	-e 's@git = "${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}(\.git)?/?"@path = "${WRKSRC_${_group}}"@'
+	-e "s@git = ['\"]${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}(\.git)?/?['\"]@path = \"${WRKSRC_${_group}}\"@"
+.    else
+.      for _group2 _crate _subdir in ${CARGO_GIT_SUBDIR:M${_group}\:*:S,:, ,g}
+_CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
+	-e "/^${_crate} = / s@git = ['\"]${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}(\.git)?/?['\"]@path = \"${WRKSRC_${_group}}/${_subdir}\"@"
+.      endfor
+.    endif
 .  endfor
 .endif
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911192108.xAJL8B1d090730>