From 24d8b59fdf77ea368030b0132a2ffbeb123218c2 Mon Sep 17 00:00:00 2001 From: Tudor Marcu Date: Fri, 25 Mar 2016 13:08:32 -0700 Subject: [PATCH] Remove leading slash in os.path.join() The os.path.join() function discard any previos paths/variables when it encounters one starting with a leading "/" so the statedir & bundle name were completely ignored when it ran into /usr/share/defaults/... This fixes it so the path is correctly made, and the dirs and files should be installed correctly. Signed-off-by: Tudor Marcu --- bundle-chroot-builder.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bundle-chroot-builder.py b/bundle-chroot-builder.py index bc1b6a8..1af78ff 100755 --- a/bundle-chroot-builder.py +++ b/bundle-chroot-builder.py @@ -283,15 +283,13 @@ def create_chroots(args, state_dir, bundles, yum_conf): """Read the configuration file for our script values""" conf = config['swupd'] bundlename = conf['BUNDLE'] - url = conf['URL'] contenturl = conf['CONTENTURL'] versionurl = conf['VERSIONURL'] formatname = conf['FORMAT'] - confpath = os.path.join(out_dir, bundlename, "/usr/share/defaults/swupd/") + """Do not add a leading slash on anything except the first variable in os.path.join!""" + confpath = os.path.join(out_dir, bundlename, "usr/share/defaults/swupd/") os.mkdir(confpath) - with open(os.path.join(confpath, "url"), "w") as file: - file.writelines(url) with open(os.path.join(confpath, "contenturl"), "w") as file: file.writelines(contenturl) with open(os.path.join(confpath, "versionurl"), "w") as file: