From ptoscano at redhat.com Thu Nov 1 09:54:42 2018 From: ptoscano at redhat.com (Pino Toscano) Date: Thu, 01 Nov 2018 10:54:42 +0100 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <20181031225532.GC27120@redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> <20181031225532.GC27120@redhat.com> Message-ID: <3548135.3KWU9aikAW@thyrus.usersys.redhat.com> On Wednesday, 31 October 2018 23:55:32 CET Richard W.M. Jones wrote: > On Wed, Oct 31, 2018 at 10:45:32PM +0100, Fabiano Fid?ncio wrote: > > Last but not least, I'm cc'ing here Richard Jones and Pino Toscano in > > order to get their input in the libguestfs bits ... mainly to know > > whether explicitly depending on libguestfs is a good idea or not (and, > > if not, to get some feedback on different approaches that could be > > taken). > > libguestfs is a pretty large dependency. It's also circular > (libguestfs uses libosinfo!) libguestfs does not use libosinfo. virt-builder-repository uses osinfo-db, reading its files directly. -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part. URL: From rjones at redhat.com Thu Nov 1 10:04:24 2018 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 1 Nov 2018 10:04:24 +0000 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <3548135.3KWU9aikAW@thyrus.usersys.redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> <20181031225532.GC27120@redhat.com> <3548135.3KWU9aikAW@thyrus.usersys.redhat.com> Message-ID: <20181101100424.GF27120@redhat.com> On Thu, Nov 01, 2018 at 10:54:42AM +0100, Pino Toscano wrote: > On Wednesday, 31 October 2018 23:55:32 CET Richard W.M. Jones wrote: > > On Wed, Oct 31, 2018 at 10:45:32PM +0100, Fabiano Fid?ncio wrote: > > > Last but not least, I'm cc'ing here Richard Jones and Pino Toscano in > > > order to get their input in the libguestfs bits ... mainly to know > > > whether explicitly depending on libguestfs is a good idea or not (and, > > > if not, to get some feedback on different approaches that could be > > > taken). > > > > libguestfs is a pretty large dependency. It's also circular > > (libguestfs uses libosinfo!) > > libguestfs does not use libosinfo. Yes you're right, I forgot we removed the code which parsed the osinfo database in libguestfs >= 1.38. > virt-builder-repository uses osinfo-db, reading its files directly. Also virt-v2v will use libosinfo in the near future to get Q35 info about guests. I don't think this changes the point that libosinfo should have only a soft dependency on libguestfs. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW From berrange at redhat.com Thu Nov 1 10:09:03 2018 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 1 Nov 2018 10:09:03 +0000 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <20181031214538.18186-1-fidencio@redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> Message-ID: <20181101100903.GA23712@redhat.com> On Wed, Oct 31, 2018 at 10:45:32PM +0100, Fabiano Fid?ncio wrote: > This patchset adds support to images entries as part of the "os" entry > in a very similar way that's already done for both medias and trees. > > It's important to note that in order to do so, we've added a libguestfs > dependency used when creating an OsinfoImage from location (more details > in the second patch of the series). > > An example of how the XML will look like is: > > > > https://download/foo/bar.img > Ditro Foo (Cloud Edition) > > > > Last but not least, I'm cc'ing here Richard Jones and Pino Toscano in > order to get their input in the libguestfs bits ... mainly to know > whether explicitly depending on libguestfs is a good idea or not (and, > if not, to get some feedback on different approaches that could be > taken). I don't like the dependancy on libguestfs here, because I don't think it is actually adding any value to libosinfo in this way, while being a very significant dependency. If the application has an OS and wants to find the URL, then they can just query the osinfo DB and get the URL so they don't need libguestfs. This part of your proposal wrt recording XML is fine. If the application has a URL and wants to find the OS, then the public libguestfs API already provides that feature, so I don't see a major benefit in wrapping this again. Just let apps call the libguestfs API directly with the image URL allowing them full flexibility it has. For ISO and install tree identification, we've recorded identifying metadata in the osinfo database. eg ISO header regexes, and treeinfo file regexes. IMHO if we did want todo image detection in osinfo we should be doing the same by providing identifying metadata in the osinfo database. ie the osinfo db would contain regex matches to do done against files such as /etc/os-release (or lsb-release, redhat-release, etc). ie essentially encode the file content probing rules that libguestfs has, as osinfo DB information, so that it becomes user extendable in the normal way we do for ISO/install tree. Admittedly the image probing rules are significantly more complicated than ISO/install tree probiing rules, but I think it is doable if we wanted to. It ultimately just comes down to a (very large) set of file content matches. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From rjones at redhat.com Thu Nov 1 11:06:11 2018 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 1 Nov 2018 11:06:11 +0000 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <20181101100903.GA23712@redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> <20181101100903.GA23712@redhat.com> Message-ID: <20181101110611.GA25226@redhat.com> On Thu, Nov 01, 2018 at 10:09:03AM +0000, Daniel P. Berrang? wrote: > ie essentially encode the file content probing rules that libguestfs > has, as osinfo DB information, so that it becomes user extendable in > the normal way we do for ISO/install tree. Admittedly the image probing > rules are significantly more complicated than ISO/install tree probiing > rules, but I think it is doable if we wanted to. It ultimately just > comes down to a (very large) set of file content matches. It's rather more complicated than that. It's definitely not true to say that libguestfs is just doing some regexps over files. Also I think this duplicates the functionality of other tools (notably facter, but there are others). Just tell people to use facter if they are running "in guest". Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW From berrange at redhat.com Thu Nov 1 11:12:45 2018 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 1 Nov 2018 11:12:45 +0000 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <20181101110611.GA25226@redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> <20181101100903.GA23712@redhat.com> <20181101110611.GA25226@redhat.com> Message-ID: <20181101111245.GB23712@redhat.com> On Thu, Nov 01, 2018 at 11:06:11AM +0000, Richard W.M. Jones wrote: > On Thu, Nov 01, 2018 at 10:09:03AM +0000, Daniel P. Berrang? wrote: > > ie essentially encode the file content probing rules that libguestfs > > has, as osinfo DB information, so that it becomes user extendable in > > the normal way we do for ISO/install tree. Admittedly the image probing > > rules are significantly more complicated than ISO/install tree probiing > > rules, but I think it is doable if we wanted to. It ultimately just > > comes down to a (very large) set of file content matches. > > It's rather more complicated than that. It's definitely not true to > say that libguestfs is just doing some regexps over files. I've not looked at all the OS match rules libguestfs has, but for the Linux matches, it looks like just file existance/content matches I'm looking at "check_filesystem" which has a bunch of logic like: (* Minix root? *) else if Is.is_dir "/etc" && Is.is_dir "/bin" && Is.is_file "/service/vm" && Is.is_file "/etc/fstab" && Is.is_file "/etc/version" then ( debug_matching "Minix root"; role := `Root; Inspect_fs_unix.check_minix_root data; ) (* Linux root? *) else if Is.is_dir "/etc" && (Is.is_dir "/bin" || is_symlink_to "/bin" "usr/bin") && (Is.is_file "/etc/fstab" || Is.is_file "/etc/hosts") then ( debug_matching "Linux root"; role := `Root; Inspect_fs_unix.check_linux_root mountable data; ) (* CoreOS root? *) else if Is.is_dir "/etc" && Is.is_dir "/root" && Is.is_dir "/home" && Is.is_dir "/usr" && Is.is_file "/etc/coreos/update.conf" then ( debug_matching "CoreOS root"; role := `Root; Inspect_fs_unix.check_coreos_root mountable data; ) And then looking at check_linux_root just iterates over the filename content regex matches defined in linux_root_tests. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From rjones at redhat.com Thu Nov 1 11:23:36 2018 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 1 Nov 2018 11:23:36 +0000 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <20181101111245.GB23712@redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> <20181101100903.GA23712@redhat.com> <20181101110611.GA25226@redhat.com> <20181101111245.GB23712@redhat.com> Message-ID: <20181101112336.GG27120@redhat.com> On Thu, Nov 01, 2018 at 11:12:45AM +0000, Daniel P. Berrang? wrote: > On Thu, Nov 01, 2018 at 11:06:11AM +0000, Richard W.M. Jones wrote: > > On Thu, Nov 01, 2018 at 10:09:03AM +0000, Daniel P. Berrang? wrote: > > > ie essentially encode the file content probing rules that libguestfs > > > has, as osinfo DB information, so that it becomes user extendable in > > > the normal way we do for ISO/install tree. Admittedly the image probing > > > rules are significantly more complicated than ISO/install tree probiing > > > rules, but I think it is doable if we wanted to. It ultimately just > > > comes down to a (very large) set of file content matches. > > > > It's rather more complicated than that. It's definitely not true to > > say that libguestfs is just doing some regexps over files. > > I've not looked at all the OS match rules libguestfs has, but for the > Linux matches, it looks like just file existance/content matches > > I'm looking at "check_filesystem" which has a bunch of logic like: > > (* Minix root? *) > else if Is.is_dir "/etc" && > Is.is_dir "/bin" && > Is.is_file "/service/vm" && > Is.is_file "/etc/fstab" && > Is.is_file "/etc/version" then ( > debug_matching "Minix root"; > role := `Root; > Inspect_fs_unix.check_minix_root data; > ) > (* Linux root? *) > else if Is.is_dir "/etc" && > (Is.is_dir "/bin" || > is_symlink_to "/bin" "usr/bin") && > (Is.is_file "/etc/fstab" || > Is.is_file "/etc/hosts") then ( > debug_matching "Linux root"; > role := `Root; > Inspect_fs_unix.check_linux_root mountable data; > ) > (* CoreOS root? *) > else if Is.is_dir "/etc" && > Is.is_dir "/root" && > Is.is_dir "/home" && > Is.is_dir "/usr" && > Is.is_file "/etc/coreos/update.conf" then ( > debug_matching "CoreOS root"; > role := `Root; > Inspect_fs_unix.check_coreos_root mountable data; > ) > > And then looking at check_linux_root just iterates over the > filename content regex matches defined in linux_root_tests. This is to ignore the ordering in which operations take place, the integration of the data structures derived from various filesystems into a single data structure, and numerous tweaks that we've applied over the years because the source data is really dirty. The code above is fairly simple, but the code in this file is not at all: https://github.com/libguestfs/libguestfs/blob/master/daemon/inspect_fs_unix.ml I guess we want to identify Windows too, and that code looks deep into the Windows Registry. Anyway I originally wanted to use Facter when rewriting it in 1.38, but IIRC Facter was at that time written in Ruby so couldn't go into the appliance (plus it didn't have all the features required). I think it's now rewritten in something else (C++?) but parts of it still seem to be in Ruby. I think we should tell people to use Facter for the "running in guest" case. It does what they want and is likely to be better and simpler than any mess of regular expressions we can come up with. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/ From felipeborges at gnome.org Thu Nov 1 12:40:34 2018 From: felipeborges at gnome.org (Felipe Borges) Date: Thu, 1 Nov 2018 13:40:34 +0100 Subject: [Libosinfo] [osinfo-db PATCH 1/3] fedora: Update f29 data In-Reply-To: <1540911908-30368-1-git-send-email-fabiano@fidencio.org> References: <1540911908-30368-1-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Oct 30, 2018 at 7:05 PM Fabiano Fid?ncio wrote: > > Signed-off-by: Fabiano Fid?ncio > --- > data/os/fedoraproject.org/fedora-29.xml.in | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) Reviewed-by: Felipe Borges Thanks! Felipe. From felipe10borges at gmail.com Thu Nov 1 12:40:55 2018 From: felipe10borges at gmail.com (Felipe Borges) Date: Thu, 1 Nov 2018 13:40:55 +0100 Subject: [Libosinfo] [osinfo-db PATCH] fixup! fedora: Update f29 data In-Reply-To: <1540920487-2849-1-git-send-email-fabiano@fidencio.org> References: <1540920487-2849-1-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Oct 30, 2018 at 11:09 PM Fabiano Fid?ncio wrote: > > --- > This patch is a fixup of: > [osinfo-db PATCH 1/3] fedora: Update f29 data > > (I'd add the link to the ML, but seems that the patches are not shown in our archives yet) > --- > > data/os/fedoraproject.org/fedora-29.xml.in | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) Reviewed-by: Felipe Borges Thanks! Felipe. From felipe10borges at gmail.com Thu Nov 1 12:43:47 2018 From: felipe10borges at gmail.com (Felipe Borges) Date: Thu, 1 Nov 2018 13:43:47 +0100 Subject: [Libosinfo] [libosinfo PATCH 1/2] tests: Update f29 isodata In-Reply-To: <1540911943-32719-1-git-send-email-fabiano@fidencio.org> References: <1540911943-32719-1-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Oct 30, 2018 at 7:05 PM Fabiano Fid?ncio wrote: > > Signed-off-by: Fabiano Fid?ncio > --- > ...Fedora-Everything-netinst-x86_64-29-1.2.iso.txt | 29 ++++++++++++++++++++++ > .../Fedora-Server-dvd-x86_64-29-1.2.iso.txt | 29 ++++++++++++++++++++++ > .../Fedora-Server-dvd-x86_64-29_Beta-1.5.iso.txt | 29 ---------------------- > .../Fedora-Server-netinst-x86_64-29-1.2.iso.txt | 29 ++++++++++++++++++++++ > ...edora-Server-netinst-x86_64-29_Beta-1.5.iso.txt | 29 ---------------------- > ...ora-Workstation-Live-x86_64-29_Beta-1.5.iso.txt | 29 ---------------------- > ...edora-Workstation-netinst-x86_64-29-1.2.iso.txt | 29 ++++++++++++++++++++++ > ...-Workstation-netinst-x86_64-29_Beta-1.5.iso.txt | 29 ---------------------- > 8 files changed, 116 insertions(+), 116 deletions(-) > create mode 100644 tests/isodata/fedora/fedora29/Fedora-Everything-netinst-x86_64-29-1.2.iso.txt > create mode 100644 tests/isodata/fedora/fedora29/Fedora-Server-dvd-x86_64-29-1.2.iso.txt > delete mode 100644 tests/isodata/fedora/fedora29/Fedora-Server-dvd-x86_64-29_Beta-1.5.iso.txt > create mode 100644 tests/isodata/fedora/fedora29/Fedora-Server-netinst-x86_64-29-1.2.iso.txt > delete mode 100644 tests/isodata/fedora/fedora29/Fedora-Server-netinst-x86_64-29_Beta-1.5.iso.txt > delete mode 100644 tests/isodata/fedora/fedora29/Fedora-Workstation-Live-x86_64-29_Beta-1.5.iso.txt > create mode 100644 tests/isodata/fedora/fedora29/Fedora-Workstation-netinst-x86_64-29-1.2.iso.txt > delete mode 100644 tests/isodata/fedora/fedora29/Fedora-Workstation-netinst-x86_64-29_Beta-1.5.iso.txt Sure, testings are passing here. Reviewed-by: Felipe Borges Thanks! Felipe. From fidencio at redhat.com Thu Nov 1 12:45:05 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 13:45:05 +0100 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH v2 0/5] Add support to images Message-ID: <20181101124510.3223-1-fidencio@redhat.com> This patchset adds support to images entries as part of the "os" entry in order to allow Apps to have access to the Images URLs (and that's the only usage planned for now). An example of how the XML will look like is: https://download/foo/bar.img - Changes since v1: - Dropped the osinfo_db_image_create_from_location() and osinfo_db_identify_image() APIs as we've agreed to leave those bits for libguestfs :-) Consequently, libguestfs dependancy has been dropped. - https://www.redhat.com/archives/libosinfo/2018-October/msg00153.html * osinfo-db: Fabiano Fid?ncio (1): schema: Add support for pre-installed images data/schema/osinfo.rng.in | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) *libosinfo: Fabiano Fid?ncio (4): Introduce OsinfoImage object Introduce OsinfoImageList object os: Introduce APIs to deal with images loader: Load Images information osinfo/Makefile.am | 4 + osinfo/libosinfo.syms | 9 ++ osinfo/osinfo.h | 2 + osinfo/osinfo_image.c | 225 ++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_image.h | 89 +++++++++++++++ osinfo/osinfo_imagelist.c | 90 +++++++++++++++ osinfo/osinfo_imagelist.h | 77 +++++++++++++ osinfo/osinfo_loader.c | 40 +++++++ osinfo/osinfo_os.c | 37 +++++++ osinfo/osinfo_os.h | 4 + po/POTFILES.in | 1 + 11 files changed, 578 insertions(+) create mode 100644 osinfo/osinfo_image.c create mode 100644 osinfo/osinfo_image.h create mode 100644 osinfo/osinfo_imagelist.c create mode 100644 osinfo/osinfo_imagelist.h -- 2.19.1 From fidencio at redhat.com Thu Nov 1 12:45:06 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 13:45:06 +0100 Subject: [Libosinfo] [osinfo-db PATCH v2 1/5] schema: Add support for pre-installed images In-Reply-To: <20181101124510.3223-1-fidencio@redhat.com> References: <20181101124510.3223-1-fidencio@redhat.com> Message-ID: <20181101124510.3223-2-fidencio@redhat.com> Let's create a new element called "image", which will be added to the "os" element. By adding the new "image" element, we'll start supporting pre-installed images, at least in order to provide their link to Apps consuming osinfo-db. The xml entry will be similar to: https://download/foo/bar.img https://gitlab.com/libosinfo/osinfo-db/issues/10 Signed-off-by: Fabiano Fid?ncio --- data/schema/osinfo.rng.in | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/data/schema/osinfo.rng.in b/data/schema/osinfo.rng.in index 6693391..c376416 100644 --- a/data/schema/osinfo.rng.in +++ b/data/schema/osinfo.rng.in @@ -473,6 +473,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -543,6 +564,9 @@ + + + -- 2.19.1 From fidencio at redhat.com Thu Nov 1 12:45:07 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 13:45:07 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 2/5] Introduce OsinfoImage object In-Reply-To: <20181101124510.3223-1-fidencio@redhat.com> References: <20181101124510.3223-1-fidencio@redhat.com> Message-ID: <20181101124510.3223-3-fidencio@redhat.com> OsinfoImage object has been created to represent pre-installed images distributed by the OSes. We've decided to go for the simplespet approach possible that's just exposing the Image URL for an existing OS and then Apps that want to deal with the Image itself can just use libguestfs for that as they already do a quite good job on this field. https://gitlab.com/libosinfo/osinfo-db/issues/10 Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 6 ++ osinfo/osinfo.h | 1 + osinfo/osinfo_image.c | 225 ++++++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_image.h | 89 +++++++++++++++++ po/POTFILES.in | 1 + 6 files changed, 324 insertions(+) create mode 100644 osinfo/osinfo_image.c create mode 100644 osinfo/osinfo_image.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 86f6344..800770e 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -98,6 +98,7 @@ libosinfo_1_0_include_HEADERS = \ osinfo_resourceslist.h \ osinfo_tree.h \ osinfo_treelist.h \ + osinfo_image.h \ $(NULL) nodist_libosinfo_1_0_include_HEADERS = \ @@ -141,6 +142,7 @@ libosinfo_c_files = \ osinfo_resourceslist.c \ osinfo_tree.c \ osinfo_treelist.c \ + osinfo_image.c \ osinfo_db.c \ osinfo_loader.c \ $(NULL) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index db9b8b2..f827fe4 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -532,6 +532,12 @@ LIBOSINFO_0.2.13 { LIBOSINFO_1.3.0 { global: osinfo_error_quark; + + osinfo_image_error_quark; + osinfo_image_get_architecture; + osinfo_image_get_type; + osinfo_image_get_url; + osinfo_image_new; } LIBOSINFO_0.2.13; /* Symbols in next release... diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 8d0a595..9e8e604 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -65,6 +65,7 @@ #include #include #include +#include #include #endif diff --git a/osinfo/osinfo_image.c b/osinfo/osinfo_image.c new file mode 100644 index 0000000..5f76336 --- /dev/null +++ b/osinfo/osinfo_image.c @@ -0,0 +1,225 @@ +/* + * libosinfo: An installed image of a (guest) OS + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include +#include +#include +#include +#include + +GQuark +osinfo_image_error_quark(void) +{ + static GQuark quark = 0; + + if (!quark) + quark = g_quark_from_static_string("osinfo-image-error"); + + return quark; +} + +G_DEFINE_TYPE(OsinfoImage, osinfo_image, OSINFO_TYPE_ENTITY); + +#define OSINFO_IMAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ + OSINFO_TYPE_IMAGE, \ + OsinfoImagePrivate)) + +/** + * SECTION:osinfo_image + * @short_description: An installation image for a (guest) OS + * @see_also: #OsinfoOs + * + * #OsinfoImage is an entity representing an installation image + * a (guest) operating system. + */ + +struct _OsinfoImagePrivate +{ + gboolean unused; +}; + +enum { + PROP_0, + + PROP_ARCHITECTURE, + PROP_URL, +}; + +static void +osinfo_image_get_property(GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + OsinfoImage *image = OSINFO_IMAGE(object); + + switch (property_id) { + case PROP_ARCHITECTURE: + g_value_set_string(value, osinfo_image_get_architecture(image)); + break; + + case PROP_URL: + g_value_set_string(value, osinfo_image_get_url(image)); + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + break; + } +} + +static void +osinfo_image_set_property(GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + OsinfoImage *image = OSINFO_IMAGE(object); + + switch (property_id) { + case PROP_ARCHITECTURE: + osinfo_entity_set_param(OSINFO_ENTITY(image), + OSINFO_IMAGE_PROP_ARCHITECTURE, + g_value_get_string(value)); + break; + + case PROP_URL: + osinfo_entity_set_param(OSINFO_ENTITY(image), + OSINFO_IMAGE_PROP_URL, + g_value_get_string(value)); + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + break; + } +} + +static void +osinfo_image_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_image_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_image_class_init(OsinfoImageClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + GParamSpec *pspec; + + g_klass->finalize = osinfo_image_finalize; + g_klass->get_property = osinfo_image_get_property; + g_klass->set_property = osinfo_image_set_property; + g_type_class_add_private(klass, sizeof(OsinfoImagePrivate)); + + /** + * OsinfoImage:architecture: + * + * The target hardware architecture of this image. + */ + pspec = g_param_spec_string("architecture", + "ARCHITECTURE", + _("CPU Architecture"), + NULL /* default value */, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, PROP_ARCHITECTURE, pspec); + + /** + * OsinfoImage:url: + * + * The URL to this image. + */ + pspec = g_param_spec_string("url", + "URL", + _("The URL to this image"), + NULL /* default value */, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, PROP_URL, pspec); +} + +static void +osinfo_image_init(OsinfoImage *image) +{ + image->priv = OSINFO_IMAGE_GET_PRIVATE(image); +} + +OsinfoImage *osinfo_image_new(const gchar *id, + const gchar *architecture) +{ + OsinfoImage *image; + + image = g_object_new(OSINFO_TYPE_IMAGE, + "id", id, + NULL); + + osinfo_entity_set_param(OSINFO_ENTITY(image), + OSINFO_IMAGE_PROP_ARCHITECTURE, + architecture); + + return image; +} + +/** + * osinfo_image_get_architecture: + * @image: an #OsinfoImage instance + * + * Retrieves the target hardware architecture of the OS @image provides. + * + * Returns: (transfer none): the hardware architecture, or NULL + */ +const gchar *osinfo_image_get_architecture(OsinfoImage *image) +{ + return osinfo_entity_get_param_value(OSINFO_ENTITY(image), + OSINFO_IMAGE_PROP_ARCHITECTURE); +} + +/** + * osinfo_image_get_url: + * @image: an #OsinfoImage instance + * + * The URL to the @image + * + * Returns: (transfer none): the URL, or NULL + */ +const gchar *osinfo_image_get_url(OsinfoImage *image) +{ + return osinfo_entity_get_param_value(OSINFO_ENTITY(image), + OSINFO_IMAGE_PROP_URL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_image.h b/osinfo/osinfo_image.h new file mode 100644 index 0000000..2f9e6d6 --- /dev/null +++ b/osinfo/osinfo_image.h @@ -0,0 +1,89 @@ +/* + * libosinfo: An installed image of a (guest) OS + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include +#include +#include + +#ifndef __OSINFO_IMAGE_H__ +#define __OSINFO_IMAGE_H__ + +GQuark +osinfo_image_error_quark (void) G_GNUC_CONST; + +#define OSINFO_IMAGE_ERROR (osinfo_image_error_quark ()) + + +/* + * Type macros. + */ +#define OSINFO_TYPE_IMAGE (osinfo_image_get_type ()) +#define OSINFO_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_IMAGE, OsinfoImage)) +#define OSINFO_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_IMAGE)) +#define OSINFO_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_IMAGE, OsinfoImageClass)) +#define OSINFO_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_IMAGE)) +#define OSINFO_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_IMAGE, OsinfoImageClass)) + +typedef struct _OsinfoImage OsinfoImage; + +typedef struct _OsinfoImageClass OsinfoImageClass; + +typedef struct _OsinfoImagePrivate OsinfoImagePrivate; + +#define OSINFO_IMAGE_PROP_ARCHITECTURE "architecture" +#define OSINFO_IMAGE_PROP_URL "url" + +/* object */ +struct _OsinfoImage +{ + OsinfoEntity parent_instance; + + /* public */ + + /* private */ + OsinfoImagePrivate *priv; +}; + +/* class */ +struct _OsinfoImageClass +{ + /*< private >*/ + OsinfoEntityClass parent_class; + + /* class members */ +}; + +GType osinfo_image_get_type(void); + +OsinfoImage *osinfo_image_new(const gchar *id, const gchar *architecture); +const gchar *osinfo_image_get_architecture(OsinfoImage *image); +const gchar *osinfo_image_get_url(OsinfoImage *image); + +#endif /* __OSINFO_IMAGE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/po/POTFILES.in b/po/POTFILES.in index fc81f42..2a714df 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -3,6 +3,7 @@ osinfo/osinfo_deployment.c osinfo/osinfo_devicelink.c osinfo/osinfo_devicelinkfilter.c osinfo/osinfo_entity.c +osinfo/osinfo_image.c osinfo/osinfo_install_config_param.c osinfo/osinfo_install_script.c osinfo/osinfo_list.c -- 2.19.1 From fidencio at redhat.com Thu Nov 1 12:45:08 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 13:45:08 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 3/5] Introduce OsinfoImageList object In-Reply-To: <20181101124510.3223-1-fidencio@redhat.com> References: <20181101124510.3223-1-fidencio@redhat.com> Message-ID: <20181101124510.3223-4-fidencio@redhat.com> OsinfoImageList object represents has been created to easily deal with OsinfoImage objects. https://gitlab.com/libosinfo/osinfo-db/issues/10 Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 3 ++ osinfo/osinfo.h | 1 + osinfo/osinfo_imagelist.c | 90 +++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_imagelist.h | 77 +++++++++++++++++++++++++++++++++ 5 files changed, 173 insertions(+) create mode 100644 osinfo/osinfo_imagelist.c create mode 100644 osinfo/osinfo_imagelist.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 800770e..19a783f 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -99,6 +99,7 @@ libosinfo_1_0_include_HEADERS = \ osinfo_tree.h \ osinfo_treelist.h \ osinfo_image.h \ + osinfo_imagelist.h \ $(NULL) nodist_libosinfo_1_0_include_HEADERS = \ @@ -143,6 +144,7 @@ libosinfo_c_files = \ osinfo_tree.c \ osinfo_treelist.c \ osinfo_image.c \ + osinfo_imagelist.c \ osinfo_db.c \ osinfo_loader.c \ $(NULL) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index f827fe4..aeb74a7 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -538,6 +538,9 @@ LIBOSINFO_1.3.0 { osinfo_image_get_type; osinfo_image_get_url; osinfo_image_new; + + osinfo_imagelist_get_type; + osinfo_imagelist_new; } LIBOSINFO_0.2.13; /* Symbols in next release... diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 9e8e604..81c0daf 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #endif diff --git a/osinfo/osinfo_imagelist.c b/osinfo/osinfo_imagelist.c new file mode 100644 index 0000000..9e91546 --- /dev/null +++ b/osinfo/osinfo_imagelist.c @@ -0,0 +1,90 @@ +/* + * libosinfo: a list of installed images + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include +#include + +G_DEFINE_TYPE(OsinfoImageList, osinfo_imagelist, OSINFO_TYPE_LIST); + +#define OSINFO_IMAGELIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OSINFO_TYPE_IMAGELIST, OsinfoImageListPrivate)) + +/** + * SECTION:osinfo_imagelist + * @short_description: A list of installation image + * @see_also: #OsinfoList, #OsinfoImage + * + * #OsinfoImageList is a list specialization that stores + * only #OsinfoImage objects. + */ + +struct _OsinfoImageListPrivate +{ + gboolean unused; +}; + +static void +osinfo_imagelist_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_imagelist_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_imagelist_class_init(OsinfoImageListClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + + g_klass->finalize = osinfo_imagelist_finalize; + g_type_class_add_private(klass, sizeof(OsinfoImageListPrivate)); +} + +static void +osinfo_imagelist_init(OsinfoImageList *list) +{ + list->priv = OSINFO_IMAGELIST_GET_PRIVATE(list); +} + +/** + * osinfo_imagelist_new: + * + * Construct a new image list that is initially empty. + * + * Returns: (transfer full): an empty image list + */ +OsinfoImageList *osinfo_imagelist_new(void) +{ + return g_object_new(OSINFO_TYPE_IMAGELIST, + "element-type", OSINFO_TYPE_IMAGE, + NULL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_imagelist.h b/osinfo/osinfo_imagelist.h new file mode 100644 index 0000000..2a7a386 --- /dev/null +++ b/osinfo/osinfo_imagelist.h @@ -0,0 +1,77 @@ +/* + * libosinfo: a list of installed images + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include +#include + +#ifndef __OSINFO_IMAGELIST_H__ +#define __OSINFO_IMAGELIST_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_IMAGELIST (osinfo_imagelist_get_type ()) +#define OSINFO_IMAGELIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_IMAGELIST, OsinfoImageList)) +#define OSINFO_IS_IMAGELIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_IMAGELIST)) +#define OSINFO_IMAGELIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_IMAGELIST, OsinfoImageListClass)) +#define OSINFO_IS_IMAGELIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_IMAGELIST)) +#define OSINFO_IMAGELIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_IMAGELIST, OsinfoImageListClass)) + +typedef struct _OsinfoImageList OsinfoImageList; + +typedef struct _OsinfoImageListClass OsinfoImageListClass; + +typedef struct _OsinfoImageListPrivate OsinfoImageListPrivate; + +/* object */ +struct _OsinfoImageList +{ + OsinfoList parent_instance; + + /* public */ + + /* private */ + OsinfoImageListPrivate *priv; +}; + +/* class */ +struct _OsinfoImageListClass +{ + /*< private >*/ + OsinfoListClass parent_class; + + /* class members */ +}; + +GType osinfo_imagelist_get_type(void); + +OsinfoImageList *osinfo_imagelist_new(void); + +#endif /* __OSINFO_IMAGELIST_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.1 From fidencio at redhat.com Thu Nov 1 12:45:09 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 13:45:09 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 4/5] os: Introduce APIs to deal with images In-Reply-To: <20181101124510.3223-1-fidencio@redhat.com> References: <20181101124510.3223-1-fidencio@redhat.com> Message-ID: <20181101124510.3223-5-fidencio@redhat.com> Let's introduce the needed APIs on os side to deal will the images. For now, there's no info being loaded as the loader part depends on one of these APIs. https://gitlab.com/libosinfo/osinfo-db/issues/10 Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_os.c | 37 +++++++++++++++++++++++++++++++++++++ osinfo/osinfo_os.h | 4 ++++ 2 files changed, 41 insertions(+) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 4f74331..6e12a06 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -52,6 +52,7 @@ struct _OsinfoOsPrivate OsinfoMediaList *medias; OsinfoTreeList *trees; + OsinfoImageList *images; OsinfoOsVariantList *variants; OsinfoResourcesList *minimum; OsinfoResourcesList *recommended; @@ -116,6 +117,7 @@ osinfo_os_finalize(GObject *object) g_list_free(os->priv->deviceLinks); g_object_unref(os->priv->medias); g_object_unref(os->priv->trees); + g_object_unref(os->priv->images); g_object_unref(os->priv->variants); g_object_unref(os->priv->minimum); g_object_unref(os->priv->recommended); @@ -181,6 +183,7 @@ osinfo_os_init(OsinfoOs *os) os->priv->deviceLinks = NULL; os->priv->medias = osinfo_medialist_new(); os->priv->trees = osinfo_treelist_new(); + os->priv->images = osinfo_imagelist_new(); os->priv->variants = osinfo_os_variantlist_new(); os->priv->minimum = osinfo_resourceslist_new(); os->priv->recommended = osinfo_resourceslist_new(); @@ -494,6 +497,40 @@ void osinfo_os_add_tree(OsinfoOs *os, OsinfoTree *tree) osinfo_list_add(OSINFO_LIST(os->priv->trees), OSINFO_ENTITY(tree)); } +/** + * osinfo_os_get_image_list: + * @os: an operating system + * + * Get all installed images associated with operating system @os. + * + * Returns: (transfer full): A list of images + */ +OsinfoImageList *osinfo_os_get_image_list(OsinfoOs *os) +{ + g_return_val_if_fail(OSINFO_IS_OS(os), NULL); + + OsinfoImageList *newList = osinfo_imagelist_new(); + + osinfo_list_add_all(OSINFO_LIST(newList), OSINFO_LIST(os->priv->images)); + + return newList; +} + +/** + * osinfo_os_add_image: + * @os: an operating system + * @image: (transfer none): the image to add + * + * Adds an installed image @image to operating system @os. + */ +void osinfo_os_add_image(OsinfoOs *os, OsinfoImage *image) +{ + g_return_if_fail(OSINFO_IS_OS(os)); + g_return_if_fail(OSINFO_IS_IMAGE(image)); + + osinfo_list_add(OSINFO_LIST(os->priv->images), OSINFO_ENTITY(image)); +} + /** * osinfo_os_get_variant_list: * @os: an operating system diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h index 96bd6e3..d51bbb4 100644 --- a/osinfo/osinfo_os.h +++ b/osinfo/osinfo_os.h @@ -34,6 +34,8 @@ #include #include #include +#include +#include #ifndef __OSINFO_OS_H__ #define __OSINFO_OS_H__ @@ -116,6 +118,8 @@ OsinfoMediaList *osinfo_os_get_media_list(OsinfoOs *os); void osinfo_os_add_media(OsinfoOs *os, OsinfoMedia *media); OsinfoTreeList *osinfo_os_get_tree_list(OsinfoOs *os); void osinfo_os_add_tree(OsinfoOs *os, OsinfoTree *tree); +OsinfoImageList *osinfo_os_get_image_list(OsinfoOs *os); +void osinfo_os_add_image(OsinfoOs *os, OsinfoImage *image); OsinfoOsVariantList *osinfo_os_get_variant_list(OsinfoOs *os); void osinfo_os_add_variant(OsinfoOs *os, OsinfoOsVariant *variant); OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os); -- 2.19.1 From fidencio at redhat.com Thu Nov 1 12:45:10 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 13:45:10 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 5/5] loader: Load Images information In-Reply-To: <20181101124510.3223-1-fidencio@redhat.com> References: <20181101124510.3223-1-fidencio@redhat.com> Message-ID: <20181101124510.3223-6-fidencio@redhat.com> Now that we've OsinfoImage and OsinfoImageList objects in place and OsinfoOs already provides us an API to add an OsinfoImage to an OsinfoOS, let's properly load the images' information present in osinfo-db. https://gitlab.com/libosinfo/osinfo-db/issues/10 Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_loader.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index d1bf61d..3a3aa90 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -1238,6 +1238,26 @@ static OsinfoTree *osinfo_loader_tree(OsinfoLoader *loader, return tree; } +static OsinfoImage *osinfo_loader_image(OsinfoLoader *loader, + xmlXPathContextPtr ctxt, + xmlNodePtr root, + const gchar *id, + GError **err) +{ + const OsinfoEntityKey keys[] = { + { OSINFO_IMAGE_PROP_URL, G_TYPE_STRING }, + { NULL, G_TYPE_INVALID } + }; + + gchar *arch = (gchar *)xmlGetProp(root, BAD_CAST "arch"); + OsinfoImage *image = osinfo_image_new(id, arch); + xmlFree(arch); + + osinfo_loader_entity(loader, OSINFO_ENTITY(image), keys, ctxt, root, err); + + return image; +} + static OsinfoOsVariant *osinfo_loader_os_variant(OsinfoLoader *loader, xmlXPathContextPtr ctxt, xmlNodePtr root, @@ -1488,6 +1508,26 @@ static void osinfo_loader_os(OsinfoLoader *loader, g_free(nodes); + nnodes = osinfo_loader_nodeset("./image", loader, ctxt, &nodes, err); + if (error_is_set(err)) + goto cleanup; + + for (i = 0; i < nnodes; i++) { + xmlNodePtr saved = ctxt->node; + ctxt->node = nodes[i]; + gchar *image_id = g_strdup_printf("%s:%u", id, i); + OsinfoImage *image = osinfo_loader_image(loader, ctxt, nodes[i], image_id, err); + g_free(image_id); + ctxt->node = saved; + if (error_is_set(err)) + goto cleanup; + + osinfo_os_add_image(os, image); + g_object_unref(G_OBJECT(image)); + } + + g_free(nodes); + nnodes = osinfo_loader_nodeset("./variant", loader, ctxt, &nodes, err); if (error_is_set(err)) goto cleanup; -- 2.19.1 From felipe10borges at gmail.com Thu Nov 1 12:47:52 2018 From: felipe10borges at gmail.com (Felipe Borges) Date: Thu, 1 Nov 2018 13:47:52 +0100 Subject: [Libosinfo] [osinfo-db PATCH 2/3] silverblue: Update silverblue29 data In-Reply-To: <1540911908-30368-2-git-send-email-fabiano@fidencio.org> References: <1540911908-30368-1-git-send-email-fabiano@fidencio.org> <1540911908-30368-2-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Oct 30, 2018 at 7:06 PM Fabiano Fid?ncio wrote: > > Signed-off-by: Fabiano Fid?ncio > --- > data/os/fedoraproject.org/silverblue-29.xml.in | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Sure. Thanks for these series! Reviewed-by: Felipe Borges Thanks! Felipe. From felipe10borges at gmail.com Thu Nov 1 12:48:29 2018 From: felipe10borges at gmail.com (Felipe Borges) Date: Thu, 1 Nov 2018 13:48:29 +0100 Subject: [Libosinfo] [libosinfo PATCH 2/2] tests: Update silverblue29 isodata In-Reply-To: <1540911943-32719-2-git-send-email-fabiano@fidencio.org> References: <1540911943-32719-1-git-send-email-fabiano@fidencio.org> <1540911943-32719-2-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Oct 30, 2018 at 7:05 PM Fabiano Fid?ncio wrote: > > Signed-off-by: Fabiano Fid?ncio > --- > .../Fedora-Silverblue-ostree-x86_64-29-1.2.iso.txt | 29 ++++++++++++++++++++++ > ...ra-Silverblue-ostree-x86_64-29_Beta-1.5.iso.txt | 29 ---------------------- > 2 files changed, 29 insertions(+), 29 deletions(-) > create mode 100644 tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29-1.2.iso.txt > delete mode 100644 tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29_Beta-1.5.iso.txt > > diff --git a/tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29-1.2.iso.txt b/tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29-1.2.iso.txt > new file mode 100644 > index 0000000..89f8603 > --- /dev/null > +++ b/tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29-1.2.iso.txt > @@ -0,0 +1,29 @@ > +CD-ROM is in ISO 9660 format > +System id: LINUX > +Volume id: Fedora-SB-ostree-x86_64-29 > +Volume set id: > +Publisher id: > +Data preparer id: > +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM > +Copyright File id: > +Abstract File id: > +Bibliographic File id: > +Volume set size is: 1 > +Volume set sequence number is: 1 > +Logical block size is: 2048 > +Volume size is: 1031435 > +El Torito VD version 1 found, boot catalog is in sector 44 > +Joliet with UCS level 3 found > +Rock Ridge signatures version 1 found > +Eltorito validation header: > + Hid 1 > + Arch 0 (x86) > + ID '' > + Key 55 AA > + Eltorito defaultboot header: > + Bootid 88 (bootable) > + Boot media 0 (No Emulation Boot) > + Load segment 0 > + Sys type 0 > + Nsect 4 > + Bootoff FA8D9 1026265 > diff --git a/tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29_Beta-1.5.iso.txt b/tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29_Beta-1.5.iso.txt > deleted file mode 100644 > index 177ad7f..0000000 > --- a/tests/isodata/fedora/silverblue29/Fedora-Silverblue-ostree-x86_64-29_Beta-1.5.iso.txt > +++ /dev/null > @@ -1,29 +0,0 @@ > -CD-ROM is in ISO 9660 format > -System id: LINUX > -Volume id: Fedora-SB-ostree-x86_64-29 > -Volume set id: > -Publisher id: > -Data preparer id: > -Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM > -Copyright File id: > -Abstract File id: > -Bibliographic File id: > -Volume set size is: 1 > -Volume set sequence number is: 1 > -Logical block size is: 2048 > -Volume size is: 1022240 > -El Torito VD version 1 found, boot catalog is in sector 44 > -Joliet with UCS level 3 found > -Rock Ridge signatures version 1 found > -Eltorito validation header: > - Hid 1 > - Arch 0 (x86) > - ID '' > - Key 55 AA > - Eltorito defaultboot header: > - Bootid 88 (bootable) > - Boot media 0 (No Emulation Boot) > - Load segment 0 > - Sys type 0 > - Nsect 4 > - Bootoff F84F2 1017074 > -- > 1.8.3.1 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo Reviewed-by: Felipe Borges Thanks! Felipe. From felipeborges at gnome.org Thu Nov 1 13:17:02 2018 From: felipeborges at gnome.org (Felipe Borges) Date: Thu, 1 Nov 2018 14:17:02 +0100 Subject: [Libosinfo] [PATCH] rhel: Add rhel7.6 isodata Message-ID: <20181101131702.7626-1-felipeborges@gnome.org> From: Felipe Borges Signed-off-by: Felipe Borges --- ...L-7.6-20181010.0-Server-ppc64-boot.iso.txt | 16 ++++++++++ ...L-7.6-20181010.0-Server-ppc64-dvd1.iso.txt | 16 ++++++++++ ...7.6-20181010.0-Server-ppc64le-boot.iso.txt | 16 ++++++++++ ...7.6-20181010.0-Server-ppc64le-dvd1.iso.txt | 16 ++++++++++ ...L-7.6-20181010.0-Server-s390x-boot.iso.txt | 29 +++++++++++++++++++ ...L-7.6-20181010.0-Server-s390x-dvd1.iso.txt | 29 +++++++++++++++++++ ...-7.6-20181010.0-Server-x86_64-boot.iso.txt | 29 +++++++++++++++++++ ...-7.6-20181010.0-Server-x86_64-dvd1.iso.txt | 29 +++++++++++++++++++ ...20181010.0-Workstation-x86_64-boot.iso.txt | 29 +++++++++++++++++++ ...20181010.0-Workstation-x86_64-dvd1.iso.txt | 29 +++++++++++++++++++ 10 files changed, 238 insertions(+) create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-boot.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-dvd1.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-boot.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-dvd1.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-boot.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-dvd1.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-boot.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-boot.iso.txt create mode 100644 tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-dvd1.iso.txt diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-boot.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-boot.iso.txt new file mode 100644 index 0000000..63e8a18 --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-boot.iso.txt @@ -0,0 +1,16 @@ +CD-ROM is in ISO 9660 format +System id: PPC +Volume id: RHEL_7_6_Server_ppc64 +Volume set id: 7.6 +Publisher id: +Data preparer id: +Application id: Red Hat Enterprise Linux 7.6 +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 294480 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-dvd1.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-dvd1.iso.txt new file mode 100644 index 0000000..c7bcede --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64-dvd1.iso.txt @@ -0,0 +1,16 @@ +CD-ROM is in ISO 9660 format +System id: PPC +Volume id: RHEL-7.6 Server.ppc64 +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 1874275 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-boot.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-boot.iso.txt new file mode 100644 index 0000000..226f88d --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-boot.iso.txt @@ -0,0 +1,16 @@ +CD-ROM is in ISO 9660 format +System id: PPC +Volume id: RHEL_7_6_Server_ppc64le +Volume set id: 7.6 +Publisher id: +Data preparer id: +Application id: Red Hat Enterprise Linux 7.6 +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 297600 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-dvd1.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-dvd1.iso.txt new file mode 100644 index 0000000..24b64db --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-ppc64le-dvd1.iso.txt @@ -0,0 +1,16 @@ +CD-ROM is in ISO 9660 format +System id: PPC +Volume id: RHEL-7.6 Server.ppc64le +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 1657806 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-boot.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-boot.iso.txt new file mode 100644 index 0000000..0f1331d --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-boot.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: LINUX +Volume id: RHEL-7.6 Server.s390x +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 235033 +El Torito VD version 1 found, boot catalog is in sector 34 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4 + Bootoff 23 35 diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-dvd1.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-dvd1.iso.txt new file mode 100644 index 0000000..6ceabce --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-s390x-dvd1.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: LINUX +Volume id: RHEL-7.6 Server.s390x +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 1653497 +El Torito VD version 1 found, boot catalog is in sector 681 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4ECC + Bootoff 2C6 710 diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-boot.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-boot.iso.txt new file mode 100644 index 0000000..f6515fc --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-boot.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: LINUX +Volume id: RHEL-7.6 Server.x86_64 +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 278719 +El Torito VD version 1 found, boot catalog is in sector 46 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4 + Bootoff 68B7 26807 diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso.txt new file mode 100644 index 0000000..588a4a2 --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: LINUX +Volume id: RHEL-7.6 Server.x86_64 +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 2195639 +El Torito VD version 1 found, boot catalog is in sector 815 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4 + Bootoff 4AB0F 305935 diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-boot.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-boot.iso.txt new file mode 100644 index 0000000..0110481 --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-boot.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: LINUX +Volume id: RHEL-7.6 Workstation.x86_64 +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 278742 +El Torito VD version 1 found, boot catalog is in sector 46 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4 + Bootoff 687B 26747 diff --git a/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-dvd1.iso.txt b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-dvd1.iso.txt new file mode 100644 index 0000000..3d30f40 --- /dev/null +++ b/tests/isodata/rhel/rhel7.6/RHEL-7.6-20181010.0-Workstation-x86_64-dvd1.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: LINUX +Volume id: RHEL-7.6 Workstation.x86_64 +Volume set id: +Publisher id: +Data preparer id: +Application id: GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 2259642 +El Torito VD version 1 found, boot catalog is in sector 805 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4 + Bootoff 4AAE0 305888 -- 2.19.1 From ptoscano at redhat.com Thu Nov 1 13:35:35 2018 From: ptoscano at redhat.com (Pino Toscano) Date: Thu, 01 Nov 2018 14:35:35 +0100 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 0/6] Add support to images In-Reply-To: <20181031214538.18186-1-fidencio@redhat.com> References: <20181031214538.18186-1-fidencio@redhat.com> Message-ID: <2742718.Whj9CLioHO@thyrus.usersys.redhat.com> On Wednesday, 31 October 2018 22:45:32 CET Fabiano Fid?ncio wrote: > This patchset adds support to images entries as part of the "os" entry > in a very similar way that's already done for both medias and trees. > > It's important to note that in order to do so, we've added a libguestfs > dependency used when creating an OsinfoImage from location (more details > in the second patch of the series). > > An example of how the XML will look like is: > > > > https://download/foo/bar.img > Ditro Foo (Cloud Edition) > > > > Last but not least, I'm cc'ing here Richard Jones and Pino Toscano in > order to get their input in the libguestfs bits ... mainly to know > whether explicitly depending on libguestfs is a good idea or not (and, > if not, to get some feedback on different approaches that could be > taken). In addition to the other notes, most probably it would be nice to see also new test-image & test-imagelist tests, and a test-imageuris network test. -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part. URL: From fidencio at redhat.com Thu Nov 1 14:52:04 2018 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 15:52:04 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 4/5] os: Introduce APIs to deal with images In-Reply-To: <20181101124510.3223-5-fidencio@redhat.com> References: <20181101124510.3223-1-fidencio@redhat.com> <20181101124510.3223-5-fidencio@redhat.com> Message-ID: On Thu, Nov 1, 2018 at 1:45 PM Fabiano Fid?ncio wrote: > > Let's introduce the needed APIs on os side to deal will the images. > For now, there's no info being loaded as the loader part depends on one > of these APIs. > > https://gitlab.com/libosinfo/osinfo-db/issues/10 > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_os.c | 37 +++++++++++++++++++++++++++++++++++++ > osinfo/osinfo_os.h | 4 ++++ > 2 files changed, 41 insertions(+) > > diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c > index 4f74331..6e12a06 100644 > --- a/osinfo/osinfo_os.c > +++ b/osinfo/osinfo_os.c > @@ -52,6 +52,7 @@ struct _OsinfoOsPrivate > > OsinfoMediaList *medias; > OsinfoTreeList *trees; > + OsinfoImageList *images; > OsinfoOsVariantList *variants; > OsinfoResourcesList *minimum; > OsinfoResourcesList *recommended; > @@ -116,6 +117,7 @@ osinfo_os_finalize(GObject *object) > g_list_free(os->priv->deviceLinks); > g_object_unref(os->priv->medias); > g_object_unref(os->priv->trees); > + g_object_unref(os->priv->images); > g_object_unref(os->priv->variants); > g_object_unref(os->priv->minimum); > g_object_unref(os->priv->recommended); > @@ -181,6 +183,7 @@ osinfo_os_init(OsinfoOs *os) > os->priv->deviceLinks = NULL; > os->priv->medias = osinfo_medialist_new(); > os->priv->trees = osinfo_treelist_new(); > + os->priv->images = osinfo_imagelist_new(); > os->priv->variants = osinfo_os_variantlist_new(); > os->priv->minimum = osinfo_resourceslist_new(); > os->priv->recommended = osinfo_resourceslist_new(); > @@ -494,6 +497,40 @@ void osinfo_os_add_tree(OsinfoOs *os, OsinfoTree *tree) > osinfo_list_add(OSINFO_LIST(os->priv->trees), OSINFO_ENTITY(tree)); > } > > +/** > + * osinfo_os_get_image_list: > + * @os: an operating system > + * > + * Get all installed images associated with operating system @os. > + * > + * Returns: (transfer full): A list of images > + */ > +OsinfoImageList *osinfo_os_get_image_list(OsinfoOs *os) > +{ > + g_return_val_if_fail(OSINFO_IS_OS(os), NULL); > + > + OsinfoImageList *newList = osinfo_imagelist_new(); > + > + osinfo_list_add_all(OSINFO_LIST(newList), OSINFO_LIST(os->priv->images)); > + > + return newList; > +} > + > +/** > + * osinfo_os_add_image: > + * @os: an operating system > + * @image: (transfer none): the image to add > + * > + * Adds an installed image @image to operating system @os. > + */ > +void osinfo_os_add_image(OsinfoOs *os, OsinfoImage *image) > +{ > + g_return_if_fail(OSINFO_IS_OS(os)); > + g_return_if_fail(OSINFO_IS_IMAGE(image)); > + > + osinfo_list_add(OSINFO_LIST(os->priv->images), OSINFO_ENTITY(image)); > +} > + > /** > * osinfo_os_get_variant_list: > * @os: an operating system > diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h > index 96bd6e3..d51bbb4 100644 > --- a/osinfo/osinfo_os.h > +++ b/osinfo/osinfo_os.h > @@ -34,6 +34,8 @@ > #include > #include > #include > +#include > +#include > > #ifndef __OSINFO_OS_H__ > #define __OSINFO_OS_H__ > @@ -116,6 +118,8 @@ OsinfoMediaList *osinfo_os_get_media_list(OsinfoOs *os); > void osinfo_os_add_media(OsinfoOs *os, OsinfoMedia *media); > OsinfoTreeList *osinfo_os_get_tree_list(OsinfoOs *os); > void osinfo_os_add_tree(OsinfoOs *os, OsinfoTree *tree); > +OsinfoImageList *osinfo_os_get_image_list(OsinfoOs *os); > +void osinfo_os_add_image(OsinfoOs *os, OsinfoImage *image); > OsinfoOsVariantList *osinfo_os_get_variant_list(OsinfoOs *os); > void osinfo_os_add_variant(OsinfoOs *os, OsinfoOsVariant *variant); > OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os); > -- > 2.19.1 > And this patch will need the following fixup: Author: Fabiano Fid?ncio AuthorDate: Thu Nov 1 15:48:55 2018 +0100 Commit: Fabiano Fid?ncio CommitDate: Thu Nov 1 15:50:36 2018 +0100 fixup! os: Introduce APIs to deal with images --- osinfo/libosinfo.syms | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index aeb74a7..7711bce 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -541,6 +541,9 @@ LIBOSINFO_1.3.0 { osinfo_imagelist_get_type; osinfo_imagelist_new; + + osinfo_os_add_image; + osinfo_os_get_image_list; } LIBOSINFO_0.2.13; /* Symbols in next release... From fidencio at redhat.com Thu Nov 1 14:57:55 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 15:57:55 +0100 Subject: [Libosinfo] [libosinfo PATCH 0/3] Add tests for OsinfoImage Message-ID: <20181101145758.8792-1-fidencio@redhat.com> This patchset introduces a bunch of tests for the following series: https://www.redhat.com/archives/libosinfo/2018-November/msg00009.html Fabiano Fid?ncio (3): tests: Add test-image tests: Add test-imagelist tests: Add test-imageuris tests/Makefile.am | 15 +++ tests/test-image.c | 64 ++++++++++++ tests/test-imagelist.c | 228 +++++++++++++++++++++++++++++++++++++++++ tests/test-imageuris.c | 150 +++++++++++++++++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 tests/test-image.c create mode 100644 tests/test-imagelist.c create mode 100644 tests/test-imageuris.c -- 2.19.1 From fidencio at redhat.com Thu Nov 1 14:57:56 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 15:57:56 +0100 Subject: [Libosinfo] [libosinfo PATCH 1/3] tests: Add test-image In-Reply-To: <20181101145758.8792-1-fidencio@redhat.com> References: <20181101145758.8792-1-fidencio@redhat.com> Message-ID: <20181101145758.8792-2-fidencio@redhat.com> test-image tests the basic functionally of OsImage APIs. Signed-off-by: Fabiano Fid?ncio --- tests/Makefile.am | 5 ++++ tests/test-image.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/test-image.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 06f81bf..410f373 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -18,6 +18,7 @@ check_PROGRAMS = \ test-isodetect \ test-install-script \ test-os-resources \ + test-image \ $(NULL) if HAVE_CURL @@ -116,6 +117,10 @@ test_os_resources_LDADD = $(COMMON_LDADD) test_os_resources_CFLAGS = $(COMMON_CFLAGS) test_os_resources_SOURCES = test-os-resources.c +test_image_LDADD = $(COMMON_LDADD) +test_image_CFLAGS = $(COMMON_CFLAGS) +test_image_SOURCES = test-image.c + TESTS = $(check_PROGRAMS) \ $(NULL) diff --git a/tests/test-image.c b/tests/test-image.c new file mode 100644 index 0000000..cc0e335 --- /dev/null +++ b/tests/test-image.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + * + * Authors: + * Fabiano Fid?nciog + */ + +#include + +#include + +#define ID "foo" +#define ARCH "x86_64" +#define URL "https://foo.bar/foobar.img" + +static void +test_basic(void) +{ + OsinfoImage *image = osinfo_image_new(ID, ARCH); + osinfo_entity_set_param(OSINFO_ENTITY(image), + OSINFO_IMAGE_PROP_URL, + URL); + + g_assert_true(OSINFO_IS_IMAGE(image)); + g_assert_cmpstr(osinfo_entity_get_id(OSINFO_ENTITY(image)), ==, ID); + g_assert_cmpstr(osinfo_image_get_architecture(image), ==, ARCH); + g_assert_cmpstr(osinfo_image_get_url(image), ==, URL); + + g_object_unref(image); +} + + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/image/basic", test_basic); + + /* Upfront so we don't confuse valgrind */ + osinfo_image_get_type(); + + return g_test_run(); +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.1 From fidencio at redhat.com Thu Nov 1 14:57:57 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 15:57:57 +0100 Subject: [Libosinfo] [libosinfo PATCH 2/3] tests: Add test-imagelist In-Reply-To: <20181101145758.8792-1-fidencio@redhat.com> References: <20181101145758.8792-1-fidencio@redhat.com> Message-ID: <20181101145758.8792-3-fidencio@redhat.com> test-imagelist is totally based on test-devicelist. Signed-off-by: Fabiano Fid?ncio --- tests/Makefile.am | 5 + tests/test-imagelist.c | 228 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 tests/test-imagelist.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 410f373..8b06e22 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,7 @@ check_PROGRAMS = \ test-install-script \ test-os-resources \ test-image \ + test-imagelist \ $(NULL) if HAVE_CURL @@ -121,6 +122,10 @@ test_image_LDADD = $(COMMON_LDADD) test_image_CFLAGS = $(COMMON_CFLAGS) test_image_SOURCES = test-image.c +test_imagelist_LDADD = $(COMMON_LDADD) +test_imagelist_CFLAGS = $(COMMON_CFLAGS) +test_imagelist_SOURCES = test-imagelist.c + TESTS = $(check_PROGRAMS) \ $(NULL) diff --git a/tests/test-imagelist.c b/tests/test-imagelist.c new file mode 100644 index 0000000..88b1fae --- /dev/null +++ b/tests/test-imagelist.c @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include + + +static void +test_union(void) +{ + OsinfoImageList *list1 = osinfo_imagelist_new(); + OsinfoImageList *list2 = osinfo_imagelist_new(); + OsinfoImageList *list3; + OsinfoImage *ent1 = osinfo_image_new("foo1", "x86_64"); + OsinfoImage *ent2 = osinfo_image_new("foo2", "x86_64"); + OsinfoImage *ent3 = osinfo_image_new("foo3", "i686"); + OsinfoImage *ent4 = osinfo_image_new("foo4", "i686"); + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4)); + + list3 = OSINFO_IMAGELIST(osinfo_list_new_union(OSINFO_LIST(list1), OSINFO_LIST(list2))); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list3)), ==, 4); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list3)); i++) { + OsinfoImage *ent = OSINFO_IMAGE(osinfo_list_get_nth(OSINFO_LIST(list3), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_true(has2); + g_assert_true(has3); + g_assert_true(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(list1); + g_object_unref(list2); + g_object_unref(list3); +} + + +static void +test_intersect(void) +{ + OsinfoImageList *list1 = osinfo_imagelist_new(); + OsinfoImageList *list2 = osinfo_imagelist_new(); + OsinfoImageList *list3; + OsinfoImage *ent1 = osinfo_image_new("foo1", "x86_64"); + OsinfoImage *ent2 = osinfo_image_new("foo2", "x86_64"); + OsinfoImage *ent3 = osinfo_image_new("foo3", "i686"); + OsinfoImage *ent4 = osinfo_image_new("foo4", "i686"); + + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent3)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4)); + + list3 = OSINFO_IMAGELIST(osinfo_list_new_intersection(OSINFO_LIST(list1), OSINFO_LIST(list2))); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list3)), ==, 2); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list3)); i++) { + OsinfoImage *ent = OSINFO_IMAGE(osinfo_list_get_nth(OSINFO_LIST(list3), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_false(has2); + g_assert_true(has3); + g_assert_false(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(list1); + g_object_unref(list2); + g_object_unref(list3); +} + + +static void +test_filter(void) +{ + OsinfoImageList *list1 = osinfo_imagelist_new(); + OsinfoImageList *list2; + OsinfoFilter *filter = osinfo_filter_new(); + OsinfoImage *ent1 = osinfo_image_new("foo1", "x86_64"); + OsinfoImage *ent2 = osinfo_image_new("foo2", "x86_64"); + OsinfoImage *ent3 = osinfo_image_new("foo3", "i686"); + OsinfoImage *ent4 = osinfo_image_new("foo4", "i686"); + + osinfo_entity_add_param(OSINFO_ENTITY(ent1), "class", "network"); + osinfo_entity_add_param(OSINFO_ENTITY(ent1), "class", "wilma"); + osinfo_entity_add_param(OSINFO_ENTITY(ent2), "class", "network"); + osinfo_entity_add_param(OSINFO_ENTITY(ent3), "class", "network"); + osinfo_entity_add_param(OSINFO_ENTITY(ent3), "class", "audio"); + osinfo_entity_add_param(OSINFO_ENTITY(ent4), "class", "audio"); + + osinfo_filter_add_constraint(filter, "class", "network"); + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent4)); + + list2 = OSINFO_IMAGELIST(osinfo_list_new_filtered(OSINFO_LIST(list1), filter)); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list2)), ==, 3); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list2)); i++) { + OsinfoImage *ent = OSINFO_IMAGE(osinfo_list_get_nth(OSINFO_LIST(list2), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_true(has2); + g_assert_true(has3); + g_assert_false(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(filter); + g_object_unref(list1); + g_object_unref(list2); +} + + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/imagelist/union", test_union); + g_test_add_func("/imagelist/intersect", test_intersect); + g_test_add_func("/imagelist/filter", test_filter); + + /* Upfront so we don't confuse valgrind */ + osinfo_image_get_type(); + osinfo_imagelist_get_type(); + osinfo_filter_get_type(); + + return g_test_run(); +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.1 From fidencio at redhat.com Thu Nov 1 14:57:58 2018 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 1 Nov 2018 15:57:58 +0100 Subject: [Libosinfo] [libosinfo PATCH 3/3] tests: Add test-imageuris In-Reply-To: <20181101145758.8792-1-fidencio@redhat.com> References: <20181101145758.8792-1-fidencio@redhat.com> Message-ID: <20181101145758.8792-4-fidencio@redhat.com> In a quite similar way than test-mediauris and test-treeuris, let's have a test for the imageuris. Signed-off-by: Fabiano Fid?ncio --- tests/Makefile.am | 5 ++ tests/test-imageuris.c | 150 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 tests/test-imageuris.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 8b06e22..770356e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,6 +26,7 @@ if HAVE_CURL check_PROGRAMS += \ test-mediauris \ test-treeuris \ + test-imageuris \ $(NULL) endif @@ -108,6 +109,10 @@ test_mediauris_SOURCES = test-mediauris.c test_treeuris_LDADD = $(COMMON_LDADD) $(CURL_LIBS) test_treeuris_CFLAGS = $(COMMON_CFLAGS) $(CURL_CFLAGS) test_treeuris_SOURCES = test-treeuris.c + +test_imageuris_LDADD = $(COMMON_LDADD) $(CURL_LIBS) +test_imageuris_CFLAGS = $(COMMON_CFLAGS) $(CURL_CFLAGS) +test_imageuris_SOURCES = test-imageuris.c endif test_install_script_LDADD = $(COMMON_LDADD) diff --git a/tests/test-imageuris.c b/tests/test-imageuris.c new file mode 100644 index 0000000..a57307e --- /dev/null +++ b/tests/test-imageuris.c @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2108 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + * + * Authors: + * Daniel P. Berrange + */ + +#include + +#include +#include +#include + +static void test_image(OsinfoImageList *imagelist, GError **error, CURL *curl) +{ + GList *imageel = NULL, *tmp; + + tmp = imageel = osinfo_list_get_elements(OSINFO_LIST(imagelist)); + while (tmp) { + OsinfoImage *image = tmp->data; + const gchar *url = osinfo_image_get_url(image); + CURLcode res; + long response_code; + + if (url == NULL || g_str_equal(url, "")) { + tmp = tmp->next; + continue; + } + + g_test_message("%s", url); + curl_easy_setopt(curl, CURLOPT_URL, url); + res = curl_easy_perform(curl); + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); + + g_test_message("res=%d, %s; code=%ld", res, curl_easy_strerror(res), response_code); + g_assert_cmpint(res, ==, CURLE_OK); + + tmp = tmp->next; + } + + g_list_free(imageel); +} + +static void +test_uris(void) +{ + CURL *curl; + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db = osinfo_loader_get_db(loader); + GError *error = NULL; + OsinfoOsList *oslist = NULL; + GList *osel = NULL, *tmp; + const gchar *debugstr; + + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_NOBODY, 1L); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60L); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); + + if ((debugstr = g_getenv("LIBOSINFO_TEST_DEBUG"))) { + int debug_level = atoi(debugstr); + + curl_easy_setopt(curl, CURLOPT_VERBOSE, debug_level > 0 ? 1L : 0L); + } + + g_assert_true(OSINFO_IS_LOADER(loader)); + g_assert_true(OSINFO_IS_DB(db)); + + osinfo_loader_process_default_path(loader, &error); + g_assert_no_error(error); + + oslist = osinfo_db_get_os_list(db); + tmp = osel = osinfo_list_get_elements(OSINFO_LIST(oslist)); + while (tmp) { + OsinfoOs *os = tmp->data; + OsinfoImageList *imagelist = osinfo_os_get_image_list(os); + + test_image(imagelist, &error, curl); + + g_assert_no_error(error); + + g_object_unref(imagelist); + tmp = tmp->next; + } + + curl_easy_cleanup(curl); + + g_list_free(osel); + if (oslist) + g_object_unref(oslist); + + g_object_unref(loader); +} + + + +int +main(int argc, char *argv[]) +{ + int ret; + + g_test_init(&argc, &argv, NULL); + g_test_set_nonfatal_assertions(); + + g_test_add_func("/imageuris/uris", test_uris); + + if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) + return 77; /* Skip */ + + /* Upfront so we don't confuse valgrind */ + curl_global_init(CURL_GLOBAL_ALL); + osinfo_entity_get_type(); + osinfo_db_get_type(); + osinfo_device_get_type(); + osinfo_platform_get_type(); + osinfo_os_get_type(); + osinfo_list_get_type(); + osinfo_devicelist_get_type(); + osinfo_platformlist_get_type(); + osinfo_oslist_get_type(); + osinfo_filter_get_type(); + + ret = g_test_run(); + + curl_global_cleanup(); + + return ret; +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.1 From felipe10borges at gmail.com Thu Nov 1 15:52:13 2018 From: felipe10borges at gmail.com (Felipe Borges) Date: Thu, 1 Nov 2018 16:52:13 +0100 Subject: [Libosinfo] [osinfo-db PATCH 3/3] debian: Update debian9 URLs In-Reply-To: <1540911908-30368-3-git-send-email-fabiano@fidencio.org> References: <1540911908-30368-1-git-send-email-fabiano@fidencio.org> <1540911908-30368-3-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Oct 30, 2018 at 7:06 PM Fabiano Fid?ncio wrote: > > Signed-off-by: Fabiano Fid?ncio > --- > data/os/debian.org/debian-9.xml.in | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) Sure. The tests are passing and the links are 200 OK. Reviewed-by: Felipe Borges From fidencio at redhat.com Thu Nov 1 16:07:56 2018 From: fidencio at redhat.com (Fabiano =?ISO-8859-1?Q?Fid=EAncio?=) Date: Thu, 01 Nov 2018 17:07:56 +0100 Subject: [Libosinfo] [PATCH] rhel: Add rhel-7.6 In-Reply-To: <20181030154847.8352-1-feborges@redhat.com> References: <20181030154847.8352-1-feborges@redhat.com> Message-ID: Felipe, I've finally had some time to test it against the isodata you've submitted. On Tue, 2018-10-30 at 16:48 +0100, Felipe Borges wrote: > https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.6_release_notes/ > > Signed-off-by: Felipe Borges > --- > data/os/redhat.com/rhel-7.6.xml.in | 89 > ++++++++++++++++++++++++++++++ > 1 file changed, 89 insertions(+) > create mode 100644 data/os/redhat.com/rhel-7.6.xml.in > > diff --git a/data/os/redhat.com/rhel-7.6.xml.in > b/data/os/redhat.com/rhel-7.6.xml.in > new file mode 100644 > index 0000000..38fa766 > --- /dev/null > +++ b/data/os/redhat.com/rhel-7.6.xml.in > @@ -0,0 +1,89 @@ > + > + > + > + rhel7.6 > + <_name>Red Hat Enterprise Linux 7.6 > + 7.6 > + <_vendor>Red Hat, Inc > + linux > + rhel > + Maipo > + > + > + > + 2018-10-30 > + > + > + > + LINUX > + .*RHEL-7.6.*x86_64.* > + > + isolinux/vmlinuz > + isolinux/initrd.img > + > + > + > + > + LINUX > + RHEL-7.6.*aarch64$ > + > + > + > + > + > + PPC > + RHEL-7.6.*ppc64$ > + > + > + > + > + > + PPC > + RHEL-7.6.*ppc64le$ > + > + So, seems that the volume-id of boot isos for ppc64 and ppc64le differ from the dvd1 isos due to: * ppc64: - boot: RHEL_7_6_Server_ppc64 - dvd1: RHEL-7.6 Server.ppc64 * ppc64le: - boot: RHEL_7_6_Server_ppc64le - dvd1: RHEL-7.6 Server.ppc64le And this only happens for the PPC ones. I'll just adjust their regex to: * ppc64: RHEL[-_]7.6.*ppc64$ * ppc64le: RHEL[-_]7.6.*ppc64le$ We can decide later on if we want some variant-id for those or not. > + > + > + > + LINUX > + RHEL-7.6.*s390x$ > + > + > + > + > + > + 1 > + 1000000000 > + 2147483648 > + 10737418240 > + > + > + > + 400000000 > + 2147483648 > + 21474836480 > + > + > + > + > + > + 1 > + 1000000000 > + 1073741824 > + 10737418240 > + > + > + > + 1000000000 > + 1073741824 > + 10737418240 > + > + > + > + > +