mirror of
https://github.com/clearlinux/bundle-chroot-builder.git
synced 2026-08-19 03:57:21 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58ddb254dc | |||
| 18620f4efb | |||
| efaa5b9051 | |||
| d5d8692156 | |||
| ef79a9ce59 | |||
| 2d1f4a75cd | |||
| 24d8b59fdf | |||
| 4cdc1ea888 | |||
| e14a928b37 |
@@ -2,3 +2,9 @@
|
|||||||
SERVER_STATE_DIR = /var/lib/update
|
SERVER_STATE_DIR = /var/lib/update
|
||||||
BUNDLE_DIR = /home/clr/mix/bundles
|
BUNDLE_DIR = /home/clr/mix/bundles
|
||||||
YUM_CONF = /usr/share/defaults/bundle-chroot-builder/yum.conf
|
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
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ def read_config(args):
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(buildconf)
|
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"""
|
"""Read the configuration file for our script values"""
|
||||||
conf = config['Builder']
|
conf = config['Builder']
|
||||||
state_dir = conf['SERVER_STATE_DIR']
|
state_dir = conf['SERVER_STATE_DIR']
|
||||||
@@ -67,12 +72,15 @@ def read_config(args):
|
|||||||
|
|
||||||
def install_bundle(out_dir, postfix, bundle, bundles, yum_cmd):
|
def install_bundle(out_dir, postfix, bundle, bundles, yum_cmd):
|
||||||
"""Helper function to yum install a bundle"""
|
"""Helper function to yum install a bundle"""
|
||||||
m4 = subprocess.Popen(["m4", bundles + "/" + bundle], cwd=bundles, stdout=subprocess.PIPE)
|
lines = []
|
||||||
m4.wait()
|
with subprocess.Popen(["m4", bundles + "/" + bundle], cwd=bundles, stdout=subprocess.PIPE, bufsize=1, universal_newlines=True) as p:
|
||||||
pkgs = m4.stdout.readlines()
|
for line in p.stdout:
|
||||||
|
lines.append(line)
|
||||||
|
|
||||||
|
pkgs = "".join(lines)
|
||||||
to_install = []
|
to_install = []
|
||||||
for pkg in pkgs:
|
for pkg in pkgs.splitlines():
|
||||||
pkg = pkg.decode("utf-8").strip()
|
pkg = pkg.strip()
|
||||||
# Don't add blank lines or lines with leading '#'
|
# Don't add blank lines or lines with leading '#'
|
||||||
if len(pkg) == 0 or pkg[0] == "#":
|
if len(pkg) == 0 or pkg[0] == "#":
|
||||||
continue
|
continue
|
||||||
@@ -271,6 +279,36 @@ def create_chroots(args, state_dir, bundles, yum_conf):
|
|||||||
for r in results_list:
|
for r in results_list:
|
||||||
r.get()
|
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")
|
print("Creating package to file mappings")
|
||||||
package_mapping = {}
|
package_mapping = {}
|
||||||
map_files = [f for f in os.listdir(out_dir) if f.startswith("pkgmap-")]
|
map_files = [f for f in os.listdir(out_dir) if f.startswith("pkgmap-")]
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
AC_PREREQ([2.68])
|
AC_PREREQ([2.68])
|
||||||
AC_INIT([bundle-chroot-builder],[1.00],[tudor.marcu@intel.com],[bundle-chroot-builder])
|
AC_INIT([bundle-chroot-builder],[1.03],[tudor.marcu@intel.com],[bundle-chroot-builder])
|
||||||
AM_INIT_AUTOMAKE([foreign silent-rules color-tests no-dist-gzip dist-xz])
|
AM_INIT_AUTOMAKE([foreign silent-rules color-tests no-dist-gzip dist-xz])
|
||||||
AC_CONFIG_FILES(Makefile)
|
AC_CONFIG_FILES(Makefile)
|
||||||
AC_PREFIX_DEFAULT(/usr/local)
|
AC_PREFIX_DEFAULT(/usr/local)
|
||||||
|
|||||||
Reference in New Issue
Block a user