I want to run a git command only to specific repositories.
I know 'repo forall' will help to run a command to all the git projects in that repo.
But, I want to run on specific projects.
For an example.
repo forall -c "git checkout -t remotes/origin/TESTBRANCH"
Will run the git command to checkout to TESTBRANCH for all projects.
But I want to checkout only few projects,
1. kernel
2. frameworks/av
3. hardware/qcom/media.
Tried as below,
repo forall -c "git checkout -t remotes/origin/TESTBRANCH" kernel frameworks/av hardware/qcom/media`
But, not working. Can anyone help?
As indicated by the documentation (repo help forall), the project names should go before the -c option:
repo forall kernel frameworks/av hardware/qcom/media \
-c "git checkout -t remotes/origin/TESTBRANCH"
Related
I have started my AOSP download with lot of hiccups.
I followed the google official site instructions.
$ mkdir ~/aosp/bin
$ PATH=~/aosp/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/aosp/bin/repo
$ chmod a+x ~/aosp/bin/repo
$ mkdir zero
$ cd zero
$ git config --global user.name "Your Name"
$ git config --global user.email "you#example.com
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r1
$ repo sync -j2 -f
As of now my .repo folder is 40GB and sync is still on its been 2 days. Please can anybody help me, all I need is KitKat OS.
Also could anyone enlighten me about project-object and project directories in repo directory.
Thanks in advance
When you do:
repo sync -j2 -f
You are synchronizing everything, which is huge. Give this a try:
repo sync -j8 -c
This will only synch the initialized manifest, which is not as big. When you don't specify a manifest name with -m option, if falls to look for default.xml, which as I can see in https://android.googlesource.com/platform/manifest/+/refs/heads/android-4.4.2_r1 that's the manifest file for the branch you want.
Also -j specifies the threads used, nowadays you can give -j8 at least a try.
With -f you force the download, this does not affect on the size of what you download, nor the speed. You can drop it if desired.
Hope it helps!
After a week's struggle completed the repo sync of KITKAT OS from google. even though you select only a particular OS, It will go upto 58 GB. Out of that 58 GB your KITKAT OS will be only of 9.5 GB. Rest is your .repo in your WORKING DIRECTORY. After sync is complete you will find your OS source in your WORKING DIRECTORY along side .repo.
STEPS:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ git config --global user.name "Your Name"
$ git config --global user.email "you#example.com"
$ repo init -u https://android.googlesource.com/platform/manifest -b OS version
check with google's "source code tags and build" page to select your OS version.
$ repo sync -j18 -c
flags that can be used with repo sync
sync-j - The value for this will be the number of threads to use when syncing the system. Parallelization helps get the job done quicker, but could also get the computer or the network stuck. Using 4 threads is what commonly used for syncing.
sync-c - syncing only the current branch/tag from git. This will checkout for each project only the current branch/tag that we specify for it, and not any other branches that exists on the repository. This will help save some space and bandwidth (and also time), but if you’ll need to switch between branches on a specific project later on - you’ll need to fetch it manually.
it took 8 days for me to get this done as my internet speed is slow (100kbps).
Thank you #Olaia for all the help. hope this helps for anyone out there.
I am running linux mint 17.2, I have repo installed and the path to repo is added to my .bashrc. I have previously initiated my repo.
I have followed the instructions on the Android Source Downloading and How to Build CyanogenMod pages.
The problem is: I have written a bash script to automate a number of the commands I would like to use to start a build. My script in a simple form is the following:
#!/bin/bash
cd ~/Android/Cyanogenmod/cm12_1/android/system
source build/envsetup.sh
repo sync --force-sync -j8
exec $SHELL
When I run this, it reports:
/home/username/Desktop/Cyanogenmod_cm12_1_Grouper_Build : line 4 repo: command not found
If I copy and paste each line into a fresh terminal instance (or by just running a script of #!/bin/bash exec $SHELL to open a terminal) it works perfectly.
What I have tried: I have tried including a sleep 10 before the repo sync --force-sync -j8 but that made no difference. I have also tried explicitly initiating the repo and force adding it to my PATH for the current terminal session directly before attempting the repo sync --force-sync -j8. The code for that test was the following:
#!/bin/bash
mkdir -p ~/Android/Cyanogenmod/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/Android/Cyanogenmod/bin/repo
chmod a+x ~/Android/Cyanogenmod/bin/repo
cd ~/Android/Cyanogenmod/cm12_1/android/system/
source build/envsetup.sh
PATH=~/Android/Cyanogenmod/bin/repo:$PATH
repo sync --force-sync -j8
exec $SHELL
The following 2 questions have a similar title, but neither are my question, this and this.
Any help or suggestions would be great, thank you!
To summarize, there turned out to be 2 problems. The first, was in my attempted solution of manually setting the path in the script as PATH=~/Android/Cyanogenmod/bin/repo:$PATH should have been just PATH=~/Android/Cyanogenmod/bin:$PATH.
The second, and overall larger problem, was an incorrectly added PATH variable (to repo) in my .bashrc. This was fixed by adding the line export PATH=$PATH:$HOME/Android/Cyanogenmod/bin to the end of my .profile, followed by logging out/in.
I am new to kernel building on android. I have a moto g. I used the cm source code and built a basic cm kernel. It booted. Now i want to cherrypick. I have cloned another repo. Now i want to cherry pick stuff into my kernel from that local source. I tried googling a lot but couldn't come up with a way. Can anyone help me?
Here I would like to share an idea to solve your problem.
Push the branch (where your stuff exists) from one repository to another where you want to cherry-pick your stuff.
For example, your stuff exists in kernel-1 repository on branch-1 branch and you want to cherry-pick your stuff into kernel-2 repository on branch-2 branch.
Go to kernel-1 repository.
$ cd $WORKSPACE/kernel-1
$ git checkout branch-1
$ git push $WORKSPACE/kernel-2 HEAD:refs/heads/branch-1
Now go to kernel-2 repository.
$ cd $WORKSPACE/kernel-2
And you will find branch-1 here. So you can cherry-pick your stuff.
I am assuming that you have two folder.
1. kernel (change will be cherry-picked into here)
2. optimus (change will be cherry-picked from here)
Go to optimus folder and craete a branch say, my-local-stuff from your stuff.
$ cd optimus
$ git checkout -b my-local-stuff <your stuff>
$ git push <absolute path of kernel folder> HEAD:refs/heads/my-local-stuff
Now go to kernel folder and you will find my-local-stuff branch.
$ cd kernel
$ git checkout my-local-stuff
$ git log
<you can see the commits which you have created into optimus folder>
Now cherry-pick the commit whatever you need into whichever branches.
Please let me know if more explanation is needed.
I downloaded Android 2.2 source code a long time ago but it didn't have the kernel source code. I looked online and it seems like there is a separate Android kernel source I should download.
Someone gave me this address
git clone https://android.googlesource.com/kernel/common
but I think I should specify the version and branch.
So what is the full command to download Android 2.2 froyo kernel source code?
For other kernels you could use any of these:
git clone https://android.googlesource.com/kernel/common.git
git clone https://android.googlesource.com/kernel/goldfish.git
git clone https://android.googlesource.com/kernel/msm.git
git clone https://android.googlesource.com/kernel/omap.git
git clone https://android.googlesource.com/kernel/samsung.git
git clone https://android.googlesource.com/kernel/tegra.git
git clone https://android.googlesource.com/kernel/common.git is not enough !
cd common
List all the branches:
git branch -a
Checkout one of them:
git checkout android-2.6.39
Get tools:
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
Get repo tool:
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Get source code:
$ repo init -u https://android.googlesource.com/platform/manifest
OR
$ repo init -u https://android.googlesource.com/platform/manifest -b release-1.0
OR
$ repo init -u https://android.googlesource.com/platform/manifest -b android-sdk-1.5_r2
$ repo sync`
Sync single project:
$ repo sync {project_name}
Get common kernel:
$ git clone https://android.googlesource.com/kernel/common
To add to #Aloongs answer ->
Get the source using Git:
git checkout -b android-2.6.35 origin/android-2.6.35
where -b = branch name and start point is android-2.6.35
To list the remote branches use the following command:
git branch -r
I am new to git and repo. I am in window 7 so I use cygwin. I have installed git from cygwin setup. After that I try to repo with the following command in cygwin.
$ repo init-u git://android.git.kernel.org/platform/manifest.git
I get an error like these:
bash: repo: command not found
I think I need to setup cygwin for repo. What do I need next to get repo?
Case 1: Not installed google repo yet?
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Use the following checksums when required:
For version 1.25 it is
d06f33115aea44e583c8669375b35aad397176a411de3461897444d247b6c220
For version 1.26, it is 0cf5f52bcafb8e1d3ba0271b087312f6117b824af272bedd4ee969d52363a86b
Case 2: Already have google repo Installed, still wondering what went wrong ?
Add
PATH=~/bin:$PATH to the end of file ~/.bashrc
and then run
source ~/.bashrc
You still need to install repo. repo is a third party tool built on top of git. See:
http://source.android.com/source/downloading.html
for how to install
I have the same problem and I have to do:
$ PATH=~/bin:$PATH every time I repo sync but at least it works.
add line
export PATH=~/bin:$PATH in file ~/.bashrc
edit .bash_profile and uncomment these fields. (any text editor will do)
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
# PATH="${HOME}/bin:${PATH}"
# fi
Restart CYGWIN.
Check and see if you have both .profile & .bash_profile in the working directory.
If you do, it's possible that the export command in both is actually conflicting in your shell. Making the output look something like this in Windows...
PATH="C:/Windows/path/to/repo/Windows/path/to/repo:$PATH"
export PATH
That's what happened to my bash shell anyway. It is correct that the 2 files interact with Bash or Cygwin differently, however if you have redundant inputs, they will compile together...
This answer for android build system error
For Python 3
If you get a "/usr/bin/env 'python' no such file or directory" error message, use one of the following solutions:
If your Ubuntu 20.04.2 LTS is a newly installed (vs. upgraded) Linux version:
sudo ln -s /usr/bin/python3 /usr/bin/python
f using Git version 2.19 or greater, you can specify --partial-clone when performing repo init. This makes use of Git's partial clone capability to only download Git objects when needed, instead of downloading everything. Because using partial clones means that many operations must communicate with the server, use the following if you're a developer and you're using a network with low latency:
repo init -u https://android.googlesource.com/platform/manifest -b master --partial-clone --clone-filter=blob:limit=10M
you can see document in
Downloading the Source