Fix zypp fail to download packages
authorHuanhuan Li <huanhuanx.li@intel.com>
Mon, 3 Mar 2014 07:03:11 +0000 (15:03 +0800)
committerHuanhuan Li <huanhuanx.li@intel.com>
Mon, 3 Mar 2014 08:37:39 +0000 (16:37 +0800)
If we changed all configuration in '/etc/mic/mic.conf' to other dirs
like '/home/build/xx' instead of '/var/tmp/xx', mic wouldn't mount
or create '/var/tmp' any more, then it would result in zypp can't download
packages, becuase zypp will use '/var/tmp' to build cache as default

Fixes: #1623

Change-Id: I6f69c4a6f9655f70d3cbfa6670756255bca171a4

plugins/backend/zypppkgmgr.py

index 604e3e9..87b33b3 100644 (file)
@@ -79,6 +79,8 @@ class Zypp(BackendPlugin):
 
         self.has_prov_query = True
         self.install_debuginfo = False
+        # this can't be changed, it is used by zypp
+        self.tmp_file_path = '/var/tmp'
 
     def doFileLogSetup(self, uid, logfile):
         # don't do the file log for the livecd as it can lead to open fds
@@ -117,6 +119,10 @@ class Zypp(BackendPlugin):
 
     def setup(self):
         self._cleanupRpmdbLocks(self.instroot)
+        # '/var/tmp' is used by zypp to build cache, so make sure
+        # if it exists
+        if not os.path.exists(self.tmp_file_path ):
+            os.makedirs(self.tmp_file_path)
 
     def whatObsolete(self, pkg):
         query = zypp.PoolQuery()