summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Utils/Platform.pm33
2 files changed, 37 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d77dc24..90d2db9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-08 Carlos Garnacho <carlosg@gnome.org>
+
+ * Utils/Platform.pm: cache the detected platform, it very likely won't
+ vary ever for the same installation.
+
2006-09-06 Carlos Garnacho <carlosg@gnome.org>
* Release 1.9.5
diff --git a/Utils/Platform.pm b/Utils/Platform.pm
index 9f343d0..1522fb1 100644
--- a/Utils/Platform.pm
+++ b/Utils/Platform.pm
@@ -27,6 +27,7 @@ package Utils::Platform;
use Utils::XML;
use Utils::Parse;
use Utils::Backend;
+use Utils::File;
use base qw(Net::DBus::Object);
use Net::DBus::Exporter ($Utils::Backend::DBUS_PREFIX . ".Platform");
@@ -407,6 +408,31 @@ sub guess
&Utils::Report::end ();
}
+sub get_cached_platform
+{
+ my ($file, $platform);
+
+ $file = &Utils::File::get_base_path() . "/detected-platform";
+ $platform = &Utils::Parse::get_first_line ($file);
+
+ if (&ensure_platform ($platform))
+ {
+ $Utils::Backend::tool{"platform"} = $gst_dist = $platform;
+ &Utils::Report::do_report ("platform_success", $platform);
+ return 1;
+ }
+
+ return 0;
+}
+
+sub cache_platform
+{
+ my ($file, $platform);
+
+ $file = &Utils::File::get_base_path() . "/detected-platform";
+ &Utils::Replace::set_first_line ($file, $gst_dist);
+}
+
sub new
{
my $class = shift;
@@ -415,7 +441,12 @@ sub new
bless $self, $class;
&get_system ();
- &guess ($self) if !$Utils::Backend::tool{"platform"};
+
+ if (!&get_cached_platform ())
+ {
+ &guess ($self) if !$Utils::Backend::tool{"platform"};
+ &cache_platform ();
+ }
return $self;
}