mirror of
https://github.com/clearlinux/autospec.git
synced 2026-06-16 02:45:56 +00:00
Add support for a copy_prepend config file
This patch has a few interrelated changes in it but primarily it is supporting a new copy_prepend configuration file for autospec. This is intended to support cases where changes should be made to the source directory prior to the source directory being copied for different builds (avx2, 32bit, etc). Also with this change some tweaks to how cmake builds are handled to be more aligned with other build systems. Primarily that the source directoy is now fully copied rather than just creating a cmake build directory per build in the same source directory. Finally check support has been updated to account for the new path and update support for meson and apx. Signed-off-by: William Douglas <william.douglas@intel.com>
This commit is contained in:
committed by
William Douglas
parent
3f1fa8e70b
commit
dc0ff31b43
@@ -268,6 +268,12 @@ prep_prepend
|
||||
resulting ``.spec``, and is used for situations where fine-grained
|
||||
control is required.
|
||||
|
||||
copy_prepend
|
||||
Additional actions that should take place directly before the source
|
||||
directory is copied for other builds (32bit, avx2, etc). This will be
|
||||
placed in the resulting ``.spec``, and is used for situations where
|
||||
fine-grained control is required.
|
||||
|
||||
build_prepend
|
||||
Additional actions that should take place after ``%build`` and before
|
||||
the ``%configure`` macro or equivalent (``%cmake``, etc.). If autospec
|
||||
|
||||
+11
-5
@@ -97,17 +97,23 @@ def scan_for_tests(src_dir, config, requirements, content):
|
||||
}
|
||||
if config.config_opts.get('32bit'):
|
||||
testsuites["makecheck"] += "\ncd ../build32;\n" + make_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../clr-build32;\n" + cmake_check + " || :"
|
||||
testsuites["meson"] += "\ncd ../build32;\n" + meson_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../../build32/clr-build32;\n" + cmake_check + " || :"
|
||||
testsuites["meson"] += "\ncd ../buildapx;\n" + meson_check + " || :"
|
||||
if config.config_opts.get('use_avx2'):
|
||||
testsuites["makecheck"] += "\ncd ../buildavx2;\n" + make_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../clr-build-avx2;\n" + cmake_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../../buildavx2/clr-build-avx2;\n" + cmake_check + " || :"
|
||||
testsuites["meson"] += "\ncd ../buildapx;\n" + meson_check + " || :"
|
||||
if config.config_opts.get('use_avx512'):
|
||||
testsuites["makecheck"] += "\ncd ../buildavx512;\n" + make_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../clr-build-avx512;\n" + cmake_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../../buildavx512/clr-build-avx512;\n" + cmake_check + " || :"
|
||||
testsuites["meson"] += "\ncd ../buildapx;\n" + meson_check + " || :"
|
||||
if config.config_opts.get('use_apx'):
|
||||
testsuites["makecheck"] += "\ncd ../buildapx;\n" + make_check + " || :"
|
||||
testsuites["cmake"] += "\ncd ../../buildapx/clr-build-apx;\n" + cmake_check + " || :"
|
||||
testsuites["meson"] += "\ncd ../buildapx;\n" + meson_check + " || :"
|
||||
if config.config_opts.get('openmpi'):
|
||||
testsuites["makecheck"] += "\ncd ../build-openmpi;\n" + make_check_openmpi
|
||||
testsuites["cmake"] += "\ncd ../clr-build-openmpi;\n" + cmake_check_openmpi
|
||||
testsuites["cmake"] += "\ncd ../../build-openmpi/clr-build-openmpi;\n" + cmake_check_openmpi
|
||||
|
||||
files = os.listdir(src_dir)
|
||||
|
||||
|
||||
+8
-4
@@ -91,6 +91,7 @@ class Config(object):
|
||||
self.install_macro = "%make_install"
|
||||
self.disable_static = "--disable-static"
|
||||
self.prep_prepend = []
|
||||
self.copy_prepend = []
|
||||
self.build_prepend = []
|
||||
self.build_prepend_once = []
|
||||
self.build_append = []
|
||||
@@ -437,10 +438,11 @@ class Config(object):
|
||||
# next the options
|
||||
config_f['autospec'] = {}
|
||||
for fname, comment in sorted(self.config_options.items()):
|
||||
fpath = os.path.join(self.download_path, fname)
|
||||
config_f.set('autospec', '# {}'.format(comment))
|
||||
if os.path.exists(fname):
|
||||
if os.path.isfile(fpath):
|
||||
config_f['autospec'][fname] = 'true'
|
||||
os.remove(fname)
|
||||
os.remove(fpath)
|
||||
else:
|
||||
config_f['autospec'][fname] = 'false'
|
||||
|
||||
@@ -448,9 +450,10 @@ class Config(object):
|
||||
config_f['autospec']['use_lto'] = 'true'
|
||||
|
||||
# renamed options need special care
|
||||
if os.path.exists("skip_test_suite"):
|
||||
skip_path = os.path.join(self.download_path, "skip_test_suite")
|
||||
if os.path.exists(skip_path):
|
||||
config_f['autospec']['skip_tests'] = 'true'
|
||||
os.remove("skip_test_suite")
|
||||
os.remove(skip_path)
|
||||
self.write_config(config_f)
|
||||
|
||||
def create_buildreq_cache(self, version, buildreqs_cache):
|
||||
@@ -1004,6 +1007,7 @@ class Config(object):
|
||||
requirements.add_buildreq("openssh")
|
||||
|
||||
self.prep_prepend = self.read_script_file(os.path.join(self.download_path, "prep_prepend"))
|
||||
self.copy_prepend = self.read_script_file(os.path.join(self.download_path, "copy_prepend"))
|
||||
if os.path.isfile(os.path.join(self.download_path, "prep_append")):
|
||||
os.rename(os.path.join(self.download_path, "prep_append"), os.path.join(self.download_path, "build_prepend"))
|
||||
self.make_prepend = self.read_script_file(os.path.join(self.download_path, "make_prepend"))
|
||||
|
||||
+55
-26
@@ -520,27 +520,28 @@ class Specfile(object):
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.default_pattern != 'cmake':
|
||||
if self.config.config_opts['32bit']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} build32".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['use_avx2']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} buildavx2".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['use_avx512']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} buildavx512".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['use_apx']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} buildapx".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['openmpi']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} build-openmpi".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
self.write_copy_prepend()
|
||||
|
||||
if self.config.config_opts['32bit']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} build32".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['use_avx2']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} buildavx2".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['use_avx512']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} buildavx512".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['use_apx']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} buildapx".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['openmpi']:
|
||||
self._write_strip("pushd ..")
|
||||
self._write_strip("cp -a {} build-openmpi".format(self.content.tarball_prefix))
|
||||
self._write_strip("popd")
|
||||
self._write_strip("\n")
|
||||
|
||||
def write_32bit_exports(self):
|
||||
@@ -800,6 +801,14 @@ class Specfile(object):
|
||||
self._write_strip("{}\n".format(line))
|
||||
self._write_strip("## prep_prepend end")
|
||||
|
||||
def write_copy_prepend(self):
|
||||
"""Write out any custom supplied commands prior to creating source copies for avx, etc builds."""
|
||||
if self.config.copy_prepend:
|
||||
self._write_strip("## copy_prepend content")
|
||||
for line in self.config.copy_prepend:
|
||||
self._write_strip("{}\n".format(line))
|
||||
self._write_strip("## copy_prepend end")
|
||||
|
||||
def write_build_prepend(self):
|
||||
"""Write out any custom supplied commands at the start of the %build section and every build type."""
|
||||
if self.config.build_prepend:
|
||||
@@ -915,13 +924,11 @@ class Specfile(object):
|
||||
|
||||
self._write_strip("export GOAMD64=v2")
|
||||
|
||||
if self.config.subdir:
|
||||
self._write_strip("pushd " + self.config.subdir)
|
||||
|
||||
if self.config.config_opts['use_ninja'] and self.config.install_macro == '%make_install':
|
||||
self.config.install_macro = '%ninja_install'
|
||||
|
||||
if self.config.config_opts['32bit']:
|
||||
self._write_strip("pushd ../build32/" + self.config.subdir)
|
||||
self._write_strip("pushd clr-build32")
|
||||
self._write_strip("{}32 {} {}".format(self.config.install_macro,
|
||||
self.config.extra_make_install,
|
||||
@@ -939,30 +946,42 @@ class Specfile(object):
|
||||
self._write_strip(" popd")
|
||||
self._write_strip("fi")
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_avx2']:
|
||||
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
|
||||
self._write_strip("GOAMD64=v3")
|
||||
self._write_strip("pushd clr-build-avx2")
|
||||
self._write_strip("%s_v3 %s || :\n" % (self.config.install_macro, self.config.extra_make_install))
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_avx512']:
|
||||
self._write_strip("pushd ../buildavx512/" + self.config.subdir)
|
||||
self._write_strip("GOAMD64=v4")
|
||||
self._write_strip("pushd clr-build-avx512")
|
||||
self._write_strip("%s_v4 %s || :\n" % (self.config.install_macro, self.config.extra_make_install))
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_apx']:
|
||||
self._write_strip("pushd ../buildapx/" + self.config.subdir)
|
||||
self._write_strip("GOAMD64=v3")
|
||||
self._write_strip("pushd clr-build-apx")
|
||||
self._write_strip("%s_va %s || :\n" % (self.config.install_macro, self.config.extra_make_install))
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['openmpi']:
|
||||
self._write_strip("pushd ../build-openmpi/" + self.config.subdir)
|
||||
self._write_strip("GOAMD64=v3")
|
||||
self._write_strip("pushd clr-build-openmpi")
|
||||
self.write_install_openmpi()
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.subdir:
|
||||
self._write_strip("pushd " + self.config.subdir)
|
||||
|
||||
self._write_strip("GOAMD64=v2")
|
||||
self._write_strip("pushd clr-build")
|
||||
@@ -1656,7 +1675,11 @@ class Specfile(object):
|
||||
self.write_make_line()
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_avx2']:
|
||||
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
|
||||
self._write_strip("mkdir -p clr-build-avx2")
|
||||
self._write_strip("pushd clr-build-avx2")
|
||||
self.write_build_prepend()
|
||||
@@ -1669,8 +1692,10 @@ class Specfile(object):
|
||||
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
|
||||
self.write_make_line()
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_avx512']:
|
||||
self._write_strip("pushd ../buildavx512/" + self.config.subdir)
|
||||
self._write_strip("mkdir -p clr-build-avx512")
|
||||
self._write_strip("pushd clr-build-avx512")
|
||||
self.write_build_prepend()
|
||||
@@ -1683,8 +1708,10 @@ class Specfile(object):
|
||||
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
|
||||
self.write_make_line()
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
|
||||
self._write_strip("pushd ../buildapx/" + self.config.subdir)
|
||||
self._write_strip("mkdir -p clr-build-apx")
|
||||
self._write_strip("pushd clr-build-apx")
|
||||
self.write_build_prepend()
|
||||
@@ -1697,8 +1724,10 @@ class Specfile(object):
|
||||
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
|
||||
self.write_make_line()
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['32bit']:
|
||||
self._write_strip("pushd ../build32/" + self.config.subdir)
|
||||
self._write_strip("mkdir -p clr-build32")
|
||||
self._write_strip("pushd clr-build32")
|
||||
self.write_build_prepend()
|
||||
@@ -1711,8 +1740,10 @@ class Specfile(object):
|
||||
self.write_make_line()
|
||||
self._write_strip("unset PKG_CONFIG_PATH")
|
||||
self._write_strip("popd")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['openmpi']:
|
||||
self._write_strip("pushd ../build-openmpi/" + self.config.subdir)
|
||||
self._write_strip("mkdir -p clr-build-openmpi")
|
||||
self._write_strip("pushd clr-build-openmpi")
|
||||
self._write_strip(". /usr/share/defaults/etc/profile.d/modules.sh")
|
||||
@@ -1728,8 +1759,6 @@ class Specfile(object):
|
||||
self.write_make_line()
|
||||
self._write_strip("module unload openmpi")
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
|
||||
self._write_strip("\n")
|
||||
|
||||
Reference in New Issue
Block a user