Skip to contentSkip to conversation

Update and improve squid

PATCH New [email protected] 1 participant 7 messages Nov 30, 2023

lore
Share & tools
lore
#0 lore raw

cover Update and improve squid

From: Patrick Wicki <[email protected]>

Update to the latest upstream version and clean up / refresh patches.

While at it, I made the package more configurable. A lot of dependencies are only relevant for authentication. We actually even remove the perl RDEPENDS downstream along with disabling auth and things seem to work just fine... But tbh I don't understand when and how exactly squid uses perl, so I didn't feel comfortable including that change.

This is my first patch here, so I'm not very familiar with the conventions yet. Commits are pretty fine-grained, and I omitted the changelog since it'd be huge.

Patrick Wicki (6):
squid: update from v5.7 to v6.5
squid: add nm dispatcher reload hook
squid: add auth packageconfig
squid: move configs to sub package
squid: add url-rewrite-helpers packageconfig
squid: add systemd service

 ...for-Wno-error-format-truncation-comp.patch | 18 ++---
 ...quid-conf-tests-run-on-target-device.patch | 74 +++++++++++++++++++
 ...d-dynamic-ldb-link-test-in-configure.patch | 40 ----------
 .../files/Set-up-for-cross-compilation.patch  | 10 +--
 .../files/Skip-AC_RUN_IFELSE-tests.patch      | 25 +++----
 .../recipes-daemons/squid/files/run-ptest     |  1 +
 .../squid/files/set_sysroot_patch.patch       | 41 ----------
 ...-t-do-squid-conf-tests-at-build-time.patch | 61 ---------------
 .../recipes-daemons/squid/files/squid.nm      |  7 ++
 .../squid/{squid_5.7.bb => squid_6.5.bb}      | 66 +++++++++++------
 10 files changed, 150 insertions(+), 193 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/squid/files/0002-squid-make-squid-conf-tests-run-on-target-device.patch
 delete mode 100644 meta-networking/recipes-daemons/squid/files/Fix-flawed-dynamic-ldb-link-test-in-configure.patch
 delete mode 100644 meta-networking/recipes-daemons/squid/files/set_sysroot_patch.patch
 delete mode 100644 meta-networking/recipes-daemons/squid/files/squid-don-t-do-squid-conf-tests-at-build-time.patch
 create mode 100644 meta-networking/recipes-daemons/squid/files/squid.nm
 rename meta-networking/recipes-daemons/squid/{squid_5.7.bb => squid_6.5.bb} (66%)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/6 squid: update from v5.7 to v6.5

From: Patrick Wicki <[email protected]>

Refresh patches and clean up ones that are no longer needed:

* dlopen test was removed in b65d2165c5c250242764ed7cdac4540fba813dec
* libxml2 variables were removed in 866a092dad01e58986a6e9ecb84ac89037a63e9a
* squid-conf-tests no longer run at build time since cd3dc147bf8abc0225237ced865c6660fffcb63a

Fix squid-conf-tests to allow running on target device.

License change: Update year

The version update eliminates the following CVEs:

* CVE-2023-5824 (affected: <6.4)
* CVE-2023-46724 (affected: >=3.3.0.1, <6.4)
* CVE-2023-46728 (affected: <6.0.1)
* CVE-2023-46846 (affected: >=2.6, <6.4)
* CVE-2023-46847 (affected: >=3.2.0.1, <6.4)
* CVE-2023-46848 (affected: >=5.0.3, <6.4)

---
 ...for-Wno-error-format-truncation-comp.patch | 18 ++---
 ...quid-conf-tests-run-on-target-device.patch | 74 +++++++++++++++++++
 ...d-dynamic-ldb-link-test-in-configure.patch | 40 ----------
 .../files/Set-up-for-cross-compilation.patch  | 10 +--
 .../files/Skip-AC_RUN_IFELSE-tests.patch      | 25 +++----
 .../recipes-daemons/squid/files/run-ptest     |  1 +
 .../squid/files/set_sysroot_patch.patch       | 41 ----------
 ...-t-do-squid-conf-tests-at-build-time.patch | 61 ---------------
 .../squid/{squid_5.7.bb => squid_6.5.bb}      | 27 +++----
 9 files changed, 110 insertions(+), 187 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/squid/files/0002-squid-make-squid-conf-tests-run-on-target-device.patch
 delete mode 100644 meta-networking/recipes-daemons/squid/files/Fix-flawed-dynamic-ldb-link-test-in-configure.patch
 delete mode 100644 meta-networking/recipes-daemons/squid/files/set_sysroot_patch.patch
 delete mode 100644 meta-networking/recipes-daemons/squid/files/squid-don-t-do-squid-conf-tests-at-build-time.patch
 rename meta-networking/recipes-daemons/squid/{squid_5.7.bb => squid_6.5.bb} (81%)
meta-networking/recipes-daemons/squid/files/0001-configure-Check-for-Wno-error-format-truncation-comp.patch +9 -9
index acebd6dce..a478dcd80 100644
@@ -1,4 +1,4 @@
-From c21adbb0b230ffba97cf5d059e2bd024e13a37df Mon Sep 17 00:00:00 2001
+From 38e7e90cc2075952c1b74f5fca826f9c6cadb2f0 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Sat, 22 Apr 2017 11:54:57 -0700
 Subject: [PATCH] configure: Check for -Wno-error=format-truncation compiler
@@ -13,8 +13,8 @@ Signed-off-by: Khem Raj <[email protected]>
 ---
 Upstream-Status: Pending
 
- acinclude/ax_check_compile_flag.m4 | 74 ++++++++++++++++++++++++++++++++++++++
- configure.ac                       |  2 ++
+ acinclude/ax_check_compile_flag.m4 | 74 ++++++++++++++++++++++++++++++
+ configure.ac                       |  2 +
  2 files changed, 76 insertions(+)
  create mode 100644 acinclude/ax_check_compile_flag.m4
 
@@ -99,20 +99,20 @@ index 0000000..dcabb92
 +AS_VAR_POPDEF([CACHEVAR])dnl
 +])dnl AX_CHECK_COMPILE_FLAGS
 diff --git a/configure.ac b/configure.ac
-index ff4688c..9382fdf 100644
+index 2543676..4635474 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -26,6 +26,7 @@ m4_include([acinclude/pkg.m4])
+@@ -28,6 +28,7 @@ m4_include([acinclude/pkg.m4])
+ m4_include([acinclude/tdb.m4])
  m4_include([acinclude/lib-checks.m4])
- m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
- m4_include([acinclude/ax_cxx_0x_types.m4])
+ m4_include([acinclude/ax_cxx_compile_stdcxx.m4])
 +m4_include([acinclude/ax_check_compile_flag.m4])
  
  HOSTCXX="$BUILD_CXX"
  PRESET_CFLAGS="$CFLAGS"
-@@ -44,6 +45,7 @@ AC_PROG_CXX
+@@ -59,6 +60,7 @@ AC_USE_SYSTEM_EXTENSIONS
+ 
  AC_LANG([C++])
- AC_CANONICAL_HOST
  
 +AX_CHECK_COMPILE_FLAG([-Werror=format-truncation],[CFLAGS="$CFLAGS -Wno-error=format-truncation" CXXFLAGS="$CXXFLAGS -Wno-error=format-truncation"])
  # Clang 3.2 on some CPUs requires -march-native to detect correctly.
meta-networking/recipes-daemons/squid/files/0002-squid-make-squid-conf-tests-run-on-target-device.patch new file +74 -0

74 lines not on this page · raw message

meta-networking/recipes-daemons/squid/files/Fix-flawed-dynamic-ldb-link-test-in-configure.patch deleted +0 -40
deleted file mode 100644
index 738e609c0..000000000
@@ -1,40 +0,0 @@
-From b73b802282bf95d214c86ba943c5765ba6930bc1 Mon Sep 17 00:00:00 2001
-From: Jim Somerville <[email protected]>
-Date: Mon, 21 Oct 2013 12:50:44 -0400
-Subject: [PATCH] Fix flawed dynamic -ldb link test in configure
-
-The test uses dbopen, but just ignores the fact
-that this function may not exist in the db version
-used.  This leads to the dynamic link test failing
-and the configure script just making assumptions
-about why and setting the need for -ldb incorrectly.
-
-Signed-off-by: Jim Somerville <[email protected]>
-
----
-Upstream-Status: Pending
-
- configure.ac | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index d2f7feb..c7ae568 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3268,6 +3268,16 @@ case "$host" in
- 		;;
- esac
- 
-+if test "x$ac_cv_have_decl_dbopen" = "xyes"; then
-+  dnl 1.85
-+  SQUID_CHECK_DBOPEN_NEEDS_LIBDB
-+else
-+  # dbopen isn't there. So instead of running a compile/link test that
-+  # uses it and is thus guaranteed to fail, we just assume that we will
-+  # need to link in the db library, rather than fabricate some other
-+  # dynamic compile/link test.
-+  ac_cv_dbopen_libdb="yes"
-+fi
- dnl System-specific library modifications
- dnl
- case "$host" in
meta-networking/recipes-daemons/squid/files/Set-up-for-cross-compilation.patch +5 -5
index ffb737164..ae8706df7 100644
@@ -1,4 +1,4 @@
-From 995aaf30799fa972441354b6feb45f0621968929 Mon Sep 17 00:00:00 2001
+From c0be3192f608037682464bcb728e97f9d9b543aa Mon Sep 17 00:00:00 2001
 From: Jim Somerville <[email protected]>
 Date: Wed, 16 Oct 2013 16:41:03 -0400
 Subject: [PATCH] Set up for cross compilation
@@ -17,12 +17,12 @@ Upstream-Status: Pending
  1 file changed, 1 insertion(+)
 
 diff --git a/configure.ac b/configure.ac
-index fe80ee0..57cd1ac 100644
+index ca0bc79..c222851 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -27,6 +27,7 @@ m4_include([acinclude/lib-checks.m4])
- m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
- m4_include([acinclude/ax_cxx_0x_types.m4])
+@@ -29,6 +29,7 @@ m4_include([acinclude/tdb.m4])
+ m4_include([acinclude/lib-checks.m4])
+ m4_include([acinclude/ax_cxx_compile_stdcxx.m4])
  
 +HOSTCXX="$BUILD_CXX"
  PRESET_CFLAGS="$CFLAGS"
meta-networking/recipes-daemons/squid/files/Skip-AC_RUN_IFELSE-tests.patch +12 -13
index 10853333e..5bb30bfcb 100644
@@ -1,4 +1,4 @@
-From e4778299a3e49a634d2c7fe4fd9ac77777e829e3 Mon Sep 17 00:00:00 2001
+From 050f8ab275a7a5f3d94045da6b15a2b63dfbeb3f Mon Sep 17 00:00:00 2001
 From: Jim Somerville <[email protected]>
 Date: Tue, 14 Oct 2014 02:56:08 -0400
 Subject: [PATCH] Skip AC_RUN_IFELSE tests
@@ -17,10 +17,10 @@ Signed-off-by: Jackie Huang <[email protected]>
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/acinclude/krb5.m4 b/acinclude/krb5.m4
-index ad0ba60..4477446 100644
+index 2c4e340..64648e3 100644
 --- a/acinclude/krb5.m4
 +++ b/acinclude/krb5.m4
-@@ -61,7 +61,15 @@ main(void)
+@@ -57,7 +57,15 @@ main(void)
  
          return 0;
  }
@@ -35,13 +35,13 @@ index ad0ba60..4477446 100644
 +     dnl Can't test in cross compiled env - so assume good
 +     squid_cv_broken_heimdal_krb5_h=no
      ])
+     SQUID_STATE_ROLLBACK(squid_krb5_heimdal_test)
    ])
- ]) dnl SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
 diff --git a/acinclude/lib-checks.m4 b/acinclude/lib-checks.m4
-index 1e9333527c..2d42787029 100644
+index 53847a8..850322a 100644
 --- a/acinclude/lib-checks.m4
 +++ b/acinclude/lib-checks.m4
-@@ -227,7 +227,9 @@ AC_DEFUN([SQUID_CHECK_OPENSSL_CONST_SSL_METHOD],[
+@@ -205,7 +205,9 @@ AC_DEFUN([SQUID_CHECK_OPENSSL_CONST_SSL_METHOD],[
    [
     AC_MSG_RESULT([no])
    ],
@@ -52,15 +52,14 @@ index 1e9333527c..2d42787029 100644
  
  SQUID_STATE_ROLLBACK(check_const_SSL_METHOD)
  ])
-@@ -386,8 +386,9 @@ AC_DEFUN([SQUID_CHECK_OPENSSL_TXTDB],[
-   [
-    AC_MSG_RESULT([yes])
-    AC_DEFINE(SQUID_USE_SSLLHASH_HACK, 1)
--  ],
--[])
+@@ -347,7 +349,9 @@ AC_DEFUN([SQUID_CHECK_OPENSSL_TXTDB],[
+   ],[
+     AC_MSG_RESULT([yes])
+     AC_DEFINE(SQUID_USE_SSLLHASH_HACK, 1)
+-  ],[])
 +  ],[
 +    AC_MSG_RESULT([skipped - can't test in cross-compiled env])
 +  ])
  
- SQUID_STATE_ROLLBACK(check_TXTDB)
+   SQUID_STATE_ROLLBACK(check_TXTDB)
  ])
meta-networking/recipes-daemons/squid/files/run-ptest +1 -0
index de79a293c..8f8e28f92 100644
@@ -1,3 +1,4 @@
 #!/bin/sh
 #
+make -C test-suite -k squid-conf-tests
 make -C test-suite -k runtest-TESTS
meta-networking/recipes-daemons/squid/files/set_sysroot_patch.patch deleted +0 -41

41 lines not on this page · raw message

meta-networking/recipes-daemons/squid/files/squid-don-t-do-squid-conf-tests-at-build-time.patch deleted +0 -61

61 lines not on this page · raw message

meta-networking/recipes-daemons/squid/squid_6.5.bb renamed from meta-networking/recipes-daemons/squid/squid_5.7.bb +9 -18
similarity index 81%
rename from meta-networking/recipes-daemons/squid/squid_5.7.bb
rename to meta-networking/recipes-daemons/squid/squid_6.5.bb
index 2a5de1872..3795da7f5 100644
@@ -15,21 +15,19 @@ MIN_VER = "${@oe.utils.trim_version("${PV}", 2)}"
 SRC_URI = "http://www.squid-cache.org/Versions/v${MAJ_VER}/${BPN}-${PV}.tar.bz2 \
            file://Set-up-for-cross-compilation.patch \
            file://Skip-AC_RUN_IFELSE-tests.patch \
-           file://Fix-flawed-dynamic-ldb-link-test-in-configure.patch \
            file://squid-use-serial-tests-config-needed-by-ptest.patch \
            file://run-ptest \
            file://volatiles.03_squid \
-           file://set_sysroot_patch.patch \
-           file://squid-don-t-do-squid-conf-tests-at-build-time.patch \
            file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
+           file://0002-squid-make-squid-conf-tests-run-on-target-device.patch \
            "
 
 SRC_URI:remove:toolchain-clang = "file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
 
-SRC_URI[sha256sum] = "4c17e1eb324c4b7aa3c6889eba66eeca7ed98625d44076f7db7b027b2b093bd5"
+SRC_URI[sha256sum] = "99acd54ec9d68b2a9080d19fcc43eca1a245146cf162dbba689510d01e6d0f25"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
-                    file://errors/COPYRIGHT;md5=0a7deb73d8fb7a9849af7145987829a4 \
+                    file://errors/COPYRIGHT;md5=d324bc1f9447d1d1588d75b22a678dc4 \
                     "
 DEPENDS = "libtool krb5 openldap db cyrus-sasl"
 
@@ -81,23 +79,17 @@ do_install_ptest() {
     cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
     cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}
 
-    # Needed to generate file squid.conf.default
-    oe_runmake DESTDIR=${D}${PTEST_PATH} -C src install-data-local
-    install -d ${D}${sysconfdir}/squid
-    install -m 0644 ${D}${PTEST_PATH}/${sysconfdir}/squid/squid.conf.default ${D}${sysconfdir}/squid
+    # Install default config
+    install -d ${D}${PTEST_PATH}/src
+    install -m 0644 ${B}/src/squid.conf.default ${D}${PTEST_PATH}/src
 
-    # Don't need these directories
-    rm -rf ${D}${PTEST_PATH}/${sysconfdir}
-    rm -rf ${D}${PTEST_PATH}/usr
-    rm -rf ${D}${PTEST_PATH}/var
+    # autoconf.h is needed during squid-conf-tests
+    install -d ${D}${PTEST_PATH}/include
+    install -m 0644 ${B}/include/autoconf.h ${D}${PTEST_PATH}/include
 
     # do NOT need to rebuild Makefile itself
     sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
 
-    # Add squid-conf-tests for runtime tests
-    sed -e 's/^\(runtest-TESTS:\)/\1 squid-conf-tests/' \
-        -i ${D}${PTEST_PATH}/${TESTDIR}/Makefile
-
     # Ensure the path for command true is correct
     sed -i 's:^TRUE = .*$:TRUE = /bin/true:' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
 }
@@ -122,7 +114,6 @@ do_install:append() {
 FILES:${PN} += "${libdir} ${datadir}/errors ${datadir}/icons"
 FILES:${PN}-dbg += "/usr/src/debug"
 FILES:${PN}-doc += "${datadir}/*.txt"
-FILES:${PN}-ptest += "${sysconfdir}/squid/squid.conf.default"
 
 RDEPENDS:${PN} += "perl"
 RDEPENDS:${PN}-ptest += "perl make"
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/6 squid: add nm dispatcher reload hook

In reply to [email protected]

From: Patrick Wicki <[email protected]>

This enables the networkmanager dispatcher to reload squid automatically on network changes. This idea is from the Fedora package where they do the same:
https://src.fedoraproject.org/rpms/squid/blob/rawhide/f/squid.spec#_207

---
 meta-networking/recipes-daemons/squid/files/squid.nm | 7 +++++++
 meta-networking/recipes-daemons/squid/squid_6.5.bb   | 8 ++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/squid/files/squid.nm
meta-networking/recipes-daemons/squid/files/squid.nm new file +7 -0
new file mode 100644
index 000000000..b58ee11bd
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+case "$2" in
+        up|down|vpn-up|vpn-down)
+                systemctl -q reload squid.service || :
+                ;;
+esac
meta-networking/recipes-daemons/squid/squid_6.5.bb +8 -0
index 3795da7f5..33a8bc476 100644
@@ -20,6 +20,7 @@ SRC_URI = "http://www.squid-cache.org/Versions/v${MAJ_VER}/${BPN}-${PV}.tar.bz2
            file://volatiles.03_squid \
            file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
            file://0002-squid-make-squid-conf-tests-run-on-target-device.patch \
+           file://squid.nm \
            "
 
 SRC_URI:remove:toolchain-clang = "file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
@@ -49,6 +50,8 @@ PACKAGECONFIG[werror] = "--enable-strict-error-checking,--disable-strict-error-c
 PACKAGECONFIG[esi] = "--enable-esi,--disable-esi,expat libxml2"
 PACKAGECONFIG[ssl] = "--with-openssl=yes,--with-openssl=no,openssl"
 
+PACKAGES =+ "${PN}-networkmanager"
+
 BASIC_AUTH = "DB SASL LDAP"
 
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
@@ -109,11 +112,16 @@ do_install:append() {
 
     rmdir "${D}${localstatedir}/log/${BPN}"
     rmdir --ignore-fail-on-non-empty "${D}${localstatedir}/log"
+
+    # Install NetworkManager dispatcher reload hooks
+    install -d ${D}${libdir}/NetworkManager/dispatcher.d
+    install -m 0755 ${WORKDIR}/squid.nm ${D}${libdir}/NetworkManager/dispatcher.d/20-squid
 }
 
 FILES:${PN} += "${libdir} ${datadir}/errors ${datadir}/icons"
 FILES:${PN}-dbg += "/usr/src/debug"
 FILES:${PN}-doc += "${datadir}/*.txt"
+FILES:${PN}-networkmanager = "${libdir}/NetworkManager/dispatcher.d"
 
 RDEPENDS:${PN} += "perl"
 RDEPENDS:${PN}-ptest += "perl make"
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/6 squid: add auth packageconfig

In reply to [email protected]

From: Patrick Wicki <[email protected]>

Introduce PACKAGECONFIG[auth] and pin the dependencies to it. This allows building squid without authentication support and all its related dependencies.

---
 meta-networking/recipes-daemons/squid/squid_6.5.bb | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
meta-networking/recipes-daemons/squid/squid_6.5.bb +7 -4
index 33a8bc476..66b42ebbb 100644
@@ -30,7 +30,7 @@ SRC_URI[sha256sum] = "99acd54ec9d68b2a9080d19fcc43eca1a245146cf162dbba689510d01e
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                     file://errors/COPYRIGHT;md5=d324bc1f9447d1d1588d75b22a678dc4 \
                     "
-DEPENDS = "libtool krb5 openldap db cyrus-sasl"
+DEPENDS = "libtool"
 
 inherit autotools pkgconfig useradd ptest perlnative
 
@@ -42,13 +42,16 @@ LDFLAGS:append:riscv32 = " -latomic"
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/squid --shell /bin/false --user-group squid"
 
-PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
-                  "
+PACKAGECONFIG ??= "auth \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+"
+
 PACKAGECONFIG[libnetfilter-conntrack] = "--with-netfilter-conntrack=${includedir}, --without-netfilter-conntrack, libnetfilter-conntrack"
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 PACKAGECONFIG[werror] = "--enable-strict-error-checking,--disable-strict-error-checking,"
 PACKAGECONFIG[esi] = "--enable-esi,--disable-esi,expat libxml2"
 PACKAGECONFIG[ssl] = "--with-openssl=yes,--with-openssl=no,openssl"
+PACKAGECONFIG[auth] = "--enable-auth-basic='${BASIC_AUTH}',--disable-auth --disable-auth-basic,krb5 openldap db cyrus-sasl"
 
 PACKAGES =+ "${PN}-networkmanager"
 
@@ -57,7 +60,7 @@ BASIC_AUTH = "DB SASL LDAP"
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 BASIC_AUTH += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'PAM', '', d)}"
 
-EXTRA_OECONF += "--with-default-user=squid --enable-auth-basic='${BASIC_AUTH}' \
+EXTRA_OECONF += "--with-default-user=squid \
                  --sysconfdir=${sysconfdir}/${BPN} \
                  --with-logdir=${localstatedir}/log/${BPN} \
                  'PERL=${USRBINPATH}/env perl'"
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/6 squid: move configs to sub package

In reply to [email protected]

From: Patrick Wicki <[email protected]>

Move the config files to a separate squid-conf package. This allows shipping new configs via a custom conf package.

---
 meta-networking/recipes-daemons/squid/squid_6.5.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta-networking/recipes-daemons/squid/squid_6.5.bb +6 -2
index 66b42ebbb..af3cbe067 100644
@@ -53,7 +53,10 @@ PACKAGECONFIG[esi] = "--enable-esi,--disable-esi,expat libxml2"
 PACKAGECONFIG[ssl] = "--with-openssl=yes,--with-openssl=no,openssl"
 PACKAGECONFIG[auth] = "--enable-auth-basic='${BASIC_AUTH}',--disable-auth --disable-auth-basic,krb5 openldap db cyrus-sasl"
 
-PACKAGES =+ "${PN}-networkmanager"
+PACKAGES =+ " \
+    ${PN}-conf \
+    ${PN}-networkmanager \
+"
 
 BASIC_AUTH = "DB SASL LDAP"
 
@@ -124,7 +127,8 @@ do_install:append() {
 FILES:${PN} += "${libdir} ${datadir}/errors ${datadir}/icons"
 FILES:${PN}-dbg += "/usr/src/debug"
 FILES:${PN}-doc += "${datadir}/*.txt"
+FILES:${PN}-conf += "${sysconfdir}/squid"
 FILES:${PN}-networkmanager = "${libdir}/NetworkManager/dispatcher.d"
 
-RDEPENDS:${PN} += "perl"
+RDEPENDS:${PN} += "perl ${PN}-conf"
 RDEPENDS:${PN}-ptest += "perl make"
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/6 squid: add url-rewrite-helpers packageconfig

In reply to [email protected]

From: Patrick Wicki <[email protected]>

---
 meta-networking/recipes-daemons/squid/squid_6.5.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-networking/recipes-daemons/squid/squid_6.5.bb +2 -1
index af3cbe067..2641943fe 100644
@@ -42,7 +42,7 @@ LDFLAGS:append:riscv32 = " -latomic"
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/squid --shell /bin/false --user-group squid"
 
-PACKAGECONFIG ??= "auth \
+PACKAGECONFIG ??= "auth url-rewrite-helpers \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
 "
 
@@ -52,6 +52,7 @@ PACKAGECONFIG[werror] = "--enable-strict-error-checking,--disable-strict-error-c
 PACKAGECONFIG[esi] = "--enable-esi,--disable-esi,expat libxml2"
 PACKAGECONFIG[ssl] = "--with-openssl=yes,--with-openssl=no,openssl"
 PACKAGECONFIG[auth] = "--enable-auth-basic='${BASIC_AUTH}',--disable-auth --disable-auth-basic,krb5 openldap db cyrus-sasl"
+PACKAGECONFIG[url-rewrite-helpers] = "--enable-url-rewrite-helpers,--disable-url-rewrite-helpers,"
 
 PACKAGES =+ " \
     ${PN}-conf \
Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/6 squid: add systemd service

In reply to [email protected]

From: Patrick Wicki <[email protected]>

Integrate the upstream unit file into the recipe.

---
 meta-networking/recipes-daemons/squid/squid_6.5.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta-networking/recipes-daemons/squid/squid_6.5.bb +12 -1
index 2641943fe..8d5d1a384 100644
@@ -32,7 +32,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                     "
 DEPENDS = "libtool"
 
-inherit autotools pkgconfig useradd ptest perlnative
+inherit autotools pkgconfig useradd ptest perlnative systemd
 
 LDFLAGS:append:mipsarch = " -latomic"
 LDFLAGS:append:powerpc = " -latomic"
@@ -44,6 +44,7 @@ USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/squid --she
 
 PACKAGECONFIG ??= "auth url-rewrite-helpers \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
 "
 
 PACKAGECONFIG[libnetfilter-conntrack] = "--with-netfilter-conntrack=${includedir}, --without-netfilter-conntrack, libnetfilter-conntrack"
@@ -53,6 +54,7 @@ PACKAGECONFIG[esi] = "--enable-esi,--disable-esi,expat libxml2"
 PACKAGECONFIG[ssl] = "--with-openssl=yes,--with-openssl=no,openssl"
 PACKAGECONFIG[auth] = "--enable-auth-basic='${BASIC_AUTH}',--disable-auth --disable-auth-basic,krb5 openldap db cyrus-sasl"
 PACKAGECONFIG[url-rewrite-helpers] = "--enable-url-rewrite-helpers,--disable-url-rewrite-helpers,"
+PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
 
 PACKAGES =+ " \
     ${PN}-conf \
@@ -106,6 +108,12 @@ do_install_ptest() {
 
 do_install:append() {
     if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        # Install service unit file
+        install -d ${D}/${systemd_unitdir}/system
+        install ${S}/tools/systemd/squid.service ${D}/${systemd_unitdir}/system
+        sed -i 's:/var/run/:/run/:g' ${D}/${systemd_unitdir}/system/squid.service
+
+        # Configure tmpfiles.d
         install -d ${D}${sysconfdir}/tmpfiles.d
         echo "d ${localstatedir}/run/${BPN} 0755 squid squid -" >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
         echo "d ${localstatedir}/log/${BPN} 0750 squid squid -" >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
@@ -125,6 +133,9 @@ do_install:append() {
     install -m 0755 ${WORKDIR}/squid.nm ${D}${libdir}/NetworkManager/dispatcher.d/20-squid
 }
 
+SYSTEMD_AUTO_ENABLE = "disable"
+SYSTEMD_SERVICE:${PN} = "squid.service"
+
 FILES:${PN} += "${libdir} ${datadir}/errors ${datadir}/icons"
 FILES:${PN}-dbg += "/usr/src/debug"
 FILES:${PN}-doc += "${datadir}/*.txt"
Signature · 1 line
2.43.0