[Libosinfo] [PATCH 3/4] loader: update to comply with new database install location

Daniel P. Berrange berrange at redhat.com
Fri Aug 5 11:57:16 UTC 2016


On Fri, Aug 05, 2016 at 01:42:09PM +0200, Christophe Fergeau wrote:
> Hey,
> 
> On Fri, Jul 29, 2016 at 11:21:26AM +0100, Daniel P. Berrange wrote:
> > The new database locations are
> > 
> >   - System location
> > 
> >     This is determined by the env variable
> > 
> >       $OSINFO_SYSTEM_DIR
> > 
> >     If not set, then defaults to /usr/share/osinfo
> > 
> >     This location is intended for use by operating system
> >     distributors to install the initial data set via a
> >     package management system like RPM or Deb
> > 
> >   - Local location
> > 
> >     This is determined by the env variable
> > 
> >       $OSINFO_LOCAL_DIR
> > 
> >     If not set, then defaults to /etc/osinfo
> > 
> >     This location is intended for use by local system
> >     administrators to install custom local data that
> >     should be available to all users on a host
> > 
> >   - User location
> > 
> >     This is determined by the env variable
> > 
> >       $OSINFO_USER_DIR
> > 
> >     If not set, then defaults to $XDG_CONFIG_HOME/osinfo
> > 
> >     If that is not set, then defaults to $HOME/.config/osinfo
> 
> I wanted to ask why XDG_CONFIG_HOME and not XDG_DATA_HOME, but it seems
> it was already this way before the split, better to keep things as close
> as possible.

Well we have 3 locations

 - system location - this is non-editable data provided by OS
 - local location  - this is sysadmin editable config in /etc
 - user location   - this is user editable config in $HOME


The system location is akin to XDG_DATA_HOME, while local location
is akin to XDG_CONFIG_HOME. So on balance I think XDG_CONFIG_HOME
is preferrable as this is user editable config for guest installs

> > index ddece61..c915b57 100644
> > --- a/osinfo/Makefile.am
> > +++ b/osinfo/Makefile.am
> > @@ -36,6 +36,7 @@ libosinfo_1_0_la_CFLAGS = \
> >  	$(GOBJECT_CFLAGS) \
> >  	$(GLIB_CFLAGS) \
> >  	$(GIO_CFLAGS) \
> > +	-DDATA_DIR='"$(datadir)"' \
> 
> DATA_DIR is then used to lookup the osinfo database. This means that the
> database and the library have to be built to use the same prefix. I'm
> wondering if it would make sense to have a .pc file together with the
> database to help with locating the system database. Probably not worth
> the complication at this point.

We have an osinfo-db-paths tool that can report this data, for all
3 db locations.  pkg-config isn't a great fit, since it can't report
the user location as it can't dynamically substitute in env variables


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libosinfo mailing list