unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH]: gnu: shogun: Remove non-free source files.
@ 2015-05-08 14:56 Ricardo Wurmus
  2015-05-08 17:30 ` Ludovic Courtès
  2015-05-09  5:15 ` Mark H Weaver
  0 siblings, 2 replies; 11+ messages in thread
From: Ricardo Wurmus @ 2015-05-08 14:56 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

Thanks to Bavier for bringing this issue to my attention.  This patch
removes two source files that are released under a non-free license.

There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
released under non-free terms, but they are enclosed in #ifdef
statements and the make flags we pass disable these functions at build
time.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-shogun-Remove-non-free-source-files.patch --]
[-- Type: text/x-patch, Size: 1228 bytes --]

From 0cc65499601910f4fdd55e93292124920a7e645d Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@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.
---
 gnu/packages/bioinformatics.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index fa7ff4c..1e93905 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1605,7 +1605,13 @@ against local background noises.")
              "/sources/shogun-" version ".tar.bz2"))
        (sha256
         (base32
-         "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb"))))
+         "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Remove non-free sources.
+        '(for-each delete-file
+                   (find-files "src/shogun/classifier/svm/"
+                               "SVMLight\\.(cpp|h)")))))
     (build-system cmake-build-system)
     (arguments
      '(#:tests? #f ;no check target
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-08 14:56 [PATCH]: gnu: shogun: Remove non-free source files Ricardo Wurmus
@ 2015-05-08 17:30 ` Ludovic Courtès
  2015-05-09  5:15 ` Mark H Weaver
  1 sibling, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2015-05-08 17:30 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Thanks to Bavier for bringing this issue to my attention.  This patch
> removes two source files that are released under a non-free license.
>
> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
> released under non-free terms, but they are enclosed in #ifdef
> statements and the make flags we pass disable these functions at build
> time.

OK.

> From 0cc65499601910f4fdd55e93292124920a7e645d Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@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.

Sure, please push.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-08 14:56 [PATCH]: gnu: shogun: Remove non-free source files Ricardo Wurmus
  2015-05-08 17:30 ` Ludovic Courtès
@ 2015-05-09  5:15 ` Mark H Weaver
  2015-05-09 13:49   ` Ludovic Courtès
  1 sibling, 1 reply; 11+ messages in thread
From: Mark H Weaver @ 2015-05-09  5:15 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Thanks to Bavier for bringing this issue to my attention.  This patch
> removes two source files that are released under a non-free license.

Sounds good, thanks!

> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
> released under non-free terms, but they are enclosed in #ifdef
> statements and the make flags we pass disable these functions at build
> time.

This is not sufficient.  We will need to completely remove the non-free
functions from the source code using a snippet.  We cannot use a patch
because the patch would contain the non-free code.

     Mark

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-09  5:15 ` Mark H Weaver
@ 2015-05-09 13:49   ` Ludovic Courtès
  2015-05-09 16:41     ` Mark H Weaver
  2015-05-09 21:06     ` Ricardo Wurmus
  0 siblings, 2 replies; 11+ messages in thread
From: Ludovic Courtès @ 2015-05-09 13:49 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

[...]

>> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
>> released under non-free terms, but they are enclosed in #ifdef
>> statements and the make flags we pass disable these functions at build
>> time.
>
> This is not sufficient.  We will need to completely remove the non-free
> functions from the source code using a snippet.  We cannot use a patch
> because the patch would contain the non-free code.

Indeed (I thought Kernel.{cpp,h} were the files being removed.)

I guess there are two ways to address this: have a snippet that reads
these two files line by line (with ‘read-line’ from (ice-9 rdelim)) and
dismisses files within the #ifdef.

If that turns out to be impractical, for instance because there are
nested #ifdefs or computed conditionals, then we’ll have to host a
cleaned up source tarball or repo somewhere.

Ricardo: could you look into it?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-09 13:49   ` Ludovic Courtès
@ 2015-05-09 16:41     ` Mark H Weaver
  2015-05-15 15:01       ` Ricardo Wurmus
  2015-05-09 21:06     ` Ricardo Wurmus
  1 sibling, 1 reply; 11+ messages in thread
From: Mark H Weaver @ 2015-05-09 16:41 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Mark H Weaver <mhw@netris.org> skribis:
>
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>
> [...]
>
>>> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
>>> released under non-free terms, but they are enclosed in #ifdef
>>> statements and the make flags we pass disable these functions at build
>>> time.
>>
>> This is not sufficient.  We will need to completely remove the non-free
>> functions from the source code using a snippet.  We cannot use a patch
>> because the patch would contain the non-free code.
>
> Indeed (I thought Kernel.{cpp,h} were the files being removed.)
>
> I guess there are two ways to address this: have a snippet that reads
> these two files line by line (with ‘read-line’ from (ice-9 rdelim)) and
> dismisses files within the #ifdef.
>
> If that turns out to be impractical, for instance because there are
> nested #ifdefs or computed conditionals, then we’ll have to host a
> cleaned up source tarball or repo somewhere.

There's another option that might be better: instead of reading the file
line-by-line, read the entire file into a single string, and then use
regexps to find the relevant section and remove it.  It might even be
possible to do it with a single regexp substitution.

      Mark

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-09 13:49   ` Ludovic Courtès
  2015-05-09 16:41     ` Mark H Weaver
@ 2015-05-09 21:06     ` Ricardo Wurmus
  1 sibling, 0 replies; 11+ messages in thread
From: Ricardo Wurmus @ 2015-05-09 21:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Ludovic Courtès writes:

>>> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
>>> released under non-free terms, but they are enclosed in #ifdef
>>> statements and the make flags we pass disable these functions at build
>>> time.
>>
>> This is not sufficient.  We will need to completely remove the non-free
>> functions from the source code using a snippet.  We cannot use a patch
>> because the patch would contain the non-free code.

> Ricardo: could you look into it?

Yes, I'll take care of this.  I'll try to have a patch ready in a couple
of days.

~~ Ricardo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-09 16:41     ` Mark H Weaver
@ 2015-05-15 15:01       ` Ricardo Wurmus
  2015-05-15 16:56         ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Wurmus @ 2015-05-15 15:01 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel


>>>> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
>>>> released under non-free terms, but they are enclosed in #ifdef
>>>> statements and the make flags we pass disable these functions at build
>>>> time.
>>>
>>> This is not sufficient.  We will need to completely remove the non-free
>>> functions from the source code using a snippet.  We cannot use a patch
>>> because the patch would contain the non-free code.

Just a quick update: I've added snippets to remove all non-free stuff
and it's compiling (after I applied a patch to R 3.2.0 which I will send
to the ML later).

Sadly, the RUNPATH validation is failing, so I first need to find some
time to fix this.  Would you like me to submit the patch to remove the
non-free parts first even though the RUNPATH validation is still
failing, or would you like me to submit this all at once instead?

~~ Ricardo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-15 15:01       ` Ricardo Wurmus
@ 2015-05-15 16:56         ` Ludovic Courtès
  2015-05-21  9:59           ` Ricardo Wurmus
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2015-05-15 16:56 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

>>>>> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also
>>>>> released under non-free terms, but they are enclosed in #ifdef
>>>>> statements and the make flags we pass disable these functions at build
>>>>> time.
>>>>
>>>> This is not sufficient.  We will need to completely remove the non-free
>>>> functions from the source code using a snippet.  We cannot use a patch
>>>> because the patch would contain the non-free code.
>
> Just a quick update: I've added snippets to remove all non-free stuff
> and it's compiling (after I applied a patch to R 3.2.0 which I will send
> to the ML later).

Great.

> Sadly, the RUNPATH validation is failing, so I first need to find some
> time to fix this.  Would you like me to submit the patch to remove the
> non-free parts first even though the RUNPATH validation is still
> failing, or would you like me to submit this all at once instead?

If the two are unrelated, feel free to commit the snippets already.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-15 16:56         ` Ludovic Courtès
@ 2015-05-21  9:59           ` Ricardo Wurmus
  2015-05-21 19:52             ` Ludovic Courtès
  2015-05-21 19:55             ` Ludovic Courtès
  0 siblings, 2 replies; 11+ messages in thread
From: Ricardo Wurmus @ 2015-05-21  9:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]

Attached is a patch to remove non-free source files as well as anything
in a "#ifdef USE_SVMLIGHT ... #endif" block.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-shogun-Remove-non-free-source-files.patch --]
[-- Type: text/x-patch, Size: 2700 bytes --]

From d409756bd2fc2db396d6257cfed42a213f6f43f6 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@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.
---
 gnu/packages/bioinformatics.scm | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index fa7ff4c..e1dfda1 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1605,7 +1605,41 @@ against local background noises.")
              "/sources/shogun-" version ".tar.bz2"))
        (sha256
         (base32
-         "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb"))))
+         "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb"))
+       (modules '((guix build utils)
+                  (ice-9 rdelim)))
+       (snippet
+        '(begin
+           ;; Remove non-free sources and files referencing them
+           (for-each delete-file
+                     (find-files "src/shogun/classifier/svm/"
+                                 "SVMLight\\.(cpp|h)"))
+           (for-each delete-file
+                     (find-files "examples/undocumented/libshogun/"
+                                 (string-append
+                                  "(classifier_.*svmlight.*|"
+                                  "evaluation_cross_validation_locked_comparison).cpp")))
+           ;; 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)"))))))
     (build-system cmake-build-system)
     (arguments
      '(#:tests? #f ;no check target
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-21  9:59           ` Ricardo Wurmus
@ 2015-05-21 19:52             ` Ludovic Courtès
  2015-05-21 19:55             ` Ludovic Courtès
  1 sibling, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2015-05-21 19:52 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@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.wurmus@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’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: gnu: shogun: Remove non-free source files.
  2015-05-21  9:59           ` Ricardo Wurmus
  2015-05-21 19:52             ` Ludovic Courtès
@ 2015-05-21 19:55             ` Ludovic Courtès
  1 sibling, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2015-05-21 19:55 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

You may actually be eligible for a GNU buck.  :-)

  http://www.gnu.org/help/gnu-bucks.html

Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-05-21 19:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 14:56 [PATCH]: gnu: shogun: Remove non-free source files Ricardo Wurmus
2015-05-08 17:30 ` Ludovic Courtès
2015-05-09  5:15 ` Mark H Weaver
2015-05-09 13:49   ` Ludovic Courtès
2015-05-09 16:41     ` Mark H Weaver
2015-05-15 15:01       ` Ricardo Wurmus
2015-05-15 16:56         ` Ludovic Courtès
2015-05-21  9:59           ` Ricardo Wurmus
2015-05-21 19:52             ` Ludovic Courtès
2015-05-21 19:55             ` Ludovic Courtès
2015-05-09 21:06     ` Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).