author | Michael Krelin <hacker@klever.net> | 2007-11-20 18:39:51 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-11-20 18:39:51 (UTC) |
commit | c868af04ffd60a04c7a98a55cd92b5e12102b1e1 (patch) (side-by-side diff) | |
tree | 0878b62d8c49f6edb175ee6c0605c27613bce2ab | |
parent | bc8cecfcf7e1dc593249200556e5553d7d025c05 (diff) | |
download | libopkele-c868af04ffd60a04c7a98a55cd92b5e12102b1e1.zip libopkele-c868af04ffd60a04c7a98a55cd92b5e12102b1e1.tar.gz libopkele-c868af04ffd60a04c7a98a55cd92b5e12102b1e1.tar.bz2 |
added more precise source tree version detection
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | lib/consumer.cc | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 50dd8d4..23e40da 100644 --- a/configure.ac +++ b/configure.ac @@ -1,39 +1,50 @@ AC_INIT([libopkele], [0.3], [libopkele-bugs@klever.net]) AC_CONFIG_SRCDIR([include/opkele/opkele-config.h]) AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h]) AM_INIT_AUTOMAKE([dist-bzip2]) AC_PROG_INSTALL AC_PROG_CXX AC_PROG_CC AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG AC_HEADER_STDC AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) +AC_MSG_CHECKING([for source tree version]) +if headrev=$(cd $srcdir && git rev-parse --verify HEAD 2>/dev/null) ; then + PACKAGE_SRC_VERSION="${PACKAGE_VERSION}:$(cd $srcdir && git describe --tags $headrev)" + ( cd $srcdir && git diff-index $headrev | read dirt ) && PACKAGE_SRC_VERSION="${PACKAGE_SRC_VERSION}-dirty" +else + PACKAGE_SRC_VERSION="$PACKAGE_VERSION" +fi +AC_MSG_RESULT([$PACKAGE_SRC_VERSION]) +AC_SUBST([PACKAGE_SRC_VERSION]) +AC_DEFINE_UNQUOTED([PACKAGE_SRC_VERSION],["$PACKAGE_SRC_VERSION"],[more or less precise source tree version]) + PKG_CHECK_MODULES([OPENSSL],[openssl],,[ AC_MSG_ERROR([no openssl library found. get one from http://www.openssl.org/]) ]) WANT_KONFORKA="yes" AC_ARG_ENABLE([konforka], AC_HELP_STRING([--disable-konforka],[do not use konforka library (default: use if found)]), [ test "${enableval}" = "no" && WANT_KONFORKA="no" ] ) if test "${WANT_KONFORKA}" = "yes" ; then PKG_CHECK_MODULES([KONFORKA],[konforka],[ AC_SUBST([KONFORKA_CFLAGS]) AC_SUBST([KONFORKA_LIBS]) AC_DEFINE([HAVE_KONFORKA],,[defined in presence of konforka library]) AC_DEFINE([OPKELE_HAVE_KONFORKA],,[defined in presence of konforka library]) AC_SUBST([KONFORKA_KONFORKA],[konforka]) ],[true]) fi WANT_DOXYGEN="yes" AC_ARG_ENABLE([doxygen], AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), diff --git a/lib/consumer.cc b/lib/consumer.cc index f72ae08..76b6ea7 100644 --- a/lib/consumer.cc +++ b/lib/consumer.cc @@ -60,49 +60,49 @@ namespace opkele { return pcre_exec(_p,NULL,s.c_str(),s.length(),0,0,m._ov,m._s); } }; class curl_t { public: CURL *_c; curl_t() : _c(0) { } curl_t(CURL *c) : _c(c) { } ~curl_t() throw() { if(_c) curl_easy_cleanup(_c); } curl_t& operator=(CURL *c) { if(_c) curl_easy_cleanup(_c); _c=c; return *this; } operator const CURL*(void) const { return _c; } operator CURL*(void) { return _c; } }; static CURLcode curl_misc_sets(CURL* c) { CURLcode r; (r=curl_easy_setopt(c,CURLOPT_FOLLOWLOCATION,1)) || (r=curl_easy_setopt(c,CURLOPT_MAXREDIRS,5)) || (r=curl_easy_setopt(c,CURLOPT_DNS_CACHE_TIMEOUT,120)) || (r=curl_easy_setopt(c,CURLOPT_DNS_USE_GLOBAL_CACHE,1)) - || (r=curl_easy_setopt(c,CURLOPT_USERAGENT,PACKAGE_NAME"/"PACKAGE_VERSION)) + || (r=curl_easy_setopt(c,CURLOPT_USERAGENT,PACKAGE_NAME"/"PACKAGE_SRC_VERSION)) || (r=curl_easy_setopt(c,CURLOPT_TIMEOUT,20)) #ifdef DISABLE_CURL_SSL_VERIFYHOST || (r=curl_easy_setopt(c,CURLOPT_SSL_VERIFYHOST,0)) #endif #ifdef DISABLE_CURL_SSL_VERIFYPEER || (r=curl_easy_setopt(c,CURLOPT_SSL_VERIFYPEER,0)) #endif ; return r; } static size_t _curl_tostring(void *ptr,size_t size,size_t nmemb,void *stream) { string *str = (string*)stream; size_t bytes = size*nmemb; size_t get = min(16384-str->length(),bytes); str->append((const char*)ptr,get); return get; } assoc_t consumer_t::associate(const string& server) { util::dh_t dh = DH_new(); if(!dh) throw exception_openssl(OPKELE_CP_ "failed to DH_new()"); dh->p = util::dec_to_bignum(data::_default_p); |