Index | Thread | Search

From:
David Uhden Collado <david@uhden.dev>
Subject:
Re: [NEW]: net/xd-torrent
To:
Stuart Henderson <stu@spacehopper.org>
Cc:
ports@openbsd.org
Date:
Wed, 11 Sep 2024 10:04:09 +0200

Download raw body.

Thread
Thank you for taking the time to check out my port.

>> 3. Configuration files are placed in the files directory because, by >> default, the program generates them and the data directories in the same
>> location as the executable. To integrate the software into the system and
>> prevent this behavior, I created these configuration files, which are
>> simply the program's default configuration with modified paths for the
>> configuration files and data storage.
> 
> are these not files which the program is meant to update itself
> after learning about trackers etc from the network?

Yes, I think it is better to let the program generate the configuration 
files in the home directory of the user running the daemon.

> 
> : BUILD_DEPENDS =		devel/git
> 
> that only seems used in the Makefile in the distro, whuch you aren't
> using. (also even in that case it's only used if .git exists, which it
> doesn't).
> 
> : USE_GMAKE =		Yes
> 
> unused in your port, you are using go.port.mk pieces to do the build and
> ignoring upstream's Makefile
> 
> : SEPARATE_BUILD=		Yes
> 
> already set by go.port.mk

Removed

> 
> : do-install:
> : 	${INSTALL_PROGRAM} ${MODGO_WORKSPACE}/bin/XD ${PREFIX}/bin
> : 	${INSTALL_DATA_DIR} ${SYSCONFDIR}/xd
> 
> if that actually works for you, you're buulding ports as root.
> do not do that.


I didn't know it was so important to build ports with doas or sudo as a 
normal user. As I said before, the documentation is not clear on this.

> 
> $ make fake
> ===>  Faking installation for xd-torrent-0.4.6
> /pobj/xd-torrent-0.4.6/bin/install -c  -m 755 /pobj/xd-torrent-0.4.6/go/bin/XD /pobj/xd-torrent-0.4.6/fake-amd64/usr/local/bin
> /pobj/xd-torrent-0.4.6/bin/install -d -m 755 /etc/xd
> install: /etc/xd: Permission denied
> *** Error 1 in . (Makefile:23 'do-install')
> *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3141 '/pobj/xd-torrent-0.4.6/fake-amd64/.fake_done': @cd /usr/ports/mystuff/net/x...)
> *** Error 2 in /usr/ports/mystuff/net/xd-torrent (/usr/ports/infrastructure/mk/bsd.port.mk:2704 'fake': @lock=xd-torrent-0.4.6;  export _LOC...)
> 
> : 	${INSTALL_DATA} ${FILESDIR}/*.ini ${SYSCONFDIR}/xd/
> 
> same - plus if you are building as root, that would install files into
> /etc on the build machine, a port should not write outside of either
> WRKDIR or /tmp at all during build.

What would be the right way to do it?

> 
> that should be installed into a dir like ${PREFIX}/share/examples/xd-torrent
> for @sample to copy from
> 
> : 	${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd
> : 	${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd/metadata
> : 	${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd/downloads
> : 	${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd/seeding
> 
> same, this is writing to /var on the build machine during build.
> 
> you don't need these at all, just create the dirs at package install
> time via @sample.

So all new directories have to be created using the PLIST file? I have 
seen ports that do this directly from the Makefile, in which cases 
should the Makefile be used and in which cases PLIST?

> 
> : post-install:
> : 	ln -s XD ${PREFIX}/bin/XD-CLI
> : 	chmod 755 -s XD ${PREFIX}/bin/XD-CLI
> 
> that chmod is a no-op, drop it.

Removed

> 
> : @newgroup _xd:900
> : @newuser _xd:900:900::xd-torrent account:${LOCALSTATEDIR}/xd:/sbin/nologin
> : @rcscript ${RCDIR}/xd
> : @bin bin/XD
> : bin/XD-CLI
> : @sample ${SYSCONFDIR}/xd/
> : @sample ${SYSCONFDIR}/xd/torrents.ini
> : @sample ${SYSCONFDIR}/xd/trackers.ini
> 
> read about @sample in pkg_create(8) to see what's wrong here.

I've read several times the section that talks about how the @sample 
option works in the packing-list (PLIST) and I can't see what's wrong 
here. Could you tell me? On the other hand, there is no man page called 
"pkg_create" in section 8, only in section 1.

> 
> : @owner _xd
> : @group _xd
> : @sample ${LOCALSTATEDIR}/xd/
> : @sample ${LOCALSTATEDIR}/xd/metadata/
> : @sample ${LOCALSTATEDIR}/xd/downloads/
> : @sample ${LOCALSTATEDIR}/xd/seeding/

I have attached to this email a new version of this port with the 
corrections made above. I have tested it on OpenBSD 7.6-beta and it 
works without problems.