← Back to team overview

keryx team mailing list archive

[Merge] lp:~mac9416/keryx/unstable into lp:~keryx-admins/keryx/devel

 

mac9416 has proposed merging lp:~mac9416/keryx/unstable into lp:~keryx-admins/keryx/devel.

    Requested reviews:
    Keryx Admins (keryx-admins)


Reordered package installation steps
Package Installation Finished dialog now recommends updating status
Packages no longer transferred to cache: packages directory set as temporary cache during installation
Fixed bug #510637
Fixed bug #510642

-- 
https://code.launchpad.net/~mac9416/keryx/unstable/+merge/17945
Your team Keryx Development Team is subscribed to branch lp:~keryx-admins/keryx/devel.
=== modified file 'keryx.py'
--- keryx.py	2010-01-17 00:52:51 +0000
+++ keryx.py	2010-01-23 16:30:29 +0000
@@ -20,7 +20,15 @@
 # Import commands here, even though we don't use it because debian.py uses it
 # and our plugin system confuses pyinstaller. We need to manually specify this
 # in keryx so that pyinstaller can grab it and bundle the code
-
+<<<<<<< TREE
+
+=======
+
+import os
+
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
+>>>>>>> MERGE-SOURCE
 import commands
 
 import os.path, sys

=== modified file 'lib/wxkeryx/main.py'
--- lib/wxkeryx/main.py	2010-01-20 17:35:40 +0000
+++ lib/wxkeryx/main.py	2010-01-23 16:30:29 +0000
@@ -347,6 +347,7 @@
         #list of failed files now stored in frame[1] as returned by download.py
 
     def OnInstall(self, event):
+<<<<<<< TREE
         dlg = InstallProjectDialog(None, -1, _("Install Project"))
         result = dlg.ShowModal()
         move = dlg.move_checkbox.GetValue()
@@ -386,6 +387,14 @@
         if result == wx.ID_NO:  
             return
 
+=======
+        # Get the necessary information for package installation
+        projdir = project.projects[len(project.projects) -1].dir
+        spacksdir = os.path.join(projdir, 'packages')
+        spacks = [x for x in os.listdir(spacksdir) if os.path.isfile(os.path.join(spacksdir, x)) and (os.path.splitext(x)[1] == '.deb')]
+        packnames = sorted([x[:x.find('_')] for x in spacks])
+
+>>>>>>> MERGE-SOURCE
         # Ask what packages need to be installed
         items = dict([(num+1, pkg) for (num, pkg) in zip(range(len(packnames)), packnames)])
         dlg = SelectPackagesDialog(None, -1, _("Install Project"), items)
@@ -397,11 +406,31 @@
         if result == wx.ID_CANCEL:
             return
 
+<<<<<<< TREE
         # Start the installation
         result = project.projects[len(project.projects) - 1].plugin.installPacks(' '.join(packnames))
+=======
+        result = project.projects[len(project.projects) - 1].plugin.installCache(project.projects[len(project.projects) -1].dir, 'installcache')
+        if not result:
+            wx.MessageBox(_("Failed to update the APT cache. Aborting " \
+                            "installation."), 
+                            _("Failed to update cache"), wx.ICON_ERROR)
+            return
+
+        # Install the packages
+        projdir = project.projects[len(project.projects) -1].dir
+        result = project.projects[len(project.projects) - 1]. \
+                    plugin.installPacks(projdir, ' '.join(packnames))
+>>>>>>> MERGE-SOURCE
         if result:
+<<<<<<< TREE
             wx.MessageBox(_("Package installation finished."), 
                           _("Installation finished"))
+=======
+            wx.MessageBox(_("Package installation finished. You should update " \
+                            "your project status (Project > Update Status)."), 
+                          _("Installation finished"))
+>>>>>>> MERGE-SOURCE
         else:
             wx.MessageBox(_("An error occurred while installing your " \
                             "packages. Make sure no other package manager is " \
@@ -470,11 +499,21 @@
         dlg.Destroy()
         if result == wx.ID_NO:
             return
-        success = self.UpdateStatus()
-        if success:
-            dlg = wx.MessageDialog(None, _("Status update Succeeded."),
-                          _("Status Update Succeeded"))
-        else:
+<<<<<<< TREE
+        success = self.UpdateStatus()
+        if success:
+            dlg = wx.MessageDialog(None, _("Status update Succeeded."),
+                          _("Status Update Succeeded"))
+        else:
+=======
+        success = self.UpdateStatus()
+        if success:
+            dlg = wx.MessageDialog(None, _("Status update Succeeded."),
+                          _("Status Update Succeeded"))
+            result = dlg.ShowModal()
+            dlg.Destroy()
+        else:
+>>>>>>> MERGE-SOURCE
             dlg = wx.MessageDialog(None, _("Status update failed. Try running Keryx as root (using 'sudo')."),
                           _("Status Update Failed"), wx.ICON_ERROR)
             result = dlg.ShowModal()
@@ -578,17 +617,15 @@
         panel = wx.Panel(self, -1)
         vbox = wx.BoxSizer(wx.VERTICAL)
 
-        text = wx.StaticText(panel, -1, _("All downloaded package files will " \
-                        "be copied to the APT cache so that APT will believe " \
-                        "they have been downloaded. In the next step, " \
-                        "apt-get will be called to install the packages."), 
+        text = wx.StaticText(panel, -1, _("The APT cache will be updated to " \
+                        "know what packages are available for installation."), 
                         (15, 10), (470, 80))
 
         #All downloaded package files will be copied to the APT cache ao that APT will believe they have been downloaded. In the next step, apt-get will be called to install the packages.
 
-        self.move_checkbox = wx.CheckBox(panel, -1, 
-                    _("Delete packages from project folder after installation"),
-                    (5, 95))
+        #self.move_checkbox = wx.CheckBox(panel, -1, 
+        #            _("Delete packages from project folder after installation"),
+        #            (5, 95))
 
         btnSizer = wx.StdDialogButtonSizer()
         btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))

=== modified file 'plugins/Debian.py'
--- plugins/Debian.py	2010-01-17 00:52:51 +0000
+++ plugins/Debian.py	2010-01-23 16:30:29 +0000
@@ -146,7 +146,7 @@
         return os.path.join(os.path.join(dir, 'sources'), 'sources.list')
 
     def installCache(self, projdir, scriptname, move=False):
-        """ Transfers all downloaded packages to the OS cache. 
+        """ Transfers index files to the APT cache. 
         Uses sh script called as 'root'
         """
         # Make sure there are packages to install
@@ -193,8 +193,8 @@
 
 slists=lists
 tlists=/var/lib/apt/lists
-spacks=packages
-tpacks=/var/cache/apt/archives
+#spacks=packages
+#tpacks=/var/cache/apt/archives
 ssources=sources
 tsources=/etc/apt
 
@@ -222,27 +222,30 @@
 
 #TODO:release lock on folder $tlists
 
+### Debs will no longer be moved to the cache. The downloads directory will ###
+### Be made Temporary cache. ###
+
 #Find all downloaded packages and move to cache
-cd ../"$spacks"/
-filelist=`find -maxdepth 1 -name '*.deb'`
+#cd ../"$spacks"/
+#filelist=`find -maxdepth 1 -name '*.deb'`
 
 #TODO:attain lock on folder $tpacks to be package-manager-friendly
 # will be attained directly with python in later versions
 
-for fn in $filelist
-do
-    if [ $transfer = "mov" ]
-    then
-        mv -f -t "$tpacks" "$fn"
-    else
-        cp -t "$tpacks" "$fn"
-    fi
-    if [ ! $? = 0 ]
-    then
-        echo "Failure when ${transfer}ing package: $fn"
-        exit 67
-    fi
-done
+#for fn in $filelist
+#do
+#    if [ $transfer = "mov" ]
+#    then
+#        mv -f -t "$tpacks" "$fn"
+#    else
+#        cp -t "$tpacks" "$fn"
+#    fi
+#    if [ ! $? = 0 ]
+#    then
+#        echo "Failure when ${transfer}ing package: $fn"
+#        exit 67
+#    fi
+#done
 
 #TODO:release lock on folder $tpacks
 
@@ -281,15 +284,22 @@
         log.info(_('installCache: transfer success'))
         return True
 
-    def installPacks(self, packnames):
+    def installPacks(self, projdir, packnames):
+        packsdir = os.path.join(projdir, 'packages')
         run = self.__runRoot('xterm', 
+<<<<<<< TREE
                     '-e sh -c \"apt-get install -y %s; a=$?; echo \\\"Press any key to exit.\\\"; read x; exit $a\"' % \
                     (packnames))
+=======
+                    '-e sh -c \"apt-get -y -o dir::cache::archives=\"%s\" ' \
+                    'install %s; echo \\\"Press any key to exit.\\\"; ' \
+                    'read x\"' % (packsdir, packnames))
+>>>>>>> MERGE-SOURCE
         if run[0] != 0:
             log.error(_('exit code:%i\n%s' % (run[0], run[1])))
-            log.info(_('installCache: failed'))
+            log.info(_('Failed to start Xterm as root'))
             return False
-        log.info(_('installCache: success'))
+        #log.info(_('installCache: success'))
         return True
 
     def installRepo(self):
@@ -376,7 +386,7 @@
         try:    shutil.copytree('/etc/apt/', dirSources)
         except: pass # Will always raise errors because some files are only readable by root
         try:    shutil.copytree('/var/lib/apt/lists/', dirLists)
-        except: pass
+        except: os.mkdir(dirLists)
         shutil.copyfile('/var/lib/dpkg/status', os.path.join(dirLists,'status'))
         shutil.copyfile('/var/lib/dpkg/status', os.path.join(dirLists,'status.bak'))
 


Follow ups