我试图创建一个简单的RPM并体验可怕的未打包文件'问题。 RPM包含一个tar文件,其中包含许多预编译的二进制文件(暂时)。安装需要将这些安装到主机系统上。
我的spec文件: 摘要案例
Name LL
Packager: Me
Source: one.tar.gz
license: AllRightsReserved
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
Initial RPM test
%prep
%setup -n one
%build
%install
rm -rf -v $RPM_BUILD_ROOT
mkdir -p -v $RPM_BUILD_ROOT/opt/rpm_test
cp -R * -v $RPM_BUILD_ROOT/opt/rpm_test
%clean
rm -rf %{buildroot}
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR
rm -rf %{_tmppath/%{name}
rm -rf %{_topdir}/BUILD%{name}
%post
echo "$RPM_BUILD_ROOT Adding file"
%postun
%files
#%defattr(-,root,root,-)
%dir /opt/rpm_test/one
/opt/rpm_test/one/file1.txt
/opt/rpm_test/one/file2.txt
/opt/rpm_test/one/file3.txt
%dir
输出:
[rajp@007 SPECS]$ rpmbuild -bb case1.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.f2j8Hn
+ umask 022
+ cd /home/rajp/rpmbuild1/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/rajp/rpmbuild1/BUILD
+ rm -rf one
+ /usr/bin/gzip -dc /home/rajp/rpmbuild1/SOURCES/one.tar.gz
+ /bin/tar -xvvf -
drwxrwxr-x rajp/rajp 0 2016-03-23 10:00 one/
-rw-rw-r-- rajp/rajp 6 2016-03-23 10:00 one/file3.txt
-rw-rw-r-- rajp/rajp 6 2016-03-23 10:00 one/file1.txt
-rw-rw-r-- rajp/rajp 6 2016-03-23 10:00 one/file2.txt
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd one
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.PSIwwg
+ umask 022
+ cd /home/rajp/rpmbuild1/BUILD
+ cd one
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.TEN8l9
+ umask 022
+ cd /home/rajp/rpmbuild1/BUILD
+ '[' /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64 '!=' / ']'
+ rm -rf /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
++ dirname /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
+ mkdir -p /home/rajp/rpmbuild1/BUILDROOT
+ mkdir /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
+ cd one
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf -v /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
removed directory: `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64'
+ mkdir -p -v /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test
mkdir: created directory `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64'
mkdir: created directory `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt'
mkdir: created directory `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test'
+ cp -R file1.txt file2.txt file3.txt -v /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test
`file1.txt' -> `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test/file1.txt'
`file2.txt' -> `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test/file2.txt'
`file3.txt' -> `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test/file3.txt'
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/rajp/rpmbuild1/BUILD/one
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: LL-debuginfo-2.6-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
error: Installed (but unpackaged) file(s) found:
/opt/rpm_test/file1.txt
/opt/rpm_test/file2.txt
/opt/rpm_test/file3.txt
RPM build errors:
Installed (but unpackaged) file(s) found:
/opt/rpm_test/file1.txt
/opt/rpm_test/file2.txt
/opt/rpm_test/file3.txt
[rajp@007 SPECS]$
不幸的是谷歌没有帮助:(
提前致谢
答案 0 :(得分:1)
解决!我在%description部分下移动了%files部分!希望这有助于某人......
答案 1 :(得分:0)
您的规范文件使用/opt/rpm_test/one
,而有问题的文件位于/opt/rpm_test/
。
预期:
/opt/rpm_test/one/file1.txt
实际
/opt/rpm_test/file1.txt
答案 2 :(得分:0)
取出空%postun
?我认为这就是问题所在。