[asterisk-bugs] [Asterisk 0013223]: [patch] Generate a version when asterisk is built in a git repository

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Aug 6 17:45:20 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13223 
====================================================================== 
Reported By:                tzafrir
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13223
Category:                   Core/BuildSystem
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     feedback
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 133488 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-08-02 11:09 CDT
Last Modified:              2008-08-06 17:45 CDT
====================================================================== 
Summary:                    [patch] Generate a version when asterisk is built in
a git repository
Description: 
Currently asterisk knows to generate version.h from two potential sources:

1. a .version file in the source tree. This is used for tarballs or
tarballs.
2. 'svn info' when building an a subversion repository and there's no
.version file.

This patch adds handling to building in a git repository, similar to (2):

* Like in (2), the numeric version number is 999999.
* Unlike in (2), though, I could not think of a nice way to derive a text
version string. Thus the version name is simply "GIT".

Without the Makefile part of this patch, building fails in a git
repository (specifically: at res/res_snmp.c). Thus I do not consider it a
feature.

The current patch is vs. 1.4. A similar patch should probably work vs.
1.6. I'll add one soon.
====================================================================== 

---------------------------------------------------------------------- 
 (0091180) tzafrir (manager) - 2008-08-06 17:45
 http://bugs.digium.com/view.php?id=13223#c91180 
---------------------------------------------------------------------- 
Just re-tested on 1.4 . 

To save time, the following is done on a tree that is already
fully-built.

tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ cat
include/asterisk/version.h
/*
 * version.h
 * Automatically generated
 */
#define ASTERISK_VERSION "SVN-branch-1.4-r136168"
#define ASTERISK_VERSION_NUM 999999
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ mv .svn _svn
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ rm
include/asterisk/version.h
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ make
include/asterisk/version.h
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ cat
include/asterisk/version.h
/*
 * version.h
 * Automatically generated
 */
#define ASTERISK_VERSION ""
#define ASTERISK_VERSION_NUM
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ LANG=C make
menuselect/menuselect --check-deps menuselect.makeopts
Generating embedded module rules ...
make[1]: Entering directory
`/home/tzafrir/Proj/Asterisk/Svn/asterisk-1.4/utils'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory
`/home/tzafrir/Proj/Asterisk/Svn/asterisk-1.4/utils'
make[1]: Entering directory
`/home/tzafrir/Proj/Asterisk/Svn/asterisk-1.4/agi'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory
`/home/tzafrir/Proj/Asterisk/Svn/asterisk-1.4/agi'
make[1]: Entering directory
`/home/tzafrir/Proj/Asterisk/Svn/asterisk-1.4/res'
   [CC] snmp/agent.c -> snmp/agent.o
snmp/agent.c: In function 'ast_var_Version':
snmp/agent.c:724: error: expected expression before ';' token
make[1]: *** [snmp/agent.o] Error 1
make[1]: Leaving directory
`/home/tzafrir/Proj/Asterisk/Svn/asterisk-1.4/res'
make: *** [res] Error 2

# now applying the Makefile fix from ver_999999.diff to Makefile alone.

And:

tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ rm
include/asterisk/version.h
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ make
include/asterisk/version.h
tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ cat
include/asterisk/version.h
/*
 * version.h
 * Automatically generated
 */
#define ASTERISK_VERSION ""
#define ASTERISK_VERSION_NUM 999999

tzafrir at sweetmorn:~/Proj/Asterisk/Svn/asterisk-1.4$ LANG=C make
menuselect/menuselect --check-deps menuselect.makeopts
Generating embedded module rules ...
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
   [CC] snmp/agent.c -> snmp/agent.o
   [LD] res_snmp.o snmp/agent.o -> res_snmp.so
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
   [CC] asterisk.c -> asterisk.o
   [CC] http.c -> http.o
   [LD] abstract_jb.o acl.o aescrypt.o aeskey.o aestab.o alaw.o app.o
ast_expr2.o ast_expr2f.o asterisk.o astmm.o astobj2.o audiohook.o
autoservice.o callerid.o cdr.o channel.o chanvars.o cli.o config.o
cryptostub.o db.o devicestate.o dial.o dns.o dnsmgr.o dsp.o enum.o file.o
fixedjitterbuf.o frame.o fskmodem.o global_datastores.o http.o image.o
indications.o io.o jitterbuf.o loader.o logger.o manager.o md5.o netsock.o
pbx.o plc.o privacy.o rtp.o say.o sched.o sha1.o slinfactory.o srv.o
stdtime/localtime.o strcompat.o tdd.o term.o threadstorage.o translate.o
udptl.o ulaw.o utils.o editline/libedit.a db1-ast/libdb1.a -> asterisk
 +--------- Asterisk Build Complete ---------+
 + Asterisk has successfully been built, and +
 + can be installed by running:              +
 +                                           +
 +               make install                +
 +-------------------------------------------+ 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-08-06 17:45 tzafrir        Note Added: 0091180                          
======================================================================




More information about the asterisk-bugs mailing list