Commits

Moises Henriquez committed 6f9c5ce

cleaning up and implementing package installation support

  • Participants
  • Parent commits b988f00

Comments (0)

Files changed (4)

             if desc.startswith('/'):
                 shutil.copy2(desc, 'slack-desc')
             else:
+                self.parent._play_output('Downloading description from %s \n'% desc)
                 u = urllib2.urlopen(desc)
                 f = open('slack-desc', 'w')
                 f.write(u.read())
             self._refresh_views()
             if result == "Success" and toinstall == "1":
                 # install the package
-                print 'we should be installing this package here'
-
-
+                self.parent._play_output(
+                        '\nInstalling package \n')
+                try:
+                    proc = srcob.install_pkg()
+                    proc.observer.add_callback(self.parent._play_output)
+                    proc.run()
+                    while proc._popen_running:
+                        time.sleep(1)
+                    retval = proc.popen.returncode
+                except:
+                    print 'Error while installing package'
+                    pass
 
 class Tab(gtk.VBox):
     ''' Generic tab for use in the tabstrip '''
         self.mon_thread.start()
         self.jobDispatcher = Dispatcher(parent = self._parent)
 
-#        self.jobDispatcher = Dispatcher(parent=self._parent)
 
     def __bot_monitor(self):
         while self._parent._bot_run:
             self.jobDispatcher.start()
         return
 
-
 class TabQueue(Tab):
     """ Job queue tab. Used to manage build jobs."""
     def __init__(self, *args, **kwargs):
         vad.set_value(newpos)
         self.scrollarea.set_vadjustment(vad)
         gtk.gdk.threads_leave()
-        # scroll the scrollwindow
-#        vad = self.scrollarea.get_vadjustment()
-#        newpos = vad.get_upper() - vad.get_page_size()
-#        vad.set_value(newpos)
-#
-#        try:
-#            self.scrollarea.set_vadjustment(vad)
-#        except:
-#            pass
 
 
     def _get_notebook(self):

File vpackager/buildutils.py

 class MissingSourcesHomeError(Exception):
     pass
 
+class PackageNotFoundError(Exception):
+    pass
 
 def get_vltag():
     ''' Return a string representing the distro tag for the installed system'''
         self.__dump = []
         self.builder = self.FindSourceType()
 
+    def install_pkg(self):
+        fullpath = glob.glob(os.path.join(
+            self.__myhome, self.ver,'%s-%s-*.t?z'% (
+                self.app, self.ger)))[0]
+        if not fullpath:
+            raise PackageNotFoundError
+
+        return bottools.Execute('installpkg %s'% fullpath)
+
+
     def makeSlackBuild(self, buildno='1', packager='vpackager'):
         """ Generate a slackbuild using sbbuilder to build this source"""
         ### Use sbbuilder to create a slackbuild for his package.
 
         return None
 
+    def install_pkg(self):
+        pkgpath = glob.glob(
+                os.path.join(
+                    self.__myhome, self.ver,'%s-%s-*.t?z'% (
+                        self.app, self.ver)))[0]
+        if not pkgpath:
+            raise PackageNotFoundError
+
+        return bottools.Execute('installpkg %s'% pkgpath)
+
+
     def buildSlackBuild(self):
         """ Execute the build script generated by the class"""
         # Make sure we are at the correct location

File vpackager/dbutils.py

         return
     return
 
-
 def __create_queue_table():
     """ Create the job queue table. NEVER to be called from the program
     itself!"""

File vpackager/vpackager.py

         l.pack_start(lb, False, False, 4)
         l.pack_start(lbl, False, False, 12)
 
-#        appline = gtk.HBox()
-#        applbl = gtk.Label(_('Application'))
-#        self.roAppNameBox = gtk.Entry()
-#        appline.pack_start(applbl, False, False, 2)
-#        appline.pack_start(self.roAppNameBox, False, False, 2)
-
-#        appverlbl = gtk.Label(_('Version'))
-#        self.roAppVerBox = gtk.Entry()
-#        appline.pack_start(appverlbl, False, False, 2)
-#        appline.pack_start(self.roAppVerBox, False, False, 2)
-
-#        l.pack_start(appline, False, False, 2)
-
-
         lbr = gtk.Label()
         lbr.set_use_markup(True)
         lbr.set_markup(