[Spacewalk-list] Status of Solaris support

Pierre Casenove pcasenove at gmail.com
Wed Jun 27 09:31:33 UTC 2012


OK, I finally got it working... but please, have a deep look on my code.
1) for python 2.4, I use only method read on zipfile
2) I modify _archive_dir value : if it has a trailing slash, I remove
it. otherwise, solaris2mpm command was nont able to detect it was a
patch, and consider the archive as a package.

Thanks,

Pierre


2012/6/26 Michael Mraka <michael.mraka at redhat.com>:
> Pierre Casenove wrote:
> % One last point on Solaris support: the hardware information page. I
> % attach a screenshot of the page with Chrome web browser.
> % 1) Under, "General", we have "(2) sparcv9 (1503 MHZ)" right in the middle...
> % 2) Is it normal to get so few information?
>
> Unfortunately yes.
>
>
> --
> Michael Mráka
> Satellite Engineering, Red Hat
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
-------------- next part --------------
From cba64d6ef2ef9f8c3190d1c5c42bb17a53620ae5 Mon Sep 17 00:00:00 2001
From: Pierre Casenove <pcasenove at gmail.com>
Date: Wed, 27 Jun 2012 09:29:16 +0000
Subject: [PATCH] Python 2.4 does not have extractall method

---
 client/tools/rhnpush/archive.py |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/client/tools/rhnpush/archive.py b/client/tools/rhnpush/archive.py
index 873c870..20535d7 100644
--- a/client/tools/rhnpush/archive.py
+++ b/client/tools/rhnpush/archive.py
@@ -241,9 +241,23 @@ class ZipParser(ArchiveParser):
     def _explode(self, archive):
         """Explode zip archive"""
         self._archive_dir = os.path.join(self._temp_dir, self._get_archive_dir())
+        if self._archive_dir[-1:] == "/":
+            self._archive_dir = self._archive_dir[0:-1]

         try:
-            self.zip_file.extractall(self._temp_dir)
+            if hasattr(self.zip_file,'extractall'):
+                self.zip_file.extractall(self._temp_dir)
+            else:
+                # there's no ZipFile.extractall() in python 2.4 (RHEL5)
+                for zipinfo in self.zip_file.namelist():
+                    complete_path = os.path.join(self._temp_dir,zipinfo)
+                    if complete_path.endswith("/"):
+                        if not os.path.exists(complete_path):
+                            os.mkdir(complete_path)
+                    else:
+                        fd = open(complete_path,"w")
+                        fd.write(self.zip_file.read(zipinfo))
+                        fd.close()
         except Exception, e:
             raise InvalidArchiveError("Archive did not expand to %s: %s" %
                                                 (self._archive_dir, str(e)))
--
1.7.4.1


More information about the Spacewalk-list mailing list