summaryrefslogtreecommitdiff
path: root/Utils
diff options
context:
space:
mode:
authorcarlosg <carlosg>2006-09-08 08:40:04 +0000
committercarlosg <carlosg>2006-09-08 08:40:04 +0000
commitf4bbdf3c245bc0bca99d103f31e2548131e31909 (patch)
tree65ba7e000550a247bf6c6b3cb6c86831ed3d5d0e /Utils
parent2bc719a5648eac70a4b33b8dca1f9e00765e2d01 (diff)
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.
Diffstat (limited to 'Utils')
-rw-r--r--Utils/Platform.pm33
1 files changed, 32 insertions, 1 deletions
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;
}