824f412 Major rework of lua routines and forge macros

Authored and Committed by nim 3 years ago
    Major rework of lua routines and forge macros
    
    Main features:
      – clean up lua function naming
      – add multiple small additional helpers to help keep lua code short and easy
        to check (this is what a non-barebones rpm lua namespace should look like)
    
      – add a plugable %auto_<call> framework. That includes two entry points in the
        preamble, %auto_init and %auto_pkg. This is necessary to separate cleanly
        the variable initialisation phase from their use in spec sections
        (including %package sections). Name: is treated as just another %package
        section without any specific handling, to KISS and save packager sanity (of
        course, Name: is not another section from the rpm parser POW, but that’s
        just one of rpm’s numerous legacy warts).
    
      – add a buildsys subsystem to manage SRPM inheritance from subpackages
    
      – add a doc subsystem to simplify creation of -doc subpackages that will hold
        bulky documents like pdf files
    
      – clean up and namespace properly forge control variables
      – make forge macros process patches too (like %autosetup, except in a safe
        way that does not break in presence of multiple archives).
      – patch processing is done via %apply_patch, and inherits all its quirks,
        limitations and lack of documentation
      – make forge macros suffix-independant: 0 no longer has any special meaning,
        and variables are not zaliased by default. You can write a whole
        multi-source and multi-patch spec without dealing with a single source or
        patch suffix.
    
    While the switch to uniform naming and the factorisation of common patterns in
    small helpers makes the code simpler and more maintainable long term, it does
    result in a huge number of changed lines (likewise, when reusing wordwrap in
    new functions required moving the wordwrap block in common.lua).
    
    The auto_call framework allows consolidating *all* macro sets that use this code into:
    
    ```rpm
    %global source_name …
    %global source_summary …
    
    %global forge_url0 …
    %global forge_commit0 …
    
    %global forge_url1 …
    %global forge_tag1 …
    
    %global go_module33 …
    %global go_description33 …
    
    %global font_family22 …
    %global font_conf22 …
    
    %auto_init
    %auto_pkg
    
    %sourcelist
    %auto_sources
    
    %patchlist
    %auto_patches
    
    %prep
    %auto_prep
    
    %generate_buildrequires
    %auto_generate_buildrequires
    
    %build
    %auto_build
    
    %install
    %auto_install
    
    %check
    %auto_check
    
    %auto_files
    
    %changelog
    ```
    
    This change is backwards compatible: the old forge syntax works as before (for
    now, it will eventually be removed). However mixing old and new syntax in a
    single spec file is not supported. Packagers need to convert spec files fully
    or not at all.
    
    The lua side of forge macros is now cleanly split into SRPM and post-SRPM
    stage. Macros that call directly into the lua forge functions need adjusting
    their imports (to my knowledge this is only done by the Go macros that I will
    fix once this is merged and pushed to koji).
    
        
file added
+239
file added
+146
file modified
+517 -194
file added
+2
file added
+27
file added
+2
file added
+103
file added
+1
file added
+44
file added
+3
file added
+438
file removed
-312
file added
+63
file added
+82
file added
+46
file added
+25
file added
+50
macros.fedora-misc-rpm macros.fedora-misc
file renamed
+14 -10
file modified
+1 -21
file removed
-70
file added
+29
file added
+65
file modified
+54 -12