EXTRACT_ONLY breaks cargo crates?

I'm in the process of updating a port I submitted a while ago (www/iocaine; see PR 287944).
In the new version (3.1.0) there are 2 files fetched during build - which of course isn't possible with poudriere as build jails have no network access during build. So I'm trying to pre-fetch those files to then move them into the location where the iocaine build process expects them.

The obvious solution for me would be this:
Code:
PORTNAME=   iocaine
DISTVERSION=    3.1.0
ROBOTS_VERSION= v1.43
FENNEL_VERSION= 1.6.0
CATEGORIES= www
MASTER_SITES=   https://git.madhouse-project.org/iocaine/iocaine/archive/ \
    https://fennel-lang.org/downloads/:fennel \
    https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/refs/tags/${ROBOTS_VERSION}/:robots
DISTFILES+= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} \
    fennel-${FENNEL_VERSION}.lua:fennel \
    robots.json:robots
EXTRACT_ONLY= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}
[....]
pre-build:
    @${MV} ${WRKSRC}/robots.json ${WRKDIR}/data/defaults/etc/
    @${MV} ${WRKSRC}/fennel-${FENNEL_VERSION}.lua ${WRKDIR}/data/defaults/etc/

'EXTRACT_ONLY' is necessary, because make will try to extract all DISTFILES, so this fixes that.
But since this is a rust program, it drags along *a lot* of cargo crates, and 'EXTRACT_ONLY' breaks moving those crates to the wrkdir:

Code:
[...]
=> SHA256 Checksum OK for rust/crates/windows_x86_64_gnullvm-0.52.6.crate.
=> SHA256 Checksum OK for rust/crates/windows_x86_64_gnullvm-0.53.1.crate.
=> SHA256 Checksum OK for rust/crates/windows_x86_64_msvc-0.52.6.crate.
=> SHA256 Checksum OK for rust/crates/windows_x86_64_msvc-0.53.1.crate.
=> SHA256 Checksum OK for rust/crates/winnow-0.6.24.crate.
=> SHA256 Checksum OK for rust/crates/winnow-0.7.14.crate.
=> SHA256 Checksum OK for rust/crates/winsafe-0.0.19.crate.
=> SHA256 Checksum OK for rust/crates/wit-bindgen-0.46.0.crate.
=> SHA256 Checksum OK for rust/crates/wyz-0.5.1.crate.
=> SHA256 Checksum OK for rust/crates/yansi-1.0.1.crate.
=> SHA256 Checksum OK for rust/crates/zerocopy-0.8.31.crate.
=> SHA256 Checksum OK for rust/crates/zerocopy-derive-0.8.31.crate.
=> SHA256 Checksum OK for rust/crates/zstd-0.13.3.crate.
=> SHA256 Checksum OK for rust/crates/zstd-safe-7.2.4.crate.
=> SHA256 Checksum OK for rust/crates/zstd-sys-2.0.16+zstd.1.5.7.crate.
===>  Moving crates to /wrkdirs/usr/ports/www/iocaine/work/iocaine-3.1.0//cargo-crates
mv: rename /wrkdirs/usr/ports/www/iocaine/work/adler2-2.0.1 to /wrkdirs/usr/ports/www/iocaine/work/iocaine-3.1.0//cargo-crates/adler2-2.0.1: No such file or directory
*** Error code 1

Stop.
[...]

So I thought, maybe I have to add ${CARGO_CRATES} to 'EXTRACT_ONLY':
Code:
=> SHA256 Checksum OK for rust/crates/zstd-0.13.3.crate.
=> SHA256 Checksum OK for rust/crates/zstd-safe-7.2.4.crate.
=> SHA256 Checksum OK for rust/crates/zstd-sys-2.0.16+zstd.1.5.7.crate.
tar: Error opening archive: Failed to open '/portdistfiles/adler2-2.0.1'
===>  Failed to extract "/portdistfiles/adler2-2.0.1".
*** Error code 1

Stop.
[...]

This makes sense, since those are not archives.

So it seems EXTRACT_ONLY completely breaks cargo crates?


Using PATCH_SITES/PATCHFILES is not an option, because make then tries to apply those files as patches (which they are not).
I'd also like to load those files from their original sources instead of shipping them with the port.

So basically my questions are:
- Is this behavior of 'EXTRACT_ONLY' really intended? (WHY?)
- Is there any other mechanism available to fetch files before build and maybe even get them into ${WRKDIR} without e.g. pre-build @${MV}...? Or maybe some kind of 'negated version' for EXTRACT_ONLY, e.g. 'DONT_EXTRACT=<file>' that doesn't break crates?
 
I think that way it could work.
Rich (BB code):
# grep -i extract_only -Hn /usr/ports/www/sqlpage/Makefile
/usr/ports/www/sqlpage/Makefile:7:EXTRACT_ONLY= ${_DISTFILES:M*${EXTRACT_SUFX}} ${_DISTFILES:M*crate}

robots.json and the fetched lua file is not in WRKDIR but in DISTDIR, so try copying them from there.
Code:
# ls `make -V DISTDIR`
fennel-1.6.0.lua        iocaine-3.1.0.tar.gz    robots.json             rust

Is there any other mechanism available to fetch files before build and maybe even get them into ${WRKDIR} without e.g. pre-build @${MV}...?
I don't know about this :/
 
  • Thanks
Reactions: sko
I think that way it could work.
Rich (BB code):
# grep -i extract_only -Hn /usr/ports/www/sqlpage/Makefile
/usr/ports/www/sqlpage/Makefile:7:EXTRACT_ONLY= ${_DISTFILES:M*${EXTRACT_SUFX}} ${_DISTFILES:M*crate}

Thanks, this works!

I already changed the makefile to just download the full tarball of both projects to extract that single file from each, but now that I can use EXTRACT_ONLY I don't have to make it that wasteful.
 
Back
Top