Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Remove git submodule in favor of CMake commands #817

Merged
merged 11 commits into from Apr 21, 2014

Conversation

oxtopus
Copy link
Contributor

@oxtopus oxtopus commented Apr 15, 2014

Fixes #798.
Fixes #634.

Removed nta git submodule, replaced with CMake commands to manually clone, fetch, and checkout nupic.core repository. This also allows overriding the defaults on the command line via NUPIC_CORE_REMOTE, for the remote repository url, and NUPIC_CORE_COMMITISH, for the specific sha.

There are several advantages to this approach:

  1. No git submodules (nupic git repository is no longer explicitly coupled to git://github.com/numenta/nupic.core.git)
  2. CMakeLists.txt .nupic_modules is the ground truth for nupic.core version dependency
  3. User can override NUPIC_CORE_REMOTE and NUPIC_CORE_COMMITISH at-will, if they are not using the official nupic.core repository.
  4. Developer can make changes in nta/ and push to remote repository of their choosing

…lone,

fetch, and checkout nupic.core repository.  This also allows overriding the
defaults on the command line via NUPIC_CORE_REMOTE, for the remote repository
url, and NUPIC_CORE_COMMITISH, for the specific sha.
@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 15, 2014

Currently running through Numenta internal pipelines to understand impact.

@breznak
Copy link
Member

breznak commented Apr 15, 2014

👍 very nice! thanks @oxtopus

@oxtopus oxtopus changed the title Remove git submodule in favor of CMake control Remove git submodule in favor of CMake commands Apr 15, 2014
@utensil
Copy link
Member

utensil commented Apr 16, 2014

I've read the code in the PR, and realize that while I'm +1 for the idea to let CMake clone nupic and update to a specific commit based on something, but I would -1 for the something(direct set in CMakefile) used here, reasoning:

  • CMakefile is not in .gitignore, changing it for the purpose of building against an unstable development might be error-prone and cause dirty commit.

Here's my 2c:

  • CMake read something that commits into nupic to determine the default repo and SHA1
  • CMake read something optional that is in .gitignore, to determine an overwritten repo and SHA1

@breznak
Copy link
Member

breznak commented Apr 16, 2014

@utensil I think the point is that you can export the variables with new values (w/o changes to CMakeLists.txt) and thus change the behavior.

@oxtopus will those exported values be overridden every time I call cmake .. ? (so I need to export them again?)

@utensil
Copy link
Member

utensil commented Apr 16, 2014

@breznak I understand the use of env vars here, but it confuses me, because aren't we trying to reduce them?

Expand a little more:

  • default repo and SHA1 is better outside CMakeFile.txt, seperate it from CMake logics.
  • instead of using env vars, I prefer a config file to do so, because if I'm working with numenta/nupic, david-ragazzi/nupic and utensil/nupic, I may maintain different values of repo and SHA1 local to each fork .

@breznak
Copy link
Member

breznak commented Apr 16, 2014

instead of using env vars, I prefer a config file to do so, because if
I'm working with numenta/nupic, david-ragazzi/nupic and utensil/nupic, I may
maintain different values of repo and SHA1 local to each fork .

I see, this one would be nice feature. (would need a warning though,
because I can imagine the forgotten values there leading to weird errors)

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 16, 2014

My intention is not to use env variables, but instead allow the user to
override via CLI option. If this option allows for both, then I would
consider it a bonus!

I'm a total noob with CMake, so I'm open to suggestions.

On Wednesday, April 16, 2014, breznak notifications@github.com wrote:

instead of using env vars, I prefer a config file to do so, because if
I'm working with numenta/nupic, DavidRagazzi/nupic and utensil/nupic, I may
maintain different values of repo and SHA1 local to each fork .

I see, this one would be nice feature. (would need a warning though,
because I can imagine the forgotten values there leading to weird errors)


Reply to this email directly or view it on GitHubhttps://github.com//pull/817#issuecomment-40573808
.

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 16, 2014

To further clarify, the user need not modify CMakeLists.txt in order to test alternative forks or commits. The idea is the user would run cmake with additional option:

cmake -DNUPIC_CORE_COMMITISH:STRING=b2727fb8f8d38221f35038c638916702cd434e57 $NUPIC
cmake -DNUPIC_CORE_COMMITISH:STRING=HEAD $NUPIC
cmake -DNUPIC_CORE_COMMITISH:STRING=feature-branch $NUPIC
cmake -DNUPIC_CORE_COMMITISH:STRING=origin/master -DNUPIC_CORE_REMOTE:STRING=/some/arbitrary/url $NUPIC

When they're ready to push those changes upstream, then they modify CMakeLists.txt and submit a PR.

@utensil
Copy link
Member

utensil commented Apr 16, 2014

To further clarify, the user need not modify CMakeLists.txt in order to test alternative forks or commits. The idea is the user would run cmake with additional option

Despite of my preferences to config(which would reduce repetitive typing or using the upper arrow) stated above, this PR would definitely help and improve development productivity in a way I can also adapt to.

When they're ready to push those changes upstream, then they modify CMakeLists.txt and submit a PR.

Still, a separate file(other than CMakeLists.txt ) to specify nupic.core's commitish look more clear to me.

@david-ragazzi
Copy link
Contributor

The idea is the user would run cmake with additional option:

cmake -DNUPIC_CORE_COMMITISH:STRING=b2727fb8f8d38221f35038c638916702cd434e57 $NUPIC
cmake -DNUPIC_CORE_COMMITISH:STRING=HEAD $NUPIC
cmake -DNUPIC_CORE_COMMITISH:STRING=feature-branch $NUPIC
cmake -DNUPIC_CORE_COMMITISH:STRING=origin/master -DNUPIC_CORE_REMOTE:STRING=/some/arbitrary/url $NUPIC

+1

message(FATAL_ERROR "Unable to fetch ${NUPIC_CORE_REMOTE}")
endif()
endif()
execute_process(COMMAND git checkout ${NUPIC_CORE_COMMITISH}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider use a parameter variable like ${commitish} instead of ${NUPIC_CORE_COMMITISH}

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 16, 2014

@utensil Can you provide an example for how I might move the NUPIC_CORE_REMOTE and NUPIC_CORE_COMMITISH into a separate file?

Would you approve this PR as-is, assuming that we could follow up with the separate file idea in a different PR?

@utensil
Copy link
Member

utensil commented Apr 16, 2014

I'm OK with current PR as is, we may investigate the idea in another PR.

@breznak
Copy link
Member

breznak commented Apr 16, 2014

Would you approve this PR as-is, assuming that we could follow up with
the separate file idea in a different PR?

+100

# checkout git dependency
if (NOT EXISTS ${submodule_dir})
execute_process(COMMAND git clone ${remote} ${submodule_dir})
if(NOT EXIT_CODE EQUAL 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot add RESULT_VARIABLE EXIT_CODE option to execute_process command.. On the contrary, you will use a empty or wrong value..

Do this:

execute_process(COMMAND git clone ${remote} ${submodule_dir}
                RESULT_VARIABLE EXIT_CODE)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks!

@@ -1,3 +0,0 @@
[submodule "nupic.core"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this file in root yet? How about we delete it once (of course, if Travis get green with this removal)?

The less files the better! 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's empty, we should remove it. I just wasn't sure if it would cause problems so I left it empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's empty.. I don't see problems in remove it...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, bro! This PR is really useful!

@david-ragazzi
Copy link
Contributor

Ok, I merged as of 7d7a6fe. I had to manually resolve some conflicts, so you can close the PR.

Thanks! It already was closed.. hehe

@@ -29,6 +29,51 @@
### ###
############################################################################################################################

# This function read variables from a file in the following format:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: This function reads

@rhyolight
Copy link
Member

@oxtopus We seem to have a Travis problem. The last push did not trigger a Travis-CI build. The only way I know to trigger one is to push another commit.

Otherwise, 👍 Looks great!

@rhyolight rhyolight added this to the Sprint 20 milestone Apr 20, 2014
@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 20, 2014

I don't know what's up w/ travis and the reported status. https://travis-ci.org/oxtopus/nupic/builds/23225301, which is the latest commit in this branch is green, and #830 is green, which is a superset of this and only differs in Dockerfile, which wouldn't affect the travis build.

@rhyolight are there any implications on tooling wrt nupic and nupic.core assuming this is merged?

…ents, and

(hopefully) trigger another travis build to get the status green
@rhyolight
Copy link
Member

@oxtopus We are green and good to go. Before the final merge, are there any README changes that need to be made? Do we need to inform our current users of this at all?

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 21, 2014

@rhyolight Nothing needed in the README. I've played through a few scenarios of switching between different SHAs before and after without any problem. The required changes are encapsulated within the changeset, so it will apply cleanly. The only problems someone might encounter is if they were modifying nta/ inline and deviated from the instructions. In which case the merge will fail for them and they will have to resolve the conflict on their own.

I will send a heads up to nupic-hackers.

oxtopus added a commit that referenced this pull request Apr 21, 2014
Remove git submodule in favor of CMake commands
@oxtopus oxtopus merged commit 7689bc8 into numenta:master Apr 21, 2014
@rhyolight
Copy link
Member

@oxtopus Thanks. Any chance you could add a wiki page with instructions on how to create the appropriate local config files to customize the remote location and committish of nupic.core? If you make it, I'll link in in the appropriate places.

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 21, 2014

Sure thing.

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 21, 2014

@rhyolight
Copy link
Member

Beautiful, thanks.


Matt Taylor
OS Community Flag-Bearer
Numenta

On Mon, Apr 21, 2014 at 9:19 AM, Austin Marshall
notifications@github.comwrote:

@rhyolight https://github.com/rhyolight here you go:
https://github.com/numenta/nupic/wiki/nupic.core-dependencies

Reply to this email directly or view it on GitHubhttps://github.com//pull/817#issuecomment-40948467
.

@rhyolight
Copy link
Member

BTW, I changed the wiki name to "NuPIC's-Dependency-on-nupic.core" and
linked it from
https://github.com/numenta/nupic/wiki/Contributing-to-NuPIC#other-references(for
now).


Matt Taylor
OS Community Flag-Bearer
Numenta

On Mon, Apr 21, 2014 at 9:41 AM, Matthew Taylor matt@numenta.org wrote:

Beautiful, thanks.


Matt Taylor
OS Community Flag-Bearer
Numenta

On Mon, Apr 21, 2014 at 9:19 AM, Austin Marshall <notifications@github.com

wrote:

@rhyolight https://github.com/rhyolight here you go:
https://github.com/numenta/nupic/wiki/nupic.core-dependencies

Reply to this email directly or view it on GitHubhttps://github.com//pull/817#issuecomment-40948467
.

@utensil
Copy link
Member

utensil commented Apr 22, 2014

👍 for the work and the wiki . Really excellent and helpful, can't wait to test it.

@breznak
Copy link
Member

breznak commented Apr 22, 2014

KUDOs @oxtopus, this is great!

The build is rocking with my new neat settings for local devel:

Default nupic.core dependencies (override in optional .nupic_modules)

NUPIC_CORE_REMOTE = '/home/nupic/nupic.core'
NUPIC_CORE_COMMITISH = 'master/HEAD'

PS: nitpicks: I think it should be

  • (override in optional .nupic_modules)
  • (override in optional .nupic_config)

and .nupic_config should be in gitignore?

Thanks a lot! :)

@breznak
Copy link
Member

breznak commented Apr 22, 2014

  • one bug, it seems to generate makefiles in $NUPIC, not $NUPIC/build, or
    $PWD, as it should (?)

On Tue, Apr 22, 2014 at 8:28 PM, Marek Otahal markotahal@gmail.com wrote:

KUDOs @oxtopus, this is great!

The build is rocking with my new neat settings for local devel:

Default nupic.core dependencies (override in optional .nupic_modules)

NUPIC_CORE_REMOTE = '/home/nupic/nupic.core'
NUPIC_CORE_COMMITISH = 'master/HEAD'

PS: nitpicks: I think it should be

  • (override in optional .nupic_modules)
  • (override in optional .nupic_config)

and .nupic_config should be in gitignore?

Thanks a lot! :)

Marek Otahal :o)

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 23, 2014

@breznak Oops! You're right re: comment in .nupic_modules and overrides. Will follow up.

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 23, 2014

@breznak

Starting from a clean state:

$ find $NUPIC -name Makefile
/Users/amarshall/nta/nupic/lang/c#/Makefile
/Users/amarshall/nta/nupic/lang/java/Makefile

Then, after building:

$ find $NUPIC -name Makefile
/Users/amarshall/nta/nupic/build/scripts/Makefile
/Users/amarshall/nta/nupic/lang/c#/Makefile
/Users/amarshall/nta/nupic/lang/java/Makefile
/Users/amarshall/nta/nupic/nta/build/scripts/Makefile

Are you seeing something different?

@oxtopus oxtopus mentioned this pull request Apr 23, 2014
@chetan51
Copy link
Contributor

Hmm, I tried putting a .nupic_config file in my NuPIC directory, and in my home directory, but it seems to have no effect. Am I doing something wrong?

@chetan51
Copy link
Contributor

Reading the CMakeLists.txt file, it looks like the .nupic_config file isn't really considered. Can someone confirm this?

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 24, 2014

I think you're right. Only place the function is used is https://github.com/numenta/nupic/blob/master/CMakeLists.txt#L600

How'd we miss that?

@oxtopus
Copy link
Contributor Author

oxtopus commented Apr 24, 2014

See #849 for possible fix. Works for me, at least.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
7 participants