Compare commits
11 Commits
8cf27bde7b
...
27fd0589d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27fd0589d1 | ||
|
|
d3e54a0dc1 | ||
|
|
8e9b2ec06b | ||
|
|
e657758d2b | ||
|
|
0e0987f19d | ||
|
|
464031c327 | ||
|
|
b83f20e26b | ||
|
|
82812861c1 | ||
|
|
08fcd1e117 | ||
|
|
906b1ea1f5 | ||
|
|
1737556bf0 |
BIN
custom_build_tool-1.0.0.tar.gz
Normal file
BIN
custom_build_tool-1.0.0.tar.gz
Normal file
Binary file not shown.
278
custom_build_tool.spec
Normal file
278
custom_build_tool.spec
Normal file
@ -0,0 +1,278 @@
|
||||
%define with_san %{?_with_san:1} %{?!_with_san:0}
|
||||
%define with_ub %{?_with_ub:1} %{?!_with_ub:0}
|
||||
%define debug_package %{nil}
|
||||
Name: custom_build_tool
|
||||
Summary: custom build tool for obs
|
||||
License: Mulan PSL v2
|
||||
Group: System/Management
|
||||
Version: 1.0.0
|
||||
Release: 20
|
||||
BuildRoot: %{_tmppath}/%{name}
|
||||
Source0: https://gitee.com/openeuler/custom_build_tool/repository/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
BuildRequires: util-linux coreutils
|
||||
|
||||
Requires: bash rpm-build sed util-linux coreutils
|
||||
%description
|
||||
provide other method to deal parameter passing for OBS build
|
||||
|
||||
%package nocheck
|
||||
Group: Development/Libraries
|
||||
BuildArch: noarch
|
||||
Requires:bash rpm-build sed util-linux coreutils
|
||||
Requires:custom_build_tool
|
||||
Summary: add nocheck to rpmbuild
|
||||
|
||||
%description nocheck
|
||||
|
||||
%package nodebug
|
||||
Group: Development/Libraries
|
||||
BuildArch: noarch
|
||||
Requires:bash rpm-build sed util-linux coreutils
|
||||
Requires:custom_build_tool
|
||||
Summary: change debug error to warning for rpmbuild
|
||||
|
||||
%description nodebug
|
||||
|
||||
%package target
|
||||
Group: Development/Libraries
|
||||
BuildArch: noarch
|
||||
Requires:bash rpm-build sed util-linux coreutils
|
||||
Requires:custom_build_tool
|
||||
Summary: add target to rpmbuild
|
||||
|
||||
%description target
|
||||
|
||||
%package uploadbuild
|
||||
Group:Development/Libraries
|
||||
Requires:util-linux rpm grep binutils gcc coreutils rpm-build pbzip2
|
||||
Requires:custom_build_tool
|
||||
BuildRequires:util-linux coreutils
|
||||
Summary:Collect the rmpbuild/BUILD directory
|
||||
|
||||
%description uploadbuild
|
||||
Collect the rmpbuild/BUILD directory and upload it to the specified server
|
||||
|
||||
%package san
|
||||
Group:Development/Libraries
|
||||
Requires:util-linux rpm grep binutils gcc coreutils rpm-build
|
||||
Requires:custom_build_tool
|
||||
Requires:gcc_secure
|
||||
BuildRequires:util-linux coreutils
|
||||
Summary:Build with san
|
||||
|
||||
%description san
|
||||
|
||||
%prep
|
||||
%setup -c
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/opt/
|
||||
mkdir -p %{buildroot}/opt/custom_build_tool
|
||||
install -m 700 %{name}/*.sh %{buildroot}/opt/custom_build_tool/
|
||||
install -m 600 %{name}/rpmbuild-nocheck %{buildroot}/opt/custom_build_tool/
|
||||
install -m 600 %{name}/rpmbuild-target %{buildroot}/opt/custom_build_tool/
|
||||
%if %{with_san}
|
||||
install -m 600 %{name}/rpmbuild-san %{buildroot}/opt/custom_build_tool/
|
||||
%endif
|
||||
|
||||
|
||||
%post
|
||||
bash /opt/custom_build_tool/custom_build_tool.sh
|
||||
%post nocheck
|
||||
sed -i '/####add parameter start/r /opt/custom_build_tool/rpmbuild-nocheck' /usr/bin/rpmbuild
|
||||
%post nodebug
|
||||
sed -i 's/strict=true/strict=false/' /usr/lib/rpm/find-debuginfo.sh
|
||||
%post target
|
||||
sed -i '/####add parameter start/r /opt/custom_build_tool/rpmbuild-target' /usr/bin/rpmbuild
|
||||
echo "abuild ALL=(ALL) NOPASSWD: /opt/custom_build_tool/rpmbuild-nocheck" >> /etc/sudoers
|
||||
|
||||
%if %{with_ub}
|
||||
%post uploadbuild
|
||||
sed -i '/####add parameter start/r /opt/custom_build_tool/rpmbuild-ub' /usr/bin/rpmbuild
|
||||
bin_rpmbuild=/usr/bin/rpmbuild
|
||||
cmd_rpmbuild=/usr/bin/rpmbuild-ub
|
||||
|
||||
cat <<END1 > ${cmd_rpmbuild}
|
||||
#!/bin/sh -x
|
||||
|
||||
${bin_rpmbuild} "\$@"
|
||||
ret=\$?
|
||||
if [ \$ret -ne 0 ]; then
|
||||
exit \$ret
|
||||
fi
|
||||
source /opt/custom_build_tool/upload_build.sh
|
||||
END1
|
||||
chmod 755 ${cmd_rpmbuild}
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with_san}
|
||||
%post san
|
||||
cp -a /usr/bin/mv /usr/bin/gmv
|
||||
sed -i '/####add parameter start/r /opt/custom_build_tool/rpmbuild-san' /usr/bin/rpmbuild
|
||||
old_gcc=/usr/bin/gcc
|
||||
old_gplus=/usr/bin/g++
|
||||
old_rpmbuild=/usr/bin/rpmbuild
|
||||
old_cplus=/usr/bin/c++
|
||||
ulimit -v unlimited
|
||||
ulimit -a
|
||||
sed '2 i export ASAN_OPTIONS=abort_on_error=0:disable_coredump=0:detect_leaks=0\nexport LD_PRELOAD=/usr/lib64/libasan.so.4' -i /usr/lib/rpm/find-debuginfo.sh
|
||||
head /usr/lib/rpm/find-debuginfo.sh
|
||||
|
||||
sed -i "$ a* hard as unlimited\n* soft as unlimited" /etc/security/limits.conf
|
||||
cat <<END1 > ${old_rpmbuild}-san
|
||||
#!/bin/sh -x
|
||||
ulimit -v unlimited
|
||||
ulimit -a
|
||||
export ASAN_OPTIONS=detect_leaks=0:halt_on_error=0
|
||||
|
||||
${old_rpmbuild} "\$@"
|
||||
|
||||
ret=\$?
|
||||
echo "SAN version has been compiledddddddddddddddddddddddddddd"
|
||||
exit \$ret
|
||||
|
||||
END1
|
||||
chmod 755 ${old_rpmbuild}-san
|
||||
|
||||
# add gcc args
|
||||
mv $old_gcc $old_gcc"_san"
|
||||
cat <<END1 > $old_gcc
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
echo "\$@" | grep conftest &>/tmp/tmp.tmp
|
||||
ret=\$?
|
||||
if [ \$ret -eq 0 ]; then
|
||||
${old_gcc}_san "\$@"
|
||||
else
|
||||
${old_gcc}_san %{?_with_san_args} "\$@"
|
||||
fi
|
||||
|
||||
|
||||
END1
|
||||
chmod 755 $old_gcc $old_gcc"_san"
|
||||
|
||||
# add gplus args
|
||||
if [ -f $old_gplus ]; then
|
||||
mv $old_gplus $old_gplus"_san"
|
||||
cat <<END1 > $old_gplus
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
echo "\$@" | grep conftest &>/tmp/tmp.tmp
|
||||
ret=\$?
|
||||
if [ \$ret -eq 0 ]; then
|
||||
${old_gplus}_san "\$@"
|
||||
else
|
||||
${old_gplus}_san %{?_with_san_args} "\$@"
|
||||
fi
|
||||
|
||||
END1
|
||||
chmod 755 $old_gplus $old_gplus"_san"
|
||||
fi
|
||||
|
||||
# add cplus args
|
||||
if [ -f $old_cplus ]; then
|
||||
mv $old_cplus $old_cplus"_san"
|
||||
cat <<END1 > $old_cplus
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
echo "\$@" | grep conftest &>/tmp/tmp.tmp
|
||||
ret=\$?
|
||||
if [ \$ret -eq 0 ]; then
|
||||
${old_cplus}_san "\$@"
|
||||
else
|
||||
${old_cplus}_san %{?_with_san_args} "\$@"
|
||||
fi
|
||||
|
||||
END1
|
||||
chmod 755 $old_cplus $old_cplus"_san"
|
||||
fi
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
%preun
|
||||
|
||||
%postun
|
||||
rm -rf /opt/custom_build_tool/custom_build_tool.sh
|
||||
%postun nocheck
|
||||
rm -rf /opt/custom_build_tool/rpmbuild-nocheck
|
||||
%postun target
|
||||
rm -rf /opt/custom_build_tool/rpmbuild-target
|
||||
%if %{with_san}
|
||||
%postun san
|
||||
rm -rf /opt/custom_build_tool/rpmbuild-san
|
||||
%endif
|
||||
%if %{with_ub}
|
||||
%postun uploadbuild
|
||||
rm -rf /opt/custom_build_tool/rpmbuild-ub
|
||||
%endif
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%dir /opt
|
||||
%dir /opt/custom_build_tool
|
||||
/opt/custom_build_tool/custom_build_tool.sh
|
||||
|
||||
%files nocheck
|
||||
%defattr(-,root,root)
|
||||
%dir /opt
|
||||
%dir /opt/custom_build_tool
|
||||
/opt/custom_build_tool/rpmbuild-nocheck
|
||||
|
||||
%files nodebug
|
||||
%defattr(-,root,root)
|
||||
|
||||
%if %{with_ub}
|
||||
%files uploadbuild
|
||||
%defattr(-,root,root)
|
||||
%dir /opt
|
||||
%dir /opt/custom_build_tool
|
||||
/opt/custom_build_tool/rpmbuild-ub
|
||||
/opt/custom_build_tool/upload_build.sh
|
||||
/opt/custom_build_tool/client-tool-linux
|
||||
/opt/custom_build_tool/cmdlist
|
||||
%endif
|
||||
|
||||
%if %{with_san}
|
||||
%files san
|
||||
%defattr(-,root,root)
|
||||
%dir /opt
|
||||
%dir /opt/custom_build_tool
|
||||
/opt/custom_build_tool/rpmbuild-san
|
||||
%endif
|
||||
|
||||
%files target
|
||||
%defattr(-,root,root)
|
||||
%dir /opt
|
||||
%dir /opt/custom_build_tool
|
||||
/opt/custom_build_tool/rpmbuild-target
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT/*
|
||||
rm -rf %{_tmppath}/%{name}
|
||||
rm -rf $RPM_BUILD_DIR/%{name}
|
||||
|
||||
%changelog
|
||||
* Fri Apr 28 2023 wangchong <wangchong56@huawei.com> - 1.0.0-20
|
||||
- Type: NA
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: delete error buildrequires
|
||||
|
||||
* Mon Jan 24 2022 senlin <xiasenlin1@huawei.com> - 1.0.0-19
|
||||
- Type: Correction of bad behavior
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: Specify the specific sudo commands for abuild users
|
||||
|
||||
* Fri Oct 16 2020 zhuchunyi <zhuchunyi@huawei.com> - 1.0.0-18
|
||||
- Type:new package
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: package init
|
||||
4
custom_build_tool.yaml
Normal file
4
custom_build_tool.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
version_control: gitee
|
||||
src_repo: openeuler/custom_build_tool
|
||||
tag_prefix: "^v"
|
||||
seperator: "."
|
||||
Loading…
x
Reference in New Issue
Block a user