Re: core-updates: fonts-dir-builder fails

2017-08-08 Thread Danny Milosavljevic
Hi Ricardo,

> ERROR: In procedure open-file:
> ERROR: In procedure open-file: No such file or directory: "fonts.scale"
> builder for `/gnu/store/8j5bll1y0c3zrifrp984gd3gfarf0ra4-fonts-dir.drv' 
> failed with exit code 1
> cannot build derivation 
> `/gnu/store/md131pdqsvxmxna3ndwd5334x6876m54-profile.drv': 1 dependencies 
> couldn't be built
> guix package: error: build failed: build of 
> `/gnu/store/md131pdqsvxmxna3ndwd5334x6876m54-profile.drv' failed
> --8<---cut here---end--->8---
> 
> Could this be because (@@ (guix profiles) fonts-dir-file) first deletes
> the file and then checks if the file is empty?

It removes the fonts.scale, then invokes mkfontscale (which is supposed to 
create fonts.scale) and then it checks whether the fonts.scale is empty (in 
which case i would be unnecessary to store it).

Apparently it can happen that mkfontscale doesn't create a fonts.scale at all - 
maybe when there are no fonts in that directory?

If so, then it might make sense to amend the check at the end to 

(when (and (file-exists? fonts-scale-file) 
(empty-file? fonts-scale-file))
  (delete-file fonts-scale-file))
(when (and (file-exists? fonts-dir-file) 
(empty-file? fonts-dir-file))
  (delete-file fonts-dir-file

In the interest of defensive programming I think one ought to do that anyway.



Re: core-updates: fonts-dir-builder fails

2017-08-08 Thread Ricardo Wurmus

Ricardo Wurmus  writes:

> Hi Guix,
>
> I’m trying to install python-wrapper on core-updates:
>
> --8<---cut here---start->8---
[…]
> ERROR: In procedure open-file:
> ERROR: In procedure open-file: No such file or directory: "fonts.scale"
> builder for `/gnu/store/8j5bll1y0c3zrifrp984gd3gfarf0ra4-fonts-dir.drv' 
> failed with exit code 1
> cannot build derivation 
> `/gnu/store/md131pdqsvxmxna3ndwd5334x6876m54-profile.drv': 1 dependencies 
> couldn't be built
> guix package: error: build failed: build of 
> `/gnu/store/md131pdqsvxmxna3ndwd5334x6876m54-profile.drv' failed
> --8<---cut here---end--->8---
>
> Could this be because (@@ (guix profiles) fonts-dir-file) first deletes
> the file and then checks if the file is empty?

That’s exactly what happens.  I’ve fixed this locally with this patch:

>From 47b399ef085514b9269c881723cfd3ec8f1dc564 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus 
Date: Tue, 8 Aug 2017 16:05:58 +0200
Subject: [PATCH] profiles: Only check file contents if the file exists.

* guix/profiles.scm (fonts-dir-file): Check that files exist before using
"empty-file?".
---
 guix/profiles.scm | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index b3732f61e..0eb99f40d 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1095,9 +1095,11 @@ files for the fonts of the @var{manifest} entries."
 (unless (and (zero? (system* mkfontscale))
  (zero? (system* mkfontdir)))
   (exit #f))
-(when (empty-file? fonts-scale-file)
+(when (and (file-exists? fonts-scale-file)
+   (empty-file? fonts-scale-file))
   (delete-file fonts-scale-file))
-(when (empty-file? fonts-dir-file)
+(when (and (file-exists? fonts-dir-file)
+   (empty-file? fonts-dir-file))
   (delete-file fonts-dir-file
 directories)))
 
-- 
2.13.3


What do you think?  Should I push this?

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net