Sync from SUSE:ALP:Source:Standard:1.0 dpkg revision da12532e0c3254f86cedaa861d1972e9

This commit is contained in:
Adrian Schröter 2023-11-24 16:41:22 +01:00
commit 06d54f4b94
13 changed files with 5450 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>update-alternatives</package>
</multibuild>

2800
dpkg.changes Normal file

File diff suppressed because it is too large Load Diff

188
dpkg.spec Normal file
View File

@ -0,0 +1,188 @@
#
# spec file for package dpkg
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: dpkg
Version: 1.22.0
Release: 0
Summary: Debian package management system
License: GPL-2.0-or-later
Group: System/Packages
URL: https://tracker.debian.org/pkg/%{name}
Source0: https://ftp.debian.org/debian/pool/main/d/dpkg/%{name}_%{version}.tar.xz
Source3: sensible-editor
# PATCH-FIX-OPENSUSE replace debian with opensuse. replace macros. update-alternatives temp directories' path and name from dpkg* to rpm*.
Patch1: update-alternatives-suse.patch
# PATCH-FIX-SUSE: tar of Leap 42.{2,3} does not recognize --sort=name, --clamp-mtime options
Patch2: drop-tar-option.patch
Patch3: ncurses-fix.patch
Patch4: openssl.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc-c++
BuildRequires: gpg2
BuildRequires: libbz2-devel
BuildRequires: libselinux-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: perl >= 5.28.1
BuildRequires: po4a >= 0.59
BuildRequires: update-alternatives
BuildRequires: xz-devel
BuildRequires: zlib-devel
BuildRequires: perl(Date::Parse)
BuildRequires: perl(IO::String)
BuildRequires: perl(Test::Pod)
BuildRequires: perl(Test::Strict)
Requires: cpio
Requires: make
Requires: patch
Requires: update-alternatives
Requires: perl(Date::Parse)
Requires(post): coreutils
Recommends: perl(File::FcntlLock)
Provides: deb = %{version}
Obsoletes: deb < %{version}
Provides: dpkg-dev = %{version}
Provides: dpkg-doc = %{version}
Provides: dselect = %{version}
%{perl_requires}
%description
This package contains tools for working with Debian packages. It makes
it possible to create and extract Debian packages. If Alien is
installed, the packages can be converted to RPMs.
This package contains the following Debian packages: dpkg, dselect,
dpkg-doc, dpkg-dev.
%package devel
Summary: Development files for dpkg
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: libmd-devel
Provides: deb-devel = %{version}
Obsoletes: deb-devel < %{version}
%description devel
Libraries and header files for dpkg.
%lang_package
%prep
%setup -q
%patch1 -p1
%if 0%{?suse_version} == 1315
%patch2 -p1
%endif
%patch3 -p1
%patch4 -p1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
autoreconf -fvi
export CFLAGS="%{?build_cflags:%build_cflags}%{?!build_cflags:%optflags}"
%configure \
--disable-silent-rules \
--with-libselinux \
--localstatedir=%{_localstatedir}/lib \
--with-admindir=%{_localstatedir}/lib/dpkg \
--docdir=%{_docdir}/%{name}
# configure somehow does not detect architecture correctly in OBS (bnc#469337), so
# let's do an awful hack and fix it in config.h
# XXX: who knows if this works on s390? :)
%define debarch %{_arch}
%ifarch x86_64
%define debarch amd64
%endif
%ifarch %{ix86}
%define debarch i386
%endif
%ifarch ppc powerpc
%define debarch powerpc
%endif
%ifarch ppc64 powerpc64
%define debarch ppc64
%endif
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "%{debarch}"/' config.h
%make_build
%install
%make_install
# remove update-alternatives stuff (included in separate package)
rm -rf %{buildroot}%{_sysconfdir}/alternatives
rm -rf %{buildroot}%{_localstatedir}/lib/dpkg/alternatives
rm -rf %{buildroot}%{_bindir}/update-alternatives
rm -rf %{buildroot}%{_sbindir}/update-alternatives
rm -rf %{buildroot}%{_mandir}/man8/update-alternatives.8
rm -rf %{buildroot}%{_mandir}/*/man8/update-alternatives.8
rm -rf %{buildroot}%{_datadir}/polkit-1/actions/org.dpkg.pkexec.update-alternatives.policy
# locales
%find_lang %{name}
%find_lang dselect
%find_lang dpkg-dev
cat dselect.lang dpkg-dev.lang >> %{name}.lang
# extras
install -m 755 %{SOURCE3} %{buildroot}%{_bindir}
%check
%make_build check
%post
cd %{_localstatedir}/lib/dpkg
for f in diversions statoverride status ; do
[ ! -f $f ] && touch $f
done
exit 0
%files lang -f %{name}.lang
%{_mandir}/??/man*/*
%files
%license COPYING
%{_docdir}/%{name}
%{_mandir}/man*/*
%exclude %{_mandir}/man*/update-alternatives*
%dir %{_sysconfdir}/dpkg
%config(noreplace) %{_sysconfdir}/dpkg/*
%{_bindir}/*
%{_sbindir}/*
%{_libexecdir}/dpkg
%{_datadir}/dpkg
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/vendor-completions
%{_datadir}/zsh/vendor-completions/_dpkg-parsechangelog
%{_localstatedir}/lib/dpkg
%{perl_vendorlib}/Dpkg
%{perl_vendorlib}/Dpkg.pm
%{perl_vendorlib}/Dselect
%files devel
%{_datadir}/aclocal/*.m4
%{_libdir}/libdpkg.a
%{_libdir}/libdpkg.la
%{_libdir}/pkgconfig/libdpkg.pc
%{_includedir}/dpkg
%changelog

BIN
dpkg_1.22.0.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

27
drop-tar-option.patch Normal file
View File

@ -0,0 +1,27 @@
From d0bcdce521f648c0a18bea795edfcb4f5ec77388 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 3 Jan 2022 13:18:13 +0100
Subject: [PATCH 1/4] drop tar option
---
scripts/Dpkg/Source/Archive.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm
index 33c181b20..0cf545cb4 100644
--- a/scripts/Dpkg/Source/Archive.pm
+++ b/scripts/Dpkg/Source/Archive.pm
@@ -51,8 +51,8 @@ sub create {
my $mtime = $opts{source_date} // $ENV{SOURCE_DATE_EPOCH} || time;
# Call tar creation process
$spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
- $spawn_opts{exec} = [ $Dpkg::PROGTAR, '-cf', '-', '--format=gnu', '--sort=name',
- '--mtime', "\@$mtime", '--clamp-mtime', '--null',
+ $spawn_opts{exec} = [ $Dpkg::PROGTAR, '-cf', '-', '--format=gnu',
+ '--mtime', "\@$mtime", '--null',
'--numeric-owner', '--owner=0', '--group=0',
@{$opts{options}}, '-T', '-' ];
*$self->{pid} = spawn(%spawn_opts);
--
2.33.1

21
ncurses-fix.patch Normal file
View File

@ -0,0 +1,21 @@
From 9b94694e59fa442b96ddf30a33782647cdda9b70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 3 Jan 2022 13:18:35 +0100
Subject: [PATCH 2/4] ncurses fix
---
dselect/keyoverride | 1 +
1 file changed, 1 insertion(+)
diff --git a/dselect/keyoverride b/dselect/keyoverride
index 35967ffec..91a8c0cec 100644
--- a/dselect/keyoverride
+++ b/dselect/keyoverride
@@ -56,3 +56,4 @@ KEY_SRIGHT Shift Right
KEY_SPREVIOUS Shift Previous
KEY_MAX [elide]
KEY_MIN [elide]
+KEY_EVENT [elide]
--
2.33.1

97
openssl.patch Normal file
View File

@ -0,0 +1,97 @@
Index: dpkg-1.22.0/configure.ac
===================================================================
--- dpkg-1.22.0.orig/configure.ac
+++ dpkg-1.22.0/configure.ac
@@ -97,6 +97,13 @@ AC_SYS_LARGEFILE
# Checks for libraries.
DPKG_LIB_RT
DPKG_LIB_MD
+AS_IF([test "x$have_libmd" = "xno"], [
+ DPKG_LIB_OPENSSL
+ AS_IF([test "x$have_libcrypto" = "xno"], [
+ AC_MSG_FAILURE([md5 digest functions not found in libmd or openssl])
+ ])
+])
+
DPKG_LIB_Z
DPKG_LIB_BZ2
DPKG_LIB_LZMA
@@ -308,6 +315,7 @@ Configuration:
libkvm . . . . . . . . . . . : ${have_libkvm:-no}
libselinux . . . . . . . . . : $have_libselinux
libmd . . . . . . . . . . . . : $have_libmd
+ libcryto . . . . . . . . . . : $have_libcrypto
libz . . . . . . . . . . . . : $have_libz_impl
liblzma . . . . . . . . . . . : $have_liblzma
libzstd . . . . . . . . . . . : $have_libzstd
Index: dpkg-1.22.0/lib/dpkg/Makefile.am
===================================================================
--- dpkg-1.22.0.orig/lib/dpkg/Makefile.am
+++ dpkg-1.22.0/lib/dpkg/Makefile.am
@@ -50,7 +50,7 @@ EXTRA_libdpkg_la_DEPENDENCIES += \
libdpkg.sym \
# EOL
endif
-libdpkg_la_LDFLAGS += $(MD_LIBS)
+libdpkg_la_LDFLAGS += $(MD_LIBS) $(OPENSSL_LIBS)
libdpkg_la_LIBADD = \
../compat/libcompat.la \
# EOL
Index: dpkg-1.22.0/lib/dpkg/buffer.c
===================================================================
--- dpkg-1.22.0.orig/lib/dpkg/buffer.c
+++ dpkg-1.22.0/lib/dpkg/buffer.c
@@ -23,10 +23,18 @@
#include <config.h>
#include <compat.h>
+#ifdef HAVE_MD5_H
+#include <md5.h>
+#elif HAVE_OPENSSL_MD5_H
+#include <openssl/md5.h>
+#define MD5Init MD5_Init
+#define MD5Update MD5_Update
+#define MD5Final MD5_Final
+#endif
+
#include <sys/types.h>
#include <errno.h>
-#include <md5.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
Index: dpkg-1.22.0/m4/dpkg-libs.m4
===================================================================
--- dpkg-1.22.0.orig/m4/dpkg-libs.m4
+++ dpkg-1.22.0/m4/dpkg-libs.m4
@@ -20,11 +20,26 @@ AC_DEFUN([DPKG_LIB_MD], [
MD_LIBS="$ac_cv_search_MD5Init"
])
])
- AS_IF([test "x$have_libmd" = "xno"], [
- AC_MSG_FAILURE([md5 digest functions not found])
- ])
])# DPKG_LIB_MD
+# DPKG_LIB_OPENSSL
+# -----------
+# Check for the digests support in openssl library.
+AC_DEFUN([DPKG_LIB_OPENSSL], [
+ AC_ARG_VAR([OPENSSL_LIBS], [linker flags for openssl library])
+ have_libcryto="no"
+ AC_CHECK_HEADERS([openssl/md5.h], [
+ dpkg_save_libcrypto_LIBS=$LIBS
+ AC_SEARCH_LIBS([MD5_Init], [crypto])
+ LIBS=$dpkg_save_libcrypto_LIBS
+ AS_IF([test "x$ac_cv_search_MD5_Init" != "xno"], [
+ have_libcrypto="yes"
+ OPENSSL_LIBS="$ac_cv_search_MD5_Init"
+ ])
+ ])
+])# DPKG_LIB_OPENSSL
+
+
# DPKG_WITH_COMPRESS_LIB(NAME, HEADER, FUNC)
# -------------------------------------------------
# Check for availability of a compression library.

32
sensible-editor Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
ret="$?"
if [ -n "$VISUAL" ]; then
${VISUAL} "$@"
ret="$?"
if [ "$ret" -ne 126 ] && [ "$ret" -ne 127 ]; then
exit "$ret"
fi
fi
${EDITOR:-editor} "$@"
ret="$?"
if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
nano "$@"
ret="$?"
if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
nano-tiny "$@"
ret="$?"
if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
vi "$@"
ret="$?"
if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
echo "Couldn't find an editor!" 1>&2
echo "Set the \$EDITOR environment variable to your desired editor." 1>&2
exit 1
fi
fi
fi
fi
exit "$ret"

View File

@ -0,0 +1,28 @@
From 472d6aad992b2d459c31449ff7d36e20a76e4adf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 3 Jan 2022 13:19:13 +0100
Subject: [PATCH 4/4] update-alternatives-slavetomaster
---
utils/update-alternatives.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index eee59d590..41fdce430 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2035,7 +2035,10 @@ alternative_prepare_install(struct alternative *a, const char *choice)
/* Drop unused slave. */
fn = xasprintf("%s/%s", altdir, sl->name);
if (alternative_path_can_remove(sl->link))
- alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL);
+ if (strcmp(sl->link, a->master_link))
+ alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL);
+ else
+ warning("not removing %s, now master", a->master_link);
else
warning(_("not removing %s since it's not a symlink"),
sl->link);
--
2.33.1

View File

@ -0,0 +1,101 @@
From 8cad1e2d4d20f76383a424aa85ebd3bc3a51487a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 3 Jan 2022 13:19:00 +0100
Subject: [PATCH 3/4] update-alternatives-suse
---
man/update-alternatives.pod | 8 ++++----
utils/Makefile.am | 10 +++++-----
utils/t/update_alternatives.t | 4 ++--
utils/update-alternatives.c | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
Index: dpkg-1.21.8/man/update-alternatives.pod
===================================================================
--- dpkg-1.21.8.orig/man/update-alternatives.pod
+++ dpkg-1.21.8/man/update-alternatives.pod
@@ -37,7 +37,7 @@ B<update-alternatives>
B<update-alternatives>
creates, removes, maintains and displays information about the symbolic
-links comprising the Debian alternatives system.
+links comprising the SUSE alternatives system.
It is possible for several programs fulfilling the same or similar
functions to be installed on a single system at the same time.
@@ -47,7 +47,7 @@ different editor, if desired, but makes
to make a good choice for an editor to invoke if the
user has not specified a particular preference.
-Debian's alternatives system aims to solve this problem.
+SUSE's alternatives system aims to solve this problem.
A generic name in the filesystem is
shared by all files providing interchangeable functionality.
The alternatives system and the system administrator
@@ -85,8 +85,8 @@ installed, changed or removed,
B<update-alternatives>
is called to update information about that file in the alternatives system.
B<update-alternatives>
-is usually called from the following Debian package maintainer scripts,
-B<postinst>
+is usually called from the following SUSE package maintainer scripts,
+B<post>
(configure) to install the alternative and from
B<prerm> and B<postrm>
(remove) to remove the alternative.
Index: dpkg-1.21.8/utils/Makefile.am
===================================================================
--- dpkg-1.21.8.orig/utils/Makefile.am
+++ dpkg-1.21.8/utils/Makefile.am
@@ -47,8 +47,8 @@ update_alternatives_SOURCES = \
update_alternatives_CPPFLAGS = \
-DALT_TMP_EXT=\".dpkg-tmp\" \
- -DADMINDIR_ENVVAR=\"DPKG_ADMINDIR\" \
- -DINSTDIR_ENVVAR=\"DPKG_ROOT\" \
+ -DADMINDIR_ENVVAR=\"RPM_ADMINDIR\" \
+ -DINSTDIR_ENVVAR=\"RPM_ROOT\" \
$(AM_CPPFLAGS) \
# EOL
@@ -85,9 +85,9 @@ uninstall-local:
rm -f $(DESTDIR)$(sysconfdir)/alternatives/README
TEST_ENV_VARS = \
- DPKG_DATADIR=$(top_srcdir)/data \
- UA_ROOTDIR_ENVVAR=DPKG_ROOT \
- UA_ADMINDIR_ENVVAR=DPKG_ADMINDIR \
+ RPM_DATADIR=$(top_srcdir)/data \
+ UA_ROOTDIR_ENVVAR=RPM_ROOT \
+ UA_ADMINDIR_ENVVAR=RPM_ADMINDIR \
UA_ADMINDIR_DEFAULT=$(admindir) \
# EOL
Index: dpkg-1.21.8/utils/t/update_alternatives.t
===================================================================
--- dpkg-1.21.8.orig/utils/t/update_alternatives.t
+++ dpkg-1.21.8/utils/t/update_alternatives.t
@@ -32,8 +32,8 @@ my $bindir = File::Spec->rel2abs("$tmpdi
my @ua = ("$ENV{builddir}/update-alternatives", '--log', '/dev/null',
'--quiet', '--admindir', "$admindir", '--altdir', "$altdir");
-my $rootdir_envvar = $ENV{UA_ROOTDIR_ENVVAR} // 'DPKG_ROOT';
-my $admindir_envvar = $ENV{UA_ADMINDIR_ENVVAR} // 'DPKG_ADMINDIR';
+my $rootdir_envvar = $ENV{UA_ROOTDIR_ENVVAR} // 'RPM_ROOT';
+my $admindir_envvar = $ENV{UA_ADMINDIR_ENVVAR} // 'RPM_ADMINDIR';
delete $ENV{$rootdir_envvar};
delete $ENV{$admindir_envvar};
Index: dpkg-1.21.8/utils/update-alternatives.c
===================================================================
--- dpkg-1.21.8.orig/utils/update-alternatives.c
+++ dpkg-1.21.8/utils/update-alternatives.c
@@ -116,7 +116,7 @@ static int opt_force = 0;
static void
version(void)
{
- printf(_("Debian %s version %s.\n"), PROGNAME, VERSION);
+ printf(_("SUSE %s version %s.\n"), PROGNAME, VERSION);
printf("\n");
printf(_(

2023
update-alternatives.changes Normal file

File diff suppressed because it is too large Load Diff

103
update-alternatives.spec Normal file
View File

@ -0,0 +1,103 @@
#
# spec file for package update-alternatives
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: update-alternatives
Version: 1.22.0
Release: 0
Summary: Maintain symbolic links determining default commands
License: GPL-2.0-or-later
Group: System/Management
URL: https://tracker.debian.org/pkg/dpkg/
Source0: https://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_%{version}.tar.xz
Source3: sensible-editor
Patch0: update-alternatives-suse.patch
Patch1: update-alternatives-slavetomaster.patch
Patch2: openssl.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: perl >= 5.28.1
BuildRequires: pkgconfig
Provides: alternatives = %{version}
%description
update-alternatives creates, removes, maintains and displays
information about the symbolic links comprising the alternatives
system. It is possible for several programs fulfilling the same or
similar functions to be installed on a single system at the same time.
For example, many systems have several text editors installed at once.
This gives choice to the users of a system, allowing each to use a
different editor, if desired, but makes it difficult for a program to
make a good choice of editor to invoke if the user has not specified a
particular preference.
%prep
%autosetup -p1 -n dpkg-%{version}
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
autoreconf -fvi
%configure \
--disable-silent-rules \
--with-admindir=%{_localstatedir}/lib
make -C lib/compat %{?_smp_mflags}
make -C utils/ %{?_smp_mflags}
make -C man/ %{?_smp_mflags}
%install
install -d -m 0755 %{buildroot}/%{_sbindir}/
install -d -m 0755 %{buildroot}/%{_mandir}/man1/
install -d -m 0755 %{buildroot}/%{_sysconfdir}/alternatives
install -d -m 0755 %{buildroot}%{_localstatedir}/lib/alternatives
install -d -m 0755 %{buildroot}/%{_localstatedir}/log
install -pm 0755 utils/%{name} %{buildroot}/%{_sbindir}
ln -s %{name} %{buildroot}/%{_sbindir}/alternatives
install -pm 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/
%post -p <lua>
-- Migrate to new location
if posix.access('var/lib/rpm/alternatives', 'x') then
print("migrating update alternatives database to new location")
-- We proceed even if no alternatives directory exists, such situation
-- occurs in buildroot environment
new_location='%{_localstatedir}/lib/alternatives/'
for i,old_file in pairs(posix.dir("var/lib/rpm/alternatives/")) do
print(old_file.."\n")
new_file = string.gsub(old_file, "(.*/)(.*)", new_location .. "%2")
print(new_file.."\n")
os.rename(old_file, new_file)
end
posix.rmdir('var/lib/rpm/alternatives')
end
-- touch file
io.open('%{_localstatedir}/log/alternatives.log', "w"):close()
%files
%license COPYING
%dir %{_sysconfdir}/alternatives
%dir %{_localstatedir}/lib/alternatives
%{_sbindir}/alternatives
%{_sbindir}/update-alternatives
%{_mandir}/man1/update-alternatives.1%{ext_man}
%ghost %{_localstatedir}/log/alternatives.log
%changelog