carbonblack/intellij-rpmspec

Support for autospec

LecrisUT opened this issue · 3 comments

rpmautospec has two macros that are not accounted for in this plugin:%autochangelog and %autorelease

Example spec:

# Allowed function arguments can be referenced at https://docs.pagure.org/fedora-infra.rpmautospec/autorelease.html
Version:    %autorelease

%changelog
%autochangelog

If the changelog could be viewed when hovering over %autochangelog that would be magical, but for now, simply not outputting an error would be sufficient.

tlusk commented

@LecrisUT as far as I can tell, the %autorelease and %autochangelog macros are just macros that get installed by the rpmautospec package:

https://fedora.pkgs.org/37/fedora-x86_64/rpmautospec-rpm-macros-0.3.0-1.fc37.noarch.rpm.html

%autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = tonumber(rpm.expand("%{?_rpmautospec_release_number}%{!?_rpmautospec_release_number:1}"));
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
%autochangelog %{lua:
    locale = os.setlocale(nil)
    os.setlocale("C.utf8")
    date = os.date("%a %b %d %Y")
    os.setlocale(locale)
    packager = rpm.expand("%{?packager}%{!?packager:John Doe <packager@example.com>}")
    evr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
    print("* " .. date .. " " .. packager .. " - " .. evr .. "\\n")
    print("- local build")
}

I tested and it looks like as long as that package is installed this is working correctly and there are no parsing errors being thrown.

Ok I've just checked. I had that rpm package installed and after some toying around I have more info.
Just the macro by itself does not trigger an error, but that is not how it is used

# This does not show an error
%autochangelog

The usage should be like this
image

tlusk commented

This should be resolved in version 2.1.0. It's been published to the jetbrains plugin repository and will be live in a couple days.