mirror of
https://github.com/clearlinux/bundle-chroot-builder.git
synced 2026-06-29 09:05:51 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| efaa5b9051 | |||
| d5d8692156 | |||
| ef79a9ce59 | |||
| 2d1f4a75cd | |||
| 24d8b59fdf | |||
| 4cdc1ea888 | |||
| e14a928b37 |
@@ -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
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user