From 302d74394bc6673adb627c3b055e2a74078e58b8 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 7 Feb 2025 08:20:05 +0100 Subject: [PATCH] dyninst: cleanup package (#47637) * Use more idiomatic construct, shorten recipe * Remove deprecated versions, and associated patches * Remove v10.0.0 --- .../repos/builtin/packages/dyninst/package.py | 148 +++--------------- .../packages/dyninst/stackanalysis_h.patch | 11 -- .../builtin/packages/dyninst/tribool.patch | 34 ---- .../packages/dyninst/v9.3.2-auto.patch | 73 --------- .../repos/builtin/packages/stat/package.py | 8 +- 5 files changed, 22 insertions(+), 252 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/dyninst/stackanalysis_h.patch delete mode 100644 var/spack/repos/builtin/packages/dyninst/tribool.patch delete mode 100644 var/spack/repos/builtin/packages/dyninst/v9.3.2-auto.patch diff --git a/var/spack/repos/builtin/packages/dyninst/package.py b/var/spack/repos/builtin/packages/dyninst/package.py index 7fe816c5ad5..1d4b22477bb 100644 --- a/var/spack/repos/builtin/packages/dyninst/package.py +++ b/var/spack/repos/builtin/packages/dyninst/package.py @@ -33,60 +33,30 @@ class Dyninst(CMakePackage): version("10.2.1", sha256="8077c6c7a12577d2ffdcd07521c1eb1b7367da94d9a7ef10bf14053aeaae7ba1") version("10.2.0", sha256="4212b93bef4563c7de7dce4258e899bcde52315a571087e87fde9f8040123b43") version("10.1.0", sha256="4a121d70c1bb020408a7a697d74602e18250c3c85800f230566fcccd593c0129") - version("10.0.0", sha256="542fccf5c57c4fe784b1a9a9e3db01d40b16ad04e7174dc6f7eb23440485ba06") - version( - "9.3.2", tag="v9.3.2", commit="5d2ddacb273682daa014ae22f17f3575e05b411e", deprecated=True - ) - version( - "9.3.0", tag="v9.3.0", commit="9b8e9c1f16d4616b827d2d36955604a8e3fb915c", deprecated=True - ) - version( - "9.2.0", tag="v9.2.0", commit="3a6ad66df7294417cf61618acdcfcc0fecccb045", deprecated=True - ) - version( - "9.1.0", tag="v9.1.0", commit="df6d090061bae7ff2ba5a6bd57bb2ecbf538ef7a", deprecated=True - ) - version( - "8.2.1", tag="v8.2.1", commit="939afcbad1a8273636a3686a31b51dae4f1f0c11", deprecated=True - ) - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated + depends_on("c", type="build") + depends_on("cxx", type="build") - variant( - "openmp", - default=True, - description="Enable OpenMP support for ParseAPI " "(version 10.0.0 or later)", - ) + variant("openmp", default=True, description="Enable OpenMP support for ParseAPI ") variant("static", default=False, description="Build static libraries") variant("stat_dysect", default=False, description="Patch for STAT's DySectAPI") - boost_libs = ( - "+atomic+chrono+date_time+filesystem+system+thread+timer+container+random+exception" + depends_on( + "boost+atomic+chrono+date_time+filesystem+system+thread+timer+container+random+exception" ) - - depends_on("boost@1.61.0:" + boost_libs, when="@10.1.0:") - depends_on("boost@1.61.0:1.69" + boost_libs, when="@:10.0") - depends_on("boost@1.67.0:" + boost_libs, when="@11.0.0:") - depends_on("boost@1.70.0:" + boost_libs, when="@12:12.3.0") - depends_on("boost@1.71.0:" + boost_libs, when="@13:") + depends_on("boost@1.61.0:", when="@10.1.0:") + depends_on("boost@1.67.0:", when="@11.0.0:") + depends_on("boost@1.70.0:", when="@12:12.3.0") + depends_on("boost@1.71.0:", when="@13:") depends_on("libiberty+pic") - # Dyninst uses elfutils starting with 9.3.0, and used libelf - # before that. - # NB: Parallel DWARF parsing in Dyninst 10.2.0 requires a thread- - # safe libdw + # Parallel DWARF parsing requires a thread-safe libdw + depends_on("elfutils", type="link") depends_on("elfutils@0.186:", type="link", when="@12.0.1:") depends_on("elfutils@0.178:", type="link", when="@10.2.0:") - depends_on("elfutils", type="link", when="@9.3.0:10.1") - depends_on("libelf", type="link", when="@:9.2") - - # Dyninst uses libdw from elfutils starting with 10.0, and used - # libdwarf before that. - depends_on("libdwarf", when="@:9") with when("@:12.3.0"): # findtbb.cmake in the dynist repo does not work with recent tbb @@ -95,21 +65,16 @@ class Dyninst(CMakePackage): conflicts("^intel-oneapi-tbb@2021.1:") conflicts("^intel-parallel-studio") - depends_on("intel-tbb@2019.9:", when="@13.0.0:") - depends_on("tbb@2018.6.0:", when="@10.0.0:12.3.0") + depends_on("tbb") + requires("^[virtuals=tbb] intel-tbb@2019.9:", when="@13.0.0:") with when("@13.0.0:"): depends_on("cmake@3.14.0:", type="build") conflicts("cmake@3.19.0") depends_on("cmake@3.4.0:", type="build", when="@10.1.0:") - depends_on("cmake@3.0.0:", type="build", when="@10.0.0:10.0") - depends_on("cmake@2.8:", type="build", when="@:9") patch("stat_dysect.patch", when="+stat_dysect") - patch("stackanalysis_h.patch", when="@9.2.0") - patch("v9.3.2-auto.patch", when="@9.3.2 %gcc@:4.7") - patch("tribool.patch", when="@9.3.0:10.0.0 ^boost@1.69:") patch( "missing_include_deque.patch", when="@10.0.0:12.2.0", @@ -124,92 +89,21 @@ class Dyninst(CMakePackage): # Version 11.0 requires a C++11-compliant ABI conflicts("%gcc@:5", when="@11.0.0:") - # Versions 9.3.x used cotire, but have no knob to turn it off. - # Cotire has no real use for one-time builds and can break - # parallel builds with both static and shared libs. - @when("@9.3.0:9.3") - def patch(self): - filter_file("USE_COTIRE true", "USE_COTIRE false", "cmake/shared.cmake") - - # New style cmake args, starting with 10.1. - @when("@10.1.0:") def cmake_args(self): spec = self.spec - args = [ - "-DBoost_ROOT_DIR=%s" % spec["boost"].prefix, - "-DElfUtils_ROOT_DIR=%s" % spec["elf"].prefix, - "-DLibIberty_ROOT_DIR=%s" % spec["libiberty"].prefix, - "-DTBB_ROOT_DIR=%s" % spec["tbb"].prefix, + self.define("Boost_ROOT_DIR", spec["boost"].prefix), + self.define("ElfUtils_ROOT_DIR", spec["elfutils"].prefix), + self.define("LibIberty_ROOT_DIR", spec["libiberty"].prefix), + self.define("TBB_ROOT_DIR", spec["tbb"].prefix), self.define("LibIberty_LIBRARIES", spec["libiberty"].libs), + self.define_from_variant("USE_OpenMP", "openmp"), + self.define_from_variant("ENABLE_STATIC_LIBS", "static"), ] - if spec.satisfies("+openmp"): - args.append("-DUSE_OpenMP=ON") - else: - args.append("-DUSE_OpenMP=OFF") - - if spec.satisfies("+static"): - args.append("-DENABLE_STATIC_LIBS=YES") - else: - args.append("-DENABLE_STATIC_LIBS=NO") - - # Make sure Dyninst doesn't try to build its own dependencies - # outside of Spack + # Make sure Dyninst doesn't try to build its own dependencies outside of Spack if spec.satisfies("@10.2.0:12.3.0"): - args.append("-DSTERILE_BUILD=ON") - - return args - - # Old style cmake args, up through 10.0. - @when("@:10.0") - def cmake_args(self): - spec = self.spec - - # Elf -- the directory containing libelf.h. - elf = spec["elf"].prefix - elf_include = os.path.dirname(find_headers("libelf", elf.include, recursive=True)[0]) - - # Dwarf -- the directory containing elfutils/libdw.h or - # libdwarf.h, and the path to libdw.so or libdwarf.so. - if spec.satisfies("@10.0.0:"): - dwarf_include = elf.include - dwarf_lib = find_libraries("libdw", elf, recursive=True) - else: - dwarf_include = spec["libdwarf"].prefix.include - dwarf_lib = spec["libdwarf"].libs - - args = [ - "-DPATH_BOOST=%s" % spec["boost"].prefix, - "-DIBERTY_LIBRARIES=%s" % spec["libiberty"].libs, - "-DLIBELF_INCLUDE_DIR=%s" % elf_include, - "-DLIBELF_LIBRARIES=%s" % spec["elf"].libs, - "-DLIBDWARF_INCLUDE_DIR=%s" % dwarf_include, - "-DLIBDWARF_LIBRARIES=%s" % dwarf_lib, - ] - - # TBB include and lib directories, version 10.x or later. - if spec.satisfies("@10.0.0:"): - args.extend( - [ - "-DTBB_INCLUDE_DIRS=%s" % spec["tbb"].prefix.include, - "-DTBB_LIBRARY=%s" % spec["tbb"].prefix.lib, - ] - ) - - # Openmp applies to version 10.x or later. - if spec.satisfies("@10.0.0:"): - if spec.satisfies("+openmp"): - args.append("-DUSE_OpenMP=ON") - else: - args.append("-DUSE_OpenMP=OFF") - - # Static libs started with version 9.1.0. - if spec.satisfies("@9.1.0:"): - if spec.satisfies("+static"): - args.append("-DENABLE_STATIC_LIBS=1") - else: - args.append("-DENABLE_STATIC_LIBS=NO") + args.append(self.define("STERILE_BUILD", True)) return args diff --git a/var/spack/repos/builtin/packages/dyninst/stackanalysis_h.patch b/var/spack/repos/builtin/packages/dyninst/stackanalysis_h.patch deleted file mode 100644 index 2c04d935d92..00000000000 --- a/var/spack/repos/builtin/packages/dyninst/stackanalysis_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/dataflowAPI/h/stackanalysis.h 2016-06-29 14:54:14.000000000 -0700 -+++ b/dataflowAPI/h/stackanalysis.h 2016-08-02 09:50:13.619079000 -0700 -@@ -331,7 +331,7 @@ - - // To build intervals, we must replay the effect of each instruction. - // To avoid sucking enormous time, we keep those transfer functions around... -- typedef std::map> -+ typedef std::map > - InstructionEffects; - - DATAFLOW_EXPORT StackAnalysis(); diff --git a/var/spack/repos/builtin/packages/dyninst/tribool.patch b/var/spack/repos/builtin/packages/dyninst/tribool.patch deleted file mode 100644 index fa7bd3882cd..00000000000 --- a/var/spack/repos/builtin/packages/dyninst/tribool.patch +++ /dev/null @@ -1,34 +0,0 @@ -Add explicit casts from boost::tribool to bool. Starting with 1.69, -tribool added 'explicit' to the conversion operator to bool, and this -was breaking the build when using boost >= 1.69. - -Patch is from: https://github.com/dyninst/dyninst/commit/54a2debd9 - - -diff --git a/dataflowAPI/rose/util/Message.C b/dataflowAPI/rose/util/Message.C -index a8a66ad4c..5e276f97d 100644 ---- a/dataflowAPI/rose/util/Message.C -+++ b/dataflowAPI/rose/util/Message.C -@@ -1123,7 +1123,7 @@ StreamBuf::bake() { - destination_->bakeDestinations(message_.properties(), baked_/*out*/); - anyUnbuffered_ = false; - for (BakedDestinations::const_iterator bi=baked_.begin(); bi!=baked_.end() && !anyUnbuffered_; ++bi) -- anyUnbuffered_ = !bi->second.isBuffered; -+ anyUnbuffered_ = static_cast(!bi->second.isBuffered); - isBaked_ = true; - } - } -diff --git a/dataflowAPI/rose/util/Message.h b/dataflowAPI/rose/util/Message.h -index 816f68d2e..03592cb97 100644 ---- a/dataflowAPI/rose/util/Message.h -+++ b/dataflowAPI/rose/util/Message.h -@@ -386,7 +386,8 @@ struct SAWYER_EXPORT ColorSpec { - ColorSpec(AnsiColor fg, AnsiColor bg, bool bold): foreground(fg), background(bg), bold(bold) {} - - /** Returns true if this object is in its default-constructed state. */ -- bool isDefault() const { return COLOR_DEFAULT==foreground && COLOR_DEFAULT==background && !bold; } -+ bool isDefault() const { return COLOR_DEFAULT==foreground && COLOR_DEFAULT==background -+ && static_cast(!bold); } - }; - - /** Colors to use for each message importance. diff --git a/var/spack/repos/builtin/packages/dyninst/v9.3.2-auto.patch b/var/spack/repos/builtin/packages/dyninst/v9.3.2-auto.patch deleted file mode 100644 index 74fa2dfeab4..00000000000 --- a/var/spack/repos/builtin/packages/dyninst/v9.3.2-auto.patch +++ /dev/null @@ -1,73 +0,0 @@ -Change some 'for (const auto& t: type)' usage to the older but -equivalent 'for (auto t = type.begin(); ...)'. This patch allows -dyninst 9.3.2 to build with gcc 4.4 which doesn't support the newer -syntax. - - -diff --git a/dyninstAPI/src/BPatch.C b/dyninstAPI/src/BPatch.C -index ebf7db0c4..49fe69f9a 100644 ---- a/dyninstAPI/src/BPatch.C -+++ b/dyninstAPI/src/BPatch.C -@@ -166,16 +166,16 @@ BPatch::BPatch() - stdTypes = BPatch_typeCollection::getGlobalTypeCollection(); - vector *sTypes = Symtab::getAllstdTypes(); - BPatch_type* type = NULL; -- for(const auto& t: *sTypes) { -- stdTypes->addType(type = new BPatch_type(t)); -+ for(auto t = sTypes->begin(); t != sTypes->end(); ++t) { -+ stdTypes->addType(type = new BPatch_type(*t)); - type->decrRefCount(); - } - delete sTypes; - - builtInTypes = new BPatch_builtInTypeCollection; - sTypes = Symtab::getAllbuiltInTypes(); -- for(const auto& t: *sTypes) { -- builtInTypes->addBuiltInType(type = new BPatch_type(t)); -+ for(auto t = sTypes->begin(); t != sTypes->end(); ++t) { -+ builtInTypes->addBuiltInType(type = new BPatch_type(*t)); - type->decrRefCount(); - } - delete sTypes; -diff --git a/dyninstAPI/src/BPatch_collections.C b/dyninstAPI/src/BPatch_collections.C -index f4e2986a3..129f8b74a 100644 ---- a/dyninstAPI/src/BPatch_collections.C -+++ b/dyninstAPI/src/BPatch_collections.C -@@ -172,12 +172,12 @@ BPatch_typeCollection::~BPatch_typeCollection() - assert(refcount == 0 || - refcount == 1); - -- for(const auto& t: typesByName) { -- t.second->decrRefCount(); -+ for(auto t = typesByName.begin(); t != typesByName.end(); ++t) { -+ t->second->decrRefCount(); - } - -- for(const auto& t: typesByID) { -- t.second->decrRefCount(); -+ for(auto t = typesByID.begin(); t != typesByID.end(); ++t) { -+ t->second->decrRefCount(); - } - } - -diff --git a/symtabAPI/src/Collections.C b/symtabAPI/src/Collections.C -index 7431dd6bf..43c339f45 100644 ---- a/symtabAPI/src/Collections.C -+++ b/symtabAPI/src/Collections.C -@@ -318,12 +318,12 @@ typeCollection::typeCollection() : - typeCollection::~typeCollection() - { - // delete all of the types -- for(const auto& t: typesByName) { -- t.second->decrRefCount(); -+ for(auto t = typesByName.begin(); t != typesByName.end(); ++t) { -+ t->second->decrRefCount(); - } - -- for(const auto& t: typesByID) { -- t.second->decrRefCount(); -+ for(auto t = typesByID.begin(); t != typesByID.end(); ++t) { -+ t->second->decrRefCount(); - } - } - diff --git a/var/spack/repos/builtin/packages/stat/package.py b/var/spack/repos/builtin/packages/stat/package.py index d398933b7b9..e6020237dec 100644 --- a/var/spack/repos/builtin/packages/stat/package.py +++ b/var/spack/repos/builtin/packages/stat/package.py @@ -35,11 +35,6 @@ class Stat(AutotoolsPackage): sha256="9ece10dde8e1579c9db469ac8d2391b26e59498c0947dbb271c2d01d7ef0a65d", url="https://github.com/LLNL/STAT/releases/download/v4.0.2/stat-4.0.2.tar.gz", ) - version( - "4.0.1", - sha256="ae3fbd6946003fb16233d82d40285780a9a802da5fe30d09adb8a8b2a2cc4ad6", - url="https://github.com/LLNL/STAT/files/2489327/stat-4.0.1.tar.gz", - ) depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated @@ -56,8 +51,7 @@ class Stat(AutotoolsPackage): depends_on("libtool", type="build") depends_on("dyninst", when="@4.2.1:") depends_on("dyninst@:11.9", when="~dysect @:4.2.0") - depends_on("dyninst@:9", when="@:4.0.1") - depends_on("dyninst@8.2.1+stat_dysect", when="+dysect") + depends_on("dyninst +stat_dysect", when="+dysect") # we depend on fgfs@master to avoid seg faults with fgfs 1.1 depends_on("fast-global-file-status@1.1.1:", when="+fgfs") depends_on("graphlib@3.0.0")