Compare commits

...

5 Commits

Author SHA1 Message Date
Tudor Marcu efaa5b9051 Release v1.02
This release includes fixes for validating builder.conf is correct, and fixes a
bug where the chroot builder would loop forever if m4 output was too large.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-03-29 11:54:08 -07:00
Tudor Marcu d5d8692156 Remove URL option as content & version are enough
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-03-28 14:16:54 -07:00
Tudor Marcu ef79a9ce59 Fix m4 infinite wait()
If there are a lot of packages then the m4 output will overflow the max
PIPE buffer, and the wait() will never finish. This patch reads the output
in chunks and then creates a string of the entire output to pass to yum.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-03-28 14:09:50 -07:00
Tudor Marcu 2d1f4a75cd Make sure builder.conf is filled correctly
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-03-25 17:02:51 -07:00
Tudor Marcu 24d8b59fdf 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 <tudor.marcu@intel.com>
2016-03-25 13:08:32 -07:00
3 changed files with 20 additions and 12 deletions
-1
View File
@@ -5,7 +5,6 @@ YUM_CONF = /usr/share/defaults/bundle-chroot-builder/yum.conf
[swupd]
BUNDLE=os-core-update
URL=https://download.clearlinux.org/update/
CONTENTURL=https://download.clearlinux.org/update/
VERSIONURL=https://download.clearlinux.org/update/
FORMAT=3
+19 -10
View File
@@ -56,6 +56,11 @@ def read_config(args):
config = configparser.ConfigParser()
config.read(buildconf)
for option in ['SERVER_STATE_DIR', 'BUNDLE_DIR', 'YUM_CONF']:
if config.has_option('Builder', option) == False:
print("ERROR:\nbuilder.conf is missing:\n[Builder]\n%s\n" % option)
exit(1)
"""Read the configuration file for our script values"""
conf = config['Builder']
state_dir = conf['SERVER_STATE_DIR']
@@ -67,12 +72,14 @@ def read_config(args):
def install_bundle(out_dir, postfix, bundle, bundles, yum_cmd):
"""Helper function to yum install a bundle"""
m4 = subprocess.Popen(["m4", bundles + "/" + bundle], cwd=bundles, stdout=subprocess.PIPE)
m4.wait()
pkgs = m4.stdout.readlines()
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)
pkgs = "".join(lines)
to_install = []
for pkg in pkgs:
pkg = pkg.decode("utf-8").strip()
for pkg in pkgs.splitlines():
# Don't add blank lines or lines with leading '#'
if len(pkg) == 0 or pkg[0] == "#":
continue
@@ -281,17 +288,19 @@ def create_chroots(args, state_dir, bundles, yum_conf):
config.read(buildconf)
"""Read the configuration file for our script values"""
for option in ['BUNDLE', 'CONTENTURL', 'VERSIONURL', 'FORMAT']:
if config.has_option('swupd', option) == False:
print("ERROR:\nbuilder.conf is missing:\n[swupd]\n%s\n" % option)
exit(1)
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/")
os.mkdir(confpath)
with open(os.path.join(confpath, "url"), "w") as file:
file.writelines(url)
"""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)
with open(os.path.join(confpath, "versionurl"), "w") as file:
+1 -1
View File
@@ -1,5 +1,5 @@
AC_PREREQ([2.68])
AC_INIT([bundle-chroot-builder],[1.00],[tudor.marcu@intel.com],[bundle-chroot-builder])
AC_INIT([bundle-chroot-builder],[1.02],[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)