[gnome-boxes/drop-gnome-continuous-images: 2/2] installed-media: Drop special handling for gnome-continuos images
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/drop-gnome-continuous-images: 2/2] installed-media: Drop special handling for gnome-continuos images
- Date: Mon, 10 Dec 2018 14:56:16 +0000 (UTC)
commit 95f911b83aed09d98870c040230eff3f5ad0f97d
Author: Felipe Borges <felipeborges gnome org>
Date: Fri Dec 7 14:18:45 2018 +0100
installed-media: Drop special handling for gnome-continuos images
It is been a long time since GNOME produces useful continuos images/
composes that can be booted.
Nowadays with Flatpak apps can be tested easily and there's not
much of a demand for a nightly image compose. There are initiatives
to get system components distributed as Flatpaks as well, voiding
the need of GNOME composed images.
data/osinfo/gnome-3.6.xml | 9 --------
data/osinfo/meson.build | 1 -
src/installed-media.vala | 55 +----------------------------------------------
src/os-database.vala | 49 -----------------------------------------
4 files changed, 1 insertion(+), 113 deletions(-)
---
diff --git a/data/osinfo/meson.build b/data/osinfo/meson.build
index 6cc2881f..38e80601 100644
--- a/data/osinfo/meson.build
+++ b/data/osinfo/meson.build
@@ -5,7 +5,6 @@ osinfo_db = [
['freedos-1.2.xml', 'gnome-boxes/osinfo/os/freedos.org'],
['opensuse-10.2.xml', 'gnome-boxes/osinfo/os/opensuse.org'],
['ubuntu-4.10.xml', 'gnome-boxes/osinfo/os/ubuntu.com'],
- ['gnome-3.6.xml', 'gnome-boxes/osinfo/os/gnome.org'],
['popos-17.10.xml', 'gnome-boxes/osinfo/os/system76.com'],
['rhel-4.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
['rhel-5.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
diff --git a/src/installed-media.vala b/src/installed-media.vala
index 16a2586c..b1930798 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -16,7 +16,6 @@
public const string[] supported_architectures = {
"i686", "i586", "i486", "i386"
};
- private static Regex date_regex = /20[0-9]{6,6}/;
public override bool need_user_input_for_vm_creation { get { return false; } }
public override bool ready_to_create { get { return true; } }
@@ -63,19 +62,7 @@ public InstalledMedia (string path, bool known_qcow2 = false) throws GLib.Error
public async InstalledMedia.guess_os (string path, MediaManager media_manager) throws GLib.Error {
this (path);
- if (path.contains ("gnome-continuous") || path.contains ("gnome-ostree")) {
- try {
- os = yield media_manager.os_db.get_os_by_id ("http://gnome.org/continuous/3.10");
- } catch (OSDatabaseError.UNKNOWN_OS_ID error) {
- debug ("gnome-continuous definition not found in libosinfo db");
- } catch (OSDatabaseError error) {
- throw error;
- }
- }
-
- os = yield guess_os_from_filename (media_manager.os_db);
- resources = (os != null)? media_manager.os_db.get_resources_for_os (os, architecture) :
- OSDatabase.get_default_resources ();
+ resources = OSDatabase.get_default_resources ();
label_setup ();
}
@@ -120,46 +107,6 @@ public override VMCreator get_vm_creator () {
return new VMImporter (this);
}
- private async Osinfo.Os? guess_os_from_filename (OSDatabase os_db) throws OSDatabaseError {
- if (!device_file.contains ("gnome-continuous") && !device_file.contains ("gnome-ostree"))
- return null;
-
- var date = get_date_from_filename ();
- if (date == null) {
- try {
- // No date on filename means older gnome-continuous images and
- // hence more close to 3.10 than anything newer.
- return yield os_db.get_os_by_id ("http://gnome.org/continuous/3.10");
- } catch (OSDatabaseError.UNKNOWN_OS_ID error) {
- debug ("gnome-continuous definition not found in libosinfo db");
-
- return null;
- }
- }
-
- var os_list = yield os_db.list_os_by_distro ("gnome", date);
- if (os_list.length () > 0)
- return os_list.data;
- else
- return null;
- }
-
- private GLib.Date? get_date_from_filename () {
- GLib.MatchInfo match_info;
-
- date_regex.match (device_file, 0, out match_info);
- if (!match_info.matches ())
- return null;
-
- var date_str = match_info.fetch (0);
- var date = GLib.Date ();
- date.set_year ((GLib.DateYear) int.parse (date_str[0:4]));
- date.set_month ((GLib.DateMonth) int.parse (date_str[4:6]));
- date.set_day ((GLib.DateDay) int.parse (date_str[6:8]));
-
- return date;
- }
-
private async bool extract_ovf () throws GLib.Error {
if (!device_file.has_suffix (".ova"))
return false;
diff --git a/src/os-database.vala b/src/os-database.vala
index 8c3353c7..e1c9dda6 100644
--- a/src/os-database.vala
+++ b/src/os-database.vala
@@ -146,55 +146,6 @@ else if (release_b == null)
return after_list;
}
- // Returned list is in ascending order by release dates. If release date is
- // unavailable and OS is
- // a. released, we assume that it is older than other OSes and @after.
- // b. unreleased, we assume that it is newer than other OSes and @after.
- //
- // If @after is non-null, only list releases after the given date.
- public async GLib.List<Os> list_os_by_distro (string distro, GLib.Date? after = null) throws
OSDatabaseError {
- if (!yield ensure_db_loaded ())
- throw new OSDatabaseError.DB_LOADING_FAILED ("Failed to load OS database");
-
- var os_list = db.get_os_list ();
- var filter = new Filter ();
- filter.add_constraint (OS_PROP_DISTRO, distro);
- os_list = (os_list as Osinfo.List).new_filtered (filter) as OsList;
-
- var after_list = new GLib.List<Os> ();
- foreach (var entity in os_list.get_elements ()) {
- var os = entity as Os;
-
- if (after != null) {
- var release_date = os.get_release_date ();
- var status = os.get_release_status ();
-
- if (status != ReleaseStatus.RELEASED || (release_date != null && release_date.compare
(after) > 0))
- after_list.append (os);
- } else
- after_list.append (os);
- }
-
- after_list.sort ((os_a, os_b) => {
- if (os_a.get_release_status () != ReleaseStatus.RELEASED)
- return 1;
- else if (os_b.get_release_status () != ReleaseStatus.RELEASED)
- return -1;
-
- var release_a = os_a.get_release_date ();
- var release_b = os_b.get_release_date ();
-
- if (release_a == null)
- return 1;
- else if (release_b == null)
- return -1;
- else
- return release_a.compare (release_b);
- });
-
- return after_list;
- }
-
public Media get_media_by_id (Os os, string id) throws OSDatabaseError {
var medias = os.get_media_list ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]