Permalink
Browse files

code: add zlog version, kick git hash away

  • Loading branch information...
1 parent 98992c8 commit ed0995d0ffe422036a07b93e32666c466f370eed @HardySimpson committed Nov 27, 2012
Showing with 21 additions and 37 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 src/conf.c
  3. +0 −2 src/makefile
  4. +0 −9 src/mk_release.sh
  5. +0 −8 src/release.c
  6. +0 −2 src/release.h
  7. +1 −0 src/version.h
  8. +5 −7 src/zlog-chk-conf.c
  9. +6 −4 src/zlog.c
  10. +0 −2 src/zlog.h
  11. +7 −2 tools/mk_targz.sh
View
@@ -48,3 +48,4 @@ doc/*.htoc
doc/*.tex
test/press*
test/*.png
+release.h
View
@@ -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) {
View
@@ -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 \
View
@@ -1,9 +0,0 @@
-#!/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
View
@@ -1,8 +0,0 @@
-/* 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;
View
@@ -1,2 +0,0 @@
-#define ZLOG_GIT_SHA1 "b8d15750"
-#define ZLOG_GIT_DIRTY "0"
View
@@ -0,0 +1 @@
+#define ZLOG_VERSION "1.2.7"
View
@@ -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;
}
View
@@ -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 @@ int zlog_init(const char *confpath)
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) {
View
@@ -24,8 +24,6 @@
extern "C" {
#endif
-extern char *zlog_git_sha1;
-
#include <stdarg.h> /* for va_list */
#include <stdio.h> /* for size_t */
View
@@ -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"

0 comments on commit ed0995d

Please sign in to comment.