From 4016e4545b57828c7598fbc89575896c8d4cc18f Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Fri, 25 Oct 2024 16:50:21 +0300 Subject: [PATCH] import lprint-1.3.1-3.el10 --- .gitignore | 1 + .lprint.metadata | 1 + ...ename-to-current-PAPPL-standard-rena.patch | 103 +++++++++++ ...print.c-Enable-TLS-support-in-Web-UI.patch | 43 +++++ SOURCES/lprint.conf | 11 ++ SPECS/lprint.spec | 172 ++++++++++++++++++ 6 files changed, 331 insertions(+) create mode 100644 .gitignore create mode 100644 .lprint.metadata create mode 100644 SOURCES/0001-Update-state-filename-to-current-PAPPL-standard-rena.patch create mode 100644 SOURCES/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch create mode 100644 SOURCES/lprint.conf create mode 100644 SPECS/lprint.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fbf157b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/lprint-1.3.1.tar.gz diff --git a/.lprint.metadata b/.lprint.metadata new file mode 100644 index 0000000..0961d51 --- /dev/null +++ b/.lprint.metadata @@ -0,0 +1 @@ +a6af2dcd2c5b3d7bae6a36d60129255514ffab0f SOURCES/lprint-1.3.1.tar.gz diff --git a/SOURCES/0001-Update-state-filename-to-current-PAPPL-standard-rena.patch b/SOURCES/0001-Update-state-filename-to-current-PAPPL-standard-rena.patch new file mode 100644 index 0000000..c675115 --- /dev/null +++ b/SOURCES/0001-Update-state-filename-to-current-PAPPL-standard-rena.patch @@ -0,0 +1,103 @@ +From 648bc2017192fe84c94ab6929c8def982069a8f7 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +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 + diff --git a/SOURCES/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch b/SOURCES/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch new file mode 100644 index 0000000..709bcc7 --- /dev/null +++ b/SOURCES/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch @@ -0,0 +1,43 @@ +From 641efd2de2c57d06389b869943aaf7517d52645c Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Tue, 6 Aug 2024 15:16:27 +0200 +Subject: [PATCH] lprint.c: Enable TLS support in Web UI + +Currently (1.3.1) there is no way how to turn TLS web UI pages, because +system callback does not set WEB_TLS option by default, and checks only +for `no-tls` when processing server options. + +This can be fixed by two way, depending on which default settings we +prefer. The PR enables TLS pages by default, leaving to user whether he +wants them to be disabled. + +Do let me know if you would prefer the other way around. +--- + lprint.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lprint.c b/lprint.c +index 435e9aa..8990379 100644 +--- a/lprint.c ++++ b/lprint.c +@@ -468,7 +468,7 @@ system_cb( + 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; ++ pappl_soptions_t soptions = PAPPL_SOPTIONS_MULTI_QUEUE | PAPPL_SOPTIONS_WEB_INTERFACE | PAPPL_SOPTIONS_WEB_LOG | PAPPL_SOPTIONS_WEB_SECURITY | PAPPL_SOPTIONS_WEB_TLS; + // System options + static pappl_version_t versions[1] = // Software versions + { +@@ -527,7 +527,7 @@ system_cb( + else if (!strcmp(valptr, "web-security") || !strncmp(valptr, "web-security,", 13)) + soptions |= PAPPL_SOPTIONS_WEB_SECURITY; + else if (!strcmp(valptr, "no-tls") || !strncmp(valptr, "no-tls,", 7)) +- soptions |= PAPPL_SOPTIONS_NO_TLS; ++ soptions &= (pappl_soptions_t)~PAPPL_SOPTIONS_WEB_TLS; + + if ((valptr = strchr(valptr, ',')) != NULL) + valptr ++; +-- +2.45.2 + diff --git a/SOURCES/lprint.conf b/SOURCES/lprint.conf new file mode 100644 index 0000000..4a3d235 --- /dev/null +++ b/SOURCES/lprint.conf @@ -0,0 +1,11 @@ +# multi-queue - Support multiple print queues. +# web-interface - Web UI. +# raw-socket - Provide a raw ("JetDirect") socket for each printer on port 91xx. +# web-network - Enables the network settings web page. +# web-remote - Enables remote queue management. +# web-security - Enables the user/password settings web page. +# web-tls - Enables the TLS settings web page. +server-options=multi-queue,web-interface,raw-socket,web-network,web-security,web-tls + +# server-port - Listens for IPP connections on the specified port. +server-port=8000 diff --git a/SPECS/lprint.spec b/SPECS/lprint.spec new file mode 100644 index 0000000..f716f69 --- /dev/null +++ b/SPECS/lprint.spec @@ -0,0 +1,172 @@ +# the package can work with devices from network, so use hardened build +%global _hardened_build 1 + +Name: lprint +Version: 1.3.1 +Release: 3%{?dist} +Summary: A Label Printer Application + +License: Apache-2.0 +URL: https://www.msweet.org/lprint +Source0: https://github.com/michaelrsweet/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz +Source1: lprint.conf + + +# 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 +# https://github.com/michaelrsweet/lprint/pull/151 +Patch002: 0001-lprint.c-Enable-TLS-support-in-Web-UI.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: pkgconfig(cups) >= 2.4.0 +# written in C +BuildRequires: gcc +# for autosetup +BuildRequires: git-core +# uses Makefile +BuildRequires: make +# the basic printer application related structures are now implemented in PAPPL +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 service, but to don't require systemd by default, +# require filesystem (provides /usr/lib/systemd/system too) +Requires: filesystem + +%description +LPrint is a label printer application for macOS and Linux. Basically, +LPrint is a print spooler optimized for label printing. It accepts +"raw" print data as well as PNG images (like those used for shipping +labels by most shippers' current web APIs) and has built-in "drivers" +to send the print data to USB and network-connected label printers. + + +%prep +%autosetup -S git + + +%build +# use gcc +export CC=%{__cc} + +# get system default CFLAGS and LDFLAGS +%set_build_flags + +%configure + +%make_build + + +%install +%make_install DESTDIR='' + +install -p -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/lprint.conf + +%pre +if [ $1 -gt 1 ] +then + if test ! -f /var/lib/lprint.state -a -f /etc/lprint.conf + then + # if the lprint.conf is the default one from RPM, do not move + grep -q "^# Fedora default configuration" lprint.conf || mv -f /etc/lprint.conf /var/lib/lprint.state + fi +fi + +%post +%systemd_post lprint.service + +%preun +%systemd_preun lprint.service + +%postun +%systemd_postun_with_restart lprint.service + +%files +%doc README.md DOCUMENTATION.md CONTRIBUTING.md CHANGES.md +%license LICENSE NOTICE +%config(noreplace) %{_sysconfdir}/lprint.conf +%{_bindir}/lprint +%{_mandir}/man1/lprint-add.1* +%{_mandir}/man1/lprint-cancel.1* +%{_mandir}/man1/lprint-default.1* +%{_mandir}/man1/lprint-delete.1* +%{_mandir}/man1/lprint-devices.1* +%{_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* +%{_mandir}/man1/lprint-status.1* +%{_mandir}/man1/lprint-submit.1* +%{_mandir}/man1/lprint.1* +%{_mandir}/man5/lprint.conf.5* +%{_unitdir}/lprint.service + + +%changelog +* Fri Oct 25 2024 MSVSphere Packaging Team - 1.3.1-3 +- Rebuilt for MSVSphere 10 + +* Thu Aug 08 2024 Zdenek Dohnal - 1.3.1-3 +- rebuilt with updated pappl + +* Tue Aug 06 2024 Zdenek Dohnal - 1.3.1-2 +- RHEL-25502 set common server settings by /etc/lprint.conf + +* Wed Jul 17 2024 Zdenek Dohnal - 1.3.1-1 +- RHEL-25806 [lprint] rebase lprint to 1.3.1 or newer upstream version + +* Mon Jun 24 2024 Troy Dawson - 1.2.0-7 +- Bump release for June 2024 mass rebuild + +* Thu Jan 25 2024 Fedora Release Engineering - 1.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 1.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jul 26 2023 Zdenek Dohnal - 1.2.0-4 +- SPDX migration and require filesystem instead of systemd + +* Thu Jul 20 2023 Fedora Release Engineering - 1.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jan 19 2023 Fedora Release Engineering - 1.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Jan 03 2023 Zdenek Dohnal - 1.2.0-1 +- 2157610 - lprint-1.2.0 is available + +* Thu Jul 21 2022 Fedora Release Engineering - 1.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Fri May 06 2022 Zdenek Dohnal - 1.1.0-3 +- path to lprint was hardcoded in service file + +* Thu Jan 20 2022 Fedora Release Engineering - 1.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Tue Jan 04 2022 Zdenek Dohnal - 1.1.0-1 +- 2035381 - lprint-1.1.0 is available + +* Thu Jul 22 2021 Fedora Release Engineering - 1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Nov 05 2020 Zdenek Dohnal - 1.0-2 +- use smaller git-core instead of git + +* Mon Aug 17 2020 Zdenek Dohnal - 1.0-1 +- Initial import (#1867587)