* Mon Dec 02 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.20180513-1.sme

- Initial code for SME Server
This commit is contained in:
Jean-Philippe Pialasse 2024-12-03 14:24:25 -05:00
parent d0022253cc
commit 9f76610f04
5 changed files with 201 additions and 19 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.rpm

0
additional/.gitignore vendored Normal file
View File

151
additional/dpkg-parsechangelog Executable file
View File

@ -0,0 +1,151 @@
#!/usr/bin/perl
#
# dpkg-parsechangelog
#
# Copyright © 1996 Ian Jackson
# Copyright © 2001 Wichert Akkerman
# Copyright © 2006-2012 Guillem Jover <guillem@debian.org>
#
# 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 2 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/>.
use strict;
use warnings;
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::Getopt;
use Dpkg::ErrorHandling;
use Dpkg::Changelog::Parse;
textdomain('dpkg-dev');
my %options;
my $fieldname;
sub version {
printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
printf g_('
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
');
}
sub usage {
printf g_(
'Usage: %s [<option>...]')
. "\n\n" . g_(
'Options:
-l, --file <changelog-file>
get per-version info from this file.
-F <changelog-format> force changelog format.
-S, --show-field <field> show the values for <field>.
-?, --help show this help message.
--version show the version.')
. "\n\n" . g_(
"Parser options:
--format <output-format>
set output format (defaults to 'dpkg').
--reverse include all changes in reverse order.
--all include all changes.
-s, --since <version> include all changes later than <version>.
-v <version> ditto.
-u, --until <version> include all changes earlier than <version>.
-f, --from <version> include all changes equal or later than <version>.
-t, --to <version> include all changes up to or equal than <version>.
-c, --count <number> include <number> entries from the top (or tail
if <number> is lower than 0).
-n <number> ditto.
-o, --offset <number> change starting point for --count, counted from
the top (or tail if <number> is lower than 0).
"), $Dpkg::PROGNAME;
}
@ARGV = normalize_options(args => \@ARGV, delim => '--');
while (@ARGV) {
last unless $ARGV[0] =~ m/^-/;
my $arg = shift;
if ($arg eq '--') {
last;
} elsif ($arg eq '-L') {
warning(g_('-L is obsolete; it is without effect'));
} elsif ($arg eq '-F') {
$options{changelogformat} = shift;
usageerr(g_('bad changelog format name'))
unless length $options{changelogformat} and
$options{changelogformat} =~ m/^([0-9a-z]+)$/;
} elsif ($arg eq '--format') {
$options{format} = shift;
} elsif ($arg eq '--reverse') {
$options{reverse} = 1;
} elsif ($arg eq '-l' or $arg eq '--file') {
$options{file} = shift;
usageerr(g_('missing changelog filename'))
unless length $options{file};
} elsif ($arg eq '-S' or $arg eq '--show-field') {
$fieldname = shift;
} elsif ($arg eq '-c' or $arg eq '--count' or $arg eq '-n') {
$options{count} = shift;
} elsif ($arg eq '-f' or $arg eq '--from') {
$options{from} = shift;
} elsif ($arg eq '-o' or $arg eq '--offset') {
$options{offset} = shift;
} elsif ($arg eq '-s' or $arg eq '--since' or $arg eq '-v') {
$options{since} = shift;
} elsif ($arg eq '-t' or $arg eq '--to') {
$options{to} = shift;
} elsif ($arg eq '-u' or $arg eq '--until') {
## no critic (ControlStructures::ProhibitUntilBlocks)
$options{until} = shift;
## use critic
} elsif ($arg eq '--all') {
$options{all} = undef;
} elsif ($arg eq '-?' or $arg eq '--help') {
usage(); exit(0);
} elsif ($arg eq '--version') {
version(); exit(0);
} else {
usageerr(g_("unknown option '%s'"), $arg);
}
}
usageerr(g_('takes no non-option arguments')) if @ARGV;
my $count = 0;
my @fields = changelog_parse(%options);
foreach my $f (@fields) {
print "\n" if $count++;
if ($fieldname) {
next if not exists $f->{$fieldname};
my ($first_line, @lines) = split /\n/, $f->{$fieldname};
my $v = '';
$v .= $first_line if length $first_line;
$v .= "\n";
foreach (@lines) {
s/\s+$//;
if (length == 0 or /^\.+$/) {
$v .= ".$_\n";
} else {
$v .= "$_\n";
}
}
print $v;
} else {
print $f->output();
}
}

27
additional/pkg-info.mk Normal file
View File

@ -0,0 +1,27 @@
# This Makefile fragment (since dpkg 1.16.1) defines the following package
# information variables:
#
# DEB_SOURCE: source package name.
# DEB_VERSION: package's full version (epoch + upstream vers. + revision).
# DEB_VERSION_EPOCH_UPSTREAM: package's version without the Debian revision.
# DEB_VERSION_UPSTREAM_REVISION: package's version without the Debian epoch.
# DEB_VERSION_UPSTREAM: package's upstream version.
# DEB_DISTRIBUTION: distribution(s) listed in the current debian/changelog
# entry.
#
# SOURCE_DATE_EPOCH: source release date as seconds since the epoch, as
# specified by <https://reproducible-builds.org/specs/source-date-epoch/>
# (since dpkg 1.18.8).
dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
DEB_SOURCE = $(call dpkg_late_eval,DEB_SOURCE,dpkg-parsechangelog -SSource)
DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog -SVersion)
DEB_VERSION_EPOCH_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_EPOCH_UPSTREAM,echo '$(DEB_VERSION)' | sed -e 's/-[^-]*$$//')
DEB_VERSION_UPSTREAM_REVISION = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM_REVISION,echo '$(DEB_VERSION)' | sed -e 's/^[0-9]*://')
DEB_VERSION_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM,echo '$(DEB_VERSION_EPOCH_UPSTREAM)' | sed -e 's/^[0-9]*://')
DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution)
SOURCE_DATE_EPOCH ?= $(call dpkg_late_eval,SOURCE_DATE_EPOCH,dpkg-parsechangelog -STimestamp)
export SOURCE_DATE_EPOCH

View File

@ -1,31 +1,46 @@
%define name ftpsync
%define version 1.0.20180513
%define version 1.20180513
%define release 1
Summary: This is what ftpsync does.
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Source: archvsync-20180513.tar.gz
# needed to make build
Source1: pkg-info.mk
Source2: dpkg-parsechangelog
License: GNU GPL version 2
Group: SMEserver/addon
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
BuildArchitectures: noarch
BuildRequires: smeserver-devtools
BuildRequires: e-smith-devtools
BuildRequires: dpkg-perl
BuildRequires: pandoc
Requires: smeserver-release >= 11.0
Requires: rsync
AutoReqProv: no
%description
${REPO_DESCRIPTION}
ftpsync is the preferred tool for maintaining a Debian mirror. It
tries to make updates as smooth as possible, without the clients
experiencing half updated mirrors. It supports partial mirrors by
architecture.
%changelog
* Mon Dec 02 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.0.20180513-1.sme
* Mon Dec 02 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.20180513-1.sme
- Initial code for SME Server
%prep
%setup -q -n archvsync-20180513
sed -i -e 's|dpkg-parsechangelog|./dpkg-parsechangelog|' %{SOURCE1}
cp %{SOURCE1} .
chmod +x %{SOURCE2}
cp %{SOURCE2} .
sed -i -e 's|include /usr/share/dpkg/pkg-info.mk|include pkg-info.mk|' Makefile
sed -i -e 's|CONFDIRS=(|CONFDIRS=(~/etc/ |' bin/include-install
make all
%build
@ -33,27 +48,15 @@ ${REPO_DESCRIPTION}
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/%{name}/examples
mkdir -p $RPM_BUILD_ROOT/usr/share/man/{man1,man5}
mandir=$RPM_BUILD_ROOT/usr/share/man
man1dir=${mandir}/man1
man5dir=${mandir}/man5
cp doc/ftpsync.1.md ${man1dir}/ftpsync.1
cp doc/ftpsync-cron.1.md ${man1dir}/ftpsync-cron.1
cp doc/rsync-ssl-tunnel.1.md ${man1dir}/rsync-ssl-tunnel.1
cp doc/runmirrors.1.md ${man1dir}/runmirrors.1
cp doc/ftpsync.conf.5.md ${man5dir}/ftpsync.conf.5
cp doc/runmirrors.conf.5.md ${man5dir}/runmirrors.conf.5
cp doc/runmirrors.mirror.5.md ${man5dir}/runmirrors.mirror.5
cp -a etc/* $RPM_BUILD_ROOT/usr/share/doc/%{name}/examples/
cp -a bin $RPM_BUILD_ROOT/usr/
mkdir -p $RPM_BUILD_ROOT/etc/ftpsync
export DESTDIR=$RPM_BUILD_ROOT
make install
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|sed -e 's/\.1/.1.gz/'\
|sed -e 's/\.5/.5.gz/'\
> %{name}-%{version}-filelist
#echo "%doc COPYING" >> %{name}-%{version}-filelist
#--dir <dir> 'attr(755,user,grp)' \
#--file <file> 'attr(755,root,root)' \
%clean
cd ..