#580 [Clarification] Policy on auto-generated code
Closed: Fixed None Opened 6 years ago by sgallagh.

Some packages ship from upstream with code generated from templates (such as bison, jison, gdbus-codegen, etc.). We have no formal policy or recommendation on how to handle this code, such as whether to require that it be regenerated as part of the RPM build or if it is acceptable to just use the pre-generated version from the tarball.

I think there is a spectrum of possible answers to a number of relevant questions here:

  1. Do we:
    a. require every package to regenerate all machine-generated code as part of the build process?
    a. suggest instead of require it?
    a. not really care at all? That's sort of where we're at.
  2. A related issue: Do we require that we have the source files from which the generated code was created included in the SRPM?
  3. Another related issue: Do we care at all about the tools necessary to regenerate the autogenerated code? And if so, that they are:
    a. available to us at all?
    a. free/open source/whatever you want to call it today?
    a. packaged?

I think it's important that we be able to patch things as necessary, which does mean being able to patch the "source" of the autogenerated code. Which implies that we really need to have access to the the entire build chain.

I don't think there are clear answers to all of these. Currently I think the best interpretation of what the guidelines say is Q1: c, Q2: no, Q3: no, though there are some legal issues for GPL'ed code due to the phrase "the preferred form of the work for making modifications" which I don't think we want to get into here.

Personally for Q1, I lean towards '''b'''. For Q2 I say '''yes'''. For Q3, I say '''c'''.

If there's consensus I can throw together a draft.

Note that autotools falls into this category, and I'm not even sure I want to know if java/ruby do anything weird as std. here.

I think I'd prefer a 1.d. option: Do whatever upstream expects, unless you have a good reason.

I can buy that, except that really I don't think it would be common to know what upstream expects. I guess if upstream ships them, then you can intuit that they expect you to use them. However, my experience is that most of these things are generated at release time simply to reduce the dependency footprint of the source release. Often times if you want to package a snapshot or do some patching you have to end up generating everything anyway. So "what upstream expects" probably isn't going to be consistent in any case.

I also know there are issues surrounding autotools (which I don't really understand) that make any kind of guideline around this really tricky.

Even glossing over the first question, which could perhaps be considered a separate issue, I think that it is worth addressing the second and third.

We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2015-12-03/fpc.2015-12-03-17.00.txt):

  • 580 [Clarification] Policy on auto-generated code (geppetto,

  • LINK: https://fedorahosted.org/fpc/ticket/580 (geppetto, 17:29:18)
  • ACTION: tibbs Draft based on 1. b; 2. yes; and ask FESCO/legal about
    3 (geppetto, 17:51:34)

Proposal: a new section immediately before "Spec File Naming:

== Use of pregenerated code ==

Often a package will contain code which was itself generated by other code.
This often takes the form of configure files or parsing code generated by
bison/yacc or lex/flex.

It is required that the original source files from which the code was generated
be included in the srpm. Generally these files are part of the source archive
supplied by upstream, but it may be necessary to fetch those files from an
upstream source repository and include them in the srpm as separate Source:

It is suggested, but not required, that such code be regenerated as part of the
build process. The means for doing this are entirely specific to the
individual package being built, but it may happen automatically if the
necessary dependencies are present at build time.

We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2016-01-07/fpc.2016-01-07-17.00.txt):

  • 580 [Clarification] Policy on auto-generated code (geppetto,

  • ACTION: new section: Use of pregenerated code (+1:5, 0:0, -1:0)
    (geppetto, 18:19:29)

Metadata Update from @tibbs:
- Issue assigned to tibbs

5 years ago

Login to comment on this ticket.