Commit 30f053d8 authored by Jakub Ružička's avatar Jakub Ružička
Browse files

examples: add minimal templates example

A simple project demonstrating apkg templating features.
parent 32f781cf
# apkg example project: templates
This minimal project demonstrates apkg templating features.
Looking at 'package templates' section of
apkg status
as well as
ls -la distro/pkg
should be self-explanatory.
Custom templates are defined in distro/config/apkg.toml
## tests
This project is used in apkg self tests:
* tests/self/test_templates.py
[project]
name = "templates"
make_archive_script = "distro/scripts/make-archive.sh"
[apkg]
compat = 1
[[distro.aliases]]
name = "deb-old"
distro = ["debian <= 9", "ubuntu < 20.04"]
[[distro.aliases]]
name = "el-8"
distro = ["rocky == 8", "centos == 8", "rhel == 8"]
deb
\ No newline at end of file
apkg-example-templates ({{ version }}-{{ release }}~{{ distro.tiny }}) unstable; urgency=medium
* new upstream version {{ version }}
* distro: {{ distro }} / {{ distro.idver }} / {{ distro.tiny }}
{%- if distro.match('debian >= 11', 'ubuntu > 20.04') %}
* new Debian-based
{%- elif distro.match('deb-old') %}
* old Debian-based (distro alias)
{%- elif distro.match('linuxmint') %}
* only on Linux Mint
{%- else %}
* other Debian-based
{%- endif %}
-- Jakub Ružička <jakub.ruzicka@nic.cz> {{ now }}
Source: apkg-example-templates
Priority: optional
Maintainer: Jakub Ružička <jakub.ruzicka@nic.cz>
Homepage: https://gitlab.nic.cz/packaging/apkg
Package: apkg-example-templates
Architecture: all
Description: minimal example of apkg templating system
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: apkg
Source: https://gitlab.nic.cz/packaging/apkg
Files: *
Copyright: (c) 2020-2021, Jakub Ružička <jakub.ruzicka@nic.cz>
License: GPL-3+
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU General Public License
version 3 can be found in the file `/usr/share/common-licenses/GPL-3'.
deb
\ No newline at end of file
rpm
\ No newline at end of file
rpm
\ No newline at end of file
Name: apkg-example-templates
Version: {{ version }}
Release: {{ release }}%{?dist}
Summary: minimal example of apkg templating system
License: GPL 3.0
Source0: %{name}-v%{version}.tar.gz
BuildArch: noarch
%description
This is a minimal example of apkg templating features.
%prep
%autosetup -n %{name}-v%{version} -S git
%files
%doc README.md
%changelog
* {{ now }} Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
- new upstream version {{ version }}
- distro: {{ distro }} / {{ distro.idver }} / {{ distro.tiny }}
{%- if distro.match('fedora') %}
- Fedora-specific block
{%- elif distro.match('centos <= 7', 'rhel <= 7') %}
- only on EL 7 and older
{%- elif distro.match('el-8') %}
- only on EL 8 (distro alias)
{%- endif %}
deb
\ No newline at end of file
deb
\ No newline at end of file
#!/bin/bash
# create archive containing only README.md in a directory
set -e
VERSION=1.0
OUTPATH=pkg/archives/dev
NAMEVER=apkg-example-templates-v$VERSION
TOPDIR=templates
ARCHIVE=$NAMEVER.tar.gz
ARPATH=$OUTPATH/$ARCHIVE
mkdir -p "$OUTPATH"
mkdir -p "$NAMEVER"
cp README.md "$NAMEVER/"
tar -czvf "$ARPATH" "$NAMEVER"
rm -rf "$NAMEVER"
# apkg expects stdout to list archive files
echo $ARPATH
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment