Re: [PATCH] handle misquoting of target in build-scripts

2022-10-31 Thread felix . winkelmann
> On Sun, Oct 30, 2022 at 02:46:49PM +0100, felix.winkelm...@bevuta.com wrote:
> > Another follow-up patch on the recent change of quoting in chicken-install, 
> > which causes
> > chicken-do to always fire (and thus rebuilding any egg, regardless of 
> > status).
>
> I noticed there were still inconsistencies here.
> How about the attached patch instead?  It may be a little bit
> trickier to read (but not by much), but should eliminate the
> problem entirely for chicken-do calls.
>

Thanks, pushed. I had to hand-apply the patch as git-am didn't like it. I also
fixed a scrutinizer warning.


felix




Re: [PATCH] Fix double normalize-destination call

2022-10-31 Thread felix . winkelmann
>
> It looks like that's actually a bug in the egg though - contrast to the
> srfi-19 egg which *does* work, it has (data srf-29-bundles (files ...))
> instead.

This has been fixed in the latest amb release (3.0.7).
>
> The attached patch fixes the double call to normalize-destination on the
> directory for "share" files (data files)
>

Thanks, pushed.


felix




[PATCH] Fix double normalize-destination call

2022-10-31 Thread Peter Bex
Hi all,

While testing my previous patch on Windows, I noticed some weird error
output during the installation phase.  It would say several times in a
row:
The filename, directory name, or volume label syntax is incorrect.

If you look at the foo.install.bat file, there's calls to mkdir which
include the chicken PREFIX twice.

Then, I realised this also happens in *nix.  For example, try to install
the "amb" egg.  Just before it emits the egg-info file, it emits several
calls to mkdir -p /path/to/chicken/path/to/chicken/share, which ought
to be just /path/to/chicken/share.

After investigating further, I realised these 5 calls correspond to
the (data ...) components in the egg, which aren't actually installed!

If you install the amb egg and then run the following command from the
target directory: "find -name amb-dwelling.scm", it turns up nothing.
The amb-dwelling.scm file also doesn't even occur in the install script.

It looks like that's actually a bug in the egg though - contrast to the
srfi-19 egg which *does* work, it has (data srf-29-bundles (files ...))
instead.

The attached patch fixes the double call to normalize-destination on the
directory for "share" files (data files)

Cheers,
Peter
From e8341cca08c43e8bac1c5d08aaac670f5c37d211 Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Mon, 31 Oct 2022 13:06:26 +0100
Subject: [PATCH] Do not double call normalize-destination on share dir

In install-random-files, don't call normalize-destination on the
destination directory - this is already done in compile-egg-info

Before, we'd see things like in the install script like:
  mkdir -p /path/to/chicken/path/to/chicken/share
With this patch, it becomes:
  mkdir -p /path/to/chicken/share
which is as it should be.
---
 egg-compile.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index 6818c6e4..5a59a43f 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -990,7 +990,7 @@
  (root (string-append srcdir "/"))
  (mkdir (mkdir-command platform))
  (sfiles (map (cut prefix srcdir <>) files))
- (dfile (qs* (normalize-destination dest mode) platform #t))
+ (dfile (qs* dest platform #t))
  (ddir (shell-variable "DESTDIR" platform)))
 (print "\n" mkdir " " ddir dfile)
 (let-values (((ds fs) (partition directory? sfiles)))
-- 
2.36.2



signature.asc
Description: PGP signature


Re: [PATCH] handle misquoting of target in build-scripts

2022-10-31 Thread Peter Bex
On Sun, Oct 30, 2022 at 02:46:49PM +0100, felix.winkelm...@bevuta.com wrote:
> Another follow-up patch on the recent change of quoting in chicken-install, 
> which causes
> chicken-do to always fire (and thus rebuilding any egg, regardless of status).

I noticed there were still inconsistencies here.
How about the attached patch instead?  It may be a little bit
trickier to read (but not by much), but should eliminate the
problem entirely for chicken-do calls.

Cheers,
Peter
From 730c74994a5feb96ef5d1d7ac2afdefbad65db7a Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Mon, 31 Oct 2022 11:44:52 +0100
Subject: [PATCH] Hopefully completely fix quoting hell in generated build
 commands

Instead of using a mess of "qs*", "joins", "slashify" and "filelist"
and hoping for the best when generating chicken-do commands, use a
more principled method by way of a helper procedure to print the build
command.

This helper will receive *only* unquoted arguments: the list of
targets, list of dependencies and the build command line with flags as
a list.  It then calls "qs*" on all of these where needed and emits a
corresponding chicken-do line.

By doing it this way, it's much more obvious where quotation happens:
only in print-build-command, and never in the procedure that calls it.
For consistency, also change prepare-custom-command so that it accepts
an unquoted filename, so that quotation is delegated to it.

For now, leave the code that emits installation commands untouched.
We'll probably want to do the same for these though.
---
 egg-compile.scm | 333 +---
 1 file changed, 142 insertions(+), 191 deletions(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index 23af8b4e..6818c6e4 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -595,9 +595,8 @@
link-objects modules
custom types-file inline-file)
  srcdir platform)
-  (let* ((cmd (qs* (or (custom-cmd custom srcdir platform)
-  default-csc)
-  platform))
+  (let* ((cmd (or (custom-cmd custom srcdir platform)
+ default-csc))
  (sname (prefix srcdir name))
  (tfile (prefix srcdir (conc types-file ".types")))
  (ifile (prefix srcdir (conc inline-file ".inline")))
@@ -613,51 +612,46 @@
(list "-emit-inline-file" ifile)
'(
  (out1 (conc sname ".static"))
- (out2 (qs* (target-file (conc out1
-   (object-extension platform))
- mode)
-platform))
+ (out2 (target-file (conc out1
+  (object-extension platform))
+mode))
  (out3 (if (null? link-objects)
out2
-   (qs* (target-file (conc out1
-   (archive-extension platform))
- mode)
-platform)))
+   (target-file (conc out1
+  (archive-extension platform))
+mode)))
  (targets (append (list out3 lfile)
   (maybe types-file tfile)
   (maybe inline-file ifile)
   (map (lambda (m)
  (prefix srcdir (conc m ".import.scm")))
(or modules '()
- (src (qs* (or source (conc name ".scm")) platform)))
+ (src (or source (conc name ".scm"
 (when custom
   (prepare-custom-command cmd platform))
-(print "\n" (qs* default-builder platform #t) " "
-   (joins targets platform) " : "
-   src " " (qs* eggfile platform) " "
-   (if custom cmd "") " "
-   (filelist srcdir source-dependencies platform)
-   " : " cmd
-   (if keep-generated-files " -k" "")
-   " -regenerate-import-libraries"
-   (if modules " -J" "") " -M"
-   " -setup-mode -static -I " srcdir 
-   " -emit-link-file " (qs* lfile platform)
-   (if (eq? mode 'host) " -host" "")
-   " -D compiling-extension -c -unit " name
-   " -D compiling-static-extension"
-   " -C -I" srcdir " " (joins opts platform) 
-   " " src " -o " out2)
+(print-build-command targets
+`(,@(filelist srcdir source-dependencies) ,src ,eggfile
+  ,@(if custom (list cmd) '()))
+`(,cmd ,@(if keep-generated-files '("-k") '())
+   "-regenerate-import-libraries"
+   ,@(if modules '("-J") '()) "-M"
+   "-setup-mode" "-static" "-I" ,srcdir 
+   "-emit-link-file" ,lfile
+   

Re: [PATCH] simplification/refactoring

2022-10-31 Thread Peter Bex
On Sun, Oct 30, 2022 at 02:48:27PM +0100, felix.winkelm...@bevuta.com wrote:
> in egg-compile.scm, as suggested by Peter.

Thanks, pushed.

Cheers,
Peter


signature.asc
Description: PGP signature