From Fedora Project Wiki
Line 46: Line 46:


== Directory ownership ==
== Directory ownership ==
Following directories are owned by package preupgrade-assistant itself.
%{preupgrade_dir}
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}
Subpackage should own content directory
%dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}


== Sample SPEC ==
== Sample SPEC ==

Revision as of 08:42, 22 January 2015

This is a DRAFT.

PreupgradeAssistant contents Packaging guidelines

How to package a PreupgradeAssistant contents

Content as a subpackage of main package should be installed in GIT in directory preupgrade.

Naming guidelines

Every Preupgrade Assistant content package must start with preupgrade-assistant-contents which is followed by original package name all lowercase.

For example preupgrade assistant package name mariadb will be named preupgrade-assistant-contents-mariadb in the SPEC file.

Dependencies

  • All packages must Require preupgrade-assistant.
  • All packages must have BuildRequires: preupgrade-assistant-devel. (for macros and checking)

Architecture

  • All preupgrade-assistant-contents must be architecture independent, i. e. BuildArch: noarch.

Macros

  • The macro denoting the parent directory where the package files go is %{preupgradedir}. This currently expands to /usr/share/preupgrade.

Build section

Nothing special

Install section

All files from preupgrade directory should be installed into

mkdir -p ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
cp preupgrade/* ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/

Check section

  • You must run %check_preupgrade in check section and it must pass.
%check_preupgrade %{preupgradedir}/Fedora%{preupg_number}_%{postupg_number}/

Files section

  • Preupgrade Assistant files and directories are installed into
%dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
  • All files except text files should be installed like
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.{sh,py}
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.ini
  • All text files from content should be installed via
%doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt

Directory ownership

Following directories are owned by package preupgrade-assistant itself.

%{preupgrade_dir}
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}

Subpackage should own content directory

%dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}

Sample SPEC

Snapshot of mariadb.spec


%global preupg_number 22 #System from which we are going to do an upgrade
%global postupg_number 23 # Target system

Name:             mariadb
Version:          %{compatver}.%{bugfixver}
Release:          4%{?with_debug:.debug}%{?dist}
Epoch:            1

Summary:          A community developed branch of MySQL
Group:            Applications/Databases
URL:              http://mariadb.org
# Exceptions allow client libraries to be linked with most open source SW,
# not only GPL code.  See README.mysql-license
License:          GPLv2 with exceptions and LGPLv2 and BSD

Source0:          http://mirrors.syringanetworks.net/mariadb/mariadb-%{version}/source/mariadb-%{version}.tar.gz

SourceX:          mariadb.ini
SourceY:          mariadb.sh
SourceZ:          mariadb.txt

%package -n preupgrade-assistant-contents-%{name}
BuildRequires:    preupgrade-assistant-devel
Requires:         preupgrade-assistant

%description -n preupgrade-assistant-contents-%{name}
The content is used for assessment before upgrading major release via fedup.

%prep
# Copy all content files to %{preupgrade_dir}
mkdir -p preupgrade
cp %{SOURCEX} preupgrade/%{SOURCEX}
cp %{SOURCEY} preupgrade/%{SOURCEY}
cp %{SOURCEZ} preupgrade/%{SOURCEZ}

%install
mkdir -p %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
cp preupgrade/* %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/

%check
%check_preupg %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/