From 065f6edb95a1b101e65897ce349ea85f68af629c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 15 Feb 2019 22:34:56 +0800 Subject: [PATCH] centralize/simplify version management --- artiq/conda-artiq-board.nix | 11 ++++------- artiq/conda-artiq.nix | 15 +++++++++++---- artiq/default.nix | 3 +-- artiq/pkgs/artiq.nix | 3 ++- main.nix | 1 + 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/artiq/conda-artiq-board.nix b/artiq/conda-artiq-board.nix index 78d3b6b..e801326 100644 --- a/artiq/conda-artiq-board.nix +++ b/artiq/conda-artiq-board.nix @@ -1,21 +1,18 @@ { pkgs }: -{ artiqSrc, boardBinaries, target, variant }: +{ target, variant, boardBinaries }: with pkgs; let + version = import ./pkgs/artiq-version.nix; fakeCondaSource = runCommand "fake-condasrc-artiq-board-${target}-${variant}" { } '' - cp --no-preserve=mode,ownership -R ${artiqSrc} $out - mkdir $out/fake-conda; + mkdir -p $out/fake-conda; cat << EOF > $out/fake-conda/meta.yaml package: name: artiq-board-${target}-${variant} - version: 5e.{{ environ["GIT_FULL_HASH"][:8] }} - - source: - git_url: .. + version: ${version} build: noarch: python diff --git a/artiq/conda-artiq.nix b/artiq/conda-artiq.nix index ba8ba25..74a5c64 100644 --- a/artiq/conda-artiq.nix +++ b/artiq/conda-artiq.nix @@ -4,18 +4,25 @@ with pkgs; let artiqSrc = import ./pkgs/artiq-src.nix { inherit fetchgit; }; + version = import ./pkgs/artiq-version.nix; fakeCondaSource = runCommand "fake-condasrc-artiq" { } '' - cp --no-preserve=mode,ownership -R ${artiqSrc} $out - mkdir $out/fake-conda; + mkdir -p $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 package: name: artiq - version: 5e.{{ environ["GIT_FULL_HASH"][:8] }} + version: ${version} source: - git_url: .. + url: ../src.tar {% set data = load_setup_py_data() %} diff --git a/artiq/default.nix b/artiq/default.nix index eb18131..d78f05b 100644 --- a/artiq/default.nix +++ b/artiq/default.nix @@ -22,10 +22,9 @@ let start // { "artiq-board-${board.target}-${board.variant}" = boardBinaries; "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; variant = board.variant; + boardBinaries = boardBinaries; }; }) {} boards; in rec { diff --git a/artiq/pkgs/artiq.nix b/artiq/pkgs/artiq.nix index 419d9d1..b6bbad5 100644 --- a/artiq/pkgs/artiq.nix +++ b/artiq/pkgs/artiq.nix @@ -64,7 +64,8 @@ pyqtgraph-qt5 = python3Packages.buildPythonPackage rec { in python3Packages.buildPythonPackage rec { - name = "artiq"; + name = "artiq-${version}"; + version = import ./artiq-version.nix; src = import ./artiq-src.nix { inherit fetchgit; }; 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 ]; diff --git a/main.nix b/main.nix index c5281d8..f5b394f 100644 --- a/main.nix +++ b/main.nix @@ -15,6 +15,7 @@ let leaveDotGit = true; } EOF + echo \"5e.`cut -c1-8 <<< $REV`\" > $out/pkgs/artiq-version.nix ''; artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; }; jobs = builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs;