3087dd7 Refuse import of packages processed by rpmautospec

2 files Authored by zbyszek 2 years ago, Committed by onosek 2 years ago,
    Refuse import of packages processed by rpmautospec
    
    People occasionally try to do 'fedpkg/rpm import' on an srpm which was
    built from a .spec file with %autorelease and %autochangelog fields.
    rpmautospec works by replacing those macros with generated content.
    Importing and srpm after such processing is generally the wrong thing
    to do, because for %autorelease and %autochangelog to work, the spec
    file with (unexpanded) macros must be stored in dist-git. But even if
    somebody wanted to stop using rpmautospec, and wanted to import the
    processed spec file, the headers that were inserted by rpmautospec
    should be removed. Thus, just refuse such imports.
    
    Note that I also opened https://pagure.io/fedora-infra/rpmautospec/issue/269
    to provide an "official" way to detect that the file was processed.
    But even the current imperfect check is better than nothing because
    it seems to be a fairly common mistake because 'fedpkg import' is
    a very common workflow, and %autorelease/%autochangelog are becoming
    the norm too.
    
    Test:
    $ PYTHONPATH=$HOME/python/rpkg fedpkg import --offline package-notes-0.5-3.fc38.src.rpm
    Could not execute import_srpm: srpm was processed by rpmautospec
    
    Merges: https://pagure.io/rpkg/pull-request/628
    Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
    
        
file modified
+11 -1
file modified
+21 -0