Compare commits

...

No commits in common. 'c9' and 'i10cs' have entirely different histories.
c9 ... i10cs

2
.gitignore vendored

@ -1 +1 @@
SOURCES/libpaper_1.1.28.tar.gz
SOURCES/libpaper-2.1.1.tar.gz

@ -1 +1 @@
c6583fbdaebe091d11d81c4e59514e58996f22ba SOURCES/libpaper_1.1.28.tar.gz
cb7704d9461323fe60da5f822f18f9cb83cfc246 SOURCES/libpaper-2.1.1.tar.gz

@ -1,22 +0,0 @@
diff -up libpaper-1.1.24+nmu5/lib/paper.c.file-leak libpaper-1.1.24+nmu5/lib/paper.c
--- libpaper-1.1.24+nmu5/lib/paper.c.file-leak 2018-03-09 16:21:01.028345956 +0100
+++ libpaper-1.1.24+nmu5/lib/paper.c 2018-03-09 16:40:57.824279357 +0100
@@ -140,7 +140,7 @@ char* systempapername(void) {
char* paperstr;
char* paperenv;
const char* paperdef;
- FILE* ps;
+ FILE* ps = NULL;
struct stat statbuf;
const struct paper* pp;
int c;
@@ -224,6 +224,9 @@ PAPERSIZEVAR, fall-back to the old behav
}
}
+ if (ps)
+ fclose(ps);
+
paperdef = defaultpapername();
paperstr = malloc((strlen(paperdef) + 1) * sizeof(char));

@ -1,80 +0,0 @@
diff -up libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback libpaper-1.1.24+nmu3/lib/paper.c
--- libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback 2010-04-24 08:12:11.000000000 -0400
+++ libpaper-1.1.24+nmu3/lib/paper.c 2014-04-22 15:58:33.120039001 -0400
@@ -20,6 +20,9 @@
#include <unistd.h>
+#include <locale.h>
+#include <langinfo.h>
+
#include "paper.h"
struct paper {
@@ -108,6 +111,27 @@ in PAPERCONFVAR, fall-back to the old be
}
const char* defaultpapername(void) {
+#if defined(LC_PAPER) && defined(_GNU_SOURCE)
+
+#define NL_PAPER_GET(x) \
+ ((union { char *string; unsigned int word; })nl_langinfo(x)).word
+
+#define PT_TO_MM(v) (unsigned int)((v * 2.54 * 10 / 72) + 0.5)
+
+ const struct paper* pp;
+
+ unsigned int w = NL_PAPER_GET(_NL_PAPER_WIDTH);
+ unsigned int h = NL_PAPER_GET(_NL_PAPER_HEIGHT);
+
+ for (pp = paperfirst(); pp; pp = papernext(pp)) {
+ if (
+ PT_TO_MM(pp->pswidth) == w &&
+ PT_TO_MM(pp->psheight) == h
+ ) {
+ return pp->name;
+ }
+ }
+#endif
return PAPERSIZE;
}
diff -up libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback libpaper-1.1.24+nmu3/man/paperconf.1.in
--- libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback 2014-04-22 15:58:33.121038995 -0400
+++ libpaper-1.1.24+nmu3/man/paperconf.1.in 2014-04-22 16:00:15.973428376 -0400
@@ -48,10 +48,12 @@ looking in order at the
.B @PAPERSIZEVAR@
environment variable, at the contents of the file specified by the
.B @PAPERCONFVAR@
-environment variable, at the contents of
+environment variable, at the contents of the file
.B @PAPERCONF@
-or by using
-.B letter
+, consulting the values controlled by the
+.B LC_PAPER
+locale setting, or by using
+.B @PAPERSIZE@
as a fall-back value if none of the other alternatives are successful.
By default, width and height of the paper are printed in PostScript points.
.SH OPTIONS
diff -up libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback libpaper-1.1.24+nmu3/src/paperconf.c
--- libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback 2012-05-03 15:05:12.000000000 -0400
+++ libpaper-1.1.24+nmu3/src/paperconf.c 2014-04-22 15:58:33.121038995 -0400
@@ -13,6 +13,7 @@
#include <errno.h>
#include <paper.h>
+#include <locale.h>
/* needed for GNU/Hurd */
@@ -99,6 +100,8 @@ int main(int argc, char** argv)
const char* progname;
+ setlocale(LC_ALL, "");
+
progname = strrchr(*argv, '/');
if (progname) {
++progname;

@ -0,0 +1,44 @@
/*
* localepaper: print the dimensions in mm of the current locale's
* paper size, if possible.
*
* Based on a patch by Caolan McNamara:
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213
*
* Copyright (C) Reuben Thomas <rrt@sc3d.org>, 2013.
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#if defined LC_PAPER && defined _GNU_SOURCE
#include <langinfo.h>
#endif
#include "progname.h"
int main(int argc, char *argv[])
{
set_program_name(argv[0]);
argc = argc; /* Avoid a compiler warning. */
#if defined LC_PAPER && defined _GNU_SOURCE
setlocale(LC_ALL, "");
#define NL_PAPER_GET(x) \
((union { char *string; unsigned word; })nl_langinfo(x)).word
printf("%d %d\n", NL_PAPER_GET(_NL_PAPER_WIDTH), NL_PAPER_GET(_NL_PAPER_HEIGHT));
return EXIT_SUCCESS;
#else
printf("%s: locale paper size information is not supported on this system", program_name);
return EXIT_FAILURE;
#endif
}

@ -1,22 +1,18 @@
#%%global nmu +nmu4
Name: libpaper
Version: 1.1.28
Release: 4%{?dist}
Version: 2.1.1
Release: 7%{?dist}
# Needed to replace separate paper package
Epoch: 1
Summary: Library and tools for handling papersize
License: GPLv2
URL: http://packages.qa.debian.org/libp/libpaper.html
Source0: http://ftp.debian.org/debian/pool/main/libp/libpaper/%{name}_%{version}.tar.gz
# Filed upstream as:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213
Patch2: libpaper-useglibcfallback.patch
# Memory leak
Patch3: libpaper-file-leak.patch
# memory leak found by covscan, reported to debian upstream
#Patch4: libpaper-covscan.patch
# libpaper is LGPL-2.1+
# bundled libgnu is LGPL-2.1+, LGPL-2+ and GPL-3+
# paperspecs is Public Domain
# localepaper.c is FSFAP
License: LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND GPL-3.0-or-later AND LGPL-2.0-or-later AND FSFAP
URL: https://github.com/rrthomas/libpaper/
Source0: https://github.com/rrthomas/libpaper/archive/v%{version}/%{name}-%{version}.tar.gz
# Pulled from paper
Source1: localepaper.c
# gcc is no longer in buildroot by default
BuildRequires: gcc
@ -24,79 +20,160 @@ BuildRequires: gcc
BuildRequires: git-core
# uses make
BuildRequires: make
BuildRequires: libtool, gettext, gawk
BuildRequires: libtool, gettext, gawk, autoconf, automake
BuildRequires: help2man, tar, gnupg2, perl-interpreter
Provides: bundled(gnulib)
%description
The paper library and accompanying files are intended to provide a
simple way for applications to take actions based on a system- or
user-specified paper size. This release is quite minimal, its purpose
being to provide really basic functions (obtaining the system paper name
and getting the height and width of a given kind of paper) that
applications can immediately integrate.
The libpaper package enables users to indicate their preferred paper
size and specifies system-wide and per-user paper size catalogues, which can
also be used directly (see paperspecs(5)).
%package devel
Summary: Headers/Libraries for developing programs that use libpaper
Requires: %{name} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%description devel
This package contains headers and libraries that programmers will need
This package contains headers and libraries that programmers will need
to develop applications which use libpaper.
%package -n paper
Summary: Print paper size information
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
# This is licensed differently from libpaper.
# paper.c is GPL-3.0-or-later
# paperconf.c is GPL 2.0 only
# localepaper.c is FSFAP (except it is missing the warranty disclaimer... but the intent is clear)
License: GPL-3.0-or-later AND FSFAP AND GPL-2.0-only
%description -n paper
The paper(1) utility can be used to find the user's preferred
default paper size and give information about known sizes.
%prep
%autosetup -S git
libtoolize
cp %{SOURCE1} src/
%if 0
sed -i 's|gnulib_tool=$gnulib_path/gnulib-tool|gnulib_tool=%{_bindir}/gnulib-tool|g' bootstrap
sed -i 's|./gnulib/gnulib-tool|%{_bindir}/gnulib-tool|g' bootstrap.conf
sed -i '/doc\/INSTALL/d' bootstrap
./bootstrap --gnulib-srcdir=%{_datadir}/gnulib/ --skip-git
%endif
%build
touch AUTHORS NEWS
aclocal
autoheader
autoconf
automake -a
%configure --disable-static
# Disable rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build
# localepaper
pushd src
%{__cc} %{optflags} -I.. -Ilibgnu -o localepaper localepaper.c libgnu/.libs/libgnupaper.a %{_hardening_ldflags}
popd
%check
# No upstream tests
echo "Testing localepaper tool"
locale width height > expected
./src/localepaper | tr ' ' "\n" > got
diff -u expected got
# No real way to test the paper tool
%install
%make_install
rm $RPM_BUILD_ROOT%{_libdir}/*.la
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
echo '# Simply write the paper name. See papersize(5) for possible values' > $RPM_BUILD_ROOT%{_sysconfdir}/papersize
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/libpaper.d
# maybe someday the translations will return
%if 0
for i in cs da de es fr gl hu it ja nl pt_BR sv tr uk vi; do
mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/;
msgfmt debian/po/$i.po -o $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/%{name}.mo;
done
%find_lang %{name}
%endif
mkdir %{buildroot}%{_libexecdir}
install -m0755 src/localepaper %{buildroot}%{_libexecdir}
%ldconfig_scriptlets
%files -f %{name}.lang
%files
%doc ChangeLog README
%license COPYING
%config(noreplace) %{_sysconfdir}/papersize
%dir %{_sysconfdir}/libpaper.d
%{_bindir}/paperconf
%{_libdir}/libpaper.so.1.1.2
%{_libdir}/libpaper.so.1
%{_sbindir}/paperconfig
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%config(noreplace) %{_sysconfdir}/paperspecs
%{_libdir}/libpaper.so.2*
%files devel
%{_includedir}/paper.h
%{_libdir}/libpaper.so
%{_mandir}/man3/*
%files -n paper
%{_bindir}/paper
%{_bindir}/paperconf
%{_libexecdir}/localepaper
%{_mandir}/man1/*
%{_mandir}/man5/*
%changelog
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.1.28-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:2.1.1-7
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Fri Oct 25 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 1:2.1.1-6
- Rebuilt for MSVSphere 10
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1:2.1.1-6
- Bump release for June 2024 mass rebuild
* Mon May 13 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.1.1-5
- remove gnulib dependency and use bundled one
* Tue Apr 23 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.1.1-4
- RHEL-33500 - apply hardening ldflags for localepaper
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Jul 25 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.1.1-1
- 2.1.1
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Apr 14 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.1.0-1
- update to 2.1.0
* Fri Mar 3 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.0.10-1
- update to 2.0.10
* Thu Feb 23 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.0.9-1
- update to 2.0.9
* Tue Feb 14 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.0.8-1
- update to 2.0.8
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Jan 9 2023 Tom Callaway <spot@fedoraproject.org> - 2.0.4-2
- move /etc/paperspecs to libpaper to ensure proper functionality in cases where paper subpackage
is not installed
- fix Requires to include epoch
* Sun Jan 8 2023 Tom Callaway <spot@fedoraproject.org> - 2.0.4-1
- update to 2.0.4
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.1.28-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

Loading…
Cancel
Save