Contents |
MeeGo uses RPM as the package format. After you finish your application development work, you need to make a RPM package to publish it. This page will introduce a tutorial to create RPM package with MeeGo SDK and tools. To generate MeeGo adapted RPM packages, the MeeGo Packaging Guideline should be followed. This page will provides a simple tutorial to create a MeeGo rpm package.
MeeGo recommends to use Spectacle to either create MeeGo spec file or convert existing spec file to MeeGo spec file.
yum install spectacle
Spectacle uses a package meta-data file as the input to generate MeeGo spec file. The meta-data file is in YAML format. Spectacle defines specific Syntax of Spectacle YAML.
Name: spectacle Summary: RPM Spec file generator and management tool Version: 0.17 Release: 1 SCM: git@git.moblin.org:spectacle Group: Development/Tools License: GPLv2+ URL: http://www.moblin.org BuildArch: noarch Description: | A tool for managing and creating RPM spec files Sources: - spectacle-%{version}.tar.gz Requires: - PyYAML - python-urlgrabber - python-cheetah PkgBR: - python-devel - python-cheetah Builder: python SupportOtherDistros: yes
spec2spectacle package_name.spec
With the YAML file, the spec file can be easily generated. With above simple yaml file, a file named "spectacle.spec" will be created:
specify spectacle.yaml
The generated spec file is:
#
# Do not Edit! Generated by:
# spectacle version 0.15
#
# >> macros
# << macros
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Name: spectacle
Summary: RPM Spec file generator and management tool
Version: 0.17
Release: 1
Group: Development/Tools
License: GPLv2+
BuildArch: noarch
URL: http://www.moblin.org
Source0: spectacle-%{version}.tar.gz
Source100: spectacle.yaml
Requires: PyYAML
Requires: python-urlgrabber
Requires: python-cheetah
BuildRequires: python-devel
BuildRequires: python-cheetah
%description
A tool for managing and creating RPM spec files
%prep
%setup -q -n %{name}-%{version}
# >> setup
# << setup
%build
# >> build pre
# << build pre
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
# >> build post
# << build post
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%if 0%{?suse_version}
%{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix}
%else
%{__python} setup.py install --root=%{buildroot} -O1
%endif
# >> install post
# << install post
%files
%defattr(-,root,root,-)
# >> files
# << files
Note: Normally, if all related information has been provided in .yaml file, then the spec file does not need any change.
# >> install post
make install-data DESTDIR=${RPM_BUILD_ROOT}
# << install post
# >> files
%doc README AUTHORS COPYING TODO
%doc examples/
%dir %{_datadir}/spectacle
%{_datadir}/spectacle/*
%{_bindir}/*
%{python_sitelib}/*
# << files
For application developers, they may want to create package directly from the MeeGo SDK chroot environment. It's quite easy to use rpmbuild to do that.
yum install rpmbuild
cp spectacle-0.17.tar.gz ~/rpmbuild/SOURCES/ cp spectacle.yaml ~/rpmbuild/SOURCES/ cp spectacle.spec ~/rpmbuild/SPECS/
cd ~/rpmbuild/SPECS rpmbuild -ba spectacle.spec
Then the rpm packages will be generated and put at ~/rpmbuild/RPMS/ and ~/rpmbuild/SRPMS/.
For people who do build or release, they may just want to build packages without the MeeGo SDK chroot environment. The following steps are useful for them.
Under Linux, a tool called "build" is used to create rpm packages directly from spec file.
* MeeGo * Fedora 10,11,12 * openSUSE(s) * xUbuntu 8.10/9.04/9.10 * Debian 5.0
sudo build --repository http://repo.meego.com/MeeGo/release/1.0/core/repo/ia32/os/ --arch i686 spectacle.spec
The packages will be generated at /var/tmp/build-root/home/abuild/rpmbuild/RPMS/ and /var/tmp/build-root/home/abuild/rpmbuild/SRPMS/