diff --git a/.gitignore b/.gitignore index b916051..017b085 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -/units-*.tar.gz -/units-*.tar.gz.sig -/units-*/ +units-1.88.tar.gz diff --git a/0100-units-2.22-no-network.patch b/0100-units-2.22-no-network.patch deleted file mode 100644 index 6c85a81..0000000 --- a/0100-units-2.22-no-network.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f18e95585de3d6f94c3b64af7bcc8793063223d3 Mon Sep 17 00:00:00 2001 -From: Kamil Dudka -Date: Wed, 8 Aug 2018 18:08:34 +0200 -Subject: [PATCH] Makefile.in: do not update currency.units from network - -Builds of packages are supposed to be reproducible. ---- - Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index 79baf1d..2b71aeb 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -266,7 +266,7 @@ units.txt: units.1 - - doc: units.dvi units.info units.txt units.pdf UnitsMKS.pdf UnitsWin.pdf - --check: all currency-update-check -+check: all - @echo Checking units - @./units -f $(srcdir)/definitions.units \ - '(((square(kiloinch)+2.84m2) /0.5) meters^2)^(1|4)' m \ --- -2.37.2 - diff --git a/0101-fix-make-less-default-pager.patch b/0101-fix-make-less-default-pager.patch deleted file mode 100644 index 6f2599f..0000000 --- a/0101-fix-make-less-default-pager.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f9e58208af29f62cec46a583039110876fbd5f3e Mon Sep 17 00:00:00 2001 -From: Jan Macku -Date: Mon, 2 Mar 2026 10:23:17 +0100 -Subject: [PATCH] fix: make less default pager - -Resolves: #2268395 ---- - units.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/units.c b/units.c -index 2bc1a02..fd138c5 100644 ---- a/units.c -+++ b/units.c -@@ -137,7 +137,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 */ - #endif - #define DEFAULTLOCALE "en_US" /* Default locale */ - #define MAXINCLUDE 5 /* Max depth of include files */ --- -2.53.0 - diff --git a/sources b/sources index c90157e..e86a38c 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -SHA512 (units-2.27.tar.gz.sig) = 6696986c3f40bdbef7a1a761c5314b6cce836c862aaae5926ab40da9516e5bf1d37293bcfc82bd01b92d54125b35d8e426d1b4368c7afef938b4ebf1c3723ee2 -SHA512 (units-2.27.tar.gz) = 432633abb10c68910d658e7ce50b23c26100566c2e9fc377e963f0d86d60b5366e12519c33b947805d447b7cbbb891578a8e1f7f2120aa8f95c3e9fbab60e881 +9b2ee6e7e0e9c62741944cf33fc8a656 units-1.88.tar.gz diff --git a/units-1.88-coverity.patch b/units-1.88-coverity.patch new file mode 100644 index 0000000..cc46992 --- /dev/null +++ b/units-1.88-coverity.patch @@ -0,0 +1,97 @@ +From 149121fe597e9d3ee818d6d1d0facf9175d6674d Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Tue, 15 Nov 2011 19:24:00 +0100 +Subject: [PATCH 1/2] units - fix defects found by Coverity + +--- + units.c | 18 +++++++++++------- + 1 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/units.c b/units.c +index cdda76a..c4230c9 100644 +--- a/units.c ++++ b/units.c +@@ -383,7 +383,7 @@ readunits(char *file, FILE *errfile, + struct prefixlist *pfxptr; + struct unitlist *uptr; + FILE *unitfile; +- char *line, *lineptr, *unitdef, *unitname, *permfile; ++ char *line = 0, *lineptr, *unitdef, *unitname, *permfile; + int len, linenum, linebufsize, goterr; + unsigned hashval, pval; + int locunitcount, locprefixcount, locfunccount; +@@ -399,12 +399,13 @@ readunits(char *file, FILE *errfile, + + growbuffer(&line,&linebufsize); + +- permfile = dupstr(file); /* This is a permanent copy to +- reference in the database. +- It is never freed. */ + unitfile = fopen(file, "rt"); + if (!unitfile) + return E_FILE; ++ ++ permfile = dupstr(file); /* This is a permanent copy to ++ reference in the database. ++ It is never freed. */ + while (!feof(unitfile)) { + if (!fgetslong(&line, &linebufsize, unitfile, &linenum)) + break; +@@ -471,8 +472,10 @@ readunits(char *file, FILE *errfile, + } + readerr = readunits(includefile, errfile, unitcount, prefixcount, + funccount, depth+1); +- if (readerr == E_MEMORY) ++ if (readerr == E_MEMORY) { ++ fclose(unitfile); + return readerr; ++ } + if (readerr == E_FILE) { + if (errfile) + fprintf(errfile, "%s: unable to open included file '%s' at line %d of file '%s\n", progname, includefile, linenum, file); +@@ -1381,7 +1384,7 @@ subunitroot(int n,char *in[], char *out[]) + char **ptr,**current; + int count; + +- for(current = in;*current && *current==NULLUNIT;current++); ++ for(current = in;*current==NULLUNIT;current++) + count = 0; + for(ptr=in;*ptr;ptr++){ + if (*ptr==NULLUNIT) continue; +@@ -2618,7 +2621,7 @@ Typing 'search text' will show units whose names contain 'text'.\n\n", + int + main(int argc, char **argv) + { +- struct unittype have, want; ++ static struct unittype have, want; + char *havestr=0, *wantstr=0; + struct func *funcval; + int havestrsize=0; /* Only used if READLINE is undefined */ +-- +1.7.1 + + +From 30ede89a0147189cd815afc58b1d82545b881bcd Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Wed, 16 Nov 2011 13:37:09 +0100 +Subject: [PATCH 2/2] units - use an annotation to suppress a false positive of Coverity + +--- + units.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/units.c b/units.c +index c4230c9..28555a4 100644 +--- a/units.c ++++ b/units.c +@@ -403,6 +403,7 @@ readunits(char *file, FILE *errfile, + if (!unitfile) + return E_FILE; + ++ /* coverity[alloc_fn] */ + permfile = dupstr(file); /* This is a permanent copy to + reference in the database. + It is never freed. */ +-- +1.7.1 + diff --git a/units-1.88-man-typo.patch b/units-1.88-man-typo.patch new file mode 100644 index 0000000..1e49b16 --- /dev/null +++ b/units-1.88-man-typo.patch @@ -0,0 +1,16 @@ + units.man | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/units.man b/units.man +index 6199904..e202da4 100644 +--- a/units.man ++++ b/units.man +@@ -446,7 +446,7 @@ The temperature differences are done using units starting with + Think of `tempF(x)' not as a function but as a notation which + indicates that `x' should have units of `tempF' attached to + it. See \fINonlinear units\fR. The first conversion shows that if it's 45 +-degrees Fahrehneit outside it's 7.2 degrees Celsius. The second ++degrees Fahrenheit outside it's 7.2 degrees Celsius. The second + conversions indicates that a change of 45 degrees Fahrenheit corresponds + to a change of 25 degrees Celsius. + .PP diff --git a/units-1.88.tar.gz.sig b/units-1.88.tar.gz.sig new file mode 100644 index 0000000..2a1898b Binary files /dev/null and b/units-1.88.tar.gz.sig differ diff --git a/units.spec b/units.spec index 14f864d..d17ae75 100644 --- a/units.spec +++ b/units.spec @@ -1,27 +1,19 @@ Summary: A utility for converting amounts from one unit to another Name: units -Version: 2.27 -Release: 3%{?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 - +Version: 1.88 +Release: 6%{?dist} +Source: ftp://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz +URL: http://www.gnu.org/software/units/units.html +License: GPLv3+ +Group: Applications/Engineering +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info BuildRequires: bison -BuildRequires: systemd-rpm-macros -BuildRequires: gcc -BuildRequires: make BuildRequires: ncurses-devel -BuildRequires: python3-devel BuildRequires: readline-devel - -# do not update currency.units from network during build -Patch100: 0100-units-2.22-no-network.patch - -# make less a default pager to avoid error about missing /usr/bin/pager -Patch101: 0101-fix-make-less-default-pager.patch +Patch1: units-1.88-man-typo.patch +Patch2: units-1.88-coverity.patch %description Units converts an amount from one unit to another, or tells you what @@ -30,276 +22,43 @@ another. The units program can handle multiplicative scale changes as well as conversions such as Fahrenheit to Celsius. %prep -%autosetup -p1 +%setup -q +%patch1 -p1 +%patch2 -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" -%make_build +%configure +make %{?_smp_mflags} %install -%make_install +rm -rf $RPM_BUILD_ROOT -# 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 +make install DESTDIR=$RPM_BUILD_ROOT -# Remove /var/lib/units from buildroot - now managed by tmpfiles.d -rm -rf %{buildroot}%{_sharedstatedir}/units +gzip $RPM_BUILD_ROOT%{_infodir}/units.info -# 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 - -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 +%clean +rm -rf $RPM_BUILD_ROOT %post -%tmpfiles_create units.conf - -%postun -if [ $1 -eq 0 ]; then - systemd-tmpfiles --purge %{_tmpfilesdir}/units.conf 2>/dev/null || : +if [ -e %{_infodir}/units.info.gz ]; then + /sbin/install-info %{_infodir}/units.info.gz %{_infodir}/dir || : fi -%check -make check +%preun +if [ $1 = 0 -a -e %{_infodir}/units.info.gz ]; then + /sbin/install-info --delete %{_infodir}/units.info.gz %{_infodir}/dir || : +fi %files -%doc COPYING NEWS README -%{_bindir}/units -%{_bindir}/units_cur -%{_datadir}/units -%{_tmpfilesdir}/units.conf +%defattr(-,root,root,-) +%doc ChangeLog COPYING NEWS README +%{_bindir}/* +%{_datadir}/units.dat %{_infodir}/* %{_mandir}/man1/* %changelog -* Fri Jul 17 2026 Fedora Release Engineering - 2.27-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild - -* Tue Apr 21 2026 Jan Macku - 2.27-2 -- fix units compatibility with Image Mode - -* Wed Apr 08 2026 Jan Macku - 2.27-1 -- new upstream release - -* Mon Mar 02 2026 Jan Macku - 2.26-1 -- new upstream release - -* Mon Jan 19 2026 Jan Macku - 2.25-1 -- new upstream release - -* Sat Jan 17 2026 Fedora Release Engineering - 2.24-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild - -* Fri Jul 25 2025 Fedora Release Engineering - 2.24-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Thu Feb 20 2025 Jan Macku - 2.24-3 -- Use C17 standard to avoid compilation errors (#2341484) - -* Sun Jan 19 2025 Fedora Release Engineering - 2.24-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Fri Nov 29 2024 Jan Macku - 2.24-1 -- new upstream release - -* Sat Jul 20 2024 Fedora Release Engineering - 2.23-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Thu Apr 11 2024 Jan Macku - 2.23-2 -- fix make less the default pager (#2268395) - -* Mon Feb 19 2024 Jan Macku - 2.23-1 -- new upstream release - -* Sat Jan 27 2024 Fedora Release Engineering - 2.22-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Thu Nov 30 2023 Florian Weimer - 2.22-7 -- C compatibility fix for the configure script (#2252276) - -* Sat Jul 22 2023 Fedora Release Engineering - 2.22-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Thu Apr 13 2023 Lukáš Zaoral - 2.22-5 -- migrate to SPDX license format - -* Sat Jan 21 2023 Fedora Release Engineering - 2.22-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Tue Sep 06 2022 Kamil Dudka - 2.22-3 -- remove a build system tweak related to Python 3 no longer needed - -* Tue Sep 06 2022 Kamil Dudka - 2.22-2 -- replace an absolute symlink by a relative symlink -- use %%make_build and %%make_install RPM macros - -* Tue Sep 06 2022 Kamil Dudka - 2.22-1 -- new upstream release - -* Sat Jul 23 2022 Fedora Release Engineering - 2.21-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Sat Jan 22 2022 Fedora Release Engineering - 2.21-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Fri Jul 23 2021 Fedora Release Engineering - 2.21-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Wed Jan 27 2021 Fedora Release Engineering - 2.21-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Nov 16 2020 Kamil Dudka - 2.21-1 -- new upstream release - -* Thu Oct 01 2020 Kamil Dudka - 2.20-1 -- new upstream release - -* Sat Aug 01 2020 Fedora Release Engineering - 2.19-5 -- Second attempt - Rebuilt for - https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Wed Jul 29 2020 Fedora Release Engineering - 2.19-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Fri Jan 31 2020 Fedora Release Engineering - 2.19-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Sat Jul 27 2019 Fedora Release Engineering - 2.19-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Sat Jun 01 2019 Kamil Dudka - 2.19-1 -- new upstream release - -* Sun Feb 17 2019 Igor Gnatenko - 2.18-3 -- Rebuild for readline 8.0 - -* Sun Feb 03 2019 Fedora Release Engineering - 2.18-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Mon Oct 29 2018 Kamil Dudka - 2.18-1 -- new upstream release - -* Wed Aug 08 2018 Kamil Dudka - 2.17-5 -- do not update currency.units from network during build -- units_cur: validate rate data from server (#1598913) - -* Sat Jul 14 2018 Fedora Release Engineering - 2.17-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Jul 04 2018 Kamil Dudka - 2.17-3 -- use %%{__python3} as the python interpreter - -* Wed Jun 27 2018 Kamil Dudka - 2.17-2 -- drop the dependency on python3-unidecode no longer used by units_cur - -* Tue Jun 26 2018 Kamil Dudka - 2.17-1 -- new upstream release - -* Mon May 28 2018 Kamil Dudka - 2.16-5 -- make units_cur work again (#1574835) - -* Mon Feb 19 2018 Kamil Dudka - 2.16-4 -- add explicit BR for the gcc compiler - -* Fri Feb 09 2018 Fedora Release Engineering - 2.16-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Mon Feb 05 2018 Kamil Dudka - 2.16-2 -- make units_cur use Python 3 - -* Wed Nov 01 2017 Kamil Dudka - 2.16-1 -- new upstream release - -* Tue Oct 31 2017 Kamil Dudka - 2.15-1 -- new upstream release - -* Thu Aug 03 2017 Fedora Release Engineering - 2.14-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Thu Jul 27 2017 Fedora Release Engineering - 2.14-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Thu Mar 09 2017 Kamil Dudka - 2.14-1 -- new upstream release - -* Sat Feb 11 2017 Fedora Release Engineering - 2.13-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Thu Jan 12 2017 Igor Gnatenko - 2.13-2 -- Rebuild for readline 7.x - -* Tue Jun 21 2016 Kamil Dudka - 2.13-1 -- new upstream release - -* Fri Feb 05 2016 Fedora Release Engineering - 2.12-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Thu Oct 15 2015 Kamil Dudka - 2.12-1 -- new upstream release - -* Fri Jun 19 2015 Fedora Release Engineering - 2.11-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Mon Oct 13 2014 Kamil Dudka - 2.11-4 -- add BR for python in order to get the units_cur script installed (#1151997) - -* Mon Aug 18 2014 Fedora Release Engineering - 2.11-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - -* Sun Jun 08 2014 Fedora Release Engineering - 2.11-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Thu Apr 03 2014 Kamil Dudka - 2.11-1 -- new upstream release - -* Mon Mar 31 2014 Kamil Dudka - 2.10-2 -- require python-unidecode used by the units_cur script -- improve utf-8 support in the units_cur script - -* Thu Mar 27 2014 Kamil Dudka - 2.10-1 -- new upstream release - -* Sun Aug 04 2013 Fedora Release Engineering - 2.02-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Mon Jul 15 2013 Kamil Dudka - 2.02-1 -- new upstream release - -* Mon May 20 2013 Kamil Dudka - 2.01-3 -- provide a man page for units_cur as a symlink to units.1 -- mention the --check-verbose option in units.1 man page - -* Fri Feb 15 2013 Fedora Release Engineering - 2.01-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Thu Oct 25 2012 Kamil Dudka - 2.01-1 -- new upstream release - -* Fri Sep 07 2012 Kamil Dudka - 2.00-4 -- run the upstream smoke-test during build - -* Tue Aug 28 2012 Kamil Dudka - 2.00-3 -- fix specfile issues reported by the fedora-review script - -* Sun Jul 22 2012 Fedora Release Engineering - 2.00-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Mon Jul 02 2012 Kamil Dudka - 2.00-1 -- new upstream release, dropped applied patches -- patch Makefile.in to respect $(DESTDIR) - * Sat Jan 14 2012 Fedora Release Engineering - 1.88-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/units.tmpfiles.conf b/units.tmpfiles.conf deleted file mode 100644 index f32b17a..0000000 --- a/units.tmpfiles.conf +++ /dev/null @@ -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