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- followed by original package name.
For example Preupgrade Assistant content subpackage for mariadb will be named preupgrade-assistant-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-* 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_prep} %{fedora_preupgrade_name}/%{name}/
%{preupgrade_prep} 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-%{name} %dir %{fedora_preupgrade_dir}/%{name}
- All files except text files should be listed like
%files ... %files -n preupgrade-assistant-%{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-%{name} %doc %{fedora_preupgrade_dir}/%{name}/*.txt
Directory ownership
Directories %{preupgrade_dir}
and
%{fedora_preupgrade_dir}
are owned by package preupgrade-assistant itself and should not be owned by your package.
Sample SPEC
Name: foo Version: 1.0 Release: 1%{?dist} Summary: An example package URL: http://example.com License: MIT Source0: http://example.com/foo/foo-%{version}.tgz Source1: foo.ini Source2: foo.sh Source3: foo.txt [Bulk of foo packaging elided] %package -n preupgrade-assistant-%{name} BuildRequires: preupgrade-assistant-devel Requires: preupgrade-assistant %description -n preupgrade-assistant-%{name} Files used by preupgrade to assist with upgrading between major releases of the foo package via fedup. %prep # Copy all content files to %{preupgrade_dir} mkdir -p %{fedora_preupgrade_name}/%{name} cp %{SOURCE1} %{fedora_preupgrade_name}/%{name}/%{SOURCE1} cp %{SOURCE2} %{fedora_preupgrade_name}/%{name}/%{SOURCE2} cp %{SOURCE3} %{fedora_preupgrade_name}/%{name}/%{SOURCE3} %build %{preupgrade_build} %{fedora_preupgrade_name}/%{name}/ %install mkdir -p %{buildroot}%{fedora_preupgrade_dir}/%{name} install -p -m 755 %{SOURCE2} %{buildroot}%{fedora_preupgrade_dir}/%{name}/%{SOURCE2} install -p -m 644 %{SOURCE3} %{buildroot}%{fedora_preupgrade_dir}/%{name}/%{SOURCE3} install -p -m 644 %{fedora_preupgrade_name}-%{preupg_results}/%{name}/group.xml %{buildroot}%{fedora_preupgrade_dir}/%{name}/group.xml %files -n preupgrade-assistant-%{name} %dir %{fedora_preupgrade_dir}/%{name} %doc %{fedora_preupgrade_dir}/%{name}/*.txt %{fedora_preupgrade_dir}/%{name}/*.{py,sh} %{fedora_preupgrade_dir}/%{name}/*.xml