Skip to contentSkip to conversation

support/scripts/pkg-stats: extract current commit id, not master

PATCH New Thomas Petazzoni 2 participants 4 messages Aug 29, 2019 – Sep 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/scripts/pkg-stats: extract current commit id, not master

pkg-stats extracts the Buildroot commit id from which the package information was collected. However, when doing so, it always assumes we're using the master branch, by running "git log master".

But in fact, pkg-stats can be run from any branch/tag, so it makes a lot more sense to use "git log HEAD".

Cc victor.huesca at bootlin.com
Cc Baruch Siach <[email protected]>

---
As was discussed with Baruch and others, the page at
http://autobuild.buildroot.net/stats/ now shows the results corresponding to the next branch when such a branch exists. However, the commit ID currently shown at the bottom of the page is incorrect, as it shows the one of the master branch at the time the page was generated.

---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/scripts/pkg-stats +1 -1
index 992c2dd7c5..6cb3a6a038 100755
@@ -727,7 +727,7 @@ def __main__():
     else:
         package_list = None
     date = datetime.datetime.utcnow()
-    commit = subprocess.check_output(['git', 'log', 'master', '-n', '1',
+    commit = subprocess.check_output(['git', 'log', 'HEAD', '-n', '1',
                                       '--pretty=format:%H']).splitlines()[0]
     print("Build package list ...")
     packages = get_pkglist(args.npackages, package_list)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 support/scripts/pkg-stats: extract current commit id, not master

Hi Thomas,

Quoted 26 lines · Thomas Petazzoni

pkg-stats extracts the Buildroot commit id from which the package information was collected. However, when doing so, it always assumes we're using the master branch, by running "git log master".

But in fact, pkg-stats can be run from any branch/tag, so it makes a lot more sense to use "git log HEAD".

Cc victor.huesca at bootlin.com
Cc Baruch Siach <[email protected]>

---
As was discussed with Baruch and others, the page at
http://autobuild.buildroot.net/stats/ now shows the results corresponding to the next branch when such a branch exists. However, the commit ID currently shown at the bottom of the page is incorrect, as it shows the one of the master branch at the time the page was generated.

---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/scripts/pkg-stats +0 -0
index 992c2dd7c5..6cb3a6a038 100755

support/scripts/pkg-stats def __main__(): · line 731

Quoted 6 lines
support/scripts/pkg-stats +1 -1
@@ -727,7 +727,7 @@ def __main__():
     else:
         package_list = None
     date = datetime.datetime.utcnow()
-    commit = subprocess.check_output(['git', 'log', 'master', '-n', '1',
+    commit = subprocess.check_output(['git', 'log', 'HEAD', '-n', '1',
                                       '--pretty=format:%H']).splitlines()[0]

Unrelated to this patch, commit id retrieval can be simplified to just:

git rev-parse HEAD

baruch

Quoted 2 lines
support/scripts/pkg-stats +0 -0
     print("Build package list ...")
     packages = get_pkglist(args.npackages, package_list)
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 support/scripts/pkg-stats: extract current commit id, not master

Quoted 3 lines · On Thu, 29 Aug 2019 10:29:29 +0300 Baruch Siach <[email protected]> wrote:

Unrelated to this patch, commit id retrieval can be simplified to just:

git rev-parse HEAD

Good point, I sent a follow-up patch doing exactly this. Thanks for the suggestion!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author Applied
#3 lore raw

PATCH 1/1 support/scripts/pkg-stats: extract current commit id, not master

In reply to Thomas Petazzoni
Quoted 17 lines · On Thu, 29 Aug 2019 09:22:33 +0200 Thomas Petazzoni…

pkg-stats extracts the Buildroot commit id from which the package information was collected. However, when doing so, it always assumes we're using the master branch, by running "git log master".

But in fact, pkg-stats can be run from any branch/tag, so it makes a lot more sense to use "git log HEAD".

Cc victor.huesca at bootlin.com
Cc Baruch Siach <[email protected]>

---
As was discussed with Baruch and others, the page at
http://autobuild.buildroot.net/stats/ now shows the results corresponding to the next branch when such a branch exists. However, the commit ID currently shown at the bottom of the page is incorrect, as it shows the one of the master branch at the time the page was generated.

Quoted 3 lines
---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com