1
0
Fork 0

centralize/simplify version management

This commit is contained in:
Sebastien Bourdeauducq 2019-02-15 22:34:56 +08:00
parent ee649bf364
commit 065f6edb95
5 changed files with 19 additions and 14 deletions

View File

@ -1,21 +1,18 @@
{ pkgs }: { pkgs }:
{ artiqSrc, boardBinaries, target, variant }: { target, variant, boardBinaries }:
with pkgs; with pkgs;
let let
version = import ./pkgs/artiq-version.nix;
fakeCondaSource = runCommand "fake-condasrc-artiq-board-${target}-${variant}" { } fakeCondaSource = runCommand "fake-condasrc-artiq-board-${target}-${variant}" { }
'' ''
cp --no-preserve=mode,ownership -R ${artiqSrc} $out mkdir -p $out/fake-conda;
mkdir $out/fake-conda;
cat << EOF > $out/fake-conda/meta.yaml cat << EOF > $out/fake-conda/meta.yaml
package: package:
name: artiq-board-${target}-${variant} name: artiq-board-${target}-${variant}
version: 5e.{{ environ["GIT_FULL_HASH"][:8] }} version: ${version}
source:
git_url: ..
build: build:
noarch: python noarch: python

View File

@ -4,18 +4,25 @@ with pkgs;
let let
artiqSrc = import ./pkgs/artiq-src.nix { inherit fetchgit; }; artiqSrc = import ./pkgs/artiq-src.nix { inherit fetchgit; };
version = import ./pkgs/artiq-version.nix;
fakeCondaSource = runCommand "fake-condasrc-artiq" { } fakeCondaSource = runCommand "fake-condasrc-artiq" { }
'' ''
cp --no-preserve=mode,ownership -R ${artiqSrc} $out mkdir -p $out/fake-conda;
mkdir $out/fake-conda;
# work around yet more idiotic conda behavior - build breaks if write permissions aren't set on source files.
cp --no-preserve=mode,ownership -R ${artiqSrc} workaround-conda
pushd workaround-conda
tar cf $out/src.tar .
popd
rm -rf workaround-conda
cat << EOF > $out/fake-conda/meta.yaml cat << EOF > $out/fake-conda/meta.yaml
package: package:
name: artiq name: artiq
version: 5e.{{ environ["GIT_FULL_HASH"][:8] }} version: ${version}
source: source:
git_url: .. url: ../src.tar
{% set data = load_setup_py_data() %} {% set data = load_setup_py_data() %}

View File

@ -22,10 +22,9 @@ let
start // { start // {
"artiq-board-${board.target}-${board.variant}" = boardBinaries; "artiq-board-${board.target}-${board.variant}" = boardBinaries;
"conda-artiq-board-${board.target}-${board.variant}" = import ./conda-artiq-board.nix { inherit pkgs; } { "conda-artiq-board-${board.target}-${board.variant}" = import ./conda-artiq-board.nix { inherit pkgs; } {
artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
boardBinaries = boardBinaries;
target = board.target; target = board.target;
variant = board.variant; variant = board.variant;
boardBinaries = boardBinaries;
}; };
}) {} boards; }) {} boards;
in rec { in rec {

View File

@ -64,7 +64,8 @@ pyqtgraph-qt5 = python3Packages.buildPythonPackage rec {
in in
python3Packages.buildPythonPackage rec { python3Packages.buildPythonPackage rec {
name = "artiq"; name = "artiq-${version}";
version = import ./artiq-version.nix;
src = import ./artiq-src.nix { inherit fetchgit; }; src = import ./artiq-src.nix { inherit fetchgit; };
buildInputs = [ git ]; buildInputs = [ git ];
propagatedBuildInputs = with python3Packages; [ binutils-or1k llvm-or1k llvmlite levenshtein pyqtgraph-qt5 aiohttp pygit2 pythonparser numpy dateutil quamash scipy prettytable pyserial asyncserial h5py cython regex qt5Full pyqt5 ]; propagatedBuildInputs = with python3Packages; [ binutils-or1k llvm-or1k llvmlite levenshtein pyqtgraph-qt5 aiohttp pygit2 pythonparser numpy dateutil quamash scipy prettytable pyserial asyncserial h5py cython regex qt5Full pyqt5 ];

View File

@ -15,6 +15,7 @@ let
leaveDotGit = true; leaveDotGit = true;
} }
EOF EOF
echo \"5e.`cut -c1-8 <<< $REV`\" > $out/pkgs/artiq-version.nix
''; '';
artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; }; artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; };
jobs = builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs; jobs = builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs;