Compare commits

..

7 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
tmarcu 4cdc1ea888 Merge pull request #2 from clearlinux/url_confs
Add url for swupd in builder.conf
2016-03-24 17:01:23 -07:00
Tudor Marcu e14a928b37 Add url for swupd in builder.conf
The update client currently defaults to the public clearlinux url, and must be
overridden with cmd line options to use other version/content/format urls. This
introduces a problem when running a mix, and not supplying the mix URL will
cause swupd to update from the official URL, rather than the mixer url.
With this patch, the URLs can all be specified and are inserted into conf files
that the swupd client will read, to know what URL to default to.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-03-24 16:42:36 -07:00
3 changed files with 49 additions and 6 deletions
+6
View File
@@ -2,3 +2,9 @@
SERVER_STATE_DIR = /var/lib/update
BUNDLE_DIR = /home/clr/mix/bundles
YUM_CONF = /usr/share/defaults/bundle-chroot-builder/yum.conf
[swupd]
BUNDLE=os-core-update
CONTENTURL=https://download.clearlinux.org/update/
VERSIONURL=https://download.clearlinux.org/update/
FORMAT=3
+42 -5
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
@@ -271,6 +278,36 @@ def create_chroots(args, state_dir, bundles, yum_conf):
for r in results_list:
r.get()
"""Read the URL values from builder.conf and insert them into os-core-update to swupd knows where to pull content from"""
buildconf='/usr/share/defaults/bundle-chroot-builder/builder.conf'
if os.path.isfile('/etc/bundle-chroot-builder/builder.conf'):
buildconf = '/etc/bundle-chroot-builder/builder.conf'
if args.config:
buildconf = args.config
config = configparser.ConfigParser()
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']
contenturl = conf['CONTENTURL']
versionurl = conf['VERSIONURL']
formatname = conf['FORMAT']
"""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:
file.writelines(versionurl)
with open(os.path.join(confpath, "format"), "w") as file:
file.writelines(formatname)
print("Creating package to file mappings")
package_mapping = {}
map_files = [f for f in os.listdir(out_dir) if f.startswith("pkgmap-")]
+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)