Compare commits

..

1 commit

Author SHA1 Message Date
Jan Macku
6d2225324d make less a default pager to avoid error about missing /usr/bin/pager
Resolves: #2268395
2024-04-11 16:34:45 +02:00
7 changed files with 43 additions and 84 deletions

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
/units-*.tar.gz
/units-*.tar.gz.sig
/units-*/

View file

@ -1,6 +1,6 @@
From f9e58208af29f62cec46a583039110876fbd5f3e Mon Sep 17 00:00:00 2001
From 413f9f5563ec85756ff1a35276e1c4833d15713e Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Mon, 2 Mar 2026 10:23:17 +0100
Date: Thu, 11 Apr 2024 16:10:28 +0200
Subject: [PATCH] fix: make less default pager
Resolves: #2268395
@ -9,18 +9,18 @@ Resolves: #2268395
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units.c b/units.c
index 2bc1a02..fd138c5 100644
index 469a82b..8b7dd78 100644
--- a/units.c
+++ b/units.c
@@ -137,7 +137,7 @@ under the terms of the GNU General Public License."
@@ -130,7 +130,7 @@ under the terms of the GNU General Public License."
#ifdef _WIN32
# define DEFAULTPAGER "more" /* Default pager for Windows */
#else
-# define DEFAULTPAGER "/usr/bin/pager" /* Default pager for Unix */
+# define DEFAULTPAGER "/usr/bin/less" /* Default pager for Unix */
+# define DEFAULTPAGER "/usr/bin/less" /* Default pager for Unix */
#endif
#define DEFAULTLOCALE "en_US" /* Default locale */
#define MAXINCLUDE 5 /* Max depth of include files */
--
2.53.0
2.44.0

View file

@ -1,2 +1,2 @@
SHA512 (units-2.27.tar.gz.sig) = 6696986c3f40bdbef7a1a761c5314b6cce836c862aaae5926ab40da9516e5bf1d37293bcfc82bd01b92d54125b35d8e426d1b4368c7afef938b4ebf1c3723ee2
SHA512 (units-2.27.tar.gz) = 432633abb10c68910d658e7ce50b23c26100566c2e9fc377e963f0d86d60b5366e12519c33b947805d447b7cbbb891578a8e1f7f2120aa8f95c3e9fbab60e881
SHA512 (units-2.22.tar.gz) = 4ed62ce6ee861b817916bc925713794187fa63eb5320e8e720558ac1d5bd48d5f1c9500e1d1f90414a6f4410f1ab806928c2a655adf4cd8b51829cd73397ab2f
SHA512 (units-2.22.tar.gz.sig) = 50a94263631d05642e56f42805711d56a54c93c73a143cdf7c18087722b5f1fff46bb8ab56abe3ca984738d8301be75ecfd2f1f9ea1917976353357a0aaad742

26
units-configure-c99.patch Normal file
View file

@ -0,0 +1,26 @@
diff --git a/configure b/configure
index 22c75a6222b06f68..43461d54e59f1568 100755
--- a/configure
+++ b/configure
@@ -3881,7 +3881,7 @@ else
int
main ()
{
-wchar_t *out;char *in;char *res;
+wchar_t *out;char *in;const char *res;
res=setlocale(LC_CTYPE,"");res=in;
mbsrtowcs(out, &res, 2, NULL);
wcswidth(out,2);
diff --git a/configure.ac b/configure.ac
index c728d5c15d16ab2e..cd39f96e39f7d587 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,7 +121,7 @@ AC_CACHE_CHECK([for locale and UTF-8 support], am_cv_utf8,
#include <wchar.h>
#include <locale.h>
#include <langinfo.h>
-], [wchar_t *out;char *in;char *res;
+], [wchar_t *out;char *in;const char *res;
res=setlocale(LC_CTYPE,"");res=in;
mbsrtowcs(out, &res, 2, NULL);
wcswidth(out,2);],

View file

@ -1,16 +1,14 @@
Summary: A utility for converting amounts from one unit to another
Name: units
Version: 2.27
Release: 3%{?dist}
Version: 2.22
Release: 9%{?dist}
Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz
Source1: units.tmpfiles.conf
URL: https://www.gnu.org/software/units/units.html
License: GPL-3.0-or-later
Requires: less
BuildRequires: bison
BuildRequires: systemd-rpm-macros
BuildRequires: gcc
BuildRequires: make
BuildRequires: ncurses-devel
@ -18,7 +16,8 @@ BuildRequires: python3-devel
BuildRequires: readline-devel
# do not update currency.units from network during build
Patch100: 0100-units-2.22-no-network.patch
Patch1: 0001-units-2.22-no-network.patch
Patch2: units-configure-c99.patch
# make less a default pager to avoid error about missing /usr/bin/pager
Patch101: 0101-fix-make-less-default-pager.patch
@ -33,44 +32,20 @@ well as conversions such as Fahrenheit to Celsius.
%autosetup -p1
%build
# Use C17 standard to avoid compilation errors
# We will revert this change once the upstream adopts the latest C standard
%configure CFLAGS="$RPM_OPT_FLAGS -std=c17"
%configure
%make_build
%install
%make_install
# Copy dynamic files to defaults directory as templates for tmpfiles.d
mkdir -p %{buildroot}%{_datadir}/units/defaults
for f in currency cpi metal_prices crypto; do
cp -p %{buildroot}%{_sharedstatedir}/units/${f}.units %{buildroot}%{_datadir}/units/defaults/
done
# Remove /var/lib/units from buildroot - now managed by tmpfiles.d
rm -rf %{buildroot}%{_sharedstatedir}/units
# Replace absolute symlinks by relative symlinks
for f in currency cpi metal_prices crypto; do
ln -fsv ../../../var/lib/units/${f}.units %{buildroot}%{_datadir}/units/${f}.units
done
# Install tmpfiles.d configuration for Image Mode support
install -m0644 -D %{SOURCE1} %{buildroot}%{_tmpfilesdir}/units.conf
# replace an absolute symlink by a relative symlink
ln -fsv ../../..%{_sharedstatedir}/units/currency.units %{buildroot}%{_datadir}/units
gzip %{buildroot}%{_infodir}/units.info
# provide a man page for units_cur as a symlink to units.1
ln -s units.1 %{buildroot}%{_mandir}/man1/units_cur.1
%post
%tmpfiles_create units.conf
%postun
if [ $1 -eq 0 ]; then
systemd-tmpfiles --purge %{_tmpfilesdir}/units.conf 2>/dev/null || :
fi
%check
make check
@ -79,50 +54,14 @@ make check
%{_bindir}/units
%{_bindir}/units_cur
%{_datadir}/units
%{_tmpfilesdir}/units.conf
%{_sharedstatedir}/units
%{_infodir}/*
%{_mandir}/man1/*
%changelog
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.27-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Tue Apr 21 2026 Jan Macku <jamacku@redhat.com> - 2.27-2
- fix units compatibility with Image Mode
* Wed Apr 08 2026 Jan Macku <jamacku@redhat.com> - 2.27-1
- new upstream release
* Mon Mar 02 2026 Jan Macku <jamacku@redhat.com> - 2.26-1
- new upstream release
* Mon Jan 19 2026 Jan Macku <jamacku@redhat.com> - 2.25-1
- new upstream release
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.24-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.24-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Feb 20 2025 Jan Macku <jamacku@redhat.com> - 2.24-3
- Use C17 standard to avoid compilation errors (#2341484)
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.24-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Fri Nov 29 2024 Jan Macku <jamacku@redhat.com> - 2.24-1
- new upstream release
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.23-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Thu Apr 11 2024 Jan Macku <jamacku@redhat.com> - 2.23-2
* Thu Apr 11 2024 Jan Macku <jamacku@redhat.com> - 2.22-9
- fix make less the default pager (#2268395)
* Mon Feb 19 2024 Jan Macku <jamacku@redhat.com> - 2.23-1
- new upstream release
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.22-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

View file

@ -1,5 +0,0 @@
d /var/lib/units 0755 root root - -
C /var/lib/units/currency.units 0644 root root - /usr/share/units/defaults/currency.units
C /var/lib/units/cpi.units 0644 root root - /usr/share/units/defaults/cpi.units
C /var/lib/units/metal_prices.units 0644 root root - /usr/share/units/defaults/metal_prices.units
C /var/lib/units/crypto.units 0644 root root - /usr/share/units/defaults/crypto.units