[Nix-dev] fetchcvs - proposal / What does the prefetch do now?

Marc Weber marco-oweber at gmx.de
Sat Nov 10 12:40:57 CET 2007


Why modifying it at all? 
Using the current fetcvs builder you are not able to export
'-D2007-20-10'
which is the only option if you don't want to use NOW (which breakes
things) if the author hasn't created tagnames .. (Or am I wrong here?)

I'm not able to get to know what the prefetch stuff does.
See my comment about the ugly export extra dirctory which doesn't harm.
It's there to get 
$out/configure instead of
$out/projektname/configure
(See comment)

I'd like to commit synergy which is using cvs.
Marc


============= original ===============================================

  fetchcvs = import ../build-support/fetchcvs {
    inherit stdenv cvs nix;
  };
--------
  {stdenv, cvs, nix}: {url, module, tag, md5}:

  stdenv.mkDerivation {
    name = "cvs-export";
    builder = ./builder.sh;
    buildInputs = [cvs nix];

    # Nix <= 0.7 compatibility.
    id = md5;

    outputHashAlgo = "md5";
    outputHashMode = "recursive";
    outputHash = md5;
    
    inherit url module tag;
  }
--------
  source $stdenv/setup

  header "exporting $url $module into $out"

  prefetch=$(dirname $out)/cvs-checkout-tmp-$outputHash
  echo $prefetch
  if test -e "$prefetch"; then
      mv $prefetch $out
  else
      if test -z "$tag"; then
        rtag="-DNOW"
      else
        rtag="-r $tag"
      fi
      cvs -f -d $url export $rtag -d $out $module
  fi

  stopNest


Drawback:


============= proposal ===============================================
  pkgs.fetchcvs = ... (the same)

--------
  # example tags:
  # "-DNOW" (get current version)
  # "-D2007-20-10" (get the last version before given date)
  # "-r <tagname>" (get version by tag name)
  {stdenv, cvs, nix}: {url, module, tag, sha256}:

  stdenv.mkDerivation {
    name = "cvs-export";
    builder = ./builder.sh;
    buildInputs = [cvs nix];

    inherit url module tag sha256;
  }


--------
  source $stdenv/setup

  if test -z "$tag"; then
    tag="-DNOW"
  fi
  # creating the export drictory and checking out there only to be able to
  # move the content without the root directory into $out ...
  # cvs -f -d "$url" export $tag -d "$out" "$module"
  # should work (but didn't - got no response on #cvs)
  # See als man page for those options

  ensureDir $out export
  cd export; cvs -f -d "$url" export $tag "$module"
  mv */* $out

  stopNest



More information about the nix-dev mailing list