Compare commits
No commits in common. "c8s" and "c9-beta" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
/units-*.tar.gz
|
SOURCES/units-2.21.tar.gz
|
||||||
|
1
.units.metadata
Normal file
1
.units.metadata
Normal file
@ -0,0 +1 @@
|
|||||||
|
a897e639111c9400737b68ec22e5f70eaf5d7253 SOURCES/units-2.21.tar.gz
|
@ -1,152 +0,0 @@
|
|||||||
From 9d1129f41f193a47d6791f44f14abe9479999266 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kamil Dudka <kdudka@redhat.com>
|
|
||||||
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
|
|
||||||
|
|
@ -12,8 +12,8 @@ diff --git a/Makefile.in b/Makefile.in
|
|||||||
index 70e2e10..7c1ee5b 100644
|
index 70e2e10..7c1ee5b 100644
|
||||||
--- a/Makefile.in
|
--- a/Makefile.in
|
||||||
+++ b/Makefile.in
|
+++ b/Makefile.in
|
||||||
@@ -58,8 +58,6 @@ DEFS=-DUNITSFILE=\"@UDAT@definitions.units\" -DLOCALEMAP=\"@UDAT@locale_map.txt\
|
@@ -61,8 +61,6 @@ CFLAGS = @CFLAGS@
|
||||||
CFLAGS = @CFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
OBJECTS = units.@OBJEXT@ parse.tab.@OBJEXT@ getopt.@OBJEXT@ getopt1.@OBJEXT@ @STRFUNC@
|
OBJECTS = units.@OBJEXT@ parse.tab.@OBJEXT@ getopt.@OBJEXT@ getopt1.@OBJEXT@ @STRFUNC@
|
||||||
|
|
||||||
-.PHONY: currency-units-update
|
-.PHONY: currency-units-update
|
||||||
@ -21,7 +21,7 @@ index 70e2e10..7c1ee5b 100644
|
|||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .@OBJEXT@ .rc .res .texinfo .pdf
|
.SUFFIXES: .c .@OBJEXT@ .rc .res .texinfo .pdf
|
||||||
|
|
||||||
@@ -107,7 +105,7 @@ units_cur_inst: units_cur
|
@@ -110,7 +108,7 @@ units_cur_inst: units_cur
|
||||||
-e "s@/usr/bin/python@$(PYTHON)@" \
|
-e "s@/usr/bin/python@$(PYTHON)@" \
|
||||||
$(srcdir)/units_cur > units_cur_inst
|
$(srcdir)/units_cur > units_cur_inst
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ index 70e2e10..7c1ee5b 100644
|
|||||||
$(MKDIR_P) $(DESTDIR)@UDAT@ $(DESTDIR)$(bindir) $(DESTDIR)@CDAT@
|
$(MKDIR_P) $(DESTDIR)@UDAT@ $(DESTDIR)$(bindir) $(DESTDIR)@CDAT@
|
||||||
$(INSTALL_DATA) $(srcdir)/definitions.units $(DESTDIR)@UDAT@definitions.units
|
$(INSTALL_DATA) $(srcdir)/definitions.units $(DESTDIR)@UDAT@definitions.units
|
||||||
-rm -f $(DESTDIR)@UDAT@currency.units
|
-rm -f $(DESTDIR)@UDAT@currency.units
|
||||||
@@ -204,11 +202,6 @@ texclean:
|
@@ -207,11 +205,6 @@ texclean:
|
||||||
-rm -f units.log UnitsMKS.log UnitsWin.log \
|
-rm -f units.log UnitsMKS.log UnitsWin.log \
|
||||||
*.aux *.cp *.fn *.ky *.op *.pg *.toc *.tp *.vr
|
*.aux *.cp *.fn *.ky *.op *.pg *.toc *.tp *.vr
|
||||||
|
|
@ -1,22 +1,18 @@
|
|||||||
Summary: A utility for converting amounts from one unit to another
|
Summary: A utility for converting amounts from one unit to another
|
||||||
Name: units
|
Name: units
|
||||||
Version: 2.17
|
Version: 2.21
|
||||||
Release: 5%{?dist}
|
Release: 4%{?dist}
|
||||||
Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz
|
Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz
|
||||||
URL: https://www.gnu.org/software/units/units.html
|
URL: https://www.gnu.org/software/units/units.html
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Requires(post): /sbin/install-info
|
|
||||||
Requires(preun): /sbin/install-info
|
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
|
BuildRequires: make
|
||||||
BuildRequires: ncurses-devel
|
BuildRequires: ncurses-devel
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
BuildRequires: readline-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
|
# do not update currency.units from network during build
|
||||||
Patch2: 0002-units-2.17-no-network.patch
|
Patch2: 0002-units-2.17-no-network.patch
|
||||||
|
|
||||||
@ -49,16 +45,6 @@ ln -s units.1 %{buildroot}%{_mandir}/man1/units_cur.1
|
|||||||
%check
|
%check
|
||||||
make 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
|
%files
|
||||||
%doc ChangeLog COPYING NEWS README
|
%doc ChangeLog COPYING NEWS README
|
||||||
%{_bindir}/units
|
%{_bindir}/units
|
||||||
@ -69,6 +55,47 @@ fi
|
|||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.21-4
|
||||||
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
|
Related: rhbz#1991688
|
||||||
|
|
||||||
|
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.21-3
|
||||||
|
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Nov 16 2020 Kamil Dudka <kdudka@redhat.com> - 2.21-1
|
||||||
|
- new upstream release
|
||||||
|
|
||||||
|
* Thu Oct 01 2020 Kamil Dudka <kdudka@redhat.com> - 2.20-1
|
||||||
|
- new upstream release
|
||||||
|
|
||||||
|
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.19-5
|
||||||
|
- Second attempt - Rebuilt for
|
||||||
|
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.19-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.19-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.19-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jun 01 2019 Kamil Dudka <kdudka@redhat.com> - 2.19-1
|
||||||
|
- new upstream release
|
||||||
|
|
||||||
|
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.18-3
|
||||||
|
- Rebuild for readline 8.0
|
||||||
|
|
||||||
|
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.18-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Oct 29 2018 Kamil Dudka <kdudka@redhat.com> - 2.18-1
|
||||||
|
- new upstream release
|
||||||
|
|
||||||
* Wed Aug 08 2018 Kamil Dudka <kdudka@redhat.com> - 2.17-5
|
* Wed Aug 08 2018 Kamil Dudka <kdudka@redhat.com> - 2.17-5
|
||||||
- do not update currency.units from network during build
|
- do not update currency.units from network during build
|
||||||
- units_cur: validate rate data from server (#1598913)
|
- units_cur: validate rate data from server (#1598913)
|
1
sources
1
sources
@ -1 +0,0 @@
|
|||||||
SHA512 (units-2.17.tar.gz) = e4114f7dc0e40146f969375511c5d930497cb9502306ef82feac78c8e09a03e84ed0b582ff82e2878beae41702c9612f7a3d28fc6e9ed2cfae708f9feb8b737b
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user