opam2rpm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A few of us have tossed around the idea of an opam2rpm project before.
Over the last few weeks, I've been working on bringing that to life.
See what I have so far:

https://pagure.io/opam2rpm

I made the possibly controversial decision to write opam2rpm in
python.  I did this so that I could borrow code and ideas from other
spec file generators, many of which are written in python.  If this
proves to be a sticking point with the other OCaml package
maintainers, I am not opposed to porting it to OCaml, but will need a
fair amount of help to do so.

The current version owes much to go2rpm.  Thank you, go2rpm developers!

Quick rundown of the source files:
- dependency.py: converts opam package dependencies into RPM dependencies
- licensing.py: SPDX-to-Fedora license converter, stolen from go2rpm
- opamparser.py: parses opam files, roughly equivalent to ocaml-file-format
- version.py: implements the Debian versioning scheme, used by opam
- __main__.py: controlling logic

There are jinja2 templates for dune, topkg, obuild, and "everything
else".  The generator almost produces everything, but there are still
a few holes.  In particular, the %files lists are generated by an
imaginary (i.e., vaporware) script.  I think writing that script
shouldn't be too hard: put *.{a,cmt,cmti,cmx,cmxa,h,mli} files into
-devel and everything else into the main package.  When there are
subpackages, repeat that logic for the directory corresponding to each
subpackage.

Things that still need to be done:

1. Make better use of pyparsing in opamparser.py.  Right now it is
only used for lexing, with a handwritten recursive descent parser on
top.  I made several attempts to use pyparsing for the actual parsing,
all ending in misery and woe.  Whenever I try to introduce a rule that
uses ZeroOrMore(), things get weird.  Rules that shouldn't fire on the
input given to the parser fire anyway.  I don't know what's going on,
hence the current solution.

2. Make better use of jinja2.  There are a bunch of strings in
dependency.py that really should be in the template files instead.

3. Get a python expert to help make the code more pythonic.

4. Write the %files script described above.  Where should it live,
ocaml-srpm-macros?

5. Write unit tests.

6. Talk to the go2rpm developers about breaking licensing.py and
spdx_to_fedora.csv out into a separate project.  Note that I fixed
some incorrect LGPL entries in the version in opam2rpm.

I have heard it said that every software project should be implemented
3 times.  The first time is to figure out what you don't know.  The
second time is to do it right.  The third time is to make it elegant.
Most projects never get around to the second implementation, and only
a very small number have ever gotten to the third.  Please remember,
when you look at this code, that this is implementation #1. :-)

If you have an interest in OCaml packaging, stop by and help knock off
some of the TODO items.  Regards,
-- 
Jerry James
http://www.jamezone.org/
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux