-
Notifications
You must be signed in to change notification settings - Fork 2k
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
make: pkg: introduce git-cache #5112
Conversation
One thing I don't know how to handle nicely is the git exec path. git picks up anything starting with "git-" as command, so in order for the build system to pick up git-cache, it has to be in PATH or GIT_EXEC_PATH has to point to it. I opted for the latter, but then git cannot find it's "https" remote helper, so currently I'm unsetting GIT_EXEC_PATH within git-cache, which seems hacky. |
An open question would be if the build should still fail if the cache cannot be updated, as that might mean that a remote repository is actually dead. |
Seems like in docker things are even more complicated. |
9d5da00
to
8b36390
Compare
Ok, modifying PATH is the only way I see. |
|
For the CI, you mean? |
@@ -20,6 +20,10 @@ RIOTPKG ?= $(RIOTBASE)/pkg | |||
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd) | |||
RIOTPROJECT := $(abspath $(RIOTPROJECT)) | |||
|
|||
# add git tools directory to PATH so git can pick it up | |||
PATH:=$(PATH):$(RIOTBASE)/dist/tools/git | |||
export PATH |
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'm not sure I would like it if a build script would modify my PATH variable. Maybe you can store the old value and restore it after the build?
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.
Also: Wouldn't this line append the additional path on every run?
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 export is only valid for sub-processes if make.
-----Original Message-----
From: Oleg Hahm notifications@github.com
To: RIOT-OS/RIOT RIOT@noreply.github.com
Cc: Kaspar Schleiser kaspar@schleiser.de
Sent: So., 20 März 2016 14:12
Subject: Re: [RIOT] make: pkg: introduce git-cache (#5112)
@@ -20,6 +20,10 @@ RIOTPKG ?= $(RIOTBASE)/pkg
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
RIOTPROJECT :=$(abspath $ (RIOTPROJECT))+# add git tools directory to PATH so git can pick it up
+PATH:=$(PATH):$(RIOTBASE)/dist/tools/git
+export PATH
I'm not sure I would like it if a build script would modify my PATH variable. Maybe you can store the old value and restore it after the build?
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/5112/files/8b363905f6854a7f841f884bf5b6e71c4010782a#r56764211
Couldn't you replace the calls with absolute paths? |
yep. -----Original Message-----
For the CI, you mean? You are receiving this because you authored the thread. |
Yeah, excellent idea! |
@OlegHahm Better? Never have failed builds because of unreachable remote repositories anymore! :) |
👍 |
8d16f11
to
12a1c5e
Compare
|
git clone "${REMOTE}" "${TARGET_PATH}" | ||
git -C "${TARGET_PATH}" checkout $SHA1 | ||
fi | ||
} |
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.
set +ex
@kaspar030, it's not clear to me how I can test this locally. I tried with the microcoap_server example: building it, then disconnect my computer from the network and try to build again, but it failed. I would have assumed that the git-cache clone command would handle this. |
@OlegHahm did you see the instructions in the beginning of the pr?
|
No I didn't. From looking at the diff it was clear to me if this information was still up to date and I couldn't figure if I would have to run this from pkg or $RIOTBASE.
Isn't there the URL parameter missing? |
Okay, got it. Can you add these instructions to the README? ACK once this is addressed. |
12a1c5e
to
812da2f
Compare
|
make: pkg: introduce git-cache
Currently, every package get's checked out from remote repositories on every build, sometimes multiple times.
This PR adds support for git-cache [1], transparently using a local copy of the requested SHA1, or reverting to the remote location if the cache doesn't exist, fails, or doesn't have the commit.
This should not affect anything unless git-cache is actually used.
In order to make use of the cache, install the git-cache binary into path.
Currently, repositories have to be added to the cache manually by executing
# git cache init
once per user, then# git cache add <name> <url>
once per repository.git cache update
fetches new commits from cached remote repos.[1] https://github.com/kaspar030/git-cache