Patchwork [4/7] classes/buildhistory: use hostname instead of reading /etc/hostname

login
register
mail settings
Submitter Paul Eggleton
Date Feb. 14, 2012, 1:40 p.m.
Message ID <f0a239770c953c55f604106afe0466a8b4ae4cea.1329226672.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/21251/
State Accepted
Commit cb939b753c9e7648a38e22e0349c279da785e69d
Headers show

Comments

Paul Eggleton - Feb. 14, 2012, 1:40 p.m.
For the purposes of querying the hostname to include it in the commit
message, it seems "cat /etc/hostname" does not work on the Yocto Project
autobuilder machines, and it's likely that the hostname command will be
more generally reliable, so use that instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/buildhistory.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Koen Kooi - Feb. 14, 2012, 2:28 p.m.
Op 14 feb. 2012, om 05:40 heeft Paul Eggleton het volgende geschreven:

> For the purposes of querying the hostname to include it in the commit
> message, it seems "cat /etc/hostname" does not work on the Yocto Project
> autobuilder machines,

/etc/hostname is a debianism, but systemd is trying to make it a standard across all distros: http://0pointer.de/blog/projects/the-new-configuration-files.html

regards,

Koen

> and it's likely that the hostname command will be
> more generally reliable, so use that instead.
> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
> meta/classes/buildhistory.bbclass |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index 3fbe3a8..dfc9b73 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -383,7 +383,7 @@ buildhistory_commit() {
> 		repostatus=`git status --porcelain`
> 		if [ "$repostatus" != "" ] ; then
> 			git add ${BUILDHISTORY_DIR}/*
> -			HOSTNAME=`cat /etc/hostname 2>/dev/null || echo unknown`
> +			HOSTNAME=`hostname 2>/dev/null || echo unknown`
> 			git commit ${BUILDHISTORY_DIR}/ -m "Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
> 			if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
> 				git push -q ${BUILDHISTORY_PUSH_REPO}
> -- 
> 1.7.5.4
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 3fbe3a8..dfc9b73 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -383,7 +383,7 @@  buildhistory_commit() {
 		repostatus=`git status --porcelain`
 		if [ "$repostatus" != "" ] ; then
 			git add ${BUILDHISTORY_DIR}/*
-			HOSTNAME=`cat /etc/hostname 2>/dev/null || echo unknown`
+			HOSTNAME=`hostname 2>/dev/null || echo unknown`
 			git commit ${BUILDHISTORY_DIR}/ -m "Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
 			if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
 				git push -q ${BUILDHISTORY_PUSH_REPO}