Compare commits

..

15 Commits

Author SHA1 Message Date
Tudor Marcu cd634c88df Release v1.09
Properly handle m4 errors during build process.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-04-04 12:29:27 -07:00
Tudor Marcu 6aa46648d0 Exit on m4 error
M4 may fail here in the case of circular includes, causing the updater
to crash later. This patch checks that the subprocess call succeeded, and if not
raises an exception to exit. It may not terminate instantly due to the async
nature of processing bundles, but once the bad thread finishes it will exit.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-03-22 15:45:16 -07:00
Tudor Marcu 9fc98a03b1 Release v1.08
This release fixes the builder.conf template so it has a more sane starting
point.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-09 12:13:35 -08:00
Tudor Marcu c96046001e Fix builder.conf template
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-09 12:13:14 -08:00
Tudor Marcu 0d0e64e2a9 Release v1.07
This release updates bundle-chroot-builder to support the new mixer-tools and
builder.conf format.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 17:56:58 -07:00
Tudor Marcu be05f6b513 Default to outputting content in the mixer workspace
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-10-28 13:09:03 -07:00
Tudor Marcu d07ac01932 Update builder.conf to match docs and new tooling
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-10-28 12:18:09 -07:00
Tudor Marcu 82bd4409f8 Version numbers are now read from builder.conf
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-10-28 11:55:35 -07:00
Tudor Marcu 78e419ee2c Print out which builder.conf is being used
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-10-27 12:13:13 -07:00
Tudor Marcu 9d987f5e3b Release v1.06
This release moves the noship folder to the chroot location, because chroot
builder should not be adding any content to the webdir, and renames the
latest.version file to more appropriately match its use.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-09-29 10:39:06 -07:00
Tudor Marcu 629f940676 Change version file to more appropriate name
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-09-29 10:35:54 -07:00
Tudor Marcu 68084ca1b6 Move noship dir to image instead of www
This is an artifict needed by the swupd-server when creating update content
in the webdir, it should not exist in the webdir since it is being created
as part of the chroot building process. All content produced by the chroot
builder should live in the STATE_DIR/image/VER directory.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-09-29 10:35:26 -07:00
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
3 changed files with 35 additions and 22 deletions
+9 -6
View File
@@ -1,10 +1,13 @@
[Builder]
SERVER_STATE_DIR = /var/lib/update
BUNDLE_DIR = /home/clr/mix/bundles
YUM_CONF = /usr/share/defaults/bundle-chroot-builder/yum.conf
SERVER_STATE_DIR=/home/clr/mix/update
BUNDLE_DIR=/home/clr/mix/mix-bundles
YUM_CONF=/home/clr/mix/.yum-mix.conf
CERT=/home/clr/mix/ClearLinuxRoot.pem
CLEAR_VERSION=VER
MIX_VERSION=VER
[swupd]
BUNDLE=os-core-update
CONTENTURL=https://download.clearlinux.org/update/
VERSIONURL=https://download.clearlinux.org/update/
FORMAT=3
CONTENTURL=<URL where the content will be hosted>
VERSIONURL=<URL where the version of the mix will be hosted>
FORMAT=1
+25 -15
View File
@@ -54,6 +54,7 @@ def read_config(args):
if args.config:
buildconf = args.config
config = configparser.ConfigParser()
print("Reading from %s" % buildconf)
config.read(buildconf)
for option in ['SERVER_STATE_DIR', 'BUNDLE_DIR', 'YUM_CONF']:
@@ -73,9 +74,13 @@ def read_config(args):
def install_bundle(out_dir, postfix, bundle, bundles, yum_cmd):
"""Helper function to yum install a bundle"""
lines = []
with subprocess.Popen(["m4", bundles + "/" + bundle], cwd=bundles, stdout=subprocess.PIPE, bufsize=1, universal_newlines=True) as p:
for line in p.stdout:
lines.append(line)
try:
output = subprocess.check_output(["m4", bundles + "/" + bundle], cwd=bundles, bufsize=1, universal_newlines=True)
except subprocess.CalledProcessError as e:
print('ERROR {0}: m4 failed on {1}/{2}'.format(e.returncode, bundles, bundle))
raise
for line in output:
lines.append(line)
pkgs = "".join(lines)
to_install = []
@@ -177,8 +182,8 @@ def create_chroots(args, state_dir, bundles, yum_conf):
out_version = args.version
build_version = args.version
if os.path.exists(state_dir + "/image/latest.version") == False:
with open(state_dir + "/image/latest.version", "w") as latestver:
if os.path.exists(state_dir + "/image/LAST_VER") == False:
with open(state_dir + "/image/LAST_VER", "w") as latestver:
latestver.write("0\n")
config = configparser.ConfigParser()
@@ -302,15 +307,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 = {}
@@ -321,14 +330,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)
@@ -338,16 +347,17 @@ def create_chroots(args, state_dir, bundles, yum_conf):
print("Cleaning package list")
web_dir = state_dir + "/www/" + out_version + "/"
image_dir = state_dir + "/image/" + out_version + "/"
if os.path.isdir(web_dir):
print(" removing pre-existing {} before setting version file" .format(web_dir))
os.system('rm -rf '+web_dir)
# FIXME: Figure out problems with the below to replace the above.
# Consider all uses of os.system("rm -fr") as FIXMEs of the same variety.
# if os.path.isdir(web_dir):
# if os.path.isdir(image_dir):
# print(" removing pre-existing {} before setting version file"
# .format(web_dir))
# shutil.rmtree(web_dir)
os.makedirs(web_dir + '/noship')
# .format(imagedir())
# shutil.rmtree(image_dir)
os.makedirs(image_dir + '/noship')
versions_output = []
with open(out_dir + "/versions", "r") as file:
versions = set()
@@ -365,17 +375,17 @@ def create_chroots(args, state_dir, bundles, yum_conf):
versions_output.append("{0: <50}{1}\n".format("Available", "Packages"))
for name, pver in [line.split(":") for line in versions]:
versions_output.append("{0: <50}{1}\n".format(name, pver))
with open(web_dir + "versions", "w") as file:
with open(image_dir + "versions", "w") as file:
file.writelines(versions_output)
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))
shutil.copyfile(out_dir + "/packages-{}".format(bundle), image_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))
shutil.copyfile(out_dir + "/{}-includes".format(bundle), image_dir + "/noship/{}-includes".format(bundle))
for package_name in package_mapping.keys():
shutil.copyfile(out_dir + "/files-{}".format(package_name),
web_dir + "/noship/files-{}".format(package_name))
image_dir + "/noship/files-{}".format(package_name))
# Remove bundles with blacklisted characters, such as dot files
def trim_bundles(bundles):
+1 -1
View File
@@ -1,5 +1,5 @@
AC_PREREQ([2.68])
AC_INIT([bundle-chroot-builder],[1.04],[tudor.marcu@intel.com],[bundle-chroot-builder])
AC_INIT([bundle-chroot-builder],[1.09],[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)