RHEL-25806 [lprint] rebase lprint to 1.3.1 or newer upstream version

Resolves: RHEL-25806
This commit is contained in:
Zdenek Dohnal 2024-07-17 14:55:07 +02:00
parent 61eebc91c9
commit 8adbe0a972
4 changed files with 117 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/lprint-1.0.tar.gz
/lprint-1.1.0.tar.gz
/lprint-1.2.0.tar.gz
/lprint-1.3.1.tar.gz

View File

@ -0,0 +1,103 @@
From 648bc2017192fe84c94ab6929c8def982069a8f7 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <msweet@msweet.org>
Date: Sun, 18 Feb 2024 19:09:51 -0500
Subject: [PATCH] Update state filename to current PAPPL standard, rename old
state filenames (Issue #129)
---
CHANGES.md | 2 +-
lprint.c | 39 +++++++++++++++++++++++++++++++++------
2 files changed, 34 insertions(+), 7 deletions(-)
v1.3.1 - February 9, 2024
diff --git a/lprint.c b/lprint.c
index 81c542a..435e9aa 100644
--- a/lprint.c
+++ b/lprint.c
@@ -465,6 +465,7 @@ system_cb(
*logfile, // Log file, if any
*spooldir, // Spool directory, if any
*system_name; // System name, if any
+ char oldfile[1024]; // Old configuration filename
pappl_loglevel_t loglevel; // Log level
int port = 0; // Port number, if any
pappl_soptions_t soptions = PAPPL_SOPTIONS_MULTI_QUEUE | PAPPL_SOPTIONS_WEB_INTERFACE | PAPPL_SOPTIONS_WEB_LOG | PAPPL_SOPTIONS_WEB_SECURITY;
@@ -554,27 +555,31 @@ system_cb(
if ((val = getenv("SNAP_DATA")) != NULL)
{
snprintf(lprint_spooldir, sizeof(lprint_spooldir), "%s/lprint.d", val);
- snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/lprint.conf", val);
+ snprintf(oldfile, sizeof(oldfile), "%s/lprint.conf", val);
+ snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/lprint.state", val);
if (!spooldir)
spooldir = lprint_spooldir;
}
else if ((val = getenv("XDG_DATA_HOME")) != NULL)
{
- snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/.lprint.conf", val);
+ snprintf(oldfile, sizeof(oldfile), "%s/.lprint.conf", val);
+ snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/lprint.state", val);
}
#ifdef _WIN32
else if ((val = getenv("USERPROFILE")) != NULL)
{
snprintf(lprint_spooldir, sizeof(lprint_spooldir), "%s/AppData/Local/lprint.d", val);
- snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/AppData/Local/lprint.ini", val);
+ snprintf(oldfile, sizeof(oldfile), "%s/AppData/Local/lprint.ini", val);
+ snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/AppData/Local/lprint.state", val);
if (!spooldir)
spooldir = lprint_spooldir;
}
else
{
- papplCopyString(lprint_statefile, "/lprint.ini", sizeof(lprint_statefile));
+ papplCopyString(oldfile, "/lprint.ini", sizeof(oldfile));
+ papplCopyString(lprint_statefile, "/lprint.state", sizeof(lprint_statefile));
}
#else
else if ((val = getenv("HOME")) != NULL)
@@ -586,15 +591,37 @@ system_cb(
if (!spooldir)
spooldir = lprint_spooldir;
# else
- snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/.lprint.conf", val);
+ snprintf(oldfile, sizeof(oldfile), "%s/.config", val);
+ if (access(oldfile, 0))
+ {
+ if (mkdir(oldfile, 0777))
+ {
+ perror(oldfile);
+ return (NULL);
+ }
+ }
+
+ snprintf(oldfile, sizeof(oldfile), "%s/.lprint.conf", val);
+ snprintf(lprint_statefile, sizeof(lprint_statefile), "%s/.config/lprint.state", val);
# endif // __APPLE__
}
else
{
- papplCopyString(lprint_statefile, "/etc/lprint.conf", sizeof(lprint_statefile));
+ papplCopyString(oldfile, "/etc/lprint.conf", sizeof(oldfile));
+# ifdef __APPLE__
+ papplCopyString(lprint_statefile, "/private/var/lib/lprint.state", sizeof(lprint_statefile));
+# else
+ papplCopyString(lprint_statefile, "/var/lib/lprint.state", sizeof(lprint_statefile));
+# endif // __APPLE__
}
#endif // _WIN32
+ if (!access(oldfile, 0) && access(lprint_statefile, 0))
+ {
+ // Move old state file to new name...
+ rename(oldfile, lprint_statefile);
+ }
+
if (spooldir && access(spooldir, 0))
{
if (mkdir(spooldir, 0777))
--
2.43.2

View File

@ -2,8 +2,8 @@
%global _hardened_build 1
Name: lprint
Version: 1.2.0
Release: 7%{?dist}
Version: 1.3.1
Release: 1%{?dist}
Summary: A Label Printer Application
License: Apache-2.0
@ -12,30 +12,29 @@ Source0: https://github.com/michaelrsweet/%{name}/releases/download/v%{version}/
# UPSTREAM PATCHES
# fix putting state file into correct place
# https://github.com/michaelrsweet/lprint/commit/648bc20171
Patch001: 0001-Update-state-filename-to-current-PAPPL-standard-rena.patch
# dns-sd support for register/sharing devices
BuildRequires: pkgconfig(avahi-client) >= 0.7
# uses CUPS API for arrays, options, rastering, HTTP, IPP support
BuildRequires: cups-devel >= 2.2.0
BuildRequires: pkgconfig(cups) >= 2.4.0
# written in C
BuildRequires: gcc
# for autosetup
BuildRequires: git-core
# PNG printing support
BuildRequires: pkgconfig(libpng) >= 1.6.0
# USB printing support
BuildRequires: pkgconfig(libusb-1.0) >= 1.0
# uses Makefile
BuildRequires: make
# the basic printer application related structures are now implemented in PAPPL
BuildRequires: pkgconfig(pappl) >= 1.1
BuildRequires: pkgconfig(pappl) >= 1.2
# using pkg-config in configure script
BuildRequires: pkgconf-pkg-config
# for macros in rpm scriptlets
BuildRequires: systemd-rpm-macros
# lprint server can run as a systemd servicea, but to don't require systemd by default,
# lprint server can run as a systemd service, but to don't require systemd by default,
# require filesystem (provides /usr/lib/systemd/system too)
Requires: filesystem
@ -87,6 +86,7 @@ export CC=%{__cc}
%{_mandir}/man1/lprint-drivers.1*
%{_mandir}/man1/lprint-jobs.1*
%{_mandir}/man1/lprint-modify.1*
%{_mandir}/man1/lprint-options.1*
%{_mandir}/man1/lprint-printers.1*
%{_mandir}/man1/lprint-server.1*
%{_mandir}/man1/lprint-shutdown.1*
@ -98,6 +98,9 @@ export CC=%{__cc}
%changelog
* Wed Jul 17 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1.3.1-1
- RHEL-25806 [lprint] rebase lprint to 1.3.1 or newer upstream version
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.2.0-7
- Bump release for June 2024 mass rebuild

View File

@ -1 +1 @@
SHA512 (lprint-1.2.0.tar.gz) = 36dd092977ba1b516c823c9804885348587dcea462a305b3d640e9fe673d04c6187088e5bea7af065814ed07a5a7bfeb0cf073de0a18bfe34ed51ba483496e62
SHA512 (lprint-1.3.1.tar.gz) = 9bb174f8325231cf2fbe194f4d2fca8197aa74f296d7e58b53defe26108bc1aeca7fb73b91634b0e2cf012701f57cd074808fad8472cc5a9878faabefe8c158f