i.e. If I have done:
$ repo init -b froyo; repo sync
and I come back to this repo later, how can I determine which the version checked out is?
In other words, the response to:
$ "unknown command which I am looking for"
should be "froyo" in this case (or the respective version number),
after:
$ repo init -b gingerbread; repo sync
it should be "gingerbread" (or the respective version number)
You can open a manifest.xml file in your .repo hidden directory.
In the file you can find the following tag and value for gingerbread:
default revision="refs/tags/android-2.3.4_r1"
I do not know if it is an official way to do this.
manifests.git
Repo just downloads a given version of a git repository containing manifest files.
That repository is stored inside .repo, so you can check out its version with:
git --git-dir .repo/manifests.git log default
which shows me on the first line:
commit 985cbc6c03245ae454491a062a54afe9e7732d1e (tag: android-7.1.1_r6, origin/android-7.1.1_r6, m/android-7.1.1_r6, default)
Get the SHA of all repos
This command might also be useful, since branches appear to be moving and not sync all the subrepos:
repover() (
# Print the revision of all repos.
top="$(pwd)/"
repo forall -c "pwd=\"\$(pwd)\"; echo \"\$(git log -1 --format=\"%H\") \${pwd#$top}\""
)
The output is of form:
c3e60f38c81a3dd4ff49dca0f05f84a8b464004f art
293d4633af7d80584c7968c650bced857f338bc0 bionic
80ccac2fffc09ef0b8a1fe43c096788e12359a1d bootable/recovery
3aaf722a8d25ed726d4aba5d96bd325afe74a61c build/blueprint
cfcaaa25117310666e02a989a6bd9d45e82d8041 build/kati
a7229a08b7c5d481cb813d810f1d88c3de3cdc8b build/make
2e020842dc44bb67c3aad84217b3e6c4fa8fd900 build/soong
4cc6ccbeeed7d8ddcfb0fc955e523ba6d86e9601 compatibility/cdd
34c43035d43004a23d34b1ae6651f6ea2107eb4c cts
dd452a4244dad07c53db525d314fdcf4429ffd46 dalvik
Related
In the Android project that I am working on, we are using GitLab CI/CD to automatically build and upload in Diawi the .apk file. In current settings build application's name is static because it needs to be known and sent to the Diawi framework as a curl request. The script looks like this:
- ./gradlew assembleRelease && cp app/build/outputs/apk/release/app-release.apk app-release.apk && curl -v --http1.1 https://upload.diawi.com/ -F token=$DIAWI_TOKEN -F file=#app-release.apk -F find_by_udid=0 -F callback_emails="mymail#company.com"
But this causes some troubles during the manual testing because the .apk files with the same name can be easily mistaken or overwritten.
My idea is to add some metadata in the .apk file's name to be unique and to avoid such errors. Do you have any ideas about how this could be done?
First thing you can do is create version bump functionality. You can do it via version bumping tool and git sync.
For version bumping you can use our open source tool - https://github.com/relizaio/versioning . Now, assuming that you sync via a file called apk_version, you first initialize this file with the current version like:
docker run --rm relizaio/versioning -s YY.0M.Patch > apk_version
Then in your CI context, you can bump it with something like
docker run --rm relizaio/versioning -s YY.0M.Patch -v $(cat apk_version) -a bump > apk_version
Now, in GitLab CI you need to have a block that resolves this. Note, that you also need to commit apk_version file at the end of the bump.
For inspiration - see this question How to grant permission for semantic-release to push code to master and also our sample CD project on GitLab - https://gitlab.com/taleodor/sample-helm-cd/-/blob/master/.gitlab-ci.yml
Also my article here may be helpful (note it's a bit outdated at this point): https://worklifenotes.com/2020/02/27/automatic-version-increments-with-reliza-hub-2-strategies/
Finally, for other things that you can add to version GitLab has a list of pre-defined env variables that you can use in whole or partially as modifiers: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
I made a custom rom for my device using Resurrection Remix Nougat. However, the security patch of the rom is December 5, 2017. I've found a guide that gives instructions (https://thealaskalinuxuser.wordpress.com/2016/08/29/how-to-manually-update-your-custom-rom-source-code-with-security-updates/) but it says to manually edit the files, even though there are commit codes on the pages (ex: https://android.googlesource.com/platform/frameworks/base/+/4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5)
Is there a way to add these commits using 'git cherry-pick' or something else without manually editing the files?
I have tried the following (with this example: https://android.googlesource.com/platform/frameworks/base/+/4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5)
go to frameworks/base using 'cd frameworks/base'
'git fetch https://android.googlesource.com/platform/frameworks/base'
'git cherry-pick 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
After running the chery-pick command, I get this:
fatal: bad object 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
Try:
git fetch https://android.googlesource.com/platform/frameworks/base 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5 --depth 2
git cherry-pick 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
And here's another method. Press the button diff on the page of https://android.googlesource.com/platform/frameworks/base/+/4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5, and the diff/patch of the commit is displayed, which starts with the line
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
You can copy and paste the diff into a local file, foo.diff for example, and run
git apply foo.diff
'go to frameworks/base using 'cd frameworks/base'
'git fetch https://android.googlesource.com/platform/frameworks/base' -A
'git cherry-pick 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
I'm trying to set up Gerrit and repo for Android development in a closed shop. I had very little trouble installing a Gerrit server, but I'm getting this error at a client workstation:
$ repo start Falk .
$ vi AndroidManifest.xml
$ git commit -m 'minor change' -a
[Falk b3398ba] minor change
1 file changed, 2 insertions(+)
$ repo upload .
Upload project packages/apps/Calculator/ to remote branch refs/tags/android-5.1.0_r1:
branch Falk ( 1 commit, Thu Mar 17 15:20:09 2016 -0700):
72aa6b93 just a minor change
to None (y/N)? y
Traceback (most recent call last):
...
error.GitError: remote aosp has no review url
I'm guessing that I made a configuration error installing Gerrit, and/or brought my initial repo over the wrong way.
This is roughly how I did my original bringover:
$ mkdir git
$ cd git
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
$ repo sync
Is there anything I should have done differently? When I configured Gerrit, I took all the defaults.
Should I modify the manifest, perhaps?
Is there a "how-to" recipe for setting up Gerrit for Android development?
I just stumbled up on this error myself today. I will share my solution for future references.
The remote AOSP repository defined in your default manifest does not have the Gerrit server review url. "Repo upload" submits your patch to the web based code review system(Gerrit) for reviewers to review your code.
Solution: Add the last line into your manifest file.
Inside .repo/manifest.xml:
<remote name="aosp"
fetch=".."
review="https://android-review.googlesource.com/"/>
I am working on a custom ROM for Android 5.0 and I found out the class StackBox.java in : frameworks/base/services/java/com/android/server/wm/ doesn't exist anymore.
Does anybody know if there is a new class which replaced it?
Thank you in advance
You can use Git to find out when and how a file has been removed or renamed.
$ cd frameworks/base
$ git log -M --name-status --all -- services/java/com/android/server/wm/StackBox.java
For me this yields the following at the top:
commit ed6649f89f236ea9e665028bd33d6d804b906a92
Author: Craig Mautner <cmautner#google.com>
Date: Mon Dec 2 14:08:25 2013 -0800
DO NOT MERGE: Eliminate StackBox.
StackBox is too constraining. Adding size and position to TaskStacks
directly makes stack positioning and management more flexible and
prepares for ActivityView.
Change-Id: I33c6b4e1c23a5a8069fd507c160bcb34e4d287b2
D services/java/com/android/server/wm/StackBox.java
Note the "D" on the last line that tells us that the commit deletes the file in question (if you add the --diff-filter=D option you'll only get commits that deletes the file but then you might lose out on commits that rename the file). Feeding the commit id to git tag --contains tells you in which release this change was introduced:
$ git tag --contains ed6649f89f236ea9e665028bd33d6d804b906a92
android-5.0.0_r1
android-5.0.0_r2
android-5.0.0_r3
android-5.0.0_r4
android-5.0.0_r5
android-5.0.0_r5.1
android-5.0.0_r6
android-5.0.0_r7
android-5.0.1_r1
android-5.0.2_r1
android-wear-5.0.0_r1
I don't know this code well enough to be able to tell you what to use instead but I hope this commit contains what you need.
I've never used git before, but I'd like to download the android source code as I'm getting a crash in the 2.2 emulator and I'd like to see exactly where in the android source code it's crashing (so I can file a better bug report).
Edit A decent answer would include instructions on using git to download a specific repository. I'm on windows, but have installed Msysgit.
I'm not entirely sure it's right, but I've done the following (in msysgit):
git clone git://android.git.kernel.org/platform/frameworks/base.git;h=refs/heads/froyo-release
Edit: I now notice that there are two tags - froyo & froyo-release. I'm not sure which one to ues, so I'm downloading them both. Can anyone tell me what the differences are?
Well, as you've found out, the Android code is not stored in only one git repository. Instead they use a python script called repo to coordinate across many repositories. Rabas has the link to Google's instructions.
I've gotten that script to run under Windows using Cygwin. Remember to add the "-b froyo" to the repo init command.
(I don't know the difference between the tags. The repo script obscures most of that; it just deals in branch names.)
Have you checked this page?
When you do repo init, you must specify manifest, and if you want specific branch, after manifest you must add -b eclair for example.
the froyo branch is a working development branch
if you want a stable release get android-2.2.2_r1
You can find out what branches are available using git:
mkdir /tmp/zug
pushd /tmp/zug
git clone https://android.googlesource.com/platform/manifest.git
cd manifest
git branch -a | sed -n '/^ r/s,.*/,,p'|sort -u|column
popd
rm -rf /tmp/zug
Produces something much like this:
android-1.6_r1 android-2.1_r1 android-2.2.3_r2 android-2.3.4_r0.9 froyo
android-1.6_r1.1 android-2.1_r2 android-2.2_r1 android-2.3.4_r1 gingerbread
android-1.6_r1.2 android-2.1_r2.1p android-2.2_r1.1 android-2.3.5_r1 gingerbread-release
android-1.6_r1.3 android-2.1_r2.1p2 android-2.2_r1.2 android-2.3.6_r0.9 ics-mr0
android-1.6_r1.4 android-2.1_r2.1s android-2.2_r1.3 android-2.3.6_r1 master
android-1.6_r1.5 android-2.2.1_r1 android-2.3.1_r1 android-2.3.7_r1 tradefed
android-1.6_r2 android-2.2.1_r2 android-2.3.2_r1 android-2.3_r1
android-2.0.1_r1 android-2.2.2_r1 android-2.3.3_r1 android-4.0.1_r1
android-2.0_r1 android-2.2.3_r1 android-2.3.3_r1.1 android-4.0.1_r1.2