Package: sysstat / 11.4.3-2

15-isag-xz.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From: Robert Luberda <robert@debian.org>
Date: Tue, 29 Mar 2016 20:00:17 +0200
Subject: Support xz in isag

Add support for the .xz files in isag.
---
 contrib/isag/isag.in | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/contrib/isag/isag.in b/contrib/isag/isag.in
index 9011fae..823aa2f 100644
--- a/contrib/isag/isag.in
+++ b/contrib/isag/isag.in
@@ -211,8 +211,6 @@ if {$tcl_version < $needed_version} {
 set gnuplot	"/usr/bin/gnuplot"
 set grep	"/bin/grep"
 set sh		"/bin/sh"
-set gunzip	"/bin/gunzip"
-set sed		"/bin/sed"
 
 # default placement of config file
 set isag_cfg_file	"$env(HOME)/.isag.cfg"
@@ -534,8 +532,7 @@ proc fill_file_menu {} {
 	foreach directory [concat $directories $sar_data_path ] {
 		set files [glob -nocomplain -directory $directory -type f $sar_data_mask ]
 		# add compressed files too
-		set files [concat $files [glob -nocomplain -directory $directory -type f $sar_data_mask.gz ]]
-		set files [concat $files [glob -nocomplain -directory $directory -type f $sar_data_mask.bz2 ]]
+		set files [concat $files [glob -nocomplain -directory $directory -type f $sar_data_mask.gz $sar_data_mask.bz2 $sar_data_mask.xz ]]
 		# remove $sar_data_path prefix from $directory
 		set directory [string range $directory [expr $ldirectory + 1] end]
 
@@ -588,6 +585,7 @@ proc fill_file_menu {} {
 
 		set label [string map { .gz "" } $label]
 		set label [string map { .bz2 "" } $label]
+		set label [string map { .xz "" } $label]
 		$menudir add command -label "$label" -command "set_file $basefile"
 
 		set file "$sar_data_path/$basefile"
@@ -611,19 +609,20 @@ proc set_file {name} {
 	.file.lbl configure -text "Data Source: $name"
 
 	set l [string last "." $sag_if_archive]
-	if { [string range $sag_if_archive $l end] == ".gz" } {
+	switch [string range $sag_if_archive $l end] {
+		".xz"   { set filter "xzcat" }
+		".bz2"  { set filter "bzcat" }
+		".gz"   { set filter "zcat"  }
+		default { set filter ""      }
+	}
+
+	if {"" == $filter} {
+		set sag_if_archive_uncompressed "$sar_data_path/$sag_if_archive"
+	} else {
 		# uncompress file to sa_data located in the temporary dir
 		set sag_if_archive_uncompressed "$fngr_tmpdir/sa_data"
-		exec zcat "$sar_data_path/$sag_if_archive" > $sag_if_archive_uncompressed
-	} else {
-		if { [string range $sag_if_archive $l end] == ".bz2" } {
-			set sag_if_archive_uncompressed "$fngr_tmpdir/sa_data"
-			exec bzcat "$sar_data_path/$sag_if_archive" > $sag_if_archive_uncompressed
-		} else {
-			set sag_if_archive_uncompressed "$sar_data_path/$sag_if_archive"
-		}
-	}		
-
+		exec "$filter" "$sar_data_path/$sag_if_archive" > $sag_if_archive_uncompressed
+	}
 
 	if {"" != $last_graph} {
 		new_chart $last_graph