[virt-tools-list] [PATCH libosinfo 1/2] Move database files into $datadir/db instead of $datadir/data

Daniel P. Berrange berrange at redhat.com
Tue Mar 13 16:32:35 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

---
 data/Makefile.am             |    2 +-
 data/devices/Makefile.am     |    2 +-
 data/hypervisors/Makefile.am |    2 +-
 data/oses/Makefile.am        |    2 +-
 libosinfo.spec.in            |   12 ++++++------
 mingw32-libosinfo.spec.in    |   12 ++++++------
 osinfo/Makefile.am           |    2 +-
 osinfo/osinfo_loader.c       |    7 +++++--
 8 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/data/Makefile.am b/data/Makefile.am
index b5547cf..a62817f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = devices oses hypervisors schemas
 
 EXTRA_DIST = usb.ids pci.ids 95-osinfo.rules.in
 
-databasedir = $(pkgdatadir)/data/
+databasedir = $(pkgdatadir)/db/
 database_DATA = usb.ids pci.ids
 
 if WITH_UDEV
diff --git a/data/devices/Makefile.am b/data/devices/Makefile.am
index f36cd8f..be6ed76 100644
--- a/data/devices/Makefile.am
+++ b/data/devices/Makefile.am
@@ -1,5 +1,5 @@
 
-databasedir = $(pkgdatadir)/data/devices/
+databasedir = $(pkgdatadir)/db/devices/
 database_DATA = xen.xml qemu-pci.xml qemu-usb.xml qemu-ps2.xml virtio-pci.xml
 
 EXTRA_DIST = $(database_DATA)
diff --git a/data/hypervisors/Makefile.am b/data/hypervisors/Makefile.am
index 0e22d3f..2d7041a 100644
--- a/data/hypervisors/Makefile.am
+++ b/data/hypervisors/Makefile.am
@@ -1,5 +1,5 @@
 
-databasedir = $(pkgdatadir)/data/hypervisors/
+databasedir = $(pkgdatadir)/db/hypervisors/
 database_DATA = rhel-xen.xml xen.xml
 
 EXTRA_DIST = $(database_DATA)
diff --git a/data/oses/Makefile.am b/data/oses/Makefile.am
index 0c6b050..889f515 100644
--- a/data/oses/Makefile.am
+++ b/data/oses/Makefile.am
@@ -1,5 +1,5 @@
 
-databasedir = $(pkgdatadir)/data/oses/
+databasedir = $(pkgdatadir)/db/oses/
 database_DATA =     \
   centos.xml        \
   debian.xml        \
diff --git a/libosinfo.spec.in b/libosinfo.spec.in
index 9bfeff8..1940a88 100644
--- a/libosinfo.spec.in
+++ b/libosinfo.spec.in
@@ -102,13 +102,13 @@ rm -fr %{buildroot}
 %{_bindir}/osinfo-db-validate
 %{_bindir}/osinfo-query
 %dir %{_datadir}/libosinfo/
-%dir %{_datadir}/libosinfo/data/
+%dir %{_datadir}/libosinfo/db/
 %dir %{_datadir}/libosinfo/schemas/
-%{_datadir}/libosinfo/data/usb.ids
-%{_datadir}/libosinfo/data/pci.ids
-%{_datadir}/libosinfo/data/devices
-%{_datadir}/libosinfo/data/oses
-%{_datadir}/libosinfo/data/hypervisors
+%{_datadir}/libosinfo/db/usb.ids
+%{_datadir}/libosinfo/db/pci.ids
+%{_datadir}/libosinfo/db/devices
+%{_datadir}/libosinfo/db/oses
+%{_datadir}/libosinfo/db/hypervisors
 %{_datadir}/libosinfo/schemas/libosinfo.rng
 %{_mandir}/man1/osinfo-db-validate.1*
 %{_mandir}/man1/osinfo-detect.1*
diff --git a/mingw32-libosinfo.spec.in b/mingw32-libosinfo.spec.in
index 7da0736..16f86b1 100644
--- a/mingw32-libosinfo.spec.in
+++ b/mingw32-libosinfo.spec.in
@@ -72,13 +72,13 @@ rm -rf $RPM_BUILD_ROOT
 %dir %{_mingw32_includedir}/libosinfo-1.0/osinfo
 %{_mingw32_includedir}/libosinfo-1.0/osinfo/*.h
 %dir %{_mingw32_datadir}/libosinfo
-%dir %{_mingw32_datadir}/libosinfo/data
+%dir %{_mingw32_datadir}/libosinfo/db
 %dir %{_mingw32_datadir}/libosinfo/schemas
-%{_mingw32_datadir}/libosinfo/data/usb.ids
-%{_mingw32_datadir}/libosinfo/data/pci.ids
-%{_mingw32_datadir}/libosinfo/data/devices
-%{_mingw32_datadir}/libosinfo/data/oses
-%{_mingw32_datadir}/libosinfo/data/hypervisors
+%{_mingw32_datadir}/libosinfo/db/usb.ids
+%{_mingw32_datadir}/libosinfo/db/pci.ids
+%{_mingw32_datadir}/libosinfo/db/devices
+%{_mingw32_datadir}/libosinfo/db/oses
+%{_mingw32_datadir}/libosinfo/db/hypervisors
 %{_mingw32_datadir}/libosinfo/schemas/libosinfo.rng
 %{_mingw32_mandir}/man1/osinfo-db-validate.1*
 %{_mingw32_mandir}/man1/osinfo-detect.1*
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 98e2365..23447d1 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -28,7 +28,7 @@ libosinfo_1_0_la_CFLAGS = \
 	$(LIBXML_CFLAGS) \
 	$(GOBJECT_CFLAGS) \
 	$(GIO_CFLAGS) \
-	-DDATA_DIR='"$(pkgdatadir)/data"'
+	-DPKG_DATA_DIR='"$(pkgdatadir)"'
 
 libosinfo_1_0_la_LDFLAGS = \
 	$(COVERAGE_LDFLAGS) \
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 337f737..b009323 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1271,11 +1271,14 @@ void osinfo_loader_process_default_path(OsinfoLoader *loader,
                                         GError **err)
 {
     GFile *file;
+    gchar *dbdir;
     const gchar *path = getenv("OSINFO_DATA_DIR");
     if (!path)
-        path = DATA_DIR;
+        path = PKG_DATA_DIR;
 
-    file = g_file_new_for_path(path);
+    dbdir = g_strdup_printf("%s/db", path);
+
+    file = g_file_new_for_path(dbdir);
     osinfo_loader_process_file(loader,
                                file,
                                err);
-- 
1.7.7.6




More information about the virt-tools-list mailing list