Skip to content

Commit

Permalink
Trim all trailing whitespace - including \r
Browse files Browse the repository at this point in the history
Fixes #33
  • Loading branch information
coolo committed Jan 28, 2021
1 parent 7e3a48d commit 5b1b859
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -17,7 +17,7 @@ check:
temp=`mktemp` ;\
for i in testing/*.spec; do \
perl prepare_spec $$i > $$temp ;\
diff -u $$temp $$i.out ;\
diff -u $$i.out $$temp ;\
done ;\
rm $$temp

Expand Down
2 changes: 2 additions & 0 deletions prepare_spec
Expand Up @@ -271,6 +271,8 @@ sub read_and_parse_old_spec {

while (@readspec) {
$_ = shift @readspec;
# trim all trailing whitespace (including \r, see issue 33)
$_ =~ s/\s+$//;

if ( /^\s*$/ && $current_section ne "description") {
# stop preamble parsing on two blank lines
Expand Down
67 changes: 67 additions & 0 deletions testing/dos2unix.spec
@@ -0,0 +1,67 @@
#
# spec file for package dos2unix
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name: dos2unix
Version: 7.4.2
Release: 0
Summary: Text converters to and from DOS/MAC to UNIX
License: BSD-2-Clause
Group: Productivity/Text/Convertors
URL: https://waterlan.home.xs4all.nl/dos2unix.html
Source: https://waterlan.home.xs4all.nl/dos2unix/dos2unix-%{version}.tar.gz
Source2: https://waterlan.home.xs4all.nl/dos2unix/dos2unix-%{version}.tar.gz.asc
# http://keys.gnupg.net/pks/lookup?op=get&search=0x38C1F572B12725BE
Source3: %{name}.keyring
Provides: unix2dos = %{version}
Obsoletes: unix2dos < %{version}

%description
Dos2unix is used to convert plain text from DOS (CR/LF) format. Mac2unix
converts plain text from MAC (CR) format to UNIX format (LF).

Unix2dos converts plain text files from UNIX
format to DOS format and unix2dos converts from UNIX to MAC format.

%prep
%setup -q
find . -type f -exec chmod -x '{}' +

%build
export RPM_OPT_FLAGS
%make_build CC="gcc" HTMLEXT="html"

%install
%make_install docdir=%{_defaultdocdir}/%{name} HTMLEXT="html"
%find_lang dos2unix --all-name --with-man

%files -f dos2unix.lang
%defattr(-,root,root,0755)
%doc %{_defaultdocdir}/%{name}
%{_bindir}/*
%{_mandir}/*/*.1%{?ext_man}
%doc %lang(de) %dir %{_mandir}/de
%doc %lang(es) %dir %{_mandir}/es
%doc %lang(fr) %dir %{_mandir}/fr
%doc %lang(nl) %dir %{_mandir}/nl
%doc %lang(pl) %dir %{_mandir}/pl
%doc %lang(pt_BR) %dir %{_mandir}/pt_BR
%doc %lang(sv) %dir %{_mandir}/sv
%doc %lang(uk) %dir %{_mandir}/uk
%doc %lang(zh_CN) %dir %{_mandir}/zh_CN

%changelog
67 changes: 67 additions & 0 deletions testing/dos2unix.spec.out
@@ -0,0 +1,67 @@
#
# spec file for package dos2unix
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name: dos2unix
Version: 7.4.2
Release: 0
Summary: Text converters to and from DOS/MAC to UNIX
License: BSD-2-Clause
Group: Productivity/Text/Convertors
URL: https://waterlan.home.xs4all.nl/dos2unix.html
Source: https://waterlan.home.xs4all.nl/dos2unix/dos2unix-%{version}.tar.gz
Source2: https://waterlan.home.xs4all.nl/dos2unix/dos2unix-%{version}.tar.gz.asc
# http://keys.gnupg.net/pks/lookup?op=get&search=0x38C1F572B12725BE
Source3: %{name}.keyring
Provides: unix2dos = %{version}
Obsoletes: unix2dos < %{version}

%description
Dos2unix is used to convert plain text from DOS (CR/LF) format. Mac2unix
converts plain text from MAC (CR) format to UNIX format (LF).

Unix2dos converts plain text files from UNIX
format to DOS format and unix2dos converts from UNIX to MAC format.

%prep
%setup -q
find . -type f -exec chmod -x '{}' +

%build
export RPM_OPT_FLAGS
%make_build CC="gcc" HTMLEXT="html"

%install
%make_install docdir=%{_defaultdocdir}/%{name} HTMLEXT="html"
%find_lang dos2unix --all-name --with-man

%files -f dos2unix.lang
%defattr(-,root,root,0755)
%doc %{_defaultdocdir}/%{name}
%{_bindir}/*
%{_mandir}/*/*.1%{?ext_man}
%doc %lang(de) %dir %{_mandir}/de
%doc %lang(es) %dir %{_mandir}/es
%doc %lang(fr) %dir %{_mandir}/fr
%doc %lang(nl) %dir %{_mandir}/nl
%doc %lang(pl) %dir %{_mandir}/pl
%doc %lang(pt_BR) %dir %{_mandir}/pt_BR
%doc %lang(sv) %dir %{_mandir}/sv
%doc %lang(uk) %dir %{_mandir}/uk
%doc %lang(zh_CN) %dir %{_mandir}/zh_CN

%changelog
6 changes: 3 additions & 3 deletions testing/gdb.spec.out
Expand Up @@ -489,7 +489,7 @@ This package provides INFO, HTML and PDF user manual for GDB.

%if %{build_testsuite}
%description
Results from running the GDB testsuite.
Results from running the GDB testsuite.
%endif

%prep
Expand Down Expand Up @@ -671,7 +671,7 @@ export CFLAGS="$RPM_OPT_FLAGS"

# Add your -Wno-x/-Wno-error=y options here:
for opt in -Wno-error=odr; do
# checking for acceptance of -Wno-foo is a bit wieldy: GCC doesn't
# checking for acceptance of -Wno-foo is a bit wieldy: GCC doesn't
# warn about unknown -Wno- flags, _except_ if there are other
# diagnostics as well, so let's force an uninitialized use warning
# and grep for the diagnostic about the -Wno flag:
Expand Down Expand Up @@ -1150,7 +1150,7 @@ cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1
%if 0%{?el5:1}
rm -f $RPM_BUILD_ROOT%{_infodir}/annotate.info*
rm -f $RPM_BUILD_ROOT%{_infodir}/gdb.info*
%endif # 0%{?el5:1}
%endif # 0%{?el5:1}
# -j1: There is some race resulting in:
# /usr/bin/texi2dvi: texinfo.tex appears to be broken, quitting.
make -j1 -C gdb/doc install DESTDIR=$RPM_BUILD_ROOT
Expand Down

0 comments on commit 5b1b859

Please sign in to comment.