• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Version numbering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Version numbering


  • Subject: Re: Version numbering
  • From: "Andy O'Meara" <email@hidden>
  • Date: Thu, 25 Jan 2007 12:49:28 -0500


Here's two perl scripts that may serve as a good starting point for you that we use in Xcode's script run phase. The first is the first run-phase script that writes a a simple C .h file containing a couple #defines, and it gets its info from subversion and the current time stamp. The second script is the last phase the execute and simply does a find/replace for the token BUILD_NUMBER in Info.plist. Credit goes to Daniel Jalkut for help developing these scripts.


/////// SNIP


# /usr/bin/perl -w
# Xcode auto-versioning script for Subversion
# This script generates BUILD_NUMBER.h based on the subversion rev and the current timestamp.
# Last modified: 12OCT06


use strict;
use POSIX qw(ceil floor);

die "$0: Must be run from Xcode" unless $ENV{"BUILT_PRODUCTS_DIR"};

# Get the current subversion revision number and use it to set the CFBundleVersion value
my $REV = `/usr/local/bin/svnversion -n ./`;


my $version = $REV;
$version =~ s/([\d]*:)([\d]+).*/$2/;
$version =~ s/([\d]+).*/$1/;   # Removes trailing letters
die "$0: No Subversion revision found" unless $version;


# Separate the version into the value before the first point, and the value after


my ( $baseVersion, $pointVersion );
( $baseVersion, $pointVersion ) = ( $ENV{APPLICATION_VERSION} =~ /(\d +)([^\d][\d\.]*)/ );


$pointVersion =~ s/[^\d]//g;
$pointVersion = ".$pointVersion";

my $base10Version = int( 100 * ( $baseVersion + $pointVersion ) );





#
# Compute the build date (days elapsed since 1/1/1900 -- see SSTime.h)
#

my @currentTime;

@currentTime = localtime( time );

my $yearDays = $currentTime[ 7 ];
my $year     = $currentTime[ 5 ] - 100;

my $DAYS_1900_TO_2000 = 36524;

my $BUILD_DATE = $DAYS_1900_TO_2000 + $yearDays + ( 365 * $year + floor( ( $year + 3 ) / 4 ) );



#
# Generate the new header string
#


my $newFileStr = "#define BUILD_NUMBER \"$version\"\n#define BUILD_VERSION \"$ENV{APPLICATION_VERSION}\"\n#define BUILD_VERSION_BASE10 $base10Version\n#define BUILD_DATE $BUILD_DATE\n";




#
# Write out the new header
#

my $HEADER = "$ENV{SRCROOT}/src/BUILD_NUMBER.h";

my $curFileStr = "";

# Read in the current BUILD_NUMBER.h so we can see if it's different (below)
if ( open(FH, "$HEADER") ) {
$curFileStr = join("", <FH>);
close(FH);
}


# Only write a new one if the contents aren't what we want (otherwise, we'll cause the project to rebuilt each time!)
if ( $curFileStr ne $newFileStr ) {
open(FH, ">$HEADER") or die "$0: $HEADER: $!";
print FH $newFileStr;
close(FH);
}




/////// SNIP


# /usr/bin/perl -w # LAST UPDATED: 22MAR06 # Xcode auto-versioning script for Subversion # Replaces BUILD_NUMBER with the subversion rev number in Info.plist

use strict;

die "$0: Must be run from Xcode" unless $ENV{"BUILT_PRODUCTS_DIR"};

# Get the current subversion revision number and use it to set the CFBundleVersion value
my $REV = `/usr/local/bin/svnversion -n ./`;
my $INFO = "$ENV{BUILT_PRODUCTS_DIR}/$ENV{WRAPPER_NAME}/Contents/ Info.plist";


my $version = $REV;
$version =~ s/([\d]*:)([\d]+).*/$2/;
$version =~ s/([\d]+).*/$1/;   # Removes trailing letters
die "$0: No Subversion revision found" unless $version;

# Read in Info.plist
open(FH, "$INFO") or die "$0: $INFO: $!";
my $info = join("", <FH>);
close(FH);

# Find and replace BUILD_NUMBER with a real value
$info =~ s/BUILD_NUMBER/$version/g;

# Write out the new plist file
open(FH, ">$INFO") or die "$0: $INFO: $!";
print FH $info;
close(FH);




/////// SNIP




On Jan 24, 2007, at 5:00 PM, Walter wrote:

Does anyone else have problems with the Apple version numbering scheme?

My software business model works in a different manner than Apple's and I
don't find the version numbering sufficient. Each and every build that we
make is a release candidate. Every bug fix needs to be built individually.
I can't go back and change the version numbers after a build has been
verified by QA.


This leaves 100 bug fixes before I need to increment the major version
number. Since not every bug is truly fixed the first time, the number of
bug fixes between major releases is even smaller.


Is there a better way to do version numbering that I'm not finding?

Currently we don't worry about it and our current version is 5.13.59,
however I've noticed issues with the installer where some components are not
properly updated. I'm assuming that the installer is getting confused with
attempting to store 13 & 59 as a BCD and then shoveling that value into a
byte.


Does anyone know how the installer actually compares version numbers?

Thanks,
Walter


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40soundspectrum.com


This email sent to email@hidden



_______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Version numbering (From: Walter <email@hidden>)

  • Prev by Date: Version numbering
  • Next by Date: RE: Version numbering
  • Previous by thread: Version numbering
  • Next by thread: RE: Version numbering
  • Index(es):
    • Date
    • Thread