add binary file to rpm package CentOS 7
Posted in Новости on 13 сентября, 2019 by adminПонадобилось создать rpm пакет для node_exporter ( компонент мониторинга Prometheus ). Как обычно с rpmbuild создал окружение и вышел такой spec:
Name: prometheus-node-exporter
Version: 0.5.0
Release: 1
Summary: Prometheus node_exporter official release rpm package
Group: PT
BuildArch: x86_64
License: GPL
URL: https://github.com/
Source: prometheus-node-exporter-0.5.0.tar.gz
%description
Prometheus official node_exporter release
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/usr/local/bin
#install -m 0755 node_exporter $RPM_BUILD_ROOT/usr/local/bin/node_exporter
cp node_exporter $RPM_BUILD_ROOT/usr/local/bin/node_exporter
%files
/usr/local/bin/node_exporter
%changelog
* Fri Sep 13 2019 Nikolai Vaganov 0.5.0
- Initial rpm release for official source
Но незадача пришла на этапе сборки пакета в виде ошибки Binary ID :
# rpmbuild -bb SPECS/prometheus-node-exporter.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.CYr1Tz
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf prometheus-node-exporter-0.5.0
+ /usr/bin/tar -xf -
+ /usr/bin/gzip -dc /root/rpmbuild/SOURCES/prometheus-node-exporter-0.5.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd prometheus-node-exporter-0.5.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.t2q8zQ
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd prometheus-node-exporter-0.5.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.hipri7
+ umask 022
+ cd /root/rpmbuild/BUILD
+ '[' /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64 '!=' / ']'
+ rm -rf /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64
++ dirname /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT
+ mkdir /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64
+ cd prometheus-node-exporter-0.5.0
+ install -m 0755 -d /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64/usr/local/bin
+ cp node_exporter /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64/usr/local/bin/node_exporter
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /root/rpmbuild/BUILD/prometheus-node-exporter-0.5.0
extracting debug info from /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64/usr/local/bin/node_exporter
*** ERROR: No build ID note found in /root/rpmbuild/BUILDROOT/prometheus-node-exporter-0.5.0-1.x86_64/usr/local/bin/node_exporter
error: Bad exit status from /var/tmp/rpm-tmp.hipri7 (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.hipri7 (%install)
При этом если поменять бинарник на обычный текстовый файл sh или txt , то таких проблем не наблюдалось.
В итоге был найден фикс. Требуется в самый верх spec файла добавить :
%define debug_package %{nil}
и сборка прошла успешно !!!!