#56 Fix update-alternative uninstall script
Closed 3 years ago by tstellar. Opened 3 years ago by sergesanspaille.
rpms/ sergesanspaille/llvm fix/update-alternatives  into  master

file modified
+37 -18
@@ -11,13 +11,12 @@ 

  %global llvm_libdir %{_libdir}/%{name}

  %global build_llvm_libdir %{buildroot}%{llvm_libdir}

  #%%global rc_ver 6

- %global baserelease 6

+ %global baserelease 8

  %global llvm_srcdir llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src

  %global maj_ver 10

  %global min_ver 0

  %global patch_ver 0

  

- 

  %if %{with compat_build}

  %global pkg_name llvm%{maj_ver}.%{min_ver}

  %global exec_suffix -%{maj_ver}.%{min_ver}
@@ -86,6 +85,10 @@ 

  # We need python3-devel for pathfix.py.

  BuildRequires:	python3-devel

  

+ # For origin certification

+ BuildRequires:	gnupg2

+ 

+ 

  Requires:	%{name}-libs%{?_isa} = %{version}-%{release}

  

  Provides:	llvm(major) = %{maj_ver}
@@ -163,6 +166,7 @@ 

  %endif

  

  %prep

+ %{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}'

  %autosetup -n %{llvm_srcdir} -p2

  

  pathfix.py -i %{__python3} -pn \
@@ -170,8 +174,6 @@ 

  	tools/opt-viewer/*.py

  

  %build

- mkdir -p _build

- cd _build

  

  %ifarch s390 %{arm} %ix86

  # Decrease debuginfo verbosity to reduce memory consumption during final library linking
@@ -179,7 +181,7 @@ 

  %endif

  

  # force off shared libs as cmake macros turns it on.

- %cmake .. -G Ninja \

+ %cmake  -G Ninja \

  	-DBUILD_SHARED_LIBS:BOOL=OFF \

  	-DLLVM_PARALLEL_LINK_JOBS=1 \

  	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -248,17 +250,20 @@ 

  # Build libLLVM.so first.  This ensures that when libLLVM.so is linking, there

  # are no other compile jobs running.  This will help reduce OOM errors on the

  # builders without having to artificially limit the number of concurrent jobs.

- %ninja_build LLVM

- %ninja_build

+ %cmake_build --target LLVM

+ %cmake_build

  

  %install

- %ninja_install -C _build

+ %cmake_install

  

  

  %if %{without compat_build}

  mkdir -p %{buildroot}/%{_bindir}

  mv %{buildroot}/%{_bindir}/llvm-config %{buildroot}/%{_bindir}/llvm-config-%{__isa_bits}

  

+ # ghost presence

+ touch %{buildroot}%{_bindir}/llvm-config

+ 

  # Fix some man pages

  ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config-%{__isa_bits}.1

  mv %{buildroot}%{_mandir}/man1/tblgen.1 %{buildroot}%{_mandir}/man1/llvm-tblgen.1
@@ -268,7 +273,7 @@ 

  

  for f in %{test_binaries}

  do

-     install -m 0755 ./_build/bin/$f %{buildroot}%{_bindir}

+     install -m 0755 %{_vpath_builddir}/bin/$f %{buildroot}%{_bindir}

  done

  

  # Remove testing of update utility tools
@@ -278,9 +283,9 @@ 

  

  # Install libraries needed for unittests

  %if 0%{?__isa_bits} == 64

- %global build_libdir _build/lib64

+ %global build_libdir %{_vpath_builddir}/lib64

  %else

- %global build_libdir _build/lib

+ %global build_libdir %{_vpath_builddir}/lib

  %endif

  

  install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir}
@@ -290,7 +295,6 @@ 

  %global lit_unit_cfg test/Unit/%{_arch}.site.cfg.py

  %global lit_fedora_cfg %{_datadir}/llvm/lit.fedora.cfg.py

  

- 

  # Install gtest sources so clang can use them for gtest

  install -d %{install_srcdir}

  install -d %{install_srcdir}/utils/
@@ -298,8 +302,8 @@ 

  

  # Generate lit config files.  Strip off the last line that initiates the

  # test run, so we can customize the configuration.

- head -n -1 _build/test/lit.site.cfg.py >> %{lit_cfg}

- head -n -1 _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}

+ head -n -1 %{_vpath_builddir}/test/lit.site.cfg.py >> %{lit_cfg}

+ head -n -1 %{_vpath_builddir}/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}

  

  # Install custom fedora config file

  cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg}
@@ -324,7 +328,7 @@ 

  

  # Install the unit test binaries

  mkdir -p %{build_llvm_libdir}

- cp -R _build/unittests %{build_llvm_libdir}/

+ cp -R %{_vpath_builddir}/unittests %{build_llvm_libdir}/

  rm -rf `find %{build_llvm_libdir} -iname 'cmake*'`

  

  # Install libraries used for testing
@@ -381,7 +385,8 @@ 

  

  %check

  # TODO: Fix test failures on arm

- LD_LIBRARY_PATH=$PWD/_build/%{_lib} ninja check-all -C _build || \

+ # FIXME: use %%cmake_build instead of %%__ninja

+ LD_LIBRARY_PATH=%{buildroot}/%{_libdir}  %{__ninja} check-all -C %{_vpath_builddir} || \

  %ifarch %{arm}

    :

  %else
@@ -397,17 +402,19 @@ 

  

  %postun devel

  if [ $1 -eq 0 ]; then

-   %{_sbindir}/update-alternatives --remove llvm-config %{_bindir}/llvm-config

+   %{_sbindir}/update-alternatives --remove llvm-config %{_bindir}/llvm-config-%{__isa_bits}

  fi

  

  %endif

  

  %files

+ %license LICENSE.TXT

  %exclude %{_mandir}/man1/llvm-config*

  %{_mandir}/man1/*

  %{_bindir}/*

  

  %if %{without compat_build}

+ %exclude %{_bindir}/llvm-config

  %exclude %{_bindir}/llvm-config-%{__isa_bits}

  %exclude %{_bindir}/not

  %exclude %{_bindir}/count
@@ -422,6 +429,7 @@ 

  %endif

  

  %files libs

+ %license LICENSE.TXT

  %{pkg_libdir}/libLLVM-%{maj_ver}.so

  %if %{without compat_build}

  %if %{with gold}
@@ -442,7 +450,9 @@ 

  %{pkg_libdir}/libRemarks.so*

  

  %files devel

+ %license LICENSE.TXT

  %if %{without compat_build}

+ %ghost %{_bindir}/llvm-config

  %{_bindir}/llvm-config-%{__isa_bits}

  %{_mandir}/man1/llvm-config*

  %{_includedir}/llvm
@@ -465,9 +475,11 @@ 

  %endif

  

  %files doc

+ %license LICENSE.TXT

  %doc %{_pkgdocdir}/html

  

  %files static

+ %license LICENSE.TXT

  %if %{without compat_build}

  %{_libdir}/*.a

  %exclude %{_libdir}/libLLVMTestingSupport.a
@@ -479,6 +491,7 @@ 

  %if %{without compat_build}

  

  %files test

+ %license LICENSE.TXT

  %{_libexecdir}/tests/llvm/

  %{llvm_libdir}/unittests/

  %{_datadir}/llvm/src/unittests
@@ -497,15 +510,21 @@ 

  %{_libdir}/cmake/llvm/LLVMTestExports.cmake

  

  %files googletest

+ %license LICENSE.TXT

  %{_datadir}/llvm/src/utils

  %{_libdir}/libLLVMTestingSupport.a

  

  %endif

  

  %changelog

+ * Fri Jul 31 2020 sguelton@redhat.com - 10.0.0-8

+ - Fix update-alternative uninstall script

+ 

+ * Wed Jul 29 2020 sguelton@redhat.com - 10.0.0-7

+ - Fix gpg verification and update macro usage.

+ 

  * Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 10.0.0-6

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

- 

  * Thu Jun 11 2020 sguelton@redhat.com - 10.0.0-5

  - Make llvm-test.tar.gz creation reproducible.