Configure phase fails because file with same name as WRKSRC cannot be created

I started porting iocaine, a garbage generator to "poison AI bots". I'm using poudriere.
I'm stuck in the configure phase with the error:
Code:
=======================<phase: configure      >============================          
===== env: NO_DEPENDS=yes USER=nobody UID=65534 GID=65534                            
===>  Configuring for iocaine-2.1.0                                                  
/bin/sh: cannot create /wrkdirs/usr/ports/www/iocaine/work/iocaine: Is a directory  
*** Error code 2

I followed the instructions in https://docs.freebsd.org/en/books/porters-handbook/makefiles/#makefile-wrksrc, because the tarball extracts to iocaine instead of iocaine-2.1.0:

Code:
PORTNAME=       iocaine
DISTVERSION=    2.1.0
CATEGORIES=     www

MAINTAINER=     [email protected]
COMMENT=        The deadliest poison known to AI.
WWW=            https://iocaine.madhouse-project.org/

LICENSE=        MIT

USES=           cargo
USE_RC_SUBR=    iocaine

MASTER_SITES=   https://git.madhouse-project.org/${PORTNAME}/${PORTNAME}/archive/

WRKSRC=         ${WRKDIR}/${PORTNAME}

USERS=          www
GROUPS=         www

.include <bsd.port.mk>

I'm assuming the error means it's trying to create the dir, so I looked into bsd.ports.mk, and the only relevant mkdir I see is in https://github.com/freebsd/freebsd-...21289041488bae032c3ccbf6/Mk/bsd.port.mk#L3306, but it should be triggered if HAS_CONFIGURATION is set, which is not the case. I also checked if cargo.mk was overriding the configure phase and I don't see it. If this is not about creating a dir, I don't know where the steps are coded to check what's happening.

I also tried adding

Code:
HAS_CONFIGURE=  yes
CONFIGURE_WRKSRC= ${WRKDIR}/${DISTNAME}

but that did not change the error message (which I feel is strange, because the line I reference above explicitly mkdir the configure_wrksrc.

So I'm lost. I feel this is a trivial thing but I can't see and would appreciate some help in pointing me in the right direction :)
 
The plot thickens a bit and this doesn't make sense to me, so I'm starting from scratch and detailing here step by step what I'm doing.
Here's the barebones, starting point Makefile including some debugging code:

Code:
PORTNAME=    iocaine
DISTVERSION=    2.1.0
CATEGORIES=    www

MAINTAINER=    [email protected]
COMMENT=    The deadliest poison known to AI.
WWW=        https://iocaine.madhouse-project.org/

LICENSE=    MIT

USES=        cargo
USE_RC_SUBR=    iocaine

MASTER_SITES=    https://git.madhouse-project.org/${PORTNAME}/${PORTNAME}/archive/

USERS=        www
GROUPS=        www

post-extract:
    @echo "===== DEBUG: post-extract WRKSRC ====="
    @ls -la ${WRKSRC}
    @echo "===== DEBUG: post-extract WRKDIR ====="
    @ls -la ${WRKDIR}
    @echo "===== DEBUG: post-extract WRKDIR/iocaine ====="
    @ls -la ${WRKDIR}/iocaine

.include <bsd.port.mk>

I'm starting clean, so I need a distinfo file which I create with doas make makesum (I'm working from /usr/local/poudriere/ports/default/www/iocaine. The tarball is downloaded
Code:
> doas make makesum
===>  License MIT accepted by the user
===>  License MIT accepted by the user
===>   iocaine-2.1.0 depends on file: /usr/local/sbin/pkg - found
=> iocaine-2.1.0.tar.gz doesn't seem to exist in /usr/local/poudriere/ports/default/distfiles/.
=> Attempting to fetch https://git.madhouse-project.org/iocaine/iocaine/archive/iocaine-2.1.0.tar.gz
iocaine-2.1.0.tar.gz                                    44 kB  542 kBps    00s
===> Fetching all distfiles required by iocaine-2.1.0 for building

and distinfo becomes
Code:
TIMESTAMP = 1747413294
SHA256 (iocaine-2.1.0.tar.gz) = 54ce886b970092d696fe666a05ea498b09fa3046c5a78a197fcfde23ce48bfe9
SIZE (iocaine-2.1.0.tar.gz) = 45512

All good so far. Now onto doas make cargo-crates, which is our first failure:

Code:
> doas make cargo-crates
===>  License MIT accepted by the user
===>   iocaine-2.1.0 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by iocaine-2.1.0 for building
===>  Extracting for iocaine-2.1.0
=> SHA256 Checksum OK for iocaine-2.1.0.tar.gz.
===>  Moving crates to /usr/local/poudriere/ports/default/www/iocaine/work/iocaine-2.1.0/cargo-crates
===== DEBUG: post-extract WRKSRC =====
total 3
drwxr-xr-x  3 root wheel 3 May 16 18:37 .
drwxr-xr-x  4 root wheel 4 May 16 18:37 ..
drwxr-xr-x  2 root wheel 2 May 16 18:37 cargo-crates
===== DEBUG: post-extract WRKDIR =====
total 20
drwxr-xr-x   4 root wheel  4 May 16 18:37 .
drwxr-xr-x   4 root wheel  8 May 16 18:37 ..
drwxr-xr-x  10 root wheel 21 Apr 26 21:42 iocaine
drwxr-xr-x   3 root wheel  3 May 16 18:37 iocaine-2.1.0
===== DEBUG: post-extract WRKDIR/iocaine =====
total 21
drwxr-xr-x  10 root wheel    21 Apr 26 21:42 .
drwxr-xr-x   4 root wheel     4 May 16 18:37 ..
-rw-r--r--   1 root wheel   129 Apr 26 21:42 .envrc
drwxr-xr-x   4 root wheel     4 Apr 26 21:42 .forgejo
-rw-r--r--   1 root wheel   241 Apr 26 21:42 .gitattributes
-rw-r--r--   1 root wheel   188 Apr 26 21:42 .gitignore
-rw-r--r--   1 root wheel  3642 Apr 26 21:42 CHANGELOG.md
-rw-r--r--   1 root wheel 70648 Apr 26 21:42 Cargo.lock
-rw-r--r--   1 root wheel  2106 Apr 26 21:42 Cargo.toml
drwxr-xr-x   2 root wheel     3 Apr 26 21:42 LICENSES
-rw-r--r--   1 root wheel  3045 Apr 26 21:42 README.md
-rw-r--r--   1 root wheel   975 Apr 26 21:42 REUSE.toml
drwxr-xr-x   3 root wheel     4 Apr 26 21:42 benches
-rw-r--r--   1 root wheel   185 Apr 26 21:42 build.rs
drwxr-xr-x   3 root wheel     7 Apr 26 21:42 data
-rw-r--r--   1 root wheel  3140 Apr 26 21:42 flake.lock
-rw-r--r--   1 root wheel  3217 Apr 26 21:42 flake.nix
drwxr-xr-x   2 root wheel     7 Apr 26 21:42 nix
drwxr-xr-x   4 root wheel    14 Apr 26 21:42 src
drwxr-xr-x   2 root wheel     3 Apr 26 21:42 templates
drwxr-xr-x   3 root wheel     4 Apr 26 21:42 tests
===> /usr/local/poudriere/ports/default/www/iocaine/work/iocaine-2.1.0/Cargo.lock not found.  Trying to generate it...
error: manifest path `/usr/local/poudriere/ports/default/www/iocaine/work/iocaine-2.1.0/Cargo.toml` does not exist
*** Error code 101

Stop.
make: stopped in /usr/local/poudriere/ports/default/www/iocaine

We see the tarball extracted into ${WRKDIR}/${PORTNAME} instead the expected/default (as in bsd.ports.mk) ${WRKDIR}/${DISTNAME}. That's ok, the Porter's handbook mentions this exact issue, so we add
Code:
WRKSRC=        ${WRKDIR}/${PORTNAME}

to the Makefile and run doas make cargo-crates again and now a list of crates is printed. I create a
Makefile.crates with this list and run
doas make makesum again. This leads to a flurry of downloads and checksums. Great.

Now, another odd (to me) thing happens: the distinfo file was completely overwritten — there's no more mention of iocaine-2.1.0.tar.gz. Maybe this is normal? I press on, because nowhere online could I find someone complaining about this (it's possible I didn't hit the right keywords).

Next step is to build this with doas poudriere bulk -b latest -j 142amd64 -f ~/pkgs-to-build.
Here's the same debugging statement, which before (running "locally" outside the poudriere jail during the make command) was showing WRKDIR/iocaine full of stuff (this is post-extract):
Code:
===>  Moving crates to /wrkdirs/usr/ports/www/iocaine/work/iocaine/cargo-crates
===== DEBUG: post-extract WRKSRC =====
total 18
drwxr-xr-x    3 nobody wheel    64 May 16 16:48 .
drwxr-xr-x    3 nobody wheel    64 May 16 16:48 ..
drwxr-xr-x  292 nobody wheel 18560 May 16 16:48 cargo-crates
===== DEBUG: post-extract WRKDIR =====
total 0
drwxr-xr-x  3 nobody wheel 64 May 16 16:48 .
drwxr-xr-x  3 nobody wheel 64 May 16 16:48 ..
drwxr-xr-x  3 nobody wheel 64 May 16 16:48 iocaine
===== DEBUG: post-extract WRKDIR/iocaine =====
total 18
drwxr-xr-x    3 nobody wheel    64 May 16 16:48 .
drwxr-xr-x    3 nobody wheel    64 May 16 16:48 ..
drwxr-xr-x  292 nobody wheel 18560 May 16 16:48 cargo-crates

Now it's empty, and after that, in the configuration phase:

Code:
=======================<phase: configure      >============================
===== env: NO_DEPENDS=yes USER=nobody UID=65534 GID=65534
===>  Configuring for iocaine-2.1.0
/bin/sh: cannot create /wrkdirs/usr/ports/www/iocaine/work/iocaine: Is a directory
*** Error code 2

Stop.
make: stopped in /usr/ports/www/iocaine

So:
  • There's no source code at all
  • Something (I still can't figure out what) is trying to write to /wrkdirs/usr/ports/www/iocaine/work/iocaine as if it was a file, but it's in fact a directory. I imagine something from the cargo macros, but I don't know what.
I tried adding
Code:
SHA256 (iocaine-2.1.0.tar.gz) = 54ce886b970092d696fe666a05ea498b09fa3046c5a78a197fcfde23ce48bfe9
SIZE (iocaine-2.1.0.tar.gz) = 45512

by hand to the distinfo file, but that still made no difference: the ls statements still show no files and the "Is a directory" error is still there. Only removing all the crates from the distinfo file and the Makefiles.crates resulted in the tarball being extracted and the iocaine dir being correctly populated inside poudriere.
At this stage it feels like I have 2 problems: why is the tarball not being used? and what command is trying to write to iocaine as if it was a file?
 
Back
Top
OSZAR »