ports structure and improvement suggestions

Aren Olvalde Tyr aren.tyr at gawab.com
Tue May 9 08:50:37 UTC 2006


On Tuesday 09 May 2006 07:10, Jeremy Chadwick wrote:

> What I proposed in the aforementioned thread was to have an actual
> BIND-like configuration file (e.g. a tree) which contains individual
> options which are set to yes/no per port.  There is a global scope
> which applies to all ports, while individual ports can be adjusted
> individually -- or overwride the global scope settings.  I proposed
> something that applied to both ports *and* buildworld, which now
> that I think about it, probably wasn't a good idea.  So here's
> a modified version:
>
> # No IPv6, and no X11
> IPV6 = no
> X11  = no
>
> devel/gettext {
>   EXAMPLES = no
>   HTMLMAN  = no
> }
> www/apache20 {
>   KQUEUE_SUPPORT = yes
> }
> www/suphp {
>   CHECKPATH = no
>   LOGFILE   = /var/log/suphp.log
> }
> net/cvsup {
>   X11 = yes
> }

I like the format (and your idea). 

Going a bit further, to keep the file size manageable, I think it would be 
best to have it split across multiple files, eg. ports.master.conf, with 
defines the overall global template:

# ports.master.conf
# Global ports configuration file

# Define global build options:

all {
	IPVG = no
	X11 = no
}

accessibility {
	file->ports.accessibility.conf
}

graphics {
	file->ports.graphics.conf
}

foobar {
	file->ports.foo.conf
}

Then in the particular file you can have your options.


# ports.graphics.conf
# Configuration file for all graphics ports under ${PORTBASE}/graphics

gimp {
	WITH_X11 = no
}
# (   ;^)  )

And I guess it would then be nice to store all these configuration files under 
somewhere like /etc/ports/ or so, or alternatively /usr/ports/config if you 
want to keep it all contained under the ports tree.


I'm almost tempted to hack up some Perl (probably quickest/simplest) scripts 
(called "portconfig" or something similar) to implement this idea as an 
interesting little programming project.

I'd like it to run something like:
  
# portconfig --init --generate-config -v

Generating configuration files for the first time...
Generating accessibility options (ports.accessiblity.conf)... DONE
Generating arabic options (ports.arabic.conf)... DONE
<snip>
Generating x11-wm options (ports.x11-wm.conf)... DONE
Generating master configuration file (ports.master.conf)... DONE

***********************************************************

File generation complete.

The following files have been created:
config/ports.accessibility.conf
config/ports.arabic.conf
<snip>
config/ports.x11-wm.conf
config/ports.master.conf

Now edit the appropriate configuration file[s] and run portconfig --install 
<port> (where <port> is of type category/port name, e.g. graphics/gimp) to 
install your port[s].
 
************************************************************



Now, if we use the gimp port as an example, under ports.graphics.conf it 
should have generated something like the following:

<snip>

gimp {
	WITH_DEBUG  = no	
	WITH_PYTHON = no
	WITHOUT_PRINT = no
	WITH_MP = no
	WITH_HTML_HELP_BROWSER = yes
	GNOME_ENABLED = no
}

<snip>

Note that it checked the default OPTIONS and set WITH_HTML_HELP_BROWSER 
to "yes" according.

Now, presuming you set say WITH_PYTHON to yes, then running 
portconfig --install graphics/gimp would invoke make with the appropriate 
knob(s) (e..g make -DWITH_HTML_HELP_BROWSER -DWITH_PYTHON install clean).

# portconfig --install graphics/gimp
Installing gimp-2.2.11...
Options: 
-> WITH_HTML_HELP_BROWSER
-> WITH_PYTHON
Checking dependencies...
gimp-2.2.11 requires: 
-> package: foo-1.x.z  - found
-> package: bar-2.x.y - not found
Installing bar-2.x.y
Options:
-> WITH_CONQUER_THE_WORLD
-> WITHOUT_XP
Checking dependencies...
bar-2.x.y requires:
-> package: discretion-1.0.0 - found
-> package: intelligence-1.0.0 - found
-> package: nice-1.0.0 - found

<build>

Returning to build of gimp-2.2.11...
<build>
Pakage gimp-2.2.11 installed successfully.


Integrating it with portupgrade would be nice,  I guess a current hackaround 
would be to call portversion -l "<" (or pkg_version) to determine out of date 
ports, then get portconfig to upgrade them all itself. It would probably have 
to call (or the user would have to have made sure to call) something like 

#portconfig --update-config
Updating configuration files (whilst preserving your specified existant 
options)....
Updating ports.accessibility.conf... DONE
<etc> 

first, which would have to go through and check all the defined options/knobs 
against the new ports snapshot which presumably you'd just fetched, and 
update accordingly (remembering your settings where they are still 
applicable/existant).

Then

#portconfig --upgrade foo
 
Would upgrade foo, and 

#portconfig --upgrade all

would upgrade all ports.

An alternative method, but very ugly, would be to generate a load of 

.if ${CURDIR} == some_category/some_port
<set make options>
.endif

type macros in make.conf. You could then just use portupgrade et al as normal. 
But I don't like it, make.conf could start to get ridiculously large.


Anyway, just a few rambling thoughts, I don't know if any of this is any good.

Regards

Aren.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20060509/1782fa43/attachment.pgp


More information about the freebsd-ports mailing list