From Fedora Project Wiki
Line 25: Line 25:
 
* Macro <code>%{postupg_number}</code> means target release to which the system is going to be upgraded, e.g. Fedora 23.
 
* Macro <code>%{postupg_number}</code> means target release to which the system is going to be upgraded, e.g. Fedora 23.
 
* Macro <code>%{preupg_results}</code> means where the contents files are generated
 
* Macro <code>%{preupg_results}</code> means where the contents files are generated
 +
* Macro <code>%{fedora_preupgrade_name}</code> means '''Fedora%{preupg_number}_%{postupg_number}''', e.g. Fedora22_23
 +
* Macro <code>%{fedora_preupgrade_dir}</code> reference to '''/usr/share/preupgrade/%{fedora_preupgrade_name}'''
  
 
== Prep section ==
 
== Prep section ==
Copy all contents files to '''Fedora%{preupg_number}_%{postupg_number}/%{name}''' directory.
+
Copy all contents files to '''%{fedora_preupgrade_name}/%{name}''' directory.
  
 
Content files are:
 
Content files are:
Line 36: Line 38:
 
== Build section ==
 
== Build section ==
 
Run command:
 
Run command:
  %{preupgrade_build} Fedora%{preupg_number}_%{postupg_number}/%{name}/
+
  %{preupgrade_build} %{fedora_preupgrade_name}/%{name}/
  
 
%{preupgrade_build} command has to success. Warning can be suppressed.
 
%{preupgrade_build} command has to success. Warning can be suppressed.
Line 44: Line 46:
 
  %install
 
  %install
 
  ...
 
  ...
  mkdir -p ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
+
  mkdir -p ${buildroot}%{fedora_preupgrade_dir}/%{name}
  install -p -m 755 %{SourceY} ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/check.sh
+
  install -p -m 755 %{SourceY} ${buildroot}%{fedora_preupgrade_dir}/%{name}/check.sh
  install -p -m 644 %{SourceZ} ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/solution.txt
+
  install -p -m 644 %{SourceZ} ${buildroot}%{fedora_preupgrade_dir}/%{name}/solution.txt
  install -p -m 644 Fedora%{preupg_number}_%{postupg_number}-%{preupg_results}/%{name}/group.xml ${buildroot}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/group.xml
+
  install -p -m 644 %{fedora_preupgrade_name}-%{preupg_results}/%{name}/group.xml ${buildroot}%{fedora_preupgrade_dir}/%{name}/group.xml
  
 
== Files section ==
 
== Files section ==
Line 54: Line 56:
 
  ...
 
  ...
 
  %files -n preupgrade-assistant-contents-%{name}
 
  %files -n preupgrade-assistant-contents-%{name}
  %dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
+
  %dir %{fedora_preupgrade_dir}/%{name}
 
* All files except text files should be listed like
 
* All files except text files should be listed like
 
  %files
 
  %files
 
  ...
 
  ...
 
  %files -n preupgrade-assistant-contents-%{name}
 
  %files -n preupgrade-assistant-contents-%{name}
  %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.{sh,py}
+
  %{fedora_preupgrade_dir}/%{name}/*.{sh,py}
  %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.xml
+
  %{fedora_preupgrade_dir}/%{name}/*.xml
 
* All text files from content should be listed via
 
* All text files from content should be listed via
 
  %files
 
  %files
 
  ...
 
  ...
 
  %files -n preupgrade-assistant-contents-%{name}
 
  %files -n preupgrade-assistant-contents-%{name}
  %doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt
+
  %doc %{fedora_preupgrade_dir}/%{name}/*.txt
  
 
== Directory ownership ==
 
== Directory ownership ==
 
Directories <code>%{preupgrade_dir}</code> and
 
Directories <code>%{preupgrade_dir}</code> and
<code>%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}</code>
+
<code>%{fedora_preupgrade_dir}</code>
 
are owned by package ''preupgrade-assistant'' itself.
 
are owned by package ''preupgrade-assistant'' itself.
  
Line 104: Line 106:
 
%prep
 
%prep
 
# Copy all content files to %{preupgrade_dir}
 
# Copy all content files to %{preupgrade_dir}
mkdir -p Fedora%{preupg_number}_%{postupg_number}/%{name}
+
mkdir -p %{fedora_preupgrade_name}/%{name}
cp %{SOURCEX} Fedora%{preupg_number}_%{postupg_number}/%{name}/%{SOURCEX}
+
cp %{SOURCEX} %{fedora_preupgrade_name}/%{name}/%{SOURCEX}
cp %{SOURCEY} Fedora%{preupg_number}_%{postupg_number}/%{name}/%{SOURCEY}
+
cp %{SOURCEY} %{fedora_preupgrade_name}/%{name}/%{SOURCEY}
cp %{SOURCEZ} Fedora%{preupg_number}_%{postupg_number}/%{name}/%{SOURCEZ}
+
cp %{SOURCEZ} %{fedora_preupgrade_name}/%{name}/%{SOURCEZ}
  
 
%build
 
%build
%{preupgrade_build} Fedora%{preupg_number}_%{postupg_number}/%{name}/
+
%{preupgrade_build} %{fedora_preupgrade_name}/%{name}/
  
 
%install
 
%install
mkdir -p %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
+
mkdir -p %{buildroor}%{fedora_preupgrade_dir}/%{name}
install -p -m 755 %{SOURCEY} %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/%{SOURCEY}
+
install -p -m 755 %{SOURCEY} %{buildroor}%{fedora_preupgrade_dir}/%{name}/%{SOURCEY}
install -p -m 644 %{SOURCEZ} %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/%{SOURCEZ}
+
install -p -m 644 %{SOURCEZ} %{buildroor}%{fedora_preupgrade_dir}/%{name}/%{SOURCEZ}
install -p -m 644 Fedora%{preupg_number}_%{postupg_number}-%{preupg_results}/%{name}/group.xml %{buildroor}%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/group.xml
+
install -p -m 644 %{fedora_preupgrade_name}-%{preupg_results}/%{name}/group.xml %{buildroor}%{fedora_preupgrade_dir}/%{name}/group.xml
  
  
 
%files -n preupgrade-assistant-contents-%{name}
 
%files -n preupgrade-assistant-contents-%{name}
%dir %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}
+
%dir %{fedora_preupgrade_dir}/%{name}
%doc %{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.txt
+
%doc %{fedora_preupgrade_dir}/%{name}/*.txt
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.{py,sh}
+
%{fedora_preupgrade_dir}/%{name}/*.{py,sh}
%{preupgrade_dir}/Fedora%{preupg_number}_%{postupg_number}/%{name}/*.xml
+
%{fedora_preupgrade_dir}/%{name}/*.xml
 
</pre>
 
</pre>

Revision as of 14:47, 23 January 2015

Warning.png
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 package (e.g mariadb)

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.
  • Macro %{preupg_results} means where the contents files are generated
  • Macro %{fedora_preupgrade_name} means Fedora%{preupg_number}_%{postupg_number}, e.g. Fedora22_23
  • Macro %{fedora_preupgrade_dir} reference to /usr/share/preupgrade/%{fedora_preupgrade_name}

Prep section

Copy all contents files to %{fedora_preupgrade_name}/%{name} directory.

Content files are:

  • INI file
  • check_script (python or bash)
  • text file with solution description.

Build section

Run command:

%{preupgrade_build} %{fedora_preupgrade_name}/%{name}/

%{preupgrade_build} command has to success. Warning can be suppressed.

Install section

All files from preupgrade directory should be installed with

%install
...
mkdir -p ${buildroot}%{fedora_preupgrade_dir}/%{name}
install -p -m 755 %{SourceY} ${buildroot}%{fedora_preupgrade_dir}/%{name}/check.sh
install -p -m 644 %{SourceZ} ${buildroot}%{fedora_preupgrade_dir}/%{name}/solution.txt
install -p -m 644 %{fedora_preupgrade_name}-%{preupg_results}/%{name}/group.xml ${buildroot}%{fedora_preupgrade_dir}/%{name}/group.xml

Files section

  • Directory where Preupgrade Assistant installs files and directories must be owned by the subpackage
%files
...
%files -n preupgrade-assistant-contents-%{name}
%dir %{fedora_preupgrade_dir}/%{name}
  • All files except text files should be listed like
%files
...
%files -n preupgrade-assistant-contents-%{name}
%{fedora_preupgrade_dir}/%{name}/*.{sh,py}
%{fedora_preupgrade_dir}/%{name}/*.xml
  • All text files from content should be listed via
%files
...
%files -n preupgrade-assistant-contents-%{name}
%doc %{fedora_preupgrade_dir}/%{name}/*.txt

Directory ownership

Directories %{preupgrade_dir} and %{fedora_preupgrade_dir} 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 %{fedora_preupgrade_name}/%{name}
cp %{SOURCEX} %{fedora_preupgrade_name}/%{name}/%{SOURCEX}
cp %{SOURCEY} %{fedora_preupgrade_name}/%{name}/%{SOURCEY}
cp %{SOURCEZ} %{fedora_preupgrade_name}/%{name}/%{SOURCEZ}

%build
%{preupgrade_build} %{fedora_preupgrade_name}/%{name}/

%install
mkdir -p %{buildroor}%{fedora_preupgrade_dir}/%{name}
install -p -m 755 %{SOURCEY} %{buildroor}%{fedora_preupgrade_dir}/%{name}/%{SOURCEY}
install -p -m 644 %{SOURCEZ} %{buildroor}%{fedora_preupgrade_dir}/%{name}/%{SOURCEZ}
install -p -m 644 %{fedora_preupgrade_name}-%{preupg_results}/%{name}/group.xml %{buildroor}%{fedora_preupgrade_dir}/%{name}/group.xml


%files -n preupgrade-assistant-contents-%{name}
%dir %{fedora_preupgrade_dir}/%{name}
%doc %{fedora_preupgrade_dir}/%{name}/*.txt
%{fedora_preupgrade_dir}/%{name}/*.{py,sh}
%{fedora_preupgrade_dir}/%{name}/*.xml