-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use common init.mk to match indigo/bigcode/infra
- Loading branch information
Showing
10 changed files
with
187 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
################################################################ | ||
# | ||
# Copyright 2013, Big Switch Networks, Inc. | ||
# | ||
# Licensed under the Eclipse Public License, Version 1.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
# either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the | ||
# License. | ||
# | ||
################################################################ | ||
|
||
# | ||
# The root of of our repository is here: | ||
# | ||
ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) | ||
|
||
# | ||
# Resolve submodule dependencies. | ||
# | ||
ifndef SUBMODULE_INFRA | ||
ifdef SUBMODULES | ||
SUBMODULE_INFRA := $(SUBMODULES)/infra | ||
else | ||
SUBMODULE_INFRA := $(ROOT)/submodules/infra | ||
SUBMODULES_LOCAL += infra | ||
endif | ||
endif | ||
|
||
ifndef SUBMODULE_BIGCODE | ||
ifdef SUBMODULES | ||
SUBMODULE_BIGCODE := $(SUBMODULES)/bigcode | ||
else | ||
SUBMODULE_BIGCODE := $(ROOT)/submodules/bigcode | ||
SUBMODULES_LOCAL += bigcode | ||
endif | ||
endif | ||
|
||
ifndef SUBMODULE_INDIGO | ||
ifdef SUBMODULES | ||
SUBMODULE_INDIGO := $(SUBMODULES)/indigo | ||
else | ||
SUBMODULE_INDIGO := $(ROOT)/submodules/indigo | ||
SUBMODULES_LOCAL += indigo | ||
endif | ||
endif | ||
|
||
ifndef SUBMODULE_LUAJIT2 | ||
ifdef SUBMODULES | ||
SUBMODULE_LUAJIT2 := $(SUBMODULES)/luajit-2.0 | ||
else | ||
SUBMODULE_LUAJIT2 := $(ROOT)/submodules/luajit-2.0 | ||
SUBMODULES_LOCAL += luajit2 | ||
endif | ||
endif | ||
|
||
ifdef SUBMODULES_LOCAL | ||
SUBMODULES_LOCAL_UPDATE := $(shell python $(ROOT)/submodules/init.py --update $(SUBMODULES_LOCAL)) | ||
ifneq ($(lastword $(SUBMODULES_LOCAL_UPDATE)),submodules:ok.) | ||
$(info Local submodule update failed.) | ||
$(info Result:) | ||
$(info $(SUBMODULES_LOCAL_UPDATE)) | ||
$(error Abort) | ||
endif | ||
endif | ||
|
||
export SUBMODULE_INFRA | ||
export SUBMODULE_BIGCODE | ||
export SUBMODULE_INDIGO | ||
export SUBMODULE_LUAJIT2 | ||
export BUILDER := $(SUBMODULE_INFRA)/builder/unix | ||
|
||
MODULE_DIRS := $(ROOT)/Modules \ | ||
$(SUBMODULE_INFRA)/modules \ | ||
$(SUBMODULE_BIGCODE)/modules \ | ||
$(SUBMODULE_INDIGO)/modules | ||
|
||
.show-submodules: | ||
@echo infra @ $(SUBMODULE_INFRA) | ||
@echo bigcode @ $(SUBMODULE_BIGCODE) | ||
@echo indigo @ $(SUBMODULE_INDIGO) | ||
@echo luajit2 @ $(SUBMODULE_LUAJIT2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/python | ||
################################################################ | ||
# | ||
# Copyright 2013, Big Switch Networks, Inc. | ||
# | ||
# Licensed under the Eclipse Public License, Version 1.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
# either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the | ||
# License. | ||
# | ||
################################################################ | ||
|
||
################################################################ | ||
# | ||
# This script updates all local submodules if they haven't | ||
# been initialized. | ||
# | ||
################################################################ | ||
import os | ||
import sys | ||
import subprocess | ||
import argparse | ||
|
||
ap = argparse.ArgumentParser(description="Submodule Management.") | ||
|
||
# | ||
# The root of the repository. | ||
# We assume by default that this script resides in | ||
# the $(ROOT)/submodules directory. | ||
# | ||
root_default = os.path.abspath("%s/../" % os.path.dirname(__file__)) | ||
|
||
ap.add_argument("--root", help="The root of the respository.", | ||
default=root_default) | ||
|
||
ap.add_argument("--update", help="Update the named submodules.", | ||
nargs='+', default=None, metavar='SUBMODULE') | ||
|
||
ap.add_argument("--list", help="List all submodules.", | ||
action='store_true') | ||
|
||
ops = ap.parse_args(); | ||
|
||
# Move to the root of the repository | ||
os.chdir(ops.root) | ||
|
||
# Get the status of all submodules | ||
submodule_status = {} | ||
try: | ||
for entry in subprocess.check_output(['git', 'submodule', 'status']).split("\n"): | ||
data = entry.split() | ||
if len(data) >= 2: | ||
submodule_status[data[1].replace("submodules/", "")] = data[0] | ||
except Exception as e: | ||
print repr(e) | ||
raise | ||
|
||
if ops.list: | ||
for (module, status) in submodule_status.iteritems(): | ||
print module | ||
|
||
if ops.update: | ||
for (module, status) in submodule_status.iteritems(): | ||
if module in ops.update or "all" in ops.update: | ||
if status[0] == '-': | ||
# This submodule has not yet been updated | ||
print "Updating submodule %s" % module | ||
if subprocess.check_call(['git', 'submodule', 'update', '--init', 'submodules/%s' % module]) != 0: | ||
print "git error updating module '%s'." % (module, switchlight_root, module) | ||
sys.exit(1) | ||
else: | ||
print "Submodule %s is already checked out." % module | ||
print "submodules:ok." | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.