The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Version Number Creation Hell

Last post 04-16-2012 12:05 PM by ASheridan. 29 replies.
Page 1 of 1 (30 items)
Sort Posts: Previous Next
  • 04-13-2012 1:09 PM

    Version Number Creation Hell

    So, the boss asked me to change the structure of the version information displayed in the about box. Previously, it showed date information. We need to move to a more version-number way for reasons that don't really matter.

    So, I start digging.

    public void showAboutBox() {
      Properties version_props = new Properties();
      String file_name = System.getProperty("APP_HOME", "/prod/app") + "/" + "release.info";
      try {
        version_props.load(new FileInputStream(file_name));
      } catch (Exception e) {
        e.printStackTrace();
      }
    
      String about = ABOUT_MESSAGE + version_props.getProperty("Release_Identifier", "no version found");
    
      Utilities.showInternalMessageDialog(this, about, "About App", JOptionPane.INFORMATION_MESSAGE);
    
    }

    Um ... okay ... so, where does this "release.info" file get created? Ant config, probably? Aha, yes! build.xml:

    <target name="release-info" depends="init">
    
      <exec executable="cvs" output="temp1.fil">
        <arg value="log" />
        <arg value="${basedir}/build.xml" />
      </exec>
    
      <exec executable="grep" output="temp2.fil">
        <arg value="-v" />
        <arg value="candidate_release_" />
        <arg value="temp1.fil" />
      </exec>
    
      <exec executable="grep" output="temp1.fil">
        <arg value="release_" />
        <arg value="temp2.fil" />
      <exec>
    
      <exec executable="sed" output="temp2.fil">
        <arg value="-e" />
        <arg value="s/^.*release_/release_/;s/:.*$//" />
        <arg value="temp1.fil" />
      </exec>
    
      <exec executable="nawk" output="temp1.fil">
        <arg value="BEGIN{x=0};{x++;if(x==1) print $0}" />
        <arg value="temp2.fil" />
      </exec>
    
      <loadfile srcFile="${basedir}/temp1.fil" property="releaseId">
        <filterchain>
          <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
            <param type="regexp" value="release_[0-9][0-9][0-9][0-9]_[0-9][0-9]_[0-9][0-9]" />
          </filterreader>
        </filterchain>
      </loadfile>
    
      <echo 
        message="Project Name: ${project}${line.separator}"
        file="${dist}/release.info" />
    
      <echo 
        message="Release_Identifier=${releaseId}"
        file="${dist}/release.info"
        append="true" />
    
      <echo
        message="Build Timestamp: "
        file="${dist}/release.info"
        append="true" />
    
      <exec executable="date" output="${dist}/release.info" append="true" />
    
      <delete file="temp1.fil" verbose="false" />
      <delete file="temp2.fil" verbose="true" />
    
      <exec executable="cat" output="${dist}/application.info">
        <arg value="${dist}/release.info" />
        <arg value="${lib.dist}/release.info" />
      </exec>
    </target>

    :headdesk:

    Essentially, search for the first tag in CVS, strip off the 'release' word and stuff it into the release ID and create the file with that info?

    So, if I don't want to break these fragile relationships, I change the regex in the filterreader to recognize [0-9].[0-9],[0-9], start using that format in the tags, and I'm done?

    But what if I want to overhaul this whole process? How do you guys do this kind of thing? There's got to be a simpler way to do this, right?

  • 04-13-2012 1:19 PM In reply to

    Re: Version Number Creation Hell

    That is heinous. Ant is good for some things but when you're doing shell scripting in it you should ask yourself "Is there a better way"?

    Let the healing begin!

  • I may not agree with everything Morbs just said, but he expresses himself in a way that is dignified, respectful, polite and non-threatening!
  • 04-13-2012 1:37 PM In reply to

    Re: Version Number Creation Hell

    zelmak:
    But what if I want to overhaul this whole process? How do you guys do this kind of thing? There's got to be a simpler way to do this, right?
    Our repository is set up as a trunk that we release from and project/feature branches, so we keep a file in the repository that represents the major and minor versions and another file with the build number.  The build script increments number in the build number file and then major and minor version numbers are modified by hand.  Our version number format is Mojor.Minor.Build.Revision with "Revision" being the SubVersion revision number of the latest change to that project in the repository.

  • 04-13-2012 1:39 PM In reply to

    Re: Version Number Creation Hell

    They're wanting to move from Solaris to Windows, client-side.

    I'm waiting to yell and scream when they want us to move development to Windows as well.

    Recently, I created a ticket to have a java -> c-shell -> sqlplus -> database process (with requisite hard-coded passwords in the shell script) changed to a java -> database process.

    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.

  • 04-13-2012 1:41 PM In reply to

    Re: Version Number Creation Hell

    Jaime:

    zelmak:
    But what if I want to overhaul this whole process? How do you guys do this kind of thing? There's got to be a simpler way to do this, right?
    Our repository is set up as a trunk that we release from and project/feature branches, so we keep a file in the repository that represents the major and minor versions and another file with the build number.  The build script increments number in the build number file and then major and minor version numbers are modified by hand.  Our version number format is Mojor.Minor.Build.Revision with "Revision" being the SubVersion revision number of the latest change to that project in the repository.

    Sadly, I've yet to figure out how to get a single magic number from CVS ... since version numbers are on individual files instead of the repository / project as a whole. How ugly is your build script which increments this number? Does it sit and wait for user input for the major/minor numbers or do you have to edit (and commit) the file before the build process?

  • 04-13-2012 1:50 PM In reply to

    Re: Version Number Creation Hell

    zelmak:
    How ugly is your build script which increments this number? Does it sit and wait for user input for the major/minor numbers or do you have to edit (and commit) the file before the build process?
    We manually edit and commit the major/minor number.  The script is medium-ugly, but that's mostly due to the fact that we build shared libraries from source, so every build has five or more versioned files, all with different version numbers.  The main output always increments the build number, but shared outputs only increment the build number if there has been a commit since the last build.  That way the same source always maps to the same version number.

  • 04-13-2012 2:26 PM In reply to

    Re: Version Number Creation Hell

     I just feel sorry for you that you're still using CVS in this day and age.  WTF?

  • 04-13-2012 3:10 PM In reply to

    Re: Version Number Creation Hell

    zelmak:
    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.
    I'm the most sane person on this board. Now excuse me while I spend 6 hours trying to get my cat to pose in her My Little Ponies outfit, so I can add that as a shield icon in Skyrim.
      <-  I couldn't make my shit work, so here's a Godzilla head.
  • 04-13-2012 3:29 PM In reply to

    • PJH
    • Top 10 Contributor
    • Joined on 02-14-2007
    • Newcastle, UK
    • Posts 3,916

    Re: Version Number Creation Hell

    zelmak:

    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.

    I, for some reason, feel you're missing out Snoofle in your requirements document....
    "Because you watched 'The Very Hungry Caterpillar,' we recommend 'The Human Centipede.'"
    --
    UED - Countryside: To kill Piers Morgan
  • Parp!
  • 04-13-2012 3:41 PM In reply to

    Re: Version Number Creation Hell

    zelmak:
    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.
    I work for a Bay Area company. I'm in the middle of relocating permanently to one of the two non-contiguous states. I have a place to live but I still have to take care of some stuff where I'm living now.

    Let the healing begin!

  • I may not agree with everything Morbs just said, but he expresses himself in a way that is dignified, respectful, polite and non-threatening!
  • 04-13-2012 3:47 PM In reply to

    Re: Version Number Creation Hell

    morbiuswilters:
    zelmak:
    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.
    I work for a Bay Area company. I'm in the middle of relocating permanently to one of the two non-contiguous states. I have a place to live but I still have to take care of some stuff where I'm living now.
    The one that Microsoft Flight models, or the one with polar bears?
      <-  I couldn't make my shit work, so here's a Godzilla head.
  • 04-13-2012 3:50 PM In reply to

    Re: Version Number Creation Hell

    morbiuswilters:
    zelmak:
    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.
    I work for a Bay Area company. I'm in the middle of relocating permanently to one of the two non-contiguous states. I have a place to live but I still have to take care of some stuff where I'm living now.

     Hey, Im based out of NY, but have been stuck in Milpitas for the past 6 months (just outside San Jose for those not familiar). I have family who until recently lived in HAwaii (my assumption as to where you are going) and have spend time in Alaska (great to visit...but...) myself.

  • 04-13-2012 4:02 PM In reply to

    Re: Version Number Creation Hell

    blakeyrat:
    morbiuswilters:
    zelmak:
    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.
    I work for a Bay Area company. I'm in the middle of relocating permanently to one of the two non-contiguous states. I have a place to live but I still have to take care of some stuff where I'm living now.
    The one that Microsoft Flight models, or the one with polar bears?
    The one from which you cannot see Russia.

    Let the healing begin!

  • I may not agree with everything Morbs just said, but he expresses himself in a way that is dignified, respectful, polite and non-threatening!
  • 04-13-2012 4:05 PM In reply to

    Re: Version Number Creation Hell

    TheCPUWizard:
    Hey, Im based out of NY
    I used to be based out of Cambridge but decided to look for jobs closer to the non-contiguous state I would be moving to.

    TheCPUWizard:
    I have family who until recently lived in HAwaii
    Which island?

    Let the healing begin!

  • I may not agree with everything Morbs just said, but he expresses himself in a way that is dignified, respectful, polite and non-threatening!
  • 04-13-2012 4:16 PM In reply to

    Re: Version Number Creation Hell

    morbiuswilters:
    TheCPUWizard:
    Hey, Im based out of NY
    I used to be based out of Cambridge but decided to look for jobs closer to the non-contiguous state I would be moving to.

    TheCPUWizard:
    I have family who until recently lived in HAwaii
    Which island?

    Maui, in Kihei (athough for a time they live in Lahaina)

  • 04-13-2012 4:25 PM In reply to

    Re: Version Number Creation Hell

    TheCPUWizard:
    Maui, in Kihei (athough for a time they live in Lahaina)
    Ah, I love Lahaina; it's probably my second favorite town after Paia. They're all nice, though.

    Let the healing begin!

  • I may not agree with everything Morbs just said, but he expresses himself in a way that is dignified, respectful, polite and non-threatening!
  • 04-13-2012 4:31 PM In reply to

    • locallunatic
    • Top 50 Contributor
    • Joined on 05-19-2010
    • (YourLocation==USA-KY?local:MisleadingUsername)
    • Posts 838

    Re: Version Number Creation Hell

    TheCPUWizard:
    spend time in Alaska (great to visit...but...)
     

    AK is an awesome place to live, plus it would help most on this board blend in as their crazy wouldn't stand out as much.

  • 04-13-2012 4:46 PM In reply to

    Re: Version Number Creation Hell

    locallunatic:

    TheCPUWizard:
    spend time in Alaska (great to visit...but...)
     

    AK is an awesome place to live, plus it would help most on this board blend in as their crazy wouldn't stand out as much.

     My sister is moving up there (just outside Anchorage) next year... Personally I like the "faster pace", which is why I will probably never move out of Manhattan (again).

  • 04-13-2012 4:59 PM In reply to

    • locallunatic
    • Top 50 Contributor
    • Joined on 05-19-2010
    • (YourLocation==USA-KY?local:MisleadingUsername)
    • Posts 838

    Re: Version Number Creation Hell

    TheCPUWizard:
    My sister is moving up there (just outside Anchorage) next year
     

    Oh?  Which direction from Anchortown, Girdwood or Eagle River/Wasilla/Palmer way?

  • 04-13-2012 5:12 PM In reply to

    Re: Version Number Creation Hell

    locallunatic:

    TheCPUWizard:
    My sister is moving up there (just outside Anchorage) next year
     

    Oh?  Which direction from Anchortown, Girdwood or Eagle River/Wasilla/Palmer way?

     Not exactly known. She is a teacher and there are opportunities up in that area. Location will depend on where she gets hired.

  • 04-13-2012 5:18 PM In reply to

    • locallunatic
    • Top 50 Contributor
    • Joined on 05-19-2010
    • (YourLocation==USA-KY?local:MisleadingUsername)
    • Posts 838

    Re: Version Number Creation Hell

    TheCPUWizard:
    Not exactly known. She is a teacher and there are opportunities up in that area. Location will depend on where she gets hired.
     

    Then if not in Anchorage but close by it's almost certainly going to be Eagle River/Wasilla/Palmer way, Girdwood is too small to have many spots and is right at the foot of a good slope so I'm sure there is fighting over any spots there.  Of course it could also be Alaska close by and not lower 48 close in which case the options expand a lot.

  • 04-13-2012 5:45 PM In reply to

    Re: Version Number Creation Hell

    morbiuswilters:
    The one from which you cannot see Russia.
    Hope you enjoy spam. And sushi made from spam.
      <-  I couldn't make my shit work, so here's a Godzilla head.
  • 04-13-2012 6:42 PM In reply to

    Re: Version Number Creation Hell

    blakeyrat:
    morbiuswilters:
    The one from which you cannot see Russia.
    Hope you enjoy spam. And sushi made from spam.
    I find their love of Spam amusing, but no, I probably won't be eating any. I've never actually had it but even when I ate meat it didn't look appetizing.

    Let the healing begin!

  • I may not agree with everything Morbs just said, but he expresses himself in a way that is dignified, respectful, polite and non-threatening!
  • 04-13-2012 9:34 PM In reply to

    Re: Version Number Creation Hell

    morbiuswilters:
    I've never actually had it but even when I ate meat it didn't look appetizing.
    I've eaten SPAM quite a few times. You can of course just slice it and put it in a sandwich as-is, but it definitely tastes best after gentle shallow-frying over a medium to low heat until it's turned golden on the outside. I'm not trying to pretend it's as good as (say) a gammon steak, but it's not the worst thing I've ever eaten, either.
  • 04-14-2012 4:21 AM In reply to

    Re: Version Number Creation Hell

    blakeyrat:
    I'm the most sane person on this board. Now excuse me while I spend 6 hours trying to get my cat to pose in her My Little Ponies outfit, so I can add that as a shield icon in Skyrim.

     It's easier if you just use the cat's skin.

  • 04-16-2012 9:30 AM In reply to

    Re: Version Number Creation Hell

    Here's what my group does...
    We have a release script we use for building our releases. 
    Our release script will TAG the release.
    
    We always use the format of vX.XX (it's manually maintained).
    
    Then the build scripts checkouts the TAG.
    That way each CVS directory has Tag file indicating the build number.
    
    In our build scripts we read in the build number.
    LINUX method:
    export releasetag=`cat CVS/Tag`
    
    WINDOWS method:
    SET CVSFOLDER="%~dp0CVS\Tag"
    set releasetag=
    IF EXIST %CVSFOLDER% (
     FOR /F "usebackq eol=; tokens=* delims=" %%i in (%CVSFOLDER%) do set releasetag=%%i
    )
    
    Then in our ANT XML file we have:
    	<condition property="env.releasetag" else="HEAD">
    		<isset property="env.releasetag" />
    	</condition>
    	<tstamp>
    		<format property="env.buildDate" pattern="yyyy-MM-dd hh:mm aa" unit="hour"/>
      	</tstamp>
    
    		<delete file="out/version.info"/>
    		<copy file="templates/version.info" todir="out/version.info" filtering="on">
    			<filterset>
    					<filter token="releaseTag" value="${env.releasetag}"/>
    					<filter token="buildDate" value="${env.buildDate}"/>
    			</filterset>
    		</copy>
    
  • 04-16-2012 9:56 AM In reply to

    Re: Version Number Creation Hell

    PJH:
    zelmak:

    Morbs / Blakey ... where (geographically) do you work and are there openings? As insane as either of you are, it would feel like Eden working in/around your environment compared to here.

    I, for some reason, feel you're missing out Snoofle in your requirements document....

    No no ... those people are bat-shit crazy.

    Oh, wait ... hrm ...

    No, I think they're still crazier at snoofle's place of work. The problem here is a 'too many cooks, with no design over 12 years' problem ...

  • 04-16-2012 10:00 AM In reply to

    Re: Version Number Creation Hell

    morbiuswilters:
    TheCPUWizard:
    Hey, Im based out of NY
    I used to be based out of Cambridge but decided to look for jobs closer to the non-contiguous state I would be moving to.

    TheCPUWizard:
    I have family who until recently lived in HAwaii
    Which island?

    I was on Oahu for three years at Hickam. (I'm retired USAF.)

  • 04-16-2012 10:01 AM In reply to

    Re: Version Number Creation Hell

    Oh, and thanks all for your hints how to overhaul our process.

  • 04-16-2012 12:05 PM In reply to

    Re: Version Number Creation Hell

    blakeyrat:
    Now excuse me while I spend 6 hours trying to get my cat to pose in her My Little Ponies outfit, so I can add that as a shield icon in Skyrim.
     

    They make those in cat sizes?!

Page 1 of 1 (30 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems