Bug 32597

Summary: Macro %package_name not found
Product: Sisyphus Reporter: ildar <ildar>
Component: perl-RPM-Source-ConvertAssignee: viy <viy>
Status: CLOSED NOTABUG QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: at, cas, cronbuild, cronport, crux, ender, lav, ldv, mike, qa_viy, shaba, viy
Version: unstable   
Hardware: all   
OS: Linux   

Description ildar 2016-10-10 22:07:36 MSK
$ srpmconvert-fc gstreamermm-1.4.3-1.fc25.src.rpm
warning: substituting Group: Development/Libraries with unaccurate Development/C
ошибка: Macro %package_name not found
ошибка: строка 33: Summary:        Headers for developing programs that will use %{package_name}

Writing src.rpm failed. May be some important rpm macros packages are missing. Writing hasher tar.
Written: ./gstreamermm-1.4.3-alt1_1.tar
Comment 1 ildar 2016-10-10 22:20:38 MSK
Почему-то macrodef не помог:
> $ srpmconvert-fc --macrodef 'package_name gstreamermm' gstreamermm-1.4.3-1.fc25.src.rpm 
> warning: substituting Group: Development/Libraries with unaccurate Development/C
> ошибка: Macro %package_name not found
> ошибка: строка 33: Summary:        Headers for developing programs that will use %{package_name}
> 
> Writing src.rpm failed. May be some important rpm macros packages are missing. Writing hasher tar.
> Written: ./gstreamermm-1.4.3-alt1_1.tar
Comment 2 viy 2016-10-11 00:51:59 MSK
macrodef для несколько другого, 
        --macrodef '<name> <value>' set the value of an rpm macro.
        --macroundef <name> undefine rpm macro.
          It does not change spec but influence spec processing.
__It does not change spec__.
Конкретно, в gstreamermm-1.4.3-1.fc25.src.rpm ошибка, 
https://bugzilla.redhat.com/show_bug.cgi?id=1383514,
просто у них это рядовая ошибка, а у нас rpmbuild на нее падает с громким криком.
починить просто. например, возьмите отсюда gstreamermm.pl:
http://git.altlinux.org/people/viy/packages/fcimport.git?p=fcimport.git;a=blob;f=hooks/gstreamermm.pl;h=2ff7c6a4493a601bba886be44f39d3c8ee2bd2f9;hb=a2652bc17e557ea0db8baaf75a0a95a4f45d8291
и запустите 
srpmconvert-fc --hook gstreamermm.pl gstreamermm-1.4.3-1.fc25.src.rpm
либо склонируйте fcimport.git, зайдите внутрь
 запустите 
srpmconvert-fc  gstreamermm-1.4.3-1.fc25.src.rpm
тогда --hook указывать не нужно, gstreamermm.pl будет найден автоматически.
Comment 3 viy 2016-10-11 00:55:44 MSK
тот hook что в fcimport.git, меняет package_name на name.
push @SPECHOOKS, 
sub {
    my ($spec, $parent) = @_;
    $spec->get_section('package','devel')->subst_body_if(qr'package_name','name',qr'Summary:');
};
альтернативно, можно было бы доопределить package_name.
тогда hook выглядел бы так:
-------
push @SPECHOOKS, 
sub {
    my ($spec, $parent) = @_;
    $spec->get_section('package','')->push_body('%define package_name %name'."\n");
};