CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Maintaining a local git repository from a source tarball

Register Blogs Community New Posts Updated Threads Search

Rate this Entry

Maintaining a local git repository from a source tarball

Posted December 12, 2010 at 10:06 by wyldckat
Updated December 12, 2010 at 11:56 by wyldckat

Here is the scenario: You need the latest OpenFOAM 1.7.x git version, but your Linux machine is stranded on a deserted lab without access to the internet or to any other machine that does have access to the internet. The only machine with internet access that you have access to, is on some other place in the world and on top of that, uses Windows for an operating system. And you think to yourself: "I'm doomed... so very doomed... "
Fear not, because:
Quote:
Originally Posted by Pauline Kael
Where there is a will, there is a way. If there is a chance in a million that you can do something, anything, to keep what you want from ending, do it. Pry the door open or, if need be, wedge your foot in that door and keep it open.
Although, you might want to have a metal plate in the end of your shoe

NOTE: Mark Olsen has already something very similar some time ago here: OpenFOAM 1.7.x git problem - post #15. But it requires that you are already using a Linux machine for getting the repository, where you would have a strange issue with the firewall+github.

These instructions are for a tarball based git repository of OpenFOAM 1.7.x - here's what you can do:
  1. Download the source tarball in tar.gz format: it's this link here
    This is a snapshot of the latest commit into the OpenFOAM 1.7.x git version. This will be completely stripped of the git history of the commits, since it's just a snapshot of the file tree of the latest commit.
  2. Copy the tarball to your Linux system.
  3. Create a folder for source development, where you will keep a clean version of your local git repository. For example: "$HOME/OpenFOAM-git"
  4. Unpack the tarball in that folder. In my case, I ran:
    Code:
    tar -xzf OpenCFD-OpenFOAM-1.7.x-version-1.7.1-167-gc7eaf52.tar.gz
    It will probably create a long name, like it did for me: "OpenCFD-OpenFOAM-1.7.x-version-1.7.1-167-gc7eaf52"
    ... so, rename it to OpenFOAM-1.7.x:
    Code:
    mv OpenCFD-OpenFOAM-1.7.x-version-1.7.1-167-gc7eaf52 OpenFOAM-1.7.x
    By the way, "c7eaf52" is the first part of the commit's unique identifier, which you can then compare online in github.
  5. Now, cd into that folder and run:
    Code:
    git init
    git add .
    git commit
    It will open nano or some other terminal based text editor and it will ask you to write in the message for this commit. I've written:
    Code:
    Source: OpenCFD-OpenFOAM-1.7.x-version-1.7.1-167-gc7eaf52.tar.gz
    Save and exit. It will commit your new commit into git history.
    And voilá, your local git repository is now ready to be used.
  6. Now, go to your folder where you will use OpenFOAM for building and working with it, e.g.: $HOME/OpenFOAM
  7. Run:
    Code:
    git clone $HOME/OpenFOAM-git/OpenFOAM-1.7.x OpenFOAM-1.7.x
    And there you go, you've got your own local git clone to work with. The rest is just as it is explained in www.openfoam.com.
OK, now when you want to update your local repository:
  1. Same as point 1 of the previous list.
  2. Same as point 2 of the previous list.
  3. Got to your local repository:
    Code:
    cd $HOME/OpenFOAM-git/OpenFOAM-1.7.x
  4. Unpack the new tarball like this:
    Code:
    tar --strip 1 -xzf ../OpenCFD-OpenFOAM-1.7.x-version-1.7.1-167-gc7eaf52.tar.gz
    This way "--strip 1" will make it unpack without the base long named folder "OpenCFD-OpenFOAM-1.7.x-version-1.7.1-167-gc7eaf52".
  5. Run:
    Code:
    git add .
    git commit
    Again, it will ask for the commit message, to which you can write the name of the source tarball, just like in point 5 in the previous list.
  6. Now, go into your working folder:
    Code:
    cd $HOME/OpenFOAM/OpenFOAM-1.7.x
  7. Run:
    Code:
    git pull
    And there you go, the code is up to date. You can now run Allwmake to rebuild the changed libraries and applications.
I had this idea a while back, but it's good to write it down, since sooner or later, me or someone else will need it
Any other questions about git, read the tutorials and learn:
Best regards,
Bruno

References:
« Prev     Main     Next »
Total Comments 0

Comments

 

All times are GMT -4. The time now is 10:31.