Bug 481034 - Review Request: coccinelle - Semantic patching for Linux (spatch)
Summary: Review Request: coccinelle - Semantic patching for Linux (spatch)
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michal Schmidt
QA Contact: Fedora Extras Quality Assurance
URL: http://www.emn.fr/x-info/coccinelle/
Whiteboard:
Depends On: 436843
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-21 20:45 UTC by Richard W.M. Jones
Modified: 2009-03-18 19:10 UTC (History)
4 users (show)

Fixed In Version: 0.1.5-3.fc10.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-03-18 09:51:50 UTC
Type: ---
Embargoed:
mschmidt: fedora-review+
kevin: fedora-cvs+


Attachments (Terms of Use)
use python_sitelib (1.27 KB, patch)
2009-01-29 15:52 UTC, Michal Schmidt
no flags Details | Diff

Description Richard W.M. Jones 2009-01-21 20:45:32 UTC
Spec URL: http://www.annexia.org/tmp/ocaml/coccinelle.spec
SRPM URL: http://www.annexia.org/tmp/ocaml/coccinelle-0.1.4-2.fc10.src.rpm
Description: 
Coccinelle is a tool to utilize semantic patches for manipulating C
code.  It was originally designed to ease maintenance of device
drivers in the Linux kernel.

Comment 1 Richard W.M. Jones 2009-01-21 20:46:38 UTC
Home page is http://www.emn.fr/x-info/coccinelle/
and there is a LWN article about the tool here:
  http://lwn.net/Articles/315686/

Comment 2 Richard W.M. Jones 2009-01-21 22:19:26 UTC
Small problem with Python 2.6 in Rawhide.  The updated package below
fixes this:

Spec URL: http://www.annexia.org/tmp/ocaml/coccinelle.spec
SRPM URL: http://www.annexia.org/tmp/ocaml/coccinelle-0.1.4-3.fc11.src.rpm
* Wed Jan 21 2009 Richard W.M. Jones <rjones> - 0.1.4-3
- Patch for Python 2.6.

Koji scratch build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1072634

rpmlint reports:

coccinelle.src:42: W: configure-without-libdir-spec

 - This is OK because this isn't an autoconf-based configure.

coccinelle.x86_64: W: devel-file-in-non-devel-package /usr/share/coccinelle/standard.h

 - Coccinelle uses this as a data file, it's not a normal include file.

coccinelle.x86_64: W: unstripped-binary-or-object /usr/bin/spatch

 - This file shouldn't be stripped, which will damage it.

coccinelle.x86_64: W: ocaml-mixed-executable /usr/bin/spatch

 - This is fine.  Prelink-defeating config script is implemented.

coccinelle.x86_64: W: ocaml-naming-policy-not-applied /usr/lib64/ocaml/stublibs/dll*.so

 - This is OK because it's not an OCaml library.

Comment 3 Michal Schmidt 2009-01-22 08:48:08 UTC
- The license notes in the sources do not have the "...or (at your option) any later version" wording, so the license should be GPLv2, not GPLv2+.

- You rename the 'dllpycaml_stubs.so' file to 'dll*.so' by mistake.

- It would be nice to have the demos/ and docs/ directories in the package or in a separate -doc package.

Comment 4 Michal Schmidt 2009-01-22 08:51:35 UTC
- Shouldn't coccilib go under %{python_sitelib}?

- coccilib/ contains two useless Makefiles.

Comment 5 Michal Schmidt 2009-01-22 09:07:59 UTC
- I stripped /usr/bin/spatch and it ran just fine afterwards. Does the stripping exception really apply then? (https://fedoraproject.org/wiki/Packaging:OCaml#Stripping_binaries)

Comment 6 Richard W.M. Jones 2009-01-22 20:34:45 UTC
Thanks, I'm going to try looking at this tomorrow.  But on the
subject of stripping binaries, firstly you can tell if the
binary was damaged by strip by looking at the end of the binary:

$ cp /usr/bin/spatch .
$ hexdump -C spatch | tail -3
00254d50  42 00 00 0c 66 43 52 43  53 00 00 10 58 00 00 00  |B...fCRCS...X...|
00254d60  05 43 61 6d 6c 31 39 39  39 58 30 30 38           |.Caml1999X008|
00254d6d

Notice the Caml1999... signature there.

$ strip spatch 
$ hexdump -C spatch | tail -3
00040940  ee 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00040950  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00040960

And notice that it's gone after stripping, and the binary
no longer works:

$ ./spatch 
No bytecode file specified.

Secondly, this method of attaching bytecode to binaries (a) sucks,
(b) is deprecated upstream, and (c) we should build a native code
(non-bytecode) version of spatch for Fedora which bypasses the
entire issue.

So the whole thing is a big bug, and I need to rebuild this
RPM, with any luck tomorrow.  Although the RPM above will work
for people who just want to try out coccinelle.

Comment 7 Michal Schmidt 2009-01-22 21:11:51 UTC
I forgot I had /usr/local/bin/spatch from my previous experiments, so that's why spatch ran fine even after I stripped /usr/bin/spatch :-) Sorry for the confusion in #5.

Comment 8 Michal Schmidt 2009-01-23 21:11:50 UTC
Richard,

In the Debian review ticket for coccinelle (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512658) they noticed that the sources include a slightly modified copy of pycaml and the library part of menhir.
I did not find any of these two packages currently in Fedora, so it would not cause a duplication, but still it would be nicer to have pycaml and menhir packaged separately if possible.

Comment 9 Richard W.M. Jones 2009-01-24 15:40:27 UTC
I've been chatting with the Debian packagers about these
issues, and it looks like they are going to organize a
revitalized upstream for pycaml.  (Upstream is dead and
there are at least two major forks).  We don't have this
package in Fedora at the moment as you say.

I posted an intent to package Menhir a while back
(bug 436843) but haven't got around to a package yet.

Comment 10 Richard W.M. Jones 2009-01-26 15:53:15 UTC
Phew, that was a bit more complicated than I anticipated ...

Here is an updated version which installs the optimized / native
code version of spatch by default, and leaves the bytecode version
for those poor platforms that have no code generator.  Every
Fedora platform should get the fast version in other words ...
The native code spatch can be, and is, stripped.

The Python 2.6 patch that I included earlier was a bit broken,
this includes a corrected version of that patch.

Menhir and pycaml and still built internally.

Spec URL: http://www.annexia.org/tmp/ocaml/coccinelle.spec
SRPM URL: http://www.annexia.org/tmp/ocaml/coccinelle-0.1.4-6.fc11.src.rpm

* Mon Jan 26 2009 Richard W.M. Jones <rjones> - 0.1.4-6
- Install the shared library in _libdir.
- Install the native code version if we have the optimizing compiler.

Comment 11 Michal Schmidt 2009-01-27 14:03:26 UTC
I don't think %{_libdir} is the correct path for the stub lib. Other ocaml-* packages put them in %{_libdir}/ocaml/stublibs/. And they have a *.so.owner file there too. I don't how that file is created.

Comment 12 Richard W.M. Jones 2009-01-28 20:28:58 UTC
I tried putting the shared library into ${_libdir}/ocaml/stublibs
but that just means that spatch can't find the shared library and
so doesn't start up.  This doesn't appear to be an ordinary use
of the OCaml stublibs (which in ordinary OCaml programs are only
used for bytecode, and the bytecode interpreter does dlopen with
the correct library path).

The *.so.owner files are generated and used by ocamlfind, and are
not an issue here.

So I guess we have to leave the library in %{_libdir}.

In reply to comment 3:
I've corrected the license.  Docs and demos are now in subpackages.

In reply to comment 4:
I got rid of the useless Makefiles and moved the python library.
However I've little idea about the Python code, not even how to test
if it is working.

Spec URL: http://www.annexia.org/tmp/ocaml/coccinelle.spec
SRPM URL: http://www.annexia.org/tmp/ocaml/coccinelle-0.1.4-8.fc11.src.rpm

* Wed Jan 28 2009 Richard W.M. Jones <rjones> - 0.1.4-8
- Remove useless Makefiles from python/coccilib.
- License is GPLv2 (not GPLv2+).
- Include documentation and demos in subpackages.
- Move python library to a more sensible path.
- Add a check section.

Comment 13 Michal Schmidt 2009-01-29 15:52:10 UTC
Created attachment 330369 [details]
use python_sitelib

Please use the correct way to find Python's site-packages path described in http://fedoraproject.org/wiki/Packaging/Python

See the attached patch.

Comment 14 Martin Nagy 2009-03-11 21:13:01 UTC
ping?

Comment 15 Richard W.M. Jones 2009-03-12 13:10:10 UTC
On my list for today/tomorrow...

Comment 16 Richard W.M. Jones 2009-03-16 12:54:11 UTC
OK!  Better late than never ..

There is a new version upstream, and this uses the correct
method to find the python sitelib, using Michal's patch from
comment 13.

I believe, from reading back over the comments, that this should
address everything.

Spec URL: http://www.annexia.org/tmp/ocaml/coccinelle.spec
SRPM URL: http://www.annexia.org/tmp/ocaml/coccinelle-0.1.5-1.fc11.src.rpm

* Mon Mar 16 2009 Richard W.M. Jones <rjones> - 0.1.5-1
- New upstream version 0.1.5.
- Use the correct method to get Python sitelib (Michal Schmidt).

Comment 17 Richard W.M. Jones 2009-03-16 12:57:03 UTC
rpmlint says:

coccinelle.src:77: W: configure-without-libdir-spec
coccinelle.x86_64: W: devel-file-in-non-devel-package /usr/share/coccinelle/standard.h

See comment 2 for both of these.

coccinelle.x86_64: W: no-soname /usr/lib64/dllpycaml_stubs.so

See comment 12.

coccinelle-examples.x86_64: W: spurious-executable-perm /usr/share/doc/coccinelle-examples-0.1.5/demos/launch.sh
coccinelle-examples.x86_64: W: doc-file-dependency /usr/share/doc/coccinelle-examples-0.1.5/demos/launch.sh R

I believe rpmlint is wrong here, and/or the packaging guidelines
aren't sufficiently specific about whether examples scripts can be
executable.  See:

https://www.redhat.com/archives/fedora-devel-list/2009-March/thread.html#00355
https://bugzilla.redhat.com/show_bug.cgi?id=487527#c3

Comment 18 Richard W.M. Jones 2009-03-16 13:00:18 UTC
Koji scratch build:

http://koji.fedoraproject.org/koji/taskinfo?taskID=1243586

Comment 19 Richard W.M. Jones 2009-03-16 13:07:23 UTC
That didn't work, because of missing BR python-devel.
Attempt two:

Spec URL: http://www.annexia.org/tmp/ocaml/coccinelle.spec
SRPM URL: http://www.annexia.org/tmp/ocaml/coccinelle-0.1.5-2.fc11.src.rpm

* Mon Mar 16 2009 Richard W.M. Jones <rjones> - 0.1.5-2
- BR python-devel.

Koji scratch build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1243604

Comment 20 Michal Schmidt 2009-03-17 16:44:26 UTC
OK: rpmlint was run and its output discussed.
OK: Package name meets the Package Naming Guidelines.
OK: The *.spec file name matches the package name.
OK: The package meets the Packaging Guidelines:
  OK: naming
  OK: version and release
  OK: licensing
  OK: no pre-built binaries
  OK: spec is legible
  OK: builds on all archs
  OK: FHS layout
  OK: changelogs
  OK: tags
  OK: BuildRoot tag
  OK: clean buildroot in %install and %clean
  OK: Requires
  OK: BuildRequires
  OK: summary and description
  OK: encoding
  OK: documentation
  N/A: compiler flags (program written in OCaml)
  N/A: debuginfo (program written in OCaml)
  N/A: devel packages
  OK: requiring base package
  N/A: shared libraries (dllpycaml_stubs.so is not a normal library)
  OK: no static libraries
  OK: no duplication of system libraries
  OK: rpath deleted
  N/A: config files
  N/A: initscripts
  N/A: desktop files
  OK: macros
  N/A: locale files
  OK: timestamps
  OK: parallel make not used for a reason
  N/A: scriptlets
  N/A: conditional deps
  OK: non-relocatable package
  OK: file and directory ownership
  N/A: users and groups
  N/A: web apps
  OK: no conflicts
  OK: no kernel modules
  OK: nothing in /srv
  OK: not bundling multiple projects
  !!! BAD !!!: Patch0 has no comment about its purpose and upstream status.
  OCaml-specific guidelines:
    OK: binary stripped, bytecode not stripped
    OK: compiled binary prefered to bytecode
    OK: tests for native compiler
OK: Meets Licensing Guidelines.
OK: License (GPLv2) tag matches the actual license.
OK: The license file included in %doc.
OK: Spec file written in American English.
OK: Source matches upstream. sha1sum: 3457c54a8e13e129a1c514debd6c9e7d41abf9d9  coccinelle-0.1.5.tgz
OK: Builds in Koji on all archs.
OK: No duplicates in %files.
OK: File permissions correct, defattr used properly.
OK: Code or permissable content.
OK: Large documentation in a separate subpackage.
OK: Program works even without %doc.
N/A: Headers in -devel.
N/A: pkconfig files.
N/A: Library with a suffix.
OK: Subpackages require the base package using full-versioned dependencies.
OK: No .la files.
OK: Does not own files or dirs already owned by other packages.
OK: Filenames are valid UTF-8.


Summary:

Please add a comment for Patch0 explaining why the patch is needed and what its upstream status is.

The Packaging Guidelines recommend using *-doc as the documentation package name. Yours is named *-docs. Consider changing it. *-docs is not unusual, but *-doc is a bit more common:
yum list \*-doc | wc -l
177
yum list \*-docs | wc -l
69


None of these two issues are blockers and they are easy to fix before you import to CVS.

I approve the package.

Comment 21 Richard W.M. Jones 2009-03-17 17:09:17 UTC
Thanks Michal.  I'll make the changes you suggest.

Comment 22 Richard W.M. Jones 2009-03-17 17:13:06 UTC
New Package CVS Request
=======================
Package Name: coccinelle
Short Description: Semantic patching for Linux (spatch)
Owners: rjones
Branches: F-10
InitialCC:

Comment 23 Kevin Fenzi 2009-03-18 03:30:08 UTC
cvs done.

Comment 24 Fedora Update System 2009-03-18 09:51:10 UTC
coccinelle-0.1.5-3.fc10.1 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/coccinelle-0.1.5-3.fc10.1

Comment 25 Fedora Update System 2009-03-18 19:10:34 UTC
coccinelle-0.1.5-3.fc10.1 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.