为什么rpmbuild会在宏中显示两次

时间:2015-05-14 18:39:11

标签: rpm rpmbuild rpm-spec

我正在编写一个非常简单的spec文件来安装文本文件(实际上是.repo文件)。这是spec文件

Name:       dm_rpm_repos
Version:    1.0
Release:    0
Summary:    custom repository file

Group:      System Environment/Base
License:    GPL
URL:        http://internal
Source0:    dm_rpm_repos-1.0.tar.gz

BuildArch:  noarch
BuildRoot:  %{_tmppath}/%{name}-buildroot

%description
Internal use repository for internal RPMs


%prep
tar -zxvf %{_sourcedir}/dm_rpm_repos-1.0.tar.gz


%install
mkdir -p %{buildroot}
cp -R * %{buildroot}


%clean
rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root,-)
/etc/yum.repos.d/dm_rpm_repos.repo

这里使用this handy command是扩展文件内容

Name:       dm_rpm_repos
Version:    1.0
Release:    0
Summary:    custom repository file

Group:      System Environment/Base
License:    GPL
URL:        http://internal
Source0:    dm_rpm_repos-1.0.tar.gz

BuildArch:  noarch
BuildRoot:  /var/tmp/dm_rpm_repos-buildroot

%description
Internal use repository for internal RPMs


%prep
tar -zxvf /home/rpmbuild/rpmbuild/SOURCES/dm_rpm_repos-1.0.tar.gz



%install

mkdir -p /home/rpmbuild/rpmbuild/BUILDROOT/dm_rpm_repos-1.0-0.x86_64
cp -R * /home/rpmbuild/rpmbuild/BUILDROOT/dm_rpm_repos-1.0-0.x86_64


%clean
rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root,-)
/etc/yum.repos.d/dm_rpm_repos.repo

为什么目录rpmbuild出现两次?它不应该。直接就是~/rpmbuild/...。它正在寻找的.tar.gz文件位于~/rpmbuild/SOURCES/。我使用rpmdev-setuptree创建了这个用户的rpm环境。最初,%prep部分使用了宏%setup -p。如果重要的话,该用户的.rpmmacros文件的内容

%_topdir %(echo $HOME)/rpmbuild

%_smp_mflags %( \
    [ -z "$RPM_BUILD_NCPUS" ] \\\
        && RPM_BUILD_NCPUS="`/usr/bin/nproc 2>/dev/null || \\\
                             /usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
    if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then \\\
        echo "-j16"; \\\
    elif [ "$RPM_BUILD_NCPUS" -gt 3 ]; then \\\
        echo "-j$RPM_BUILD_NCPUS"; \\\
    else \\\
        echo "-j3"; \\\
    fi )

%__arch_install_post \
    [ "%{buildarch}" = "noarch" ] || QA_CHECK_RPATHS=1 ; \
    case "${QA_CHECK_RPATHS:-}" in [1yY]*) /usr/lib/rpm/check-rpaths ;; esac \
    /usr/lib/rpm/check-buildroot

0 个答案:

没有答案