artiq: better version numbers

This commit is contained in:
Sebastien Bourdeauducq 2019-05-06 23:09:11 +08:00
parent 141cb709de
commit 6114dbb738
2 changed files with 4 additions and 2 deletions

View File

@ -5,9 +5,10 @@ let
src = import ./artiq-src.nix { inherit fetchgit; }; src = import ./artiq-src.nix { inherit fetchgit; };
buildPhase = '' buildPhase = ''
REV=`${git}/bin/git rev-parse HEAD` REV=`${git}/bin/git rev-parse HEAD`
COMMITCOUNT=`${git}/bin/git rev-list --count HEAD`
''; '';
installPhase = '' installPhase = ''
echo -n 5e.`cut -c1-8 <<< $REV` > $out echo -n 5.$COMMITCOUNT.`cut -c1-8 <<< $REV`-beta > $out
''; '';
}; };
in in

View File

@ -5,6 +5,7 @@ let
'' ''
cp --no-preserve=mode,ownership -R ${./artiq} $out cp --no-preserve=mode,ownership -R ${./artiq} $out
REV=`git --git-dir ${artiqSrc}/.git rev-parse HEAD` REV=`git --git-dir ${artiqSrc}/.git rev-parse HEAD`
COMMITCOUNT=`git --git-dir ${artiqSrc}/.git rev-list --count HEAD`
TIMESTAMP=`git --git-dir ${artiqSrc}/.git log -1 --format=%ct` TIMESTAMP=`git --git-dir ${artiqSrc}/.git log -1 --format=%ct`
ARTIQ_SRC_CLEAN=`mktemp -d` ARTIQ_SRC_CLEAN=`mktemp -d`
cp -a ${artiqSrc}/. $ARTIQ_SRC_CLEAN cp -a ${artiqSrc}/. $ARTIQ_SRC_CLEAN
@ -20,7 +21,7 @@ let
sha256 = "$HASH"; sha256 = "$HASH";
} }
EOF EOF
echo "{ stdenv, git, fetchgit }: \"5e.`cut -c1-8 <<< $REV`\"" > $out/pkgs/artiq-version.nix echo "{ stdenv, git, fetchgit }: \"5.$COMMITCOUNT.`cut -c1-8 <<< $REV`-beta\"" > $out/pkgs/artiq-version.nix
echo "{ stdenv, git, fetchgit }: \"$TIMESTAMP\"" > $out/pkgs/artiq-timestamp.nix echo "{ stdenv, git, fetchgit }: \"$TIMESTAMP\"" > $out/pkgs/artiq-timestamp.nix
''; '';
generateTestOkHash = pkgs.runCommand "generate-test-ok-hash" { buildInputs = [ pkgs.nix ]; } generateTestOkHash = pkgs.runCommand "generate-test-ok-hash" { buildInputs = [ pkgs.nix ]; }