Package coccinelle: Specfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | # coccinelle.spec %define _unpackaged_files_terminate_build 1 Name: coccinelle Version: 1.2 Release: alt1 Summary: Semantic patching for Linux (spatch) Group: Development/C License: GPL-2.0-only Url: http://coccinelle.lip6.fr/ Vcs: https://github.com/coccinelle/coccinelle.git Provides: spatch Requires: python3-dev Source: %name-%version.tar BuildRequires(pre): rpm-build-ocaml >= 1.6.1 BuildRequires(pre): rpm-build-python3 BuildRequires: ocaml >= 3.12.1 BuildRequires: ocaml-findlib BuildRequires: ocaml-menhir BuildRequires: ocaml-num-devel BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-parmap-devel BuildRequires: ocaml-pcre-devel BuildRequires: ocaml-stdcompat-devel BuildRequires: python3-dev # Bogus internal name %filter_from_requires /^python.*(coccinelle)/d # Bogus dependencies to OCaml AutoReqProv: noocaml # Only what's matter Provides: ocaml-cmi(Coccilib) = %version-%release Provides: ocaml-cmx(Coccilib) = %version-%release # No cocciguis (pida for vim, gtk output), yet %add_findreq_skiplist %python3_sitelibdir/coccilib/coccigui/* # No trac integraion %add_findreq_skiplist %python3_sitelibdir/coccilib/trac.py %description Coccinelle (French for "ladybug") is a utility for matching and transforming the source code of programs written in the C programming language. The source code to be matched or replaced is specified using a "semantic patch" syntax based on the patch syntax. The Semantic Patch Language (SmPL) pattern resembles a unified diff with C-like declarations. Coccinelle was initially used to aid the evolution of the Linux kernel (and ease the maintenance of device drivers), providing support for changes to APIs such as renaming a function, adding a function argument whose value is somehow context-dependent, and reorganizing a data structure. It can also be used to find bad programming patterns in code (i.e., pieces of code that are erroneous with high probability such as possible NULL pointer dereference) without transforming them. (Then coccinelle's role is close to that of static analysis tools.) %package demos %global demos_summary Demos of coccinelle semantic patches with C code examples Summary: %demos_summary Group: Documentation Requires: %name = %EVR BuildArch: noarch %description demos %demos_summary. They can be applied to the corresponding C code examples by a command like: spatch -sp_file F.cocci F.c and you'll get a normal patch for this C code example. The tests from coccinelle are also included in this package; they can be run with: spatch --testall --no-update-score-file in the directory which includes the tests/ subdir (with *.res files). %package checkinstall %global checkinstall_summary Immediately run some tests for %name Summary: %checkinstall_summary Group: Development/Other Requires: %name-demos = %EVR BuildArch: noarch %description checkinstall %checkinstall_summary. %prep %setup -q -n %{name}-%{version} sed -i '1s|^#!.*python.*|#!%__python3|' tools/pycocci # see https://bugzilla.altlinux.org/48475 find . -name Makefile | xargs sed -r -i 's/-custom\s/-output-complete-exe /g' %build ./autogen %configure \ --with-python=%__python3 \ %nil %make_build VERBOSE=1 %install %make DESTDIR=%buildroot install # relocate python module install -d %buildroot%python3_sitelibdir mv %buildroot%_libdir/coccinelle/python/coccilib %buildroot%python3_sitelibdir/ rm -rf %buildroot%_libdir/coccinelle/python # Somebody forgot to install this install ./tools/pycocci %buildroot%_bindir/pycocci %check PATH=%buildroot%_bindir:$PATH spatch --version spatch --version | grep -F 'spatch version %version ' %define run_tests \ demos=( \ simple # a simple demo \ python_identifier # with embedded Python \ ) \ for f in "${demos[@]}"; do \ spatch -sp_file demos/"$f".{cocci,c} \ done export COCCINELLE_HOME=%buildroot%_libdir/coccinelle export PYTHONPATH=%buildroot%python3_sitelibdir %run_tests # tests/SCORE_expected.sexp should be generated with previous version # of coccinelle by `spatch --testall`. if yes | spatch -macro_file standard.h --iso-file standard.iso --testall > log 2>&1; then echo :: SCORE TEST SUCCESS tail log else echo :: SCORE TEST FAILURE $? tail log exit 1 fi %pre checkinstall -p %_sbindir/sh-safely set -xe cd %_docdir/%name-demos-%version %run_tests %files %doc authors.txt bugs.txt changes.txt copyright.txt credits.txt %doc license.txt readme.txt %_bindir/pycocci %_bindir/spatch %_bindir/spgen %_libdir/%name/ %python3_sitelibdir/coccilib %_man1dir/*.1* %_man3dir/Coccilib.3cocci* /usr/share/bash-completion/completions/spatch %files demos %doc demos tests %files checkinstall %changelog * Sat Mar 30 2024 Vitaly Chikunov <vt@altlinux.org> 1.2-alt1 - Update to 1.2 (2024-03-28). * Wed Feb 28 2024 Ivan A. Melnikov <iv@altlinux.org> 1.1.1-alt2.1 - NMU: fix build w/o ocamlnative * Fri Feb 04 2022 Vitaly Chikunov <vt@altlinux.org> 1.1.1-alt2 - Fixed rebuild with python 3.10. - Resolved memory exhaustion when building on armh. * Tue Oct 12 2021 Vitaly Chikunov <vt@altlinux.org> 1.1.1-alt1 - Update to 1.1.1 (2021-09-06). * Tue May 11 2021 Vitaly Chikunov <vt@altlinux.org> 1.1.0-alt2 - spec: Avoid make install race. * Wed Mar 03 2021 Vitaly Chikunov <vt@altlinux.org> 1.1.0-alt1 - Update to 1.1.0 (2021-02-24). * Thu Feb 25 2021 Vitaly Chikunov <vt@altlinux.org> 1.0.8-alt9 - Update to 0e1f2b1f (2021-02-19). - Add score tests in %%check. * Mon Oct 12 2020 Anton Farygin <rider@altlinux.ru> 1.0.8-alt8 - added patch for build with new menhir, based on upstream commit 4bffe71 * Fri May 29 2020 Andrew A. Vasilyev <andy@altlinux.org> 1.0.8-alt7 - fix changelog * Wed Apr 29 2020 Andrew A. Vasilyev <andy@altlinux.org> 1.0.8-alt6 - merge changes from p9 branch (imz@altlinux.org) * Mon Apr 20 2020 Vitaly Chikunov <vt@altlinux.org> 1.0.8-alt5 - spec: Fix `Cannot infer Python version'. * Sat Apr 18 2020 Vitaly Chikunov <vt@altlinux.org> 1.0.8-alt4 - Convert to python3, add spgen, delete spatch.opt, clean up reqs. * Sat Apr 18 2020 Vitaly Chikunov <vt@altlinux.org> 1.0.8-alt3 - Install coccinelle ocaml libs (for coccicheck). * Thu Mar 05 2020 Anton Farygin <rider@altlinux.ru> 1.0.8-alt2 - removed unsafe-string build flag to avoid problems with ocaml-4.10 - built with external stdcompat - removed chrpath from build dependencies (it is no longer required) * Mon Feb 17 2020 Vitaly Chikunov <vt@altlinux.org> 1.0.8-alt1 - Update to 1.0.8. * Thu Dec 19 2019 Ivan Zakharyaschev <imz@altlinux.org> 1.0.6-alt2 - Adapted BuildReqs for any OCaml (whether with "num" or without in the core), so that it can be built in Sisyphus/p9 and p8. - For testing, made a checkinstall subpkg and added more tests (with embedded Python scripts). - Worked-around the problem with the loading of libpython (to enable the built-in Python interpreter). * Wed Aug 07 2019 Vitaly Chikunov <vt@altlinux.org> 1.0.7.0.217.ged1eb8e0-alt1 - Update to 1.0.7-217-ged1eb8e0. * Sun Jun 10 2018 Vitaly Chikunov <vt@altlinux.ru> 1.0.6-alt1 - Initial build for ALT. |