New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added fetchRepoProject #24239
Added fetchRepoProject #24239
Conversation
The name is ambiguous and people could it mixed it up with |
done | ||
|
||
export HOME=.repo | ||
repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these manifests always points to fixed revisions in other repos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep (or at least, they're supposed to)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think repo supports floating branch refs too, so that's a risk...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably this could be decided from case to case. But a fair warning would helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should the warning be presented?
stdenv.mkDerivation { | ||
inherit name cacert; | ||
buildCommand = with stdenv.lib; '' | ||
mkdir ./.repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is wrong here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should it be?
This was my initial reaction as well. I haven't heard of git-repo until now. +1 for fetchGoogleGitRepo.
|
I have renamed it to fetchRepoProject, I think that's a far better name |
a3172c3
to
e3d3c52
Compare
assert repoRepoRev != "" -> repoRepoURL != ""; | ||
|
||
stdenv.mkDerivation { | ||
inherit name cacert; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation seems kinda wonky across this file
Looks fine to me apart from the indentation being wonky |
Oh I see you asked earlier how it should look. This is how I'd do it, based on conventions I've seen elsewhere in nixpkgs: {stdenv, git, gitRepo, gnupg ? null, cacert}:
{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "",
localManifests ? [] }:
assert repoRepoRev != "" -> repoRepoURL != "";
stdenv.mkDerivation {
inherit name cacert;
buildCommand = with stdenv.lib; ''
mkdir ./.repo
mkdir ./.repo/local_manifests
for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests}
do
cp $local_manifest ./.repo/local_manifests/$(stripHash $local_manifest; echo $strippedName)
done
export HOME=.repo
repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle
${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"}
${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"}
${optionalString (referenceDir != "") " --reference=${referenceDir}"}
repo sync --jobs=$NIX_BUILD_CORES --current-branch
rm -rf $out/.repo
'';
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "SOCKS_SERVER"
];
buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;
preferLocalBuild = true;
enableParallelBuilding = true;
inherit manifest rev repoRepoURL repoRepoRev referenceDir;
} Edit: whoops, I screwed it up a bit by attempting to remove the string appends, but it shouldn't be hard to fix. |
e3d3c52
to
ef50fba
Compare
Alright @copumpkin I reformatted it like that (fixing the optionalString bits of course) |
ef50fba
to
4afc9e3
Compare
with import <nixpkgs> {}; | ||
let fetcher = import ./default.nix {inherit stdenv cacert | ||
git gitRepo gnupg;}; | ||
in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same formatting issues here, sorry 😄
name = "foo"; | ||
manifest = "https://github.com/CopperheadOS/platform_manifest.git"; | ||
rev="nougat-mr1.1-release"; | ||
sha256 = "51rhjsqka5v02zw6k0m4fnwz8xrx70ifar4afsndm88i6fbd3vaw"; #fake hash, don't worry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would I worry about the hash? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the hash is just a random hash to test that repo actually does its thing (that manifest branch, without a tag, follows HEAD)... also it fetches about 80GB of sources |-)
I could change it to a smaller project with a fixed rev, though?
8e6742b
to
cef00e7
Compare
Added to grab projects added by git-repo. Contains some problems still reguarding purity and clone.bundle, but good enough for now.
cef00e7
to
76e095c
Compare
Looks good to me, thanks! |
This broken evaluation, fixed in f6669da. |
@LnL7 that seems to have an optionalString on each (bash script) line? |
Oh shit, that's because I forgot to add the change before committing. What you have at the moment doesn't work, either, @LnL7 . |
Created a "fetchGitRepo" to fetch source repositories managed by Google's
git-repo
One problem is fetching clone.bundle 's fails due to python's urllib not being able to parse the result given by repo's call to
git config --get-regexp url.*.insteadof
, but this behaviour doesn't manifest when calling it from a normal shell, even in nixos.