[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#28281] [PATCH] gnu: Add os-prober.
From: |
Arun Isaac |
Subject: |
[bug#28281] [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))))))
- [bug#28281] [PATCH] gnu: Add os-prober., Arun Isaac, 2017/09/09
- [bug#28281] [PATCH] gnu: Add os-prober., Arun Isaac, 2017/09/09
- [bug#28281] [PATCH] gnu: Add os-prober., Ludovic Courtès, 2017/09/10
- [bug#28281] [PATCH] gnu: Add os-prober.,
Arun Isaac <=
- Message not available
- [bug#28281] [PATCH] gnu: Add os-prober., Ludovic Courtès, 2017/09/10
- [bug#28281] [PATCH] gnu: Add os-prober., Arun Isaac, 2017/09/10
- Message not available
- [bug#28281] [PATCH] gnu: Add os-prober., Ludovic Courtès, 2017/09/11
- [bug#28281] [PATCH] gnu: Add os-prober., Arun Isaac, 2017/09/11
- Message not available
- [bug#28281] [PATCH] gnu: Add os-prober., Ludovic Courtès, 2017/09/11
- bug#28281: [PATCH] gnu: Add os-prober., Arun Isaac, 2017/09/13