jasperla / openbsd-wip

OpenBSD work in progress ports
http://www.openbsd.org/
267 stars 87 forks source link

gurk-rs: Fix sed in-place editing error. #175

Closed falsifian closed 3 months ago

falsifian commented 5 months ago

Without this change, make (specifically, make FETCH_PACKAGES=-Dsnap MAKE_JOBS=3 PORTSDIR_PATH=/usr/ports:/usr/ports/openbsd-wip) fails with:

[modcargo] Generating metadata for zvariant_derive-3.15.2
[modcargo] Generating metadata for zvariant_utils-1.0.1
===>  Generating configure for gurk-rs-0.4.3
===>  Configuring for gurk-rs-0.4.3
sed -i '/opt-level/s,2,0,' /home/pobj/gurk-rs-0.4.3/.cargo/config
sed: /home/pobj/gurk-rs-0.4.3/.cargo/config: in-place editing only works for regular files
*** Error 1 in . (Makefile:35 'post-configure')
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3044 '/home/pobj/gurk-rs-0.4.3/.co
nfigure_done': @cd /usr/ports/openbsd-wip/net/g...)
*** Error 2 in /usr/ports/openbsd-wip/net/gurk-rs (/usr/ports/infrastructure/mk/bsd.port.mk:2
704 'all': @lock=gurk-rs-0.4.3;  export _LOCKS_...)
exit: 2 angel gurk-rs $ grep -R opt-level
Makefile:       sed -i '/opt-level/s,2,0,' ${WRKDIR}/.cargo/config

Not sure why it works for other(s) but not me. My ports tree is at commit fd2b2c6a on the git mirror.

@c0dev0id

c0dev0id commented 5 months ago

This is odd. I have the same PORTSDIR_PATH configuration.

Does this work?

cd ${WRKDIR}/.cargo && sed -i '/opt-level/s,2,0,' config
falsifian commented 5 months ago

No. sed is complaining because the file is a symlink:

$ ls -l /home/pobj/gurk-rs-0.4.3/.cargo/config
lrwxr-xr-x  1 _pbuild  _pbuild  43 May 19 15:22 /home/pobj/gurk-rs-0.4.3/.cargo/config -> /home/pobj/gurk-rs-0.4.3/.cargo/config.toml

Specifically, with this change against commit 97bc5fe3:

--- net/gurk-rs/Makefile
+++ net/gurk-rs/Makefile
@@ -32,7 +32,8 @@ SUBST_VARS =  LOCALBASE
 #              < ${FILESDIR}/notification.rs.patch

 post-configure:
-       sed -i '/opt-level/s,2,0,' ${WRKDIR}/.cargo/config
+       #sed -i '/opt-level/s,2,0,' ${WRKDIR}/.cargo/config
+       cd ${WRKDIR}/.cargo && sed -i '/opt-level/s,2,0,' config
        cat ${FILESDIR}/config >> ${WRKDIR}/.cargo/config

 do-install:

running make FETCH_PACKAGES=-Dsnap MAKE_JOBS=3 PORTSDIR_PATH=/usr/ports:/usr/ports/openbsd-wip clean and then make FETCH_PACKAGES=-Dsnap MAKE_JOBS=3 PORTSDIR_PATH=/usr/ports:/usr/ports/openbsd-wip, the output ends with this:

===>  Generating configure for gurk-rs-0.4.3
===>  Configuring for gurk-rs-0.4.3
#sed -i '/opt-level/s,2,0,' /home/pobj/gurk-rs-0.4.3/.cargo/config
cd /home/pobj/gurk-rs-0.4.3/.cargo && sed -i '/opt-level/s,2,0,' config
sed: config: in-place editing only works for regular files
*** Error 1 in . (Makefile:36 'post-configure')
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3044 '/home/pobj/gurk-rs-0.4.3/.configure_done': @cd /usr/ports/openbsd-wip/net/g...)
*** Error 2 in /usr/ports/openbsd-wip/net/gurk-rs (/usr/ports/infrastructure/mk/bsd.port.mk:2704 'all': @lock=gurk-rs-0.4.3;  export _LOCKS_...)
c0dev0id commented 3 months ago

I fixed it by applying sed to config.toml, which is the target of the symlink.

(I know gurk-rs 5.0 is out, but libsqlite3-sys is not building.)