# Is it possible to create /var/db/ports/*/options with pkgng?



## frijsdijk (Dec 11, 2013)

Hi,

When a machine is installed with pkgng (using external repositories), is it possible to generate the /var/db/ports/{portname}/options files in order to be able to upgrade ports locally by compiling them from /usr/ports while maintaining compile-flags?


----------



## kpa (Dec 11, 2013)

*Re: Is it possible to create /var/db/ports/*/options with pk*

There's no direct support for that but you can query the options for installed packages like this: `pkg query "%n-%v %o %Ok %Ov"`. That will output something like:

```
cairo-1.10.2_6,2 graphics/cairo GLIB on
cairo-1.10.2_6,2 graphics/cairo OPENGL off
cairo-1.10.2_6,2 graphics/cairo X11 on
cairo-1.10.2_6,2 graphics/cairo XCB on
curl-7.33.0_1 ftp/curl CARES off
...
```

With some scripting knowledge you can turn those into an options file /var/db/ports/graphics_cairo/options:

```
# This file is auto-generated by 'make config'.
# Options for cairo-1.10.2_6,2
_OPTIONS_READ=cairo-1.10.2_6,2
_FILE_COMPLETE_OPTIONS_LIST=GLIB OPENGL X11 XCB
OPTIONS_FILE_SET+=GLIB
OPTIONS_FILE_UNSET+=OPENGL
OPTIONS_FILE_SET+=X11
OPTIONS_FILE_SET+=XCB
```

And the same for other installed packages.

It shouldn't too hard. The downside of this solution is that you can't trust that the format of the options files is going to remain stable.


----------



## frijsdijk (Dec 11, 2013)

*Re: Is it possible to create /var/db/ports/*/options with pk*

That's workable. Thanks. It would be a nice feature though! Agree? If yes, where to submit such a request?


----------



## DutchDaemon (Dec 11, 2013)

*Re: Is it possible to create /var/db/ports/*/options with pk*

Sounds like a perfect reason to use Poudriere.


----------



## kpa (Dec 11, 2013)

*Re: Is it possible to create /var/db/ports/*/options with pk*

Yes of course but ports-mgmt/poudriere still has the limitation that comes from ports(7) that you have to use the dialog if you want to save your customized options. It's not possible to do something like `make -C /usr/ports/graphics/cairo setoptions WITH_OPENGL=1` to just toggle one option from its default.

Interestingly I thought setting BATCH=yes with `make config` would prevent the dialogs from popping but that doesn't seem to be the case now.


----------



## phoenix (Dec 11, 2013)

*Re: Is it possible to create /var/db/ports/*/options with pk*



			
				frijsdijk said:
			
		

> Hi,
> 
> When a machine is installed with pkgng (using external repositories), is it possible to generate the /var/db/ports/{portname}/options files in order to be able to upgrade ports locally by compiling them from /usr/ports while maintaining compile-flags?



You don't need to.  PKGNG packages are built using the default OPTIONS.  When you compile a port by hand, the OPTIONS screen comes up.  Don't change anything, and you have the exact same OPTIONS set as the pkg.


----------



## frijsdijk (Dec 13, 2013)

*Re: Is it possible to create /var/db/ports/*/options with pk*



			
				phoenix said:
			
		

> frijsdijk said:
> 
> 
> 
> ...



Ah yes, default options. But I build my own repositories with poudriere.


----------

