[Nix-dev] Why is unpackPhase special?

Marc Weber marco-oweber at gmx.de
Thu Aug 16 00:58:28 CEST 2007


On Mon, Aug 13, 2007 at 06:15:09PM +0200, Eelco Dolstra wrote:
> Marc Weber wrote:
> > unpackPhase is special because you can't omit it.
> 
> The only reason it's special is because of the "cd", so if you put the "cd" in
> unpackPhase then indeed this is no longer necessary :-)
> 
> There are a handful of packages in Nixpkgs which override unpackPhase and
> sourceRoot (lsof at least), so those would have to be updated.

lsof is using   
  unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=lsof_*; ";
                 ^^^^^^^^^^^^^^^^^^^^^^^^
The marked area does exactly what I'd propose.. (should work without
change though) Only nix expressions altering phases have to be updated
(unpackPhase has to be added.. but I did'nt find any except my own)
It should be possible to write
    unpackPhase = "unpackPhase; tar xvf lsof_*.tar; sourceRoot=lsof_*; ";
instead.

Something similar I've used for a ghc-6.7 expression.
    unpackPhase = "unpackPhase; tar -C gmp xfz gmp/gmp-*.tar.gz; rm gmp/gmp-*.tar.gz;";

Drawback: I have to recompile all packages because setup.sh is one of
the root files :-)

My proposal:

Index: generic/setup.sh
===================================================================
--- generic/setup.sh    (revision 9106)
+++ generic/setup.sh    (working copy)
@@ -481,6 +481,7 @@
     unpackW
     stopLog
     stopNest
+    cd $sourceRoot
 }
 
 
@@ -769,11 +770,8 @@
         return
     fi
 
-    unpackPhase
-    cd $sourceRoot
-
     if test -z "$phases"; then
-        phases="patchPhase configurePhase buildPhase checkPhase \
+        phases="unpackPhase patchPhase configurePhase buildPhase checkPhase \
             installPhase fixupPhase distPhase";
     fi
 


Now it's possible to use genericBuilder without unpackPhase or altering
the rest of phases depending on the unpackPhase..

Marc



More information about the nix-dev mailing list