From f04b08002e9e23ed6d964b79a777843f20d5d223a2d0f588f51bae8082109b73 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 25 May 2021 10:47:49 +0000 Subject: [PATCH] - Add wrapper script to set COCCINELLE_HOME [boo#1184563] OBS-URL: https://build.opensuse.org/package/show/devel:tools/coccinelle?expand=0&rev=81 --- coccinelle.changes | 5 +++++ coccinelle.spec | 33 +++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/coccinelle.changes b/coccinelle.changes index 22b4b56..0f617f0 100644 --- a/coccinelle.changes +++ b/coccinelle.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue May 25 10:47:33 UTC 2021 - Jan Engelhardt + +- Add wrapper script to set COCCINELLE_HOME [boo#1184563] + ------------------------------------------------------------------- Tue Apr 13 13:13:13 UTC 2021 - ohering@suse.de diff --git a/coccinelle.spec b/coccinelle.spec index 203219e..73c0213 100644 --- a/coccinelle.spec +++ b/coccinelle.spec @@ -1,7 +1,7 @@ # # spec file for package coccinelle # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,15 +29,15 @@ BuildRequires: autoconf BuildRequires: automake BuildRequires: fdupes BuildRequires: ncurses-devel -BuildRequires: ocaml(ocaml.opt) BuildRequires: ocaml-ocamldoc >= 3.11 +BuildRequires: python-rpm-macros +BuildRequires: ocaml(ocaml.opt) BuildRequires: ocamlfind(findlib) BuildRequires: ocamlfind(menhir) BuildRequires: ocamlfind(parmap) BuildRequires: ocamlfind(pcre) BuildRequires: ocamlfind(pyml) BuildRequires: ocamlfind(stdcompat) -BuildRequires: python-rpm-macros BuildRequires: pkgconfig(python3) Requires: python3-base @@ -62,9 +62,10 @@ fixing bugs in systems code. autoreconf -fi %configure # internal copy of stdcompat -make -j1 +%make_build -j1 %install +b="%buildroot" # "because it is simply not possible to strip ocaml binaries that are built # with the -custom option." export NO_BRP_STRIP_DEBUG=true @@ -76,14 +77,26 @@ export NO_DEBUGINFO_STRIP_DEBUG=true %make_install # Remove coccilib, don't have the deps -rm -Rf "%buildroot/%_libdir/%name"/{commons,globals,ocaml,parsing_c} \ - "%buildroot/%_mandir/man3"/Coccilib* -%fdupes %buildroot/%_prefix +rm -Rf "$b/%_libdir/%name"/{commons,globals,ocaml,parsing_c} \ + "$b/%_mandir/man3"/Coccilib* + +# Until https://github.com/coccinelle/coccinelle/issues/259 is fixed +for i in spatch spgen; do + mv -v "$b/%_bindir/$i" "$b/%_bindir/$i.bin" + cat >"$b/%_bindir/$i" <<-EOF + #!/bin/bash + if test -z "\$COCCINELLE_HOME"; then export COCCINELLE_HOME="%_libdir/coccinelle"; fi + exec %_bindir/$i.bin "\$@" + EOF + chmod -v a+x "$b/%_bindir/$i" +done + +%fdupes $b/%_prefix # Python library have been named after directories in the site-packages hierarchy -mkdir -p "%buildroot/%python3_sitelib" -mv "%buildroot/%_libdir/%name/python/coccilib" "%buildroot/%python3_sitelib" -%fdupes %buildroot/%python3_sitelib/coccilib +mkdir -p "$b/%python3_sitelib" +mv "$b/%_libdir/%name/python/coccilib" "$b/%python3_sitelib" +%fdupes $b/%python3_sitelib/coccilib %files %doc authors.txt bugs.txt changes.txt copyright.txt credits.txt