86d0aa scripts/osc_wrapper: Assign spec with *.spec file when building

Authored and Committed by Marcos Paulo de Souza a year ago
    scripts/osc_wrapper: Assign spec with *.spec file when building
    
    Commit 270fc6884c5b ("scripts/osc_wrapper: Pass more options to osc"),
    decided that only the last argument of osc_wrapper can be the spec file.
    But on commit 30f26fbbe86c ("scripts/osc_wrapper: Accept --ibs | --obs
    as the first parameter"), it swaps the order of arguments, leaving
    --ibs/--obs as the last ones.
    
    This creates a problem when running osc_wrapper with --ibs
    kernel-default.spec, since it'll add the specfile in osc_args, and
    letting spec variable empty. Later on, if spec if empty, the find_spec
    function is called, setting the spec automatically. The end result is
    messy:
    
    $ ./scripts/osc_wrapper --ibs kernel-source/kernel-default.spec
    osc -A https://api.suse.de build --no-service --local-package --alternative-project=Devel:Kernel:SLE15-SP4 \
    kernel-source/kernel-default.spec \
    <some other options here...> \
    --define klp_symbols 1 standard kernel-source/kernel-default.spec
    
    The osc command contains two spec definitions, which is wrong. The first
    one is wrongly assumed to be an argument to be used for osc or
    osc_wrapper.
    
    The fix is to respect the argument of *.spec and assign it to spec
    variable, and let other options to be handled by the code that is
    currently present.
    
    Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
    Reviewed-by: Michal Koutný <mkoutny@suse.com>
    
        
file modified
+1 -5