Skip to content

Transfer to new a directory structure

DStrelak edited this page Jul 26, 2019 · 8 revisions

New directory structure

With the pull request 169, we have changed the directory structure of the Xmipp repository.

Why?

We want to simplify the installation and allow external tools to analyze our code.

It will also allow you to use git directly from the root directory.

What has changed?

We moved majority of the repository files from the root directory to the src/xmipp directory. Commit 543c48a shows the repository with the original layout:

.  
├── applications/  
├── bindings/  
├── CHANGELOG.md  
├── external/    
├── install/   
├── libraries/  
├── LICENSE  
├── README.md  
├── resources/  
├── SConscript  
├── SConstruct  
├── scripts/  
├── sonar-project.properties  
├── tar.py  
├── tests/  
└── xmipp  

Layout after the change:

.  
├── CHANGELOG.md  
├── LICENSE  
├── README.md  
├── scripts/  
├── sonar-project.properties  
├── src/  
│   └── xmipp/
│       ├── applications/  
│       ├── ...   
│       └── tests/  
└── xmipp

What does it mean for me as a user?

We recommend you to remove the current installation and replace it with a new version:

  • In Scipion: Nothing to do. Just update the plugin version and the binaries when available.
  • In Standalone: remove entire Xmipp folder, clone the repository again and run xmipp script in the root

What does it mean for me as a developer?

To avoid possible issues, we recommend you to move entire Xmipp folder to a backup directory, clone the repository again and run xmipp script in the root.

cd
mv xmipp-bundle xmipp-bundle-BCKP
git clone https://github.com/I2PC/xmipp xmipp-bundle

In case you have an existing branch (with old directory structure), you might experience merge conflict while creating a PR to the new directory structure.

We recommend you to create a patch, manually alter the paths to the files (with accordance to the new repository layout), and apply the patch in the new repository, as described here

git clone -b devel https://github.com/I2PC/xmipp.git new_repo
cd new_repo
git checkout your_old_branch
git diff devel...your_old_branch > patch.txt

Now, in the patch.txt you will have a git diff with only your changes. Open the file with the text editor of your preference. Each patch starts with a header like this:

diff --git a/applications/programs/my_new_program/my_new_program.cpp b/applications/programs/my_new_program/my_new_program.cpp
new file mode 100644
index 0000000..8fcef13
--- /dev/null
+++ b/applications/programs/my_new_program/my_new_program.cpp

Change the file name where appropriate (the file names starts with a/ and b/):

diff --git a_/applications/programs/my_new_program/my_program.cpp_ b_/applications/programs/my_new_program/my_program.cpp_
->
diff --git a/src/xmipp/applications/programs/my_new_program/my_program.cpp b/src/xmipp/applications/programs/my_new_program/my_program.cpp

(replace all 'a/path_to_file' and 'b/path_to_file' with 'a/src/xmipp/path_to_file' and 'b/src/xmipp/path_to_file')

Save the patch, and apply it to new repo layout:

git checkout devel
git pull
git checkout -b your_new_branch_with_new_layout
git apply patch.txt

Make sure that any deleted / newly created file is in the proper location before committing.

If none of this works, please contact us at [email protected]