commit ac848d256539e6060683aa023ab41f7d81051236 Author: CentOS Sources Date: Mon Jul 12 02:17:52 2021 +0000 import units-2.17-5.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e40cc82 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/units-2.17.tar.gz diff --git a/.units.metadata b/.units.metadata new file mode 100644 index 0000000..6d20f1e --- /dev/null +++ b/.units.metadata @@ -0,0 +1 @@ +d00211095d2433f7dea08c323e6fbd0a65e867dd SOURCES/units-2.17.tar.gz diff --git a/SOURCES/0001-units-2.17-units_cur-validate.patch b/SOURCES/0001-units-2.17-units_cur-validate.patch new file mode 100644 index 0000000..237903e --- /dev/null +++ b/SOURCES/0001-units-2.17-units_cur-validate.patch @@ -0,0 +1,152 @@ +From 9d1129f41f193a47d6791f44f14abe9479999266 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Wed, 8 Aug 2018 17:42:17 +0200 +Subject: [PATCH] units_cur: validate rate data from server + +--- + units_cur | 72 ++++++++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 55 insertions(+), 17 deletions(-) + +diff --git a/units_cur b/units_cur +index 00281d8..d625570 100755 +--- a/units_cur ++++ b/units_cur +@@ -28,8 +28,12 @@ from __future__ import absolute_import, division, print_function + # + # + +-version = '4.2' ++version = '4.3' + ++# Version 4.3: 20 July 2018 ++# ++# Validate rate data from server ++# + # Version 4.2: 18 April 2018 + # + # Handle case of empty/malformed entry returned from the server +@@ -55,6 +59,10 @@ from sys import exit, stderr, stdout + + outfile_name = 'currency.units' + ++# valid metals ++ ++validmetals = ['silver','gold','platinum'] ++ + # This exchange rate table lists the currency ISO 4217 codes, their + # long text names, and any fixed definitions. If the definition is + # empty then units_cur will query the server for a value. +@@ -271,11 +279,19 @@ ap.add_argument('-v','--verbose', + help='display details when fetching currency data', + ) + ++ ++def validfloat(x): ++ try: ++ float(x) ++ return True ++ except ValueError: ++ return False ++ + outfile_name = ap.parse_args().output_file + verbose = ap.parse_args().verbose + + try: +- res = requests.get('http://finance.yahoo.com/webservice/v1/symbols' ++ res = requests.get('https://finance.yahoo.com/webservice/v1/symbols' + '/allcurrencies/quote?format=json') + res.raise_for_status() + webdata = res.json()['list']['resources'] +@@ -299,10 +315,16 @@ for data in webdata: + stderr.write('Got unknown currency with code {}\n'.format(code)) + else: + if not currency[code][rate_index]: +- currency[code][rate_index] = '1|{} US$'.format(rate) ++ if validfloat(rate): ++ currency[code][rate_index] = '1|{} US$'.format(rate) ++ else: ++ stderr.write('Got invalid rate "{}" for currency "{}"\n'.format( ++ rate, code)) + elif verbose: +- stderr.write('Got value "{}" for currency "{}" but ' +- 'it is already defined\n'.format(rate, code)) ++ if currency[code][rate_index] != '1|{} US$'.format(rate): ++ stderr.write('Got value "{}" for currency "{}" but ' ++ 'it is already defined as {}\n'.format(rate, code, ++ currency[code][rate_index])) + + + # Delete currencies where we have no rate data +@@ -313,17 +335,15 @@ for code in currency.keys(): + del currency[code] + + try: +- req = requests.get('http://services.packetizer.com/spotprices/?f=json') ++ req = requests.get('https://services.packetizer.com/spotprices/?f=json') + req.raise_for_status() + metals = req.json() + except requests.exceptions.RequestException as e: + stderr.write('Error connecting to spotprices server:\n{}\n'.format(e)) + exit(1) + +-del metals['date'] +- + try: +- req = requests.get('http://services.packetizer.com/btc/?f=json') ++ req = requests.get('https://services.packetizer.com/btc/?f=json') + req.raise_for_status() + bitcoin = req.json() + except requests.exceptions.RequestException as e: +@@ -344,13 +364,31 @@ ratestr = '\n'.join( + '{:{}}{}'.format(name, maxlen, rate) for (name, rate) in zip(cnames, crates) + ) + +-ozzystr = '\n'.join('{:19}{} US$/troyounce'.format( +- metal + 'price', +- price, +- ) for metal, price in metals.items()) +- +-bitcoinstr = '{:{}}{} US$ # From services.packetizer.com/btc\n'.format( ++metallist = ['']*len(validmetals) ++for metal, price in metals.items(): ++ if metal in validmetals: ++ metalindex = validmetals.index(metal) ++ if validfloat(price): ++ if not metallist[metalindex]: ++ metallist[validmetals.index(metal)] = '{:19}{} US$/troyounce'.format( ++ metal + 'price', price) ++ elif verbose: ++ stderr.write('Got value "{}" for metal "{}" but ' ++ 'it is already defined\n'.format(price,metal)) ++ else: ++ stderr.write('Got invalid rate "{}" for metal "{}"\n'.format( ++ price, metal)) ++ elif metal != 'date' and verbose: # Don't print a message for the "date" entry ++ stderr.write('Got unknown metal "{}" with value "{}"\n',metal,price) ++metalstr = '\n'.join(metallist) ++ ++if validfloat(bitcoin['usd']): ++ bitcoinstr = '{:{}}{} US$ # From services.packetizer.com/btc\n'.format( + 'bitcoin',maxlen,bitcoin['usd']) ++else: ++ stderr.write('Got invalid bitcoin rate "{}"\n', bitcoint['usd']) ++ bitcointstr='' ++ + + outstr = ( + """# ISO Currency Codes +@@ -366,9 +404,9 @@ outstr = ( + + # Precious metals prices from Packetizer (services.packetizer.com/spotprices) + +-{ozzystr} ++{metalstr} + +-""".format(codestr=codestr, datestr=datestr, ratestr=ratestr, ozzystr=ozzystr, ++""".format(codestr=codestr, datestr=datestr, ratestr=ratestr, metalstr=metalstr, + bitcoinstr=bitcoinstr) + ).replace('\n', linesep) + +-- +2.17.1 + diff --git a/SOURCES/0002-units-2.17-no-network.patch b/SOURCES/0002-units-2.17-no-network.patch new file mode 100644 index 0000000..3456f9b --- /dev/null +++ b/SOURCES/0002-units-2.17-no-network.patch @@ -0,0 +1,47 @@ +From 06a4ba00e8e4188486fa962dbccbfa1e6afe2cf2 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 | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 70e2e10..7c1ee5b 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -58,8 +58,6 @@ DEFS=-DUNITSFILE=\"@UDAT@definitions.units\" -DLOCALEMAP=\"@UDAT@locale_map.txt\ + CFLAGS = @CFLAGS@ + OBJECTS = units.@OBJEXT@ parse.tab.@OBJEXT@ getopt.@OBJEXT@ getopt1.@OBJEXT@ @STRFUNC@ + +-.PHONY: currency-units-update +- + .SUFFIXES: + .SUFFIXES: .c .@OBJEXT@ .rc .res .texinfo .pdf + +@@ -107,7 +105,7 @@ units_cur_inst: units_cur + -e "s@/usr/bin/python@$(PYTHON)@" \ + $(srcdir)/units_cur > units_cur_inst + +-install-support: definitions.units units_cur_inst currency-units-update ++install-support: definitions.units units_cur_inst + $(MKDIR_P) $(DESTDIR)@UDAT@ $(DESTDIR)$(bindir) $(DESTDIR)@CDAT@ + $(INSTALL_DATA) $(srcdir)/definitions.units $(DESTDIR)@UDAT@definitions.units + -rm -f $(DESTDIR)@UDAT@currency.units +@@ -204,11 +202,6 @@ texclean: + -rm -f units.log UnitsMKS.log UnitsWin.log \ + *.aux *.cp *.fn *.ky *.op *.pg *.toc *.tp *.vr + +-currency-units-update: +- @echo "Trying to update currency.units (will use existing file if this fails)" +- -$(srcdir)/units_cur currency.units +- if [ ! -s currency.units ]; then cp $(srcdir)/currency.units currency.units;fi +- + sig: + echo units-`sed -n -e '/\#.*VERSION/s/.*"\(.*\)"/\1/gp' \ + $(srcdir)/units.c`.tar.gz > distname +-- +2.17.1 + diff --git a/SPECS/units.spec b/SPECS/units.spec new file mode 100644 index 0000000..30b44dd --- /dev/null +++ b/SPECS/units.spec @@ -0,0 +1,350 @@ +Summary: A utility for converting amounts from one unit to another +Name: units +Version: 2.17 +Release: 5%{?dist} +Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz +URL: https://www.gnu.org/software/units/units.html +License: GPLv3+ +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info +BuildRequires: automake +BuildRequires: bison +BuildRequires: gcc +BuildRequires: ncurses-devel +BuildRequires: python3-devel +BuildRequires: readline-devel + +# units_cur: validate rate data from server (#1598913) +Patch1: 0001-units-2.17-units_cur-validate.patch + +# do not update currency.units from network during build +Patch2: 0002-units-2.17-no-network.patch + +%description +Units converts an amount from one unit to another, or tells you what +mathematical operation you need to perform to convert from one unit to +another. The units program can handle multiplicative scale changes as +well as conversions such as Fahrenheit to Celsius. + +%prep +%autosetup -p1 + +# make units_cur use Python 3 +sed -e 's|^AC_PATH_PROG(PYTHON, .*$|PYTHON=%{__python3}\nAC_SUBST(PYTHON)|' \ + -i configure.ac +autoreconf -fiv + +%build +%configure +make %{?_smp_mflags} + +%install +make install DESTDIR=$RPM_BUILD_ROOT + +gzip $RPM_BUILD_ROOT%{_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 + +%check +make check + +%post +if [ -e %{_infodir}/units.info.gz ]; then + /sbin/install-info %{_infodir}/units.info.gz %{_infodir}/dir || : +fi + +%preun +if [ $1 = 0 -a -e %{_infodir}/units.info.gz ]; then + /sbin/install-info --delete %{_infodir}/units.info.gz %{_infodir}/dir || : +fi + +%files +%doc ChangeLog COPYING NEWS README +%{_bindir}/units +%{_bindir}/units_cur +%{_datadir}/units +%{_sharedstatedir}/units +%{_infodir}/* +%{_mandir}/man1/* + +%changelog +* 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 + +* Thu Nov 17 2011 Kamil Dudka - 1.88-5 +- improve the units-1.88-coverity.patch (thanks to Adrian Mariano) + +* Wed Nov 16 2011 Kamil Dudka - 1.88-4 +- fix code defects found by Coverity + +* Mon Feb 07 2011 Fedora Release Engineering - 1.88-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed May 05 2010 Kamil Dudka - 1.88-2 +- fix typo in man page (#588565) + +* Tue Feb 23 2010 Kamil Dudka - 1.88-1 +- new upstream release, dropped applied patches + +* Tue Dec 01 2009 Kamil Dudka - 1.87-7 +- add BuildRequires for bison + +* Tue Dec 01 2009 Kamil Dudka - 1.87-6 +- update license to GPLv3+, sanitize specfile +- fix tons of gcc warnings + +* Thu Aug 20 2009 Zdenek Prikryl - 1.87-5 +- Don't complain if installing with --excludedocs (#515941) + +* Sun Jul 26 2009 Fedora Release Engineering - 1.87-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 1.87-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 20 2008 Fedora Release Engineering - 1.87-2 +- Autorebuild for GCC 4.3 + +* Wed Oct 31 2007 Zdenek Prikryl - 1.87-1 +- New version 1.87 + +* Thu Aug 23 2007 Harald Hoyer - 1.86-7 +- changed license tag + +* Thu Jul 05 2007 Florian La Roche +- fix preun script to properly remove the info file + +* Fri Mar 23 2007 Harald Hoyer - 1.86-5 +- more specfile cleanups + +* Tue Mar 20 2007 Harald Hoyer - 1.86-4 +- added readline build requirement +- changed BUILDROOT + +* Wed Jan 24 2007 Harald Hoyer - 1.86-3 +- fixed previous fix for rhbz#220533 + +* Tue Jan 23 2007 Florian La Roche - 1.86-2 +- rhbz#220533 + +* Mon Nov 13 2006 Florian La Roche - 1.86-1 +- 1.86 + +* Wed Jul 12 2006 Jesse Keating - 1.85-1.2.2 +- rebuild + +* Fri Feb 10 2006 Jesse Keating - 1.85-1.2.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 1.85-1.2 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Tue Jul 19 2005 Harald Hoyer - 1.85-1 +- version 1.85 + +* Thu Mar 03 2005 Harald Hoyer +- rebuilt + +* Wed Jan 12 2005 Tim Waugh +- Rebuilt for new readline. + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Tue Jun 24 2003 Harald Hoyer 1.80-8 +- au is now astronomicalunit + +* Wed Jun 11 2003 Harald Hoyer 1.80-7 +- fix parsecs #96982 + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Fri May 23 2003 Jeremy Katz 1.80-5 +- fix build with gcc 3.3 + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Tue Dec 17 2002 Harald Hoyer 1.80-2 +- changed description + +* Tue Nov 05 2002 Harald Hoyer 1.80-1 +- update to version 1.80 + +* Tue Jul 23 2002 Harald Hoyer +- removed prestripping + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Fri Dec 14 2001 Harald Hoyer 1.74-1 +- bumped version +- this fixed #54971 + +* Fri May 11 2001 Bernhard Rosenkraenzer 1.55-10 +- rebuild with new readline + +* Wed Jul 12 2000 Prospector +- automatic rebuild + +* Sun Jun 11 2000 Bill Nottingham +- rebuild, FHS stuff + +* Wed Apr 5 2000 Bill Nottingham +- rebuild against current ncurses/readline + +* Fri Mar 24 2000 Bernhard Rosenkraenzer +- rebuild with new readline + +* Thu Feb 3 2000 Bill Nottingham +- handle compressed man pages + +* Mon Nov 22 1999 Bill Nottingham +- fix install-info (#6631) + +* Mon Sep 13 1999 Bill Nottingham +- strip files + +* Mon Aug 2 1999 Bill Nottingham +- update to 1.55 + +* Sun Mar 21 1999 Cristian Gafton +- auto rebuild in the new build environment (release 12) + +* Thu Dec 17 1998 Michael Maher +- built package for 6.0 + +* Sun Aug 23 1998 Jeff Johnson +- units.lib corrections (problem #685) + +* Tue Aug 11 1998 Jeff Johnson +- build root + +* Mon Apr 27 1998 Prospector System +- translations modified for de, fr, tr + +* Tue Oct 21 1997 Donnie Barnes +- spec file cleanups + +* Mon Jul 21 1997 Erik Troan +- built against glibc