jrmarino / synth

Next D/Ports build tool for live systems (Alternative for Portmaster and Portupgrade tools)
ISC License
254 stars 15 forks source link

Support for subpackage feature #219

Closed daemonblade closed 9 months ago

daemonblade commented 10 months ago

FreeBSD ports has introduced SUBPACKAGES, and some ports (eg: audio/alsa-plugins) have started adopting the feature. Unfortunately, this breaks synth:

--------------------------------------------------------------------------------
--  Phase: lib-depends
--------------------------------------------------------------------------------
===>   alsa-plugins-1.2.7.1_3 depends on shared library: libasound.so - not found
===>   Installing existing package /packages/All/alsa-lib-1.2.10_1.pkg
Installing alsa-lib-1.2.10_1...
Extracting alsa-lib-1.2.10_1: .......... done
===>   alsa-plugins-1.2.7.1_3 depends on shared library: libasound.so - found (/usr/local/lib/libasound.so)
===>   Returning to build of alsa-plugins-1.2.7.1_3
===>   alsa-plugins-1.2.7.1_3 depends on shared library: libasound.so - found (/usr/local/lib/libasound.so)
===>   alsa-plugins-1.2.7.1_3 depends on shared library: libavcodec.so - not found
===>   alsa-plugins-1.2.7.1_3 depends on package: /packages/All/ffmpeg-6.1.1_3,1.pkg - not found
===>   USE_PACKAGE_DEPENDS_ONLY set - not building missing dependency from source
*** Error code 1
jrmarino commented 10 months ago

this could require a major rewrite to support. I haven't been following ports development so I don't know how this is even being implemented (to be honest I'm shocked subpackages even succeeded). It's a whole new ball of wax.

jrmarino commented 9 months ago

do you have any idea what changes are needed? I was hoping changes like this would be take care of by the framework but sounds like it wasn't. The flavor support was a major pain -- requiring that awful 15 minute indexing to happen, and changing how the ports were referenced with that "@" symbol. I'm scared to think how the subpackages were implemented.

daemonblade commented 9 months ago

I'll take a look during the weekend. It may be as simple as an additional mount_nullfs and an extra make-var - hopefully.

daemonblade commented 9 months ago

The failure appears to be centred around dependency resolution. How does synth compute which dependencies are required for a port? It's not recognising that the multimedia/ffmpeg needs to be built before audio/alsa-plugins. If I look at /usr/ports/INDEX, alsa-plugins correctly has "ffmpeg-6.1.1_3,1 listed as a dependency - synth apparently does not consult this file?

jrmarino commented 9 months ago

no, it doesn't use index at all (which has to be generated on every single dep change to any port. It's not part of the repository either. Synth runs a make query on several variables, in the form of "make -V LIB_DEPENDS -V BUILD_DEPENDS" etc. It's possible that there is a new variable in play. But really subpackages should not have broken this.

I can try to track down the code where this happens and post it.

daemonblade commented 9 months ago

As you've probably discovered by now, SUBPACKAGE has introduced LIB_DEPENDS.* variables to the Makefile. Hopefully, this won't be too hard to incorporate into synth.

jrmarino commented 9 months ago

so here is the query:

https://github.com/jrmarino/synth/blob/eecfd29d7c81f535550b1e486a9d0b7b5a193d2c/src/portscan.adb#L773-L779

Can you provide a complete list of the new, missing dependency variables?

daemonblade commented 9 months ago

My first reading of bsd.port.mk suggests that we need to replace {FETCH|EXTRACT|PATCH|BUILD|LIB|RUN}_DEPENDS with {FETCH|EXTRACT|PATCH|BUILD|LIB|RUN}_DEPENDS_ALL.

For audio/alsa-plugins:

alsa-plugins,11:55am> make -VLIB_DEPENDS_ALL
libasound.so:audio/alsa-lib libasound.so:audio/alsa-lib libavcodec.so:multimedia/ffmpeg libasound.so:audio/alsa-lib libjack.so:audio/jack libasound.so:audio/alsa-lib libsamplerate.so:audio/libsamplerate libasound.so:audio/alsa-lib libspeexdsp.so:audio/speexdsp

which looks better to me.

jrmarino commented 9 months ago

You are saying somebody renamed _DEPENDS to _DEPENDS_ALL ? That would be pretty reckless. My guess is *_DEPENDS_ALL is a combination of several variables. WHich would make sense if they added a new variable to that combination.

If the full rename happened it would completely break all ports so I am thinking that didn't happen.

daemonblade commented 9 months ago

Yup, _DEPENDS_ALL is a combo of the _DEPENDS + _DEPENDS.subpkg1 + _DEPENDS.subpkg2 + ...

jrmarino commented 9 months ago

Alright, so it may just be (relatively) simple matter of extracting the .subpkg1 and .subpkg2 depends and including them with the rest. I'll see what I can do.

To test it, what port do you recommend that I build?

jrmarino commented 9 months ago

It looks like your interpretation is correct. see: https://github.com/freebsd/freebsd-ports/commit/47564762a319a037686c921accbb831db779715c#diff-9340abbbd3230f71b4794701ef9b7a68555511d3d67d45ae97b93d99b27f7ba3

All the _DEPENDS* were essentially renames to _DEPENDS_ALL.

I still think this is reckless but it could be a relative easy fix.

daemonblade commented 9 months ago

I would suggest to test against the port that I reported at the start. You'd have to start with an empty repo, and then see if audio/alsa-plugins completes its build. audio/alsa-plugins is one of the few that took the jump to SUBPACKGES

jrmarino commented 9 months ago

Okay, audio/alsa-plugins builds along with every package that needs to exist to get to the point of building. I will tag v3.0 in a minute.

jrmarino commented 9 months ago

Alright, the tag is actually "v3.00" to match previous formats. Let me know if that completely solves the issue. if so you might want to let fluffy (the maintainer) know to update the port.

daemonblade commented 9 months ago

The fix is good. I think it's good for a formal release. Thanks!