Packaging:Octave

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Naming of Octave packages: versioning problem)
(Update to new specs)
Line 18: Line 18:
  
 
<pre>
 
<pre>
%define pkg foo
+
%global octpkg image
%{!?octave_api: %define octave_api %(octave-config -p API_VERSION || echo 0)}
+
  
Name:          octave-%{pkg}
+
Name:          octave-%{octpkg}
Version:        1.2.1
+
Version:        1.0.13
 
Release:        1%{?dist}
 
Release:        1%{?dist}
Summary:        Foo Interface for Octave
+
Summary:        Image processing for Octave
 
Group:          Applications/Engineering
 
Group:          Applications/Engineering
 
License:        GPLv2+
 
License:        GPLv2+
 
URL:            http://octave.sourceforge.net
 
URL:            http://octave.sourceforge.net
Source0:        http://downloads.sourceforge.net/octave/%{pkg}-%{version}.tar.gz
+
Source0:        http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
  
 
Requires:      octave(api) = %{octave_api}
 
Requires:      octave(api) = %{octave_api}
Obsoletes:      octave-forge < 20071015
 
  
BuildRequires:  octave-devel >= 2.9.14
+
BuildRequires:  octave-devel
BuildRequires:  gcc-c++ libstdc++-devel
+
BuildRequires:  gcc-c++
  
%define octave_distpkg %{?_vendor:%_vendor}%{?!_vendor:distributions}
 
  
 
%description
 
%description
Provides Foo interface for Octave.
+
The Octave-forge Image package provides functions for processing images. The
 +
package also provides functions for feature extraction, image statistics,
 +
spatial and geometric transformations, morphological operations, linear
 +
filtering, and much more.  
 +
 
  
 
%prep
 
%prep
%setup -q -n %{pkg}-%{version}
+
%setup -q -n %{octpkg}-%{version}
 +
 
  
 
%build
 
%build
unset TERM
+
pushd src
%configure
+
%octave_pkg_build
make TMPDIR=%{_tmppath} %{?_smp_mflags}
+
 
  
 
%install
 
%install
unset TERM
 
 
rm -rf %{buildroot}
 
rm -rf %{buildroot}
make install TMPDIR=%{_tmppath} DESTDIR=%{buildroot} DISTPKG=%{octave_distpkg}
+
%octave_pkg_install
 +
 
  
 
%clean
 
%clean
Line 59: Line 60:
  
 
%post
 
%post
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/dist_admin install
+
%octave_cmd pkg rebuild
  
 
%preun
 
%preun
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/dist_admin uninstall
+
%octave_pkg_preun
  
 
%postun
 
%postun
octave -q -H --no-site-file --eval "pkg('rebuild');"
+
%octave_cmd pkg rebuild
  
 
%files
 
%files
 
%defattr(-,root,root)
 
%defattr(-,root,root)
%{_libexecdir}/octave/packages/%{pkg}-%{version}
+
%{octpkglibdir}
%dir %{_datadir}/octave/packages/%{pkg}-%{version}
+
%dir %{octpkgdir}
%{_datadir}/octave/packages/%{pkg}-%{version}/*.m
+
%{octpkgdir}/*.m
%dir %{_datadir}/octave/packages/%{pkg}-%{version}/packinfo
+
%doc %{octpkgdir}/doc-cache
%doc %{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/COPYING
+
%dir %{octpkgdir}/packinfo
%doc %{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/DESCRIPTION
+
%doc %{octpkgdir}/packinfo/COPYING
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/.autoload
+
%doc %{octpkgdir}/packinfo/DESCRIPTION
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/INDEX
+
%{octpkgdir}/packinfo/.autoload
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/dist_admin
+
%{octpkgdir}/packinfo/INDEX
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/on_uninstall.m
+
%{octpkgdir}/packinfo/on_uninstall.m
 +
 
  
 
%changelog
 
%changelog
* Tue Sep 25 2007 Orion Poplawski <orion@cora.nwra.com> 1.2.1-1
+
* Sat Feb 12 2011 Orion Poplawski <orion@cora.nwra.com> 1.0.13-1
- Octave package template
+
- Initial Fedora package
 
</pre>
 
</pre>
  
Line 88: Line 90:
  
 
<pre>
 
<pre>
%define pkg foo
+
%global octpkg image
  
Name:          octave-%{pkg}
+
Name:          octave-%{octpkg}
Version:        1.2.1
+
Version:        1.0.13
 
Release:        1%{?dist}
 
Release:        1%{?dist}
Summary:        Foo Interface for Octave
+
Summary:        Image processing for Octave
 
Group:          Applications/Engineering
 
Group:          Applications/Engineering
 
License:        GPLv2+
 
License:        GPLv2+
 
URL:            http://octave.sourceforge.net
 
URL:            http://octave.sourceforge.net
Source0:        http://downloads.sourceforge.net/octave/%{pkg}-%{version}.tar.gz
+
Source0:        http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
BuildArch:      noarch
  
 
Requires:      octave
 
Requires:      octave
Obsoletes:      octave-forge < 20071015
 
  
BuildRequires:  octave-devel >= 2.9.14
+
BuildRequires:  octave-devel
BuildRequires:  gcc-c++ libstdc++-devel
+
BuildRequires:  gcc-c++
BuildArch:      noarch
+
  
%define octave_distpkg %{?_vendor:%_vendor}%{?!_vendor:distributions}
 
  
 
%description
 
%description
Provides Foo interface for Octave.
+
The Octave-forge Image package provides functions for processing images. The
 +
package also provides functions for feature extraction, image statistics,
 +
spatial and geometric transformations, morphological operations, linear
 +
filtering, and much more.  
 +
 
  
 
%prep
 
%prep
%setup -q -n %{pkg}-%{version}
+
%setup -q -n %{octpkg}-%{version}
 +
 
  
 
%build
 
%build
 +
  
 
%install
 
%install
unset TERM
 
 
rm -rf %{buildroot}
 
rm -rf %{buildroot}
make install PACKAGE=%SOURCE0 TMPDIR=%{_tmppath} \
+
%octave_pkg_install
DESTDIR=%{buildroot} DISTPKG=%{octave_distpkg}
+
 
  
 
%clean
 
%clean
Line 127: Line 131:
  
 
%post
 
%post
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/dist_admin install
+
%octave_cmd pkg rebuild
  
 
%preun
 
%preun
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/dist_admin uninstall
+
%octave_pkg_preun
  
 
%postun
 
%postun
octave -q -H --no-site-file --eval "pkg('rebuild');"
+
%octave_cmd pkg rebuild
  
 
%files
 
%files
 
%defattr(-,root,root)
 
%defattr(-,root,root)
%dir %{_datadir}/octave/packages/%{pkg}-%{version}
+
%dir %{octpkgdir}
%{_datadir}/octave/packages/%{pkg}-%{version}/*.m
+
%{octpkgdir}/*.m
%dir %{_datadir}/octave/packages/%{pkg}-%{version}/packinfo
+
%doc %{octpkgdir}/doc-cache
%doc %{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/COPYING
+
%dir %{octpkgdir}/packinfo
%doc %{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/DESCRIPTION
+
%doc %{octpkgdir}/packinfo/COPYING
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/.autoload
+
%doc %{octpkgdir}/packinfo/DESCRIPTION
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/INDEX
+
%{octpkgdir}/packinfo/.autoload
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/dist_admin
+
%{octpkgdir}/packinfo/INDEX
%{_datadir}/octave/packages/%{pkg}-%{version}/packinfo/on_uninstall.m
+
%{octpkgdir}/packinfo/on_uninstall.m
 +
 
  
 
%changelog
 
%changelog
* Tue Sep 25 2007 Orion Poplawski <orion@cora.nwra.com> 1.2.1-1
+
* Sat Feb 12 2011 Orion Poplawski <orion@cora.nwra.com> 1.0.13-1
- Octave package template
+
- Initial Fedora package
 
</pre>
 
</pre>
  
Line 157: Line 162:
 
* Don't require a specific api version
 
* Don't require a specific api version
 
* No build step needed, just install from the source tar ball
 
* No build step needed, just install from the source tar ball
* Noarch packages don't install anything into %{_libexecdir}/octave/packages
+
* Noarch packages don't install anything into %{octpkglibdir}
  
 
== Octave packaging tips ==
 
== Octave packaging tips ==

Revision as of 18:57, 12 February 2011

Contents

How to package Octave packages

What is Octave?

The definition from website says:

"GNU Octave is a high-level language, primarily intended for numerical computations. It provides a convenient command line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with Matlab. It may also be used as a batch-oriented language."

If you are interested in packaging Octave packages, you should check here for upstream sources:

Spec Templates for Octave packages

There are two types of Octave packages: arch-specific and noarch.

Arch specific Octave spec template

%global octpkg image

Name:           octave-%{octpkg}
Version:        1.0.13
Release:        1%{?dist}
Summary:        Image processing for Octave
Group:          Applications/Engineering
License:        GPLv2+
URL:            http://octave.sourceforge.net
Source0:        http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz

Requires:       octave(api) = %{octave_api}

BuildRequires:  octave-devel
BuildRequires:  gcc-c++


%description
The Octave-forge Image package provides functions for processing images. The
package also provides functions for feature extraction, image statistics,
spatial and geometric transformations, morphological operations, linear
filtering, and much more. 


%prep
%setup -q -n %{octpkg}-%{version}


%build
pushd src
%octave_pkg_build


%install
rm -rf %{buildroot}
%octave_pkg_install


%clean
rm -rf %{buildroot}

%post
%octave_cmd pkg rebuild

%preun
%octave_pkg_preun

%postun
%octave_cmd pkg rebuild

%files
%defattr(-,root,root)
%{octpkglibdir}
%dir %{octpkgdir}
%{octpkgdir}/*.m
%doc %{octpkgdir}/doc-cache
%dir %{octpkgdir}/packinfo
%doc %{octpkgdir}/packinfo/COPYING
%doc %{octpkgdir}/packinfo/DESCRIPTION
%{octpkgdir}/packinfo/.autoload
%{octpkgdir}/packinfo/INDEX
%{octpkgdir}/packinfo/on_uninstall.m


%changelog
* Sat Feb 12 2011 Orion Poplawski <orion@cora.nwra.com> 1.0.13-1
- Initial Fedora package

Noarch Octave spec template

%global octpkg image

Name:           octave-%{octpkg}
Version:        1.0.13
Release:        1%{?dist}
Summary:        Image processing for Octave
Group:          Applications/Engineering
License:        GPLv2+
URL:            http://octave.sourceforge.net
Source0:        http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
BuildArch:      noarch

Requires:       octave

BuildRequires:  octave-devel
BuildRequires:  gcc-c++


%description
The Octave-forge Image package provides functions for processing images. The
package also provides functions for feature extraction, image statistics,
spatial and geometric transformations, morphological operations, linear
filtering, and much more. 


%prep
%setup -q -n %{octpkg}-%{version}


%build


%install
rm -rf %{buildroot}
%octave_pkg_install


%clean
rm -rf %{buildroot}

%post
%octave_cmd pkg rebuild

%preun
%octave_pkg_preun

%postun
%octave_cmd pkg rebuild

%files
%defattr(-,root,root)
%dir %{octpkgdir}
%{octpkgdir}/*.m
%doc %{octpkgdir}/doc-cache
%dir %{octpkgdir}/packinfo
%doc %{octpkgdir}/packinfo/COPYING
%doc %{octpkgdir}/packinfo/DESCRIPTION
%{octpkgdir}/packinfo/.autoload
%{octpkgdir}/packinfo/INDEX
%{octpkgdir}/packinfo/on_uninstall.m


%changelog
* Sat Feb 12 2011 Orion Poplawski <orion@cora.nwra.com> 1.0.13-1
- Initial Fedora package

Summary of differences between arch-specific and noarch octave packages

  • Noarch packages set BuildArch: noarch
  • Don't require a specific api version
  • No build step needed, just install from the source tar ball
  • Noarch packages don't install anything into %{octpkglibdir}

Octave packaging tips

Naming of Octave packages

Packages of Octave packages have their own naming scheme. They should take into account the upstream name of the package. This makes a package name format of octave-$NAME. When in doubt, use the name of the module that you type to import it in octave.

Examples:

octave-java (Octave package named java)
octave-gsl (Octave package named gsl)

Limitations in the pkg function of octave (pkg.m) means that versioning of octave packages requires that the package version must have a MAJOR.MINOR.MICRO format. Failing to use this format results in octave not recognising binary package components in %prefix/libexec.

unset TERM

Due to an issue with octave emitting an escape sequence (due to readline library) on startup, you need to unset the TERM variable in the %build and %install sections.

Updating the octave package database

Octave maintains a list of installed packages in /usr/share/octave/octave_packages that needs to be updated on package install and removal. This file is in an octave plain-text format.

The contents of the /usr/share/octave/packages/ directory are scanned for the follwing files when performing a pkg('rebuild') from within octave.

  • /usr/share/octave/packages/NAMEOFPACKAGE/packinfo/COPYING
  • /usr/share/octave/packages/NAMEOFPACKAGE/packinfo/DESCRIPTION

If these files are not present in any given NAMEOFPACKAGE directory, then octave will silently skip the folder and fail to index it correctly.

Octave will use the contents of octave_packages to modify its path at startup, allowing octave to find plugins.

Documentation files

All package files are installed into the octave directories. The COPYING and DESCRIPTION files are documentation and need to be marked as %doc. The others are not.