Date: Sun, 4 Mar 2012 14:09:22 -0500 From: "A.J. Kehoe IV (Nanoman)" <nanoman@nanoman.ca> To: ports@FreeBSD.org Subject: Indexing FreeBSD Ports with Optional Dependencies Message-ID: <20120304190922.GA58789@nanocomputer.nanoman.ca>
next in thread | raw e-mail | index | archive | help
--gKMricLos+KVdGMg Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I am responsible for hundreds of FreeBSD systems with hundreds of different= combinations of installed packages. Back in 2003, I wrote a script that h= elps me manage this, and over the past few months, I've been doing bug fixe= s. My script generates an index of all the ports that I use. It uses this ind= ex to build, install, and update the packages that are used by the hundreds= of different systems. To get the list of each port's dependencies, it run= s "make all-depends-list". I'm having a problem with a few ports that use an automatic detection metho= d to declare their optional dependencies. With these ports, dependencies a= nd/or other things important to the build process are changed depending on = whether or not files from another port exist on the system. A quick search= of the entire ports tree shows that there are less than three hundred port= s using this method. Every other port uses the OPTIONS framework to make t= hese changes, which is easy to use and to write a script around, whereas th= is automatic method complicates indexing. Consider this example from the current print/libgnomeprint Makefile: -----BEGIN QUOTE----- =2Einclude <bsd.port.pre.mk> =2Eif (defined(WITH_CUPS) || exists(${LOCALBASE}/lib/libcups.so)) && !defin= ed(WITHOUT_CUPS) CONFIGURE_ARGS+=3D --with-cups LIB_DEPENDS+=3D gnomecups-1.0:${PORTSDIR}/print/libgnomecups PLIST_SUB+=3D CUPS:=3D"" =2Eelse CONFIGURE_ARGS+=3D --without-cups PLIST_SUB+=3D CUPS:=3D"@comment " =2Eendif pre-everything:: =2Eif !defined(WITH_CUPS) @${ECHO_MSG} " Enable cups support by defining" @${ECHO_MSG} " WITH_CUPS" @${ECHO_MSG} "" =2Eendif -----END QUOTE----- print/libgnomeprint does not use OPTIONS to define WITH_CUPS or WITHOUT_CUP= S. If you haven't defined these as environment variables, running "make al= l-depends-list" will yield two different results, depending on whether or n= ot you have print/cups-base installed. print/libgnomeprint will echo "Enab= le cups support by defining WITH_CUPS" in the "pre-everything" stage, but u= nless you read through every Makefile before installing each port, it's eas= y to miss. I use over a thousand different ports for the hundreds of systems that I ma= intain. I'd strongly prefer not to be expected to read through each port's= Makefile and/or to stay abreast of every Makefile's changes. It would be = very difficult to write a script to do this for me because of how obscure t= hese Makefiles can be, and I don't have the time for it. As far as I can tell, the only benefit to using this automatic method is th= at it slightly reduces the potential number of OPTIONS "dialog" screens tha= t appear. The reduction across the entire ports tree is only about 1%, so = it's barely noticeable. The cost of this minor benefit is the breaking of = indexing, which causes problems for ports management scripts. What we need is a way to identify which dependencies a port requires, regar= dless of what other ports have been installed, and without the need to manu= ally read through every Makefile before every build. I have three solution= s to propose: A. Require ports to use the OPTIONS framework instead of the automatic meth= od that I described above. This would require an update to the Porter's Ha= ndbook and patches to the approximately three hundred ports that currently = use this method. I am willing to write all these changes by myself. B. Require ports to use the OPTIONS framework in addition to the automatic = method that I described above. This would require an update to the Porter'= s Handbook and patches to the approximately three hundred ports that curren= tly use this method. I am willing to write all these changes by myself. C. Create a new dependency category to be defined by ports that use optiona= l dependencies. This would require a new type of dependency checking added= to bsd.*.mk (perhaps called "OPT_DEPENDS" with "make opt-depends-list"), a= n update to the Porter's Handbook, and patches to the many thousands of por= ts that use optional dependencies by any method. I am not willing to do al= l of this by myself, and I think it's excessive. Personally, I like solution A. Like B, A is significantly simpler than C, = but unlike B and C, A eliminates this automatic detection method entirely. With any of these solutions, the Porter's Handbook would need to be updated= =2E For solution A, it would forbid port maintainers from using the automa= tic method for the reasons that I described above. For solution B, it woul= d explain the need to use the OPTIONS framework whenever the automatic meth= od is used. For solution C, it would explain the requirement of "OPT_DEPEN= DS" (or whatever) for inclusion into every port that has optional dependenc= ies. Using the example from print/libgnomeprint, under solution A, I would chang= e that segment of its Makefile to the following: -----BEGIN REVISION A----- OPTIONS=3D CUPS "Enable CUPS support" on =2Einclude <bsd.port.pre.mk> =2Eif defined(WITH_CUPS) && !defined(WITHOUT_CUPS) CONFIGURE_ARGS+=3D --with-cups LIB_DEPENDS+=3D gnomecups-1.0:${PORTSDIR}/print/libgnomecups PLIST_SUB+=3D CUPS:=3D"" =2Eelse CONFIGURE_ARGS+=3D --without-cups PLIST_SUB+=3D CUPS:=3D"@comment " =2Eendif -----END REVISION A----- Under solution B, it would look like this: -----BEGIN REVISION B----- OPTIONS=3D CUPS "Enable CUPS support" on =2Einclude <bsd.port.pre.mk> =2Eif (defined(WITH_CUPS) || exists(${LOCALBASE}/lib/libcups.so)) && !defin= ed(WITHOUT_CUPS) CONFIGURE_ARGS+=3D --with-cups LIB_DEPENDS+=3D gnomecups-1.0:${PORTSDIR}/print/libgnomecups PLIST_SUB+=3D CUPS:=3D"" =2Eelse CONFIGURE_ARGS+=3D --without-cups PLIST_SUB+=3D CUPS:=3D"@comment " =2Eendif -----END REVISION B----- And under solution C, it would look like this: -----BEGIN REVISION C----- OPT_DEPENDS=3D gnomecups-1.0:${PORTSDIR}/print/libgnomecups =2Einclude <bsd.port.pre.mk> =2Eif (defined(WITH_CUPS) || exists(${LOCALBASE}/lib/libcups.so)) && !defin= ed(WITHOUT_CUPS) CONFIGURE_ARGS+=3D --with-cups LIB_DEPENDS+=3D gnomecups-1.0:${PORTSDIR}/print/libgnomecups PLIST_SUB+=3D CUPS:=3D"" =2Eelse CONFIGURE_ARGS+=3D --without-cups PLIST_SUB+=3D CUPS:=3D"@comment " =2Eendif pre-everything:: =2Eif !defined(WITH_CUPS) @${ECHO_MSG} " Enable cups support by defining" @${ECHO_MSG} " WITH_CUPS" @${ECHO_MSG} "" =2Eendif -----END REVISION C----- If anyone has any other ideas or comments, I'm very interested in hearing f= rom you. My thanks to the FreeBSD Ports Management Team for all the sugges= tions and feedback you've given me so far. Your time is greatly appreciate= d. --=20 A.J. Kehoe IV (Nanoman) | /"\ ASCII Ribbon Campaign Nanoman's Company | \ / - No HTML/RTF in E-mail E-mail: nanoman@nanoman.ca | X - No proprietary attachments WWW: http://www.nanoman.ca/ | / \ - Respect for open standards --gKMricLos+KVdGMg Content-Type: application/x-pkcs7-signature Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIIPCwYJKoZIhvcNAQcCoIIO/DCCDvgCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC DHcwggUyMIIDGqADAgECAgMK10swDQYJKoZIhvcNAQEFBQAweTEQMA4GA1UEChMHUm9vdCBD QTEeMBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0IFNp Z25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2VydC5vcmcwHhcN MTExMDE3MjAzMDIzWhcNMTIwNDE0MjAzMDIzWjA9MRgwFgYDVQQDEw9DQWNlcnQgV29UIFVz ZXIxITAfBgkqhkiG9w0BCQEWEm5hbm9tYW5AbmFub21hbi5jYTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAK9WRGqRDUDjWwNIfZTBp4FL5bI0kY3ZqvM6tEO+Sqp5YxATre8F a+BYbeNp/8MKfuPrRgE2jRzlePAx7kpvZUhRTGAZpncmHC7Z3FDl8Ugid4193ReCfPypb9Gs 3ZgPfzJyNuDeCM3amz/cDXC/makJLpmLzu95D91hD+V30iActE5j1tNewMq9qJRoEdr5Tqus bUjjDm8kiK5sz9JzQjFoufuaWIR57w2Sm1gDVZ0MH46fxZ/SwLDDzt4VC2u+1oS4KSmVUm6X Wv1/Fmdf2sOOu9Ro2xVjJHW+j16lsFPPj+lkDv5tb0G7I2vBoKEQg/s+h8J4F+l/xPL3O5xB c68CAwEAAaOB/jCB+zAMBgNVHRMBAf8EAjAAMFYGCWCGSAGG+EIBDQRJFkdUbyBnZXQgeW91 ciBvd24gY2VydGlmaWNhdGUgZm9yIEZSRUUgaGVhZCBvdmVyIHRvIGh0dHA6Ly93d3cuQ0Fj ZXJ0Lm9yZzBABgNVHSUEOTA3BggrBgEFBQcDBAYIKwYBBQUHAwIGCisGAQQBg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k2Dh loZQtHpZ2I8hC5/PgpHGO79r3AeRuZdWI6q2bJTGSAY85M5OquT2LwncU28u/HTrOmOZwqas ibynskSgDYoQ42zyJMv6m59wRy7eFIvUsiAJlqJk8SQc3KE1nBWy1LxVLn0G9ZwOVfRa1pPa dq0lc0zFQzGCAlwwggJYAgEBMIGAMHkxEDAOBgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0 dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0 eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9ydEBjYWNlcnQub3JnAgMK10swCQYFKw4DAhoFAKCB sTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMjAzMDQxOTA5 MjJaMCMGCSqGSIb3DQEJBDEWBBRSKms333zGfTz4jCFqGAmp90LRAjBSBgkqhkiG9w0BCQ8x RTBDMAoGCCqGSIb3DQMHMA4GCCqGSIb3DQMCAgIAgDANBggqhkiG9w0DAgIBQDAHBgUrDgMC BzANBggqhkiG9w0DAgIBKDANBgkqhkiG9w0BAQEFAASCAQAYCtt5erLa6DbGDLOgEYbiI0u3 QMYfPi/mEQsdNOOvSW/vuDUWaubrfIt+R0bMmKp9hUcxD5F2MKqroIxkYsk+OuP/R1fQn2UM R05D4UbEqWCqsAHShccrULH6Dg6MRYa4GS6tXjVHP1tbKwwn/Gvr+hpY6JDvYaP7Zi/pPrkd Xgv2+xK7PGtNfB98Tlrl+LMt3osnSQ81fJQk3NMfb7sCFPCxLPCVHSjXPOysCnd+mpBDzM4N Zg6ff01uACLVrCacajerQ9YFa4JeJc/oGfnYuhFHjAfdKpsSZ+Z1xuCExpzcURO9qzmWdR3K /0W2TxCqebNW3JL2DmcoMGGuBeIb --gKMricLos+KVdGMg--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120304190922.GA58789>