How to get spec file path within rpm spec file

5,200
%{_specdir} /${name}.spec 

will do the job. See this Fedora Wiki Page for more information.

Share:
5,200

Related videos on Youtube

Felipe Rodriguez
Author by

Felipe Rodriguez

Updated on September 18, 2022

Comments

  • Felipe Rodriguez
    Felipe Rodriguez over 1 year

    The spec file is present inside the source directory. The specfile build section looks like

    %build
    cd ~/path/sources
    make
    

    If the spec file path can be detected then the hardcoding of the ~/path/sources can be avoided. How to get the spec file path.

  • Abby
    Abby about 5 years
    Note that the %{_specdir} macro will redirect to %{_topdir}/SPECS/, which by default is ~/rpmbuild/SPECS/. Not sure if that is what the OP was looking for.