commit 97e1650760733cd74d89be3ea3234ef3c9c57fb0 Author: Monty Taylor Date: Sat Oct 29 11:05:08 2016 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81f7027 --- /dev/null +++ b/.gitignore @@ -0,0 +1,89 @@ +*.py[cod] + +# C extensions +*.so + +# C++ proto files +*.pb.cc +*.pb.h + +# Python protos +*pb2.py + +# autotools +Makefile +config.h +config.log +config.status +libtool +stamp-h1 +Makefile.in +aclocal.m4 +autom4te.cache/ +config.h.in +config/ +configure +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +.deps +*.la +*.lo +*.o +.dirstamp +.libs + +# Packages +*.egg +*.egg-info +dist +build +.eggs +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +.testrepository +.venv + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +doc/build + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp +.*sw? + +# Protobuf Generated Files +oaktree/rpc/*_pb2.py diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..41ff332 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/oaktreemodel.git diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..516ae6f --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# Format is: +# +# diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000..6d83b3c --- /dev/null +++ b/.testr.conf @@ -0,0 +1,7 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..296caf6 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,17 @@ +If you would like to contribute to the development of OpenStack, you must +follow the steps in this page: + + http://docs.openstack.org/infra/manual/developers.html + +If you already have a good understanding of how the system works and your +OpenStack accounts are set up, you can skip to the development workflow +section of this documentation to learn how changes to OpenStack should be +submitted for review via the Gerrit tool: + + http://docs.openstack.org/infra/manual/developers.html#development-workflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed in Storyboard, not GitHub: + + https://storyboard.openstack.org diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..68c771a --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..9aa8813 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,8 @@ +include AUTHORS +include ChangeLog +include oaktreemodel/*pb2.py +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc +global-exclude *.go diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..443c3d9 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,142 @@ +# Copyright (c) 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +# +# 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. + +ACLOCAL_AMFLAGS = -I m4 + +SUFFIXES = +lib_LTLIBRARIES = liboaktreemodel.la +noinst_LTLIBRARIES = + +SUBDIRS= . + +DIST_SUBDIRS = ${SUBDIRS} + +BUILT_SOURCES= +BUILT_MAINT_SRC= +EXTRA_DIST= \ + ChangeLog \ + config/pandora_vc_revinfo \ + ${top_srcdir}/m4/*m4 + +CLEANFILES= ${BUILT_SOURCES} +DISTCLEANFILES= config/top.h + +MAINTAINERCLEANFILES= +MAINTAINERCLEANFILES+= autom4te.cache +MAINTAINERCLEANFILES+= ChangeLog + +maintainer-clean-local: + find . -type f -name '*~' -exec rm -f '{}' \; + -rm -rf @PACKAGE@-*.rpm + -rm -rf @PACKAGE@-*.tar.gz + -rm -r -f autom4te.cache + -rm -f Makefile.in + -rm -f aclocal.m4 + -rm -f config/config.guess + -rm -f config/config.sub + -rm -f config/depcomp + -rm -f config/install-sh + -rm -f config/ltmain.sh + -rm -f config/missing + -rm -f config.in + -rm -f config.log + -rm -f config.status + -rm -f configure + -rm -f m4/libtool.m4 + -rm -f m4/ltoptions.m4 + -rm -f m4/ltsugar.m4 + -rm -f m4/ltversion.m4 + -rm -f m4/lt~obsolete.m4 + + +liboaktreemodel_la_CXXFLAGS = ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS} ${NO_WERROR} +liboaktreemodel_la_SOURCES = \ + oaktreemodel/common.pb.cc \ + oaktreemodel/flavor.pb.cc \ + oaktreemodel/image.pb.cc \ + oaktreemodel/security_group.pb.cc \ + oaktreemodel/oaktree.pb.cc \ + oaktreemodel/oaktree.grpc.pb.cc + +pkginclude_HEADERS = \ + oaktreemodel/common.pb.h \ + oaktreemodel/flavor.pb.h \ + oaktreemodel/image.pb.h \ + oaktreemodel/security_group.pb.h \ + oaktreemodel/oaktree.pb.h \ + oaktreemodel/oaktree.grpc.pb.h + +# TODO: There is a lot of repetition here +BUILT_SOURCES += \ + oaktreemodel/common.pb.cc \ + oaktreemodel/common.pb.h \ + oaktreemodel/common_pb2.py \ + oaktreemodel/flavor.pb.cc \ + oaktreemodel/flavor.pb.h \ + oaktreemodel/flavor_pb2.py \ + oaktreemodel/image.pb.cc \ + oaktreemodel/image.pb.h \ + oaktreemodel/image_pb2.py \ + oaktreemodel/oaktree.grpc.pb.cc \ + oaktreemodel/oaktree.grpc.pb.h \ + oaktreemodel/oaktree.pb.cc \ + oaktreemodel/oaktree.pb.h \ + oaktreemodel/oaktree_pb2.py \ + oaktreemodel/security_group.pb.cc \ + oaktreemodel/security_group.pb.h \ + oaktreemodel/security_group_pb2.py + +if HAVE_GO_PLUGIN +BUILT_SOURCES += \ + oaktreemodel/common.pb.go \ + oaktreemodel/flavor.pb.go \ + oaktreemodel/image.pb.go \ + oaktreemodel/oaktree.pb.go \ + oaktreemodel/security_group.pb.go +endif + +EXTRA_DIST += \ + oaktreemodel/common.proto \ + oaktreemodel/flavor.proto \ + oaktreemodel/image.proto \ + oaktreemodel/security_group.proto \ + oaktreemodel/oaktree.proto + +SUFFIXES += .proto .grpc.pb.cc .pb.cc .pb.h py .pb.go +PROTOS_PATH=${top_srcdir}/oaktreemodel +PROTO_OUTPUT=${top_builddir}/oaktreemodel +.proto.grpc.pb.cc: + $(PROTOC) -I $(PROTOS_PATH) \ + --grpc_out=${PROTO_OUTPUT} \ + --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} $< +.proto.grpc.pb.h: + $(PROTOC) -I $(PROTOS_PATH) \ + --grpc_out=${PROTO_OUTPUT} \ + --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} $< +.proto.pb.cc: + $(PROTOC) -I $(PROTOS_PATH) --cpp_out=${PROTO_OUTPUT} $< + $(PROTOC) -I $(PROTOS_PATH) --go_out=${PROTO_OUTPUT} $< +.proto.pb.h: + $(PROTOC) -I $(PROTOS_PATH) --cpp_out=${PROTO_OUTPUT} $< + +.proto.pb.go: + $(PROTOC) -I $(PROTOS_PATH) --go_out=${PROTO_OUTPUT} $< + +# Have to do this with make matching not automake matching +# Yay _pb2.py extension! +%_pb2.py: %.proto + python -m grpc.tools.protoc -I $(PROTOS_PATH) \ + --python_out=${PROTO_OUTPUT} \ + --grpc_python_out=${PROTO_OUTPUT} $< diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..147e6ac --- /dev/null +++ b/README.rst @@ -0,0 +1,85 @@ +============ +oaktreemodel +============ + +oaktree is a gRPC interface for interacting with OpenStack clouds that is +inherently interoperable and multi-cloud aware. + +oaktreemodel is the protobuf definitions and the libraries and/or code +generated from that to make it possible for people of all languages to +interact with the gRPC system without developing a python dependency anywhere. + +At start, go, C++ and python are supported. + +With go, the generated files are checked in to the git repo, because that's +how go dependencies work. + +With C++ and python, they are not, as we exepct the unit of consumption to +be a built library and header files for C++ or a PyPI package for Ruby. It's +the most likely that as we add structure for more languages that they will +follow the C++/Python approach and not the go approach - but the decision +will be made on a per-language basis and reported back here. + +Note on API compat +------------------ + +tl;dr - Upgrading oaktree should NEVER negatively impact end users. + +Until a 1.0.0 release is cut, please consider that literally everything in +this repo can change with no notice or consideration of breaking backwards +compat. This is a new approach to several things and it's entirely likely +we're going to get things wrong a few times. + +Post 1.0.0 oaktree and oaktreemodel will be held to the same backwards-compat +promises as shade itself. That is - there will never be backwards-compat +breaking release, and it should _always_ be safe to deploy the latest release +in production. In fact, even for people running older stable releases of +OpenStack, the recommendation will be to run the latest oaktree, so that the +latest cross-compatibility changes can be picked up. + +Note on Implementations +----------------------- + +It is absolutely the intent of oaktreemodel that multiple implementations +based on the protobuf descriptions exist for the client interaction. In fact, +the code generated and published from this repo is fairly low-leve on a gRPC +basis, so it's almost certainly the case that each language will want to +consume this code in the context of some other library that has an end-user +focused UI. + +It is absolutely NOT the intent that multiple implementations of the server +side exist. + +The reason for that is that, at least as of now, the business logic in the +shade library is extensive and complex. It handles a million corner cases in +the underlying clouds. oaktree servers should all be able to talk not just +to the cloud they are deployed with, but also to other OpenStack clouds +either talking to the remote oaktree or directly to the remote OpenStack API. + +The client interfaces in gRPC should be considered to be comprehensive and +as descriptive of the interface as possible. For people wanting an oaktree +server, please use actual oaktree. + +Building +-------- + +First you need some dependencies: + +.. code-block:: bash + + pip install bindep + apt-get install $(bindep -b) + pip install -f requirements.txt + pip install grpcio-tools + go get -u github.com/golang/protobuf/protoc-gen-go + +Then you can build the code: + +.. code-block:: bash + + autoreconf -fi + ./configure + make + +* Source: http://git.openstack.org/cgit/openstack/oaktreemodel +* Bugs: http://storyboard.openstack.org diff --git a/TODO b/TODO new file mode 100644 index 0000000..9204e59 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +Get the vc_version stuff working properly with git diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..fdfa7df --- /dev/null +++ b/bindep.txt @@ -0,0 +1,7 @@ +libprotobuf-dev +protobuf-compiler +pkg-config +build-essential +autoconf +libtool +golang-go diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..5a14fe6 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Copyright (c) 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +# +# 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. + +autoreconf -fi diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..4c785b2 --- /dev/null +++ b/build.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Copyright (c) 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +# +# 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. + +if [ ! -f configure ]; then + autoreconf -fi +fi +if [ ! -f Makefile ]; then + ./configure +fi +make diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..1ccaaba --- /dev/null +++ b/configure.ac @@ -0,0 +1,142 @@ +dnl -*- bash -*- +dnl Process this file with autoconf to produce a configure script. + +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; version 2 of the License. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +AC_INIT( + [liboaktreemodel], + [1.0], + [http://storyboard.openstack.org], + [liboaktreemodel], + [http://openstack.org/]) + +AC_CONFIG_AUX_DIR([config]) + +AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar]) +AC_PREREQ(2.59)dnl Minimum Autoconf version required. + +AC_CANONICAL_HOST +AC_CANONICAL_BUILD +AC_ARG_PROGRAM +AC_USE_SYSTEM_EXTENSIONS + +AC_CONFIG_MACRO_DIR([m4]) + +AC_CONFIG_HEADERS([config.h]) + +AC_CONFIG_SRCDIR([oaktreemodel/oaktree.proto]) + +OAKTREE_CANONICAL_TARGET([require-cxx, version-from-vc]) + +LT_PREREQ([2.4]) +LT_INIT +LT_LANG([C++]) + + +gl_VISIBILITY +AX_ASSERT + + +AS_IF([test "x${pandora_cv_skip_requires}" != "xno"],[ + + AC_ARG_WITH([comment], + [AS_HELP_STRING([--with-comment], + [Comment about compilation environment. @<:@default=off@:>@])], + [with_comment=$withval], + [with_comment=no]) + AS_IF([test "$with_comment" != "no"],[ + COMPILATION_COMMENT=$with_comment + ],[ + COMPILATION_COMMENT="Source distribution (${PANDORA_RELEASE_COMMENT})" + ]) + AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"], + [Comment about compilation environment]) +]) + + +PKG_CHECK_MODULES(PROTOBUF, protobuf >= 2.4.0) +AC_SUBST(PROTOBUF_LIBS) +AC_SUBST(PROTOBUF_CFLAGS) +AC_SUBST(PROTOBUF_VERSION) +AM_CFLAGS="${PROTOBUF_CFLAGS} ${AM_CFLAGS}" +AM_LDFLAGS="${PROTOBUF_LIBS} ${AM_LDFLAGS}" + +AC_PATH_PROG( + [PROTOC], + [protoc], + [AC_MSG_ERROR([oaktreemodel requires protobuf])], +) + +AC_PATH_PROG( + [GRPC_CPP_PLUGIN], + [grpc_cpp_plugin], + [AC_MSG_ERROR([oaktreemodel requires grpc_cpp_plugin])], +) + +AC_PATH_PROG( + [GRPC_PYTHON_PLUGIN], + [grpc_python_plugin], + [AC_MSG_ERROR([oaktreemodel requires grpc_python_plugin])], +) + +AC_PATH_PROG( + [GRPC_GO_PLUGIN], + [protoc-gen-go]) + +AM_CONDITIONAL([HAVE_GO_PLUGIN], [test "x$ac_cv_path_GRPC_GO_PLUGIN" != "x"]) + +AX_PTHREAD([ + AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}" + AM_LDFLAGS="${PTHREAD_LIBS} ${AM_LDFLAGS}" + LIBS="${PTHREAD_LIBS} ${LIBS}" + ], [AC_MSG_ERROR([oaktreemodel requires pthreads])]) + +######################################################################### + +AS_IF([test "$lt_cv_prog_gnu_ld" = "yes"],[ + LDFLAGS="${LDFLAGS} ${LD_VERSION_SCRIPT}" + ]) + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT + +echo "---" +echo "Configuration summary for $PACKAGE_NAME version $VERSION" +echo "" +echo " * Installation prefix: $prefix" +echo " * System type: $host_vendor-$host_os" +echo " * Host CPU: $host_cpu" +echo " * C++ Compiler: $CXX_VERSION" +echo " * C++ Flags: $CXXFLAGS" +echo " * C++ AM Flags: $AM_CXXFLAGS" +echo " * CPP Flags: $CPPFLAGS" +echo " * CPP AM Flags: $AM_CPPFLAGS" +echo " * Assertions enabled: $ac_cv_assert" +echo " * Debug enabled: $with_debug" +echo " * Profiling enabled: $ac_profiling" +echo " * Coverage enabled: $ac_coverage" +echo " * Warnings as failure: $ac_cv_warnings_as_errors" +echo "" +echo "---" + +dnl libtoolize scans configure.ac and needs to see some text +m4_define([LIBTOOLIZE_AC_INIT], []) +m4_define([UNUSED_MACRO], [ + LT_INIT + AC_CONFIG_MACRO_DIR([m4]) +]) diff --git a/m4/ax_assert.m4 b/m4/ax_assert.m4 new file mode 100644 index 0000000..8874129 --- /dev/null +++ b/m4/ax_assert.m4 @@ -0,0 +1,66 @@ +# =========================================================================== +# https://github.com/BrianAker/ddm4/ +# =========================================================================== +# +# SYNOPSIS +# +# AX_ASSERT() +# +# DESCRIPTION +# +# --enable-assert +# +# LICENSE +# +# Copyright (C) 2012 Brian Aker +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# * The names of its contributors may not be used to endorse or +# promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#serial 6 + +AC_DEFUN([AX_ASSERT], + [AC_PREREQ([2.63])dnl + AC_REQUIRE([AX_DEBUG]) + AC_REQUIRE([AX_VCS_CHECKOUT]) + AC_ARG_ENABLE([assert], + [AS_HELP_STRING([--enable-assert], + [Enable assert, this will be overridden by --enable-debug (yes|no) @<:@default=no@:>@])], + [ax_enable_assert=yes], + [ax_enable_assert=no]) + + AS_IF([ test "$ax_enable_assert" = "yes" -o "$ax_enable_debug" = "yes" -o "$ac_cv_vcs_checkout" = "yes" ], + [ax_enable_assert="yes"], + [ax_enable_assert="no" + AC_DEFINE(NDEBUG,[1],[Define to 1 to disable assert'ing code.])]) + + AC_MSG_CHECKING([for assert]) + AC_MSG_RESULT([$ax_enable_assert]) + ]) + diff --git a/m4/ax_debug.m4 b/m4/ax_debug.m4 new file mode 100644 index 0000000..8c4da66 --- /dev/null +++ b/m4/ax_debug.m4 @@ -0,0 +1,61 @@ +# =========================================================================== +# https://github.com/BrianAker/ddm4/ +# =========================================================================== +# +# SYNOPSIS +# +# AX_DEBUG() +# +# DESCRIPTION +# +# --enable-debug +# +# LICENSE +# +# Copyright (C) 2012 Brian Aker +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# * The names of its contributors may not be used to endorse or +# promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#serial 5 + +AC_DEFUN([AX_DEBUG], + [AC_PREREQ([2.63])dnl + AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], + [ax_enable_debug=yes + AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])], + [ax_enable_debug=no + AC_SUBST([MCHECK]) + AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) + + AC_MSG_CHECKING([for debug]) + AC_MSG_RESULT([$ax_enable_debug]) + AM_CONDITIONAL([DEBUG],[test "x${ax_enable_debug}" = "xyes"])]) diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 new file mode 100644 index 0000000..71b932e --- /dev/null +++ b/m4/ax_pthread.m4 @@ -0,0 +1,313 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 19 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) + AC_MSG_RESULT($ax_pthread_ok) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case ${host_os} in + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin12*) + ax_pthread_flags="$ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($ax_pthread_ok) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/m4/ax_vcs_checkout.m4 b/m4/ax_vcs_checkout.m4 new file mode 100644 index 0000000..8047b65 --- /dev/null +++ b/m4/ax_vcs_checkout.m4 @@ -0,0 +1,75 @@ +# =========================================================================== +# http:// +# =========================================================================== +# +# SYNOPSIS +# +# AX_VCS_CHECKOUT +# +# DESCRIPTION +# +# Discover whether or not we are operating with a tree which +# has been checked out of a version control system. +# +# +# LICENSE +# +# Copyright (C) 2012 Brian Aker +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# * The names of its contributors may not be used to endorse or +# promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#serial 6 + +AC_DEFUN([AX_VCS_SYSTEM], + [AC_PREREQ([2.63])dnl + AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system], + [ac_cv_vcs_system="none" + AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"]) + AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"]) + AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"]) + AS_IF([test -d ".git"],[ac_cv_vcs_system="git"]) + ]) + AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system]) + ]) + +AC_DEFUN([AX_VCS_CHECKOUT], + [AC_PREREQ([2.63])dnl + AC_REQUIRE([AX_VCS_SYSTEM]) + AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout], + [AS_IF([test "x$ac_cv_vcs_system" != "xnone"], + [ac_cv_vcs_checkout=yes], + [ac_cv_vcs_checkout=no]) + ]) + + AM_CONDITIONAL([IS_VCS_CHECKOUT],[test "x$ac_cv_vcs_checkout" = "xyes"]) + AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"], + [AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])], + [AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])]) + ]) diff --git a/m4/oaktree_canonical.m4 b/m4/oaktree_canonical.m4 new file mode 100644 index 0000000..0866998 --- /dev/null +++ b/m4/oaktree_canonical.m4 @@ -0,0 +1,91 @@ +# Copyright (C) 2009 Sun Microsystems, Inc. +# This file is free software; Sun Microsystems, Inc. +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Which version of the canonical setup we're using +AC_DEFUN([OAKTREE_CANONICAL_VERSION],[0.175]) + +AC_DEFUN([OAKTREE_CANONICAL_TARGET],[ + ifdef([m4_define],,[define([m4_define], defn([define]))]) + ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))]) + m4_define([PCT_ALL_ARGS],[$*]) + m4_define([PCT_REQUIRE_CXX],[no]) + m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no]) + m4_define([PCT_NO_VC_CHANGELOG],[no]) + m4_define([PCT_VERSION_FROM_VC],[no]) + m4_define([PCT_USE_VISIBILITY],[yes]) + m4_foreach([pct_arg],[$*],[ + m4_case(pct_arg, + [require-cxx], [ + m4_undefine([PCT_REQUIRE_CXX]) + m4_define([PCT_REQUIRE_CXX],[yes]) + ], + [skip-visibility], [ + m4_undefine([PCT_USE_VISIBILITY]) + m4_define([PCT_USE_VISIBILITY],[no]) + ], + [dont-suppress-include], [ + m4_undefine([PCT_DONT_SUPPRESS_INCLUDE]) + m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes]) + ], + [no-vc-changelog], [ + m4_undefine([PCT_NO_VC_CHANGELOG]) + m4_define([PCT_NO_VC_CHANGELOG],[yes]) + ], + [version-from-vc], [ + m4_undefine([PCT_VERSION_FROM_VC]) + m4_define([PCT_VERSION_FROM_VC],[yes]) + ]) + ]) + + # We need to prevent canonical target + # from injecting -O2 into CFLAGS - but we won't modify anything if we have + # set CFLAGS on the command line, since that should take ultimate precedence + AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"], + [CFLAGS=""]) + AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], + [CXXFLAGS=""]) + + m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + + AC_REQUIRE([AC_PROG_CC]) + + m4_if(PCT_NO_VC_CHANGELOG,yes,[ + vc_changelog=no + ],[ + vc_changelog=yes + ]) + m4_if(PCT_VERSION_FROM_VC,yes,[ + PANDORA_VC_INFO_HEADER + ],[ + PANDORA_TEST_VC_DIR + + AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["$VERSION"], + [Version of the software]) + + AC_SUBST(PANDORA_RELEASE_VERSION) + ]) + + AC_REQUIRE([AC_PROG_CXX]) + AM_PROG_CC_C_O + + PANDORA_OPTIMIZE + + PANDORA_HEADER_ASSERT + + # Enable PANDORA_WARNINGS once there is C++ code that's not generated, if + # that's ever a time + dnl PANDORA_WARNINGS(PCT_ALL_ARGS) + + PANDORA_ENABLE_DTRACE + + AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" + AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" + + AC_SUBST([AM_CFLAGS]) + AC_SUBST([AM_CXXFLAGS]) + AC_SUBST([AM_CPPFLAGS]) + AC_SUBST([AM_LDFLAGS]) + +]) diff --git a/m4/pandora_64bit.m4 b/m4/pandora_64bit.m4 new file mode 100644 index 0000000..5d9983b --- /dev/null +++ b/m4/pandora_64bit.m4 @@ -0,0 +1,60 @@ +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl --------------------------------------------------------------------------- +dnl Macro: PANDORA_64BIT +dnl --------------------------------------------------------------------------- +AC_DEFUN([PANDORA_64BIT],[ + AC_BEFORE([$0], [AC_LIB_PREFIX]) + + AC_ARG_ENABLE([64bit], + [AS_HELP_STRING([--disable-64bit], + [Build 64 bit binary @<:@default=on@:>@])], + [ac_enable_64bit="$enableval"], + [ac_enable_64bit="yes"]) + + AC_CHECK_PROGS(ISAINFO, [isainfo], [no]) + AS_IF([test "x$ISAINFO" != "xno"], + [isainfo_b=`${ISAINFO} -b`], + [isainfo_b="x"]) + + AS_IF([test "$isainfo_b" != "x" -a "$isainfo_b" != "32"],[ + + isainfo_k=`${ISAINFO} -k` + DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}" + + AS_IF([test "x$ac_enable_64bit" = "xyes"],[ + + AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[ + LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}" + ]) + + AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[ + dnl The user hasn't overridden the default libdir, so we'll + dnl the dir suffix to match solaris 32/64-bit policy + libdir="${libdir}/${isainfo_k}" + ]) + + AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],[ + CFLAGS="${CFLAGS} -m64" + ac_cv_env_CFLAGS_set=set + ac_cv_env_CFLAGS_value='-m64' + ]) + AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ + CXXFLAGS="${CXXFLAGS} -m64" + ac_cv_env_CXXFLAGS_set=set + ac_cv_env_CXXFLAGS_value='-m64' + ]) + + AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[ + AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}" + AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}" + ]) + ]) + ]) +]) +dnl --------------------------------------------------------------------------- +dnl End Macro: PANDORA_64BIT +dnl --------------------------------------------------------------------------- diff --git a/m4/pandora_header_assert.m4 b/m4/pandora_header_assert.m4 new file mode 100644 index 0000000..2fdf9d4 --- /dev/null +++ b/m4/pandora_header_assert.m4 @@ -0,0 +1,23 @@ +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl PANDORA_HEADER_ASSERT +dnl ---------------- +dnl Check whether to enable assertions. +AC_DEFUN([PANDORA_HEADER_ASSERT], +[ + AC_CHECK_HEADERS(assert.h) + AC_MSG_CHECKING([whether to enable assertions]) + AC_ARG_ENABLE([assert], + [AS_HELP_STRING([--disable-assert], + [Turn off assertions])], + [ac_cv_assert="no"], + [ac_cv_assert="yes"]) + AC_MSG_RESULT([$ac_cv_assert]) + + AS_IF([test "$ac_cv_assert" = "no"], + [AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])]) +]) + diff --git a/m4/pandora_optimize.m4 b/m4/pandora_optimize.m4 new file mode 100644 index 0000000..fb2cd77 --- /dev/null +++ b/m4/pandora_optimize.m4 @@ -0,0 +1,75 @@ +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([PANDORA_OPTIMIZE],[ + dnl Build optimized or debug version ? + dnl First check for gcc and g++ + AS_IF([test "$GCC" = "yes" -a "$INTELCC" = "no"],[ + + dnl The following is required for portable results of floating point + dnl calculations on PowerPC. The same must also be done for IA-64, but + dnl this options is missing in the IA-64 gcc backend. + case "$target_cpu" in + *ppc* | *powerpc*) + AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}" + AM_CXXFLAGS="-mno-fused-madd ${AM_CXXFLAGS}" + ;; + esac + + dnl Once we can use a modern autoconf, we can replace the std=gnu99 here + dnl with using AC_CC_STD_C99 above + CC="${CC} -std=gnu99" + + AM_CPPFLAGS="-g ${AM_CPPFLAGS}" + + DEBUG_CFLAGS="-O0" + DEBUG_CXXFLAGS="-O0" + + OPTIMIZE_CFLAGS="-O2" + OPTIMIZE_CXXFLAGS="-O2" + ]) + AS_IF([test "$INTELCC" = "yes"],[ + AM_CPPFLAGS="-g ${AM_CPPFLAGS}" + + DEBUG_CFLAGS="-O0" + DEBUG_CXXFLAGS="-O0" + + OPTIMIZE_CFLAGS="-xHOST -O2 -no-prec-div -static" + OPTIMIZE_CXXFLAGS="${OPTIMIZE_CFLAGS}" + + ]) + AS_IF([test "$SUNCC" = "yes"],[ + dnl Once we can use a modern autoconf, we can replace the -xc99=all here + dnl with using AC_CC_STD_C99 above + CC="${CC} -xc99=all" + CXX="${CXX} -xlang=c99" + + AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}" + AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -library=Crun -template=no%extdef ${AM_CXXFLAGS}" + + DEBUG_CXXFLAGS="-g" + + dnl TODO: Make a test for -xO4 usability here + OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin" + OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}" + OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}" + + ]) + + AC_ARG_WITH([debug], + [AS_HELP_STRING([--with-debug], + [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], + [with_debug=$withval], + [with_debug=no]) + AS_IF([test "$with_debug" = "yes"],[ + # Debugging. No optimization. + AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG" + AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG" + ],[ + # Optimized version. No debug + AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}" + AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}" + ]) +]) diff --git a/m4/pandora_vc_build.m4 b/m4/pandora_vc_build.m4 new file mode 100644 index 0000000..6e9c4be --- /dev/null +++ b/m4/pandora_vc_build.m4 @@ -0,0 +1,77 @@ +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([PANDORA_TEST_VC_DIR],[ + pandora_building_from_vc=no + + if test -d ".git" ; then + pandora_building_from_git=yes + pandora_building_from_vc=yes + else + pandora_building_from_git=no + fi +]) + +AC_DEFUN([PANDORA_BUILDING_FROM_VC],[ + m4_syscmd(PANDORA_TEST_VC_DIR + m4_if(PCT_NO_VC_CHANGELOG,yes,[ + vc_changelog=no + ],[ + vc_changelog=yes + ]) + + [ + + if test "${pandora_building_from_git}" = "yes"; then + echo "# Grabbing changelog and version information from git" + PANDORA_RELEASE_VERSION=$(python -c "import pbr.version;print(pbr.version.VersionInfo('oaktreemodel').semantic_version().release_string())") + fi + + if ! test -d config ; then + mkdir -p config + fi + + if test "${pandora_building_from_git}" = "yes" -o ! -f config/pandora_vc_revinfo ; then + cat > config/pandora_vc_revinfo.tmp </dev/null 2>&1 ; then + mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo + fi + rm -f config/pandora_vc_revinfo.tmp + fi + ]) +]) + +AC_DEFUN([_PANDORA_READ_FROM_FILE],[ + $1=`grep $1 $2 | cut -f2 -d=` +]) + +AC_DEFUN([PANDORA_VC_VERSION],[ + AC_REQUIRE([PANDORA_BUILDING_FROM_VC]) + + PANDORA_TEST_VC_DIR + + AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[ + _PANDORA_READ_FROM_FILE( + [PANDORA_RELEASE_VERSION],${srcdir}/config/pandora_vc_revinfo) + ]) + + VERSION="${PANDORA_RELEASE_VERSION}" + AC_DEFINE_UNQUOTED( + [PANDORA_RELEASE_VERSION], + ["${PANDORA_RELEASE_VERSION}"], + [The real version of the software]) +]) + +AC_DEFUN([PANDORA_VC_INFO_HEADER],[ + AC_REQUIRE([PANDORA_VC_VERSION]) + m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_]) + + AC_DEFINE_UNQUOTED( + PANDORA_VC_PREFIX[RELEASE_VERSION], + ["$PANDORA_RELEASE_VERSION"], + [Release date and revision number of checkout]) +]) diff --git a/m4/pandora_warnings.m4 b/m4/pandora_warnings.m4 new file mode 100644 index 0000000..cd18a19 --- /dev/null +++ b/m4/pandora_warnings.m4 @@ -0,0 +1,447 @@ +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl AC_PANDORA_WARNINGS([less-warnings|warnings-always-on]) +dnl less-warnings turn on a limited set of warnings +dnl warnings-always-on always set warnings=error regardless of tarball/vc + +dnl @TODO: remove less-warnings option as soon as Drizzle is clean enough to +dnl allow it + +AC_DEFUN([PANDORA_WARNINGS],[ + m4_define([PW_LESS_WARNINGS],[no]) + m4_define([PW_WARN_ALWAYS_ON],[no]) + ifdef([m4_define],,[define([m4_define], defn([define]))]) + ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))]) + m4_foreach([pw_arg],[$*],[ + m4_case(pw_arg, + [less-warnings],[ + m4_undefine([PW_LESS_WARNINGS]) + m4_define([PW_LESS_WARNINGS],[yes]) + ], + [warnings-always-on],[ + m4_undefine([PW_WARN_ALWAYS_ON]) + m4_define([PW_WARN_ALWAYS_ON],[yes]) + ]) + ]) + + AC_REQUIRE([PANDORA_BUILDING_FROM_VC]) + m4_if(PW_WARN_ALWAYS_ON, [yes], + [ac_cv_warnings_as_errors=yes], + AS_IF([test "$pandora_building_from_vc" = "yes"], + [ac_cv_warnings_as_errors=yes], + [ac_cv_warnings_as_errors=no])) + + AC_ARG_ENABLE([gcc-profile-mode], + [AS_HELP_STRING([--enable-gcc-profile-mode], + [Toggle gcc profile mode @<:@default=off@:>@])], + [ac_gcc_profile_mode="$enableval"], + [ac_gcc_profile_mode="no"]) + + AC_ARG_ENABLE([profiling], + [AS_HELP_STRING([--enable-profiling], + [Toggle profiling @<:@default=off@:>@])], + [ac_profiling="$enableval"], + [ac_profiling="no"]) + + AC_ARG_ENABLE([coverage], + [AS_HELP_STRING([--enable-coverage], + [Toggle coverage @<:@default=off@:>@])], + [ac_coverage="$enableval"], + [ac_coverage="no"]) + + AS_IF([test "$GCC" = "yes"],[ + + AS_IF([test "$ac_profiling" = "yes"],[ + CC_PROFILING="-pg" + GCOV_LIBS="-pg -lgcov" + save_LIBS="${LIBS}" + LIBS="" + AC_CHECK_LIB(c_p, read) + LIBC_P="${LIBS}" + LIBS="${save_LIBS}" + AC_SUBST(LIBC_P) + ],[ + CC_PROFILING=" " + ]) + + AS_IF([test "$ac_coverage" = "yes"], + [ + CC_COVERAGE="--coverage" + GCOV_LIBS="-lgcov" + ]) + + + + AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],[ + W_FAIL="-Werror" + SPHINX_WARNINGS="-W" + dnl INTLTOOL_WARNINGS="yes" + ]) + + AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option], + [ac_cv_safe_to_use_fdiagnostics_show_option_], + [save_CFLAGS="$CFLAGS" + CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([],[])], + [ac_cv_safe_to_use_fdiagnostics_show_option_=yes], + [ac_cv_safe_to_use_fdiagnostics_show_option_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_fdiagnostics_show_option_" = "yes"], + [ + F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option" + ]) + + AC_CACHE_CHECK([whether it is safe to use -floop-parallelize-all], + [ac_cv_safe_to_use_floop_parallelize_all_], + [save_CFLAGS="$CFLAGS" + CFLAGS="-floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([],[])], + [ac_cv_safe_to_use_floop_parallelize_all_=yes], + [ac_cv_safe_to_use_floop_parallelize_all_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"], + [ + F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all" + ]) + + NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing" + NO_SHADOW="-Wno-shadow" + + AS_IF([test "$INTELCC" = "yes"],[ + m4_if(PW_LESS_WARNINGS,[no],[ + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188" + ],[ + dnl 2203 is like old-style-cast + dnl 1684 is like strict-aliasing + dnl 188 is about using enums as bitfields + dnl 1683 is a warning about _EXPLICIT_ casting, which we want + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684" + ]) + CC_WARNINGS="${BASE_WARNINGS}" + CXX_WARNINGS="${BASE_WARNINGS}" + PROTOSKIP_WARNINGS="-diag-disable 188,981,967,2259,1683,1684,2203" + + ],[ + m4_if(PW_LESS_WARNINGS,[no],[ + BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing -Wswitch-enum " + CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings" + CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast" + NO_OLD_STYLE_CAST="-Wno-old-style-cast" + NO_EFF_CXX="-Wno-effc++" + ],[ + BASE_WARNINGS_FULL="${NO_STRICT_ALIASING}" + ]) + + AS_IF([test "${ac_cv_assert}" = "no"], + [NO_UNUSED="-Wno-unused-variable -Wno-unused-parameter"]) + + AC_CACHE_CHECK([whether it is safe to use -Wextra], + [ac_cv_safe_to_use_Wextra_], + [save_CFLAGS="$CFLAGS" + CFLAGS="${W_FAIL} -pedantic -Wextra ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wextra_=yes], + [ac_cv_safe_to_use_Wextra_=no]) + CFLAGS="$save_CFLAGS"]) + + BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} ${BASE_WARNINGS_FULL}" + AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"], + [BASE_WARNINGS="${BASE_WARNINGS} -Wextra"], + [BASE_WARNINGS="${BASE_WARNINGS} -W"]) + + AC_CACHE_CHECK([whether it is safe to use -Wformat], + [ac_cv_safe_to_use_wformat_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#include +#include +void foo(); +void foo() +{ + uint64_t test_u= 0; + printf("This is a %" PRIu64 "test\n", test_u); +} + ]],[[ +foo(); + ]])], + [ac_cv_safe_to_use_wformat_=yes], + [ac_cv_safe_to_use_wformat_=no]) + CFLAGS="$save_CFLAGS"]) + AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[ + BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wno-format-security" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wno-format-security" + ],[ + BASE_WARNINGS="${BASE_WARNINGS} -Wno-format" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format" + ]) + + + + AC_CACHE_CHECK([whether it is safe to use -Wconversion], + [ac_cv_safe_to_use_wconversion_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include +void foo(bool a) +{ + (void)a; +} + ]],[[ +foo(0); + ]])], + [ac_cv_safe_to_use_wconversion_=yes], + [ac_cv_safe_to_use_wconversion_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"], + [W_CONVERSION="-Wconversion" + AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons], + [ac_cv_safe_to_use_Wconversion_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]],[[ +uint16_t x= htons(80); + ]])], + [ac_cv_safe_to_use_Wconversion_=yes], + [ac_cv_safe_to_use_Wconversion_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"], + [NO_CONVERSION="-Wno-conversion"]) + ]) + + CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}" + CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}" + + AC_CACHE_CHECK([whether it is safe to use -Wmissing-declarations from C++], + [ac_cv_safe_to_use_Wmissing_declarations_], + [AC_LANG_PUSH(C++) + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-Werror -pedantic -Wmissing-declarations ${AM_CXXFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wmissing_declarations_=yes], + [ac_cv_safe_to_use_Wmissing_declarations_=no]) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_POP() + ]) + AS_IF([test "$ac_cv_safe_to_use_Wmissing_declarations_" = "yes"], + [CXX_WARNINGS="${CXX_WARNINGS} -Wmissing-declarations"]) + + AC_CACHE_CHECK([whether it is safe to use -Wframe-larger-than], + [ac_cv_safe_to_use_Wframe_larger_than_], + [AC_LANG_PUSH(C++) + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-Werror -pedantic -Wframe-larger-than=32768 ${AM_CXXFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wframe_larger_than_=yes], + [ac_cv_safe_to_use_Wframe_larger_than_=no]) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_POP() + ]) + AS_IF([test "$ac_cv_safe_to_use_Wframe_larger_than_" = "yes"], + [CXX_WARNINGS="${CXX_WARNINGS} -Wframe-larger-than=32768"]) + + AC_CACHE_CHECK([whether it is safe to use -Wlogical-op], + [ac_cv_safe_to_use_Wlogical_op_], + [save_CFLAGS="$CFLAGS" + CFLAGS="${W_FAIL} -pedantic -Wlogical-op ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wlogical_op_=yes], + [ac_cv_safe_to_use_Wlogical_op_=no]) + CFLAGS="$save_CFLAGS"]) + AS_IF([test "$ac_cv_safe_to_use_Wlogical_op_" = "yes"], + [CC_WARNINGS="${CC_WARNINGS} -Wlogical-op"]) + + AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls from C++], + [ac_cv_safe_to_use_Wredundant_decls_], + [AC_LANG_PUSH(C++) + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${W_FAIL} -pedantic -Wredundant-decls ${AM_CXXFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +template struct C { void foo(); }; +template void C::foo() { } +template <> void C::foo(); + AC_INCLUDES_DEFAULT])], + [ac_cv_safe_to_use_Wredundant_decls_=yes], + [ac_cv_safe_to_use_Wredundant_decls_=no]) + CXXFLAGS="${save_CXXFLAGS}" + AC_LANG_POP()]) + AS_IF([test "$ac_cv_safe_to_use_Wredundant_decls_" = "yes"], + [CXX_WARNINGS="${CXX_WARNINGS} -Wredundant-decls"], + [CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"]) + + AC_CACHE_CHECK([whether it is safe to use -Wattributes from C++], + [ac_cv_safe_to_use_Wattributes_], + [AC_LANG_PUSH(C++) + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${W_FAIL} -pedantic -Wattributes -fvisibility=hidden ${AM_CXXFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +#include +#include + + +const ::google::protobuf::EnumDescriptor* Table_TableOptions_RowType_descriptor(); +enum Table_TableOptions_RowType { + Table_TableOptions_RowType_ROW_TYPE_DEFAULT = 0, + Table_TableOptions_RowType_ROW_TYPE_FIXED = 1, + Table_TableOptions_RowType_ROW_TYPE_DYNAMIC = 2, + Table_TableOptions_RowType_ROW_TYPE_COMPRESSED = 3, + Table_TableOptions_RowType_ROW_TYPE_REDUNDANT = 4, + Table_TableOptions_RowType_ROW_TYPE_COMPACT = 5, + Table_TableOptions_RowType_ROW_TYPE_PAGE = 6 +}; + +namespace google { +namespace protobuf { +template <> +inline const EnumDescriptor* GetEnumDescriptor() { + return Table_TableOptions_RowType_descriptor(); +} +} +} + ])], + [ac_cv_safe_to_use_Wattributes_=yes], + [ac_cv_safe_to_use_Wattributes_=no]) + CXXFLAGS="${save_CXXFLAGS}" + AC_LANG_POP()]) + AC_CACHE_CHECK([whether it is safe to use -Wno-attributes], + [ac_cv_safe_to_use_Wno_attributes_], + [save_CFLAGS="$CFLAGS" + CFLAGS="${W_FAIL} -pedantic -Wno_attributes_ ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wno_attributes_=yes], + [ac_cv_safe_to_use_Wno_attributes_=no]) + CFLAGS="$save_CFLAGS"]) + + dnl GCC 3.4 doesn't have -Wno-attributes, so we can't turn them off + dnl by using that. + AS_IF([test "$ac_cv_safe_to_use_Wattributes_" != "yes"],[ + AS_IF([test "$ac_cv_safe_to_use_Wno_attributes_" = "yes"],[ + CC_WARNINGS="${CC_WARNINGS} -Wno-attributes" + NO_ATTRIBUTES="-Wno-attributes"])]) + + + NO_REDUNDANT_DECLS="-Wno-redundant-decls" + dnl TODO: Figure out a better way to deal with this: + PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}" + NO_WERROR="-Wno-error" + PERMISSIVE_WARNINGS="-Wno-error -Wno-unused-function -fpermissive" + PERMISSIVE_C_WARNINGS="-Wno-error -Wno-redundant-decls" + AS_IF([test "$host_vendor" = "apple"],[ + BOOSTSKIP_WARNINGS="-Wno-uninitialized" + ]) + ]) + ]) + + AS_IF([test "$SUNCC" = "yes"],[ + + AS_IF([test "$ac_profiling" = "yes"], + [CC_PROFILING="-xinstrument=datarace"]) + + AS_IF([test "$ac_cv_warnings_as_errors" = "yes"], + [W_FAIL="-errwarn=%all"]) + + AC_CACHE_CHECK([whether E_PASTE_RESULT_NOT_TOKEN is usable], + [ac_cv_paste_result], + [ + save_CFLAGS="${CFLAGS}" + CFLAGS="-errwarn=%all -erroff=E_PASTE_RESULT_NOT_TOKEN ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + AC_INCLUDES_DEFAULT + ],[ + int x= 0;])], + [ac_cv_paste_result=yes], + [ac_cv_paste_result=no]) + CFLAGS="${save_CFLAGS}" + ]) + AS_IF([test $ac_cv_paste_result = yes], + [W_PASTE_RESULT=",E_PASTE_RESULT_NOT_TOKEN"]) + + + m4_if(PW_LESS_WARNINGS, [no],[ + CC_WARNINGS_FULL="-erroff=E_STATEMENT_NOT_REACHED,E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" + CXX_WARNINGS_FULL="-erroff=inllargeuse" + ],[ + CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR,E_STATEMENT_NOT_REACHED" + CXX_WARNINGS_FULL="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint" + ]) + + CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}" + CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}" + PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit" + BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem" + PERMISSIVE_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem,notused,badargtype2w,wunreachable" + INNOBASE_SKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit,wunreachable" + NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED" + NO_WERROR="-errwarn=%none" + + ]) + + AC_SUBST(NO_CONVERSION) + AC_SUBST(NO_REDUNDANT_DECLS) + AC_SUBST(NO_UNREACHED) + AC_SUBST(NO_SHADOW) + AC_SUBST(NO_STRICT_ALIASING) + AC_SUBST(NO_EFF_CXX) + AC_SUBST(NO_OLD_STYLE_CAST) + AC_SUBST(PROTOSKIP_WARNINGS) + AC_SUBST(INNOBASE_SKIP_WARNINGS) + AC_SUBST(BOOSTSKIP_WARNINGS) + AC_SUBST(PERMISSIVE_WARNINGS) + AC_SUBST(PERMISSIVE_C_WARNINGS) + AC_SUBST(NO_WERROR) + AC_SUBST([GCOV_LIBS]) + AC_SUBST([SPHINX_WARNINGS]) + AC_SUBST([INTLTOOL_WARNINGS]) + +]) diff --git a/m4/visibility.m4 b/m4/visibility.m4 new file mode 100644 index 0000000..75c34b6 --- /dev/null +++ b/m4/visibility.m4 @@ -0,0 +1,77 @@ +# visibility.m4 serial 4 (gettext-0.18.2) +dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Tests whether the compiler supports the command-line option +dnl -fvisibility=hidden and the function and variable attributes +dnl __attribute__((__visibility__("hidden"))) and +dnl __attribute__((__visibility__("default"))). +dnl Does *not* test for __visibility__("protected") - which has tricky +dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on +dnl MacOS X. +dnl Does *not* test for __visibility__("internal") - which has processor +dnl dependent semantics. +dnl Does *not* test for #pragma GCC visibility push(hidden) - which is +dnl "really only recommended for legacy code". +dnl Set the variable CFLAG_VISIBILITY. +dnl Defines and sets the variable HAVE_VISIBILITY. + +AC_DEFUN([gl_VISIBILITY], +[ + AC_REQUIRE([AC_PROG_CC]) + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then + dnl First, check whether -Werror can be added to the command line, or + dnl whether it leads to an error because of some other option that the + dnl user has put into $CC $CFLAGS $CPPFLAGS. + AC_MSG_CHECKING([whether the -Werror option is usable]) + AC_CACHE_VAL([gl_cv_cc_vis_werror], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_vis_werror=yes], + [gl_cv_cc_vis_werror=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_vis_werror]) + dnl Now check whether visibility declarations are supported. + AC_MSG_CHECKING([for simple visibility declarations]) + AC_CACHE_VAL([gl_cv_cc_visibility], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + dnl We use the option -Werror and a function dummyfunc, because on some + dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning + dnl "visibility attribute not supported in this configuration; ignored" + dnl at the first function definition in every compilation unit, and we + dnl don't want to use the option in this case. + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void) {} + ]], + [[]])], + [gl_cv_cc_visibility=yes], + [gl_cv_cc_visibility=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_visibility]) + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + HAVE_VISIBILITY=1 + fi + fi + AC_SUBST([CFLAG_VISIBILITY]) + AC_SUBST([HAVE_VISIBILITY]) + AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], + [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) +]) diff --git a/oaktreemodel/__init__.py b/oaktreemodel/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/oaktreemodel/common.pb.go b/oaktreemodel/common.pb.go new file mode 100644 index 0000000..ae5e3c9 --- /dev/null +++ b/oaktreemodel/common.pb.go @@ -0,0 +1,287 @@ +// Code generated by protoc-gen-go. +// source: common.proto +// DO NOT EDIT! + +/* +Package oaktree is a generated protocol buffer package. + +It is generated from these files: + common.proto + +It has these top-level messages: + Project + Location + Filter +*/ +package oaktree + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Project struct { + // Types that are valid to be assigned to Project: + // *Project_Id + // *Project_Name + Project isProject_Project `protobuf_oneof:"project"` + // Types that are valid to be assigned to Domain: + // *Project_DomainId + // *Project_DomainName + Domain isProject_Domain `protobuf_oneof:"domain"` +} + +func (m *Project) Reset() { *m = Project{} } +func (m *Project) String() string { return proto.CompactTextString(m) } +func (*Project) ProtoMessage() {} +func (*Project) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type isProject_Project interface { + isProject_Project() +} +type isProject_Domain interface { + isProject_Domain() +} + +type Project_Id struct { + Id string `protobuf:"bytes,1,opt,name=id,oneof"` +} +type Project_Name struct { + Name string `protobuf:"bytes,2,opt,name=name,oneof"` +} +type Project_DomainId struct { + DomainId string `protobuf:"bytes,3,opt,name=domain_id,json=domainId,oneof"` +} +type Project_DomainName struct { + DomainName string `protobuf:"bytes,4,opt,name=domain_name,json=domainName,oneof"` +} + +func (*Project_Id) isProject_Project() {} +func (*Project_Name) isProject_Project() {} +func (*Project_DomainId) isProject_Domain() {} +func (*Project_DomainName) isProject_Domain() {} + +func (m *Project) GetProject() isProject_Project { + if m != nil { + return m.Project + } + return nil +} +func (m *Project) GetDomain() isProject_Domain { + if m != nil { + return m.Domain + } + return nil +} + +func (m *Project) GetId() string { + if x, ok := m.GetProject().(*Project_Id); ok { + return x.Id + } + return "" +} + +func (m *Project) GetName() string { + if x, ok := m.GetProject().(*Project_Name); ok { + return x.Name + } + return "" +} + +func (m *Project) GetDomainId() string { + if x, ok := m.GetDomain().(*Project_DomainId); ok { + return x.DomainId + } + return "" +} + +func (m *Project) GetDomainName() string { + if x, ok := m.GetDomain().(*Project_DomainName); ok { + return x.DomainName + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Project) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Project_OneofMarshaler, _Project_OneofUnmarshaler, _Project_OneofSizer, []interface{}{ + (*Project_Id)(nil), + (*Project_Name)(nil), + (*Project_DomainId)(nil), + (*Project_DomainName)(nil), + } +} + +func _Project_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Project) + // project + switch x := m.Project.(type) { + case *Project_Id: + b.EncodeVarint(1<<3 | proto.WireBytes) + b.EncodeStringBytes(x.Id) + case *Project_Name: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.Name) + case nil: + default: + return fmt.Errorf("Project.Project has unexpected type %T", x) + } + // domain + switch x := m.Domain.(type) { + case *Project_DomainId: + b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeStringBytes(x.DomainId) + case *Project_DomainName: + b.EncodeVarint(4<<3 | proto.WireBytes) + b.EncodeStringBytes(x.DomainName) + case nil: + default: + return fmt.Errorf("Project.Domain has unexpected type %T", x) + } + return nil +} + +func _Project_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Project) + switch tag { + case 1: // project.id + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Project = &Project_Id{x} + return true, err + case 2: // project.name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Project = &Project_Name{x} + return true, err + case 3: // domain.domain_id + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Domain = &Project_DomainId{x} + return true, err + case 4: // domain.domain_name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Domain = &Project_DomainName{x} + return true, err + default: + return false, nil + } +} + +func _Project_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Project) + // project + switch x := m.Project.(type) { + case *Project_Id: + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.Id))) + n += len(x.Id) + case *Project_Name: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.Name))) + n += len(x.Name) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + // domain + switch x := m.Domain.(type) { + case *Project_DomainId: + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.DomainId))) + n += len(x.DomainId) + case *Project_DomainName: + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.DomainName))) + n += len(x.DomainName) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Location struct { + Cloud string `protobuf:"bytes,1,opt,name=cloud" json:"cloud,omitempty"` + Region string `protobuf:"bytes,2,opt,name=region" json:"region,omitempty"` + Zone string `protobuf:"bytes,3,opt,name=zone" json:"zone,omitempty"` + Project *Project `protobuf:"bytes,4,opt,name=project" json:"project,omitempty"` +} + +func (m *Location) Reset() { *m = Location{} } +func (m *Location) String() string { return proto.CompactTextString(m) } +func (*Location) ProtoMessage() {} +func (*Location) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Location) GetProject() *Project { + if m != nil { + return m.Project + } + return nil +} + +type Filter struct { + Location *Location `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + NameOrId string `protobuf:"bytes,2,opt,name=name_or_id,json=nameOrId" json:"name_or_id,omitempty"` + Jmespath string `protobuf:"bytes,3,opt,name=jmespath" json:"jmespath,omitempty"` +} + +func (m *Filter) Reset() { *m = Filter{} } +func (m *Filter) String() string { return proto.CompactTextString(m) } +func (*Filter) ProtoMessage() {} +func (*Filter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Filter) GetLocation() *Location { + if m != nil { + return m.Location + } + return nil +} + +func init() { + proto.RegisterType((*Project)(nil), "oaktree.Project") + proto.RegisterType((*Location)(nil), "oaktree.Location") + proto.RegisterType((*Filter)(nil), "oaktree.Filter") +} + +func init() { proto.RegisterFile("common.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x3c, 0x91, 0xc1, 0x4a, 0xc4, 0x30, + 0x10, 0x86, 0xed, 0x5a, 0xdb, 0x74, 0xea, 0x61, 0x1d, 0x44, 0x16, 0x51, 0xd0, 0x9e, 0x44, 0xb0, + 0x87, 0xf5, 0x0d, 0xf6, 0x20, 0x0a, 0xa2, 0x92, 0x17, 0x58, 0x62, 0x1b, 0xb4, 0x6b, 0x93, 0xa9, + 0x31, 0x82, 0xf8, 0x04, 0x3e, 0xb6, 0x69, 0x92, 0xf6, 0x96, 0xf9, 0xff, 0x3f, 0xfc, 0xdf, 0x24, + 0x70, 0xd8, 0x90, 0x52, 0xa4, 0xeb, 0xc1, 0x90, 0x25, 0xcc, 0x49, 0x7c, 0x58, 0x23, 0x65, 0xf5, + 0x97, 0x40, 0xfe, 0x62, 0x68,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+} diff --git a/oaktreemodel/common.proto b/oaktreemodel/common.proto new file mode 100644 index 0000000..1c51b0f --- /dev/null +++ b/oaktreemodel/common.proto @@ -0,0 +1,43 @@ +// Copyright (c) 2016 Red Hat, Inc +// +// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +// +// 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. + +syntax = "proto3"; + +package oaktree; + +message Project { + oneof project { + string id = 1; + string name = 2; + } + oneof domain { + string domain_id = 3; + string domain_name = 4; + } +} + +message Location { + string cloud = 1; + string region = 2; + string zone = 3; + Project project = 4; +} + +message Filter { + Location location = 1; + string name_or_id = 2; + string jmespath = 3; +} + diff --git a/oaktreemodel/flavor.pb.go b/oaktreemodel/flavor.pb.go new file mode 100644 index 0000000..f31d2b7 --- /dev/null +++ b/oaktreemodel/flavor.pb.go @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-go. +// source: flavor.proto +// DO NOT EDIT! + +/* +Package oaktree is a generated protocol buffer package. + +It is generated from these files: + flavor.proto + +It has these top-level messages: + Flavor + FlavorList +*/ +package oaktree + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import oaktree1 "." + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Flavor struct { + Location *oaktree1.Location `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + IsPublic bool `protobuf:"varint,4,opt,name=is_public,json=isPublic" json:"is_public,omitempty"` + Disabled bool `protobuf:"varint,5,opt,name=disabled" json:"disabled,omitempty"` + Ram uint32 `protobuf:"varint,6,opt,name=ram" json:"ram,omitempty"` + Vcpus uint32 `protobuf:"varint,7,opt,name=vcpus" json:"vcpus,omitempty"` + Disk uint64 `protobuf:"varint,8,opt,name=disk" json:"disk,omitempty"` + Ephemeral uint32 `protobuf:"varint,9,opt,name=ephemeral" json:"ephemeral,omitempty"` + Swap uint64 `protobuf:"varint,10,opt,name=swap" json:"swap,omitempty"` + RxtxFactor float32 `protobuf:"fixed32,11,opt,name=rxtx_factor,json=rxtxFactor" json:"rxtx_factor,omitempty"` + Properties map[string]string `protobuf:"bytes,99,rep,name=properties" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *Flavor) Reset() { *m = Flavor{} } +func (m *Flavor) String() string { return proto.CompactTextString(m) } +func (*Flavor) ProtoMessage() {} +func (*Flavor) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Flavor) GetLocation() *oaktree1.Location { + if m != nil { + return m.Location + } + return nil +} + +func (m *Flavor) GetProperties() map[string]string { + if m != nil { + return m.Properties + } + return nil +} + +type FlavorList struct { + Flavors []*Flavor `protobuf:"bytes,1,rep,name=flavors" json:"flavors,omitempty"` +} + +func (m *FlavorList) Reset() { *m = FlavorList{} } +func (m *FlavorList) String() string { return proto.CompactTextString(m) } +func (*FlavorList) ProtoMessage() {} +func (*FlavorList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *FlavorList) GetFlavors() []*Flavor { + if m != nil { + return m.Flavors + } + return nil +} + +func init() { + proto.RegisterType((*Flavor)(nil), "oaktree.Flavor") + proto.RegisterType((*FlavorList)(nil), "oaktree.FlavorList") +} + +func init() { proto.RegisterFile("flavor.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 334 bytes of a gzipped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x6b, 0x9b, 0xd7, 0x1b, 0x4d, 0x3a, 0x5e, 0x0b, 0xc4, 0x1d, 0x6a, 0x3b, 0x6b, + 0x92, 0x58, 0xb1, 0x49, 0x3d, 0xc6, 0x3b, 0x48, 0x79, 0xfd, 0xc5, 0x4b, 0xae, 0x58, 0x41, 0x52, + 0x9f, 0xfe, 0x13, 0x5c, 0x43, 0x7f, 0xb3, 0x9a, 0x40, 0x68, 0x38, 0x8c, 0x43, 0xe8, 0xaa, 0x9d, + 0xd9, 0xcd, 0x57, 0x2c, 0x37, 0x52, 0x91, 0xae, 0xb5, 0x22, 0x0a, 0x4e, 0x9a, 0x78, 0x05, 0x3f, + 0x00, 0xec, 0x5c, 0x35, 0x57, 0x46, 0x70, 0x4d, 0xf2, 0x51, 0x6c, 0xc7, 0x19, 0x9e, 0xc6, 0x09, + 0xfb, 0x65, 0xb3, 0x53, 0xe2, 0xb3, 0x32, 0x6a, 0x4f, 0xff, 0x55, 0x06, 0xef, 0xd0, 0x3f, 0xb3, + 0xdd, 0x13, 0xd7, 0x7c, 0xef, 0x97, 0x4e, 0xa9, 0x83, 0xfe, 0x89, 0xac, 0xd8, 0xf0, 0xc3, 0xa8, + 0x81, 0xbc, 0x45, 0xaf, 0x8d, 0xf1, 0x0b, 0x40, 0x38, 0x64, 0x2a, 0xb4, 0xc1, 0x07, 0xe8, 0x84, + 0xaf, 0xd5, 0xb6, 0xed, 0xae, 0xd2, 0x3f, 0xbb, 0x0a, 0x3d, 0xfa, 0x8b, 0xb6, 0xff, 0xe5, 0xe7, + 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x22, 0xa6, 0x39, 0x8f, 0x0c, 0x02, 0x00, 0x00, +} diff --git a/oaktreemodel/flavor.proto b/oaktreemodel/flavor.proto new file mode 100644 index 0000000..d35b364 --- /dev/null +++ b/oaktreemodel/flavor.proto @@ -0,0 +1,39 @@ +// Copyright (c) 2016 Red Hat, Inc +// +// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +// +// 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. + +syntax = "proto3"; + +import "common.proto"; + +package oaktree; + +message Flavor { + Location location = 1; + string id = 2; + string name = 3; + bool is_public = 4; + bool disabled = 5; + uint32 ram = 6; + uint32 vcpus = 7; + uint64 disk = 8; + uint32 ephemeral = 9; + uint64 swap = 10; + float rxtx_factor = 11; + map properties = 99; +} + +message FlavorList { + repeated Flavor flavors = 1; +} diff --git a/oaktreemodel/image.pb.go b/oaktreemodel/image.pb.go new file mode 100644 index 0000000..04e4cf5 --- /dev/null +++ b/oaktreemodel/image.pb.go @@ -0,0 +1,284 @@ +// Code generated by protoc-gen-go. +// source: image.proto +// DO NOT EDIT! + +/* +Package oaktree is a generated protocol buffer package. + +It is generated from these files: + image.proto + +It has these top-level messages: + DiskFormat + ContainerFormat + Image + ImageList +*/ +package oaktree + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import oaktree1 "." + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type DiskFormat_DiskFormatChoice int32 + +const ( + DiskFormat_qcow2 DiskFormat_DiskFormatChoice = 0 + DiskFormat_raw DiskFormat_DiskFormatChoice = 1 + DiskFormat_vhd DiskFormat_DiskFormatChoice = 2 + DiskFormat_iso DiskFormat_DiskFormatChoice = 3 + DiskFormat_vmdk DiskFormat_DiskFormatChoice = 4 + DiskFormat_vdi DiskFormat_DiskFormatChoice = 5 + DiskFormat_ami DiskFormat_DiskFormatChoice = 6 + DiskFormat_ari DiskFormat_DiskFormatChoice = 7 + DiskFormat_aki DiskFormat_DiskFormatChoice = 8 +) + +var DiskFormat_DiskFormatChoice_name = map[int32]string{ + 0: "qcow2", + 1: "raw", + 2: "vhd", + 3: "iso", + 4: "vmdk", + 5: "vdi", + 6: "ami", + 7: "ari", + 8: "aki", +} +var DiskFormat_DiskFormatChoice_value = map[string]int32{ + "qcow2": 0, + "raw": 1, + "vhd": 2, + "iso": 3, + "vmdk": 4, + "vdi": 5, + "ami": 6, + "ari": 7, + "aki": 8, +} + +func (x DiskFormat_DiskFormatChoice) String() string { + return proto.EnumName(DiskFormat_DiskFormatChoice_name, int32(x)) +} +func (DiskFormat_DiskFormatChoice) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 0} +} + +type ContainerFormat_ContainerFormatChoice int32 + +const ( + ContainerFormat_bare ContainerFormat_ContainerFormatChoice = 0 + ContainerFormat_docker ContainerFormat_ContainerFormatChoice = 1 + ContainerFormat_ovf ContainerFormat_ContainerFormatChoice = 2 + ContainerFormat_ova ContainerFormat_ContainerFormatChoice = 3 + ContainerFormat_ami ContainerFormat_ContainerFormatChoice = 4 + ContainerFormat_ari ContainerFormat_ContainerFormatChoice = 5 + ContainerFormat_aki ContainerFormat_ContainerFormatChoice = 6 +) + +var ContainerFormat_ContainerFormatChoice_name = map[int32]string{ + 0: "bare", + 1: "docker", + 2: "ovf", + 3: "ova", + 4: "ami", + 5: "ari", + 6: "aki", +} +var ContainerFormat_ContainerFormatChoice_value = map[string]int32{ + "bare": 0, + "docker": 1, + "ovf": 2, + "ova": 3, + "ami": 4, + "ari": 5, + "aki": 6, +} + +func (x ContainerFormat_ContainerFormatChoice) String() string { + return proto.EnumName(ContainerFormat_ContainerFormatChoice_name, int32(x)) +} +func (ContainerFormat_ContainerFormatChoice) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{1, 0} +} + +type Image_Status int32 + +const ( + Image_active Image_Status = 0 + Image_queued Image_Status = 1 + Image_saving Image_Status = 2 + Image_deleted Image_Status = 3 + Image_killed Image_Status = 4 + Image_pending_delete Image_Status = 5 + Image_deactivated Image_Status = 6 +) + +var Image_Status_name = map[int32]string{ + 0: "active", + 1: "queued", + 2: "saving", + 3: "deleted", + 4: "killed", + 5: "pending_delete", + 6: "deactivated", +} +var Image_Status_value = map[string]int32{ + "active": 0, + "queued": 1, + "saving": 2, + "deleted": 3, + "killed": 4, + "pending_delete": 5, + "deactivated": 6, +} + +func (x Image_Status) String() string { + return proto.EnumName(Image_Status_name, int32(x)) +} +func (Image_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +type DiskFormat struct { +} + +func (m *DiskFormat) Reset() { *m = DiskFormat{} } +func (m *DiskFormat) String() string { return proto.CompactTextString(m) } +func (*DiskFormat) ProtoMessage() {} +func (*DiskFormat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type ContainerFormat struct { +} + +func (m *ContainerFormat) Reset() { *m = ContainerFormat{} } +func (m *ContainerFormat) String() string { return proto.CompactTextString(m) } +func (*ContainerFormat) ProtoMessage() {} +func (*ContainerFormat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +type Image struct { + Location *oaktree1.Location `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + MinRam uint32 `protobuf:"varint,4,opt,name=min_ram,json=minRam" json:"min_ram,omitempty"` + MinDisk uint64 `protobuf:"varint,5,opt,name=min_disk,json=minDisk" json:"min_disk,omitempty"` + Size uint64 `protobuf:"varint,6,opt,name=size" json:"size,omitempty"` + VirtualSize uint64 `protobuf:"varint,7,opt,name=virtual_size,json=virtualSize" json:"virtual_size,omitempty"` + ContainerFormat ContainerFormat_ContainerFormatChoice `protobuf:"varint,8,opt,name=container_format,json=containerFormat,enum=oaktree.ContainerFormat_ContainerFormatChoice" json:"container_format,omitempty"` + DiskFormat DiskFormat_DiskFormatChoice `protobuf:"varint,9,opt,name=disk_format,json=diskFormat,enum=oaktree.DiskFormat_DiskFormatChoice" json:"disk_format,omitempty"` + Checksum string `protobuf:"bytes,10,opt,name=checksum" json:"checksum,omitempty"` + CreatedAt string `protobuf:"bytes,11,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,12,opt,name=updated_at,json=updatedAt" json:"updated_at,omitempty"` + Owner string `protobuf:"bytes,13,opt,name=owner" json:"owner,omitempty"` + IsPublic bool `protobuf:"varint,14,opt,name=is_public,json=isPublic" json:"is_public,omitempty"` + IsProtected bool `protobuf:"varint,15,opt,name=is_protected,json=isProtected" json:"is_protected,omitempty"` + Status Image_Status `protobuf:"varint,16,opt,name=status,enum=oaktree.Image_Status" json:"status,omitempty"` + Locations []string `protobuf:"bytes,17,rep,name=locations" json:"locations,omitempty"` + DirectUrl string `protobuf:"bytes,18,opt,name=direct_url,json=directUrl" json:"direct_url,omitempty"` + Tags []string `protobuf:"bytes,19,rep,name=tags" json:"tags,omitempty"` + Properties map[string]string `protobuf:"bytes,99,rep,name=properties" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *Image) Reset() { *m = Image{} } +func (m *Image) String() string { return proto.CompactTextString(m) } +func (*Image) ProtoMessage() {} +func (*Image) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Image) GetLocation() *oaktree1.Location { + if m != nil { + return m.Location + } + return nil +} + +func (m *Image) GetProperties() map[string]string { + if m != nil { + return m.Properties + } + return nil +} + +type ImageList struct { + Images []*Image `protobuf:"bytes,1,rep,name=images" json:"images,omitempty"` +} + +func (m *ImageList) Reset() { *m = ImageList{} } +func (m *ImageList) String() string { return proto.CompactTextString(m) } +func (*ImageList) ProtoMessage() {} +func (*ImageList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *ImageList) GetImages() []*Image { + if m != nil { + return m.Images + } + return nil +} + +func init() { + proto.RegisterType((*DiskFormat)(nil), "oaktree.DiskFormat") + proto.RegisterType((*ContainerFormat)(nil), "oaktree.ContainerFormat") + proto.RegisterType((*Image)(nil), "oaktree.Image") + proto.RegisterType((*ImageList)(nil), "oaktree.ImageList") + proto.RegisterEnum("oaktree.DiskFormat_DiskFormatChoice", DiskFormat_DiskFormatChoice_name, DiskFormat_DiskFormatChoice_value) + proto.RegisterEnum("oaktree.ContainerFormat_ContainerFormatChoice", ContainerFormat_ContainerFormatChoice_name, ContainerFormat_ContainerFormatChoice_value) + proto.RegisterEnum("oaktree.Image_Status", Image_Status_name, Image_Status_value) +} + +func init() { proto.RegisterFile("image.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 676 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x54, 0x4b, 0x6f, 0xd3, 0x4c, + 0x14, 0xfd, 0xf2, 0x72, 0xec, 0xeb, 0x36, 0x71, 0xe7, 0xa3, 0x62, 0x28, 0x0f, 0x95, 0x08, 0x21, + 0x36, 0x64, 0x91, 0x6e, 0x10, 0x12, 0x48, 0xa8, 0x14, 0x09, 0xa9, 0x8b, 0xca, 0x15, 0x0b, 0xd8, + 0x44, 0x53, 0x7b, 0xda, 0x0e, 0x7e, 0x4c, 0x3a, 0x33, 0x76, 0x55, 0x96, 0xfc, 0x72, 0xee, 0x8c, + 0x1f, 0xa5, 0x11, 0xbb, 0x33, 0xe7, 0xdc, 0xdc, 0xc7, 0xc9, 0xbd, 0x86, 0x50, 0x14, 0xec, 0x8a, + 0x2f, 0x37, 0x4a, 0x1a, 0x49, 0xa6, 0x92, 0x65, 0x46, 0x71, 0x7e, 0xb0, 0x93, 0xc8, 0xa2, 0x90, + 0x65, 0x43, 0x2f, 0x0c, 0xc0, 0x67, 0xa1, 0xb3, 0x2f, 0x52, 0x15, 0xcc,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, 0x1c, 0xb7, + 0xea, 0x85, 0xe7, 0xbe, 0x52, 0x47, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xb3, 0x99, 0x9b, + 0xcb, 0x04, 0x00, 0x00, +} diff --git a/oaktreemodel/image.proto b/oaktreemodel/image.proto new file mode 100644 index 0000000..d1adcb9 --- /dev/null +++ b/oaktreemodel/image.proto @@ -0,0 +1,82 @@ +// Copyright (c) 2016 Red Hat, Inc +// +// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +// +// 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. + +syntax = "proto3"; + +import "common.proto"; + +package oaktree; + +message DiskFormat { + enum DiskFormatChoice { + qcow2 = 0; + raw = 1; + vhd = 2; + iso = 3; + vmdk = 4; + vdi = 5; + ami = 6; + ari = 7; + aki = 8; + }; +}; + +message ContainerFormat { + enum ContainerFormatChoice { + bare = 0; + docker = 1; + ovf = 2; + ova = 3; + ami = 4; + ari = 5; + aki = 6; + }; +}; + +message Image { + Location location = 1; + string id = 2; + string name = 3; + uint32 min_ram = 4; + uint64 min_disk = 5; + uint64 size = 6; + uint64 virtual_size = 7; + ContainerFormat.ContainerFormatChoice container_format = 8; + DiskFormat.DiskFormatChoice disk_format = 9; + string checksum = 10; + string created_at = 11; + string updated_at = 12; + string owner = 13; + bool is_public = 14; + bool is_protected = 15; + enum Status { + active = 0; + queued = 1; + saving = 2; + deleted = 3; + killed = 4; + pending_delete = 5; + deactivated = 6; + } + Status status = 16; + repeated string locations = 17; + string direct_url = 18; + repeated string tags = 19; + map properties = 99; +} + +message ImageList { + repeated Image images = 1; +} diff --git a/oaktreemodel/model.py b/oaktreemodel/model.py new file mode 100644 index 0000000..2908b21 --- /dev/null +++ b/oaktreemodel/model.py @@ -0,0 +1,22 @@ +# Copyright (c) 2016 Monty Taylor +# +# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +# +# 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. +# flake8: noqa + +from oaktreemodel.common_pb2 import Project, Location, Filter +from oaktreemodel.flavor_pb2 import Flavor, FlavorList +from oaktreemodel.image_pb2 import Image, ImageList +from oaktreemodel.security_group_pb2 import SecurityGroup, SecurityGroupList +from oaktreemodel.security_group_pb2 import SecurityGroupRule +from oaktreemodel.security_group_pb2 import SecurityGroupRuleList diff --git a/oaktreemodel/oaktree.pb.go b/oaktreemodel/oaktree.pb.go new file mode 100644 index 0000000..fb3a1b0 --- /dev/null +++ b/oaktreemodel/oaktree.pb.go @@ -0,0 +1,57 @@ +// Code generated by protoc-gen-go. +// source: oaktree.proto +// DO NOT EDIT! + +/* +Package oaktree is a generated protocol buffer package. + +It is generated from these files: + oaktree.proto + +It has these top-level messages: +*/ +package oaktree + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "." +import _ "." +import _ "." +import _ "." + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +func init() { proto.RegisterFile("oaktree.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 291 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0xdf, 0x4a, 0xc3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0xbc, 0x12, 0x1a, 0x46, 0x8d, 0xdf, 0x43, 0xdf, 0xb5, 0x36, 0x2e, + 0x02, 0xed, 0x34, 0x1c, 0xe1, 0x57, 0xe8, 0x98, 0xf5, 0x15, 0x2f, 0x75, 0xc6, 0xff, 0x1d, 0x63, + 0xcc, 0x3a, 0xe6, 0x19, 0x4e, 0x02, 0x6b, 0xcc, 0x65, 0x60, 0xd1, 0xd9, 0xdf, 0x51, 0x6e, 0xd5, + 0x70, 0x00, 0xa7, 0x12, 0xd3, 0x58, 0x96, 0xbc, 0xa8, 0x14, 0x4b, 0x16, 0xb1, 0x28, 0xe6, 0xc8, + 0x96, 0xd8, 0x30, 0xf2, 0x7f, 0x62, 0x6a, 0x3e, 0xc9, 0x74, 0xf3, 0x6b, 0xab, 0x33, 0xb9, 0x7b, + 0x7c, 0xdb, 0xb6, 0x7f, 0x66, 0xf0, 0x13, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x6e, 0xbe, 0xa3, 0x8c, + 0x02, 0x00, 0x00, +} diff --git a/oaktreemodel/oaktree.proto b/oaktreemodel/oaktree.proto new file mode 100644 index 0000000..33e1af3 --- /dev/null +++ b/oaktreemodel/oaktree.proto @@ -0,0 +1,39 @@ +// Copyright (c) Red Hat, Inc +// +// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +// +// 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. + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.openstack.infra.oaktree"; +option java_outer_classname = "OaktreeProto"; +option objc_class_prefix = "OAK"; + +import "common.proto"; +import "flavor.proto"; +import "image.proto"; +import "security_group.proto"; + +package oaktree; + +service Oaktree { + rpc GetFlavor (Filter) returns (Flavor) {} + rpc SearchFlavors (Filter) returns (FlavorList) {} + rpc GetImage (Filter) returns (Image) {} + rpc SearchImages (Filter) returns (ImageList) {} + rpc GetSecurityGroup (Filter) returns (SecurityGroup) {} + rpc SearchSecurityGroups (Filter) returns (SecurityGroupList) {} + rpc GetSecurityGroupRule (Filter) returns (SecurityGroupRule) {} + rpc SearchSecurityGroupRules (Filter) returns (SecurityGroupRuleList) {} +} diff --git a/oaktreemodel/security_group.pb.go b/oaktreemodel/security_group.pb.go new file mode 100644 index 0000000..f9ceb24 --- /dev/null +++ b/oaktreemodel/security_group.pb.go @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-go. +// source: security_group.proto +// DO NOT EDIT! + +/* +Package oaktree is a generated protocol buffer package. + +It is generated from these files: + security_group.proto + +It has these top-level messages: + SecurityGroupRule + SecurityGroupRuleList + SecurityGroup + SecurityGroupList +*/ +package oaktree + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import oaktree1 "." + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type SecurityGroupRule_Direction int32 + +const ( + SecurityGroupRule_ingress SecurityGroupRule_Direction = 0 + SecurityGroupRule_egress SecurityGroupRule_Direction = 1 +) + +var SecurityGroupRule_Direction_name = map[int32]string{ + 0: "ingress", + 1: "egress", +} +var SecurityGroupRule_Direction_value = map[string]int32{ + "ingress": 0, + "egress": 1, +} + +func (x SecurityGroupRule_Direction) String() string { + return proto.EnumName(SecurityGroupRule_Direction_name, int32(x)) +} +func (SecurityGroupRule_Direction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 0} +} + +type SecurityGroupRule struct { + Location *oaktree1.Location `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + Direction SecurityGroupRule_Direction `protobuf:"varint,3,opt,name=direction,enum=oaktree.SecurityGroupRule_Direction" json:"direction,omitempty"` + Ethertype string `protobuf:"bytes,4,opt,name=ethertype" json:"ethertype,omitempty"` + PortRangeMin uint32 `protobuf:"varint,5,opt,name=port_range_min,json=portRangeMin" json:"port_range_min,omitempty"` + PortRangeMax uint32 `protobuf:"varint,6,opt,name=port_range_max,json=portRangeMax" json:"port_range_max,omitempty"` + Protocol string `protobuf:"bytes,7,opt,name=protocol" json:"protocol,omitempty"` + RemoteIpPrefix string `protobuf:"bytes,8,opt,name=remote_ip_prefix,json=remoteIpPrefix" json:"remote_ip_prefix,omitempty"` + SecurityGroupId string `protobuf:"bytes,9,opt,name=security_group_id,json=securityGroupId" json:"security_group_id,omitempty"` + RemoteGroupId string `protobuf:"bytes,10,opt,name=remote_group_id,json=remoteGroupId" json:"remote_group_id,omitempty"` + Properties map[string]string `protobuf:"bytes,99,rep,name=properties" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *SecurityGroupRule) Reset() { *m = SecurityGroupRule{} } +func (m *SecurityGroupRule) String() string { return proto.CompactTextString(m) } +func (*SecurityGroupRule) ProtoMessage() {} +func (*SecurityGroupRule) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *SecurityGroupRule) GetLocation() *oaktree1.Location { + if m != nil { + return m.Location + } + return nil +} + +func (m *SecurityGroupRule) GetProperties() map[string]string { + if m != nil { + return m.Properties + } + return nil +} + +type SecurityGroupRuleList struct { + Rules []*SecurityGroupRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"` +} + +func (m *SecurityGroupRuleList) Reset() { *m = SecurityGroupRuleList{} } +func (m *SecurityGroupRuleList) String() string { return proto.CompactTextString(m) } +func (*SecurityGroupRuleList) ProtoMessage() {} +func (*SecurityGroupRuleList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *SecurityGroupRuleList) GetRules() []*SecurityGroupRule { + if m != nil { + return m.Rules + } + return nil +} + +type SecurityGroup struct { + Location *oaktree1.Location `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"` + Rules []*SecurityGroupRule `protobuf:"bytes,5,rep,name=rules" json:"rules,omitempty"` + Properties map[string]string `protobuf:"bytes,99,rep,name=properties" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *SecurityGroup) Reset() { *m = SecurityGroup{} } +func (m *SecurityGroup) String() string { return proto.CompactTextString(m) } +func (*SecurityGroup) ProtoMessage() {} +func (*SecurityGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *SecurityGroup) GetLocation() *oaktree1.Location { + if m != nil { + return m.Location + } + return nil +} + +func (m *SecurityGroup) GetRules() []*SecurityGroupRule { + if m != nil { + return m.Rules + } + return nil +} + +func (m *SecurityGroup) GetProperties() map[string]string { + if m != nil { + return m.Properties + } + return nil +} + +type SecurityGroupList struct { + SecurityGroups []*SecurityGroup `protobuf:"bytes,1,rep,name=security_groups,json=securityGroups" json:"security_groups,omitempty"` +} + +func (m *SecurityGroupList) Reset() { *m = SecurityGroupList{} } +func (m *SecurityGroupList) String() string { return proto.CompactTextString(m) } +func (*SecurityGroupList) ProtoMessage() {} +func (*SecurityGroupList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *SecurityGroupList) GetSecurityGroups() []*SecurityGroup { + if m != nil { + return m.SecurityGroups + } + return nil +} + +func init() { + proto.RegisterType((*SecurityGroupRule)(nil), "oaktree.SecurityGroupRule") + proto.RegisterType((*SecurityGroupRuleList)(nil), "oaktree.SecurityGroupRuleList") + proto.RegisterType((*SecurityGroup)(nil), "oaktree.SecurityGroup") + proto.RegisterType((*SecurityGroupList)(nil), "oaktree.SecurityGroupList") + proto.RegisterEnum("oaktree.SecurityGroupRule_Direction", SecurityGroupRule_Direction_name, SecurityGroupRule_Direction_value) +} + +func init() { proto.RegisterFile("security_group.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 473 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x93, 0x6d, 0x8b, 0xd3, 0x40, + 0x10, 0xc7, 0xed, 0x73, 0x33, 0xbd, 0xa6, 0xed, 0x70, 0x4a, 0x28, 0xbe, 0x28, 0xa5, 0x1c, 0xc7, + 0x81, 0x45, 0xce, 0x37, 0x22, 0x88, 0x20, 0x3e, 0x50, 0x39, 0xe1, 0x58, 0x7d, 0x1f, 0x62, 0x3a, + 0xd6, 0xe5, 0x9a, 0xec, 0xb2, 0xbb, 0x95, 0xf6, 0xc3, 0xf9, 0x09, 0xfc, 0x52, 0x6e, 0x36, 0x69, + 0xfa, 0x70, 0x77, 0x22, 0xc8, 0xbd, 0x9b, 0xfc, 0xf7, 0x37, 0xbb, 0x33, 0xf3, 0x9f, 0xc0, 0xa9, + 0xa6, 0x78, 0xa5, 0xb8, 0xd9, 0x84, 0x0b, 0x25, 0x56, 0x72, 0x2a, 0x95, 0x30, 0x02, 0x5b, 0x22, + 0xba, 0x31, 0x8a, 0x68, 0x78, 0x12, 0x8b, 0x24, 0x11, 0x69, 0x2e, 0x8f, 0x7f, 0xd7, 0x61, 0xf0, + 0xa5, 0xe0, 0x3f, 0x66, 0x38, 0x5b, 0x2d, 0x09, 0x9f, 0x41, 0x7b, 0x29, 0xe2, 0xc8, 0x70, 0x91, + 0x06, 0x95, 0x51, 0xe5, 0xbc, 0x73, 0x39, 0x98, 0x16, 0xf9, 0xd3, 0xab, 0xe2, 0x80, 0x95, 0x08, + 0xfa, 0x50, 0xe5, 0xf3, 0xa0, 0x6a, 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x7e, 0x46, 0xcb, 0x15, 0x15, 0x5e, + 0xe6, 0x1f, 0xaf, 0xaa, 0x2f, 0x2b, 0xe3, 0x09, 0x78, 0xa5, 0x4d, 0xd8, 0x81, 0x16, 0x4f, 0x17, + 0x8a, 0xb4, 0xee, 0x3f, 0x42, 0x80, 0x26, 0xe5, 0x71, 0x65, 0x3c, 0x83, 0xc7, 0xb7, 0xaa, 0xba, + 0xe2, 0xda, 0xe0, 0x73, 0x68, 0x28, 0x1b, 0x6b, 0xfb, 0x58, 0xd6, 0xc4, 0xf0, 0xfe, 0x26, 0x58, + 0x0e, 0x8e, 0x7f, 0x55, 0xa1, 0x7b, 0x70, 0xf8, 0xbf, 0x4b, 0x89, 0x50, 0x4f, 0xa3, 0x84, 0xdc, + 0x3e, 0x7a, 0xcc, 0xc5, 0x38, 0x82, 0xce, 0x9c, 0x74, 0xac, 0xb8, 0x74, 0xb7, 0xe6, 0x6b, 0xb6, + 0x2f, 0xed, 0x0a, 0x6f, 0xfc, 0x63, 0xe1, 0xf8, 0xe1, 0x0e, 0xd3, 0xce, 0xee, 0x4e, 0x7b, 0x48, + 0xc3, 0xbe, 0x1e, 0xfd, 0xd7, 0xce, 0x86, 0x37, 0xd0, 0x3b, 0x5c, 0xd2, 0xad, 0x21, 0x4f, 0xee, + 0xe9, 0xcb, 0x3f, 0x58, 0x5d, 0xfd, 0xad, 0xe9, 0xfe, 0x8c, 0x17, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x3e, 0xd8, 0xb9, 0x74, 0x64, 0x04, 0x00, 0x00, +} diff --git a/oaktreemodel/security_group.proto b/oaktreemodel/security_group.proto new file mode 100644 index 0000000..7fc7b2c --- /dev/null +++ b/oaktreemodel/security_group.proto @@ -0,0 +1,55 @@ +// Copyright (c) 2016 Red Hat, Inc +// +// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +// +// 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. + +syntax = "proto3"; + +import "common.proto"; + +package oaktree; + +message SecurityGroupRule { + enum Direction { + ingress = 0; + egress = 1; + } + Location location = 1; + string id = 2; + Direction direction = 3; + string ethertype = 4; + uint32 port_range_min = 5; + uint32 port_range_max = 6; + string protocol = 7; + string remote_ip_prefix = 8; + string security_group_id = 9; + string remote_group_id = 10; + map properties = 99; +} + +message SecurityGroupRuleList { + repeated SecurityGroupRule rules = 1; +} + +message SecurityGroup { + Location location = 1; + string id = 2; + string name = 3; + string description = 4; + repeated SecurityGroupRule rules = 5; + map properties = 99; +} + +message SecurityGroupList { + repeated SecurityGroup security_groups = 1; +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..92d861e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +pbr>=1.6 +grpcio diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..7ee1c4a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = oaktreemodel +summary = Base protobuf data model for oaktree +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + Programming Language :: Python :: 3.4 + +[files] +packages = + oaktree_model diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..056c16c --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +# +# 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 FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..55f27c9 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,17 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +hacking<0.11,>=0.10.0 + +grpcio-tools + +coverage>=3.6 +discover +python-subunit>=0.0.18 +sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 +oslosphinx>=2.5.0 # Apache-2.0 +oslotest>=1.10.0 # Apache-2.0 +testrepository>=0.0.18 +testscenarios>=0.4 +testtools>=1.4.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0179283 --- /dev/null +++ b/tox.ini @@ -0,0 +1,32 @@ +[tox] +minversion = 1.6 +envlist = py34,py27,pypy,pep8 +skipsdist = True + +[testenv] +usedevelop = True +install_command = {toxinidir}/tox_install_python.sh {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/test-requirements.txt +commands = python setup.py test --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = flake8 + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py test --coverage --testr-args='{posargs}' + +[testenv:docs] +commands = python setup.py build_sphinx + +[testenv:debug] +commands = oslo_debug_helper {posargs} + +[flake8] +show-source = True +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*_pb2.py diff --git a/tox_install_python.sh b/tox_install_python.sh new file mode 100755 index 0000000..588b1cf --- /dev/null +++ b/tox_install_python.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Copyright (c) 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +# +# 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. + +./build.sh +pip install -U $*