From Fedora Project Wiki
No edit summary
(my two cents)
Line 1: Line 1:
{{admon/warning|This is a DRAFT.}}
{{admon/warning|This is a DRAFT.}}


= PreupgradeAssistant contents Packaging guidelines =
= Preupgrade Assistant contents Packaging guidelines =


== How to package a PreupgradeAssistant contents ==
== How to package a Preupgrade Assistant contents ==
Contents files are packed as a subpackage of main package.
Contents files are packaged as a subpackage of main ''preupgrade-assistant'' package.


== Naming guidelines ==
== Naming guidelines ==
Every Preupgrade Assistant content package must start with '''preupgrade-assistant-contents-''' which is followed by original package name.
Every Preupgrade Assistant content subpackage name must start with ''preupgrade-assistant-contents-'' followed by original package name.


For example preupgrade assistant package name '''mariadb''' will be named '''preupgrade-assistant-contents-mariadb''' in the SPEC file.
For example Preupgrade Assistant content subpackage for ''mariadb'' will be named ''preupgrade-assistant-contents-mariadb''.


== Dependencies ==
== Dependencies ==
 
* All packages must have
* All packages must Require <code>preupgrade-assistant</code>.
  Requires: preupgrade-assistant
* All packages must have <code>BuildRequires: preupgrade-assistant-devel</code>. Devel package contains macros and check script whether contents is valid.
  BuildRequires: preupgrade-assistant-devel
Devel package contains macros and contents validating check script.


== Architecture ==
== Architecture ==
 
* All ''preupgrade-assistant-contents-*'' subpackages must be architecture independent, i.e. have <code>BuildArch: noarch</code>.
* All preupgrade-assistant-contents must be architecture independent, i. e. <code>BuildArch: noarch</code>.


== Macros ==
== Macros ==
 
* Macro denoting the parent directory where the package files go is <code>%{preupgrade_dir}</code>. This currently expands to <code>/usr/share/preupgrade</code>.
* The macro denoting the parent directory where the package files go is <code>%{preupgradedir}</code>. This currently expands to <code>/usr/share/preupgrade</code>.
* Macro <code>%{preupg_number}</code> means source release from which the system is going to be upgraded, e.g. Fedora 22.
* The macro <code>%{preupg_number}</code> means source system from which system is going to be upgraded like from Fedora 22.
* Macro <code>%{postupg_number}</code> means target release to which the system is going to be upgraded, e.g. Fedora 23.
* The macro <code>%{postupg_number}</code> means target system to which system is going to be upgraded like to Fedora 23.


== Build section ==
== Build section ==
Nothing special
N/A


== Install section ==
== Install section ==
All files from '''preupgrade''' directory should be installed into
All files from ''preupgrade'' directory should be installed with
%install
...
  mkdir -p ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
  mkdir -p ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
  cp preupgrade/* ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/
  cp preupgrade/* ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/


== Check section ==
== Check section ==
* You must run %check_preupgrade in '''check''' section and it must pass.
* %check_preupgrade needs to be run in %check section.
  %check_preupgrade %{preupgradedir}/Fedora%{preupg_number}_%{postupg_number}/
%check
  %check_preupgrade %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/


== Files section ==
== Files section ==
* Preupgrade Assistant files and directories are installed into
* Directory where Preupgrade Assistant installs files and directories must be owned by the subpackage
%files
...
  %dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
  %dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
* All files except text files should be installed like
* All files except text files should be listed like
%files
...
  %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.{sh,py}
  %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.{sh,py}
  %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.ini
  %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.ini
* All text files from content should be installed via
* All text files from content should be listed via
%files
...
  %doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt
  %doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt


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


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

Revision as of 13:58, 22 January 2015

This is a DRAFT.

Preupgrade Assistant contents Packaging guidelines

How to package a Preupgrade Assistant contents

Contents files are packaged as a subpackage of main preupgrade-assistant package.

Naming guidelines

Every Preupgrade Assistant content subpackage name must start with preupgrade-assistant-contents- followed by original package name.

For example Preupgrade Assistant content subpackage for mariadb will be named preupgrade-assistant-contents-mariadb.

Dependencies

  • All packages must have
 Requires: preupgrade-assistant
 BuildRequires: preupgrade-assistant-devel

Devel package contains macros and contents validating check script.

Architecture

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

Macros

  • Macro denoting the parent directory where the package files go is %{preupgrade_dir}. This currently expands to /usr/share/preupgrade.
  • Macro %{preupg_number} means source release from which the system is going to be upgraded, e.g. Fedora 22.
  • Macro %{postupg_number} means target release to which the system is going to be upgraded, e.g. Fedora 23.

Build section

N/A

Install section

All files from preupgrade directory should be installed with

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

Check section

  • %check_preupgrade needs to be run in %check section.
%check
%check_preupgrade %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/

Files section

  • Directory where Preupgrade Assistant installs files and directories must be owned by the subpackage
%files
...
%dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
  • All files except text files should be listed like
%files
...
%{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 listed via
%files
...
%doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt

Directory ownership

Directories %{preupgrade_dir} and %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number} are owned by package preupgrade-assistant itself.

Sample SPEC

Snapshot of mariadb.spec


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}/

%files -n preupgrade-assistant-contents-%{name}
%dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
%doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.{py,sh}
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.ini