GNU bug report logs - #28281
[PATCH] gnu: Add os-prober.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Tue, 29 Aug 2017 19:08:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28281 in the body.
You can then email your comments to 28281 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Tue, 29 Aug 2017 19:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arun Isaac <arunisaac <at> systemreboot.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 29 Aug 2017 19:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: guix-patches <at> gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] gnu: Add os-prober.
Date: Wed, 30 Aug 2017 00:36:28 +0530
* gnu/packages/bootloaders.scm (os-prober): New variable.
---
 gnu/packages/bootloaders.scm | 66 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index f66d0bb3f..57d284be6 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -395,3 +395,69 @@ also initializes the boards (RAM etc).")
 
 (define-public u-boot-odroid-c2
   (make-u-boot-package "odroid-c2" "aarch64-linux-gnu"))
+
+(define-public os-prober
+  (package
+    (name "os-prober")
+    (version "1.76")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://debian/pool/main/o/os-prober/os-prober_"
+                           version ".tar.xz"))
+       (sha256
+        (base32
+         "1vb45i76bqivlghrq7m3n07qfmmq4wxrkplqx8gywj011rhq19fk"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 ftw)     ; for ftw
+                  (ice-9 regex)   ; for string-match
+                  (srfi srfi-2)   ; for and-let*
+                  (srfi srfi-26)) ; for cut
+       #:make-flags (list "CC=gcc")
+       #:tests? #f ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* (find-files ".")
+               (("/usr") (assoc-ref outputs "out")))
+             (substitute* (find-files "." "50mounted-tests$")
+               (("mkdir") "mkdir -p"))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (lib (string-append out "/lib"))
+                    (share (string-append out "/share")))
+               (for-each (cut install-file <> bin)
+                         (list "linux-boot-prober" "os-prober"))
+               (install-file "newns" (string-append lib "/os-prober"))
+               (install-file "common.sh" (string-append share "/os-prober"))
+               (install-file "os-probes/mounted/powerpc/20macosx"
+                             (string-append lib "/os-probes/mounted"))
+               (for-each
+                (lambda (directory)
+                  (ftw directory
+                       (lambda (file stat flag)
+                         (when (eq? flag 'regular)
+                           (and-let* ((result (or (string-match "/common/" file)
+                                                  (string-match "/x86/" file))))
+                             (install-file
+                              file (dirname
+                                    (string-append
+                                     lib "/" (substring file 0 (match:start result 0))
+                                     (substring file (1- (match:end result 0))))))))
+                         #t)))
+                (list "os-probes" "linux-boot-probes"))
+               #t))))))
+    (home-page "https://joeyh.name/code/os-prober")
+    (synopsis "Detect other operating systems")
+    (description "os-prober probes disks on the system for other operating
+systems so that they can be added to the bootloader.  It also works out how to
+boot existing GNU/Linux systems and detects what distribution is installed in
+order to add a suitable bootloader menu entry.")
+    (license license:gpl2+)))
-- 
2.13.4





Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Tue, 29 Aug 2017 19:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 28281 <at> debbugs.gnu.org
Subject: Re: bug#28281: Acknowledgement ([PATCH] gnu: Add os-prober.)
Date: Wed, 30 Aug 2017 00:49:38 +0530
It would be good if someone with a dual boot installation actually
verifies that os-prober is able to detect the other operating system. I
believe you just have to run os-prober as root without any command-line
arguments.

# os-prober

More detailed instructions are in the README file of the source tarball.




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Thu, 31 Aug 2017 13:27:03 GMT) Full text and rfc822 format available.

Message #11 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [bug#28281] [PATCH] gnu: Add os-prober.
Date: Thu, 31 Aug 2017 15:25:48 +0200
Hi!

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

> * gnu/packages/bootloaders.scm (os-prober): New variable.

[...]

> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (bin (string-append out "/bin"))
> +                    (lib (string-append out "/lib"))
> +                    (share (string-append out "/share")))
> +               (for-each (cut install-file <> bin)
> +                         (list "linux-boot-prober" "os-prober"))
> +               (install-file "newns" (string-append lib "/os-prober"))
> +               (install-file "common.sh" (string-append share "/os-prober"))
> +               (install-file "os-probes/mounted/powerpc/20macosx"
> +                             (string-append lib "/os-probes/mounted"))
> +               (for-each
> +                (lambda (directory)
> +                  (ftw directory
> +                       (lambda (file stat flag)
> +                         (when (eq? flag 'regular)
> +                           (and-let* ((result (or (string-match "/common/" file)
> +                                                  (string-match "/x86/" file))))
> +                             (install-file
> +                              file (dirname
> +                                    (string-append
> +                                     lib "/" (substring file 0 (match:start result 0))
> +                                     (substring file (1- (match:end result 0))))))))
> +                         #t)))

For clarity, what about (1) using ‘find-files’ instead of ‘ftw’, and (2)
separating code that builds the list of files from code that calls
‘install-file’?

So something like:

  (define (candidate-files directory)
    (find-files directory
                (lambda (file stat)
                  (and (eq? (stat:kind stat) 'regular)
                       …))))

  (for-each (lambda (file)
              (install-file file …))
            (append-map candidate-files
                        (list "os-probes" "linux-boot-probes")))

WDYT?

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Thu, 31 Aug 2017 17:42:02 GMT) Full text and rfc822 format available.

Message #14 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [bug#28281] [PATCH] gnu: Add os-prober.
Date: Thu, 31 Aug 2017 23:11:26 +0530
> For clarity, what about (1) using ‘find-files’ instead of ‘ftw’

I started with something like that and switched to `ftw' for slightly
shorter code. But, I guess clarity is more important.

> (2) separating code that builds the list of files from code that calls
> ‘install-file’?

Sure, will do. I'll send an updated patch with both changes
incorporated.

This package is really so messed up. I don't know why they couldn't have
just provided us with a Makefile for installation. Sigh...




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Sat, 09 Sep 2017 17:18:02 GMT) Full text and rfc822 format available.

Message #17 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 28281 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] gnu: Add os-prober.
Date: Sat,  9 Sep 2017 22:46:35 +0530
* gnu/packages/bootloaders.scm (os-prober): New variable.
---
 gnu/packages/bootloaders.scm | 69 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index f66d0bb3f..613537a5d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -395,3 +395,72 @@ also initializes the boards (RAM etc).")
 
 (define-public u-boot-odroid-c2
   (make-u-boot-package "odroid-c2" "aarch64-linux-gnu"))
+
+(define-public os-prober
+  (package
+    (name "os-prober")
+    (version "1.76")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://debian/pool/main/o/os-prober/os-prober_"
+                           version ".tar.xz"))
+       (sha256
+        (base32
+         "1vb45i76bqivlghrq7m3n07qfmmq4wxrkplqx8gywj011rhq19fk"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 regex)   ; for string-match
+                  (srfi srfi-26)) ; for cut
+       #:make-flags (list "CC=gcc")
+       #:tests? #f ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* (find-files ".")
+               (("/usr") (assoc-ref outputs "out")))
+             (substitute* (find-files "." "50mounted-tests$")
+               (("mkdir") "mkdir -p"))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (define (find-files-non-recursive directory)
+               (find-files directory
+                           (lambda (file stat)
+                             (string-match (string-append "^" directory "/[^/]*$")
+                                           file))
+                           #:directories? #t))
+
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (lib (string-append out "/lib"))
+                    (share (string-append out "/share")))
+               (for-each (cut install-file <> bin)
+                         (list "linux-boot-prober" "os-prober"))
+               (install-file "newns" (string-append lib "/os-prober"))
+               (install-file "common.sh" (string-append share "/os-prober"))
+               (install-file "os-probes/mounted/powerpc/20macosx"
+                             (string-append lib "/os-probes/mounted"))
+               (for-each
+                (lambda (directory)
+                  (for-each
+                   (lambda (file)
+                     (let ((destination (string-append lib "/" directory
+                                                       "/" (basename file))))
+                       (mkdir-p (dirname destination))
+                       (copy-recursively file destination)))
+                   (append (find-files-non-recursive (string-append directory "/common"))
+                           (find-files-non-recursive (string-append directory "/x86")))))
+                (list "os-probes" "os-probes/mounted" "os-probes/init"
+                      "linux-boot-probes" "linux-boot-probes/mounted"))
+               #t))))))
+    (home-page "https://joeyh.name/code/os-prober")
+    (synopsis "Detect other operating systems")
+    (description "os-prober probes disks on the system for other operating
+systems so that they can be added to the bootloader.  It also works out how to
+boot existing GNU/Linux systems and detects what distribution is installed in
+order to add a suitable bootloader menu entry.")
+    (license license:gpl2+)))
-- 
2.14.1





Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Sat, 09 Sep 2017 17:25:02 GMT) Full text and rfc822 format available.

Message #20 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 28281 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Sat, 09 Sep 2017 22:54:27 +0530
Here's an updated patch.

> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (define (find-files-non-recursive directory)
> +               (find-files directory
> +                           (lambda (file stat)
> +                             (string-match (string-append "^" directory "/[^/]*$")
> +                                           file))
> +                           #:directories? #t))

Do you think it would be a good idea to add a #:recursive? keyword
argument to `find-files' in (guix build utils), instead of creating this
`find-files-non-recursive-function' here?

> +             (let* ((out (assoc-ref outputs "out"))
> +                    (bin (string-append out "/bin"))
> +                    (lib (string-append out "/lib"))
> +                    (share (string-append out "/share")))
> +               (for-each (cut install-file <> bin)
> +                         (list "linux-boot-prober" "os-prober"))
> +               (install-file "newns" (string-append lib "/os-prober"))
> +               (install-file "common.sh" (string-append share "/os-prober"))
> +               (install-file "os-probes/mounted/powerpc/20macosx"
> +                             (string-append lib "/os-probes/mounted"))
> +               (for-each
> +                (lambda (directory)
> +                  (for-each
> +                   (lambda (file)
> +                     (let ((destination (string-append lib "/" directory
> +                                                       "/" (basename file))))
> +                       (mkdir-p (dirname destination))
> +                       (copy-recursively file destination)))
> +                   (append (find-files-non-recursive (string-append directory "/common"))
> +                           (find-files-non-recursive (string-append directory "/x86")))))
> +                (list "os-probes" "os-probes/mounted" "os-probes/init"
> +                      "linux-boot-probes" "linux-boot-probes/mounted"))
> +               #t))))))

I have used `find-files' instead of `ftw', as you suggested. The install
procedure is clearer now. but still remains quite messy. It is not
simple enough to separate the "candidate-files" and "install-file"
logic.

WDYT? Will the above code do?




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Sun, 10 Sep 2017 13:07:02 GMT) Full text and rfc822 format available.

Message #23 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Sun, 10 Sep 2017 15:05:55 +0200
Heya,

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

> Here's an updated patch.
>
>> +         (replace 'install
>> +           (lambda* (#:key outputs #:allow-other-keys)
>> +             (define (find-files-non-recursive directory)
>> +               (find-files directory
>> +                           (lambda (file stat)
>> +                             (string-match (string-append "^" directory "/[^/]*$")
>> +                                           file))
>> +                           #:directories? #t))
>
> Do you think it would be a good idea to add a #:recursive? keyword
> argument to `find-files' in (guix build utils), instead of creating this
> `find-files-non-recursive-function' here?

Hmm I didn’t understand that it *had* to be non-recursive.  Does it
really make a difference?

If it does, then ‘scandir’ from (ice-9 ftw) would be the thing.  Sorry
if I led you in the wrong direction.  :-/

>> +             (let* ((out (assoc-ref outputs "out"))
>> +                    (bin (string-append out "/bin"))
>> +                    (lib (string-append out "/lib"))
>> +                    (share (string-append out "/share")))
>> +               (for-each (cut install-file <> bin)
>> +                         (list "linux-boot-prober" "os-prober"))
>> +               (install-file "newns" (string-append lib "/os-prober"))
>> +               (install-file "common.sh" (string-append share "/os-prober"))
>> +               (install-file "os-probes/mounted/powerpc/20macosx"
>> +                             (string-append lib "/os-probes/mounted"))
>> +               (for-each
>> +                (lambda (directory)
>> +                  (for-each
>> +                   (lambda (file)
>> +                     (let ((destination (string-append lib "/" directory
>> +                                                       "/" (basename file))))
>> +                       (mkdir-p (dirname destination))
>> +                       (copy-recursively file destination)))
>> +                   (append (find-files-non-recursive (string-append directory "/common"))
>> +                           (find-files-non-recursive (string-append directory "/x86")))))
>> +                (list "os-probes" "os-probes/mounted" "os-probes/init"
>> +                      "linux-boot-probes" "linux-boot-probes/mounted"))
>> +               #t))))))
>
> I have used `find-files' instead of `ftw', as you suggested. The install
> procedure is clearer now. but still remains quite messy. It is not
> simple enough to separate the "candidate-files" and "install-file"
> logic.
>
> WDYT? Will the above code do?

Sure.  I mean, we should try our best to make things clearer, while not
losing our hairs on it.  Sometimes it just has to be messy.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Sun, 10 Sep 2017 16:04:02 GMT) Full text and rfc822 format available.

Message #26 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Sun, 10 Sep 2017 21:32:19 +0530
>>> +         (replace 'install
>>> +           (lambda* (#:key outputs #:allow-other-keys)
>>> +             (define (find-files-non-recursive directory)
>>> +               (find-files directory
>>> +                           (lambda (file stat)
>>> +                             (string-match (string-append "^" directory "/[^/]*$")
>>> +                                           file))
>>> +                           #:directories? #t))
>>
>> Do you think it would be a good idea to add a #:recursive? keyword
>> argument to `find-files' in (guix build utils), instead of creating this
>> `find-files-non-recursive-function' here?
>
> Hmm I didn’t understand that it *had* to be non-recursive.  Does it
> really make a difference?

I am trying to do

cp -r /some/directory/* destination

To do this, I used `find-files-non-recursive' to get all files in
/some/directory/ and applied `copy-recursively' on each one of them.

Do you have a better way of doing this in mind?

> If it does, then ‘scandir’ from (ice-9 ftw) would be the thing.  Sorry
> if I led you in the wrong direction.  :-/

Yes, scandir could be used. But, it also returns "." and "..", and I'll
have to filter them out. So code length, or clarity-wise, it won't be
much of an improvement. That is why I thought adding a #:recursive?
argument to `find-files' would be nice.

>>> +             (let* ((out (assoc-ref outputs "out"))
>>> +                    (bin (string-append out "/bin"))
>>> +                    (lib (string-append out "/lib"))
>>> +                    (share (string-append out "/share")))
>>> +               (for-each (cut install-file <> bin)
>>> +                         (list "linux-boot-prober" "os-prober"))
>>> +               (install-file "newns" (string-append lib "/os-prober"))
>>> +               (install-file "common.sh" (string-append share "/os-prober"))
>>> +               (install-file "os-probes/mounted/powerpc/20macosx"
>>> +                             (string-append lib "/os-probes/mounted"))
>>> +               (for-each
>>> +                (lambda (directory)
>>> +                  (for-each
>>> +                   (lambda (file)
>>> +                     (let ((destination (string-append lib "/" directory
>>> +                                                       "/" (basename file))))
>>> +                       (mkdir-p (dirname destination))
>>> +                       (copy-recursively file destination)))
>>> +                   (append (find-files-non-recursive (string-append directory "/common"))
>>> +                           (find-files-non-recursive (string-append directory "/x86")))))
>>> +                (list "os-probes" "os-probes/mounted" "os-probes/init"
>>> +                      "linux-boot-probes" "linux-boot-probes/mounted"))
>>> +               #t))))))




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Sun, 10 Sep 2017 20:42:02 GMT) Full text and rfc822 format available.

Message #29 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Sun, 10 Sep 2017 22:41:37 +0200
Arun Isaac <arunisaac <at> systemreboot.net> skribis:

>>>> +         (replace 'install
>>>> +           (lambda* (#:key outputs #:allow-other-keys)
>>>> +             (define (find-files-non-recursive directory)
>>>> +               (find-files directory
>>>> +                           (lambda (file stat)
>>>> +                             (string-match (string-append "^" directory "/[^/]*$")
>>>> +                                           file))
>>>> +                           #:directories? #t))
>>>
>>> Do you think it would be a good idea to add a #:recursive? keyword
>>> argument to `find-files' in (guix build utils), instead of creating this
>>> `find-files-non-recursive-function' here?
>>
>> Hmm I didn’t understand that it *had* to be non-recursive.  Does it
>> really make a difference?
>
> I am trying to do
>
> cp -r /some/directory/* destination
>
> To do this, I used `find-files-non-recursive' to get all files in
> /some/directory/ and applied `copy-recursively' on each one of them.
>
> Do you have a better way of doing this in mind?

Would (copy-recursively "/some/directory" destination) work for you?

>> If it does, then ‘scandir’ from (ice-9 ftw) would be the thing.  Sorry
>> if I led you in the wrong direction.  :-/
>
> Yes, scandir could be used. But, it also returns "." and "..", and I'll
> have to filter them out. So code length, or clarity-wise, it won't be
> much of an improvement. That is why I thought adding a #:recursive?
> argument to `find-files' would be nice.

Yeah, looks like none of the options is a perfect match.

HTH,
LUdo’.




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Sun, 10 Sep 2017 23:37:01 GMT) Full text and rfc822 format available.

Message #32 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Mon, 11 Sep 2017 05:05:54 +0530
>> I am trying to do
>>
>> cp -r /some/directory/* destination
>>
>> To do this, I used `find-files-non-recursive' to get all files in
>> /some/directory/ and applied `copy-recursively' on each one of them.
>>
>> Do you have a better way of doing this in mind?
>
> Would (copy-recursively "/some/directory" destination) work for you?

No, it wouldn't. That would recreate /some/directory at the
destination. I only want the files inside /some/directory to be copied,
not /some/directory itself.




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Mon, 11 Sep 2017 07:29:01 GMT) Full text and rfc822 format available.

Message #35 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Mon, 11 Sep 2017 09:28:30 +0200
Hi Arun,

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

>>> I am trying to do
>>>
>>> cp -r /some/directory/* destination
>>>
>>> To do this, I used `find-files-non-recursive' to get all files in
>>> /some/directory/ and applied `copy-recursively' on each one of them.
>>>
>>> Do you have a better way of doing this in mind?
>>
>> Would (copy-recursively "/some/directory" destination) work for you?
>
> No, it wouldn't. That would recreate /some/directory at the
> destination. I only want the files inside /some/directory to be copied,
> not /some/directory itself.

Ah sorry.  Then yeah, either ‘scandir’ or ‘find-files’, whichever you
find is the least cumbersome.

Feel free to push something along these lines!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Mon, 11 Sep 2017 17:24:02 GMT) Full text and rfc822 format available.

Message #38 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Mon, 11 Sep 2017 22:53:03 +0530
>>> Would (copy-recursively "/some/directory" destination) work for you?
>>
>> No, it wouldn't. That would recreate /some/directory at the
>> destination. I only want the files inside /some/directory to be copied,
>> not /some/directory itself.
>
> Ah sorry.  Then yeah, either ‘scandir’ or ‘find-files’, whichever you
> find is the least cumbersome.
>
> Feel free to push something along these lines!

Not sure I follow you. Should I

1. push the patch I sent most recently

OR

2. or add a #:recursive? argument to `find-files', and push a patch
which uses this new `find-files'?

IMO, approach 2 is a better idea, though it could be that we are adding
too many keyword arguments to `find-files'.

WDYT?




Information forwarded to guix-patches <at> gnu.org:
bug#28281; Package guix-patches. (Mon, 11 Sep 2017 20:22:02 GMT) Full text and rfc822 format available.

Message #41 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Mon, 11 Sep 2017 22:20:59 +0200
Arun Isaac <arunisaac <at> systemreboot.net> skribis:

>>>> Would (copy-recursively "/some/directory" destination) work for you?
>>>
>>> No, it wouldn't. That would recreate /some/directory at the
>>> destination. I only want the files inside /some/directory to be copied,
>>> not /some/directory itself.
>>
>> Ah sorry.  Then yeah, either ‘scandir’ or ‘find-files’, whichever you
>> find is the least cumbersome.
>>
>> Feel free to push something along these lines!
>
> Not sure I follow you. Should I
>
> 1. push the patch I sent most recently
>
> OR
>
> 2. or add a #:recursive? argument to `find-files', and push a patch
> which uses this new `find-files'?
>
> IMO, approach 2 is a better idea, though it could be that we are adding
> too many keyword arguments to `find-files'.
>
> WDYT?

I’m for approach #1, go for it!  :-)

Approach #2 would take a full rebuild, and it would make ‘find-files’
equivalent to ‘scandir’, so not worth it IMO.

Sorry for being unclear!

Ludo’.




Reply sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Wed, 13 Sep 2017 23:23:01 GMT) Full text and rfc822 format available.

Notification sent to Arun Isaac <arunisaac <at> systemreboot.net>:
bug acknowledged by developer. (Wed, 13 Sep 2017 23:23:02 GMT) Full text and rfc822 format available.

Message #46 received at 28281-done <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 28281-done <at> debbugs.gnu.org
Cc: ludo <at> gnu.org
Subject: Re: [PATCH] gnu: Add os-prober.
Date: Thu, 14 Sep 2017 04:52:30 +0530
>> Should I
>>
>> 1. push the patch I sent most recently
>>
>> OR
>>
>> 2. or add a #:recursive? argument to `find-files', and push a patch
>> which uses this new `find-files'?
>>
>> IMO, approach 2 is a better idea, though it could be that we are adding
>> too many keyword arguments to `find-files'.
>>
>> WDYT?
>
> I’m for approach #1, go for it!  :-)

Ok, pushed!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 Oct 2017 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 253 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.