Compare commits
10 Commits
a676f4a3ed
...
a06ac92a2e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a06ac92a2e | ||
|
|
a73ae69ef6 | ||
|
|
bb7f238db3 | ||
|
|
dfb960f093 | ||
|
|
3de0f45c1f | ||
|
|
bbc9bef226 | ||
|
|
9ff8c31af3 | ||
|
|
28f6976ced | ||
|
|
543d5b19f9 | ||
|
|
fd572dcff9 |
Binary file not shown.
BIN
psutils-2.08.tar.gz
Normal file
BIN
psutils-2.08.tar.gz
Normal file
Binary file not shown.
@ -1,40 +1,12 @@
|
|||||||
diff -up psutils-1.23/configure.paperconf psutils-1.23/configure
|
diff -Nur a/PSUtils.pm b/PSUtils.pm
|
||||||
--- psutils-1.23/configure.paperconf 2014-01-22 10:31:58.000000000 +0100
|
--- a/PSUtils.pm 2024-04-07 16:45:42.263733801 +0800
|
||||||
+++ psutils-1.23/configure 2015-05-20 14:25:40.636115433 +0200
|
+++ b/PSUtils.pm 2024-04-07 16:46:22.289733801 +0800
|
||||||
@@ -15700,7 +15700,7 @@ fi
|
@@ -60,7 +60,7 @@
|
||||||
|
# Get the size of the given paper, or the default paper if no argument given.
|
||||||
|
sub paper {
|
||||||
if test -z "$PAPER"; then
|
my ($cmd, $silent) = @_;
|
||||||
- PAPER=paper
|
- unshift @{$cmd}, "paper";
|
||||||
+ PAPER=paperconf
|
+ unshift @{$cmd}, "paperconf";
|
||||||
fi
|
my $out;
|
||||||
|
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)
|
|
||||||
{
|
|
||||||
|
|||||||
39
psutils.spec
39
psutils.spec
@ -1,20 +1,29 @@
|
|||||||
|
# Don't generate debuginfo for new versions.
|
||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
Name: psutils
|
Name: psutils
|
||||||
Version: 1.23
|
Version: 2.08
|
||||||
Release: 15
|
Release: 3
|
||||||
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
|
||||||
# wget https://github.com/rrthomas/psutils/archive/master.zip && unzip master.zip && cd psutils-master/
|
|
||||||
# then run:
|
# then run:
|
||||||
# ./bootstrap && autoreconf -vfi && ./configure && make dist-xz
|
# ./bootstrap && autoreconf -vfi && cd .. && tar -cvf psutils-1.23.tar.gz psutils-1.23
|
||||||
Source0: %{name}-%{version}.tar.xz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
Patch0: psutils-paperconf.patch
|
Patch0: psutils-paperconf.patch
|
||||||
|
Patch1: rewrite-papersize.patch
|
||||||
|
|
||||||
BuildRequires: gcc perl-generators
|
BuildRequires: gcc
|
||||||
|
BuildRequires: perl-generators
|
||||||
|
BuildRequires: perl(File::Basename)
|
||||||
|
BuildRequires: perl(Getopt::Long)
|
||||||
|
BuildRequires: perl(strict)
|
||||||
|
BuildRequires: perl(warnings)
|
||||||
Requires: /usr/bin/paperconf
|
Requires: /usr/bin/paperconf
|
||||||
Provides: bundled(gnulib) psutils-perl
|
Provides: bundled(gnulib)
|
||||||
Obsoletes: psutils-perl
|
Provides: psutils-perl = %{version}-%{release}
|
||||||
|
Obsoletes: psutils-perl < %{version}-%{release}
|
||||||
|
|
||||||
%package_help
|
%package_help
|
||||||
|
|
||||||
@ -40,6 +49,7 @@ 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)
|
||||||
@ -47,5 +57,14 @@ 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
|
||||||
|
|||||||
4
psutils.yaml
Normal file
4
psutils.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version_control: github
|
||||||
|
src_repo: rrthomas/psutils
|
||||||
|
tag_prefix: "^v"
|
||||||
|
seperator: "."
|
||||||
37
rewrite-papersize.patch
Normal file
37
rewrite-papersize.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
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
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user