Compare commits

..

No commits in common. "a06ac92a2e21c44467b206fa5f67afb3b4e1b755" and "a676f4a3edc976be6df9c422765344f5438700b6" have entirely different histories.

6 changed files with 52 additions and 84 deletions

BIN
psutils-1.23.tar.xz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,40 @@
diff -Nur a/PSUtils.pm b/PSUtils.pm diff -up psutils-1.23/configure.paperconf psutils-1.23/configure
--- a/PSUtils.pm 2024-04-07 16:45:42.263733801 +0800 --- psutils-1.23/configure.paperconf 2014-01-22 10:31:58.000000000 +0100
+++ b/PSUtils.pm 2024-04-07 16:46:22.289733801 +0800 +++ psutils-1.23/configure 2015-05-20 14:25:40.636115433 +0200
@@ -60,7 +60,7 @@ @@ -15700,7 +15700,7 @@ fi
# Get the size of the given paper, or the default paper if no argument given.
sub paper {
my ($cmd, $silent) = @_; if test -z "$PAPER"; then
- unshift @{$cmd}, "paper"; - PAPER=paper
+ unshift @{$cmd}, "paperconf"; + PAPER=paperconf
my $out; fi
run3 $cmd, undef, \$out, $silent ? \undef : undef, {return_if_system_error=>1};
Die("could not run `paper' command") if $? == -1;
diff -up psutils-1.23/psutil.c.paperconf psutils-1.23/psutil.c
--- psutils-1.23/psutil.c.paperconf 2014-01-16 11:20:54.000000000 +0100
+++ psutils-1.23/psutil.c 2015-05-29 13:24:12.834350330 +0200
@@ -88,13 +87,21 @@ int paper_size(const char *paper_name, d
int res = 0;
if (paper_name == NULL) /* Use default paper name */
paper_name = pgetline(PAPER);
- if (paper_name && (cmd = xasprintf(PAPER " --unit=pt --size %s", paper_name)) && (l = pgetline(cmd)))
- res = sscanf(l, "%lg %lg", width, height);
+ if (paper_name && (cmd = xasprintf(PAPER " -s %s", paper_name)) && (l = pgetline(cmd)))
+ {
+ for (int i = 0; i < strlen(l); i++)
+ {
+ if (l[i] == ',')
+ {
+ l[i] = '.';
+ }
+ }
+ res = sscanf(l, "%lg %lg", width, height);
+ }
free(l);
free(cmd);
return res == 2;
}
-
/* Make a file seekable, using temporary files if necessary */
FILE *seekable(FILE *fp)
{

View File

@ -1,29 +1,20 @@
# Don't generate debuginfo for new versions.
%define debug_package %{nil}
Name: psutils Name: psutils
Version: 2.08 Version: 1.23
Release: 3 Release: 15
Summary: Utilities for manipulating PostScript documents Summary: utilities for manipulating PostScript documents
License: psutils License: psutils
URL: https://github.com/rrthomas/psutils URL: https://github.com/rrthomas/psutils
# wget https://github.com/rrthomas/psutils/archive/v1.23.tar.gz && tar xf v1.23.tar.gz && cd psutils-1.23
# then run:
# ./bootstrap && autoreconf -vfi && cd .. && tar -cvf psutils-1.23.tar.gz psutils-1.23
Source0: %{name}-%{version}.tar.gz
Patch0: psutils-paperconf.patch
Patch1: rewrite-papersize.patch
BuildRequires: gcc # wget https://github.com/rrthomas/psutils/archive/master.zip && unzip master.zip && cd psutils-master/
BuildRequires: perl-generators # then run:
BuildRequires: perl(File::Basename) # ./bootstrap && autoreconf -vfi && ./configure && make dist-xz
BuildRequires: perl(Getopt::Long) Source0: %{name}-%{version}.tar.xz
BuildRequires: perl(strict) Patch0: psutils-paperconf.patch
BuildRequires: perl(warnings)
BuildRequires: gcc perl-generators
Requires: /usr/bin/paperconf Requires: /usr/bin/paperconf
Provides: bundled(gnulib) Provides: bundled(gnulib) psutils-perl
Provides: psutils-perl = %{version}-%{release} Obsoletes: psutils-perl
Obsoletes: psutils-perl < %{version}-%{release}
%package_help %package_help
@ -49,7 +40,6 @@ make %{?_smp_mflags}
%defattr(-,root,root) %defattr(-,root,root)
%doc LICENSE %doc LICENSE
%{_bindir}/* %{_bindir}/*
%{_datadir}/%{name}
%files help %files help
%defattr(-,root,root) %defattr(-,root,root)
@ -57,14 +47,5 @@ make %{?_smp_mflags}
%{_mandir}/man1/*1* %{_mandir}/man1/*1*
%changelog %changelog
* Fri Apr 19 2024 Ge Wang <wang__ge@126.com> - 2.08-3
- Rewrite papersize to fix psnup psresize execute error
* Sun Apr 07 2024 wulei <wu_lei@hoperun.com> - 2.08-2
- Fix could not run 'paper' command
* Fri May 06 2022 misaka00251 <misaka00251@misakanet.cn> - 2.08-1
- Upgrade package version
* Tue Dec 10 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.23-15 * Tue Dec 10 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.23-15
- Package init - Package init

View File

@ -1,4 +0,0 @@
version_control: github
src_repo: rrthomas/psutils
tag_prefix: "^v"
seperator: "."

View File

@ -1,37 +0,0 @@
From 9aed7b37ac2740cf577165d4e3e348fcf17ab4f7 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Fri, 19 Apr 2024 15:37:37 +0800
Subject: [PATCH] rewrite papersize
---
PSUtils.pm | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/PSUtils.pm b/PSUtils.pm
index 9a95056..8b64247 100644
--- a/PSUtils.pm
+++ b/PSUtils.pm
@@ -73,13 +73,16 @@ sub paper {
sub paper_size {
my ($paper_name) = @_;
chomp($paper_name = paper([])) unless defined($paper_name);
- my $dimensions = paper(["--unit=pt", "$paper_name"], 1) or return;
- $dimensions =~ / ([.0-9]+)x([.0-9]+) pt$/;
+ my $dimensions_w = paper(["-p", "$paper_name", "-m", "-w"], 1) or return;
+ $dimensions_w =~ / ([.0-9]+) mm$/;
my $old_locale = setlocale(LC_ALL);
setlocale(LC_ALL, "");
- my ($w, $w_unparsed) = strtod($1);
- my ($h, $h_unparsed) = strtod($2);
+ my ($w, $w_unparsed) = strtod($dimensions_w);
+ my $dimensions_h = paper(["-p", "$paper_name", "-m", "-h"], 1) or return;
+ $dimensions_h =~ / ([.0-9]+) mm$/;
+ my ($h, $h_unparsed) = strtod($dimensions_h);
setlocale(LC_ALL, $old_locale);
+ print($w,$h, $dimensions_w, $dimensions_h);
return int($w + 0.5), int($h + 0.5); # round dimensions to nearest point
}
--
2.33.0