From 1679aa6dc81d09b9b2f19b2f5f984ed9afea15fc Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Fri, 19 Apr 2019 01:11:46 +0200 Subject: [PATCH 1/2] pkgs/build-support: provide useful names in more fetchers --- pkgs/build-support/fetchbitbucket/default.nix | 2 +- pkgs/build-support/fetchbzr/default.nix | 6 ++---- pkgs/build-support/fetchcvs/default.nix | 7 ++++--- pkgs/build-support/fetchdarcs/default.nix | 7 +++---- pkgs/build-support/fetchgithub/default.nix | 2 +- pkgs/build-support/fetchgitlab/default.nix | 2 +- pkgs/build-support/fetchgitlocal/default.nix | 2 +- pkgs/build-support/fetchrepoorcz/default.nix | 2 +- pkgs/build-support/fetchsavannah/default.nix | 2 +- pkgs/build-support/fetchsvnrevision/default.nix | 4 ++-- pkgs/build-support/fetchsvnssh/default.nix | 2 +- pkgs/build-support/fetchzip/default.nix | 2 +- 12 files changed, 19 insertions(+), 21 deletions(-) diff --git a/pkgs/build-support/fetchbitbucket/default.nix b/pkgs/build-support/fetchbitbucket/default.nix index a99f72e9eaa75..bb896d215178a 100644 --- a/pkgs/build-support/fetchbitbucket/default.nix +++ b/pkgs/build-support/fetchbitbucket/default.nix @@ -1,6 +1,6 @@ { fetchzip }: -{ owner, repo, rev, name ? "source" +{ owner, repo, rev, name ? "${repo}-${builtins.substring 0 10 rev}" , ... # For hash agility }@args: fetchzip ({ inherit name; diff --git a/pkgs/build-support/fetchbzr/default.nix b/pkgs/build-support/fetchbzr/default.nix index f9250de4ee07e..8018ee653075b 100644 --- a/pkgs/build-support/fetchbzr/default.nix +++ b/pkgs/build-support/fetchbzr/default.nix @@ -1,9 +1,7 @@ { stdenvNoCC, bazaar }: -{ url, rev, sha256 }: +{ url, rev, sha256, name ? "bzr-export" }: stdenvNoCC.mkDerivation { - name = "bzr-export"; - builder = ./builder.sh; nativeBuildInputs = [ bazaar ]; @@ -11,5 +9,5 @@ stdenvNoCC.mkDerivation { outputHashMode = "recursive"; outputHash = sha256; - inherit url rev; + inherit url rev name; } diff --git a/pkgs/build-support/fetchcvs/default.nix b/pkgs/build-support/fetchcvs/default.nix index 1f7947d4d4529..2a5fae6cdd361 100644 --- a/pkgs/build-support/fetchcvs/default.nix +++ b/pkgs/build-support/fetchcvs/default.nix @@ -5,10 +5,11 @@ {stdenvNoCC, cvs, openssh}: -{cvsRoot, module, tag ? null, date ? null, sha256}: +{cvsRoot, module, tag ? null, date ? null, sha256 +, name ? "${module}-${if tag != null then tag else if date != null then date else "NOW"}" +}: stdenvNoCC.mkDerivation { - name = "cvs-export"; builder = ./builder.sh; nativeBuildInputs = [cvs openssh]; @@ -16,5 +17,5 @@ stdenvNoCC.mkDerivation { outputHashMode = "recursive"; outputHash = sha256; - inherit cvsRoot module sha256 tag date; + inherit cvsRoot module sha256 tag date name; } diff --git a/pkgs/build-support/fetchdarcs/default.nix b/pkgs/build-support/fetchdarcs/default.nix index 02777c9900dcc..3ff1f85c3ca7d 100644 --- a/pkgs/build-support/fetchdarcs/default.nix +++ b/pkgs/build-support/fetchdarcs/default.nix @@ -1,12 +1,11 @@ -{stdenvNoCC, darcs, cacert}: +{stdenvNoCC, lib, darcs, cacert}: -{url, rev ? null, context ? null, md5 ? "", sha256 ? ""}: +{url, rev ? null, context ? null, md5 ? "", sha256 ? "", name ? "${baseNameOf url}" + (lib.optional (rev != null) "-${rev}")}: if md5 != "" then throw "fetchdarcs does not support md5 anymore, please use sha256" else stdenvNoCC.mkDerivation { - name = "fetchdarcs"; builder = ./builder.sh; nativeBuildInputs = [cacert darcs]; @@ -14,5 +13,5 @@ stdenvNoCC.mkDerivation { outputHashMode = "recursive"; outputHash = sha256; - inherit url rev context; + inherit url rev context name; } diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index 66671dd0a6ae2..51a4355506456 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -1,6 +1,6 @@ { lib, fetchgit, fetchzip }: -{ owner, repo, rev, name ? "source" +{ owner, repo, rev, name ? "${repo}-${builtins.substring 0 10 rev}" , fetchSubmodules ? false, private ? false , githubBase ? "github.com", varPrefix ? null , ... # For hash agility diff --git a/pkgs/build-support/fetchgitlab/default.nix b/pkgs/build-support/fetchgitlab/default.nix index be110cf8393ec..2de40c5c52516 100644 --- a/pkgs/build-support/fetchgitlab/default.nix +++ b/pkgs/build-support/fetchgitlab/default.nix @@ -1,7 +1,7 @@ { fetchzip, lib }: # gitlab example -{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null +{ owner, repo, rev, domain ? "gitlab.com", name ? "${repo}-${builtins.substring 0 10 rev}", group ? null , ... # For hash agility }@args: fetchzip ({ inherit name; diff --git a/pkgs/build-support/fetchgitlocal/default.nix b/pkgs/build-support/fetchgitlocal/default.nix index fa19457755374..a0b28af0a3a00 100644 --- a/pkgs/build-support/fetchgitlocal/default.nix +++ b/pkgs/build-support/fetchgitlocal/default.nix @@ -26,7 +26,7 @@ let gitHash = builtins.readFile gitHashFile; # cache against git hash - nixPath = runCommand "put-in-nix" { + nixPath = runCommand "${baseNameOf srcStr}" { nativeBuildInputs = [ git ]; preferLocalBuild = true; } '' diff --git a/pkgs/build-support/fetchrepoorcz/default.nix b/pkgs/build-support/fetchrepoorcz/default.nix index 3ac7cace0dcf7..ef5e184f86131 100644 --- a/pkgs/build-support/fetchrepoorcz/default.nix +++ b/pkgs/build-support/fetchrepoorcz/default.nix @@ -1,7 +1,7 @@ { fetchzip }: # gitweb example, snapshot support is optional in gitweb -{ repo, rev, name ? "source" +{ repo, rev, name ? "${repo}-${builtins.substring 0 10 rev}" , ... # For hash agility }@args: fetchzip ({ inherit name; diff --git a/pkgs/build-support/fetchsavannah/default.nix b/pkgs/build-support/fetchsavannah/default.nix index 994922a58679d..35a3f889d6ecd 100644 --- a/pkgs/build-support/fetchsavannah/default.nix +++ b/pkgs/build-support/fetchsavannah/default.nix @@ -1,7 +1,7 @@ { fetchzip }: # cgit example, snapshot support is optional in cgit -{ repo, rev, name ? "source" +{ repo, rev, name ? "repo-${builtins.substring 0 10 rev}" , ... # For hash agility }@args: fetchzip ({ inherit name; diff --git a/pkgs/build-support/fetchsvnrevision/default.nix b/pkgs/build-support/fetchsvnrevision/default.nix index 288451a225c77..5e91d1bfa35ff 100644 --- a/pkgs/build-support/fetchsvnrevision/default.nix +++ b/pkgs/build-support/fetchsvnrevision/default.nix @@ -1,5 +1,5 @@ runCommand: subversion: repository: - import (runCommand "head-revision" + import (runCommand "${baseNameOf repository}-head-revision" { buildInputs = [ subversion ]; dummy = builtins.currentTime; } @@ -7,4 +7,4 @@ runCommand: subversion: repository: rev=$(echo p | svn ls -v --depth empty ${repository} |awk '{ print $1 }') echo "[ \"$rev\" ]" > $out echo Latest revision is $rev - '') \ No newline at end of file + '') diff --git a/pkgs/build-support/fetchsvnssh/default.nix b/pkgs/build-support/fetchsvnssh/default.nix index fbd74efd750ad..9586f8a378b9f 100644 --- a/pkgs/build-support/fetchsvnssh/default.nix +++ b/pkgs/build-support/fetchsvnssh/default.nix @@ -6,7 +6,7 @@ if md5 != "" then throw "fetchsvnssh does not support md5 anymore, please use sha256" else stdenvNoCC.mkDerivation { - name = "svn-export-ssh"; + name = "svn-export-${baseNameOf url}"; builder = ./builder.sh; nativeBuildInputs = [subversion expect]; diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix index f1b9b9290d4c3..ea8d2d4749bdb 100644 --- a/pkgs/build-support/fetchzip/default.nix +++ b/pkgs/build-support/fetchzip/default.nix @@ -11,7 +11,7 @@ stripRoot ? true , url , extraPostFetch ? "" -, name ? "source" +, name ? baseNameOf url , ... } @ args: (fetchurl ({ From d21759842e48e11c14ac656c1cafabb7c8dc429e Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Fri, 19 Apr 2019 01:14:04 +0200 Subject: [PATCH 2/2] treewide: use fetchFromRepoOrCz where appropriate --- pkgs/applications/audio/a2jmidid/default.nix | 9 +++++---- pkgs/applications/misc/llpp/default.nix | 7 +++---- .../networking/browsers/conkeror/default.nix | 8 ++++---- .../git-and-tools/fast-export/default.nix | 6 +++--- .../version-management/git-and-tools/git2cl/default.nix | 8 ++++---- .../windowmaker/dockapps/alsamixer.app.nix | 6 +++--- pkgs/development/libraries/libtar/default.nix | 8 ++++---- pkgs/development/tools/analysis/smatch/default.nix | 6 +++--- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pkgs/applications/audio/a2jmidid/default.nix b/pkgs/applications/audio/a2jmidid/default.nix index 70709ae4ac4c0..897779ba8651b 100644 --- a/pkgs/applications/audio/a2jmidid/default.nix +++ b/pkgs/applications/audio/a2jmidid/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchpatch, makeWrapper, pkgconfig, alsaLib, dbus, libjack2 +{ stdenv, fetchFromRepoOrCz, fetchpatch, makeWrapper, pkgconfig, alsaLib, dbus, libjack2 , wafHook , python2Packages}: @@ -8,9 +8,10 @@ in stdenv.mkDerivation rec { name = "a2jmidid-${version}"; version = "8"; - src = fetchurl { - url = "https://repo.or.cz/a2jmidid.git/snapshot/7383d268c4bfe85df9f10df6351677659211d1ca.tar.gz"; - sha256 = "06dgf5655znbvrd7fhrv8msv6zw8vk0hjqglcqkh90960mnnmwz7"; + src = fetchFromRepoOrCz { + repo = "a2jmidid"; + rev = "7383d268c4bfe85df9f10df6351677659211d1ca"; + sha256 = "0j22la0zjixcw55x8ccfpabnv1ljl487s0b9yaj4ykrv1731wr5y"; }; nativeBuildInputs = [ pkgconfig makeWrapper wafHook ]; diff --git a/pkgs/applications/misc/llpp/default.nix b/pkgs/applications/misc/llpp/default.nix index 5ae652d750d12..cdf656ee34840 100644 --- a/pkgs/applications/misc/llpp/default.nix +++ b/pkgs/applications/misc/llpp/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, substituteAll, makeWrapper, fetchgit, ocaml, mupdf, libX11, +{ stdenv, lib, substituteAll, makeWrapper, fetchFromRepoOrCz, ocaml, mupdf, libX11, libGLU_combined, freetype, xclip, inotify-tools, procps }: assert lib.versionAtLeast (lib.getVersion ocaml) "4.07"; @@ -7,11 +7,10 @@ stdenv.mkDerivation rec { name = "llpp-${version}"; version = "30"; - src = fetchgit { - url = "git://repo.or.cz/llpp.git"; + src = fetchFromRepoOrCz { + repo = "llpp"; rev = "v${version}"; sha256 = "0iilpzf12hs0zky58j55l4y5dvzv7fc53nsrg324n9vka92mppvd"; - fetchSubmodules = false; }; patches = (substituteAll { diff --git a/pkgs/applications/networking/browsers/conkeror/default.nix b/pkgs/applications/networking/browsers/conkeror/default.nix index be1389c2121f7..e23708b91c459 100644 --- a/pkgs/applications/networking/browsers/conkeror/default.nix +++ b/pkgs/applications/networking/browsers/conkeror/default.nix @@ -1,13 +1,13 @@ -{ stdenv, fetchgit, unzip, firefox-esr, makeWrapper }: +{ stdenv, fetchFromRepoOrCz, unzip, firefox-esr, makeWrapper }: stdenv.mkDerivation rec { pkgname = "conkeror"; version = "1.0.4"; name = "${pkgname}-${version}"; - src = fetchgit { - url = git://repo.or.cz/conkeror.git; - rev = "refs/tags/${version}"; + src = fetchFromRepoOrCz { + repo = "conkeror"; + rev = version; sha256 = "10c57wqybp9kcjpkb01wxq0h3vafcdb1g5kb4k8sb2zajg59afv8"; }; diff --git a/pkgs/applications/version-management/git-and-tools/fast-export/default.nix b/pkgs/applications/version-management/git-and-tools/fast-export/default.nix index fd50febb46991..ce32f7c670941 100644 --- a/pkgs/applications/version-management/git-and-tools/fast-export/default.nix +++ b/pkgs/applications/version-management/git-and-tools/fast-export/default.nix @@ -1,11 +1,11 @@ -{stdenv, fetchgit, mercurial, makeWrapper, subversion}: +{stdenv, fetchFromRepoOrCz, mercurial, makeWrapper, subversion}: with stdenv.lib; stdenv.mkDerivation { name = "fast-export"; - src = fetchgit { - url = git://repo.or.cz/fast-export.git; + src = fetchFromRepoOrCz { + repo = "fast-export"; rev = "d202200fd9daa75cdb37d4cf067d4ca00e269535"; sha256 = "0m4llsg9rx4sza1kf39kxsdvhi6y87a18wm5k19c5r2h3vpylwcc"; }; diff --git a/pkgs/applications/version-management/git-and-tools/git2cl/default.nix b/pkgs/applications/version-management/git-and-tools/git2cl/default.nix index 044800fe73a6c..7766b26659a5e 100644 --- a/pkgs/applications/version-management/git-and-tools/git2cl/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git2cl/default.nix @@ -1,12 +1,12 @@ -{ fetchgit, stdenv, perl }: +{ fetchFromRepoOrCz, stdenv, perl }: stdenv.mkDerivation { name = "git2cl-20080827"; - src = fetchgit { - url = "git://repo.or.cz/git2cl.git"; + src = fetchFromRepoOrCz { + repo = "git2cl"; rev = "8373c9f74993e218a08819cbcdbab3f3564bbeba"; - sha256 = "b0d39379640c8a12821442431e2121f7908ce1cc88ec8ec6bede218ea8c21f2f"; + sha256 = "0bqzqal8w8fypv38xv48rkhqr47p44hiwhs22j1152hcciwr7lxh"; }; buildInputs = [ perl ]; diff --git a/pkgs/applications/window-managers/windowmaker/dockapps/alsamixer.app.nix b/pkgs/applications/window-managers/windowmaker/dockapps/alsamixer.app.nix index e708682e3036f..0eaf89c019a67 100644 --- a/pkgs/applications/window-managers/windowmaker/dockapps/alsamixer.app.nix +++ b/pkgs/applications/window-managers/windowmaker/dockapps/alsamixer.app.nix @@ -1,9 +1,9 @@ -{ stdenv, fetchgit, pkgconfig, libX11, libXpm, libXext, alsaLib }: +{ stdenv, fetchFromRepoOrCz, pkgconfig, libX11, libXpm, libXext, alsaLib }: stdenv.mkDerivation { name = "alsamixer.app-0.2.1"; - src = fetchgit { - url = git://repo.or.cz/dockapps.git; + src = fetchFromRepoOrCz { + repo = "dockapps"; rev = "38c74350b02f35824554ce0c4f0f251d71762040"; sha256 = "0g9cwhlqg065fbhav4g4n16a4cqkk9jykl3y0zwbn5whhacfqyhl"; }; diff --git a/pkgs/development/libraries/libtar/default.nix b/pkgs/development/libraries/libtar/default.nix index f2cb879b3e073..4698617ab600a 100644 --- a/pkgs/development/libraries/libtar/default.nix +++ b/pkgs/development/libraries/libtar/default.nix @@ -1,13 +1,13 @@ -{ stdenv, fetchgit, fetchpatch, autoreconfHook }: +{ stdenv, fetchFromRepoOrCz, fetchpatch, autoreconfHook }: stdenv.mkDerivation rec { version = "1.2.20"; name = "libtar-${version}"; # Maintenance repo for libtar (Arch Linux uses this) - src = fetchgit { - url = "git://repo.or.cz/libtar.git"; - rev = "refs/tags/v${version}"; + src = fetchFromRepoOrCz { + repo = "libtar"; + rev = "v${version}"; sha256 = "1pjsqnqjaqgkzf1j8m6y5h76bwprffsjjj6gk8rh2fjsha14rqn9"; }; diff --git a/pkgs/development/tools/analysis/smatch/default.nix b/pkgs/development/tools/analysis/smatch/default.nix index 9dc1e2db8c090..ba168c7c7cdbe 100644 --- a/pkgs/development/tools/analysis/smatch/default.nix +++ b/pkgs/development/tools/analysis/smatch/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, sqlite, pkgconfig, perl +{ stdenv, fetchFromRepoOrCz, sqlite, pkgconfig, perl , buildllvmsparse ? true , buildc2xml ? true , llvm ? null, libxml2 ? null @@ -10,8 +10,8 @@ assert buildc2xml -> libxml2 != null; stdenv.mkDerivation { name = "smatch-20120924"; - src = fetchgit { - url = git://repo.or.cz/smatch.git; + src = fetchFromRepoOrCz { + repo = "smatch"; rev = "23656e3e578b700cbf96d043f039e6341a3ba5b9"; sha256 = "0r43qi6vryqg450fj73yjwbb7gzcgx64rhrhb3r1m6a252srijiy"; };