Compare commits

..

5 Commits

Author SHA1 Message Date
Tudor Marcu 4225b901a9 Release v1.05
This release changes the builder to read raw bytes to account for weirdly
encoded filenames, and provides better output to the user.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-09-26 11:56:00 -07:00
Patrick McCarty dee894f28d Add progress messages for builder.conf values
To help debug issues related to SWUPD config values being set in the
chroot, or not, print out diagnostic messages to display the expected
values.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-09-06 11:39:05 -07:00
Tudor Marcu 9919c1523f Use raw bytes to read filenames
We cannot be sure of the encoding used for certain filenames or the locale on
a specific system, so use raw bytes and don't worry about the encoding of the
filenames.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-08-31 15:56:06 -07:00
Tudor Marcu bda3519d4d Release v1.04
This release introduces functionality to blacklist/ignore bundles beginning with
a '.', and will support other banned characters in the future.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-05-03 20:26:44 +00:00
Tudor Marcu a1c4e4a5c5 Do not accept bundles beginning with '.'
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-05-03 20:26:01 +00:00
2 changed files with 20 additions and 5 deletions
+19 -4
View File
@@ -163,7 +163,9 @@ def create_chroots(args, state_dir, bundles, yum_conf):
with open(state_dir + "/server.ini", "w+") as serverini:
serverini.write("[Server]\nemptydir=" + state_dir + "/empty/\nimagebase=" + state_dir + "/image/\noutputdir=" + state_dir + "/www/\n")
with open(state_dir + "/groups.ini", "w+") as groupsini:
for bundle in os.listdir(bundles):
bundle_list = os.listdir(bundles)
bundle_list = trim_bundles(bundle_list)
for bundle in bundle_list:
groupsini.write("[" + bundle + "]\ngroup=" + bundle + "\n\n")
"""Setup chroots for bundles"""
@@ -261,6 +263,7 @@ def create_chroots(args, state_dir, bundles, yum_conf):
bundle_list = os.listdir(bundles)
bundle_list.remove('os-core')
bundle_list = trim_bundles(bundle_list)
pool = multiprocessing.Pool()
results_list = []
@@ -299,15 +302,19 @@ def create_chroots(args, state_dir, bundles, yum_conf):
versionurl = conf['VERSIONURL']
formatname = conf['FORMAT']
print("Adding SWUPD default values to '{}' bundle...".format(bundlename))
"""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.makedirs(confpath, exist_ok=True)
with open(os.path.join(confpath, "contenturl"), "w") as file:
file.writelines(contenturl)
print(" contenturl: {}".format(contenturl))
with open(os.path.join(confpath, "versionurl"), "w") as file:
file.writelines(versionurl)
print(" versionurl: {}".format(versionurl))
with open(os.path.join(confpath, "format"), "w") as file:
file.writelines(formatname)
print(" format: {}".format(formatname))
print("Creating package to file mappings")
package_mapping = {}
@@ -318,14 +325,14 @@ def create_chroots(args, state_dir, bundles, yum_conf):
# real package's filename I'm using it instead of recursing through
# temporary per bundle folders
package_name = map_file[map_file.find(" * ") + 3:-len(".src.rpm")]
with open(out_dir + "/" + map_file, "r") as file:
with open(out_dir + "/" + map_file, "rb") as file:
path_list = file.readlines()
if package_name not in package_mapping:
package_mapping[package_name] = set()
for path in path_list:
package_mapping[package_name].add(path)
for package_name, paths in package_mapping.items():
with open(out_dir + "/files-{}".format(package_name), "w") as file:
with open(out_dir + "/files-{}".format(package_name), "wb") as file:
file.writelines(sorted(paths))
for map_file in map_files:
os.unlink(out_dir + "/" + map_file)
@@ -364,7 +371,9 @@ def create_chroots(args, state_dir, bundles, yum_conf):
versions_output.append("{0: <50}{1}\n".format(name, pver))
with open(web_dir + "versions", "w") as file:
file.writelines(versions_output)
for bundle in os.listdir(bundles):
bundle_list = os.listdir(bundles)
bundle_list = trim_bundles(bundle_list)
for bundle in bundle_list:
shutil.copyfile(out_dir + "/packages-{}".format(bundle), web_dir + "/noship/packages-{}".format(bundle))
if os.path.isfile(out_dir + "/{}-includes".format(bundle)):
shutil.copyfile(out_dir + "/{}-includes".format(bundle), web_dir + "/noship/{}-includes".format(bundle))
@@ -372,6 +381,12 @@ def create_chroots(args, state_dir, bundles, yum_conf):
shutil.copyfile(out_dir + "/files-{}".format(package_name),
web_dir + "/noship/files-{}".format(package_name))
# Remove bundles with blacklisted characters, such as dot files
def trim_bundles(bundles):
for bundle in bundles:
if bundle.startswith('.'):
bundles.remove(bundle)
return bundles
def main():
"""Entry point for chroot creator"""
+1 -1
View File
@@ -1,5 +1,5 @@
AC_PREREQ([2.68])
AC_INIT([bundle-chroot-builder],[1.03],[tudor.marcu@intel.com],[bundle-chroot-builder])
AC_INIT([bundle-chroot-builder],[1.05],[tudor.marcu@intel.com],[bundle-chroot-builder])
AM_INIT_AUTOMAKE([foreign silent-rules color-tests no-dist-gzip dist-xz])
AC_CONFIG_FILES(Makefile)
AC_PREFIX_DEFAULT(/usr/local)