CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Update 1.7.x from local source (http://www.cfd-online.com/Forums/openfoam-installation/82796-update-1-7-x-local-source.html)

SD@TUB December 6, 2010 06:23

Update 1.7.x from local source
 
Hello FOAMers,

i need an advice for the following issue...
I'll have to administrating some PC's using OpenFOAM without any connection to the internet (at present and in future). But i don't want to miss the update features of 1.*.x-Versions!
What would be the smartest procedure of getting OpenFOAM up-to-date from local source?
I guess https://github.com/OpenCFD/OpenFOAM-...rchives/master is one option where i can download the very latest git repository of the present 1.7.x-Version. But afterwards i'm not sure how to proceed with 'git' using a local device as source!

Thanks in advance for sharing your expertise,
/Stefan

akidess December 6, 2010 08:45

Instead of "git pull http://xxx" you should be able to use "git pull user@xxx:/", which pulls the changes from your local copy.

olesen December 7, 2010 03:18

Quote:

Originally Posted by akidess (Post 286193)
Instead of "git pull http://xxx" you should be able to use "git pull user@xxx:/", which pulls the changes from your local copy.

Except that I would generally advocate creating a separate branch instead of working on 'master' -- see http://olesenm.github.com/2009/11/12...nFOAM-and-git/ for more infomation.

SD@TUB December 10, 2010 06:50

Thanks Anton and Mark for your hints!
It is seemingly advantageous to get familiar with git, avoiding problems due to administrating.
But nevertheless, i'm insecure to get the right start-up. When I download the latest status from https://github.com/OpenCFD/OpenFOAM-1.7.x und extract the archive, it seems not compatible with getting a clone via
Code:

git clone
. I tried to change the ending from *1.7.x to *1.7.x.git, but that doesn't help unsurprisingly. And initializing the extracted directory via
Code:

git init
is not the setup i'm looking for, right?

Maybe another advice will help me to get the right start-up in that case!
/Stefan

wyldckat December 11, 2010 08:47

Greetings Stefan,

Given the limited information you gave us, there are three possible scenarios:
  1. You have one machine with Windows and internet access, while the other one is a Linux machine who is disconnected from both the internet and the Windows machine.
  2. Both machines have Linux and git; the one with no internet can access the other one via intranet.
  3. Both machines have Linux and git, but the only way of data transfer is through CD/DVD or USB drive.
So, the short and extreme solutions for each scenario are:
  1. Forget git. Download the gziped tarball from github once in a while, unpack it on the second machine and overwrite the current files. I think there is an option in tar to unpack only the newest files.
  2. This scenario is what Anton and Mark were talking about. For this, read Mark's blog post and the official git tutorial.
  3. This scenario still requires that you read the tutorials from the previous scenario. But in this case, you'll have to read these examples. I got to these examples from the bullet points near the end of the git tutorial:
    Quote:

    Originally Posted by http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
    git-format-patch(1), git-am(1): These convert series of git commits into emailed patches, and vice versa, useful for projects such as the Linux kernel which rely heavily on emailed patches.

    In other words, you'll be emailing to yourself ;)
So there you go, read and learn ;) Otherwise, we can't help you much more, since we don't know in which scenario you are.

Best regards,
Bruno

SD@TUB December 12, 2010 07:42

Hello Bruno,

the first scenario was the right guess! So working with the tarball exclusively is a practical way at the very least.
Finally, just to unterstand in depth. The downloadable archive from https://github.com/OpenCFD/OpenFOAM-1.7.x is a (git) clone from the master repository itself? Creating a separate branch such as Mark suggested wouldn't be possible at all?

/Stefan

wyldckat December 12, 2010 09:32

Hi Stefan,

Mmm, do you also want to keep a track of the changes in the main git tree?
  • If you do, the only way is to install a Virtual Machine with some Linux distribution installed in it; this VM would be installed in your Windows machine and would be for keeping track of changes only!
    edit: Maintaining a local git repository on a portable disk image file or partition
  • If you don't need to, but if you still need to keep track of the versions you have downloaded, then after the break, are a few instructions on what you can do.
____________________

OK, this is for a tarball based git repository - 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

PS: I've posted these instructions in my blog here in cfd-online, just in case I need to update the instructions in the future: Maintaining a local git repository from a source tarball

SD@TUB December 13, 2010 05:04

Thanks a lot Bruno for this instruction! This will help me to proceed with my setup and i'll not have to miss the features of git.

Best Regards,
/Stefan

P.S. I'm learning by doing ;)


All times are GMT -4. The time now is 16:48.