Ricardo Wurmus <ricardo.wur...@mdc-berlin.de> 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 <ricardo.wur...@mdc-berlin.de> > 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" line))) > + (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’.