Subject: bug#40145: closed (Re: [bug#40145] [PATCH] gnu: Add squid.)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 20 Mar 2020 17:27:03 +0000

Your bug report

#40145: [PATCH] gnu: Add squid.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
40145: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40145
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#40145] [PATCH] gnu: Add squid.
From: Marius Bakke <[email-masked]>
To: Vincent Legoll <[email-masked]>, [email-masked]
Date: Fri, 20 Mar 2020 18:25:53 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Vincent Legoll <[email-masked]> writes:

> The attached patch adds squid caching proxy so that we can all start
> saving precious network bandwidth.

Nice, about time!  :-)

> I lightly tested it with the attached squid config file, in foreground
> mode, like the following:
>
> # Create temporary test space for squid
> mkdir /tmp/squid
> # Create the hashed store directories
> /gnu/store/szbiglrkvll6qdxcrg3ir0hz8zdc9h5f-squid-4.10/sbin/squid -N
> -f ./squid.conf -z
> # Run squid
> /gnu/store/szbiglrkvll6qdxcrg3ir0hz8zdc9h5f-squid-4.10/sbin/squid -N
> -f ./squid.conf
>
> # In another shell
> export http_proxy=localhost:3128
> export https_proxy=localhost:3128
> time wget google.fr
> time wget google.fr
> less /tmp/squid/access.log
> less /tmp/squid/cache.log
> ls -lah /tmp/squid/00/00
>
> There's no shepherd ready to run service &
> config definitions, as I still don't know how
> to do that.
>
> I'll try to create one, if no one beats me to
> it, but it may already be useful as-is...

Writing services may seem intimidating at first, but is actually easier
than it looks.  I think you'll figure it out fairly quickly.  :-)

> From 24a81038d315a4bf757eca590c53a16eac005879 Mon Sep 17 00:00:00 2001
> From: Vincent Legoll <[email-masked]>
> Date: Fri, 20 Mar 2020 11:45:11 +0100
> Subject: [PATCH] gnu: Add squid.
>
> * gnu/packages/networking.scm (squid): New variable.

[...]

> +;  #:use-module (gnu packages cppunit)

I dropped this leftover from the patch.

[...]

> +    (inputs
> +     `(("perl" ,perl)
> +       ("openldap" ,openldap)
> +       ("linux-pam" ,linux-pam)
> +       ("libcap" ,libcap)
> +       ("cyrus-sasl" ,cyrus-sasl)
> +       ("expat" ,expat)
> +       ("libxml2" ,libxml2)
> +       ("openssl" ,openssl)))
> +    (native-inputs
> +     `(("cppunit" ,cppunit)
> +       ("coreutils" ,coreutils) ; test suite needs /bin/true

coreutils is already implicitly available, so I removed this input.

> +       ("pkg-config" ,pkg-config)))
> +    (synopsis "A web caching proxy supporting HTTP, HTTPS, FTP, etc.")

I changed this to just "Web caching proxy" to please 'guix lint'.

> +    (description "Squid is a caching proxy for the Web supporting HTTP, HTTPS,
> +FTP, and more.  It reduces bandwidth and improves response times by caching and
> +reusing frequently-requested web pages.")
> +    (home-page "http://www.squid-cache.org/")
> +    (license license:gpl2)))

The license is actually GPL2+ according to the source code headers.

Applied with these changes, thank you!

Subject: [PATCH] gnu: Add squid.
From: Vincent Legoll <[email-masked]>
To: [email-masked]
Date: Fri, 20 Mar 2020 11:55:22 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

The attached patch adds squid caching proxy so that we can all start
saving precious network bandwidth.

I lightly tested it with the attached squid config file, in foreground
mode, like the following:

# Create temporary test space for squid
mkdir /tmp/squid
# Create the hashed store directories
/gnu/store/szbiglrkvll6qdxcrg3ir0hz8zdc9h5f-squid-4.10/sbin/squid -N
-f ./squid.conf -z
# Run squid
/gnu/store/szbiglrkvll6qdxcrg3ir0hz8zdc9h5f-squid-4.10/sbin/squid -N
-f ./squid.conf

# In another shell
export http_proxy=localhost:3128
export https_proxy=localhost:3128
time wget google.fr
time wget google.fr
less /tmp/squid/access.log
less /tmp/squid/cache.log
ls -lah /tmp/squid/00/00

There's no shepherd ready to run service &
config definitions, as I still don't know how
to do that.

I'll try to create one, if no one beats me to
it, but it may already be useful as-is...

-- 
Vincent Legoll
From 24a81038d315a4bf757eca590c53a16eac005879 Mon Sep 17 00:00:00 2001
From: Vincent Legoll <[email-masked]>
Date: Fri, 20 Mar 2020 11:45:11 +0100
Subject: [PATCH] gnu: Add squid.

* gnu/packages/networking.scm (squid): New variable.
---
 gnu/packages/networking.scm | 45 +++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index e9abac2991..6a6e836261 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -80,8 +80,10 @@
   #:use-module (gnu packages code)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
+;  #:use-module (gnu packages cppunit)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages dejagnu)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
@@ -98,6 +100,7 @@
   #:use-module (gnu packages kerberos)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
+  #:use-module (gnu packages openldap)
   #:use-module (gnu packages password-utils)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -862,6 +865,48 @@ prints timing information for each step of the HTTP request (DNS lookup,
 TCP connection, TLS handshake and so on) in the terminal.")
     (license license:expat)))
 
+(define-public squid
+  (package
+    (name "squid")
+    (version "4.10")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://www.squid-cache.org/Versions/v4/squid-"
+                           version ".tar.xz"))
+       (sha256
+        (base32 "07sz0adv8nkhy797675bpra7lvdkwjq9isw1ddgylhlazl511w4q"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-true-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "test-suite/testheaders.sh"
+               (("/bin/true")
+                (string-append (assoc-ref inputs "coreutils")
+                               "/bin/true")))
+             #t)))))
+    (inputs
+     `(("perl" ,perl)
+       ("openldap" ,openldap)
+       ("linux-pam" ,linux-pam)
+       ("libcap" ,libcap)
+       ("cyrus-sasl" ,cyrus-sasl)
+       ("expat" ,expat)
+       ("libxml2" ,libxml2)
+       ("openssl" ,openssl)))
+    (native-inputs
+     `(("cppunit" ,cppunit)
+       ("coreutils" ,coreutils) ; test suite needs /bin/true
+       ("pkg-config" ,pkg-config)))
+    (synopsis "A web caching proxy supporting HTTP, HTTPS, FTP, etc.")
+    (description "Squid is a caching proxy for the Web supporting HTTP, HTTPS,
+FTP, and more.  It reduces bandwidth and improves response times by caching and
+reusing frequently-requested web pages.")
+    (home-page "http://www.squid-cache.org/")
+    (license license:gpl2)))
+
 (define-public bwm-ng
   (package
     (name "bwm-ng")
-- 
2.25.1