Package: gdebi
Version: 0.9.5.7+nmu1
Severity: minor
Tags: patch

Hi,

Running lintian can put down a considerable load on the machine, especially if it's a slow one or when the package is large.

Given the presumed "begginer users" target of gdebi, I guess it's unlikelly that many of them would even look at the "Lintian" tab.

So, to remove that "unnecessary" load, patch attached defers running lintian on startup until it's tab is selected.

Cheers!
Filip

--- System information. ---
Architecture: Kernel:       Linux 4.12.0

Debian Release: 9.0
500 trusty ppa.launchpad.net 500 stretch-loki gandalfn.ovh 500 stable security.debian.org 500 stable repo.vivaldi.com 500 stable httpredir.debian.org 500 stable dl.winehq.org 500 all liveusb.info 1050 stretch angband.pl 100 stretch-backports httpredir.debian.org 1 experimental ftp.debian.org
--- Package information. ---
Depends                     (Version) | Installed
=====================================-+-=================
python3:any (>= 3.3.2-2~) | gdebi-core (= 0.9.5.7+nmu1) | 0.9.5.7+nmu1
gir1.2-gtk-3.0                        | 3.22.11-1
gir1.2-vte-2.91                       | 0.46.1-1
python3-gi                            | 3.22.0-2
gksu                                  | 2.0.2-9+b1
gnome-icon-theme                      | 3.12.0-2


Recommends            (Version) | Installed
===============================-+-===========
libgtk2-perl                    | 2:1.2499-1
shared-mime-info                | 1.8-1
lintian                         | 2.5.50.4


Package's Suggests field is empty.
--- a/data/gdebi.ui	2015-07-02 09:14:27.000000000 +0200
+++ b/data/gdebi.ui	2017-07-09 23:34:42.000000000 +0200
@@ -915,6 +915,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="border_width">6</property>
+            <signal name="switch-page" handler="on_notebook_switch_page" swapped="no"/>
             <child>
               <object class="GtkScrolledWindow" id="scrolledwindow1">
                 <property name="visible">True</property>
--- a/GDebi/GDebiGtk.py	2015-07-08 15:29:23.000000000 +0200
+++ b/GDebi/GDebiGtk.py	2017-07-09 23:34:42.000000000 +0200
@@ -118,6 +118,9 @@
         self.window_main.connect("drag_data_received",
                                  self.on_window_main_drag_data_received)
 
+        # Initialize var to hold lintian output
+        self._lintian_output = ""
+
         # Check file with gio
         file = self.gio_copy_in_place(file)
 
@@ -148,6 +151,7 @@
         self.synaptic_config = apt_pkg.Configuration()
 
         if file != "" and os.path.exists(file):
+            self.filename = file
             self.open(file)
 
         self.window_main.set_sensitive(True)
@@ -237,6 +241,8 @@
                 self.open(path)
 
     def open(self, filename, downloaded=False):
+        if self._lintian_output:
+            self._lintian_output = ""
         self._show_busy_cursor(True)
         res = GDebiCommon.open(self, filename, downloaded)
         self._show_busy_cursor(False)
@@ -322,9 +328,6 @@
         self.textview_file_content.modify_font(font_desc)
         self.textview_lintian_output.modify_font(font_desc)
 
-        # run lintian async
-        if self._options and self._options.non_interactive is False:
-            self._run_lintian(filename)
 
         # check the deps
         if not self._deb.check():
@@ -405,7 +408,6 @@
                   "Please install using sudo apt-get install lintian"))
             return
         buf.set_text(_("Running lintian..."))
-        self._lintian_output = ""
         self._lintian_exit_status = None
         self._lintian_exit_status_gathered = None
         cmd = ["/usr/bin/lintian", filename]
@@ -781,6 +783,12 @@
     def on_button_remove_clicked(self, widget):
         self.dpkg_action(widget, False)
 
+    def on_notebook_switch_page(self, notebook, page, page_num):
+        # run lintian async when it's notebook page is selected
+        if (page_num == 3 and not self._lintian_output
+            and self._options and self._options.non_interactive is False):
+            self._run_lintian(self.filename)
+
     def on_button_deb_install_close_clicked(self, widget):
         # Set the autoclose option when we close
         autoclose = self.checkbutton_autoclose.get_active()

Reply via email to