From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Vong Subject: Re: [PATCH] gnu: Add sendmail Date: Sat, 17 Sep 2016 17:38:26 +0800 Message-ID: <87d1k2c1d9.fsf@gmail.com> References: <1474042893-9690-1-git-send-email-jmd@gnu.org> <87d1k3t9h3.fsf@gmail.com> <20160917085035.GA23691@jocasta.intra> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blC5y-0001oR-MU for guix-devel@gnu.org; Sat, 17 Sep 2016 05:39:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blC5u-000185-GT for guix-devel@gnu.org; Sat, 17 Sep 2016 05:39:37 -0400 In-Reply-To: <20160917085035.GA23691@jocasta.intra> (John Darrington's message of "Sat, 17 Sep 2016 10:50:35 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: John Darrington Cc: guix-devel@gnu.org, John Darrington Hi, John Darrington writes: > They need more than that. They need the binary to be installed > setuid. So these > cannot be run as package tests. They must be tested after the > as-yet-to-be-written > service is installed. But I'll update the comment to make it more clear. > I see, so this is a circular dependency problem here. The service depends on this package, but the test depends on the service. Am I right? > > + #:phases > > + (modify-phases %standard-phases > > + (add-before 'build 'replace-/bin/sh > > + (lambda _ > > + (substitute* > > + (append > > + (list "smrsh/smrsh.c" "sendmail/conf.c" "contrib/mailprio" > > + "contrib/mmuegel" "devtools/bin/configure.sh") > > + (find-files "." ".*\\.m4") > > + (find-files "." ".*\\.cf")) > I think this can be simplified to: > `("smrsh/smrsh.c" "sendmail/conf.c" > "contrib/mailprio" "contrib/mmuegel" > "devtools/bin/configure.sh" > .@(find-files "." ".*\\.m4") > ,@(find-files "." ".*\\.cf")) > using the quasi-quote quasi-unquote-splicing notation, which is similar > to string interpolation in shell "foo bar $(CAR) $(TAR)". > > Is that simpler? It has more characters? > Hmmm, it is more of a style thing. You can ask how others think about it. > > + "contrib/mmuegel" "devtools/bin/configure.sh") > > + (("/bin/sh") (which "bash"))) > > + > > + (substitute* "devtools/bin/Build" > > + (("SHELL=/bin/sh") (string-append "SHELL=" (which "bash")))) > > + #t)) > I think the `#t' is not neccessary here, since `substitute*' uses > `substitute', which will either return #t or throw an exception. > > WTF?? Didn't you complain earlier this week when I *didn't* put #t in > exactly this > scenario?? > Yes, I am a different Alex :) Also, it seems we are not being consistent here, sometimes we put `#t' after `substitute*', sometimes we don't. Anyone has an idea? > > + (replace 'configure > > + (lambda _ > > + > > + ;; Render harmless any attempts to chown or chmod > > + (substitute* "devtools/bin/install.sh" > > + (("owner=\\$2") "owner=''") > > + (("group=\\$2") "group=''")) > > + > > + (with-output-to-file "devtools/Site/site.config.m4" > > + (lambda () > > + (format #t " > > +define(`confCC', `gcc') > > +define(`confOPTIMIZE', `-g -O2') > > +define(`confLIBS', `-lresolv') > > +define(`confINSTALL', `~a/devtools/bin/install.sh') > > +define(`confDEPEND_TYPE', `CC-M') > > +define(`confINST_DEP', `') > > +" (getcwd)))))) > > + (replace 'build > > + (lambda _ > > + (system* "sh" "Build") > I think there is a missing `zero?' here. > > > Would that make any difference? Since only the last expression would > get returned from lambda ? > You are right. The following should chain things up correctly: (and (zero? (system* "sh" "Build")) (with-directory-excursion "cf/cf" (begin (copy-file "generic-linux.mc" "sendmail.mc") (zero? (system* "sh" "Build" "sendmail.cf"))))) > > + (with-directory-excursion "cf/cf" > > + (begin > > + (copy-file "generic-linux.mc" "sendmail.mc") > > + (zero? (system* "sh" "Build" "sendmail.cf")))))) > > + (add-before 'install 'pre-install > > + (lambda _ > > + (let ((out (assoc-ref %outputs "out"))) > > + (mkdir-p (string-append out "/usr/bin")) > > + (mkdir-p (string-append out "/usr/sbin")) > > + (mkdir-p (string-append out "/etc/mail")) > > + (setenv "DESTDIR" out) > > + (with-directory-excursion "cf/cf" > > + (zero? (system* "sh" "Build" "install-cf"))))))))) > > + (inputs > > + `(("m4" ,m4) > > + ("perl" ,perl))) > > + (home-page "http://sendmail.org") > > + (synopsis > > + "Highly configurable Mail Transfer Agent (MTA)") > > + (description > > + "Sendmail is a mail transfer agent (MTA) originally developed > > by Eric > > +Allman. It is highly configurable and supports many delivery > > methods and many > > +transfer protocols.") > > + (license (non-copyleft "file://LICENSE" > > + "See LICENSE in the distribution.")))) > > + > > Thanks, > Alex