[Home]

Summary:ASTERISK-02645: Add preprocessor parsable ASTERISK_VERSION
Reporter:zozo (zozo)Labels:
Date Opened:2004-10-21 10:16:24Date Closed:2011-06-07 14:05:30
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asteriskversionnum.patch
( 1) asteriskversionnum.patch.txt
( 2) version-num-noquote.patch.txt
Description:It would be nice to have something like the following ...

#define ASTERISK_VERSIONX 010000 // In 1.0.0
#define ASTERISK_VERSIONX 010001 // In 1.0.1
#define ASTERISK_VERSIONX 999999 // In CVS Head

.. available for modules at compile time.

or am i missing something obvious for modules (e/g chan_bluetooth) trying to support both 1.0 and cvs head? (channel->cid. for example in 1.0)

we're obviously not going to get anyhting in 1.0.0 or 1.0.1, but how about adding 999999 into cvs head, then adding into releases from now on?
Comments:By: Brian West (bkw918) 2004-10-21 10:26:25

Its there already... CVS-HEAD vs CVS-tag for stable.

bkw

By: Brian West (bkw918) 2004-10-21 10:26:45

ASTERISKVERSION=$(shell if [ -f .version ]; then cat .version; else if [ -d CVS ]; then if [ -f CVS/Tag ] ; then echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%\
T"`"; else echo "CVS-HEAD-`date +"%D-%T"`"; fi; fi; fi)

By: zozo (zozo) 2004-10-21 11:45:42

Thats not too helpful when trying to work out if it's < version 1.0.1, release 1.0.x, etc...  only strict matches on single releases.

By: Brian West (bkw918) 2004-10-22 15:14:21

Can't be done the way we do it now.

By: zozo (zozo) 2004-10-22 20:08:58

How about this then?  Sets ASTERISK_VERSION_NUM to 999999 if CVS directory exists, else parses .version ands sets it to %02d%02d%02d.  If either fails, sets to 000000.

#if (ASTERISK_VERSION_NUM < 010100)
 if (!ast_callerid_parse(tmp, &name, &num))
     esc = escape_str(name);
#else
   if (dev->owner->cid.cid_name)
     esc = escape_str(dev->owner->cid.cid_name);
#endif

hows that look?

edited on: 10-22-04 20:11

By: zozo (zozo) 2004-10-22 20:29:31

Thinking about this a bit more late at night with a bottle of wine, it might be nice to have an API revision number.  I don't care from an app/channel point of view if it's version 1.0.0 of 1.0.1, only that the channel and app API is the same.

perhaps ASTERISK_API_VERSION which is bumped when a new release comes out and has a different API from the presious release?

(That includes things like a change of const char instead of char in ast_channel_register()!)

By: Mark Spencer (markster) 2004-10-23 17:40:39

Do you have a disclaimer on file, btw?

By: zozo (zozo) 2004-10-23 18:38:18

yup ... sent yonks ago :)

By: Mark Spencer (markster) 2004-10-23 23:12:50

Added to CVS!

By: zozo (zozo) 2004-10-24 07:14:52

Whoops.  -DASTERISK_VERSION_NUM=$(ASTERISKVERSIONNUM) instead of -DASTERISK_VERSION_NUM=\"$(ASTERISKVERSIONNUM)\".  Sorry, i'm an idiot.

Patch attached.

By: Mark Spencer (markster) 2004-10-24 09:07:46

Fixed in CVS (again) :)

By: Russell Bryant (russell) 2004-10-24 20:39:23

If someone gets asterisk from the stable branch of CVS, ASTERISKVERSIONNUM will be 999999.

I just wanted to make sure that this is still what you wanted.  In your given example for callerid, it would break because of this.

By: Mark Spencer (markster) 2004-11-01 15:47:21.000-0600

We could add a .version file into Asterisk CVS stable, right?

edited on: 11-01-04 15:47

By: Russell Bryant (russell) 2004-11-11 12:17:43.000-0600

Sure, but it will still be set to 999999 with the current implementation:

ASTERISKVERSIONNUM=$(shell if [ -d CVS ]; then echo 999999 ; else if [ -f .version ] ...

By: Brian West (bkw918) 2004-11-30 00:06:02.000-0600

Is this still a problem?

By: Digium Subversion (svnbot) 2008-01-15 15:11:29.000-0600

Repository: asterisk
Revision: 4080

U   trunk/Makefile

------------------------------------------------------------------------
r4080 | markster | 2008-01-15 15:11:28 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix Makefile issue (bug ASTERISK-2645, again)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4080