Strip trailing slash from subpath's if they exist when creating filenames. rewrite-without-wtk
authorBrian Dolbec <dolsen@gentoo.org>
Thu, 27 Jun 2013 23:41:39 +0000 (16:41 -0700)
committerW. Trevor King <wking@tremily.us>
Sun, 15 Dec 2013 04:25:09 +0000 (20:25 -0800)
This bug was introduced in commit 52c9d37ff5de18981d6ecbe5bdde524b2bf4ebda when a trailing slash was added to target_subpath.

catalyst/base/stagebase.py
catalyst/targets/livecd_stage2.py
catalyst/targets/stage2.py

index 09ebdb026ea1e936d6d75f3d2130095cd0354d37..4ace63da4602eccea2cd83fbf3aa3903c3718a73 100644 (file)
@@ -314,7 +314,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
        def set_target_path(self):
                self.settings["target_path"]=normpath(self.settings["storedir"]+\
-                       "/builds/"+self.settings["target_subpath"]+".tar.bz2")
+                       "/builds/"+self.settings["target_subpath"].rstrip('/')+".tar.bz2")
                if "autoresume" in self.settings["options"]\
                        and self.resume.is_enabled("setup_target_path"):
                        print \
@@ -398,7 +398,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                "/tmp/"+self.settings["source_subpath"])
                else:
                        self.settings["source_path"]=normpath(self.settings["storedir"]+\
-                               "/builds/"+self.settings["source_subpath"]+".tar.bz2")
+                               "/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
                        if os.path.isfile(self.settings["source_path"]):
                                # XXX: Is this even necessary if the previous check passes?
                                if os.path.exists(self.settings["source_path"]):
@@ -413,7 +413,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        print "\tseedcache in the options of catalyst.conf the source path"
                        print "\twill then be "+\
                                normpath(self.settings["storedir"]+"/builds/"+\
-                               self.settings["source_subpath"]+".tar.bz2\n")
+                               self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
 
        def set_dest_path(self):
                if "root_path" in self.settings:
@@ -429,7 +429,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
        def set_snapshot_path(self):
                self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
                        "/snapshots/" + self.settings["snapshot_name"] +
-                       self.settings["snapshot"] + ".tar.xz")
+                       self.settings["snapshot"].rstrip('/') + ".tar.xz")
 
                if os.path.exists(self.settings["snapshot_path"]):
                        self.settings["snapshot_path_hash"]=\
@@ -440,7 +440,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                else:
                        self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
                                "/snapshots/" + self.settings["snapshot_name"] +
-                               self.settings["snapshot"] + ".tar.bz2")
+                               self.settings["snapshot"].rstrip('/') + ".tar.bz2")
 
                        if os.path.exists(self.settings["snapshot_path"]):
                                self.settings["snapshot_path_hash"]=\
index e8bee7d42c2b87d712ba3a45cc417221820f9e9e..5f6e86caa008199e089a3edb7b86abe8306464af 100644 (file)
@@ -38,7 +38,7 @@ class livecd_stage2(StageBase):
                file_locate(self.settings, ["cdtar","controller_file"])
 
        def set_source_path(self):
-               self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
+               self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
                if os.path.isfile(self.settings["source_path"]):
                        self.settings["source_path_hash"] = \
                                self.settings["hash_map"].generate_hash(
index c447facea5072275a1944068f01a76a0899220fc..116871c310c4b96f554a675aaadf1d66d72bee64 100644 (file)
@@ -23,7 +23,7 @@ class stage2(StageBase):
                if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
                        self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")
                else:
-                       self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
+                       self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
                        if os.path.isfile(self.settings["source_path"]):
                                if os.path.exists(self.settings["source_path"]):
                                # XXX: Is this even necessary if the previous check passes?
@@ -35,7 +35,7 @@ class stage2(StageBase):
                print "Source path set to "+self.settings["source_path"]
                if os.path.isdir(self.settings["source_path"]):
                        print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf"
-                       print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
+                       print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
 
        # XXX: How do these override_foo() functions differ from the ones in
        # StageBase and why aren't they in stage3_target?