From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fjw5a-0000w6-5b for guix-patches@gnu.org; Sun, 29 Jul 2018 20:31:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fjw5X-0006IB-1Z for guix-patches@gnu.org; Sun, 29 Jul 2018 20:31:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:57432) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fjw5W-0006HV-S0 for guix-patches@gnu.org; Sun, 29 Jul 2018 20:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fjw5W-00065e-GT for guix-patches@gnu.org; Sun, 29 Jul 2018 20:31:02 -0400 Subject: [bug#32102] [PATCH v2 2/2] gnu: gajim: Combine wrap-program phases. Resent-Message-ID: From: Arun Isaac In-Reply-To: <87y3dudsz0.fsf@gnu.org> References: <20180711192652.20186-1-arunisaac@systemreboot.net> <20180711192652.20186-3-arunisaac@systemreboot.net> <87zhyv1qe8.fsf@lassieur.org> <87y3dudsz0.fsf@gnu.org> Date: Mon, 30 Jul 2018 06:00:28 +0530 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 32102@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Lassieur ludo@gnu.org (Ludovic Court=C3=A8s) writes: >> From 6ee5cf4423109ab64df58c85f4114e456dda098b Mon Sep 17 00:00:00 2001 >> From: Arun Isaac >> Date: Wed, 11 Jul 2018 13:03:33 +0530 >> Subject: [PATCH v3 1/3] build-system: python: Do not double wrap executa= bles. >> To: clement@lassieur.org >> Cc: mhw@netris.org, >> andreas@enge.fr, >> 32102@debbugs.gnu.org > > Hmm, weird! What's weird? Are you referring to the Cc field? The people in the Cc field were originally referred to by Clement. So, I put them there to keep them in the loop. >> (define* (wrap #:key inputs outputs #:allow-other-keys) >> (define (list-of-files dir) >> - (map (cut string-append dir "/" <>) >> - (or (scandir dir (lambda (f) >> - (let ((s (stat (string-append dir "/" f)))) >> - (eq? 'regular (stat:type s))))) >> - '()))) >> + (find-files dir (lambda (file stat) >> + (and (eq? 'regular (stat:type stat)) >> + (not (is-wrapped? file)))))) > > Something I don=E2=80=99t get is that =E2=80=98wrap-program=E2=80=99 itse= lf is supposed to > detect already-wrapped program. I vaguely remember discussing it before > but I forgot what the conclusions were; do we really need extra > =E2=80=98wrapped?=E2=80=99 checks? Can=E2=80=99t we fix =E2=80=98wrap-pr= ogram=E2=80=99 itself? Could you refer to our earlier discussion on 32102? https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D32102 In the case of Gajim, our current wrapping ends up double wrapping and creating bin/.gajim-real-real. The original fix I proposed was to modify `wrap-program` to fix already-wrapped detection. But, after discussion with Clement, we decided to go with a is-wrapped? check in the python build system. Do check out our earlier discussion and let us know what you think. >> +(define (is-wrapped? prog) >> + "Return #t if PROG is already wrapped using wrap-program, else return= #f." >> + (with-directory-excursion (dirname prog) >> + (and-let* ((match-record (string-match "^\\.(.*)-real$" (basename p= rog)))) >> + (access? (match:substring match-record 1) X_OK)))) > > By convention I=E2=80=99d suggest calling it =E2=80=98wrapped?=E2=80=99 r= ather than > =E2=80=98is-wrapped?=E2=80=99. In fact, a more accurate name would be = =E2=80=98wrapper?=E2=80=99. Sure, will do. > Also I=E2=80=99d suggest not using SRFI-2 because IMO it doesn=E2=80=99t = bring much and > it=E2=80=99s not used anywhere in Guix currently. Also, =E2=80=98file-ex= ists?=E2=80=99 rather > than =E2=80=98access?=E2=80=99, and no need to change directories. So: > > (define (wrapper? prog) > "Return #t if PROG is a wrapper as produced by 'wrap-program'." > (and (file-exists? prog) > (let ((base (basename prog))) > (and (string-prefix? "." base) > (string-suffix? "-real" base))))) Sure, will do.