GNU bug report logs -
#28504
[PATCH] cuirass: Add --listen command line option.
Previous Next
Reported by: Jan Nieuwenhuizen <janneke <at> gnu.org>
Date: Mon, 18 Sep 2017 20:03:02 UTC
Severity: normal
Tags: patch
Done: Jan Nieuwenhuizen <janneke <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28504 in the body.
You can then email your comments to 28504 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Mon, 18 Sep 2017 20:03:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jan Nieuwenhuizen <janneke <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 18 Sep 2017 20:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* bin/cuirass.in (show-help): Add help for --listen option.
(%options): Add listen option.
(main): Pass host to run-cuirass-server.
* doc/cuirass.texi (Invocation): Add --listen option.
* src/cuirass/http.scm (run-cuirass-server): Add named #:host parameter.
---
bin/cuirass.in | 5 ++++-
doc/cuirass.texi | 4 ++++
src/cuirass/http.scm | 15 +++++++++------
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/bin/cuirass.in b/bin/cuirass.in
index 18edf1e..0da5c06 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -41,6 +41,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
Add specifications from SPECFILE to database.
-D --database=DB Use DB to store build results.
-p --port=NUM Port of the HTTP server.
+ --listen=HOST Listen on the network interface for HOST
-I, --interval=N Wait N seconds between each poll
--use-substitutes Allow usage of pre-built substitutes
-V, --version Display version
@@ -55,6 +56,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(specifications (single-char #\S) (value #t))
(database (single-char #\D) (value #t))
(port (single-char #\p) (value #t))
+ (listen (value #t))
(interval (single-char #\I) (value #t))
(use-substitutes (value #f))
(fallback (value #f))
@@ -87,6 +89,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(else
(let ((one-shot? (option-ref opts 'one-shot #f))
(port (string->number (option-ref opts 'port "8080")))
+ (host (option-ref opts 'listen "localhost"))
(interval (string->number (option-ref opts 'interval "10")))
(specfile (option-ref opts 'specifications #f)))
(with-database db
@@ -105,4 +108,4 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(while #t
(process-specs db (db-get-specifications db))
(sleep interval))))
- (run-cuirass-server db #:port port))))))))))
+ (run-cuirass-server db #:host host #:port port))))))))))
diff --git a/doc/cuirass.texi b/doc/cuirass.texi
index 7f944ca..159b13b 100644
--- a/doc/cuirass.texi
+++ b/doc/cuirass.texi
@@ -186,6 +186,10 @@ be created.
Make the HTTP interface listen on port @var{num}. Use port 8080 by
default.
+@item --listen=@var{host}
+Make the HTTP interface listen on network interface for @var{host}. Use
+localhost by default.
+
@item --interval=@var{n}
@itemx -I @var{n}
Wait @var{n} seconds between each poll.
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 23c3ad7..7434429 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -166,9 +166,12 @@
#:body (string-append "Resource not found: "
(uri->string (request-uri request)))))))
-(define* (run-cuirass-server db #:key (port 8080))
- (format (current-error-port) "listening on port ~A~%" port)
- (run-server url-handler
- 'http
- `(#:port ,port)
- db))
+(define* (run-cuirass-server db #:key (host "localhost") (port 8080))
+ (let* ((host-info (gethostbyname host))
+ (address (inet-ntop (hostent:addrtype host-info)
+ (car (hostent:addr-list host-info)))))
+ (format (current-error-port) "listening on ~A:~A~%" address port)
+ (run-server url-handler
+ 'http
+ `(#:host ,address #:port ,port)
+ db)))
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Tue, 19 Sep 2017 10:19:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 28504 <at> debbugs.gnu.org (full text, mbox):
Jan Nieuwenhuizen <janneke <at> gnu.org> skribis:
> * bin/cuirass.in (show-help): Add help for --listen option.
> (%options): Add listen option.
> (main): Pass host to run-cuirass-server.
> * doc/cuirass.texi (Invocation): Add --listen option.
> * src/cuirass/http.scm (run-cuirass-server): Add named #:host parameter.
Good idea, LGTM thanks!
Ludo'.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Tue, 19 Sep 2017 15:33:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 28504 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Ludovic Courtès writes:
>> * bin/cuirass.in (show-help): Add help for --listen option.
>> (%options): Add listen option.
>> (main): Pass host to run-cuirass-server.
>> * doc/cuirass.texi (Invocation): Add --listen option.
>> * src/cuirass/http.scm (run-cuirass-server): Add named #:host parameter.
>
> Good idea, LGTM thanks!
Pushed to guix-cuirass master as 2a4d493e28100b8eca7d23300dd872c9f99e1f16
Attached is the corresponding Guixy side (or should I close this one and
open a new bug?).
Greetings,
janneke
[0001-services-cuirass-Add-host-option.patch (text/x-patch, inline)]
From 5e14a890c0ffa1b9a753be8b9a9d516f14a6955f Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke <at> gnu.org>
Date: Mon, 18 Sep 2017 22:12:18 +0200
Subject: [PATCH] services: cuirass: Add host option.
* gnu/services/cuirass.scm (<cuirass-configuration>): Add host option.
(cuirass-shepherd-service): Pass host option.
* doc/guix.texi (Continuous Integration): Document it.
---
doc/guix.texi | 4 ++++
gnu/services/cuirass.scm | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1356a357c..deb055e29 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15335,6 +15335,10 @@ added specifications.
@item @code{port} (default: @code{8081})
Port number used by the HTTP server.
+@item --listen=@var{host}
+Listen on the network interface for @var{host}. The default is to
+accept connections from localhost.
+
@item @code{specifications} (default: @code{#~'()})
A gexp (@pxref{G-Expressions}) that evaluates to a list of specifications,
where a specification is an association list
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index 2ad595220..c5e9fcbb2 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016 Mathieu Lirzin <mthl <at> gnu.org>
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
+;;; Copyright © 2017 Jan Nieuwenhuizen <janneke <at> gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -61,6 +62,8 @@
(default "/var/run/cuirass/cuirass.db"))
(port cuirass-configuration-port ;integer (port)
(default 8081))
+ (host cuirass-configuration-host ;string
+ (default "localhost"))
(specifications cuirass-configuration-specifications)
;gexp that evaluates to specification-alist
(use-substitutes? cuirass-configuration-use-substitutes? ;boolean
@@ -84,6 +87,7 @@
(interval (cuirass-configuration-interval config))
(database (cuirass-configuration-database config))
(port (cuirass-configuration-port config))
+ (host (cuirass-configuration-host config))
(specs (cuirass-configuration-specifications config))
(use-substitutes? (cuirass-configuration-use-substitutes? config))
(one-shot? (cuirass-configuration-one-shot? config))
@@ -100,6 +104,7 @@
#$(scheme-file "cuirass-specs.scm" specs)
"--database" #$database
"--port" #$(number->string port)
+ "--listen" #$host
"--interval" #$(number->string interval)
#$@(if use-substitutes? '("--use-substitutes") '())
#$@(if one-shot? '("--one-shot") '())
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
[Message part 3 (text/plain, inline)]
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Tue, 19 Sep 2017 16:40:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 28504 <at> debbugs.gnu.org (full text, mbox):
Hi Jan,
> * gnu/services/cuirass.scm (<cuirass-configuration>): Add host option.
> (cuirass-shepherd-service): Pass host option.
> * doc/guix.texi (Continuous Integration): Document it.
This looks good to me !
Thanks,
Mathieu
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Tue, 19 Sep 2017 16:55:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 28504 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Mathieu Othacehe writes:
Hi Mathieu,
>> * gnu/services/cuirass.scm (<cuirass-configuration>): Add host option.
>> (cuirass-shepherd-service): Pass host option.
>> * doc/guix.texi (Continuous Integration): Document it.
>
> This looks good to me !
Thanks! I was just thinking: to make this work we need cuirass master,
so I should probably add the attached cuirass update first?
janneke
[0001-gnu-cuirass-Update-development-snapshot.patch (text/x-patch, inline)]
From 5d65ecb0d6c240ef25b643da6f2b9d6d87ca474f Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke <at> gnu.org>
Date: Tue, 19 Sep 2017 18:51:06 +0200
Subject: [PATCH] gnu: cuirass: Update development snapshot.
* gnu/packages/ci.scm (cuirass): Update to commit 87ad259.
---
gnu/packages/ci.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/ci.scm b/gnu/packages/ci.scm
index 78d6e9514..a6057a76e 100644
--- a/gnu/packages/ci.scm
+++ b/gnu/packages/ci.scm
@@ -187,8 +187,8 @@ their dependencies.")
(license l:gpl3+))))
(define-public cuirass
- (let ((commit "87ad259dba7de38b6e3ab954cd7b2f655358d877")
- (revision "8"))
+ (let ((commit "2a4d493e28100b8eca7d23300dd872c9f99e1f16")
+ (revision "9"))
(package
(name "cuirass")
(version (string-append "0.0.1-" revision "." (string-take commit 7)))
@@ -200,7 +200,7 @@ their dependencies.")
(file-name (string-append name "-" version))
(sha256
(base32
- "127pvbxbh6b6ar43cdgia9qpzzpldq4wm3igsxb1ycxfsdqnjrnz"))))
+ "0hi7x25ya8wydrfj9jd9zb351mw8pgxxxwgxxdn5kds7qvhxr26v"))))
(build-system gnu-build-system)
(arguments
'(#:modules ((guix build utils)
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
[Message part 3 (text/plain, inline)]
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Tue, 19 Sep 2017 17:02:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 28504 <at> debbugs.gnu.org (full text, mbox):
> Thanks! I was just thinking: to make this work we need cuirass master,
> so I should probably add the attached cuirass update first?
It seems like a good idea, but that would impact bayfront who uses Guix
cuirass package. So we should maybe wait for Ludo and Ricardo to give
their opinion ?
Mathieu
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28504
; Package
guix-patches
.
(Tue, 26 Sep 2017 08:14:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 28504 <at> debbugs.gnu.org (full text, mbox):
Hello,
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:
>> Thanks! I was just thinking: to make this work we need cuirass master,
>> so I should probably add the attached cuirass update first?
>
> It seems like a good idea, but that would impact bayfront who uses Guix
> cuirass package. So we should maybe wait for Ludo and Ricardo to give
> their opinion ?
You can push the patches, Jan.
Sorry for delaying this!
Thanks,
Ludo’.
Reply sent
to
Jan Nieuwenhuizen <janneke <at> gnu.org>
:
You have taken responsibility.
(Tue, 26 Sep 2017 16:19:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jan Nieuwenhuizen <janneke <at> gnu.org>
:
bug acknowledged by developer.
(Tue, 26 Sep 2017 16:19:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 28504-done <at> debbugs.gnu.org (full text, mbox):
Ludovic Courtès writes:
> Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:
>
>>> Thanks! I was just thinking: to make this work we need cuirass master,
>>> so I should probably add the attached cuirass update first?
>>
>> It seems like a good idea, but that would impact bayfront who uses Guix
>> cuirass package. So we should maybe wait for Ludo and Ricardo to give
>> their opinion ?
>
> You can push the patches, Jan.
Thanks, pushed to master as 326f6ef10f2ac774455751ab08cab8fc55e7e44d
> Sorry for delaying this!
Thanks for taking the time to review!
Greetings,
janneke
--
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 25 Oct 2017 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 296 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.