[Buildroot] [git commit] support/scripts/pkg-stats: simplify Git commit id retrieval

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sun Sep 15 14:10:22 UTC 2019


commit: https://git.buildroot.net/buildroot/commit/?id=ffcd34af079d21f1430efa22faac034d68a3c3ca
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

As suggested by Baruch Siach, using "git rev-parse HEAD" is a lot
simpler than playing around with "git log" to just retrieve the commit
id corresponding to the current HEAD.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 support/scripts/pkg-stats | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 6cb3a6a038..e477828f7b 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -727,8 +727,8 @@ def __main__():
     else:
         package_list = None
     date = datetime.datetime.utcnow()
-    commit = subprocess.check_output(['git', 'log', 'HEAD', '-n', '1',
-                                      '--pretty=format:%H']).splitlines()[0]
+    commit = subprocess.check_output(['git', 'rev-parse',
+                                      'HEAD']).splitlines()[0]
     print("Build package list ...")
     packages = get_pkglist(args.npackages, package_list)
     print("Getting package make info ...")


More information about the buildroot mailing list