Compare commits

..

2 Commits

Author SHA1 Message Date
Matthew Johnson 798b4e8906 Release v1.11
This release adds a configuration section for debuginfo banning in the
swupd-server configuration file server.ini.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-09-20 14:56:14 -07:00
Matthew Johnson 6a0cafa617 Add debuginfo configuration for server.ini
Add configuration for debuginfo bans to server.ini via builder.conf.
These configurations will be directly used by swupd-server to determine
if it should ban debuginfo files from the manifests and exactly which
paths should be banned. This patch cleans up the writing of the
server.ini file as well.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-09-19 10:33:16 -07:00
3 changed files with 49 additions and 13 deletions
+5
View File
@@ -10,3 +10,8 @@ BUNDLE=os-core-update
CONTENTURL=<URL where the content will be hosted>
VERSIONURL=<URL where the version of the mix will be hosted>
FORMAT=1
[Server]
debuginfo_banned=true
debuginfo_lib=/usr/lib/debug/
debuginfo_src=/usr/src/debug/
+43 -12
View File
@@ -47,16 +47,21 @@ def handle_options():
return args
def read_config(args):
def get_config(args):
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()
print("Reading from %s" % buildconf)
config.read(buildconf)
return config
def read_config(args):
config = get_config(args)
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)
@@ -151,6 +156,37 @@ def clean_bundle(out_dir, bundle, bundles, yum_cmd):
os.chdir(prev_dir)
def write_default_server_ini(state_dir, server_conf):
"""
Write default server.ini file in the state dir in the following format
[Server]
emptydir={state_dir}/empty/
imagebase={state_dir}/image/
outputdir={state_dir}/www/
[Debuginfo]
banned=true
lib=/usr/lib/debug/
src=/usr/src/debug/
"""
contents = ("[Server]\n"
"emptydir={0}/empty/\n"
"imagebase={0}/image/\n"
"outputdir={0}/www/\n".format(state_dir))
if server_conf:
contents += ("\n[Debuginfo]\n"
"banned={}\n"
"lib={}\n"
"src={}\n"
.format(server_conf.get('debuginfo_banned'),
server_conf.get('debuginfo_lib'),
server_conf.get('debuginfo_src')))
with open(state_dir + "/server.ini", "w+") as serverini:
serverini.write(contents)
def create_chroots(args, state_dir, bundles, yum_conf):
"""The state_dir should always be created if it does not exist"""
if os.path.isdir(state_dir) == False:
@@ -164,14 +200,15 @@ def create_chroots(args, state_dir, bundles, yum_conf):
if os.path.isdir(state_dir + "/www/0") == False:
os.makedirs(state_dir + "/www/0")
"""Create server.ini and groups.ini for create_update later on"""
with open(state_dir + "/server.ini", "w+") as serverini:
serverini.write("[Server]\nemptydir=" + state_dir + "/empty/\nimagebase=" + state_dir + "/image/\noutputdir=" + state_dir + "/www/\n")
# Create server.ini and groups.ini for create_update later on
config = get_config(args)
config = config['Server'] if 'Server' in config else {}
write_default_server_ini(state_dir, config)
with open(state_dir + "/groups.ini", "w+") as groupsini:
bundle_list = os.listdir(bundles)
bundle_list = trim_bundles(bundle_list)
for bundle in bundle_list:
groupsini.write("[" + bundle + "]\ngroup=" + bundle + "\n\n")
groupsini.write("[{0}]\ngroup={0}\n\n".format(bundle))
"""Setup chroots for bundles"""
bversion = ""
@@ -288,13 +325,7 @@ def create_chroots(args, state_dir, bundles, yum_conf):
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)
config = get_config(args)
"""Read the configuration file for our script values"""
for option in ['BUNDLE', 'CONTENTURL', 'VERSIONURL', 'FORMAT']:
+1 -1
View File
@@ -1,5 +1,5 @@
AC_PREREQ([2.68])
AC_INIT([bundle-chroot-builder],[1.10],[tudor.marcu@intel.com],[bundle-chroot-builder])
AC_INIT([bundle-chroot-builder],[1.11],[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)