From 171daaaa9d442bd9b64e9c3d29dab5588874834a Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Dec 07 2016 05:44:18 +0000 Subject: Rework pkg build/install macros --- diff --git a/macros.octave b/macros.octave index 5d2a83b..1fcea91 100644 --- a/macros.octave +++ b/macros.octave @@ -14,7 +14,19 @@ %octave_cmd() octave -H -q --no-window-system --no-site-file --eval '%*'; # Build unpacked source directory into a package tar file in a temporary location -%octave_pkg_build %octave_cmd pkg build "-verbose" "-nodeps" %{_tmppath}/%{name}-%{version}-%{release}.%{_arch} %{_builddir}/%{buildsubdir} +# Pass -T to use source tarball +%octave_pkg_build(T) %{lua: + if (rpm.expand("%{-T}") == "") then + octpkg_tarfile = rpm .expand("%{_tmppath}/%{octpkg}-%{version}.tar.gz") + print("tar czf "..octpkg_tarfile.." -C "..rpm.expand("%{_builddir} %{buildsubdir}").."\\n") + else + octpkg_tarfile = rpm.expand("%{SOURCE0}") + end + -- print(rpm.expand("%octave_cmd pkg build -verbose -nodeps %{_builddir}/%{buildsubdir} "..octpkg_tarfile).."\\n") + print(rpm.expand("octave -H -q --no-window-system --no-site-file --eval 'pkg build -verbose -nodeps %{_builddir}/%{buildsubdir} "..octpkg_tarfile).."'\\n") + -- Extract the build tarball for debuginfo generation + print(rpm.expand("tar xf %{octpkg}-%{version}-%{_arch}-redhat-linux-gnu-%{octave_api}.tar.gz\\n")) +} # Install a package. We use the octave pkg install command to install the # built package into the buildroot. We also put a note to prevent the root @@ -24,7 +36,7 @@ %octave_pkg_install \ mkdir -p %{buildroot}%{octprefix} \ mkdir -p %{buildroot}%{octarchprefix} \ -%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{_tmppath}/%{name}-%{version}-%{release}.%{_arch}/%{octpkg}-%{version}.tar.gz");unlink(pkg("local_list"));unlink(pkg("global_list")); \ +%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{octpkg}-%{version}-%{_arch}-redhat-linux-gnu-%{octave_api}.tar.gz");unlink(pkg("local_list"));unlink(pkg("global_list")); \ if [ -e %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m ] \ then \ mv %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m.orig \ @@ -37,7 +49,7 @@ echo "endfunction" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \ # Run pkg tests - We need to reinstall to recreate 'octave_packages' so that # octave can find the package, then remove 'octave_packages' again. %octave_pkg_check \ -%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{_tmppath}/%{name}-%{version}-%{release}.%{_arch}/%{octpkg}-%{version}.tar.gz");pkg("load","%{octpkg}");runtests("%{buildroot}%{octpkgdir}");unlink(pkg("local_list"));unlink(pkg("global_list")); \ +%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{octpkg}-%{version}-%{_arch}-redhat-linux-gnu-%{octave_api}.tar.gz");pkg("load","%{octpkg}");runtests("%{buildroot}%{octpkgdir}");unlink(pkg("local_list"));unlink(pkg("global_list")); \ %{nil} # preun script - we need to remove our uninstall protection and perhaps diff --git a/octave-pkgbuilddir.patch b/octave-pkgbuilddir.patch deleted file mode 100644 index c30acc0..0000000 --- a/octave-pkgbuilddir.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -up octave-4.0.0-rc1/scripts/pkg/private/install.m.pkgbuilddir octave-4.0.0-rc1/scripts/pkg/private/install.m ---- octave-4.0.0-rc1/scripts/pkg/private/install.m.pkgbuilddir 2015-03-05 08:13:28.000000000 -0700 -+++ octave-4.0.0-rc1/scripts/pkg/private/install.m 2015-03-05 20:43:45.762854275 -0700 -@@ -62,7 +62,10 @@ function install (files, handle_deps, au - for i = 1:length (files) - tgz = files{i}; - -- if (exist (tgz, "file")) -+ ## The filename pointed to an uncompressed package to begin with. -+ if (exist (tgz, "dir")) -+ dirlist = {".", "..", tgz}; -+ elseif (exist (tgz, "file")) - ## Create a temporary directory. - tmpdir = tempname (); - tmpdirs{end+1} = tmpdir; -@@ -91,17 +94,16 @@ function install (files, handle_deps, au - endif - endif - -- ## The filename pointed to an uncompressed package to begin with. -- if (exist (tgz, "dir")) -- dirlist = {".", "..", tgz}; -- endif -- -- if (exist (tgz, "file") || exist (tgz, "dir")) -+ if (exist (tgz, "file")) - ## The two first entries of dirlist are "." and "..". -- if (exist (tgz, "file")) -- packdir = fullfile (tmpdir, dirlist{3}); -+ if (exist (tgz, "dir")) -+ if (tgz(1) == '/') -+ packdir = tgz; -+ else -+ packdir = fullfile (pwd (), dirlist{3}); -+ endif - else -- packdir = fullfile (pwd (), dirlist{3}); -+ packdir = fullfile (tmpdir, dirlist{3}); - endif - packdirs{end+1} = packdir; - diff --git a/octave.spec b/octave.spec index f32f4f4..e737ae8 100644 --- a/octave.spec +++ b/octave.spec @@ -1,8 +1,6 @@ # From src/version.h:#define OCTAVE_API_VERSION %global octave_api api-v51 -%{?!_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}} - %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) %global builddocs 1 @@ -16,7 +14,7 @@ Name: octave Epoch: 6 Version: 4.2.0 -Release: 1%{?rcver:.rc%{rcver}}%{?dist} +Release: 2%{?rcver:.rc%{rcver}}%{?dist} Summary: A high-level language for numerical computations Group: Applications/Engineering License: GPLv3+ @@ -30,9 +28,6 @@ Source0: ftp://alpha.gnu.org/gnu/octave/octave-%{version}%{rctag}.tar.lz # RPM macros for helping to build Octave packages Source1: macros.octave Source2: xorg.conf -# Fix to allow pkg build to use a directory -# https://savannah.gnu.org/bugs/?func=detailitem&item_id=32839 -Patch0: octave-pkgbuilddir.patch # Fix compilation with -Werror=implicit-declarations Patch1: octave-implicit.patch # Remove project_group from appdata.xml file @@ -187,7 +182,6 @@ This package contains documentation for Octave. %prep %setup -q -n %{name}-%{version}%{?rctag} -%patch0 -p1 -b .pkgbuilddir %patch1 -p1 -b .implicit %patch2 -p1 -b .appdata %patch4 -p1 -b .gnulib @@ -428,6 +422,9 @@ fi %{_pkgdocdir}/refcard*.pdf %changelog +* Tue Dec 06 2016 Orion Poplawski - 6:4.2.0-2 +- Rework pkg build/install macros + * Tue Dec 06 2016 Orion Poplawski - 6:4.2.0-1 - Update to 4.2.0 - Drop texinfo5 patch