Project

General

Profile

Actions

Bug #1170

closed

Installation from tar file does not work due to issue getting the version

Added by Amber Herold over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Amber Herold
Category:
-
Target version:
Start date:
02/02/2011
Due date:
% Done:

0%

Estimated time:
Affected Version:
Appion/Leginon 2.1.0
Show in known bugs:
No
Workaround:

Description

setup.py in the Appion folder needs to be updated to get the revision from the .xml file that stores it using a function already created in the dbschema update code.

Then we MUST test a complete installation from scratch using the tar file, NOT svn and NOT the autoinstaller.


Related issues 1 (0 open1 closed)

Related to Appion - Bug #469: For appion releases we need a version.txt file with the version name in itClosedJim Pulokas05/12/2010

Actions
Actions #1

Updated by Amber Herold over 13 years ago

OK, there are about 5 different ways that we are storing and retrieving the revision information. Myamiweb uses the XML file located under myamiweb/xml, and so does dbschema updates. This revision number is added to the project database install table. Appion looks up the information in the svn files, and uses that to create a version.txt file stored under appionlib which is used to add the revision number being used for processing runs to the ap databases. Leginon also has its own functions for getting version information.

To fix the current bug, I added the version.txt file to source control, which will be manually edited prior to release. If svn information is available at the time the file is being used, the current svn revision is appended to one already available in the text file.

This is really not an ideal fix. I would like the whole process to be automated to eliminate user error during release packaging, and I would like to simplify the way that we are handling tracking the current revision. It seems silly to use so many different mechanisms. Perhaps we could create a versioning library in pyami that all the projects could use.

To test:
  1. do a fresh install using the svn trunk.
    svn co http://emg.nysbc.org/svn/myami/trunk myami/
    
  2. ensure the proper revision is stored in appionlib/version.txt
  3. get the code from svn using the export function which removes svn files.
    svn export http://emg.nysbc.org/svn/myami/trunk myami/
    
  4. do a fresh install the svn-less version
  5. ensure the proper revision is stored in appionlib/version.txt
  6. remove the version.txt file and ensure an exception is thrown.

You can follow the appion upgrade directions to install appion.

Actions #2

Updated by Amber Herold over 13 years ago

Tested, was not updating file for svn checkout due to logic error. Updated code for simplicity:

def getVersion():
    verfile = 'appionlib/version.txt'

    # Get the revision from any available svn file first
    version = getSubversionRevision()
    if version is not None:
        # write version to file
        f = open(verfile, "w")
        f.write("%s\n"%(version))
        f.close()
    else:
        # Check the version in version.txt
        if os.path.isfile(verfile):
            f = open(verfile, "r")
            line = f.readline()
            f.close()
            version = line.strip()

    if version is None:
        raise VersionError, "Could not find Appion version number while checking svn info and appionlib/version.txt." 

    return version

This changes the behavior a little. Instead of logging the version in distutils.core.setup() as r123245-r12346 in the case that there is an svn revision AND a revision stored in the text file, it will only log the svn revision (ex. r12346). I don't see an issue with this, let me know if you do.

This also needs to be merged to the 2.1 branch.

Actions #3

Updated by Amber Herold over 13 years ago

  • Status changed from Assigned to In Code Review
  • Assignee changed from Amber Herold to Anchi Cheng
Actions #4

Updated by Anchi Cheng over 13 years ago

  • Assignee changed from Anchi Cheng to Neil Voss

Neil,

Need to know from you if Amber's change is an issue. I don't see it but then I don't know if it has impact on what you planed to use it.

Actions #5

Updated by Neil Voss over 13 years ago

Please see Bug #469 for the version.txt file. This was my solution to have a 2.0, 2.1 version rather than just the subversion version.

Actions #6

Updated by Amber Herold over 13 years ago

Aha, so it looks like we always needed to put a version.txt file (with 2.x.x versions) into the release packages, but that bit never made it into the release process before. And it looks like we have some version functions in pyami as well as everywhere else :) Definitely need to do some consolidation if it is at all possible.

So, I'm thinking we can leave the version.txt file code as is, with my recent changes, but maybe there is a question about whether we should use 2.x.x versions for releases, or add the svn revision number to the file. Since we need to do it manually, it seems it would be just as easy to do either one. I like using the svn revision...not sure there is any specific benefit to it though.

Thoughts?

Actions #7

Updated by Neil Voss over 13 years ago

The svn revision is not enough, because it does not tell you which branch you are using. So, IIRC, the program grabs both the version.txt and svn revision and inserts them into the database. So, we know the branch and the last checkout. We did not have a version.txt in the trunk, because it did not have a version associated with it.

Actions #8

Updated by Amber Herold over 13 years ago

  • Assignee changed from Neil Voss to Amber Herold

OK. The web end does keep track of the version (2.x.x) in ProjectDefaultValues.xml, but I could see it being useful to have the value available on the python side as well. I'll go ahead and change the code to check for an svn revision and check version.txt and smash the two together. I'd still like to revisit the whole versioning issue though...there seems to be too much repeated code spread over multiple modules.

Actions #9

Updated by Amber Herold over 13 years ago

  • Assignee changed from Amber Herold to Anchi Cheng

Anchi, I reverted the code and added the version file to 2.1 branch. I tested by doing an svn export of the 2.1 branch and then running the setup script. I think it is good to go after you eyeball the changes. I can package the release and then to a complete installation of the package to make sure we are good.

Actions #10

Updated by Anchi Cheng over 13 years ago

  • Status changed from In Code Review to In Test
  • Assignee changed from Anchi Cheng to Amber Herold

Looks good. I also did a test installation on my Mac to see if the revision number shows up when I run an appion script.
If it is installed, it shows in ScriptProgramRun as '2.1.3' if it is not, it shows as '2.1.3-r15369'.

Actions #11

Updated by Amber Herold about 13 years ago

  • Status changed from In Test to Closed

Did a fresh install from posted 2.1.3 tar file. All good.

Actions

Also available in: Atom PDF