From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH]: gnu: shogun: Remove non-free source files. Date: Thu, 21 May 2015 21:52:47 +0200 Message-ID: <87r3q91ze8.fsf@gnu.org> References: <87a8xeqqk7.fsf@netris.org> <871tipj1xq.fsf@gnu.org> <87mw1dputa.fsf@netris.org> <87wq09wzir.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvWYv-0005qa-OX for guix-devel@gnu.org; Thu, 21 May 2015 15:55:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvWYt-0005nQ-Gn for guix-devel@gnu.org; Thu, 21 May 2015 15:55:25 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvWYt-0005m5-Dv for guix-devel@gnu.org; Thu, 21 May 2015 15:55:23 -0400 In-Reply-To: (Ricardo Wurmus's message of "Thu, 21 May 2015 11:59:00 +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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: guix-devel Ricardo Wurmus skribis: > Attached is a patch to remove non-free source files as well as anything > in a "#ifdef USE_SVMLIGHT ... #endif" block. Good! > From d409756bd2fc2db396d6257cfed42a213f6f43f6 Mon Sep 17 00:00:00 2001 > From: Ricardo Wurmus > Date: Fri, 8 May 2015 16:53:28 +0200 > Subject: [PATCH] gnu: shogun: Remove non-free source files. > > * gnu/packages/bioinformatics.scm (shogun)[source]: Add snippet to remove > non-free sources. [...] > + ;; Remove non-free functions. > + (for-each > + (lambda (file) > + (with-atomic-file-replacement file > + (lambda (in out) > + (let loop ((line (read-line in 'concat)) > + (skipping? #f)) > + (if (eof-object? line) > + #t > + (let ((skip-next? > + (or (and skipping? > + (not (string-prefix? > + "#endif //USE_SVMLIGHT" li= ne))) > + (string-prefix? > + "#ifdef USE_SVMLIGHT" line)))) > + (when (or (not skipping?) > + (and skipping? (not skip-next?))) > + (display line out)) > + (loop (read-line in 'concat) skip-next?))))))) > + (find-files "src/shogun/kernel/" > + "^Kernel\\.(cpp|h)")))))) It would be nicer to give the lambda a name, like: (define (delete-ifdefs file) ...) ... (for-each delete-ifdefs (find-files ...)) OK to push with this change. Thanks for working on it! Ludo=E2=80=99.