diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index 2adcf2b..cdad827 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ bc-1.06.95.tar.bz2 +/bc-1.07.tar.gz +/bc-1.07.1.tar.gz +/bc-1.08.1.tar.gz +/bc-1.08.1.tar.xz +/bc-1.08.1.tar.xz.sig +/bc-1.08.2.tar.gz +/bc-1.08.2.tar.gz.sig diff --git a/bc-1.06.95-matlib.patch b/bc-1.06.95-matlib.patch deleted file mode 100644 index 796c5e2..0000000 --- a/bc-1.06.95-matlib.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -urNp bc-1.06.95-orig/bc/storage.c bc-1.06.95/bc/storage.c ---- bc-1.06.95-orig/bc/storage.c 2006-09-05 04:39:31.000000000 +0200 -+++ bc-1.06.95/bc/storage.c 2010-12-22 10:26:43.805250912 +0100 -@@ -99,6 +99,7 @@ more_functions (VOID) - { - f = &functions[indx]; - f->f_defined = FALSE; -+ f->f_void = FALSE; - f->f_body = (char *) bc_malloc (BC_START_SIZE); - f->f_body_size = BC_START_SIZE; - f->f_code_size = 0; -@@ -179,7 +180,7 @@ more_arrays () - - - /* Initialize the new elements. */ -- for (; indx < v_count; indx++) -+ for (; indx < a_count; indx++) - arrays[indx] = NULL; - - /* Free the old elements. */ diff --git a/bc-1.06.95-memleak.patch b/bc-1.06.95-memleak.patch deleted file mode 100644 index 0b8fc5b..0000000 --- a/bc-1.06.95-memleak.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/bc/bc.y b/bc/bc.y -index 14dc4be..bd91c38 100644 ---- a/bc/bc.y -+++ b/bc/bc.y -@@ -569,6 +569,7 @@ expression : named_expression ASSIGN_OP - generate (">"); - break; - } -+ free($2); - } - | expression '+' expression - { -diff --git a/bc/util.c b/bc/util.c -index 30beaf9..26e2e85 100644 ---- a/bc/util.c -+++ b/bc/util.c -@@ -602,8 +602,7 @@ lookup (name, namekind) - case FUNCTDEF: - if (id->f_name != 0) - { -- if (namekind != FUNCT) -- free(name); -+ free(name); - /* Check to see if we are redefining a math lib function. */ - if (use_math && namekind == FUNCTDEF && id->f_name <= 6) - id->f_name = next_func++; diff --git a/bc-1.06.95-sigintmasking.patch b/bc-1.06.95-sigintmasking.patch deleted file mode 100644 index c86340f..0000000 --- a/bc-1.06.95-sigintmasking.patch +++ /dev/null @@ -1,27 +0,0 @@ -Binary files bc-1.06.95-orig/dc/.dc.c.swp and bc-1.06.95/dc/.dc.c.swp differ -diff -urNp bc-1.06.95-orig/dc/eval.c bc-1.06.95/dc/eval.c ---- bc-1.06.95-orig/dc/eval.c 2006-06-04 13:04:40.000000000 +0200 -+++ bc-1.06.95/dc/eval.c 2011-09-08 15:11:48.815060585 +0200 -@@ -661,7 +661,9 @@ dc_evalfile DC_DECLARG((fp)) - int next_negcmp = 0; - dc_data datum; - -- signal(SIGINT, dc_trap_interrupt); -+ /* Do not mask SIGINT when running from stdin */ -+ if (fp != stdin) -+ signal(SIGINT, dc_trap_interrupt); - stdin_lookahead = EOF; - for (c=getc(fp); c!=EOF; c=peekc){ - peekc = getc(fp); -diff -urNp bc-1.06.95-orig/doc/dc.texi bc-1.06.95/doc/dc.texi ---- bc-1.06.95-orig/doc/dc.texi 2006-06-11 10:15:54.000000000 +0200 -+++ bc-1.06.95/doc/dc.texi 2011-09-08 15:09:37.032059798 +0200 -@@ -126,6 +126,8 @@ To exit, use @samp{q}. - (or whatever other keystroke your system uses to generate a @code{SIGINT}) - does not exit; - it is used to abort macros that are looping, etc. -+This is not true if running on stdin to prevent accidental user confusion -+about @kbd{C-c} unfunctionality. - - A reverse-polish calculator stores numbers on a stack. - Entering a number pushes it on the stack. diff --git a/bc-1.07.1-readline-echo-empty.diff b/bc-1.07.1-readline-echo-empty.diff new file mode 100644 index 0000000..1b2c034 --- /dev/null +++ b/bc-1.07.1-readline-echo-empty.diff @@ -0,0 +1,14 @@ +diff -Naur bc-1.07.1/bc/scan.l bc-1.07.1-new/bc/scan.l +--- bc-1.07.1/bc/scan.l 2017-04-07 22:20:02.000000000 +0000 ++++ bc-1.07.1-new/bc/scan.l 2021-08-14 12:12:33.860991777 +0000 +@@ -170,6 +170,10 @@ + if (rl_len != 1) + add_history (rl_line); + rl_line[rl_len-1] = '\n'; ++ /* readline doesn't echo empty lines without a prompt, ++ so do so here. */ ++ if (rl_len == 1) ++ putchar ('\n'); + fflush (stdout); + } + diff --git a/bc.spec b/bc.spec index 985b05f..fe06d1e 100644 --- a/bc.spec +++ b/bc.spec @@ -1,20 +1,24 @@ Summary: GNU's bc (a numeric processing language) and dc (a calculator) Name: bc -Version: 1.06.95 -Release: 16%{?dist} -License: GPLv2+ -URL: http://www.gnu.org/software/bc/ -Group: Applications/Engineering -Source: ftp://alpha.gnu.org/pub/gnu/bc/bc-%{version}.tar.bz2 +Version: 1.08.2 +Release: 2%{?dist} +License: GPL-3.0-or-later +URL: https://www.gnu.org/software/bc/ +Source0: https://ftp.gnu.org/gnu/bc/bc-%{version}.tar.gz +Source1: https://ftp.gnu.org/gnu/bc/bc-%{version}.tar.gz.sig +Source2: kevin_pizzini.asc Patch1: bc-1.06-dc_ibase.patch -Patch2: bc-1.06.95-memleak.patch -Patch3: bc-1.06.95-matlib.patch -Patch4: bc-1.06.95-sigintmasking.patch -Patch5: bc-1.06.95-doc.patch -Requires(post): /sbin/install-info -Requires(preun): /sbin/install-info -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: readline-devel, flex, bison, texinfo +Patch2: bc-1.06.95-doc.patch +Patch3: bc-1.07.1-readline-echo-empty.diff +BuildRequires: bison +BuildRequires: ed +BuildRequires: flex +BuildRequires: gcc +BuildRequires: make +BuildRequires: readline-devel +BuildRequires: texinfo +# for gpg verification +BuildRequires: gnupg2 %description The bc package includes bc and dc. Bc is an arbitrary precision @@ -26,46 +30,126 @@ Install the bc package if you need its number handling capabilities or if you would like to use its text mode calculator. %prep -%setup -q -%patch1 -p1 -b .dc_ibase -%patch2 -p1 -b .memleak -%patch3 -p1 -b .matlib -%patch4 -p1 -b .sigintmask -%patch5 -p1 -b .doc +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%autosetup -p1 %build %configure --with-readline -make %{?_smp_mflags} +%make_build %install -make install DESTDIR=$RPM_BUILD_ROOT -rm -f $RPM_BUILD_ROOT/%{_infodir}/dir - -%post -if [ -e %{_infodir}/bc.info.gz -a -e %{_infodir}/dc.info.gz ]; then - /sbin/install-info %{_infodir}/bc.info.gz %{_infodir}/dir \ - --entry="* bc: (bc). The GNU calculator language." || : - /sbin/install-info %{_infodir}/dc.info.gz %{_infodir}/dir \ - --entry="* dc: (dc). The GNU RPN calculator." || : -fi - -%preun -if [ $1 = 0 -a -e %{_infodir}/bc.info.gz -a -e %{_infodir}/dc.info.gz ]; then - /sbin/install-info --delete %{_infodir}/bc.info.gz %{_infodir}/dir \ - --entry="* bc: (bc). The GNU calculator language." || : - /sbin/install-info --delete %{_infodir}/dc.info.gz %{_infodir}/dir \ - --entry="* dc: (dc). The GNU RPN calculator." || : -fi +%make_install +rm -f %{buildroot}/%{_infodir}/dir %files -%defattr(-,root,root,-) -%doc COPYING COPYING.LIB FAQ AUTHORS NEWS README Examples/ +%license COPYING COPYING.LIB +%doc FAQ AUTHORS NEWS README Examples/ %{_bindir}/dc %{_bindir}/bc -%{_mandir}/*/* -%{_infodir}/* +%{_mandir}/man1/bc.1* +%{_mandir}/man1/dc.1* +%{_infodir}/bc.info* +%{_infodir}/dc.info* %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 1.08.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Thu Jun 26 2025 Mikel Olasagasti Uranga - 1.08.2-1 +- Update to 1.08.2 - rhbz#2368486 + +* Wed Mar 05 2025 Mikel Olasagasti Uranga - 1.08.1-3 +- Verify gpg signature +- Change to https links +- Misc changes + +* Thu Jan 16 2025 Fedora Release Engineering - 1.08.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Mon Jan 06 2025 Fedora Release Monitoring - 1.08.1-1 +- Update to 1.08.1 (#2335123) + +* Wed Jul 17 2024 Fedora Release Engineering - 1.07.1-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue Jan 23 2024 Fedora Release Engineering - 1.07.1-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 1.07.1-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jul 19 2023 Fedora Release Engineering - 1.07.1-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Sun Jun 25 2023 Sérgio Basto - 1.07.1-18 +- Migrate to SPDX license format + +* Wed Jan 18 2023 Fedora Release Engineering - 1.07.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Jul 20 2022 Fedora Release Engineering - 1.07.1-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Wed Jan 19 2022 Fedora Release Engineering - 1.07.1-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Sat Aug 14 2021 Pádraig Brady - 1.07.1-14 +- Echo empty lines, useful for delimiting work + +* Wed Jul 21 2021 Fedora Release Engineering - 1.07.1-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 1.07.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 1.07.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jan 28 2020 Fedora Release Engineering - 1.07.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jul 24 2019 Fedora Release Engineering - 1.07.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun Feb 17 2019 Igor Gnatenko - 1.07.1-8 +- Rebuild for readline 8.0 + +* Thu Jan 31 2019 Fedora Release Engineering - 1.07.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 12 2018 Fedora Release Engineering - 1.07.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering - 1.07.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Sep 13 2017 Vasiliy N. Glazov - 1.07.1-4 +- Cleanup spec + +* Wed Aug 02 2017 Fedora Release Engineering - 1.07.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.07.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon May 15 2017 Kevin Fenzi - 1.07.1-1https://bugs.archlinux.org/task/53546 +- Update to 1.07.1 +- Fixes a bug that breaks kernel builds ( https://bugs.archlinux.org/task/53546 ) + +* Mon May 15 2017 Ondrej Vasik - 1.07-2 +- build seems to be racy now, removing parallel build for now +- add build dep on "ed" + +* Wed May 10 2017 Ondrej Vasik - 1.07-1 +- new upstream version 1.07, dropped patches already appllied + in usptream version + +* Wed Feb 01 2017 Stephen Gallagher - 1.06.95-18 +- Install COPYING[.*] using the %%license macro + +* Thu Jan 12 2017 Igor Gnatenko - 1.06.95-17 +- Rebuild for readline 7.x + * Wed Feb 03 2016 Fedora Release Engineering - 1.06.95-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/kevin_pizzini.asc b/kevin_pizzini.asc new file mode 100644 index 0000000..49b4a73 --- /dev/null +++ b/kevin_pizzini.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBEum60cBCADIZ/am0d96/2Is86VRUkNi4DReLYDzQqpuI1cCtCHKbBel6uYL +ERsTJUxgqEtYAzjQOaOOr8k7X/U8NzmmjAk/GR/coHFbGLVUI3O/TWZZ4u3bZLpC +4lhe303PZZDHMGGcUEmzhU9LDxeCYF2LfQQYWQNmc674VgOt+fcJJkty3tjWHag0 +YWOPvugOg5SfqDtGPfnmoeSbdKmVgbmXLX5ab68jIRHfcQNlKgfQbkLN7CYi7ou7 +f8aNIO/DQ1mFzzNc6fuP6i5zznL4FcKTzvx1z6+gtjUXWmqWuVw6qqiND7V1tjJd +b0cjl4BNoXPk3btKfYwHd9I9tTfilmWm5KNtABEBAAG0GUtlbiBQaXp6aW5pIDxr +ZW5AZ251Lm9yZz6JAVUEEwEKAD8CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheA +FiEEMltU5GU/k1olzzK9oYYnjUJqOOkFAmclQjUFCSEh8W4ACgkQoYYnjUJqOOmj +vgf/QRqbDPdfm3+JcEQBZKjBby0syw70FrxL8oJpthTapN7vljyL1/QmrFukhScD +98mns1OJsbud11Qbdab5d3MGD9agQ4H7OGm48h4MAkkd7ekJR2ISxrNGw8pQiir8 +Sr0+LsS+5l/W16GaGUegmNyirKv2//mb9IDBBmZ0Ui13x85fIwxe7PrjcLw5vIB9 +qPr7bcCZaKrzuWygpbzUQwXtW1ipKierEk4C780QV3jJFw8wkTB6ul1Kk221oMo/ +OeAOnLk5+d5tOtUMonyYSZmvkbEhFDpOF3J3qNomwmnBBUA+bn0hEsNjhmy3h4jS +SRRIuqRrMFF1GiFNuHa67uBI0bkBDQRLputHAQgAtCX015BdwVGX9IaO1Iv2FBkt +JSg4A/GV+0iZXVqafi5pe/oLQY7gXQUV/AuTqjj7168sb9s8ZJjzrE0CsBrcUtOU +eSKBQiCL81L6eO91tKBpwuPACEyzxiW5Bfh/dn3jiZikXBi9u7NSsLaDDj4AK6W7 +6/fWz9984elxeIqZSiRuae0xTs+kaEw49ha8wrv6sE4H9CbWoz4276raGQmBJLky +NQlCZMxq6Z/a6NXTNiNNrVMueCCQmbW6iu8fV8W1IRMBnbWZjTcBBZztzW5T6mOE +3weuvYkuwy6yNcgrafG2WeW+wrYzQ38yYIH7o27pgQKySZHjZxaeoqRysW42gwAR +AQABiQE8BBgBCgAmAhsMFiEEMltU5GU/k1olzzK9oYYnjUJqOOkFAmclQkMFCSEh +8XwACgkQoYYnjUJqOOk55wf/W3p31v5zZtRyalRohfxUn9rrbucye38W+LzZGGoz +BU4CCcZhwtumkFgd3bB3t50e26VDBB3D3cVPyLDLU182eibKbgv4/6bjk09l1PRl +UhTHpWTqiz+lkmMEMsSFXWJjXssmAo5XOL4OxX/bgHUK5NgvaRg7WL1CVuLAL91s +VTasLP1XoOpZ85ec5YmzNciCU41XfGSIrkG+PbE7MJmjlUT0w4/Q59/5CiIv/XoM +UAiiIDozgvzDinVUBP8+Kl5QexEe3E3dHSNPRc4xlPsx5KTOCWJHEe00XgZgMuTZ +bzVD5uvJm95WssY37wZ2bt58iufB9sBsw2NFPr3eQIo12A== +=L3fP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/sources b/sources index 686ab4f..4cc1018 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -5126a721b73f97d715bb72c13c889035 bc-1.06.95.tar.bz2 +SHA512 (bc-1.08.2.tar.gz) = 0876a4c5bfc23da79479519c6a8e03ac9f59ae54077eb71ffdcc6ddaccb76c4b7595b088e89e6ad82d833c072eeff5b378178084276584813c00eedace4c6f8c +SHA512 (bc-1.08.2.tar.gz.sig) = 5987363ae617b46136d5fec45e302045d55ec43db1005d175ff78d4c9a8450a7a95c4ebce22a1f810c64f21a7a6f5eee764bfe84aa084cfe439c2f04775f4939 diff --git a/tests/sanity/main.fmf b/tests/sanity/main.fmf new file mode 100644 index 0000000..911d9ad --- /dev/null +++ b/tests/sanity/main.fmf @@ -0,0 +1,9 @@ +summary: Basic sanity test +component: + - bc +test: python3 ./runtests.py -v +framework: shell +recommend: + - bc + - python3 +duration: 1m diff --git a/tests/sanity/runtests.py b/tests/sanity/runtests.py new file mode 100644 index 0000000..0839015 --- /dev/null +++ b/tests/sanity/runtests.py @@ -0,0 +1,45 @@ +import unittest + +import os +import subprocess + + +def call_command(command_to_call): + result = subprocess.check_output(command_to_call, shell=True) + return result[:-1].decode("utf-8") + + +class TestBC(unittest.TestCase): + + def test_divide(self): + result = call_command("echo '6.5 / 2.7' | bc") + self.assertEqual( result, '2') + + def test_sum(self): + result = call_command("echo '2 + 5' | bc") + self.assertEqual( result, '7') + + def test_difference(self): + result = call_command("echo '10 - 4' | bc") + self.assertEqual( result, '6') + + def test_multiplying(self): + result = call_command("echo '3 * 8' | bc") + self.assertEqual( result, '24') + + def test_scale(self): + result = call_command("echo 'scale = 2; 2 / 3' | bc") + self.assertEqual( result, '.66') + + def test_remainder(self): + result = call_command("echo '6 % 4' | bc") + self.assertEqual( result, '2') + + def test_exponent(self): + result = call_command("echo '10^2' | bc") + self.assertEqual( result, '100') + + +if __name__ == '__main__': + unittest.main() +