use ARTIQ MAJOR_VERSION file

This commit is contained in:
Sebastien Bourdeauducq 2019-06-13 14:05:30 +08:00
parent 01e71b8511
commit 264cff7d4b
2 changed files with 6 additions and 4 deletions

View File

@ -5,10 +5,11 @@ 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` MAJOR_VERSION=`cat MAJOR_VERSION`
COMMIT_COUNT=`${git}/bin/git rev-list --count HEAD`
''; '';
installPhase = '' installPhase = ''
echo -n 5.$COMMITCOUNT.`cut -c1-8 <<< $REV`.beta > $out echo -n $MAJOR_VERSION.$COMMIT_COUNT.`cut -c1-8 <<< $REV`.beta > $out
''; '';
}; };
in in

View File

@ -5,7 +5,8 @@ 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` MAJOR_VERSION=`cat ${artiqSrc}/MAJOR_VERSION`
COMMIT_COUNT=`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
@ -21,7 +22,7 @@ let
sha256 = "$HASH"; sha256 = "$HASH";
} }
EOF EOF
echo "{ stdenv, git, fetchgit }: \"5.$COMMITCOUNT.`cut -c1-8 <<< $REV`.beta\"" > $out/pkgs/artiq-version.nix echo "{ stdenv, git, fetchgit }: \"$MAJOR_VERSION.$COMMIT_COUNT.`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 ]; }