-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
(ruby-modules/gem): (refactor) #53525
Conversation
git config user.email nixbld@localhost.none | ||
git config user.name Nix | ||
git add . | ||
git commit -m "Nixpkgs setup for rubygems" || true |
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 like this idea. Do you know if it's bit-reproducible?
You might be able to reduce a few lines by using --author
and also add --date=
just in case
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.
You might be able to reduce a few lines by using
--author
and also add--date=
just in case
Those flags only affect the author date, IIRC. You can’t set the committer through flags, although you can use environment variables.
But, shouldn’t git ls-files
report all files tracked by git? In that case, is a commit even necessary?
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 like this idea. Do you know if it's bit-reproducible?
It could definitely change between git versions. There’s a lot of stuff like initial repository config and sample hooks in a brand new repo.
Something like this could help:
nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git
Lines 245 to 246 in c514728
rm -rf .git/logs/ .git/hooks/ .git/index .git/FETCH_HEAD .git/ORIG_HEAD \ | |
.git/refs/remotes/origin/HEAD .git/config |
Aside from those, and possibly some other files like info/exclude, I think this would be bit-reproducible, unless the git repository format changed. There’s not really anything we could do about that, and it would already be a big problem for Nixpkgs.
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.
Excellent notes. I've removed the commit
which removes the requirement for config
and added that rm
. Retesting on my problem repo still works.
elif [[ "$type" == "git" ]]; then | ||
git init | ||
git add . | ||
rm -rf .git/logs/ .git/hooks/ .git/index .git/FETCH_HEAD .git/ORIG_HEAD .git/refs/remotes/origin/HEAD .git/config |
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.
Oh, really, you can remove .git/index
? What's left in .git
after this?
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 copied your reference above! I experimented directly, and removing the index clobbers the effect of git add
(which is obvious in hindsight). Reversing the order fixes it.
elif [[ "$type" == "git" ]]; then | ||
git init | ||
rm -rf .git/logs/ .git/hooks/ .git/index .git/FETCH_HEAD .git/ORIG_HEAD .git/refs/remotes/origin/HEAD .git/config | ||
git add . |
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 is the purpose of having the files in the staging area?
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.
Adding this at build time can be useful for git ls-files
to work.
Useful comments Co-Authored-By: nyarly <nyarly@users.noreply.github.com>
Comments are useful Co-Authored-By: nyarly <nyarly@users.noreply.github.com>
Motivation for this change
Rubygems with a
git
source useleaveDotGit
across the board. The upshot is that many unrelated changes to the upstream git repo (even on a gem that is referred to byref
) will change the fixed output digest and fail builds.Things done
This PR removes
leaveDotGit
and replaces it with a series of git commands to recreate the git repo locally during build. The reason for this is that many gems use some variation ofgit ls-files
rather than specifically enumerating their manifests. This is plainly wrong, but that battle is well lost.sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)I have used this branch to build a relatively complicated gemset.nix that includes git gems. Attempts to use
nox-review
exhausted the disk on my laptop.