Skip to content

Commit 7aae279

Browse files
committed
unstableGitUpdater: fix updating fetchzip-based sources
a67950f added `url` attribute from `fetchurl` and therefore also from `fetchzip`. We previously relied on `url` from fetchgit-based fetchers to find the repo URL but now it will just return tarballs in the case of `fetchFrom{GitHub,GitLab}`. Let’s add an attribute to `fetch{git,FromGitHub,FromGitLab}` to expose a repo URL consistently.
1 parent 1daa1ed commit 7aae279

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

pkgs/build-support/fetchgit/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,8 @@ stdenvNoCC.mkDerivation {
9292
];
9393

9494
inherit preferLocalBuild meta;
95+
96+
passthru = {
97+
gitRepoUrl = url;
98+
};
9599
}

pkgs/build-support/fetchgithub/default.nix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,20 @@ let
4242
'';
4343
netrcImpureEnvVars = [ "${varBase}USERNAME" "${varBase}PASSWORD" ];
4444
};
45+
46+
gitRepoUrl = "${baseUrl}.git";
47+
4548
fetcherArgs = (if useFetchGit
4649
then {
47-
inherit rev deepClone fetchSubmodules sparseCheckout; url = "${baseUrl}.git";
50+
inherit rev deepClone fetchSubmodules sparseCheckout; url = gitRepoUrl;
4851
} // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; }
49-
else { url = "${baseUrl}/archive/${rev}.tar.gz"; }
52+
else {
53+
url = "${baseUrl}/archive/${rev}.tar.gz";
54+
55+
passthru = {
56+
inherit gitRepoUrl;
57+
};
58+
}
5059
) // privateAttrs // passthruAttrs // { inherit name; };
5160
in
5261

pkgs/build-support/fetchgitlab/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ let
1515
useFetchGit = deepClone || fetchSubmodules || leaveDotGit;
1616
fetcher = if useFetchGit then fetchgit else fetchzip;
1717

18+
gitRepoUrl = "${protocol}://${domain}/${slug}.git";
19+
1820
fetcherArgs = (if useFetchGit then {
1921
inherit rev deepClone fetchSubmodules leaveDotGit;
20-
url = "${protocol}://${domain}/${slug}.git";
22+
url = gitRepoUrl;
2123
} else {
2224
url = "${protocol}://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRev}";
25+
26+
passthru = {
27+
inherit gitRepoUrl;
28+
};
2329
}) // passthruAttrs // { inherit name; };
2430
in
2531

pkgs/common-updater/unstable-updater.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let
4949
# By default we set url to src.url
5050
if [[ -z "$url" ]]; then
5151
url="$(${nix}/bin/nix-instantiate $systemArg --eval -E \
52-
"with import ./. {}; $UPDATE_NIX_ATTR_PATH.src.url or $UPDATE_NIX_ATTR_PATH.src.meta.homepage" \
52+
"with import ./. {}; $UPDATE_NIX_ATTR_PATH.src.gitRepoUrl" \
5353
| tr -d '"')"
5454
fi
5555

0 commit comments

Comments
 (0)