Skip to content

Commit

Permalink
Get OBS Build Info into Variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and Marco van Wieringen committed Sep 16, 2015
1 parent 51e3360 commit 5771574
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
18 changes: 17 additions & 1 deletion autoconf/bareos/os.m4
Expand Up @@ -50,7 +50,6 @@ else
$1_FALSE=
fi])


AC_DEFUN([BA_CHECK_OPSYS],
[
AC_CYGWIN
Expand Down Expand Up @@ -336,3 +335,20 @@ else
fi
AC_MSG_RESULT(done)
])

AC_DEFUN([BA_CHECK_OBS_DISTNAME], [
AC_MSG_CHECKING(for OBS OS Distribution)
if test "x$OBS_DISTRIBUTION" != "x"
then
echo "obsdistname set to $OBS_DISTRIBUTION"
else
if test -e /.build.log; then
OBS_PROJECT=`grep 'Building bareos for project' /.build.log | cut -d' ' -f10 | sed "s#'##g"`
OBS_DISTRIBUTION=`grep 'Building bareos for project' /.build.log | cut -d' ' -f12 | sed "s#'##g"`
OBS_ARCH=`grep 'Building bareos for project' /.build.log | cut -d' ' -f14 | sed "s#'##g"`
OBS_SRCMD5=`grep 'Building bareos for project' /.build.log | cut -d' ' -f16 | sed "s#'##g"`
AC_DEFINE(IS_BUILD_ON_OBS, 1, [Define to 1 if things are build using the Open Build Service (OBS)])
fi
fi
AC_MSG_RESULT(done)
])
9 changes: 9 additions & 0 deletions autoconf/configure.in
Expand Up @@ -244,6 +244,15 @@ dnl Bareos OPSys Distribution determination (see aclocal.m4)
dnl ----------------------------------------------------------
BA_CHECK_OPSYS_DISTNAME

dnl -----------------------------------------------------------
dnl Bareos OPSys Distribution determination (see aclocal.m4)
dnl ----------------------------------------------------------
BA_CHECK_OBS_DISTNAME
AC_SUBST(OBS_PROJECT)
AC_SUBST(OBS_DISTRIBUTION)
AC_SUBST(OBS_ARCH)
AC_SUBST(OBS_SRCMD5)

dnl --------------------------------------------------
dnl Suppport for gettext (translations)
dnl By default, $datarootdir is ${prefix}/share
Expand Down
16 changes: 14 additions & 2 deletions src/filed/dir_cmd.c
Expand Up @@ -227,7 +227,11 @@ static char OKstore[] =
static char OKstoreend[] =
"2000 OK storage end\n";
static char OKjob[] =
#if !defined(IS_BUILD_ON_OBS)
"2000 OK Job %s (%s) %s,%s,%s";
#else
"2000 OK Job %s (%s) %s,%s,%s,%s,%s";
#endif
static char OKsetdebugv0[] =
"2000 OK setdebug=%d trace=%d hangup=%d tracefile=%s\n";
static char OKsetdebugv1[] =
Expand Down Expand Up @@ -776,6 +780,7 @@ static bool job_cmd(JCR *jcr)
BSOCK *dir = jcr->dir_bsock;
POOL_MEM sd_auth_key(PM_MESSAGE);
sd_auth_key.check_size(dir->msglen);
const char *os_version;

if (sscanf(dir->msg, jobcmd, &jcr->JobId, jcr->Job,
&jcr->VolSessionId, &jcr->VolSessionTime,
Expand All @@ -790,10 +795,17 @@ static bool job_cmd(JCR *jcr)
Mmsg(jcr->errmsg, "JobId=%d Job=%s", jcr->JobId, jcr->Job);
new_plugins(jcr); /* instantiate plugins for this jcr */
generate_plugin_event(jcr, bEventJobStart, (void *)jcr->errmsg);

#ifdef HAVE_WIN32
return dir->fsend(OKjob, VERSION, LSMDATE, win_os, DISTNAME, DISTVER);
os_version = win_os;
#else
os_version = HOST_OS;
#endif

#if !defined(IS_BUILD_ON_OBS)
return dir->fsend(OKjob, VERSION, LSMDATE, os_version, DISTNAME, DISTVER);
#else
return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER);
return dir->fsend(OKjob, VERSION, LSMDATE, os_version, DISTNAME, DISTVER, OBS_DISTRIBUTION, OBS_ARCH);
#endif
}

Expand Down
5 changes: 5 additions & 0 deletions src/include/host.h.in
Expand Up @@ -33,3 +33,8 @@
#define SD_DEFAULT_PORT "@sd_port@"
#define DIR_DEFAULT_PORT "@dir_port@"
#define NDMP_DEFAULT_PORT "10000"

#define OBS_PROJECT "@OBS_PROJECT@"
#define OBS_DISTRIBUTION "@OBS_DISTRIBUTION@"
#define OBS_ARCH "@OBS_ARCH@"
#define OBS_SRCMD5 "@OBS_SRCMD5@"

0 comments on commit 5771574

Please sign in to comment.