Commit ed0995d0 authored by Hardy Simpson's avatar Hardy Simpson

code: add zlog version, kick git hash away

parent 98992c8e
......@@ -48,3 +48,4 @@ doc/*.htoc
doc/*.tex
test/press*
test/*.png
release.h
......@@ -108,7 +108,7 @@ zlog_conf_t *zlog_conf_new(const char *confpath)
{
int nwrite = 0;
int has_conf_file = 0;
zlog_conf_t *a_conf;
zlog_conf_t *a_conf = NULL;
a_conf = calloc(1, sizeof(zlog_conf_t));
if (!a_conf) {
......
......@@ -14,7 +14,6 @@ OBJ= \
mdc.o \
record.o \
record_table.o \
release.o \
rotater.o \
rule.o \
spec.o \
......@@ -89,7 +88,6 @@ record.o: record.c zc_defs.h zc_profile.h zc_arraylist.h zc_hashtable.h \
zc_xplatform.h zc_util.h record.h
record_table.o: record_table.c zc_defs.h zc_profile.h zc_arraylist.h \
zc_hashtable.h zc_xplatform.h zc_util.h record_table.h record.h
release.o: release.c release.h
rotater.o: rotater.c zc_defs.h zc_profile.h zc_arraylist.h zc_hashtable.h \
zc_xplatform.h zc_util.h rotater.h
rule.o: rule.c fmacros.h rule.h zc_defs.h zc_profile.h zc_arraylist.h \
......
#!/bin/sh
GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1`
GIT_DIRTY=`git diff 2> /dev/null | wc -l`
test -f release.h || touch release.h
(cat release.h | grep SHA1 | grep $GIT_SHA1) && \
(cat release.h | grep DIRTY | grep $GIT_DIRTY) && exit 0 # Already uptodate
echo "#define ZLOG_GIT_SHA1 \"$GIT_SHA1\"" > release.h
echo "#define ZLOG_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h
touch release.c # Force recompile of release.c
/* Every time the zlog Git SHA1 or Dirty status changes only this file
* small file is recompiled, as we access this information in all the other
* files using this functions. */
#include "release.h"
char *zlog_git_sha1 = ZLOG_GIT_SHA1;
char *zlog_git_dirty = ZLOG_GIT_DIRTY;
#define ZLOG_GIT_SHA1 "b8d15750"
#define ZLOG_GIT_DIRTY "0"
#define ZLOG_VERSION "1.2.7"
......@@ -27,6 +27,7 @@
#include <unistd.h>
#include "zlog.h"
#include "version.h"
int main(int argc, char *argv[])
......@@ -35,17 +36,14 @@ int main(int argc, char *argv[])
int op;
int quiet = 0;
static const char *help =
"Useage: zlog-chk-conf [conf files]...\n"
"useage: zlog-chk-conf [conf files]...\n"
"\t-q,\tsuppress non-error message\n"
"\t-h,\tshow help message\n"
"\t-v,\tshow zlog library's git version\n";
"zlog version: " ZLOG_VERSION "\n";
while((op = getopt(argc, argv, "qhv")) > 0) {
if (op == 'h') {
puts(help);
return 0;
} else if (op == 'v') {
printf("zlog git version[%s]\n", zlog_git_sha1);
fputs(help, stdout);
return 0;
} else if (op == 'q') {
quiet = 1;
......@@ -56,7 +54,7 @@ int main(int argc, char *argv[])
argv += optind;
if (argc == 0) {
puts(help);
fputs(help, stdout);
return -1;
}
......
......@@ -31,6 +31,7 @@
#include "mdc.h"
#include "zc_defs.h"
#include "rule.h"
#include "version.h"
/*******************************************************************************/
extern char *zlog_git_sha1;
......@@ -123,8 +124,8 @@ int zlog_init(const char *confpath)
{
int rc;
zc_debug("------zlog_init start------");
zc_debug("------compile time[%s %s], git version[%s]------",
__DATE__, __TIME__, zlog_git_sha1);
zc_debug("------compile time[%s %s], version[%s]------",
__DATE__, __TIME__, ZLOG_VERSION);
rc = pthread_rwlock_wrlock(&zlog_env_lock);
if (rc) {
......@@ -164,8 +165,9 @@ err:
int dzlog_init(const char *confpath, const char *cname)
{
int rc = 0;
zc_debug("------zlog_init start, compile time[%s %s], git version[%s]------",
__DATE__, __TIME__, zlog_git_sha1);
zc_debug("------dzlog_init start------");
zc_debug("------compile time[%s %s], version[%s]------",
__DATE__, __TIME__, ZLOG_VERSION);
rc = pthread_rwlock_wrlock(&zlog_env_lock);
if (rc) {
......
......@@ -24,8 +24,6 @@
extern "C" {
#endif
extern char *zlog_git_sha1;
#include <stdarg.h> /* for va_list */
#include <stdio.h> /* for size_t */
......
......@@ -3,14 +3,19 @@
if [ "$1" = "" ]
then
echo "Usage: mk_targz.sh <git tag only>"
echo "Example: mktarball.sh 2.2-rc4"
echo "Example: mk_targz.sh 1.2.7"
exit 1
fi
if [ ! -d .git ]
then
echo "Must run at git home directory"
exit 2
fi
HASH=`git show-ref --hash=8 refs/tags/${1}`
PREFIX="zlog-${1}-${HASH}/"
TARBALL="/tmp/zlog-${1}-${HASH}.tar.gz"
git archive --format=tar -v --prefix=$PREFIX $1 | gzip -c > $TARBALL
cp ${TARBALL} /tmp/zlog-latest-stable.tar.gz
#git archive --format=tar -v --prefix=$PREFIX $1 -o $TARBALL
echo "File created: $TARBALL"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment