[Script] repo-mm: gerrit-mirror.sh - Gerrit project mirroring script [06/30/2013] - Android Software/Hacking General [Developers Only]

Hello xda,
I had a little time on my hands the other night, and wanted to figure out a way that I could work on any of the project repositories needed to build say, aokp, cyanogenmod, aosp, etc... without having to connect to the internet.
Mirroring is not new. Simple enough to:
Code:
mkdir cm-mirror
cd cm-mirror
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 --mirror
repo sync -j[dl-jobs]
then create a working directory:
Code:
cd ..
mkdir cm-work
cd cm-work
repo init -u file:///Volumes/Android/cm-mirror/CyanogenMod/android.git --reference /Volumes/Android/cm-mirror/ -b cm-10.1
repo sync # no jobs needed. super fast.
But at this point you only have what you need for cm-10.1. What if you also have work you are doing for 10.1.0? Or an old update to make for cm-7.2.0?
I originally started looking for a solution to sync every branch in the manifest one at a time, but while talking with cdesai he showed me a really clean way of getting the repositories directly from gerrit.
Anyways, here is the resulting script. Let me know your thoughts.
I've moved the script to a git repository here: https://github.com/bhundven/repo-mm
in case anyone wants to contribute.
I've also written a post on my blog about using the new gerrit-mirror.sh on gh.

ChangeLog
Changes:
[06/30/13]: Announce some updates to gerrit-mirror.sh, and blog post.
[06/24/13]: Moved gist to github project.
GitHub for repo-mm.

Related

[Q] Best way to cherry pick changes from the CyanogenMod code review?

So I set up a chain of scripts to build, package, and deploy CyanogenMod kang builds on Ubuntu 11.04 according to the guide in this thread: http://forum.xda-developers.com/showthread.php?t=1067519
Now that I can successfully build CyanogenMod, I'm wondering what the best (quickest, easiest, etc.) way is to cherry pick changes from the CyanogenMod code review which is found here: http://review.cyanogenmod.com/#q,statuspen,n,z
For example, if I wanted to allow the user to choose whether or not to show the "Hold" button in calls, I would need to pull this change: http://review.cyanogenmod.com/#change,6104. What would be the best way of doing this?
Thanks in advance for any help!
When I try to use the git cherry-pick command found on the commit page, I get this error: "fatal: You do not have a valid HEAD"
hmmm I would
Code:
cd android/system/packages/apps/Phone/
and then do
Code:
git pull http://review.cyanogenmod.com/p/CyanogenMod/android_packages_apps_Phone refs/changes/04/6104/1
but I'm pretty new on this too.
I've been building from source for a couple of weeks now and just finished my first kernel from source but I'm having problems pulling commits.
Whenever I try to pull or cherry-pick I get
Code:
fatal: Not a git repository (or any of the parent directories): .git
Were you actually able to pull the commit? I'm doing this from android/system. Should I be in a different folder?
Try this little tutorial. ^_~
http://forum.xda-developers.com/showpost.php?p=23527685&postcount=29
The important part that I was missing was to be in the correct directory based on the patch.
For instance
Code:
cyanogenmod dot com/p/CyanogenMod/android_packages_apps_Phone refs/changes/04/6104/1
would have to be in android/packages/apps/Phone
and
Code:
cyanogenmod dot com/p/CyanogenMod/android_frameworks_base refs/changes/29/11129/8 && git checkout FETCH_HEAD
would be in android/frameworks/base
Thanks for the help on this

Cherry-Picking From Github

how do i cherry pick a single commit from a github source? like get a certain commit from aokps settings app and get it into cm10.1
i tried this and seemed to break my build
cd ~/android/system/frameworks/base
git fetch https://github.com/AOKP/packages_apps_Settings.git && cherry-pick 8b7e06fe63939730067b539ca7343fcd8e68ad01 FETCH_HEAD
is that the right way to do it? and how do i know if it cherry picked correctly? sorry im still getting the hang of thins with github
azoller1 said:
how do i cherry pick a single commit from a github source? like get a certain commit from aokps settings app and get it into cm10.1
i tried this and seemed to break my build
cd ~/android/system/frameworks/base
git fetch https://github.com/AOKP/packages_apps_Settings.git && cherry-pick 8b7e06fe63939730067b539ca7343fcd8e68ad01 FETCH_HEAD
is that the right way to do it? and how do i know if it cherry picked correctly? sorry im still getting the hang of thins with github
Click to expand...
Click to collapse
I'd go to their gerrit. Anything and find what you want.
http://gerrit.sudoservers.com/#/q/status:open,n,z
Click on it, note the Project listed. cd to that in your tree. then in the download section you see a cherry-pick tab. click that and select the command there. That is the command you use. If it comes in without needing to merge anything you are good.
thanks, and how would i know if merging is needed?
azoller1 said:
thanks, and how would i know if merging is needed?
Click to expand...
Click to collapse
it'll tell you. Not sure if you use UI or command line but in command line i installed vimdiff, then set it as git mergetool with,
git config --global merge.tool vimdiff
if using UI I'd use meld.
so it'll report something needs to be merged then just
git mergetool and it'll open up. manually fix the merge
then
git status
This will show you the .orig files. delete them
Then:
git add -A
git commit -a
Control+X(nano) or :wq (vim)
And you're done.
git remote add -f repo.git then git cherry pick commit id
so basically just get the branch i want a cherry pick from, then picks it from the branch when i enter the commit, and i need to cd in the right directory before doing
git remote add -f repo.git?
see if it help!http://forum.xda-developers.com/showthread.php?p=23527685#post23527685
yeah i saw that guide, but still confused using github, gerrit is pretty easy
I always use this thingy as reference for cherry-picking:
http://stackoverflow.com/questions/...ctively-pull-merge-changes-from-anothers-fork
sorry forgot about this i will give a better example. if you want tp cherry pick a framwork base commit be in the framework folder then
git remote add paranoid(name is irrlefvent) -f [email protected]aranoidAndroid/android_frameworks_base.git
wait for it to download
then git cherry pick the commit id: git cherry pick f9cedfe79cc1d545b920f93539a0843d02819fe6
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
If using this method to patch, which folder in my source do I download the patch to? Also when adding commits to my source do I need to add every single commit individually or can I just choose the commit from the major header? For example there are many commits within the Frameworks folder (Frameworks/Base..etc) do I need to go into the Frameworks folder and add each element individually or can I just add the commit from the Frameworks folder? One more thing, how to I apply a patch that I have downloaded as xxx.patch? Sorry if this is hard to understand I'm new at this and still learning the jargon.
Thanks!
The truth is already out there: http://wiki.cyanogenmod.org/w/After_You_Build
http://wiki.cyanogenmod.org/w/Doc:_...building_a_patch_submission_already_on_Gerrit
Sent from my Nexus 7 using xda premium
i want this commit: https://github.com/CyanogenMod/andr...mmit/d1f1fb4064bfcef528a12a4c5176df7b44ffd48c
you need two things, the url to the main project and the commit id, both you just copy out of your browser
the branch i always use is called "jellybean"
my remote to my git is called "github"
that might differ from your configuration-
cd aosp
cd packages/app/Settings
git checkout jellybean
git remote add cyan https://github.com/CyanogenMod/android_packages_apps_Settings
git fetch cyan
git cherry-pick d1f1fb4064bfcef528a12a4c5176df7b44ffd48c
done.
in case it conflicts, you run:
grep -r "<< HEAD" .
and fix all the files it spits out. search for "<< HEAD" in these files and you should see what to do.
when you're done fixing your files you can test if it builds, if it does you go:
git add --all
git commit --all
in the end you push it up to your git
git push github jellybean
Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
i think this is the easiest way to pick a commit from someone and add it into your own source, but instead i used this command line in my root source
patch -p1 < ./patch
seems to fail a lot when adding the patch but its really easy to fix it
Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
FYI, you use a lot of `FYI` in your post lol.
Sent from my Nexus 7 using Tapatalk 4

Building a rom...

i' m following a guide to try builiding my first rom and i don't understand a step
"6. After the repo sync finally finishes, all you need to do is add your device, kernel, vendor specific files for the device you are building for."
Where can i find these things? Is there a command i should give in the terminal?
I've searched a little but not found anything...any hint would be accepted!
tylpica wives
phoenixita said:
i' m following a guide to try builiding my first rom and i don't understand a step
"6. After the repo sync finally finishes, all you need to do is add your device, kernel, vendor specific files for the device you are building for."
Where can i find these things? Is there a command i should give in the terminal?
I've searched a little but not found anything...any hint would be accepted!
Click to expand...
Click to collapse
What rom are you building? If CM10.1 or CM10.2 just follow the instructions on
wiki.cyanogenmod.org - w - Build_for_ville
(sorry, cannot post the link since I don't have enough posts Just replace - with /)
I guess your point 6 refers to items 2.7-2.9 where prebuilt apps, device-specific code (e.g. kernel etc.) and other
proprietary drivers are copied to your source code.
To init for CM10.1, use
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
for CM10.2 use
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
Hope this helps. good luck
drkxyz said:
What rom are you building? If CM10.1 or CM10.2 just follow the instructions on
wiki.cyanogenmod.org - w - Build_for_ville
(sorry, cannot post the link since I don't have enough posts Just replace - with /)
I guess your point 6 refers to items 2.7-2.9 where prebuilt apps, device-specific code (e.g. kernel etc.) and other
proprietary drivers are copied to your source code.
To init for CM10.1, use
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
for CM10.2 use
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
Hope this helps. good luck
Click to expand...
Click to collapse
I'm trying to build another rom not CM but i'm trying following the 2.7-2.9 steps from your link
What
Building from source or MOD ROM?
xdluisssxd said:
Building from source or MOD ROM?
Click to expand...
Click to collapse
i think i'm building it from source lol

Building AOSP

I am trying to build AOSP. I have followed some instructions and the best are the instructions of Sony. But when I come to the point to clone the local_manifests, I need to have another file. I have found the AOSP-bacon repo on github where is a local_manifests to clone. So I have done that but when I try to sync the repo with the command 'repo sync' it gives this back:
[email protected]:~/android$ repo sync
fatal: remove-project element specifies non-existent project: platform/build
I have searched but could not find the answer what to do now. Can someone help me or say what I need to do to build AOSP?
Lennert_F said:
I am trying to build AOSP. I have followed some instructions and the best are the instructions of Sony. But when I come to the point to clone the local_manifests, I need to have another file. I have found the AOSP-bacon repo on github where is a local_manifests to clone. So I have done that but when I try to sync the repo with the command 'repo sync' it gives this back:
[email protected]:~/android$ repo sync
fatal: remove-project element specifies non-existent project: platform/build
I have searched but could not find the answer what to do now. Can someone help me or say what I need to do to build AOSP?
Click to expand...
Click to collapse
try deleting platform/build manually from the source and delete the same from the local_manifest.xml file then do a repo sync.

CustomRom Building Guide For Newbies

Okay So you we have flashed many custom ROMs in your device, but have you wonder , how developers build custom ROMs , Well as a matter of fact we will Cover this Topic , So To build Custom Rom we need to mainly sync a source. Let's say it's LineageOS , so We have to first initialise the source via
Code:
repo init -u "clone url" -b "branchname"
You need to have a linux distro with atleast 8 cores and atleast 12 gb ram and 130 gb of HDD.
For example :
Let's take lineageOS For pie so the branch will be lineage-16.0
Code:
repo init -u git://github.com/LineageOS/android.git -b lineage-16.0
As we have initialised the source Let's Sync it , but before that you might want to configure your GitHub username and email , here we will do it globally , so that you don't have to do that again and again.
To configure GitHub username
Code:
git config --global user.name "FIRST_NAME LAST_NAME"
To configure GitHub email
Code:
git config --global user.email "YOUR EMAIL"
Now let's sync the Source
Code:
repo sync -j$(nproc --all)
Now as we synced the source , we just need to add device tree , vendor blobs and kernel source. After that we can start the bring up by
Code:
. build/envsetup.sh
lunch lineage_devicename-userdebug
brunch devicename
The build should Start
Well For more detailed explanation refer to my guide which I made for Rookies
Guide :- https://github.com/TheGlitchh/CustomRom_Building_Guide/
You can always pm me at Telegram for build errors and bug fixes ,I will try my best to help you out
Telegram username :- TheGlitchh
========O=======​

Categories

Resources