On Wed, Jul 28, 2021 at 06:39:32PM +0000, Klemens Nanni wrote: > No idea why, but cargo's API from which cargo-module(5) fetches crates > ships tarballs which seem to always have both Cargo.toml *and* > Cargo.toml.orig. > > This blows up `make update-patches' by adding as many new patches as > there are crates. > > This is because PATCHORIG defaults to ".orig"; defaulint it to e.g. > ".modcrate.orig" in cargo.port.mk feels wrong, so let's remove the > shipped original files. > > By using `${PATCHORIG}' instead of hard-coding ".orig" I leave the files > should porters user other PATCHORIG values and therefore avoid the > conflict in the first place. > > I know this is raceu since `make PATCHORIG=.foo.orig extract && > make patch && make update-patches' will still trip over that, but our > framework can't cope with everything and I simply find using > `${PATCHORIG}' in cargo.port.mk both cleaner and more obvious. > > > Feedback? Objections? OK?
The current pratice for patched ports using lang/rust is to set PATCHORIG in the Makefile. For quoting bsd.port.mk(5): PATCHORIG Suffix used by patch to rename original files, and update-patches to re-generate ${PATCHDIR}/${PATCH_LIST} by looking for files using this suffix. Defaults to .orig. For a port that already contains .orig files in the ${DISTFILES}, set this to something else, such as .pat.orig. See also distpatch, DISTORIG. About removing upstream files because there are conflicting with your tool, I am unsure. But I am not strongly opposed. But please note that it might not remove all conflicting files, and setting PATCHORIG might be still need. About your patch, it should be done differently: - don't use PATCHORIG in a module. it could be something else than .orig - respect MODCARGO_VENDOR_DIR variable: the Cargo.toml files could be somewhere else than ${WRKDIR}/* - append `rm -f' to existing MODCARGO_post-extract definition (the line before) instead of using += (your diff doesn't remove Cargo.toml.orig files from crates using MODCARGO_CRATES) The rm line should be something like (untested): rm -f -- ${MODCARGO_CARGOTOML}.orig ${MODCARGO_VENDOR_DIR}/*/Cargo.toml.orig ; > Index: cargo.port.mk > =================================================================== > RCS file: /cvs/ports/devel/cargo/cargo.port.mk,v > retrieving revision 1.22 > diff -u -p -r1.22 cargo.port.mk > --- cargo.port.mk 27 Apr 2021 06:51:10 -0000 1.22 > +++ cargo.port.mk 28 Jul 2021 18:29:55 -0000 > @@ -59,6 +59,8 @@ DISTFILES += ${_MODCARGO_DIST_SUBDIR}${_ > MODCARGO_post-extract = \ > ${ECHO_MSG} "[modcargo] moving crates to ${MODCARGO_VENDOR_DIR}" ; \ > mkdir ${MODCARGO_VENDOR_DIR} ; > +MODCARGO_post-extract += \ > + rm -f -- ${WRKDIR}/*/Cargo.toml${PATCHORIG} ; > .for _cratename _cratever in ${MODCARGO_CRATES} > MODCARGO_post-extract += \ > mv ${WRKDIR}/${_cratename}-${_cratever} > ${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever} ; -- Sebastien Marie