import libosinfo-1.5.0-2.el8

This commit is contained in:
CentOS Sources 2019-08-01 17:47:39 -04:00 committed by Stepan Oksanichenko
commit 9f1bc158af
6 changed files with 484 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/libosinfo-1.5.0.tar.gz

1
.libosinfo.metadata Normal file
View File

@ -0,0 +1 @@
0ec54e6e1972c4fbfc97179f943d4f9a2902b879 SOURCES/libosinfo-1.5.0.tar.gz

View File

@ -0,0 +1,62 @@
From cb509ad153a35053e1e003d73fd0ece53bd2c3d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Tue, 21 May 2019 13:01:26 +0200
Subject: [PATCH 1/3] db: Avoid dereference of null pointer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As any consumer of libosinfo API may pass NULL as the @matched argument
of compare_tree(), the current code could be dereferencing a NULL
pointer when calling `osinfo_tree_set_os()`.
In order to avoid doing so, let's set the os to the OsinfoTree at the
moment the @matched argument is set.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 949ad5e05480470ba1a5913fbec538314807dfc2)
---
osinfo/osinfo_db.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index b7da2b7..c4cd1e4 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -790,6 +790,7 @@ static gboolean compare_tree(OsinfoTree *tree,
OsinfoTreeList *tree_list = osinfo_os_get_tree_list(os);
GList *trees = osinfo_list_get_elements(OSINFO_LIST(tree_list));
GList *tree_iter;
+ gboolean found = FALSE;
for (tree_iter = trees; tree_iter; tree_iter = tree_iter->next) {
OsinfoTree *os_tree = OSINFO_TREE(tree_iter->data);
@@ -820,8 +821,11 @@ static gboolean compare_tree(OsinfoTree *tree,
match_regex(os_treeinfo_version, treeinfo_version) &&
match_regex(os_treeinfo_arch, treeinfo_arch)) {
*ret_os = os;
- if (matched != NULL)
+ if (matched != NULL) {
*matched = os_tree;
+ osinfo_tree_set_os(*matched, *ret_os);
+ found = TRUE;
+ }
break;
}
}
@@ -829,10 +833,8 @@ static gboolean compare_tree(OsinfoTree *tree,
g_list_free(trees);
g_object_unref(tree_list);
- if (*ret_os != NULL) {
- osinfo_tree_set_os(*matched, *ret_os);
+ if (found)
return TRUE;
- }
}
return FALSE;
--
2.21.0

View File

@ -0,0 +1,50 @@
From d1baaf2946513be06f97ab66e7845e14073add3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Tue, 21 May 2019 13:29:18 +0200
Subject: [PATCH 2/3] tree: Avoid use of memory after it's freed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We've been passing data->location as the @url argument of
osinfo_tree_create_from_location_async_helper(), freeing it and trying
to g_strdup() it as the new content of data->location.
In order to avoid doing so, let's set the data->location only once, in
the first caller of osinfo_tree_create_from_location_async_helper(), as
its content is always going to be the same doesn't matter the treeinfo
format to be used with.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit d7bc838a96acf5f058e13d2b49157b4ba396cd87)
---
osinfo/osinfo_tree.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index 88a2d6e..ab498f0 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -702,9 +702,6 @@ osinfo_tree_create_from_location_async_helper(const gchar *url,
g_clear_object(&data->file);
data->file = g_file_new_for_uri(location);
- g_free(data->location);
- data->location = g_strdup(url);
-
g_free(data->treeinfo);
data->treeinfo = g_strdup(treeinfo);
@@ -740,6 +737,8 @@ void osinfo_tree_create_from_location_async(const gchar *location,
user_data);
g_task_set_priority(data->res, priority);
+ data->location = g_strdup(location);
+
osinfo_tree_create_from_location_async_helper(location,
".treeinfo",
cancellable,
--
2.21.0

View File

@ -0,0 +1,92 @@
From 97d60a2e53439d6ad1a462267c3bdf0f09a6f7c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Tue, 21 May 2019 13:33:27 +0200
Subject: [PATCH 3/3] tree: Cleanup _create_from_location_async_helper()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There's no need to pass neither the URL nor the cancellable to this
function as those can be taken directly from data.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit dfda02598034737610b69fdd08d62f62cbf5b0cb)
---
osinfo/osinfo_tree.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index ab498f0..0f14276 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -631,10 +631,8 @@ static OsinfoTree *load_keyinfo(const gchar *location,
}
static void
-osinfo_tree_create_from_location_async_helper(const gchar *url,
- const gchar *treeinfo,
- GCancellable *cancellable,
- CreateFromLocationAsyncData *data);
+osinfo_tree_create_from_location_async_helper(CreateFromLocationAsyncData *data,
+ const gchar *treeinfo);
static void on_location_read(GObject *source,
GAsyncResult *res,
@@ -657,10 +655,7 @@ static void on_location_read(GObject *source,
/* It means no ".treeinfo" file has been found. Try again, this time
* looking for a "treeinfo" file. */
if (g_str_equal(data->treeinfo, ".treeinfo")) {
- osinfo_tree_create_from_location_async_helper(data->location,
- "treeinfo",
- g_task_get_cancellable(data->res),
- data);
+ osinfo_tree_create_from_location_async_helper(data, "treeinfo");
return;
}
@@ -687,17 +682,14 @@ static void on_location_read(GObject *source,
}
static void
-osinfo_tree_create_from_location_async_helper(const gchar *url,
- const gchar *treeinfo,
- GCancellable *cancellable,
- CreateFromLocationAsyncData *data)
+osinfo_tree_create_from_location_async_helper(CreateFromLocationAsyncData *data,
+ const gchar *treeinfo)
{
gchar *location;
- g_return_if_fail(url != NULL);
g_return_if_fail(treeinfo != NULL);
- location = g_strdup_printf("%s/%s", url, treeinfo);
+ location = g_strdup_printf("%s/%s", data->location, treeinfo);
g_clear_object(&data->file);
data->file = g_file_new_for_uri(location);
@@ -706,7 +698,7 @@ osinfo_tree_create_from_location_async_helper(const gchar *url,
data->treeinfo = g_strdup(treeinfo);
g_file_load_contents_async(data->file,
- cancellable,
+ g_task_get_cancellable(data->res),
on_location_read,
data);
g_free(location);
@@ -739,10 +731,7 @@ void osinfo_tree_create_from_location_async(const gchar *location,
data->location = g_strdup(location);
- osinfo_tree_create_from_location_async_helper(location,
- ".treeinfo",
- cancellable,
- data);
+ osinfo_tree_create_from_location_async_helper(data, ".treeinfo");
}
--
2.21.0

278
SPECS/libosinfo.spec Normal file
View File

@ -0,0 +1,278 @@
# -*- rpm-spec -*-
Summary: A library for managing OS information for virtualization
Name: libosinfo
Version: 1.5.0
Release: 2%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
Source: https://releases.pagure.io/%{name}/%{name}-%{version}.tar.gz
URL: https://libosinfo.org/
### Patches ###
Patch0001: 0001-db-Avoid-dereference-of-null-pointer.patch
Patch0002: 0002-tree-Avoid-use-of-memory-after-it-s-freed.patch
Patch0003: 0003-tree-Cleanup-_create_from_location_async_helper.patch
BuildRequires: intltool
BuildRequires: glib2-devel >= 2.38
BuildRequires: libxml2-devel >= 2.6.0
BuildRequires: libxslt-devel >= 1.0.0
BuildRequires: vala
BuildRequires: vala-tools
BuildRequires: libcurl-devel
BuildRequires: /usr/bin/pod2man
BuildRequires: hwdata
BuildRequires: gobject-introspection-devel
Requires: hwdata
Requires: osinfo-db >= 20181011-1
Requires: osinfo-db-tools
Requires: gvfs
%description
libosinfo is a library that allows virtualization provisioning tools to
determine the optimal device settings for a hypervisor/operating system
combination.
%package devel
Summary: Libraries, includes, etc. to compile with the libosinfo library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
Requires: glib2-devel
%description devel
libosinfo is a library that allows virtualization provisioning tools to
determine the optimal device settings for a hypervisor/operating system
combination.
Libraries, includes, etc. to compile with the libosinfo library
%package vala
Summary: Vala bindings
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description vala
libosinfo is a library that allows virtualization provisioning tools to
determine the optimal device settings for a hypervisor/operating system
combination.
This package provides the Vala bindings for libosinfo library.
%prep
%setup -q
for p in %patches ; do
%__patch -p1 -i $p
done
%build
autoreconf -vi
%configure --enable-introspection=yes --enable-vala=yes
%__make %{?_smp_mflags} V=1
chmod a-x examples/*.js examples/*.py
%install
rm -fr %{buildroot}
%__make install DESTDIR=%{buildroot}
rm -f %{buildroot}%{_libdir}/*.a
rm -f %{buildroot}%{_libdir}/*.la
%find_lang %{name}
%check
if ! make check
then
cat tests/test-suite.log || true
exit 1
fi
%ldconfig_scriptlets
%files -f %{name}.lang
%defattr(-, root, root)
%doc AUTHORS ChangeLog COPYING.LIB NEWS README
%{_bindir}/osinfo-detect
%{_bindir}/osinfo-query
%{_bindir}/osinfo-install-script
%{_mandir}/man1/osinfo-detect.1*
%{_mandir}/man1/osinfo-query.1*
%{_mandir}/man1/osinfo-install-script.1*
%{_libdir}/%{name}-1.0.so.*
%{_libdir}/girepository-1.0/Libosinfo-1.0.typelib
%files devel
%defattr(-, root, root)
%doc examples/demo.js
%doc examples/demo.py
%{_libdir}/%{name}-1.0.so
%dir %{_includedir}/%{name}-1.0/
%dir %{_includedir}/%{name}-1.0/osinfo/
%{_includedir}/%{name}-1.0/osinfo/*.h
%{_libdir}/pkgconfig/%{name}-1.0.pc
%{_datadir}/gir-1.0/Libosinfo-1.0.gir
%{_datadir}/gtk-doc/html/Libosinfo
%files vala
%defattr(-, root, root)
%{_datadir}/vala/vapi/libosinfo-1.0.vapi
%changelog
* Wed May 22 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.5.0-2
- Resolves: rhbz#1712425 - New defects found in libosinfo-1.5.0-1.el8
* Fri May 10 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.5.0-1
- Update to 1.5.0 release
- Resolves: rhbz#1699988 - Rebase to the latest upstream release
* Fri Nov 30 2018 Fabiano Fidêncio <fidencio@redhat.com> - 1.2.0-5
- Related: rhbz#1650197 - Fix volume-ids for rhel8.0 entry
* Wed Nov 14 2018 Fabiano Fidêncio <fidencio@redhat.com> - 1.2.0-4
- Resolves: rhbz#1649632 - libosinfo test suite should collect+report all
failures, not exit on first error
* Mon Oct 08 2018 Fabiano Fidêncio <fidencio@redhat.com> - 1.2.0-3
- Related: rhbz#1628027 - Revert ca945cdf04f
* Fri Sep 21 2018 Fabiano Fidêncio <fidencio@redhat.com> - 1.2.0-2
- Resolves: rhbz#1628027 - Force anchored patterns when matching regex
* Wed Jun 20 2018 Daniel P. Berrangé <berrange@redhat.com> - 1.2.0-1
- Update to 1.2.0 release
* Tue Feb 06 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.1.0-2
- Switch to %%ldconfig_scriptlets
* Tue Aug 15 2017 Daniel P. Berrange <berrange@redhat.com> 1.1.0-1
- New upstream release 1.1.0
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Oct 7 2016 Daniel P. Berrange <berrange@redhat.com> 1.0.0-1
- New upstream release 1.0.0
* Fri Jul 1 2016 Daniel P. Berrange <berrange@redhat.com> 0.3.1-1
- New upstream release 0.3.1
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jan 8 2016 Zeeshan Ali <zeenix@redhat.com> 0.3.0-1
- New upstream release 0.3.0
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu May 28 2015 Zeeshan Ali <zeenix@redhat.com> 0.2.12-1
- New upstream release 0.2.12
* Mon Sep 22 2014 Cole Robinson <crobinso@redhat.com> - 0.2.11-2
- os: Add Fedora 21
* Tue Aug 26 2014 Christophe Fergeau <cfergeau@redhat.com> 0.2.11-1
- New upstream release 0.2.11
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Tue Jul 22 2014 Kalev Lember <kalevlember@gmail.com> - 0.2.9-3
- Rebuilt for gobject-introspection 1.41.4
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Dec 18 2013 Debarshi Ray <rishi@fedoraproject.org> - 0.2.9-1
- New upstream release 0.2.9
* Thu Nov 28 2013 Zeeshan Ali <zeenix@redhat.com> - 0.2.8-1
- New upstream release 0.2.8
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue May 14 2013 Zeeshan Ali <zeenix@redhat.com> - 0.2.7-1
- New upstream release 0.2.7
* Thu Mar 21 2013 Zeeshan Ali <zeenix@redhat.com> - 0.2.6-1
- New upstream release 0.2.6
* Wed Mar 06 2013 Christophe Fergeau <cfergeau@redhat.com> - 0.2.5-2
- BuildRequires /usr/bin/pod2man as this will automatically pick the right
package rather than conditionally requiring a package that is only
available in f19+
- Do not Requires: udev when building libosinfo without its udev rule
(which is done on f19+)
* Tue Mar 05 2013 Christophe Fergeau <cfergeau@redhat.com> 0.2.5-1
- New upstream release 0.2.5
- Disable udev rule as it's no longer required with newer
systemd/util-linux
* Tue Feb 12 2013 Cole Robinson <crobinso@redhat.com> - 0.2.3-2
- Fix osinfo-detect crash with non-bootable media (bz #901910)
* Mon Jan 14 2013 Zeeshan Ali <zeenix@redhat.com> - 0.2.3-1
- New upstream release 0.2.3
* Thu Dec 20 2012 Christophe Fergeau <cfergeau@redhat.com> - 0.2.2-1
- New upstream release 0.2.2
* Fri Oct 12 2012 Zeeshan Ali <zeenix@redhat.com> - 0.2.1-1
- Fix and simplify udev rule.
- Fedora:
- Fix minimum RAM requirements for F16 and F17.
- Add data on:
- Fedora 18
- GNOME 3.6
- Ubuntu 12.10
- Fixes to doc build.
- Install script:
- Add get_config_param method.
- Differenciate between expected/output script names.
- Add more utility functions.
- Add 'installer-reboots' parameter to medias.
- osinfo-detect does not die of DB loading errors anymore.
- More type-specific entity value getters/setters.
- Fixe and update RNG file.
- Add 'subsystem' property/attribute to devices.
* Mon Sep 03 2012 Christophe Fergeau <cfergeau@redhat.com> - 0.2.0-1
- Update to 0.2.0 release.
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Jun 12 2012 Zeeshan Ali <zeenix@redhat.com> - 0.1.2-1
- Update to 0.1.2 release.
* Thu Apr 12 2012 Zeeshan Ali <zeenix@redhat.com> - 0.1.1-1
- Update to 0.1.1 release.
* Wed Mar 14 2012 Daniel P. Berrange <berrange@redhat.com> - 0.1.0-2
- Remove obsolete perl based scripts (rhbz #803086)
* Wed Feb 08 2012 Christophe Fergeau <cfergeau@redhat.com> - 0.1.0-1
- Update to 0.1.0 release
* Tue Jan 17 2012 Zeeshan Ali <zeenix@redhat.com> - 0.0.5-1
- Update to 0.0.5 release
* Tue Jan 3 2012 Daniel P. Berrange <berrange@redhat.com> - 0.0.4-2
- Remove pointless gir conditionals
* Wed Dec 21 2011 Daniel P. Berrange <berrange@redhat.com> - 0.0.4-1
- Update to 0.0.4 release
* Thu Nov 24 2011 Daniel P. Berrange <berrange@redhat.com> - 0.0.2-1
- Initial package