How to use specific repo tool version - repo

I installed repo on my system, but why can't I see its version using 'repo --version' until 'repo init' is run!
Also to suppress repo init to connect to android repo git, I have to pass --repo-url. Is it possible to suppress this behaviour, because it forces me to use repo version from --repo-url and not the one I installed??

In order to ensure you use the newest version (or for compatibility), when you run repo init, repo tool will download a new version of repo in your .repo/repo. So by default, repo --version is designed to check the version in your .repo/repo.
If you want to avoid using --repo-url, you can download repo source and add the directory of repo source to your PATH environment variable.

Related

git-repo (aosp repo) tool checking-out projects again from local cache

We use the google git-repo tool (aosp repo) to manage a workspace of many git repositories. However, if you want to do a clean checkout that is exactly the same as the last workspace, using the command repo sync will pull in all the changes from remotes first.
How can you get the local repositories populated from only the local cache that is currently in the .repo/ directory?
You can use:
repo sync --local-only
From repo help:
$ repo help sync
[...]
-l, --local-only only update working tree, don't fetch

Why does repo command fail to find android.git.kernel.org and how do I get work around the failure if I cannot upgrade repo?

This answer points to the new repo command. The repo command points to the old site in older versions of repo. I have a shared Ubuntu 16 system where I was hesitant to update the repo command. How can point repo to the migrated repo at https://android.googlesource.com?
repo is just a Python script which has the correct url in the version I have on Ubuntu 18. Thus, a simple workaround is to just modify the URL in your script.
The failure is apparently a result of repo looking for its own repository so it can report if your current version is out of date (maybe it is used for other things?). My newer version of repo sets the URL differently:
The script looks for an environment variable named REPO_URL which, if set, overrides the location. If the variable is set, the script just uses it.
If the variable is not set, the script sets REPO_URL = 'https://gerrit.googlesource.com/git-repo'

repo init stop always check latest repo

Is it possible to stop verify/download newer repo from internet, such as
test $ repo init -u git#1.1.1.1/test/iot_manifest.git
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
remote: Counting objects: 1, done
remote: Finding sources: 100% (36/36)
...
You can't, the repo installed on your computer (the one in your $PATH) is not the full version of repo it is only a launcher.
From the repo documentation on source.android.com:
Repo comes in two parts: One is a launcher script you install, and it communicates with the second part, the full Repo tool included in a source code checkout.
When you run repo init for the first time it gets the full repo and store it in the .repo/repo directory. Every time you'll run repo init again in a brand new repository, the full repo will be downloaded again in .repo/repo.
One thing though you can stop getting the clone.bundle line with repo init --no-clone-bundle
Get repo from your own computer (without internet)
You can use a local version of repo, you need the internet at least to get the git-repo code once. After that you can use this version stored locally in place of the remote ones on Google server.
cd workspace
git clone https://gerrit.googlesource.com/git-repo
mkdir repo_init_no_internet && cd repo_init_no_internet
repo init --repo-url=/home/<user>/workspace/git-repo

How do I install a specific version of a git commit library in Linux?

How to install a specific version of git commit in Linux? When any program requests for the library it should take from the installation.
Eg:
The following version of wiringPi is required by one of my c++ program.
git://git.drogon.net/wiringPi
Version: 5edd177112c99416f68ba3e8c6c4db6ed942e796
Add a checkout statement after you clone?
Eg:
git clone git://git.drogon.net/wiringPi
git checkout 5edd177112c99416f68ba3e8c6c4db6ed942e796
Then you type the build and installation commands - if you want everything to use it, it probably needs to go in the default location. For the package you're looking at the documentation says it's:
./build
If you already have a version from a package manager (like apt you should remove that first - the README.md from the package you linked explains how to do this)

Changing the location of git installation on linux

I apologize if this seems basic but I'm new to linux and not really sure how to proceed. My current git version is 1.7.1 and is located in /usr/bin/git but a newer version of git (1.8) is now available in /usr/src/git/bin/git. How do I make git use this version by default as opposed to the 1.7.1 version?
You have to make sure to call the right executable. This can ben done by explicitly calling /usr/src/git/bin/git instead of git. Of course this would be annoying to type all the time, so you can either make git an alias for that path by adding the line
alias git=/usr/src/git/bin/git
to your .bashrc, or add the directory /usr/src/git/bin to your binary search path by adding the line
export PATH="/usr/src/git/bin:$PATH"
To test that the other git installation searches for the core binaries in the right place, you can check the output of git --exec-path.

Resources