Opened 2 years ago

Closed 4 months ago

#1336 closed defect/bug (fixed)

Release number is not set correctly for Android builds

Reported by: mvglasow (2) Owned by: cp15
Priority: minor Milestone:
Component: port/android Version: git master
Severity: normal Keywords: toolchain, build, android
Cc: http://wiki.navit-project.org/index.php/user:mvglasow, (2)

Description

When building an APK from a feature branch, it gets an outdated release number. This confuses apps like F-Droid, which will constantly announce an update even when the update is in fact older than what is currently installed.

Steps to reproduce:

  1. Switch to a feature branch on which the last commit has no tag.
  2. Build a Navit APK.
  3. Install the APK.
  4. Examine the APK in System > Apps.
  5. View the history of your branch in gitk.

Android shows an outdated release number, i.e. lower than the last tag in the branch history. I haven't quite figured out how that release number is obtained – it may be the last tagged branch that was built on that machine.

In any case, the cleaner way to solve this would be to look for the last tag in the history of the branch and use that for the release number.

Change History (8)

comment:1 Changed 2 years ago by tryagain

Hi!

Can you please show an example of a broken feature branch, what version do you get, what one expect, and, say, top 30 lines of output git log --format='%h %d' of the source tree used for build.

We actually use git log "--format=%h %d" to fetch history with tags, and the topmost tag is used to set revision number.

Your repository has much less release tags than the central one. You probably have to "git push --tags" to your repo after you have merged with central repository.

Another probable cause (seems to not affect https://github.com/mvglasow/navit/tree/trac712.squashed) might be related to the fact you're doing merge instead of rebase. So your history becomes non-linear, and git log may report an older tag above a newer one. As we currently check top tagged log entry, we may fail at that point.

comment:2 Changed 2 years ago by tryagain

If the problem is non-linear history, maybe adding --date-order key to our git log command would help.

comment:3 Changed 2 years ago by mvglasow (2)

For example, this branch: https://github.com/mvglasow/navit/tree/trac1325.rebased.

Yes, occasionally I forget to pull in the tags but even after doing git pull upstream trunk --tags the problem remains, even though the tags are there.

The branch in question is in fact rebased on top of latest trunk, thus non-linear history wouldn't be an issue here.

After a fresh pull with tags and a rebuild, the latest tag I see in the history is R6427. Yet the Navit build is reported as 0.5.0-6327 by Android (coincidentally the build number is off by just 100).

Output of git log --format='%h %d':

7c59b3c  (HEAD -> trac1325.rebased, origin/trac1325.rebased)
719cabf 
5954309 
08b746a  (tag: R6427, upstream/trunk, trunk)
77b9683  (tag: R6424)
ae66e6b 
2d43eff 
8bdcd53 
e0d1899 
52a7a81 
3f4b78d 
2c30cf4  (tag: R6421)
dcd6280  (tag: R6419, origin/trunk)
b61fded  (tag: R6417)
70755a3  (tag: R6409)
1f37913 
433f84a  (tag: R6405)
4cea76f 
e27a93c 
c765ca2 
dc77946 
9df63b5 
c5624e8 
83b07f8  (tag: R6382)
1bad323 
cfd4a3a 
695a96c  (tag: R6376)
9c2d7dc  (tag: R6374)
142a4dd  (tag: R6372)
316eefa  (tag: R6370)

Seems like something else isn't working properly.

comment:4 Changed 2 years ago by mvglasow (2)

  • Cc http://wiki.navit-project.org/index.php/user:mvglasow (2) added

comment:5 Changed 2 years ago by kazer

  • Milestone set to version 0.5.1

comment:6 Changed 2 years ago by tryagain

Please check if R6499 fixes this problem.

comment:7 Changed 2 years ago by mvglasow (2)

  • Milestone version 0.5.1 deleted

I pulled the latest changes and did a full build. Forgot to pull tags, though.

The full build ran correctly and the APK reports itself as 0.5.0-6427 (the latest tag in my local repo). So at least that part works.

Then I pulled the tags from the main repo and rebuilt Navit. Now the APK is reported as 0.5.1-6427 – the version number increased because we've had a new version since, but the release number did not change (still 6427 when it should be 6502).

Git output:

f1dda62  (HEAD -> trunk, upstream/trunk)
92cbe43  (tag: R6502)
0452e62 
8f45344  (tag: R6499)
e356b96  (tag: R6497)
24aa15c 
5b05919 
eac6b30  (tag: R6492)
ffac5ae 
7ba00da 
98f8cf8 
9ec259e 
e9931f1  (tag: R6485, origin/trunk)
da791ce 
3de77b1 
cddbdcd 
2f5d2a0 
ca74f66 
4d5f509 
9b3bcb5 
03d7a5c 
39175cc  (tag: R6463)
ad3e773 
4c7e3da  (tag: v0.5.0, tag: R6461)
4e93b84  (tag: R6459)
6b93380 
cc41317 
04a01d5 
2271bd7 
cf4e08c 
38c15df 
cb9e043  (tag: R6449)

Apparently the new release doesn't get set if none of the source files have changed.

comment:8 Changed 4 months ago by http://wiki.navit-project.org/index.php/user:jkoan

  • Resolution set to fixed
  • Status changed from new to closed

This problem is now fixed because of #1351

Note: See TracTickets for help on using tickets.