Compare commits
75 commits
Author | SHA1 | Date | |
---|---|---|---|
|
7b0c75450b | ||
|
235f854087 | ||
|
4fc4953ec4 | ||
|
119d1c429b | ||
|
a8a7cf779f | ||
|
98f2cab4a2 | ||
|
09628391cc | ||
|
f72fdacfb0 | ||
|
55cf9bcb70 | ||
|
fe4a0dc06e | ||
|
d67b8ca1d7 | ||
|
ecd59f7a8d | ||
|
5d75dcc15e | ||
|
9a70711537 | ||
|
203f178d68 | ||
|
9584266b71 | ||
|
6f20f5b62f | ||
|
04471c6918 | ||
|
dbad078d95 | ||
|
b9db36520c | ||
|
2c795debfd | ||
|
c553f67d4e | ||
|
461b23400c | ||
|
9b3593e9d9 | ||
|
8d67d8c2f3 | ||
|
e13349db26 | ||
|
afcdaa84b8 | ||
|
51597ecb32 | ||
|
acbe9ad9e5 | ||
|
4a0cbcd770 | ||
|
b776bd301d | ||
|
e4e8a1c0b3 | ||
|
71d41de2e4 | ||
|
84e8762495 | ||
|
11c71b0463 | ||
|
8f9a678b7d | ||
|
fdd94e9bea | ||
|
67b37d5a42 | ||
|
56b325ed80 | ||
|
ef421f60c3 | ||
|
c4691c7347 | ||
|
533591ab89 | ||
|
0c00765995 | ||
|
0b43a58b15 | ||
|
992e52eba2 | ||
|
0c32a7e683 | ||
|
e1906542a6 | ||
|
005980fc44 | ||
|
98b4061513 | ||
|
e00e0a0492 | ||
|
5836ede37b | ||
|
b0c25e9013 | ||
|
76300782ba | ||
|
c1be2fe62b | ||
|
133938b307 | ||
|
c071e5ca62 | ||
|
c00b83b14c | ||
|
47d955d4a4 | ||
|
99b03c1254 | ||
|
7967270b3b | ||
|
54378b2d8a | ||
|
59e3a7065e | ||
|
cec9c001fb | ||
|
366599fb80 | ||
|
356978cb42 | ||
|
3e4590dcc0 | ||
|
b6effe66b7 | ||
|
848b5f7971 | ||
|
d747a48626 | ||
|
573e45a59c | ||
|
8a9a97c150 | ||
|
1146736c2b | ||
|
c65a47f6e2 | ||
|
4471c62659 | ||
|
a23bd1b2cc |
2208 changed files with 37284 additions and 415036 deletions
5
.aurora-config/security.ini
Normal file
5
.aurora-config/security.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[users]
|
||||
aurora = secret, admin
|
||||
|
||||
[roles]
|
||||
admin = *
|
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
gen-go/ linguist-generated=true
|
||||
vendor/ linguist-generated=true
|
||||
Gopkg.lock linguist-generated=true
|
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -8,6 +8,17 @@ _obj
|
|||
_test
|
||||
.idea
|
||||
|
||||
# Thrift library comes with a lot of other files we don't need.
|
||||
# Ignore everything but the files we do need
|
||||
vendor/github.com/apache/thrift/*
|
||||
!vendor/github.com/apache/thrift/lib/
|
||||
|
||||
vendor/github.com/apache/thrift/lib/*
|
||||
!vendor/github.com/apache/thrift/lib/go/
|
||||
|
||||
vendor/github.com/apache/thrift/lib/go/*
|
||||
!vendor/github.com/apache/thrift/lib/go/thrift/
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
|
|
@ -3,7 +3,7 @@ sudo: required
|
|||
language: go
|
||||
|
||||
go:
|
||||
- "1.10.x"
|
||||
- "1.11.x"
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
34
Gopkg.lock
generated
34
Gopkg.lock
generated
|
@ -2,43 +2,59 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
branch = "0.10.0-http-client-fix"
|
||||
name = "git.apache.org/thrift.git"
|
||||
branch = "0.12.0"
|
||||
digest = "1:89696c38cec777120b8b1bb5e2d363d655cf2e1e7d8c851919aaa0fd576d9b86"
|
||||
name = "github.com/apache/thrift"
|
||||
packages = ["lib/go/thrift"]
|
||||
revision = "cb1afec972a85791e9b24a04b60fc9dbbfc3cda3"
|
||||
source = "github.com/rdelval/thrift"
|
||||
pruneopts = ""
|
||||
revision = "384647d290e2e4a55a14b1b7ef1b7e66293a2c33"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0deddd908b6b4b768cfc272c16ee61e7088a60f7fe2f06c547bd3d8e1f8b8e77"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
pruneopts = ""
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:df48fb76fb2a40edea0c9b3d960bc95e326660d82ff1114e1f88001f7a236b40"
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411"
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
pruneopts = ""
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:78bea5e26e82826dacc5fd64a1013a6711b7075ec8072819b89e6ad76cb8196d"
|
||||
name = "github.com/samuel/go-zookeeper"
|
||||
packages = ["zk"]
|
||||
pruneopts = ""
|
||||
revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c587772fb8ad29ad4db67575dad25ba17a51f072ff18a22b4f0257a4d9c24f75"
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
|
||||
version = "v1.2.0"
|
||||
pruneopts = ""
|
||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||
version = "v1.2.2"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "fdb631400420ca7299ad56b66175c9157ca073e3de52f666a84fc1d6fa893978"
|
||||
input-imports = [
|
||||
"github.com/apache/thrift/lib/go/thrift",
|
||||
"github.com/pkg/errors",
|
||||
"github.com/samuel/go-zookeeper/zk",
|
||||
"github.com/stretchr/testify/assert",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[[constraint]]
|
||||
name = "git.apache.org/thrift.git"
|
||||
branch = "0.10.0-http-client-fix"
|
||||
source = "github.com/rdelval/thrift"
|
||||
name = "github.com/apache/thrift"
|
||||
branch = "0.12.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/pkg/errors"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# gorealis [](https://godoc.org/github.com/paypal/gorealis) [](https://travis-ci.org/paypal/gorealis) [](https://codecov.io/gh/paypal/gorealis)
|
||||
# gorealis [](https://godoc.org/github.com/paypal/gorealis) [](https://travis-ci.org/paypal/gorealis) [](https://codecov.io/gh/paypal/gorealis/branch/master-v2.0)
|
||||
|
||||
Go library for interacting with [Apache Aurora](https://github.com/apache/aurora).
|
||||
|
||||
|
|
11
clusters.go
11
clusters.go
|
@ -54,3 +54,14 @@ func LoadClusters(config string) (map[string]Cluster, error) {
|
|||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func GetDefaultClusterFromZKUrl(zkURL string) *Cluster {
|
||||
return &Cluster{
|
||||
Name: "defaultCluster",
|
||||
AuthMechanism: "UNAUTHENTICATED",
|
||||
ZK: zkURL,
|
||||
SchedZKPath: "/aurora/scheduler",
|
||||
AgentRunDir: "latest",
|
||||
AgentRoot: "/var/lib/mesos",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/paypal/gorealis"
|
||||
realis "github.com/paypal/gorealis/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
39
container.go
39
container.go
|
@ -15,35 +15,31 @@
|
|||
package realis
|
||||
|
||||
import (
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
type Container interface {
|
||||
Build() *aurora.Container
|
||||
}
|
||||
|
||||
type MesosContainer struct {
|
||||
container *aurora.MesosContainer
|
||||
}
|
||||
|
||||
type DockerContainer struct {
|
||||
container *aurora.DockerContainer
|
||||
}
|
||||
|
||||
func NewDockerContainer() DockerContainer {
|
||||
return DockerContainer{container: aurora.NewDockerContainer()}
|
||||
func NewDockerContainer() *DockerContainer {
|
||||
return &DockerContainer{container: aurora.NewDockerContainer()}
|
||||
}
|
||||
|
||||
func (c DockerContainer) Build() *aurora.Container {
|
||||
func (c *DockerContainer) Build() *aurora.Container {
|
||||
return &aurora.Container{Docker: c.container}
|
||||
}
|
||||
|
||||
func (c DockerContainer) Image(image string) DockerContainer {
|
||||
func (c *DockerContainer) Image(image string) *DockerContainer {
|
||||
c.container.Image = image
|
||||
return c
|
||||
}
|
||||
|
||||
func (c DockerContainer) AddParameter(name, value string) DockerContainer {
|
||||
func (c *DockerContainer) AddParameter(name, value string) *DockerContainer {
|
||||
c.container.Parameters = append(c.container.Parameters, &aurora.DockerParameter{
|
||||
Name: name,
|
||||
Value: value,
|
||||
|
@ -51,15 +47,19 @@ func (c DockerContainer) AddParameter(name, value string) DockerContainer {
|
|||
return c
|
||||
}
|
||||
|
||||
func NewMesosContainer() MesosContainer {
|
||||
return MesosContainer{container: aurora.NewMesosContainer()}
|
||||
type MesosContainer struct {
|
||||
container *aurora.MesosContainer
|
||||
}
|
||||
|
||||
func (c MesosContainer) Build() *aurora.Container {
|
||||
func NewMesosContainer() *MesosContainer {
|
||||
return &MesosContainer{container: aurora.NewMesosContainer()}
|
||||
}
|
||||
|
||||
func (c *MesosContainer) Build() *aurora.Container {
|
||||
return &aurora.Container{Mesos: c.container}
|
||||
}
|
||||
|
||||
func (c MesosContainer) DockerImage(name, tag string) MesosContainer {
|
||||
func (c *MesosContainer) DockerImage(name, tag string) *MesosContainer {
|
||||
if c.container.Image == nil {
|
||||
c.container.Image = aurora.NewImage()
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (c MesosContainer) DockerImage(name, tag string) MesosContainer {
|
|||
return c
|
||||
}
|
||||
|
||||
func (c MesosContainer) AppcImage(name, imageId string) MesosContainer {
|
||||
func (c *MesosContainer) AppcImage(name, imageId string) *MesosContainer {
|
||||
if c.container.Image == nil {
|
||||
c.container.Image = aurora.NewImage()
|
||||
}
|
||||
|
@ -76,3 +76,12 @@ func (c MesosContainer) AppcImage(name, imageId string) MesosContainer {
|
|||
c.container.Image.Appc = &aurora.AppcImage{Name: name, ImageId: imageId}
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *MesosContainer) AddVolume(hostPath, containerPath string, mode aurora.Mode) *MesosContainer {
|
||||
c.container.Volumes = append(c.container.Volumes, &aurora.Volume{
|
||||
HostPath: hostPath,
|
||||
ContainerPath: containerPath,
|
||||
Mode: mode})
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
@ -65,6 +65,12 @@ services:
|
|||
CLUSTER_NAME: test-cluster
|
||||
ZK_ENDPOINTS: "192.168.33.2:2181"
|
||||
MESOS_MASTER: "zk://192.168.33.2:2181/mesos"
|
||||
EXTRA_SCHEDULER_ARGS: >
|
||||
-http_authentication_mechanism=BASIC
|
||||
-shiro_realm_modules=INI_AUTHNZ
|
||||
-shiro_ini_path=/etc/aurora/security.ini
|
||||
volumes:
|
||||
- ./.aurora-config:/etc/aurora
|
||||
networks:
|
||||
aurora_cluster:
|
||||
ipv4_address: 192.168.33.7
|
||||
|
|
15
errors.go
15
errors.go
|
@ -17,7 +17,7 @@ package realis
|
|||
// Using a pattern described by Dave Cheney to differentiate errors
|
||||
// https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
|
||||
|
||||
// Timeout errors are returned when a function is unable to continue executing due
|
||||
// Timedout errors are returned when a function is unable to continue executing due
|
||||
// to a time constraint or meeting a set number of retries.
|
||||
type timeout interface {
|
||||
Timedout() bool
|
||||
|
@ -28,6 +28,19 @@ func IsTimeout(err error) bool {
|
|||
return ok && temp.Timedout()
|
||||
}
|
||||
|
||||
type timeoutErr struct {
|
||||
error
|
||||
timedout bool
|
||||
}
|
||||
|
||||
func (r *timeoutErr) Timedout() bool {
|
||||
return r.timedout
|
||||
}
|
||||
|
||||
func newTimedoutError(err error) *timeoutErr {
|
||||
return &timeoutErr{error: err, timedout: true}
|
||||
}
|
||||
|
||||
// retryErr is a superset of timeout which includes extra context
|
||||
// with regards to our retry mechanism. This is done in order to make sure
|
||||
// that our retry mechanism works as expected through our tests and should
|
||||
|
|
|
@ -17,24 +17,22 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/paypal/gorealis"
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/response"
|
||||
realis "github.com/paypal/gorealis/v2"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string
|
||||
var caCertsPath string
|
||||
var clientKey, clientCert string
|
||||
|
||||
var CONNECTION_TIMEOUT = 20000
|
||||
var ConnectionTimeout = 20 * time.Second
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&cmd, "cmd", "", "Job request type to send to Aurora Scheduler")
|
||||
flag.StringVar(&cmd, "cmd", "", "Aurora Job request type to send to Aurora Scheduler")
|
||||
flag.StringVar(&executor, "executor", "thermos", "Executor to use")
|
||||
flag.StringVar(&url, "url", "", "URL at which the Aurora Scheduler exists as [url]:[port]")
|
||||
flag.StringVar(&clustersConfig, "clusters", "", "Location of the clusters.json file used by aurora.")
|
||||
|
@ -74,15 +72,14 @@ func init() {
|
|||
|
||||
func main() {
|
||||
|
||||
var job realis.Job
|
||||
var job *realis.AuroraJob
|
||||
var err error
|
||||
var monitor *realis.Monitor
|
||||
var r realis.Realis
|
||||
var r *realis.Client
|
||||
|
||||
clientOptions := []realis.ClientOption{
|
||||
realis.BasicAuth(username, password),
|
||||
realis.ThriftJSON(),
|
||||
realis.TimeoutMS(CONNECTION_TIMEOUT),
|
||||
realis.Timeout(ConnectionTimeout),
|
||||
realis.BackOff(realis.Backoff{
|
||||
Steps: 2,
|
||||
Duration: 10 * time.Second,
|
||||
|
@ -92,7 +89,6 @@ func main() {
|
|||
realis.Debug(),
|
||||
}
|
||||
|
||||
//check if zkUrl is available.
|
||||
if zkUrl != "" {
|
||||
fmt.Println("zkUrl: ", zkUrl)
|
||||
clientOptions = append(clientOptions, realis.ZKUrl(zkUrl))
|
||||
|
@ -101,39 +97,36 @@ func main() {
|
|||
}
|
||||
|
||||
if caCertsPath != "" {
|
||||
clientOptions = append(clientOptions, realis.Certspath(caCertsPath))
|
||||
clientOptions = append(clientOptions, realis.CertsPath(caCertsPath))
|
||||
}
|
||||
|
||||
if clientKey != "" && clientCert != "" {
|
||||
clientOptions = append(clientOptions, realis.ClientCerts(clientKey, clientCert))
|
||||
}
|
||||
|
||||
r, err = realis.NewRealisClient(clientOptions...)
|
||||
r, err = realis.NewClient(clientOptions...)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
monitor = &realis.Monitor{r}
|
||||
defer r.Close()
|
||||
|
||||
switch executor {
|
||||
case "thermos":
|
||||
payload, err := ioutil.ReadFile("examples/thermos_payload.json")
|
||||
if err != nil {
|
||||
log.Fatalln("Error reading json config file: ", err)
|
||||
}
|
||||
thermosExec := realis.ThermosExecutor{}
|
||||
thermosExec.AddProcess(realis.NewThermosProcess("boostrap", "echo bootsrapping")).
|
||||
AddProcess(realis.NewThermosProcess("hello_gorealis", "while true; do echo hello world from gorealis; sleep 10; done"))
|
||||
|
||||
job = realis.NewJob().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("hello_world_from_gorealis").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(payload)).
|
||||
CPU(1).
|
||||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
InstanceCount(1).
|
||||
AddPorts(1)
|
||||
AddPorts(1).
|
||||
ThermosExecutor(thermosExec)
|
||||
case "compose":
|
||||
job = realis.NewJob().
|
||||
Environment("prod").
|
||||
|
@ -167,14 +160,13 @@ func main() {
|
|||
switch cmd {
|
||||
case "create":
|
||||
fmt.Println("Creating job")
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
if ok, mErr := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50); !ok || mErr != nil {
|
||||
_, err := r.KillJob(job.JobKey())
|
||||
if ok, mErr := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 5*time.Second, 50*time.Second); !ok || mErr != nil {
|
||||
err := r.KillJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
@ -184,18 +176,17 @@ func main() {
|
|||
case "createService":
|
||||
// Create a service with three instances using the update API instead of the createJob API
|
||||
fmt.Println("Creating service")
|
||||
settings := realis.NewUpdateSettings()
|
||||
job.InstanceCount(3)
|
||||
resp, result, err := r.CreateService(job, settings)
|
||||
settings := realis.JobUpdateFromAuroraTask(job.AuroraTask()).InstanceCount(3)
|
||||
|
||||
result, err := r.CreateService(settings)
|
||||
if err != nil {
|
||||
log.Println("error: ", err)
|
||||
log.Fatal("response: ", resp.String())
|
||||
log.Fatal("error: ", err)
|
||||
}
|
||||
fmt.Println(result.String())
|
||||
|
||||
if ok, mErr := monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil {
|
||||
_, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out")
|
||||
_, err = r.KillJob(job.JobKey())
|
||||
if ok, mErr := r.MonitorJobUpdate(*result.GetKey(), 5*time.Second, 180*time.Second); !ok || mErr != nil {
|
||||
err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out")
|
||||
err = r.KillJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -206,14 +197,13 @@ func main() {
|
|||
fmt.Println("Creating a docker based job")
|
||||
container := realis.NewDockerContainer().Image("python:2.7").AddParameter("network", "host")
|
||||
job.Container(container)
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 10, 300); !ok || err != nil {
|
||||
_, err := r.KillJob(job.JobKey())
|
||||
if ok, err := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 10*time.Second, 300*time.Second); !ok || err != nil {
|
||||
err := r.KillJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -223,14 +213,13 @@ func main() {
|
|||
fmt.Println("Creating a docker based job")
|
||||
container := realis.NewMesosContainer().DockerImage("python", "2.7")
|
||||
job.Container(container)
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 10, 300); !ok || err != nil {
|
||||
_, err := r.KillJob(job.JobKey())
|
||||
if ok, err := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 10*time.Second, 300*time.Second); !ok || err != nil {
|
||||
err := r.KillJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -241,50 +230,44 @@ func main() {
|
|||
// Cron config
|
||||
job.CronSchedule("* * * * *")
|
||||
job.IsService(false)
|
||||
resp, err := r.ScheduleCronJob(job)
|
||||
err := r.ScheduleCronJob(job)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "startCron":
|
||||
fmt.Println("Starting a Cron job")
|
||||
resp, err := r.StartCronJob(job.JobKey())
|
||||
err := r.StartCronJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "descheduleCron":
|
||||
fmt.Println("Descheduling a Cron job")
|
||||
resp, err := r.DescheduleCronJob(job.JobKey())
|
||||
err := r.DescheduleCronJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "kill":
|
||||
fmt.Println("Killing job")
|
||||
|
||||
resp, err := r.KillJob(job.JobKey())
|
||||
err := r.KillJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if ok, err := monitor.Instances(job.JobKey(), 0, 5, 50); !ok || err != nil {
|
||||
if ok, err := r.MonitorInstances(job.JobKey(), 0, 5*time.Second, 50*time.Second); !ok || err != nil {
|
||||
log.Fatal("Unable to kill all instances of job")
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "restart":
|
||||
fmt.Println("Restarting job")
|
||||
resp, err := r.RestartJob(job.JobKey())
|
||||
err := r.RestartJob(job.JobKey())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "liveCount":
|
||||
fmt.Println("Getting instance count")
|
||||
|
||||
|
@ -303,114 +286,110 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println("Number of live instances: ", len(live))
|
||||
fmt.Println("Active instances: ", live)
|
||||
|
||||
case "flexUp":
|
||||
fmt.Println("Flexing up job")
|
||||
|
||||
numOfInstances := int32(4)
|
||||
numOfInstances := 4
|
||||
|
||||
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
currInstances := int32(len(live))
|
||||
currInstances := len(live)
|
||||
fmt.Println("Current num of instances: ", currInstances)
|
||||
var instId int32
|
||||
for k := range live {
|
||||
instId = k
|
||||
}
|
||||
resp, err := r.AddInstances(aurora.InstanceKey{
|
||||
JobKey: job.JobKey(),
|
||||
InstanceId: instId,
|
||||
|
||||
key := job.JobKey()
|
||||
err = r.AddInstances(aurora.InstanceKey{
|
||||
JobKey: &key,
|
||||
InstanceId: live[0],
|
||||
},
|
||||
numOfInstances)
|
||||
int32(numOfInstances))
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if ok, err := monitor.Instances(job.JobKey(), currInstances+numOfInstances, 5, 50); !ok || err != nil {
|
||||
if ok, err := r.MonitorInstances(job.JobKey(), int32(currInstances+numOfInstances), 5*time.Second, 50*time.Second); !ok || err != nil {
|
||||
fmt.Println("Flexing up failed")
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "flexDown":
|
||||
fmt.Println("Flexing down job")
|
||||
|
||||
numOfInstances := int32(2)
|
||||
numOfInstances := 2
|
||||
|
||||
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
currInstances := int32(len(live))
|
||||
currInstances := len(live)
|
||||
fmt.Println("Current num of instances: ", currInstances)
|
||||
|
||||
resp, err := r.RemoveInstances(job.JobKey(), numOfInstances)
|
||||
err = r.RemoveInstances(job.JobKey(), numOfInstances)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if ok, err := monitor.Instances(job.JobKey(), currInstances-numOfInstances, 5, 100); !ok || err != nil {
|
||||
if ok, err := r.MonitorInstances(job.JobKey(), int32(currInstances-numOfInstances), 5*time.Second, 100*time.Second); !ok || err != nil {
|
||||
fmt.Println("flexDown failed")
|
||||
}
|
||||
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "update":
|
||||
fmt.Println("Updating a job with with more RAM and to 5 instances")
|
||||
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var instId int32
|
||||
for k := range live {
|
||||
instId = k
|
||||
}
|
||||
|
||||
key := job.JobKey()
|
||||
taskConfig, err := r.FetchTaskConfig(aurora.InstanceKey{
|
||||
JobKey: job.JobKey(),
|
||||
InstanceId: instId,
|
||||
JobKey: &key,
|
||||
InstanceId: live[0],
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
updateJob := realis.NewDefaultUpdateJob(taskConfig)
|
||||
updateJob.InstanceCount(5).RAM(128)
|
||||
updateJob := realis.JobUpdateFromConfig(taskConfig).InstanceCount(5).RAM(128)
|
||||
|
||||
resp, err := r.StartJobUpdate(updateJob, "")
|
||||
result, err := r.StartJobUpdate(updateJob, "")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
jobUpdateKey := response.JobUpdateKey(resp)
|
||||
monitor.JobUpdate(*jobUpdateKey, 5, 500)
|
||||
jobUpdateKey := result.GetKey()
|
||||
_, err = r.MonitorJobUpdate(*jobUpdateKey, 5*time.Second, 6*time.Minute)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
case "pauseJobUpdate":
|
||||
resp, err := r.PauseJobUpdate(&aurora.JobUpdateKey{
|
||||
Job: job.JobKey(),
|
||||
key := job.JobKey()
|
||||
err := r.PauseJobUpdate(&aurora.JobUpdateKey{
|
||||
Job: &key,
|
||||
ID: updateId,
|
||||
}, "")
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println("PauseJobUpdate response: ", resp.String())
|
||||
|
||||
case "resumeJobUpdate":
|
||||
resp, err := r.ResumeJobUpdate(&aurora.JobUpdateKey{
|
||||
Job: job.JobKey(),
|
||||
key := job.JobKey()
|
||||
err := r.ResumeJobUpdate(aurora.JobUpdateKey{
|
||||
Job: &key,
|
||||
ID: updateId,
|
||||
}, "")
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println("ResumeJobUpdate response: ", resp.String())
|
||||
|
||||
case "pulseJobUpdate":
|
||||
resp, err := r.PulseJobUpdate(&aurora.JobUpdateKey{
|
||||
Job: job.JobKey(),
|
||||
key := job.JobKey()
|
||||
resp, err := r.PulseJobUpdate(aurora.JobUpdateKey{
|
||||
Job: &key,
|
||||
ID: updateId,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -420,9 +399,10 @@ func main() {
|
|||
fmt.Println("PulseJobUpdate response: ", resp.String())
|
||||
|
||||
case "updateDetails":
|
||||
resp, err := r.JobUpdateDetails(aurora.JobUpdateQuery{
|
||||
key := job.JobKey()
|
||||
result, err := r.JobUpdateDetails(aurora.JobUpdateQuery{
|
||||
Key: &aurora.JobUpdateKey{
|
||||
Job: job.JobKey(),
|
||||
Job: &key,
|
||||
ID: updateId,
|
||||
},
|
||||
Limit: 1,
|
||||
|
@ -432,12 +412,13 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(response.JobUpdateDetails(resp))
|
||||
fmt.Println(result)
|
||||
|
||||
case "abortUpdate":
|
||||
fmt.Println("Abort update")
|
||||
resp, err := r.AbortJobUpdate(aurora.JobUpdateKey{
|
||||
Job: job.JobKey(),
|
||||
key := job.JobKey()
|
||||
err := r.AbortJobUpdate(aurora.JobUpdateKey{
|
||||
Job: &key,
|
||||
ID: updateId,
|
||||
},
|
||||
"")
|
||||
|
@ -445,12 +426,12 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "rollbackUpdate":
|
||||
fmt.Println("Abort update")
|
||||
resp, err := r.RollbackJobUpdate(aurora.JobUpdateKey{
|
||||
Job: job.JobKey(),
|
||||
key := job.JobKey()
|
||||
err := r.RollbackJobUpdate(aurora.JobUpdateKey{
|
||||
Job: &key,
|
||||
ID: updateId,
|
||||
},
|
||||
"")
|
||||
|
@ -458,7 +439,6 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(resp.String())
|
||||
|
||||
case "taskConfig":
|
||||
fmt.Println("Getting job info")
|
||||
|
@ -467,14 +447,10 @@ func main() {
|
|||
log.Fatal(err)
|
||||
|
||||
}
|
||||
var instId int32
|
||||
for k := range live {
|
||||
instId = k
|
||||
break
|
||||
}
|
||||
key := job.JobKey()
|
||||
config, err := r.FetchTaskConfig(aurora.InstanceKey{
|
||||
JobKey: job.JobKey(),
|
||||
InstanceId: instId,
|
||||
JobKey: &key,
|
||||
InstanceId: live[0],
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -485,9 +461,10 @@ func main() {
|
|||
|
||||
case "updatesummary":
|
||||
fmt.Println("Getting job update summary")
|
||||
key := job.JobKey()
|
||||
jobquery := &aurora.JobUpdateQuery{
|
||||
Role: &job.JobKey().Role,
|
||||
JobKey: job.JobKey(),
|
||||
Role: &key.Role,
|
||||
JobKey: &key,
|
||||
}
|
||||
updatesummary, err := r.GetJobUpdateSummaries(jobquery)
|
||||
if err != nil {
|
||||
|
@ -498,10 +475,11 @@ func main() {
|
|||
|
||||
case "taskStatus":
|
||||
fmt.Println("Getting task status")
|
||||
key := job.JobKey()
|
||||
taskQ := &aurora.TaskQuery{
|
||||
Role: &job.JobKey().Role,
|
||||
Environment: &job.JobKey().Environment,
|
||||
JobName: &job.JobKey().Name,
|
||||
Role: &key.Role,
|
||||
Environment: &key.Environment,
|
||||
JobName: &key.Name,
|
||||
}
|
||||
tasks, err := r.GetTaskStatus(taskQ)
|
||||
if err != nil {
|
||||
|
@ -513,10 +491,11 @@ func main() {
|
|||
|
||||
case "tasksWithoutConfig":
|
||||
fmt.Println("Getting task status")
|
||||
key := job.JobKey()
|
||||
taskQ := &aurora.TaskQuery{
|
||||
Role: &job.JobKey().Role,
|
||||
Environment: &job.JobKey().Environment,
|
||||
JobName: &job.JobKey().Name,
|
||||
Role: &key.Role,
|
||||
Environment: &key.Environment,
|
||||
JobName: &key.Name,
|
||||
}
|
||||
tasks, err := r.GetTasksWithoutConfigs(taskQ)
|
||||
if err != nil {
|
||||
|
@ -532,17 +511,17 @@ func main() {
|
|||
log.Fatal("No hosts specified to drain")
|
||||
}
|
||||
hosts := strings.Split(hostList, ",")
|
||||
_, result, err := r.DrainHosts(hosts...)
|
||||
_, err := r.DrainHosts(hosts...)
|
||||
if err != nil {
|
||||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResult, err := monitor.HostMaintenance(
|
||||
hostResult, err := r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
|
||||
5,
|
||||
10)
|
||||
5*time.Second,
|
||||
10*time.Second)
|
||||
if err != nil {
|
||||
for host, ok := range hostResult {
|
||||
if !ok {
|
||||
|
@ -552,8 +531,6 @@ func main() {
|
|||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
||||
fmt.Print(result.String())
|
||||
|
||||
case "SLADrainHosts":
|
||||
fmt.Println("Setting hosts to DRAINING using SLA aware draining")
|
||||
if hostList == "" {
|
||||
|
@ -563,17 +540,17 @@ func main() {
|
|||
|
||||
policy := aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 50.0}}
|
||||
|
||||
result, err := r.SLADrainHosts(&policy, 30, hosts...)
|
||||
_, err := r.SLADrainHosts(&policy, 30, hosts...)
|
||||
if err != nil {
|
||||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResult, err := monitor.HostMaintenance(
|
||||
hostResult, err := r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
|
||||
5,
|
||||
10)
|
||||
5*time.Second,
|
||||
10*time.Second)
|
||||
if err != nil {
|
||||
for host, ok := range hostResult {
|
||||
if !ok {
|
||||
|
@ -583,25 +560,23 @@ func main() {
|
|||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
||||
fmt.Print(result.String())
|
||||
|
||||
case "endMaintenance":
|
||||
fmt.Println("Setting hosts to ACTIVE")
|
||||
if hostList == "" {
|
||||
log.Fatal("No hosts specified to drain")
|
||||
}
|
||||
hosts := strings.Split(hostList, ",")
|
||||
_, result, err := r.EndMaintenance(hosts...)
|
||||
_, err := r.EndMaintenance(hosts...)
|
||||
if err != nil {
|
||||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResult, err := monitor.HostMaintenance(
|
||||
hostResult, err := r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
|
||||
5,
|
||||
10)
|
||||
5*time.Second,
|
||||
10*time.Second)
|
||||
if err != nil {
|
||||
for host, ok := range hostResult {
|
||||
if !ok {
|
||||
|
@ -611,14 +586,13 @@ func main() {
|
|||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
||||
fmt.Print(result.String())
|
||||
|
||||
case "getPendingReasons":
|
||||
fmt.Println("Getting pending reasons")
|
||||
key := job.JobKey()
|
||||
taskQ := &aurora.TaskQuery{
|
||||
Role: &job.JobKey().Role,
|
||||
Environment: &job.JobKey().Environment,
|
||||
JobName: &job.JobKey().Name,
|
||||
Role: &key.Role,
|
||||
Environment: &key.Environment,
|
||||
JobName: &key.Name,
|
||||
}
|
||||
reasons, err := r.GetPendingReason(taskQ)
|
||||
if err != nil {
|
||||
|
@ -630,7 +604,7 @@ func main() {
|
|||
|
||||
case "getJobs":
|
||||
fmt.Println("GetJobs...role: ", role)
|
||||
_, result, err := r.GetJobs(role)
|
||||
result, err := r.GetJobs(role)
|
||||
if err != nil {
|
||||
log.Fatalf("error: %+v\n", err.Error())
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/paypal/gorealis"
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
realis "github.com/paypal/gorealis/v2"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -125,7 +125,7 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func CreateRealisClient(config *Config) (realis.Realis, error) {
|
||||
func CreateRealisClient(config *Config) (*realis.Client, error) {
|
||||
var transportOption realis.ClientOption
|
||||
// Configuring transport protocol. If not transport is provided, then using JSON as the
|
||||
// default transport protocol.
|
||||
|
@ -157,7 +157,7 @@ func CreateRealisClient(config *Config) (realis.Realis, error) {
|
|||
clientOptions = append(clientOptions, realis.Debug())
|
||||
}
|
||||
|
||||
return realis.NewRealisClient(clientOptions...)
|
||||
return realis.NewClient(clientOptions...)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -165,7 +165,6 @@ func main() {
|
|||
fmt.Println(clientCreationErr)
|
||||
os.Exit(1)
|
||||
} else {
|
||||
monitor := &realis.Monitor{Client: r}
|
||||
defer r.Close()
|
||||
uris := job.URIs
|
||||
labels := job.Labels
|
||||
|
@ -205,20 +204,18 @@ func main() {
|
|||
}
|
||||
|
||||
fmt.Println("Creating Job...")
|
||||
if resp, jobCreationErr := r.CreateJob(auroraJob); jobCreationErr != nil {
|
||||
if jobCreationErr := r.CreateJob(auroraJob); jobCreationErr != nil {
|
||||
fmt.Println("Error creating Aurora job: ", jobCreationErr)
|
||||
os.Exit(1)
|
||||
} else {
|
||||
if resp.ResponseCode == aurora.ResponseCode_OK {
|
||||
if ok, monitorErr := monitor.Instances(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil {
|
||||
if _, jobErr := r.KillJob(auroraJob.JobKey()); jobErr !=
|
||||
nil {
|
||||
fmt.Println(jobErr)
|
||||
os.Exit(1)
|
||||
} else {
|
||||
fmt.Println("ok: ", ok)
|
||||
fmt.Println("jobErr: ", jobErr)
|
||||
}
|
||||
if ok, monitorErr := r.MonitorInstances(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil {
|
||||
if jobErr := r.KillJob(auroraJob.JobKey()); jobErr !=
|
||||
nil {
|
||||
fmt.Println(jobErr)
|
||||
os.Exit(1)
|
||||
} else {
|
||||
fmt.Println("ok: ", ok)
|
||||
fmt.Println("jobErr: ", jobErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
"environment": "prod",
|
||||
"health_check_config": {
|
||||
"initial_interval_secs": 15.0,
|
||||
"health_checker": {
|
||||
"http": {
|
||||
"expected_response_code": 0,
|
||||
"endpoint": "/health",
|
||||
"expected_response": "ok"
|
||||
}
|
||||
},
|
||||
"interval_secs": 10.0,
|
||||
"timeout_secs": 1.0,
|
||||
"max_consecutive_failures": 0
|
||||
},
|
||||
"name": "hello_world_from_gorealis",
|
||||
"service": false,
|
||||
"max_task_failures": 1,
|
||||
"cron_collision_policy": "KILL_EXISTING",
|
||||
"enable_hooks": false,
|
||||
"cluster": "devcluster",
|
||||
"task": {
|
||||
"processes": [
|
||||
{
|
||||
"daemon": false,
|
||||
"name": "hello",
|
||||
"ephemeral": false,
|
||||
"max_failures": 1,
|
||||
"min_duration": 5,
|
||||
"cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
|
||||
"final": false
|
||||
}
|
||||
],
|
||||
"name": "hello",
|
||||
"finalization_wait": 30,
|
||||
"max_failures": 1,
|
||||
"max_concurrency": 0,
|
||||
"resources": {
|
||||
"gpu": 0,
|
||||
"disk": 134217728,
|
||||
"ram": 134217728,
|
||||
"cpu": 1.0
|
||||
},
|
||||
"constraints": [
|
||||
{
|
||||
"order": [
|
||||
"hello"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"production": false,
|
||||
"role": "vagrant",
|
||||
"lifecycle": {
|
||||
"http": {
|
||||
"graceful_shutdown_endpoint": "/quitquitquit",
|
||||
"port": "health",
|
||||
"shutdown_endpoint": "/abortabortabort"
|
||||
}
|
||||
},
|
||||
"priority": 0
|
||||
}
|
28
examples/thermos_payload_minimal.json
Normal file
28
examples/thermos_payload_minimal.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"task": {
|
||||
"processes": [
|
||||
{
|
||||
"daemon": false,
|
||||
"name": "hello",
|
||||
"ephemeral": false,
|
||||
"max_failures": 1,
|
||||
"min_duration": 5,
|
||||
"cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
|
||||
"final": false
|
||||
}
|
||||
],
|
||||
"resources": {
|
||||
"gpu": 0,
|
||||
"disk": 134217728,
|
||||
"ram": 134217728,
|
||||
"cpu": 1.1
|
||||
},
|
||||
"constraints": [
|
||||
{
|
||||
"order": [
|
||||
"hello"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
7
gen-go/apache/aurora/GoUnusedProtection__.go
Normal file
7
gen-go/apache/aurora/GoUnusedProtection__.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Autogenerated by Thrift Compiler (0.12.0)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package aurora
|
||||
|
||||
var GoUnusedProtection__ int;
|
||||
|
54
gen-go/apache/aurora/auroraAPI-consts.go
Normal file
54
gen-go/apache/aurora/auroraAPI-consts.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
// Autogenerated by Thrift Compiler (0.12.0)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package aurora
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"reflect"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = context.Background
|
||||
var _ = reflect.DeepEqual
|
||||
var _ = bytes.Equal
|
||||
|
||||
const AURORA_EXECUTOR_NAME = "AuroraExecutor"
|
||||
var ACTIVE_STATES []ScheduleStatus
|
||||
var SLAVE_ASSIGNED_STATES []ScheduleStatus
|
||||
var LIVE_STATES []ScheduleStatus
|
||||
var TERMINAL_STATES []ScheduleStatus
|
||||
const GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$"
|
||||
const GOOD_IDENTIFIER_PATTERN_JVM = "^[\\w\\-\\.]+$"
|
||||
const GOOD_IDENTIFIER_PATTERN_PYTHON = "^[\\w\\-\\.]+$"
|
||||
var ACTIVE_JOB_UPDATE_STATES []JobUpdateStatus
|
||||
var AWAITNG_PULSE_JOB_UPDATE_STATES []JobUpdateStatus
|
||||
const BYPASS_LEADER_REDIRECT_HEADER_NAME = "Bypass-Leader-Redirect"
|
||||
const TASK_FILESYSTEM_MOUNT_POINT = "taskfs"
|
||||
|
||||
func init() {
|
||||
ACTIVE_STATES = []ScheduleStatus{
|
||||
9, 17, 6, 0, 13, 12, 2, 1, 18, 16, }
|
||||
|
||||
SLAVE_ASSIGNED_STATES = []ScheduleStatus{
|
||||
9, 17, 6, 13, 12, 2, 18, 1, }
|
||||
|
||||
LIVE_STATES = []ScheduleStatus{
|
||||
6, 13, 12, 17, 18, 2, }
|
||||
|
||||
TERMINAL_STATES = []ScheduleStatus{
|
||||
4, 3, 5, 7, }
|
||||
|
||||
ACTIVE_JOB_UPDATE_STATES = []JobUpdateStatus{
|
||||
0, 1, 2, 3, 9, 10, }
|
||||
|
||||
AWAITNG_PULSE_JOB_UPDATE_STATES = []JobUpdateStatus{
|
||||
9, 10, }
|
||||
|
||||
}
|
||||
|
29020
gen-go/apache/aurora/auroraAPI.go
Normal file
29020
gen-go/apache/aurora/auroraAPI.go
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,89 +0,0 @@
|
|||
// Autogenerated by Thrift Compiler (0.9.3)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package aurora
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = bytes.Equal
|
||||
|
||||
const AURORA_EXECUTOR_NAME = "AuroraExecutor"
|
||||
|
||||
var ACTIVE_STATES map[ScheduleStatus]bool
|
||||
var SLAVE_ASSIGNED_STATES map[ScheduleStatus]bool
|
||||
var LIVE_STATES map[ScheduleStatus]bool
|
||||
var TERMINAL_STATES map[ScheduleStatus]bool
|
||||
|
||||
const GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$"
|
||||
const GOOD_IDENTIFIER_PATTERN_JVM = "^[\\w\\-\\.]+$"
|
||||
const GOOD_IDENTIFIER_PATTERN_PYTHON = "^[\\w\\-\\.]+$"
|
||||
|
||||
var ACTIVE_JOB_UPDATE_STATES map[JobUpdateStatus]bool
|
||||
var AWAITNG_PULSE_JOB_UPDATE_STATES map[JobUpdateStatus]bool
|
||||
|
||||
const BYPASS_LEADER_REDIRECT_HEADER_NAME = "Bypass-Leader-Redirect"
|
||||
const TASK_FILESYSTEM_MOUNT_POINT = "taskfs"
|
||||
|
||||
func init() {
|
||||
ACTIVE_STATES = map[ScheduleStatus]bool{
|
||||
9: true,
|
||||
17: true,
|
||||
6: true,
|
||||
0: true,
|
||||
13: true,
|
||||
12: true,
|
||||
2: true,
|
||||
1: true,
|
||||
18: true,
|
||||
16: true,
|
||||
}
|
||||
|
||||
SLAVE_ASSIGNED_STATES = map[ScheduleStatus]bool{
|
||||
9: true,
|
||||
17: true,
|
||||
6: true,
|
||||
13: true,
|
||||
12: true,
|
||||
2: true,
|
||||
18: true,
|
||||
1: true,
|
||||
}
|
||||
|
||||
LIVE_STATES = map[ScheduleStatus]bool{
|
||||
6: true,
|
||||
13: true,
|
||||
12: true,
|
||||
17: true,
|
||||
18: true,
|
||||
2: true,
|
||||
}
|
||||
|
||||
TERMINAL_STATES = map[ScheduleStatus]bool{
|
||||
4: true,
|
||||
3: true,
|
||||
5: true,
|
||||
7: true,
|
||||
}
|
||||
|
||||
ACTIVE_JOB_UPDATE_STATES = map[JobUpdateStatus]bool{
|
||||
0: true,
|
||||
1: true,
|
||||
2: true,
|
||||
3: true,
|
||||
9: true,
|
||||
10: true,
|
||||
}
|
||||
|
||||
AWAITNG_PULSE_JOB_UPDATE_STATES = map[JobUpdateStatus]bool{
|
||||
9: true,
|
||||
10: true,
|
||||
}
|
||||
|
||||
}
|
|
@ -1,382 +1,411 @@
|
|||
// Autogenerated by Thrift Compiler (0.9.3)
|
||||
// Autogenerated by Thrift Compiler (0.12.0)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"apache/aurora"
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
"math"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"apache/aurora"
|
||||
)
|
||||
|
||||
|
||||
func Usage() {
|
||||
fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
|
||||
flag.PrintDefaults()
|
||||
fmt.Fprintln(os.Stderr, "\nFunctions:")
|
||||
fmt.Fprintln(os.Stderr, " Response getRoleSummary()")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobSummary(string role)")
|
||||
fmt.Fprintln(os.Stderr, " Response getTasksStatus(TaskQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getTasksWithoutConfigs(TaskQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getPendingReason(TaskQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getConfigSummary(JobKey job)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobs(string ownerRole)")
|
||||
fmt.Fprintln(os.Stderr, " Response getQuota(string ownerRole)")
|
||||
fmt.Fprintln(os.Stderr, " Response populateJobConfig(JobConfiguration description)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobUpdateSummaries(JobUpdateQuery jobUpdateQuery)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobUpdateDetails(JobUpdateQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobUpdateDiff(JobUpdateRequest request)")
|
||||
fmt.Fprintln(os.Stderr, " Response getTierConfigs()")
|
||||
fmt.Fprintln(os.Stderr)
|
||||
os.Exit(0)
|
||||
fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
|
||||
flag.PrintDefaults()
|
||||
fmt.Fprintln(os.Stderr, "\nFunctions:")
|
||||
fmt.Fprintln(os.Stderr, " Response getRoleSummary()")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobSummary(string role)")
|
||||
fmt.Fprintln(os.Stderr, " Response getTasksStatus(TaskQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getTasksWithoutConfigs(TaskQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getPendingReason(TaskQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getConfigSummary(JobKey job)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobs(string ownerRole)")
|
||||
fmt.Fprintln(os.Stderr, " Response getQuota(string ownerRole)")
|
||||
fmt.Fprintln(os.Stderr, " Response populateJobConfig(JobConfiguration description)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobUpdateSummaries(JobUpdateQuery jobUpdateQuery)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobUpdateDetails(JobUpdateQuery query)")
|
||||
fmt.Fprintln(os.Stderr, " Response getJobUpdateDiff(JobUpdateRequest request)")
|
||||
fmt.Fprintln(os.Stderr, " Response getTierConfigs()")
|
||||
fmt.Fprintln(os.Stderr)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
type httpHeaders map[string]string
|
||||
|
||||
func (h httpHeaders) String() string {
|
||||
var m map[string]string = h
|
||||
return fmt.Sprintf("%s", m)
|
||||
}
|
||||
|
||||
func (h httpHeaders) Set(value string) error {
|
||||
parts := strings.Split(value, ": ")
|
||||
if len(parts) != 2 {
|
||||
return fmt.Errorf("header should be of format 'Key: Value'")
|
||||
}
|
||||
h[parts[0]] = parts[1]
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = Usage
|
||||
var host string
|
||||
var port int
|
||||
var protocol string
|
||||
var urlString string
|
||||
var framed bool
|
||||
var useHttp bool
|
||||
var parsedUrl url.URL
|
||||
var trans thrift.TTransport
|
||||
_ = strconv.Atoi
|
||||
_ = math.Abs
|
||||
flag.Usage = Usage
|
||||
flag.StringVar(&host, "h", "localhost", "Specify host and port")
|
||||
flag.IntVar(&port, "p", 9090, "Specify port")
|
||||
flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
|
||||
flag.StringVar(&urlString, "u", "", "Specify the url")
|
||||
flag.BoolVar(&framed, "framed", false, "Use framed transport")
|
||||
flag.BoolVar(&useHttp, "http", false, "Use http")
|
||||
flag.Parse()
|
||||
|
||||
if len(urlString) > 0 {
|
||||
parsedUrl, err := url.Parse(urlString)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
|
||||
flag.Usage()
|
||||
}
|
||||
host = parsedUrl.Host
|
||||
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
|
||||
} else if useHttp {
|
||||
_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
|
||||
flag.Usage()
|
||||
}
|
||||
}
|
||||
|
||||
cmd := flag.Arg(0)
|
||||
var err error
|
||||
if useHttp {
|
||||
trans, err = thrift.NewTHttpClient(parsedUrl.String())
|
||||
} else {
|
||||
portStr := fmt.Sprint(port)
|
||||
if strings.Contains(host, ":") {
|
||||
host, portStr, err = net.SplitHostPort(host)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error with host:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error resolving address:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if framed {
|
||||
trans = thrift.NewTFramedTransport(trans)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error creating transport", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer trans.Close()
|
||||
var protocolFactory thrift.TProtocolFactory
|
||||
switch protocol {
|
||||
case "compact":
|
||||
protocolFactory = thrift.NewTCompactProtocolFactory()
|
||||
break
|
||||
case "simplejson":
|
||||
protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
|
||||
break
|
||||
case "json":
|
||||
protocolFactory = thrift.NewTJSONProtocolFactory()
|
||||
break
|
||||
case "binary", "":
|
||||
protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
|
||||
break
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
|
||||
Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
client := aurora.NewReadOnlySchedulerClientFactory(trans, protocolFactory)
|
||||
if err := trans.Open(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
switch cmd {
|
||||
case "getRoleSummary":
|
||||
if flag.NArg()-1 != 0 {
|
||||
fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args")
|
||||
flag.Usage()
|
||||
}
|
||||
fmt.Print(client.GetRoleSummary())
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobSummary":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobSummary requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
argvalue0 := flag.Arg(1)
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobSummary(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getTasksStatus":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg81 := flag.Arg(1)
|
||||
mbTrans82 := thrift.NewTMemoryBufferLen(len(arg81))
|
||||
defer mbTrans82.Close()
|
||||
_, err83 := mbTrans82.WriteString(arg81)
|
||||
if err83 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory84 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt85 := factory84.GetProtocol(mbTrans82)
|
||||
argvalue0 := aurora.NewTaskQuery()
|
||||
err86 := argvalue0.Read(jsProt85)
|
||||
if err86 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetTasksStatus(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getTasksWithoutConfigs":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg87 := flag.Arg(1)
|
||||
mbTrans88 := thrift.NewTMemoryBufferLen(len(arg87))
|
||||
defer mbTrans88.Close()
|
||||
_, err89 := mbTrans88.WriteString(arg87)
|
||||
if err89 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory90 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt91 := factory90.GetProtocol(mbTrans88)
|
||||
argvalue0 := aurora.NewTaskQuery()
|
||||
err92 := argvalue0.Read(jsProt91)
|
||||
if err92 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetTasksWithoutConfigs(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getPendingReason":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg93 := flag.Arg(1)
|
||||
mbTrans94 := thrift.NewTMemoryBufferLen(len(arg93))
|
||||
defer mbTrans94.Close()
|
||||
_, err95 := mbTrans94.WriteString(arg93)
|
||||
if err95 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory96 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt97 := factory96.GetProtocol(mbTrans94)
|
||||
argvalue0 := aurora.NewTaskQuery()
|
||||
err98 := argvalue0.Read(jsProt97)
|
||||
if err98 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetPendingReason(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getConfigSummary":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg99 := flag.Arg(1)
|
||||
mbTrans100 := thrift.NewTMemoryBufferLen(len(arg99))
|
||||
defer mbTrans100.Close()
|
||||
_, err101 := mbTrans100.WriteString(arg99)
|
||||
if err101 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory102 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt103 := factory102.GetProtocol(mbTrans100)
|
||||
argvalue0 := aurora.NewJobKey()
|
||||
err104 := argvalue0.Read(jsProt103)
|
||||
if err104 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetConfigSummary(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobs":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobs requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
argvalue0 := flag.Arg(1)
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobs(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getQuota":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetQuota requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
argvalue0 := flag.Arg(1)
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetQuota(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "populateJobConfig":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg107 := flag.Arg(1)
|
||||
mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107))
|
||||
defer mbTrans108.Close()
|
||||
_, err109 := mbTrans108.WriteString(arg107)
|
||||
if err109 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory110 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt111 := factory110.GetProtocol(mbTrans108)
|
||||
argvalue0 := aurora.NewJobConfiguration()
|
||||
err112 := argvalue0.Read(jsProt111)
|
||||
if err112 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.PopulateJobConfig(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobUpdateSummaries":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg113 := flag.Arg(1)
|
||||
mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113))
|
||||
defer mbTrans114.Close()
|
||||
_, err115 := mbTrans114.WriteString(arg113)
|
||||
if err115 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory116 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt117 := factory116.GetProtocol(mbTrans114)
|
||||
argvalue0 := aurora.NewJobUpdateQuery()
|
||||
err118 := argvalue0.Read(jsProt117)
|
||||
if err118 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobUpdateSummaries(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobUpdateDetails":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg119 := flag.Arg(1)
|
||||
mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119))
|
||||
defer mbTrans120.Close()
|
||||
_, err121 := mbTrans120.WriteString(arg119)
|
||||
if err121 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory122 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt123 := factory122.GetProtocol(mbTrans120)
|
||||
argvalue0 := aurora.NewJobUpdateQuery()
|
||||
err124 := argvalue0.Read(jsProt123)
|
||||
if err124 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobUpdateDetails(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobUpdateDiff":
|
||||
if flag.NArg()-1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg125 := flag.Arg(1)
|
||||
mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125))
|
||||
defer mbTrans126.Close()
|
||||
_, err127 := mbTrans126.WriteString(arg125)
|
||||
if err127 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory128 := thrift.NewTSimpleJSONProtocolFactory()
|
||||
jsProt129 := factory128.GetProtocol(mbTrans126)
|
||||
argvalue0 := aurora.NewJobUpdateRequest()
|
||||
err130 := argvalue0.Read(jsProt129)
|
||||
if err130 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobUpdateDiff(value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getTierConfigs":
|
||||
if flag.NArg()-1 != 0 {
|
||||
fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args")
|
||||
flag.Usage()
|
||||
}
|
||||
fmt.Print(client.GetTierConfigs())
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "":
|
||||
Usage()
|
||||
break
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
|
||||
}
|
||||
flag.Usage = Usage
|
||||
var host string
|
||||
var port int
|
||||
var protocol string
|
||||
var urlString string
|
||||
var framed bool
|
||||
var useHttp bool
|
||||
headers := make(httpHeaders)
|
||||
var parsedUrl *url.URL
|
||||
var trans thrift.TTransport
|
||||
_ = strconv.Atoi
|
||||
_ = math.Abs
|
||||
flag.Usage = Usage
|
||||
flag.StringVar(&host, "h", "localhost", "Specify host and port")
|
||||
flag.IntVar(&port, "p", 9090, "Specify port")
|
||||
flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
|
||||
flag.StringVar(&urlString, "u", "", "Specify the url")
|
||||
flag.BoolVar(&framed, "framed", false, "Use framed transport")
|
||||
flag.BoolVar(&useHttp, "http", false, "Use http")
|
||||
flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")")
|
||||
flag.Parse()
|
||||
|
||||
if len(urlString) > 0 {
|
||||
var err error
|
||||
parsedUrl, err = url.Parse(urlString)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
|
||||
flag.Usage()
|
||||
}
|
||||
host = parsedUrl.Host
|
||||
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https"
|
||||
} else if useHttp {
|
||||
_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
|
||||
flag.Usage()
|
||||
}
|
||||
}
|
||||
|
||||
cmd := flag.Arg(0)
|
||||
var err error
|
||||
if useHttp {
|
||||
trans, err = thrift.NewTHttpClient(parsedUrl.String())
|
||||
if len(headers) > 0 {
|
||||
httptrans := trans.(*thrift.THttpClient)
|
||||
for key, value := range headers {
|
||||
httptrans.SetHeader(key, value)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
portStr := fmt.Sprint(port)
|
||||
if strings.Contains(host, ":") {
|
||||
host, portStr, err = net.SplitHostPort(host)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error with host:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error resolving address:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if framed {
|
||||
trans = thrift.NewTFramedTransport(trans)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error creating transport", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer trans.Close()
|
||||
var protocolFactory thrift.TProtocolFactory
|
||||
switch protocol {
|
||||
case "compact":
|
||||
protocolFactory = thrift.NewTCompactProtocolFactory()
|
||||
break
|
||||
case "simplejson":
|
||||
protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
|
||||
break
|
||||
case "json":
|
||||
protocolFactory = thrift.NewTJSONProtocolFactory()
|
||||
break
|
||||
case "binary", "":
|
||||
protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
|
||||
break
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
|
||||
Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
iprot := protocolFactory.GetProtocol(trans)
|
||||
oprot := protocolFactory.GetProtocol(trans)
|
||||
client := aurora.NewReadOnlySchedulerClient(thrift.NewTStandardClient(iprot, oprot))
|
||||
if err := trans.Open(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
switch cmd {
|
||||
case "getRoleSummary":
|
||||
if flag.NArg() - 1 != 0 {
|
||||
fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args")
|
||||
flag.Usage()
|
||||
}
|
||||
fmt.Print(client.GetRoleSummary(context.Background()))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobSummary":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobSummary requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
argvalue0 := flag.Arg(1)
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobSummary(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getTasksStatus":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg81 := flag.Arg(1)
|
||||
mbTrans82 := thrift.NewTMemoryBufferLen(len(arg81))
|
||||
defer mbTrans82.Close()
|
||||
_, err83 := mbTrans82.WriteString(arg81)
|
||||
if err83 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory84 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt85 := factory84.GetProtocol(mbTrans82)
|
||||
argvalue0 := aurora.NewTaskQuery()
|
||||
err86 := argvalue0.Read(jsProt85)
|
||||
if err86 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetTasksStatus(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getTasksWithoutConfigs":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg87 := flag.Arg(1)
|
||||
mbTrans88 := thrift.NewTMemoryBufferLen(len(arg87))
|
||||
defer mbTrans88.Close()
|
||||
_, err89 := mbTrans88.WriteString(arg87)
|
||||
if err89 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory90 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt91 := factory90.GetProtocol(mbTrans88)
|
||||
argvalue0 := aurora.NewTaskQuery()
|
||||
err92 := argvalue0.Read(jsProt91)
|
||||
if err92 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetTasksWithoutConfigs(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getPendingReason":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg93 := flag.Arg(1)
|
||||
mbTrans94 := thrift.NewTMemoryBufferLen(len(arg93))
|
||||
defer mbTrans94.Close()
|
||||
_, err95 := mbTrans94.WriteString(arg93)
|
||||
if err95 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory96 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt97 := factory96.GetProtocol(mbTrans94)
|
||||
argvalue0 := aurora.NewTaskQuery()
|
||||
err98 := argvalue0.Read(jsProt97)
|
||||
if err98 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetPendingReason(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getConfigSummary":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg99 := flag.Arg(1)
|
||||
mbTrans100 := thrift.NewTMemoryBufferLen(len(arg99))
|
||||
defer mbTrans100.Close()
|
||||
_, err101 := mbTrans100.WriteString(arg99)
|
||||
if err101 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory102 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt103 := factory102.GetProtocol(mbTrans100)
|
||||
argvalue0 := aurora.NewJobKey()
|
||||
err104 := argvalue0.Read(jsProt103)
|
||||
if err104 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetConfigSummary(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobs":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobs requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
argvalue0 := flag.Arg(1)
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobs(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getQuota":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetQuota requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
argvalue0 := flag.Arg(1)
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetQuota(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "populateJobConfig":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg107 := flag.Arg(1)
|
||||
mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107))
|
||||
defer mbTrans108.Close()
|
||||
_, err109 := mbTrans108.WriteString(arg107)
|
||||
if err109 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory110 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt111 := factory110.GetProtocol(mbTrans108)
|
||||
argvalue0 := aurora.NewJobConfiguration()
|
||||
err112 := argvalue0.Read(jsProt111)
|
||||
if err112 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.PopulateJobConfig(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobUpdateSummaries":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg113 := flag.Arg(1)
|
||||
mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113))
|
||||
defer mbTrans114.Close()
|
||||
_, err115 := mbTrans114.WriteString(arg113)
|
||||
if err115 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory116 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt117 := factory116.GetProtocol(mbTrans114)
|
||||
argvalue0 := aurora.NewJobUpdateQuery()
|
||||
err118 := argvalue0.Read(jsProt117)
|
||||
if err118 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobUpdateSummaries(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobUpdateDetails":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg119 := flag.Arg(1)
|
||||
mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119))
|
||||
defer mbTrans120.Close()
|
||||
_, err121 := mbTrans120.WriteString(arg119)
|
||||
if err121 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory122 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt123 := factory122.GetProtocol(mbTrans120)
|
||||
argvalue0 := aurora.NewJobUpdateQuery()
|
||||
err124 := argvalue0.Read(jsProt123)
|
||||
if err124 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobUpdateDetails(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getJobUpdateDiff":
|
||||
if flag.NArg() - 1 != 1 {
|
||||
fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args")
|
||||
flag.Usage()
|
||||
}
|
||||
arg125 := flag.Arg(1)
|
||||
mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125))
|
||||
defer mbTrans126.Close()
|
||||
_, err127 := mbTrans126.WriteString(arg125)
|
||||
if err127 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
factory128 := thrift.NewTJSONProtocolFactory()
|
||||
jsProt129 := factory128.GetProtocol(mbTrans126)
|
||||
argvalue0 := aurora.NewJobUpdateRequest()
|
||||
err130 := argvalue0.Read(jsProt129)
|
||||
if err130 != nil {
|
||||
Usage()
|
||||
return
|
||||
}
|
||||
value0 := argvalue0
|
||||
fmt.Print(client.GetJobUpdateDiff(context.Background(), value0))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "getTierConfigs":
|
||||
if flag.NArg() - 1 != 0 {
|
||||
fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args")
|
||||
flag.Usage()
|
||||
}
|
||||
fmt.Print(client.GetTierConfigs(context.Background()))
|
||||
fmt.Print("\n")
|
||||
break
|
||||
case "":
|
||||
Usage()
|
||||
break
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
#! /bin/bash
|
||||
|
||||
THRIFT_VER=0.9.3
|
||||
THRIFT_VER=0.12.0
|
||||
|
||||
if [[ $(thrift -version | grep -e $THRIFT_VER -c) -ne 1 ]]; then
|
||||
echo "Warning: This wrapper has only been tested with version" $THRIFT_VER;
|
||||
|
|
10
go.mod
Normal file
10
go.mod
Normal file
|
@ -0,0 +1,10 @@
|
|||
module github.com/paypal/gorealis/v2
|
||||
|
||||
require (
|
||||
github.com/apache/thrift v0.12.0
|
||||
github.com/davecgh/go-spew v1.1.0 // indirect
|
||||
github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a
|
||||
github.com/stretchr/testify v1.2.0
|
||||
)
|
332
job.go
332
job.go
|
@ -15,180 +15,73 @@
|
|||
package realis
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
type Job interface {
|
||||
// Set Job Key environment.
|
||||
Environment(env string) Job
|
||||
Role(role string) Job
|
||||
Name(name string) Job
|
||||
CPU(cpus float64) Job
|
||||
CronSchedule(cron string) Job
|
||||
CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job
|
||||
Disk(disk int64) Job
|
||||
RAM(ram int64) Job
|
||||
ExecutorName(name string) Job
|
||||
ExecutorData(data string) Job
|
||||
AddPorts(num int) Job
|
||||
AddLabel(key string, value string) Job
|
||||
AddNamedPorts(names ...string) Job
|
||||
AddLimitConstraint(name string, limit int32) Job
|
||||
AddValueConstraint(name string, negated bool, values ...string) Job
|
||||
|
||||
// From Aurora Docs:
|
||||
// dedicated attribute. Aurora treats this specially, and only allows matching jobs
|
||||
// to run on these machines, and will only schedule matching jobs on these machines.
|
||||
// When a job is created, the scheduler requires that the $role component matches
|
||||
// the role field in the job configuration, and will reject the job creation otherwise.
|
||||
// A wildcard (*) may be used for the role portion of the dedicated attribute, which
|
||||
// will allow any owner to elect for a job to run on the host(s)
|
||||
AddDedicatedConstraint(role, name string) Job
|
||||
AddURIs(extract bool, cache bool, values ...string) Job
|
||||
JobKey() *aurora.JobKey
|
||||
JobConfig() *aurora.JobConfiguration
|
||||
TaskConfig() *aurora.TaskConfig
|
||||
IsService(isService bool) Job
|
||||
InstanceCount(instCount int32) Job
|
||||
GetInstanceCount() int32
|
||||
MaxFailure(maxFail int32) Job
|
||||
Container(container Container) Job
|
||||
}
|
||||
|
||||
// Structure to collect all information pertaining to an Aurora job.
|
||||
type AuroraJob struct {
|
||||
jobConfig *aurora.JobConfiguration
|
||||
resources map[string]*aurora.Resource
|
||||
portCount int
|
||||
task *AuroraTask
|
||||
}
|
||||
|
||||
// Create a Job object with everything initialized.
|
||||
func NewJob() Job {
|
||||
jobConfig := aurora.NewJobConfiguration()
|
||||
taskConfig := aurora.NewTaskConfig()
|
||||
jobKey := aurora.NewJobKey()
|
||||
// Create a AuroraJob object with everything initialized.
|
||||
func NewJob() *AuroraJob {
|
||||
|
||||
// Job Config
|
||||
jobConfig.Key = jobKey
|
||||
jobConfig.TaskConfig = taskConfig
|
||||
jobKey := &aurora.JobKey{}
|
||||
|
||||
// Task Config
|
||||
taskConfig.Job = jobKey
|
||||
taskConfig.Container = aurora.NewContainer()
|
||||
taskConfig.Container.Mesos = aurora.NewMesosContainer()
|
||||
taskConfig.MesosFetcherUris = make(map[*aurora.MesosFetcherURI]bool)
|
||||
taskConfig.Metadata = make(map[*aurora.Metadata]bool)
|
||||
taskConfig.Constraints = make(map[*aurora.Constraint]bool)
|
||||
// AuroraTask clientConfig
|
||||
task := NewTask()
|
||||
task.task.Job = jobKey
|
||||
|
||||
// Resources
|
||||
numCpus := aurora.NewResource()
|
||||
ramMb := aurora.NewResource()
|
||||
diskMb := aurora.NewResource()
|
||||
|
||||
resources := make(map[string]*aurora.Resource)
|
||||
resources["cpu"] = numCpus
|
||||
resources["ram"] = ramMb
|
||||
resources["disk"] = diskMb
|
||||
|
||||
taskConfig.Resources = make(map[*aurora.Resource]bool)
|
||||
taskConfig.Resources[numCpus] = true
|
||||
taskConfig.Resources[ramMb] = true
|
||||
taskConfig.Resources[diskMb] = true
|
||||
|
||||
numCpus.NumCpus = new(float64)
|
||||
ramMb.RamMb = new(int64)
|
||||
diskMb.DiskMb = new(int64)
|
||||
// AuroraJob clientConfig
|
||||
jobConfig := &aurora.JobConfiguration{
|
||||
Key: jobKey,
|
||||
TaskConfig: task.TaskConfig(),
|
||||
}
|
||||
|
||||
return &AuroraJob{
|
||||
jobConfig: jobConfig,
|
||||
resources: resources,
|
||||
portCount: 0,
|
||||
task: task,
|
||||
}
|
||||
}
|
||||
|
||||
// Set Job Key environment.
|
||||
func (j *AuroraJob) Environment(env string) Job {
|
||||
// Set AuroraJob Key environment. Explicit changes to AuroraTask's job key are not needed
|
||||
// because they share a pointer to the same JobKey.
|
||||
func (j *AuroraJob) Environment(env string) *AuroraJob {
|
||||
j.jobConfig.Key.Environment = env
|
||||
return j
|
||||
}
|
||||
|
||||
// Set Job Key Role.
|
||||
func (j *AuroraJob) Role(role string) Job {
|
||||
// Set AuroraJob Key Role.
|
||||
func (j *AuroraJob) Role(role string) *AuroraJob {
|
||||
j.jobConfig.Key.Role = role
|
||||
|
||||
//Will be deprecated
|
||||
// Will be deprecated
|
||||
identity := &aurora.Identity{User: role}
|
||||
j.jobConfig.Owner = identity
|
||||
j.jobConfig.TaskConfig.Owner = identity
|
||||
|
||||
return j
|
||||
}
|
||||
|
||||
// Set Job Key Name.
|
||||
func (j *AuroraJob) Name(name string) Job {
|
||||
// Set AuroraJob Key Name.
|
||||
func (j *AuroraJob) Name(name string) *AuroraJob {
|
||||
j.jobConfig.Key.Name = name
|
||||
return j
|
||||
}
|
||||
|
||||
// Set name of the executor that will the task will be configured to.
|
||||
func (j *AuroraJob) ExecutorName(name string) Job {
|
||||
|
||||
if j.jobConfig.TaskConfig.ExecutorConfig == nil {
|
||||
j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig()
|
||||
}
|
||||
|
||||
j.jobConfig.TaskConfig.ExecutorConfig.Name = name
|
||||
return j
|
||||
}
|
||||
|
||||
// Will be included as part of entire task inside the scheduler that will be serialized.
|
||||
func (j *AuroraJob) ExecutorData(data string) Job {
|
||||
|
||||
if j.jobConfig.TaskConfig.ExecutorConfig == nil {
|
||||
j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig()
|
||||
}
|
||||
|
||||
j.jobConfig.TaskConfig.ExecutorConfig.Data = data
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) CPU(cpus float64) Job {
|
||||
*j.resources["cpu"].NumCpus = cpus
|
||||
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) RAM(ram int64) Job {
|
||||
*j.resources["ram"].RamMb = ram
|
||||
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) Disk(disk int64) Job {
|
||||
*j.resources["disk"].DiskMb = disk
|
||||
|
||||
return j
|
||||
}
|
||||
|
||||
// How many failures to tolerate before giving up.
|
||||
func (j *AuroraJob) MaxFailure(maxFail int32) Job {
|
||||
j.jobConfig.TaskConfig.MaxTaskFailures = maxFail
|
||||
return j
|
||||
}
|
||||
|
||||
// How many instances of the job to run
|
||||
func (j *AuroraJob) InstanceCount(instCount int32) Job {
|
||||
func (j *AuroraJob) InstanceCount(instCount int32) *AuroraJob {
|
||||
j.jobConfig.InstanceCount = instCount
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) CronSchedule(cron string) Job {
|
||||
func (j *AuroraJob) CronSchedule(cron string) *AuroraJob {
|
||||
j.jobConfig.CronSchedule = &cron
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job {
|
||||
func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) *AuroraJob {
|
||||
j.jobConfig.CronCollisionPolicy = policy
|
||||
return j
|
||||
}
|
||||
|
@ -198,15 +91,9 @@ func (j *AuroraJob) GetInstanceCount() int32 {
|
|||
return j.jobConfig.InstanceCount
|
||||
}
|
||||
|
||||
// Restart the job's tasks if they fail
|
||||
func (j *AuroraJob) IsService(isService bool) Job {
|
||||
j.jobConfig.TaskConfig.IsService = isService
|
||||
return j
|
||||
}
|
||||
|
||||
// Get the current job configurations key to use for some realis calls.
|
||||
func (j *AuroraJob) JobKey() *aurora.JobKey {
|
||||
return j.jobConfig.Key
|
||||
func (j *AuroraJob) JobKey() aurora.JobKey {
|
||||
return *j.jobConfig.Key
|
||||
}
|
||||
|
||||
// Get the current job configurations key to use for some realis calls.
|
||||
|
@ -214,104 +101,117 @@ func (j *AuroraJob) JobConfig() *aurora.JobConfiguration {
|
|||
return j.jobConfig
|
||||
}
|
||||
|
||||
// Get the current job configurations key to use for some realis calls.
|
||||
func (j *AuroraJob) AuroraTask() *AuroraTask {
|
||||
return j.task
|
||||
}
|
||||
|
||||
/*
|
||||
AuroraTask specific API, see task.go for further documentation.
|
||||
These functions are provided for the convenience of chaining API calls.
|
||||
*/
|
||||
|
||||
func (j *AuroraJob) ExecutorName(name string) *AuroraJob {
|
||||
j.task.ExecutorName(name)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) ExecutorData(data string) *AuroraJob {
|
||||
j.task.ExecutorData(data)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) CPU(cpus float64) *AuroraJob {
|
||||
j.task.CPU(cpus)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) RAM(ram int64) *AuroraJob {
|
||||
j.task.RAM(ram)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) Disk(disk int64) *AuroraJob {
|
||||
j.task.Disk(disk)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) GPU(gpu int64) *AuroraJob {
|
||||
j.task.GPU(gpu)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) Tier(tier string) *AuroraJob {
|
||||
j.task.Tier(tier)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) MaxFailure(maxFail int32) *AuroraJob {
|
||||
j.task.MaxFailure(maxFail)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) IsService(isService bool) *AuroraJob {
|
||||
j.task.IsService(isService)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) TaskConfig() *aurora.TaskConfig {
|
||||
return j.jobConfig.TaskConfig
|
||||
return j.task.TaskConfig()
|
||||
}
|
||||
|
||||
// Add a list of URIs with the same extract and cache configuration. Scheduler must have
|
||||
// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.
|
||||
func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job {
|
||||
for _, value := range values {
|
||||
j.jobConfig.TaskConfig.MesosFetcherUris[&aurora.MesosFetcherURI{
|
||||
Value: value,
|
||||
Extract: &extract,
|
||||
Cache: &cache,
|
||||
}] = true
|
||||
}
|
||||
func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) *AuroraJob {
|
||||
j.task.AddURIs(extract, cache, values...)
|
||||
return j
|
||||
}
|
||||
|
||||
// Adds a Mesos label to the job. Note that Aurora will add the
|
||||
// prefix "org.apache.aurora.metadata." to the beginning of each key.
|
||||
func (j *AuroraJob) AddLabel(key string, value string) Job {
|
||||
j.jobConfig.TaskConfig.Metadata[&aurora.Metadata{Key: key, Value: value}] = true
|
||||
func (j *AuroraJob) AddLabel(key string, value string) *AuroraJob {
|
||||
j.task.AddLabel(key, value)
|
||||
return j
|
||||
}
|
||||
|
||||
// Add a named port to the job configuration These are random ports as it's
|
||||
// not currently possible to request specific ports using Aurora.
|
||||
func (j *AuroraJob) AddNamedPorts(names ...string) Job {
|
||||
j.portCount += len(names)
|
||||
for _, name := range names {
|
||||
j.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &name}] = true
|
||||
}
|
||||
|
||||
func (j *AuroraJob) AddNamedPorts(names ...string) *AuroraJob {
|
||||
j.task.AddNamedPorts(names...)
|
||||
return j
|
||||
}
|
||||
|
||||
// Adds a request for a number of ports to the job configuration. The names chosen for these ports
|
||||
// will be org.apache.aurora.port.X, where X is the current port count for the job configuration
|
||||
// starting at 0. These are random ports as it's not currently possible to request
|
||||
// specific ports using Aurora.
|
||||
func (j *AuroraJob) AddPorts(num int) Job {
|
||||
start := j.portCount
|
||||
j.portCount += num
|
||||
for i := start; i < j.portCount; i++ {
|
||||
portName := "org.apache.aurora.port." + strconv.Itoa(i)
|
||||
j.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &portName}] = true
|
||||
}
|
||||
|
||||
func (j *AuroraJob) AddPorts(num int) *AuroraJob {
|
||||
j.task.AddPorts(num)
|
||||
return j
|
||||
}
|
||||
func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) *AuroraJob {
|
||||
j.task.AddValueConstraint(name, negated, values...)
|
||||
return j
|
||||
}
|
||||
|
||||
// From Aurora Docs:
|
||||
// Add a Value constraint
|
||||
// name - Mesos slave attribute that the constraint is matched against.
|
||||
// If negated = true , treat this as a 'not' - to avoid specific values.
|
||||
// Values - list of values we look for in attribute name
|
||||
func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) Job {
|
||||
constraintValues := make(map[string]bool)
|
||||
for _, value := range values {
|
||||
constraintValues[value] = true
|
||||
}
|
||||
j.jobConfig.TaskConfig.Constraints[&aurora.Constraint{
|
||||
Name: name,
|
||||
Constraint: &aurora.TaskConstraint{
|
||||
Value: &aurora.ValueConstraint{
|
||||
Negated: negated,
|
||||
Values: constraintValues,
|
||||
},
|
||||
Limit: nil,
|
||||
},
|
||||
}] = true
|
||||
|
||||
func (j *AuroraJob) AddLimitConstraint(name string, limit int32) *AuroraJob {
|
||||
j.task.AddLimitConstraint(name, limit)
|
||||
return j
|
||||
}
|
||||
|
||||
// From Aurora Docs:
|
||||
// A constraint that specifies the maximum number of active tasks on a host with
|
||||
// a matching attribute that may be scheduled simultaneously.
|
||||
func (j *AuroraJob) AddLimitConstraint(name string, limit int32) Job {
|
||||
j.jobConfig.TaskConfig.Constraints[&aurora.Constraint{
|
||||
Name: name,
|
||||
Constraint: &aurora.TaskConstraint{
|
||||
Value: nil,
|
||||
Limit: &aurora.LimitConstraint{Limit: limit},
|
||||
},
|
||||
}] = true
|
||||
|
||||
func (j *AuroraJob) AddDedicatedConstraint(role, name string) *AuroraJob {
|
||||
j.task.AddDedicatedConstraint(role, name)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) AddDedicatedConstraint(role, name string) Job {
|
||||
j.AddValueConstraint("dedicated", false, role+"/"+name)
|
||||
|
||||
func (j *AuroraJob) Container(container Container) *AuroraJob {
|
||||
j.task.Container(container)
|
||||
return j
|
||||
}
|
||||
|
||||
// Set a container to run for the job configuration to run.
|
||||
func (j *AuroraJob) Container(container Container) Job {
|
||||
j.jobConfig.TaskConfig.Container = container.Build()
|
||||
|
||||
func (j *AuroraJob) ThermosExecutor(thermos ThermosExecutor) *AuroraJob {
|
||||
j.task.ThermosExecutor(thermos)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *AuroraJob) BuildThermosPayload() error {
|
||||
return j.task.BuildThermosPayload()
|
||||
}
|
||||
|
||||
func (j *AuroraJob) PartitionPolicy(reschedule bool, delay int64) *AuroraJob {
|
||||
j.task.PartitionPolicy(aurora.PartitionPolicy{
|
||||
Reschedule: reschedule,
|
||||
DelaySecs: &delay,
|
||||
})
|
||||
return j
|
||||
}
|
||||
|
|
249
jobUpdate.go
Normal file
249
jobUpdate.go
Normal file
|
@ -0,0 +1,249 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
// Structure to collect all information required to create job update
|
||||
type JobUpdate struct {
|
||||
task *AuroraTask
|
||||
request *aurora.JobUpdateRequest
|
||||
}
|
||||
|
||||
// Create a default JobUpdate object with an empty task and no fields filled in.
|
||||
func NewJobUpdate() *JobUpdate {
|
||||
newTask := NewTask()
|
||||
|
||||
req := aurora.JobUpdateRequest{}
|
||||
req.TaskConfig = newTask.TaskConfig()
|
||||
req.Settings = newUpdateSettings()
|
||||
|
||||
return &JobUpdate{task: newTask, request: &req}
|
||||
}
|
||||
|
||||
func JobUpdateFromAuroraTask(task *AuroraTask) *JobUpdate {
|
||||
newTask := task.Clone()
|
||||
|
||||
req := aurora.JobUpdateRequest{}
|
||||
req.TaskConfig = newTask.TaskConfig()
|
||||
req.Settings = newUpdateSettings()
|
||||
|
||||
return &JobUpdate{task: newTask, request: &req}
|
||||
}
|
||||
|
||||
func JobUpdateFromConfig(task *aurora.TaskConfig) *JobUpdate {
|
||||
// Perform a deep copy to avoid unexpected behavior
|
||||
newTask := TaskFromThrift(task)
|
||||
|
||||
req := aurora.JobUpdateRequest{}
|
||||
req.TaskConfig = newTask.TaskConfig()
|
||||
req.Settings = newUpdateSettings()
|
||||
|
||||
return &JobUpdate{task: newTask, request: &req}
|
||||
}
|
||||
|
||||
// Set instance count the job will have after the update.
|
||||
func (j *JobUpdate) InstanceCount(inst int32) *JobUpdate {
|
||||
j.request.InstanceCount = inst
|
||||
return j
|
||||
}
|
||||
|
||||
// Max number of instances being updated at any given moment.
|
||||
func (j *JobUpdate) BatchSize(size int32) *JobUpdate {
|
||||
j.request.Settings.UpdateGroupSize = size
|
||||
return j
|
||||
}
|
||||
|
||||
// Minimum number of seconds a shard must remain in RUNNING state before considered a success.
|
||||
func (j *JobUpdate) WatchTime(timeout time.Duration) *JobUpdate {
|
||||
j.request.Settings.MinWaitInInstanceRunningMs = int32(timeout.Seconds() * 1000)
|
||||
return j
|
||||
}
|
||||
|
||||
// Wait for all instances in a group to be done before moving on.
|
||||
func (j *JobUpdate) WaitForBatchCompletion(batchWait bool) *JobUpdate {
|
||||
j.request.Settings.WaitForBatchCompletion = batchWait
|
||||
return j
|
||||
}
|
||||
|
||||
// Max number of instance failures to tolerate before marking instance as FAILED.
|
||||
func (j *JobUpdate) MaxPerInstanceFailures(inst int32) *JobUpdate {
|
||||
j.request.Settings.MaxPerInstanceFailures = inst
|
||||
return j
|
||||
}
|
||||
|
||||
// Max number of FAILED instances to tolerate before terminating the update.
|
||||
func (j *JobUpdate) MaxFailedInstances(inst int32) *JobUpdate {
|
||||
j.request.Settings.MaxFailedInstances = inst
|
||||
return j
|
||||
}
|
||||
|
||||
// When False, prevents auto rollback of a failed update.
|
||||
func (j *JobUpdate) RollbackOnFail(rollback bool) *JobUpdate {
|
||||
j.request.Settings.RollbackOnFailure = rollback
|
||||
return j
|
||||
}
|
||||
|
||||
// Sets the interval at which pulses should be received by the job update before timing out.
|
||||
func (j *JobUpdate) PulseIntervalTimeout(timeout time.Duration) *JobUpdate {
|
||||
j.request.Settings.BlockIfNoPulsesAfterMs = thrift.Int32Ptr(int32(timeout.Seconds() * 1000))
|
||||
return j
|
||||
}
|
||||
|
||||
func newUpdateSettings() *aurora.JobUpdateSettings {
|
||||
|
||||
us := aurora.JobUpdateSettings{}
|
||||
// Mirrors defaults set by Pystachio
|
||||
us.UpdateOnlyTheseInstances = []*aurora.Range{}
|
||||
us.UpdateGroupSize = 1
|
||||
us.WaitForBatchCompletion = false
|
||||
us.MinWaitInInstanceRunningMs = 45000
|
||||
us.MaxPerInstanceFailures = 0
|
||||
us.MaxFailedInstances = 0
|
||||
us.RollbackOnFailure = true
|
||||
|
||||
return &us
|
||||
}
|
||||
|
||||
/*
|
||||
These methods are provided for user convenience in order to chain
|
||||
calls for configuration.
|
||||
API below here are wrappers around modifying an AuroraTask instance.
|
||||
See task.go for further documentation.
|
||||
*/
|
||||
|
||||
func (j *JobUpdate) Environment(env string) *JobUpdate {
|
||||
j.task.Environment(env)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) Role(role string) *JobUpdate {
|
||||
j.task.Role(role)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) Name(name string) *JobUpdate {
|
||||
j.task.Name(name)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) ExecutorName(name string) *JobUpdate {
|
||||
j.task.ExecutorName(name)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) ExecutorData(data string) *JobUpdate {
|
||||
j.task.ExecutorData(data)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) CPU(cpus float64) *JobUpdate {
|
||||
j.task.CPU(cpus)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) RAM(ram int64) *JobUpdate {
|
||||
j.task.RAM(ram)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) Disk(disk int64) *JobUpdate {
|
||||
j.task.Disk(disk)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) Tier(tier string) *JobUpdate {
|
||||
j.task.Tier(tier)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) MaxFailure(maxFail int32) *JobUpdate {
|
||||
j.task.MaxFailure(maxFail)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) IsService(isService bool) *JobUpdate {
|
||||
j.task.IsService(isService)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) TaskConfig() *aurora.TaskConfig {
|
||||
return j.task.TaskConfig()
|
||||
}
|
||||
|
||||
func (j *JobUpdate) AddURIs(extract bool, cache bool, values ...string) *JobUpdate {
|
||||
j.task.AddURIs(extract, cache, values...)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) AddLabel(key string, value string) *JobUpdate {
|
||||
j.task.AddLabel(key, value)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) AddNamedPorts(names ...string) *JobUpdate {
|
||||
j.task.AddNamedPorts(names...)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) AddPorts(num int) *JobUpdate {
|
||||
j.task.AddPorts(num)
|
||||
return j
|
||||
}
|
||||
func (j *JobUpdate) AddValueConstraint(name string, negated bool, values ...string) *JobUpdate {
|
||||
j.task.AddValueConstraint(name, negated, values...)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) AddLimitConstraint(name string, limit int32) *JobUpdate {
|
||||
j.task.AddLimitConstraint(name, limit)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) AddDedicatedConstraint(role, name string) *JobUpdate {
|
||||
j.task.AddDedicatedConstraint(role, name)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) Container(container Container) *JobUpdate {
|
||||
j.task.Container(container)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) JobKey() aurora.JobKey {
|
||||
return j.task.JobKey()
|
||||
}
|
||||
|
||||
func (j *JobUpdate) ThermosExecutor(thermos ThermosExecutor) *JobUpdate {
|
||||
j.task.ThermosExecutor(thermos)
|
||||
return j
|
||||
}
|
||||
|
||||
func (j *JobUpdate) BuildThermosPayload() error {
|
||||
return j.task.BuildThermosPayload()
|
||||
}
|
||||
|
||||
func (j *JobUpdate) PartitionPolicy(reschedule bool, delay int64) *JobUpdate {
|
||||
j.task.PartitionPolicy(aurora.PartitionPolicy{
|
||||
Reschedule: reschedule,
|
||||
DelaySecs: &delay,
|
||||
})
|
||||
return j
|
||||
}
|
32
logger.go
32
logger.go
|
@ -31,29 +31,49 @@ func (NoopLogger) Println(a ...interface{}) {}
|
|||
type LevelLogger struct {
|
||||
Logger
|
||||
debug bool
|
||||
trace bool
|
||||
}
|
||||
|
||||
func (l *LevelLogger) EnableDebug(enable bool) {
|
||||
l.debug = enable
|
||||
}
|
||||
|
||||
func (l *LevelLogger) EnableTrace(enable bool) {
|
||||
l.trace = enable
|
||||
}
|
||||
|
||||
func (l LevelLogger) DebugPrintf(format string, a ...interface{}) {
|
||||
if l.debug {
|
||||
l.Print("[DEBUG] ")
|
||||
l.Printf(format, a)
|
||||
l.Printf("[DEBUG] "+format, a...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) DebugPrint(a ...interface{}) {
|
||||
if l.debug {
|
||||
l.Print("[DEBUG] ")
|
||||
l.Print(a)
|
||||
l.Print(append([]interface{}{"[DEBUG] "}, a...)...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) DebugPrintln(a ...interface{}) {
|
||||
if l.debug {
|
||||
l.Print("[DEBUG] ")
|
||||
l.Println(a)
|
||||
l.Println(append([]interface{}{"[DEBUG] "}, a...)...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) TracePrintf(format string, a ...interface{}) {
|
||||
if l.trace {
|
||||
l.Printf("[TRACE] "+format, a...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) TracePrint(a ...interface{}) {
|
||||
if l.trace {
|
||||
l.Print(append([]interface{}{"[TRACE] "}, a...)...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) TracePrintln(a ...interface{}) {
|
||||
if l.trace {
|
||||
l.Println(append([]interface{}{"[TRACE] "}, a...)...)
|
||||
}
|
||||
}
|
||||
|
|
187
monitors.go
187
monitors.go
|
@ -18,88 +18,142 @@ package realis
|
|||
import (
|
||||
"time"
|
||||
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/response"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
UpdateFailed = "update failed"
|
||||
RolledBack = "update rolled back"
|
||||
Timeout = "timeout"
|
||||
)
|
||||
// MonitorJobUpdate polls the scheduler every certain amount of time to see if the update has succeeded.
|
||||
// If the update entered a terminal update state but it is not ROLLED_FORWARD, this function will return an error.
|
||||
func (c *Client) MonitorJobUpdate(updateKey aurora.JobUpdateKey, interval, timeout time.Duration) (bool, error) {
|
||||
if interval < 1*time.Second {
|
||||
interval = interval * time.Second
|
||||
}
|
||||
|
||||
type Monitor struct {
|
||||
Client Realis
|
||||
if timeout < 1*time.Second {
|
||||
timeout = timeout * time.Second
|
||||
}
|
||||
updateSummaries, err := c.MonitorJobUpdateQuery(
|
||||
aurora.JobUpdateQuery{
|
||||
Key: &updateKey,
|
||||
Limit: 1,
|
||||
UpdateStatuses: []aurora.JobUpdateStatus{
|
||||
aurora.JobUpdateStatus_ROLLED_FORWARD,
|
||||
aurora.JobUpdateStatus_ROLLED_BACK,
|
||||
aurora.JobUpdateStatus_ABORTED,
|
||||
aurora.JobUpdateStatus_ERROR,
|
||||
aurora.JobUpdateStatus_FAILED,
|
||||
},
|
||||
},
|
||||
interval,
|
||||
timeout)
|
||||
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
status := updateSummaries[0].State.Status
|
||||
|
||||
c.RealisConfig().logger.Printf("job update status: %v\n", status)
|
||||
|
||||
// Rolled forward is the only state in which an update has been successfully updated
|
||||
// if we encounter an inactive state and it is not at rolled forward, update failed
|
||||
switch status {
|
||||
case aurora.JobUpdateStatus_ROLLED_FORWARD:
|
||||
return true, nil
|
||||
case aurora.JobUpdateStatus_ROLLED_BACK,
|
||||
aurora.JobUpdateStatus_ABORTED,
|
||||
aurora.JobUpdateStatus_ERROR,
|
||||
aurora.JobUpdateStatus_FAILED:
|
||||
return false, errors.Errorf("bad terminal state for update: %v", status)
|
||||
default:
|
||||
return false, errors.Errorf("unexpected update state: %v", status)
|
||||
}
|
||||
}
|
||||
|
||||
// Polls the scheduler every certain amount of time to see if the update has succeeded
|
||||
func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout int) (bool, error) {
|
||||
// MonitorJobUpdateStatus polls the scheduler for information about an update until the update enters one of the
|
||||
// desired states or until the function times out.
|
||||
func (c *Client) MonitorJobUpdateStatus(updateKey aurora.JobUpdateKey,
|
||||
desiredStatuses []aurora.JobUpdateStatus,
|
||||
interval, timeout time.Duration) (aurora.JobUpdateStatus, error) {
|
||||
|
||||
if len(desiredStatuses) == 0 {
|
||||
return aurora.JobUpdateStatus(-1), errors.New("no desired statuses provided")
|
||||
}
|
||||
|
||||
// Make deep local copy to avoid side effects from job key being manipulated externally.
|
||||
updateKeyLocal := &aurora.JobUpdateKey{
|
||||
Job: &aurora.JobKey{
|
||||
Role: updateKey.Job.GetRole(),
|
||||
Environment: updateKey.Job.GetEnvironment(),
|
||||
Name: updateKey.Job.GetName(),
|
||||
},
|
||||
ID: updateKey.GetID(),
|
||||
}
|
||||
|
||||
updateQ := aurora.JobUpdateQuery{
|
||||
Key: &updateKey,
|
||||
Limit: 1,
|
||||
Key: updateKeyLocal,
|
||||
Limit: 1,
|
||||
UpdateStatuses: desiredStatuses,
|
||||
}
|
||||
ticker := time.NewTicker(time.Second * time.Duration(interval))
|
||||
defer ticker.Stop()
|
||||
timer := time.NewTimer(time.Second * time.Duration(timeout))
|
||||
defer timer.Stop()
|
||||
var cliErr error
|
||||
var respDetail *aurora.Response
|
||||
|
||||
summary, err := c.MonitorJobUpdateQuery(updateQ, interval, timeout)
|
||||
if len(summary) > 0 {
|
||||
return summary[0].State.Status, err
|
||||
}
|
||||
|
||||
return aurora.JobUpdateStatus(-1), err
|
||||
}
|
||||
|
||||
func (c *Client) MonitorJobUpdateQuery(
|
||||
updateQuery aurora.JobUpdateQuery,
|
||||
interval time.Duration,
|
||||
timeout time.Duration) ([]*aurora.JobUpdateSummary, error) {
|
||||
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
timer := time.NewTimer(timeout)
|
||||
defer timer.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
respDetail, cliErr = m.Client.JobUpdateDetails(updateQ)
|
||||
updateSummaryResults, cliErr := c.GetJobUpdateSummaries(&updateQuery)
|
||||
if cliErr != nil {
|
||||
return false, cliErr
|
||||
return nil, cliErr
|
||||
}
|
||||
|
||||
updateDetail := response.JobUpdateDetails(respDetail)
|
||||
|
||||
if len(updateDetail) == 0 {
|
||||
m.Client.RealisConfig().logger.Println("No update found")
|
||||
return false, errors.New("No update found for " + updateKey.String())
|
||||
if len(updateSummaryResults.GetUpdateSummaries()) >= 1 {
|
||||
return updateSummaryResults.GetUpdateSummaries(), nil
|
||||
}
|
||||
status := updateDetail[0].Update.Summary.State.Status
|
||||
|
||||
if _, ok := aurora.ACTIVE_JOB_UPDATE_STATES[status]; !ok {
|
||||
|
||||
// Rolled forward is the only state in which an update has been successfully updated
|
||||
// if we encounter an inactive state and it is not at rolled forward, update failed
|
||||
switch status {
|
||||
case aurora.JobUpdateStatus_ROLLED_FORWARD:
|
||||
m.Client.RealisConfig().logger.Println("Update succeeded")
|
||||
return true, nil
|
||||
case aurora.JobUpdateStatus_FAILED:
|
||||
m.Client.RealisConfig().logger.Println("Update failed")
|
||||
return false, errors.New(UpdateFailed)
|
||||
case aurora.JobUpdateStatus_ROLLED_BACK:
|
||||
m.Client.RealisConfig().logger.Println("rolled back")
|
||||
return false, errors.New(RolledBack)
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
case <-timer.C:
|
||||
return false, errors.New(Timeout)
|
||||
return nil, newTimedoutError(errors.New("job update monitor timed out"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Monitor a Job until all instances enter one of the LIVE_STATES
|
||||
func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval, timeout int) (bool, error) {
|
||||
return m.ScheduleStatus(key, instances, aurora.LIVE_STATES, interval, timeout)
|
||||
// Monitor a AuroraJob until all instances enter one of the LiveStates
|
||||
func (c *Client) MonitorInstances(key aurora.JobKey, instances int32, interval, timeout time.Duration) (bool, error) {
|
||||
return c.MonitorScheduleStatus(key, instances, aurora.LIVE_STATES, interval, timeout)
|
||||
}
|
||||
|
||||
// Monitor a Job until all instances enter a desired status.
|
||||
// Monitor a AuroraJob until all instances enter a desired status.
|
||||
// Defaults sets of desired statuses provided by the thrift API include:
|
||||
// ACTIVE_STATES, SLAVE_ASSIGNED_STATES, LIVE_STATES, and TERMINAL_STATES
|
||||
func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desiredStatuses map[aurora.ScheduleStatus]bool, interval, timeout int) (bool, error) {
|
||||
// ActiveStates, SlaveAssignedStates, LiveStates, and TerminalStates
|
||||
func (c *Client) MonitorScheduleStatus(key aurora.JobKey,
|
||||
instanceCount int32,
|
||||
desiredStatuses []aurora.ScheduleStatus,
|
||||
interval, timeout time.Duration) (bool, error) {
|
||||
if interval < 1*time.Second {
|
||||
interval = interval * time.Second
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(time.Second * time.Duration(interval))
|
||||
if timeout < 1*time.Second {
|
||||
timeout = timeout * time.Second
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
timer := time.NewTimer(time.Second * time.Duration(timeout))
|
||||
timer := time.NewTimer(timeout)
|
||||
defer timer.Stop()
|
||||
|
||||
for {
|
||||
|
@ -107,7 +161,7 @@ func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desire
|
|||
case <-ticker.C:
|
||||
|
||||
// Query Aurora for the state of the job key ever interval
|
||||
instCount, cliErr := m.Client.GetInstanceIds(key, desiredStatuses)
|
||||
instCount, cliErr := c.GetInstanceIds(key, desiredStatuses)
|
||||
if cliErr != nil {
|
||||
return false, errors.Wrap(cliErr, "Unable to communicate with Aurora")
|
||||
}
|
||||
|
@ -117,14 +171,23 @@ func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desire
|
|||
case <-timer.C:
|
||||
|
||||
// If the timer runs out, return a timeout error to user
|
||||
return false, errors.New(Timeout)
|
||||
return false, newTimedoutError(errors.New("schedule status monitor timedout"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Monitor host status until all hosts match the status provided. Returns a map where the value is true if the host
|
||||
// is in one of the desired mode(s) or false if it is not as of the time when the monitor exited.
|
||||
func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode, interval, timeout int) (map[string]bool, error) {
|
||||
func (c *Client) MonitorHostMaintenance(hosts []string,
|
||||
modes []aurora.MaintenanceMode,
|
||||
interval, timeout time.Duration) (map[string]bool, error) {
|
||||
if interval < 1*time.Second {
|
||||
interval = interval * time.Second
|
||||
}
|
||||
|
||||
if timeout < 1*time.Second {
|
||||
timeout = timeout * time.Second
|
||||
}
|
||||
|
||||
// Transform modes to monitor for into a set for easy lookup
|
||||
desiredMode := make(map[aurora.MaintenanceMode]struct{})
|
||||
|
@ -142,16 +205,16 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode
|
|||
|
||||
hostResult := make(map[string]bool)
|
||||
|
||||
ticker := time.NewTicker(time.Second * time.Duration(interval))
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
timer := time.NewTimer(time.Second * time.Duration(timeout))
|
||||
timer := time.NewTimer(timeout)
|
||||
defer timer.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
// Client call has multiple retries internally
|
||||
_, result, err := m.Client.MaintenanceStatus(hosts...)
|
||||
result, err := c.MaintenanceStatus(hosts...)
|
||||
if err != nil {
|
||||
// Error is either a payload error or a severe connection error
|
||||
for host := range remainingHosts {
|
||||
|
@ -160,7 +223,7 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode
|
|||
return hostResult, errors.Wrap(err, "client error in monitor")
|
||||
}
|
||||
|
||||
for status := range result.GetStatuses() {
|
||||
for _, status := range result.GetStatuses() {
|
||||
|
||||
if _, ok := desiredMode[status.GetMode()]; ok {
|
||||
hostResult[status.GetHost()] = true
|
||||
|
@ -177,7 +240,7 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode
|
|||
hostResult[host] = false
|
||||
}
|
||||
|
||||
return hostResult, errors.New(Timeout)
|
||||
return hostResult, newTimedoutError(errors.New("host maintenance monitor timedout"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
268
realis_admin.go
Normal file
268
realis_admin.go
Normal file
|
@ -0,0 +1,268 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Set a list of nodes to DRAINING. This means nothing will be able to be scheduled on them and any existing
|
||||
// tasks will be killed and re-scheduled elsewhere in the cluster. Tasks from DRAINING nodes are not guaranteed
|
||||
// to return to running unless there is enough capacity in the cluster to run them.
|
||||
func (c *Client) DrainHosts(hosts ...string) ([]*aurora.HostStatus, error) {
|
||||
|
||||
if len(hosts) == 0 {
|
||||
return nil, errors.New("no hosts provided to drain")
|
||||
}
|
||||
|
||||
drainList := aurora.NewHosts()
|
||||
drainList.HostNames = hosts
|
||||
|
||||
c.logger.DebugPrintf("DrainHosts Thrift Payload: %v\n", drainList)
|
||||
|
||||
resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.DrainHosts(context.TODO(), drainList)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return nil, errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
if resp.GetResult_() != nil && resp.GetResult_().GetDrainHostsResult_() != nil {
|
||||
return resp.GetResult_().GetDrainHostsResult_().GetStatuses(), nil
|
||||
} else {
|
||||
return nil, errors.New("thrift error: Field in response is nil unexpectedly.")
|
||||
}
|
||||
}
|
||||
|
||||
// Start SLA Aware Drain.
|
||||
// defaultSlaPolicy is the fallback SlaPolicy to use if a task does not have an SlaPolicy.
|
||||
// After timeoutSecs, tasks will be forcefully drained without checking SLA.
|
||||
func (c *Client) SLADrainHosts(policy *aurora.SlaPolicy, timeout int64, hosts ...string) ([]*aurora.HostStatus, error) {
|
||||
|
||||
if len(hosts) == 0 {
|
||||
return nil, errors.New("no hosts provided to drain")
|
||||
}
|
||||
|
||||
drainList := aurora.NewHosts()
|
||||
drainList.HostNames = hosts
|
||||
|
||||
c.logger.DebugPrintf("SLADrainHosts Thrift Payload: %v\n", drainList)
|
||||
|
||||
resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.SlaDrainHosts(context.TODO(), drainList, policy, timeout)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return nil, errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
if resp.GetResult_() != nil && resp.GetResult_().GetDrainHostsResult_() != nil {
|
||||
return resp.GetResult_().GetDrainHostsResult_().GetStatuses(), nil
|
||||
} else {
|
||||
return nil, errors.New("thrift error: Field in response is nil unexpectedly.")
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) StartMaintenance(hosts ...string) ([]*aurora.HostStatus, error) {
|
||||
|
||||
if len(hosts) == 0 {
|
||||
return nil, errors.New("no hosts provided to start maintenance on")
|
||||
}
|
||||
|
||||
hostList := aurora.NewHosts()
|
||||
hostList.HostNames = hosts
|
||||
|
||||
c.logger.DebugPrintf("StartMaintenance Thrift Payload: %v\n", hostList)
|
||||
|
||||
resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.StartMaintenance(context.TODO(), hostList)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return nil, errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
if resp.GetResult_() != nil && resp.GetResult_().GetStartMaintenanceResult_() != nil {
|
||||
return resp.GetResult_().GetStartMaintenanceResult_().GetStatuses(), nil
|
||||
} else {
|
||||
return nil, errors.New("thrift error: Field in response is nil unexpectedly.")
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) EndMaintenance(hosts ...string) ([]*aurora.HostStatus, error) {
|
||||
|
||||
if len(hosts) == 0 {
|
||||
return nil, errors.New("no hosts provided to end maintenance on")
|
||||
}
|
||||
|
||||
hostList := aurora.NewHosts()
|
||||
hostList.HostNames = hosts
|
||||
|
||||
c.logger.DebugPrintf("EndMaintenance Thrift Payload: %v\n", hostList)
|
||||
|
||||
resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.EndMaintenance(context.TODO(), hostList)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return nil, errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
if resp.GetResult_() != nil && resp.GetResult_().GetEndMaintenanceResult_() != nil {
|
||||
return resp.GetResult_().GetEndMaintenanceResult_().GetStatuses(), nil
|
||||
} else {
|
||||
return nil, errors.New("thrift error: Field in response is nil unexpectedly.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (c *Client) MaintenanceStatus(hosts ...string) (*aurora.MaintenanceStatusResult_, error) {
|
||||
|
||||
var result *aurora.MaintenanceStatusResult_
|
||||
|
||||
if len(hosts) == 0 {
|
||||
return nil, errors.New("no hosts provided to get maintenance status from")
|
||||
}
|
||||
|
||||
hostList := aurora.NewHosts()
|
||||
hostList.HostNames = hosts
|
||||
|
||||
c.logger.DebugPrintf("MaintenanceStatus Thrift Payload: %v\n", hostList)
|
||||
|
||||
// Make thrift call. If we encounter an error sending the call, attempt to reconnect
|
||||
// and continue trying to resend command until we run out of retries.
|
||||
resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.MaintenanceStatus(context.TODO(), hostList)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return result, errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
if resp.GetResult_() != nil {
|
||||
result = resp.GetResult_().GetMaintenanceStatusResult_()
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetQuota sets a quota aggregate for the given role
|
||||
// TODO(zircote) Currently investigating an error that is returned from thrift calls that include resources for `NamedPort` and `NumGpu`
|
||||
func (c *Client) SetQuota(role string, cpu *float64, ramMb *int64, diskMb *int64) error {
|
||||
ramResource := aurora.NewResource()
|
||||
ramResource.RamMb = ramMb
|
||||
cpuResource := aurora.NewResource()
|
||||
cpuResource.NumCpus = cpu
|
||||
diskResource := aurora.NewResource()
|
||||
diskResource.DiskMb = diskMb
|
||||
|
||||
quota := aurora.NewResourceAggregate()
|
||||
quota.Resources = []*aurora.Resource{ramResource, cpuResource, diskResource}
|
||||
|
||||
_, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.SetQuota(context.TODO(), role, quota)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return errors.Wrap(retryErr, "unable to set role quota")
|
||||
}
|
||||
return retryErr
|
||||
|
||||
}
|
||||
|
||||
// GetQuota returns the resource aggregate for the given role
|
||||
func (c *Client) GetQuota(role string) (*aurora.GetQuotaResult_, error) {
|
||||
|
||||
resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.GetQuota(context.TODO(), role)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return nil, errors.Wrap(retryErr, "unable to get role quota")
|
||||
}
|
||||
|
||||
if resp.GetResult_() != nil {
|
||||
return resp.GetResult_().GetGetQuotaResult_(), nil
|
||||
} else {
|
||||
return nil, errors.New("thrift error: Field in response is nil unexpectedly.")
|
||||
}
|
||||
}
|
||||
|
||||
// Force Aurora Scheduler to perform a snapshot and write to Mesos log
|
||||
func (c *Client) Snapshot() error {
|
||||
|
||||
_, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.Snapshot(context.TODO())
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Force Aurora Scheduler to write backup file to a file in the backup directory
|
||||
func (c *Client) PerformBackup() error {
|
||||
|
||||
_, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.PerformBackup(context.TODO())
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Force an Implicit reconciliation between Mesos and Aurora
|
||||
func (c *Client) ForceImplicitTaskReconciliation() error {
|
||||
|
||||
_, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.TriggerImplicitTaskReconciliation(context.TODO())
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Force an Explicit reconciliation between Mesos and Aurora
|
||||
func (c *Client) ForceExplicitTaskReconciliation(batchSize *int32) error {
|
||||
|
||||
if batchSize != nil && *batchSize < 1 {
|
||||
return errors.New("invalid batch size.")
|
||||
}
|
||||
settings := aurora.NewExplicitReconciliationSettings()
|
||||
|
||||
settings.BatchSize = batchSize
|
||||
|
||||
_, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) {
|
||||
return c.adminClient.TriggerExplicitTaskReconciliation(context.TODO(), settings)
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
return errors.Wrap(retryErr, "unable to recover connection")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
171
realis_config.go
Normal file
171
realis_config.go
Normal file
|
@ -0,0 +1,171 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
type clientConfig struct {
|
||||
username, password string
|
||||
url string
|
||||
timeout time.Duration
|
||||
transportProtocol TransportProtocol
|
||||
cluster *Cluster
|
||||
backoff Backoff
|
||||
transport thrift.TTransport
|
||||
protoFactory thrift.TProtocolFactory
|
||||
logger *LevelLogger
|
||||
insecureSkipVerify bool
|
||||
certsPath string
|
||||
clientKey, clientCert string
|
||||
options []ClientOption
|
||||
debug bool
|
||||
trace bool
|
||||
zkOptions []ZKOpt
|
||||
failOnPermanentErrors bool
|
||||
}
|
||||
|
||||
var defaultBackoff = Backoff{
|
||||
Steps: 3,
|
||||
Duration: 10 * time.Second,
|
||||
Factor: 5.0,
|
||||
Jitter: 0.1,
|
||||
}
|
||||
|
||||
type TransportProtocol int
|
||||
|
||||
const (
|
||||
unsetProtocol TransportProtocol = iota
|
||||
jsonProtocol
|
||||
binaryProtocol
|
||||
)
|
||||
|
||||
type ClientOption func(*clientConfig)
|
||||
|
||||
// clientConfig sets for options in clientConfig.
|
||||
func BasicAuth(username, password string) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.username = username
|
||||
config.password = password
|
||||
}
|
||||
}
|
||||
|
||||
func SchedulerUrl(url string) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.url = url
|
||||
}
|
||||
}
|
||||
|
||||
func Timeout(timeout time.Duration) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.timeout = timeout
|
||||
}
|
||||
}
|
||||
|
||||
func ZKCluster(cluster *Cluster) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.cluster = cluster
|
||||
}
|
||||
}
|
||||
|
||||
func ZKUrl(url string) ClientOption {
|
||||
|
||||
opts := []ZKOpt{ZKEndpoints(strings.Split(url, ",")...), ZKPath("/aurora/scheduler")}
|
||||
|
||||
return func(config *clientConfig) {
|
||||
if config.zkOptions == nil {
|
||||
config.zkOptions = opts
|
||||
} else {
|
||||
config.zkOptions = append(config.zkOptions, opts...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func ThriftJSON() ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.transportProtocol = jsonProtocol
|
||||
}
|
||||
}
|
||||
|
||||
func ThriftBinary() ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.transportProtocol = binaryProtocol
|
||||
}
|
||||
}
|
||||
|
||||
func BackOff(b Backoff) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.backoff = b
|
||||
}
|
||||
}
|
||||
|
||||
func InsecureSkipVerify(InsecureSkipVerify bool) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.insecureSkipVerify = InsecureSkipVerify
|
||||
}
|
||||
}
|
||||
|
||||
func CertsPath(certspath string) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.certsPath = certspath
|
||||
}
|
||||
}
|
||||
|
||||
func ClientCerts(clientKey, clientCert string) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.clientKey, config.clientCert = clientKey, clientCert
|
||||
}
|
||||
}
|
||||
|
||||
// Use this option if you'd like to override default settings for connecting to Zookeeper.
|
||||
// See zk.go for what is possible to set as an option.
|
||||
func ZookeeperOptions(opts ...ZKOpt) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.zkOptions = opts
|
||||
}
|
||||
}
|
||||
|
||||
// Using the word set to avoid name collision with Interface.
|
||||
func SetLogger(l Logger) ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.logger = &LevelLogger{Logger: l}
|
||||
}
|
||||
}
|
||||
|
||||
// Enable debug statements.
|
||||
func Debug() ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.debug = true
|
||||
}
|
||||
}
|
||||
|
||||
// Enable trace statements.
|
||||
func Trace() ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.trace = true
|
||||
}
|
||||
}
|
||||
|
||||
// FailOnPermanentErrors - If the client encounters a connection error the standard library
|
||||
// considers permanent, stop retrying and return an error to the user.
|
||||
func FailOnPermanentErrors() ClientOption {
|
||||
return func(config *clientConfig) {
|
||||
config.failOnPermanentErrors = true
|
||||
}
|
||||
}
|
|
@ -22,24 +22,22 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/paypal/gorealis"
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/response"
|
||||
realis "github.com/paypal/gorealis/v2"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var r realis.Realis
|
||||
var monitor *realis.Monitor
|
||||
var thermosPayload []byte
|
||||
var r *realis.Client
|
||||
var thermosExec realis.ThermosExecutor
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
|
||||
// New configuration to connect to docker container
|
||||
r, err = realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
r, err = realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
realis.BasicAuth("aurora", "secret"),
|
||||
realis.TimeoutMS(20000))
|
||||
realis.Timeout(20*time.Second))
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Please run docker-compose up -d before running test suite")
|
||||
|
@ -48,14 +46,8 @@ func TestMain(m *testing.M) {
|
|||
|
||||
defer r.Close()
|
||||
|
||||
// Create monitor
|
||||
monitor = &realis.Monitor{Client: r}
|
||||
|
||||
thermosPayload, err = ioutil.ReadFile("examples/thermos_payload.json")
|
||||
if err != nil {
|
||||
fmt.Println("Error reading thermos payload file: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
thermosExec.AddProcess(realis.NewThermosProcess("boostrap", "echo bootsrapping")).
|
||||
AddProcess(realis.NewThermosProcess("hello_gorealis", "while true; do echo hello world from gorealis; sleep 10; done"))
|
||||
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
@ -68,8 +60,8 @@ func TestNonExistentEndpoint(t *testing.T) {
|
|||
Jitter: 0.1}
|
||||
|
||||
// Attempt to connect to a bad endpoint
|
||||
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081/doesntexist/"),
|
||||
realis.TimeoutMS(200),
|
||||
r, err := realis.NewClient(realis.SchedulerUrl("http://doesntexist.com:8081/api"),
|
||||
realis.Timeout(200*time.Millisecond),
|
||||
realis.BackOff(backoff),
|
||||
)
|
||||
defer r.Close()
|
||||
|
@ -90,13 +82,37 @@ func TestNonExistentEndpoint(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func TestBadCredentials(t *testing.T) {
|
||||
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
realis.BasicAuth("incorrect", "password"),
|
||||
realis.Debug())
|
||||
defer r.Close()
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
||||
job := realis.NewJob().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("create_thermos_job_test").
|
||||
ThermosExecutor(thermosExec).
|
||||
CPU(.5).
|
||||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
InstanceCount(2).
|
||||
AddPorts(1)
|
||||
|
||||
assert.Error(t, r.CreateJob(job))
|
||||
}
|
||||
|
||||
func TestThriftBinary(t *testing.T) {
|
||||
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
realis.BasicAuth("aurora", "secret"),
|
||||
realis.TimeoutMS(20000),
|
||||
realis.Timeout(20*time.Second),
|
||||
realis.ThriftBinary())
|
||||
|
||||
assert.NoError(t, err)
|
||||
defer r.Close()
|
||||
|
||||
role := "all"
|
||||
taskQ := &aurora.TaskQuery{
|
||||
|
@ -108,14 +124,12 @@ func TestThriftBinary(t *testing.T) {
|
|||
|
||||
assert.NoError(t, err)
|
||||
|
||||
r.Close()
|
||||
|
||||
}
|
||||
|
||||
func TestThriftJSON(t *testing.T) {
|
||||
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
realis.BasicAuth("aurora", "secret"),
|
||||
realis.TimeoutMS(20000),
|
||||
realis.Timeout(20*time.Second),
|
||||
realis.ThriftJSON())
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
@ -135,7 +149,7 @@ func TestThriftJSON(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNoopLogger(t *testing.T) {
|
||||
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
|
||||
realis.BasicAuth("aurora", "secret"),
|
||||
realis.SetLogger(realis.NoopLogger{}))
|
||||
|
||||
|
@ -160,6 +174,34 @@ func TestLeaderFromZK(t *testing.T) {
|
|||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "http://192.168.33.7:8081", url)
|
||||
|
||||
}
|
||||
func TestInvalidAuroraURL(t *testing.T) {
|
||||
for _, url := range []string{
|
||||
"http://doesntexist.com:8081/apitest",
|
||||
"test://doesntexist.com:8081",
|
||||
"https://doesntexist.com:8081/testing/api",
|
||||
} {
|
||||
r, err := realis.NewClient(realis.SchedulerUrl(url))
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidAuroraURL(t *testing.T) {
|
||||
for _, url := range []string{
|
||||
"http://domain.com:8081/api",
|
||||
"https://domain.com:8081/api",
|
||||
"domain.com:8081",
|
||||
"domain.com",
|
||||
"192.168.33.7",
|
||||
"192.168.33.7:8081",
|
||||
"192.168.33.7:8081/api",
|
||||
} {
|
||||
r, err := realis.NewClient(realis.SchedulerUrl(url))
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRealisClient_ReestablishConn(t *testing.T) {
|
||||
|
@ -184,8 +226,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
|
|||
Environment("prod").
|
||||
Role(role).
|
||||
Name("create_thermos_job_test").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(thermosPayload)).
|
||||
ThermosExecutor(thermosExec).
|
||||
CPU(.5).
|
||||
RAM(64).
|
||||
Disk(100).
|
||||
|
@ -193,23 +234,21 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
|
|||
InstanceCount(2).
|
||||
AddPorts(1)
|
||||
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
|
||||
// Test Instances Monitor
|
||||
success, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 1, 50)
|
||||
success, err := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 1*time.Second, 50*time.Second)
|
||||
assert.True(t, success)
|
||||
assert.NoError(t, err)
|
||||
|
||||
//Fetch all Jobs
|
||||
_, result, err := r.GetJobs(role)
|
||||
// Fetch all Jobs
|
||||
result, err := r.GetJobs(role)
|
||||
fmt.Printf("GetJobs length: %+v \n", len(result.Configs))
|
||||
assert.Len(t, result.Configs, 1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Test asking the scheduler to perform a Snpshot
|
||||
// Test asking the scheduler to perform a Snapshot
|
||||
t.Run("TestRealisClient_Snapshot", func(t *testing.T) {
|
||||
err := r.Snapshot()
|
||||
assert.NoError(t, err)
|
||||
|
@ -223,12 +262,10 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
|
|||
|
||||
// Tasks must exist for it to, be killed
|
||||
t.Run("TestRealisClient_KillJob_Thermos", func(t *testing.T) {
|
||||
resp, err := r.KillJob(job.JobKey())
|
||||
err := r.KillJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
|
||||
success, err := monitor.Instances(job.JobKey(), 0, 1, 50)
|
||||
success, err := r.MonitorInstances(job.JobKey(), 0, 1*time.Second, 60*time.Second)
|
||||
assert.True(t, success)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
@ -249,9 +286,8 @@ func TestRealisClient_CreateJob_ExecutorDoesNotExist(t *testing.T) {
|
|||
Disk(10).
|
||||
InstanceCount(1)
|
||||
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode())
|
||||
}
|
||||
|
||||
// Test configuring an executor that doesn't exist for CreateJob API
|
||||
|
@ -266,16 +302,14 @@ func TestRealisClient_GetPendingReason(t *testing.T) {
|
|||
Environment(env).
|
||||
Role(role).
|
||||
Name(name).
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(thermosPayload)).
|
||||
ThermosExecutor(thermosExec).
|
||||
CPU(1000).
|
||||
RAM(64).
|
||||
Disk(100).
|
||||
InstanceCount(1)
|
||||
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
|
||||
taskQ := &aurora.TaskQuery{
|
||||
Role: &role,
|
||||
|
@ -287,7 +321,7 @@ func TestRealisClient_GetPendingReason(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, reasons, 1)
|
||||
|
||||
resp, err = r.KillJob(job.JobKey())
|
||||
err = r.KillJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
|
@ -295,119 +329,115 @@ func TestRealisClient_CreateService_WithPulse_Thermos(t *testing.T) {
|
|||
|
||||
fmt.Println("Creating service")
|
||||
role := "vagrant"
|
||||
job := realis.NewJob().
|
||||
job := realis.NewJobUpdate().
|
||||
Environment("prod").
|
||||
Role(role).
|
||||
Name("create_thermos_job_test").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(thermosPayload)).
|
||||
Name("create_thermos_job_pulse_test").
|
||||
CPU(.5).
|
||||
RAM(64).
|
||||
Disk(100).
|
||||
ThermosExecutor(thermosExec).
|
||||
IsService(true).
|
||||
InstanceCount(1).
|
||||
InstanceCount(2).
|
||||
AddPorts(1).
|
||||
AddLabel("currentTime", time.Now().String())
|
||||
AddLabel("currentTime", time.Now().String()).
|
||||
PulseIntervalTimeout(30 * time.Millisecond).
|
||||
BatchSize(1).WaitForBatchCompletion(true)
|
||||
|
||||
pulse := int32(30)
|
||||
timeout := 300
|
||||
settings := realis.NewUpdateSettings()
|
||||
settings.BlockIfNoPulsesAfterMs = &pulse
|
||||
settings.UpdateGroupSize = 1
|
||||
settings.WaitForBatchCompletion = true
|
||||
job.InstanceCount(2)
|
||||
resp, result, err := r.CreateService(job, settings)
|
||||
result, err := r.CreateService(job)
|
||||
fmt.Println(result.String())
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
|
||||
updateQ := aurora.JobUpdateQuery{
|
||||
Key: result.GetKey(),
|
||||
Limit: 1,
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
for i := 0; i*int(pulse) <= timeout; i++ {
|
||||
var updateDetails []*aurora.JobUpdateDetails
|
||||
|
||||
fmt.Println("sending PulseJobUpdate....")
|
||||
resp, err = r.PulseJobUpdate(result.GetKey())
|
||||
assert.NotNil(t, resp)
|
||||
assert.Nil(t, err)
|
||||
ticker := time.NewTicker(time.Second * 3)
|
||||
timer := time.NewTimer(time.Minute * 6)
|
||||
defer ticker.Stop()
|
||||
defer timer.Stop()
|
||||
|
||||
respDetail, err := r.JobUpdateDetails(updateQ)
|
||||
assert.Nil(t, err)
|
||||
|
||||
updateDetail := response.JobUpdateDetails(respDetail)
|
||||
if len(updateDetail) == 0 {
|
||||
fmt.Println("No update found")
|
||||
assert.NotEqual(t, len(updateDetail), 0)
|
||||
}
|
||||
status := updateDetail[0].Update.Summary.State.Status
|
||||
|
||||
if _, ok := aurora.ACTIVE_JOB_UPDATE_STATES[status]; !ok {
|
||||
|
||||
// Rolled forward is the only state in which an update has been successfully updated
|
||||
// if we encounter an inactive state and it is not at rolled forward, update failed
|
||||
if status == aurora.JobUpdateStatus_ROLLED_FORWARD {
|
||||
fmt.Println("Update succeded")
|
||||
break
|
||||
} else {
|
||||
fmt.Println("Update failed")
|
||||
break
|
||||
pulseLoop:
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if result.GetKey() == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
pulseStatus, err := r.PulseJobUpdate(*result.GetKey())
|
||||
|
||||
assert.Nil(t, err)
|
||||
if pulseStatus != aurora.JobUpdatePulseStatus_OK && pulseStatus != aurora.JobUpdatePulseStatus_FINISHED {
|
||||
assert.FailNow(t, "pulse update status received doesn't exist")
|
||||
}
|
||||
|
||||
updateDetails, err = r.JobUpdateDetails(updateQ)
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, len(updateDetails), 1, "no update matching query found")
|
||||
status := updateDetails[0].Update.Summary.State.Status
|
||||
|
||||
if _, ok := realis.ActiveJobUpdateStates[status]; !ok {
|
||||
|
||||
// Rolled forward is the only state in which an update has been successfully updated
|
||||
// if we encounter an inactive state and it is not at rolled forward, update failed
|
||||
if status == aurora.JobUpdateStatus_ROLLED_FORWARD {
|
||||
fmt.Println("Update succeeded")
|
||||
break pulseLoop
|
||||
} else {
|
||||
fmt.Println("Update failed")
|
||||
break pulseLoop
|
||||
}
|
||||
}
|
||||
|
||||
case <-timer.C:
|
||||
err := r.AbortJobUpdate(*updateDetails[0].GetUpdate().GetSummary().GetKey(), "")
|
||||
assert.NoError(t, err)
|
||||
err = r.KillJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
assert.FailNow(t, "timed out during pulse update test")
|
||||
}
|
||||
|
||||
fmt.Println("Polling, update still active...")
|
||||
time.Sleep(time.Duration(pulse) * time.Second)
|
||||
}
|
||||
end := time.Now()
|
||||
fmt.Printf("Update call took %d ns\n", (end.UnixNano() - start.UnixNano()))
|
||||
|
||||
t.Run("TestRealisClient_KillJob_Thermos", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
resp, err := r.KillJob(job.JobKey())
|
||||
end := time.Now()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
fmt.Printf("Kill call took %d ns\n", (end.UnixNano() - start.UnixNano()))
|
||||
})
|
||||
|
||||
err = r.KillJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// Test configuring an executor that doesn't exist for CreateJob API
|
||||
func TestRealisClient_CreateService(t *testing.T) {
|
||||
|
||||
// Create a single job
|
||||
job := realis.NewJob().
|
||||
job := realis.NewJobUpdate().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("create_service_test").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(thermosPayload)).
|
||||
ThermosExecutor(thermosExec).
|
||||
CPU(.25).
|
||||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(3).
|
||||
IsService(true)
|
||||
WatchTime(20 * time.Second).
|
||||
IsService(true).
|
||||
BatchSize(2)
|
||||
|
||||
settings := realis.NewUpdateSettings()
|
||||
settings.UpdateGroupSize = 2
|
||||
job.InstanceCount(3)
|
||||
resp, result, err := r.CreateService(job, settings)
|
||||
result, err := r.CreateService(job)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.GetResponseCode())
|
||||
|
||||
var ok bool
|
||||
var mErr error
|
||||
|
||||
if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil {
|
||||
if ok, mErr = r.MonitorJobUpdate(*result.GetKey(), 5*time.Second, 4*time.Minute); !ok || mErr != nil {
|
||||
// Update may already be in a terminal state so don't check for error
|
||||
_, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.")
|
||||
err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.")
|
||||
|
||||
_, err = r.KillJob(job.JobKey())
|
||||
err = r.KillJob(job.JobKey())
|
||||
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
@ -416,7 +446,7 @@ func TestRealisClient_CreateService(t *testing.T) {
|
|||
assert.NoError(t, mErr)
|
||||
|
||||
// Kill task test task after confirming it came up fine
|
||||
_, err = r.KillJob(job.JobKey())
|
||||
err = r.KillJob(job.JobKey())
|
||||
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
@ -425,7 +455,7 @@ func TestRealisClient_CreateService(t *testing.T) {
|
|||
func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) {
|
||||
|
||||
// Create a single job
|
||||
job := realis.NewJob().
|
||||
jobUpdate := realis.NewJobUpdate().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("executordoesntexist").
|
||||
|
@ -434,15 +464,12 @@ func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) {
|
|||
CPU(.25).
|
||||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(1)
|
||||
InstanceCount(3)
|
||||
|
||||
settings := realis.NewUpdateSettings()
|
||||
job.InstanceCount(3)
|
||||
resp, result, err := r.CreateService(job, settings)
|
||||
result, err := r.CreateService(jobUpdate)
|
||||
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, result)
|
||||
assert.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode())
|
||||
}
|
||||
|
||||
func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) {
|
||||
|
@ -465,87 +492,66 @@ func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) {
|
|||
CronSchedule("* * * * *").
|
||||
IsService(false)
|
||||
|
||||
resp, err := r.ScheduleCronJob(job)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
err = r.ScheduleCronJob(job)
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("TestRealisClient_StartCronJob_Thermos", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
resp, err := r.StartCronJob(job.JobKey())
|
||||
end := time.Now()
|
||||
|
||||
err := r.StartCronJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
fmt.Printf("Schedule cron call took %d ns\n", (end.UnixNano() - start.UnixNano()))
|
||||
})
|
||||
|
||||
t.Run("TestRealisClient_DeschedulerCronJob_Thermos", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
resp, err := r.DescheduleCronJob(job.JobKey())
|
||||
end := time.Now()
|
||||
|
||||
err := r.DescheduleCronJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
fmt.Printf("Deschedule cron call took %d ns\n", (end.UnixNano() - start.UnixNano()))
|
||||
})
|
||||
}
|
||||
func TestRealisClient_StartMaintenance(t *testing.T) {
|
||||
hosts := []string{"localhost"}
|
||||
_, _, err := r.StartMaintenance(hosts...)
|
||||
if err != nil {
|
||||
fmt.Printf("error: %+v\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
_, err := r.StartMaintenance(hosts...)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResults, err := monitor.HostMaintenance(
|
||||
hostResults, err := r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_SCHEDULED},
|
||||
1,
|
||||
50)
|
||||
1*time.Second,
|
||||
50*time.Second)
|
||||
assert.Equal(t, map[string]bool{"localhost": true}, hostResults)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, _, err = r.EndMaintenance(hosts...)
|
||||
_, err = r.EndMaintenance(hosts...)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
_, err = monitor.HostMaintenance(
|
||||
_, err = r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
|
||||
5,
|
||||
10)
|
||||
5*time.Second,
|
||||
10*time.Second)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestRealisClient_DrainHosts(t *testing.T) {
|
||||
hosts := []string{"localhost"}
|
||||
_, _, err := r.DrainHosts(hosts...)
|
||||
if err != nil {
|
||||
fmt.Printf("error: %+v\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
_, err := r.DrainHosts(hosts...)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResults, err := monitor.HostMaintenance(
|
||||
hostResults, err := r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
|
||||
1,
|
||||
50)
|
||||
1*time.Second,
|
||||
50*time.Second)
|
||||
assert.Equal(t, map[string]bool{"localhost": true}, hostResults)
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("TestRealisClient_MonitorNontransitioned", func(t *testing.T) {
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResults, err := monitor.HostMaintenance(
|
||||
hostResults, err := r.MonitorHostMaintenance(
|
||||
append(hosts, "IMAGINARY_HOST"),
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
|
||||
1,
|
||||
1)
|
||||
1*time.Second,
|
||||
1*time.Second)
|
||||
|
||||
// Assert monitor returned an error that was not nil, and also a list of the non-transitioned hosts
|
||||
assert.Error(t, err)
|
||||
|
@ -553,15 +559,15 @@ func TestRealisClient_DrainHosts(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("TestRealisClient_EndMaintenance", func(t *testing.T) {
|
||||
_, _, err := r.EndMaintenance(hosts...)
|
||||
_, err := r.EndMaintenance(hosts...)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
_, err = monitor.HostMaintenance(
|
||||
_, err = r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
|
||||
5,
|
||||
10)
|
||||
5*time.Second,
|
||||
10*time.Second)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
|
@ -578,23 +584,23 @@ func TestRealisClient_SLADrainHosts(t *testing.T) {
|
|||
}
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
hostResults, err := monitor.HostMaintenance(
|
||||
hostResults, err := r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
|
||||
1,
|
||||
50)
|
||||
1*time.Second,
|
||||
50*time.Second)
|
||||
assert.Equal(t, map[string]bool{"localhost": true}, hostResults)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, _, err = r.EndMaintenance(hosts...)
|
||||
_, err = r.EndMaintenance(hosts...)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
_, err = monitor.HostMaintenance(
|
||||
_, err = r.MonitorHostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
|
||||
5,
|
||||
10)
|
||||
5*time.Second,
|
||||
10*time.Second)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
|
@ -606,18 +612,15 @@ func TestRealisClient_SessionThreadSafety(t *testing.T) {
|
|||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("create_thermos_job_test_multi").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(thermosPayload)).
|
||||
ThermosExecutor(thermosExec).
|
||||
CPU(.25).
|
||||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(1000) // Impossible amount to go live in any sane machine
|
||||
|
||||
resp, err := r.CreateJob(job)
|
||||
err := r.CreateJob(job)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
for i := 0; i < 20; i++ {
|
||||
|
||||
|
@ -628,15 +631,13 @@ func TestRealisClient_SessionThreadSafety(t *testing.T) {
|
|||
defer wg.Done()
|
||||
|
||||
// Test Schedule status monitor for terminal state and timing out after 30 seconds
|
||||
success, err := monitor.ScheduleStatus(job.JobKey(), job.GetInstanceCount(), aurora.LIVE_STATES, 1, 30)
|
||||
success, err := r.MonitorScheduleStatus(job.JobKey(), job.GetInstanceCount(), aurora.LIVE_STATES, 1, 30)
|
||||
assert.False(t, success)
|
||||
assert.Error(t, err)
|
||||
|
||||
resp, err := r.KillJob(job.JobKey())
|
||||
err = r.KillJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
|
||||
}()
|
||||
}
|
||||
|
||||
|
@ -648,19 +649,15 @@ func TestRealisClient_SetQuota(t *testing.T) {
|
|||
var cpu = 3.5
|
||||
var ram int64 = 20480
|
||||
var disk int64 = 10240
|
||||
resp, err := r.SetQuota("vagrant", &cpu, &ram, &disk)
|
||||
err := r.SetQuota("vagrant", &cpu, &ram, &disk)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
t.Run("TestRealisClient_GetQuota", func(t *testing.T) {
|
||||
// Test GetQuota based on previously set values
|
||||
var result *aurora.GetQuotaResult_
|
||||
resp, err = r.GetQuota("vagrant")
|
||||
if resp.GetResult_() != nil {
|
||||
result = resp.GetResult_().GetQuotaResult_
|
||||
}
|
||||
quotaResult, err := r.GetQuota("vagrant")
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
|
||||
for res := range result.Quota.GetResources() {
|
||||
for _, res := range quotaResult.GetQuota().GetResources() {
|
||||
switch true {
|
||||
case res.DiskMb != nil:
|
||||
assert.Equal(t, disk, *res.DiskMb)
|
||||
|
@ -692,3 +689,37 @@ func TestRealisClient_ForceExplicitTaskReconciliation(t *testing.T) {
|
|||
err = r.ForceExplicitTaskReconciliation(&batchSize)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestRealisClient_PartitionPolicy(t *testing.T) {
|
||||
|
||||
role := "vagrant"
|
||||
var partitionDelay int64 = 30
|
||||
job := realis.NewJobUpdate().
|
||||
Environment("prod").
|
||||
Role(role).
|
||||
Name("create_thermos_job_partition_policy_test").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ThermosExecutor(thermosExec).
|
||||
CPU(.5).
|
||||
RAM(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
InstanceCount(2).
|
||||
BatchSize(2).
|
||||
PartitionPolicy(true, partitionDelay)
|
||||
|
||||
result, err := r.CreateService(job)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var ok bool
|
||||
var mErr error
|
||||
|
||||
if ok, mErr = r.MonitorJobUpdate(*result.GetKey(), 5*time.Second, 4*time.Minute); !ok || mErr != nil {
|
||||
// Update may already be in a terminal state so don't check for error
|
||||
err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.")
|
||||
err = r.KillJob(job.JobKey())
|
||||
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
72
realis_test.go
Normal file
72
realis_test.go
Normal file
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetCACerts(t *testing.T) {
|
||||
certs, err := GetCerts("./examples/certs")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, len(certs.Subjects()), 2)
|
||||
}
|
||||
|
||||
func TestAuroraURLValidator(t *testing.T) {
|
||||
t.Run("badURL", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("http://badurl.com/badpath")
|
||||
assert.Empty(t, url)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("URLHttp", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("http://goodurl.com:8081/api")
|
||||
assert.Equal(t, "http://goodurl.com:8081/api", url)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("URLHttps", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("https://goodurl.com:8081/api")
|
||||
assert.Equal(t, "https://goodurl.com:8081/api", url)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("URLNoPath", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("http://goodurl.com:8081")
|
||||
assert.Equal(t, "http://goodurl.com:8081/api", url)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("ipAddrNoPath", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("http://192.168.1.33:8081")
|
||||
assert.Equal(t, "http://192.168.1.33:8081/api", url)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("URLNoProtocol", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("goodurl.com:8081/api")
|
||||
assert.Equal(t, "http://goodurl.com:8081/api", url)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("URLNoProtocolNoPathNoPort", func(t *testing.T) {
|
||||
url, err := validateAuroraAddress("goodurl.com")
|
||||
assert.Equal(t, "http://goodurl.com:8081/api", url)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
|
@ -17,9 +17,8 @@ package response
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
// Get key from a response created by a StartJobUpdate call
|
||||
|
@ -39,18 +38,6 @@ func JobUpdateSummaries(resp *aurora.Response) []*aurora.JobUpdateSummary {
|
|||
return resp.GetResult_().GetGetJobUpdateSummariesResult_().GetUpdateSummaries()
|
||||
}
|
||||
|
||||
// Deprecated: Replaced by checks done inside of thriftCallHelper
|
||||
func ResponseCodeCheck(resp *aurora.Response) (*aurora.Response, error) {
|
||||
if resp == nil {
|
||||
return resp, errors.New("Response is nil")
|
||||
}
|
||||
if resp.GetResponseCode() != aurora.ResponseCode_OK {
|
||||
return resp, errors.New(CombineMessage(resp))
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Based on aurora client: src/main/python/apache/aurora/client/base.py
|
||||
func CombineMessage(resp *aurora.Response) string {
|
||||
var buffer bytes.Buffer
|
||||
|
|
74
retry.go
74
retry.go
|
@ -17,12 +17,15 @@ package realis
|
|||
import (
|
||||
"io"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/response"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/paypal/gorealis/v2/response"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -66,6 +69,7 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc)
|
|||
var err error
|
||||
var ok bool
|
||||
var curStep int
|
||||
|
||||
duration := backoff.Duration
|
||||
|
||||
for curStep = 0; curStep < backoff.Steps; curStep++ {
|
||||
|
@ -77,7 +81,7 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc)
|
|||
adjusted = Jitter(duration, backoff.Jitter)
|
||||
}
|
||||
|
||||
logger.Printf("A retriable error occurred during function call, backing off for %v before retrying\n", adjusted)
|
||||
logger.Printf("A retryable error occurred during function call, backing off for %v before retrying\n", adjusted)
|
||||
time.Sleep(adjusted)
|
||||
duration = time.Duration(float64(duration) * backoff.Factor)
|
||||
}
|
||||
|
@ -116,12 +120,13 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc)
|
|||
type auroraThriftCall func() (resp *aurora.Response, err error)
|
||||
|
||||
// Duplicates the functionality of ExponentialBackoff but is specifically targeted towards ThriftCalls.
|
||||
func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*aurora.Response, error) {
|
||||
func (c *Client) thriftCallWithRetries(returnOnTimeout bool, thriftCall auroraThriftCall) (*aurora.Response, error) {
|
||||
var resp *aurora.Response
|
||||
var clientErr error
|
||||
var curStep int
|
||||
var timeouts int
|
||||
|
||||
backoff := r.config.backoff
|
||||
backoff := c.config.backoff
|
||||
duration := backoff.Duration
|
||||
|
||||
for curStep = 0; curStep < backoff.Steps; curStep++ {
|
||||
|
@ -133,7 +138,7 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
|
|||
adjusted = Jitter(duration, backoff.Jitter)
|
||||
}
|
||||
|
||||
r.logger.Printf("A retriable error occurred during thrift call, backing off for %v before retry %v\n", adjusted, curStep)
|
||||
c.logger.Printf("A retryable error occurred during thrift call, backing off for %v before retry %v\n", adjusted, curStep)
|
||||
|
||||
time.Sleep(adjusted)
|
||||
duration = time.Duration(float64(duration) * backoff.Factor)
|
||||
|
@ -143,47 +148,68 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
|
|||
// Placing this in an anonymous function in order to create a new, short-lived stack allowing unlock
|
||||
// to be run in case of a panic inside of thriftCall.
|
||||
func() {
|
||||
r.lock.Lock()
|
||||
defer r.lock.Unlock()
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
resp, clientErr = thriftCall()
|
||||
|
||||
r.logger.DebugPrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr)
|
||||
c.logger.TracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr)
|
||||
}()
|
||||
|
||||
// Check if our thrift call is returning an error. This is a retriable event as we don't know
|
||||
// Check if our thrift call is returning an error. This is a retryable event as we don't know
|
||||
// if it was caused by network issues.
|
||||
if clientErr != nil {
|
||||
|
||||
// Print out the error to the user
|
||||
r.logger.Printf("Client Error: %v\n", clientErr)
|
||||
c.logger.Printf("Client Error: %v\n", clientErr)
|
||||
|
||||
// Determine if error is a temporary URL error by going up the stack
|
||||
e, ok := clientErr.(thrift.TTransportException)
|
||||
if ok {
|
||||
r.logger.DebugPrint("Encountered a transport exception")
|
||||
c.logger.DebugPrint("Encountered a transport exception")
|
||||
|
||||
// TODO(rdelvalle): Figure out a better way to obtain the error code as this is a very brittle solution
|
||||
// 401 Unauthorized means the wrong username and password were provided
|
||||
if strings.Contains(e.Error(), strconv.Itoa(http.StatusUnauthorized)) {
|
||||
return nil, errors.Wrap(clientErr, "wrong username or password provided")
|
||||
}
|
||||
|
||||
e, ok := e.Err().(*url.Error)
|
||||
if ok {
|
||||
// EOF error occurs when the server closes the read buffer of the client. This is common
|
||||
// when the server is overloaded and should be retried. All other errors that are permanent
|
||||
// will not be retried.
|
||||
if e.Err != io.EOF && !e.Temporary() {
|
||||
return nil, errors.Wrap(clientErr, "Permanent connection error")
|
||||
if e.Err != io.EOF && !e.Temporary() && c.RealisConfig().failOnPermanentErrors {
|
||||
return nil, errors.Wrap(clientErr, "permanent connection error")
|
||||
}
|
||||
// Corner case where thrift payload was received by Aurora but connection timedout before Aurora was
|
||||
// able to reply. In this case we will return whatever response was received and a TimedOut behaving
|
||||
// error. Users can take special action on a timeout by using IsTimedout and reacting accordingly.
|
||||
if e.Timeout() {
|
||||
timeouts++
|
||||
c.logger.DebugPrintf(
|
||||
"Client closed connection (timedout) %d times before server responded,"+
|
||||
" consider increasing connection timeout",
|
||||
timeouts)
|
||||
if returnOnTimeout {
|
||||
return resp,
|
||||
newTimedoutError(errors.New("client connection closed before server answer"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In the future, reestablish connection should be able to check if it is actually possible
|
||||
// to make a thrift call to Aurora. For now, a reconnect should always lead to a retry.
|
||||
r.ReestablishConn()
|
||||
// Ignoring error due to the fact that an error should be retried regardless
|
||||
_ = c.ReestablishConn()
|
||||
|
||||
} else {
|
||||
|
||||
// If there was no client error, but the response is nil, something went wrong.
|
||||
// Ideally, we'll never encounter this but we're placing a safeguard here.
|
||||
if resp == nil {
|
||||
return nil, errors.New("Response from aurora is nil")
|
||||
return nil, errors.New("response from aurora is nil")
|
||||
}
|
||||
|
||||
// Check Response Code from thrift and make a decision to continue retrying or not.
|
||||
|
@ -195,31 +221,31 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
|
|||
|
||||
// If the response code is transient, continue retrying
|
||||
case aurora.ResponseCode_ERROR_TRANSIENT:
|
||||
r.logger.Println("Aurora replied with Transient error code, retrying")
|
||||
c.logger.Println("Aurora replied with Transient error code, retrying")
|
||||
continue
|
||||
|
||||
// Failure scenarios, these indicate a bad payload or a bad config. Stop retrying.
|
||||
// Failure scenarios, these indicate a bad payload or a bad clientConfig. Stop retrying.
|
||||
case aurora.ResponseCode_INVALID_REQUEST,
|
||||
aurora.ResponseCode_ERROR,
|
||||
aurora.ResponseCode_AUTH_FAILED,
|
||||
aurora.ResponseCode_JOB_UPDATING_ERROR:
|
||||
r.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String())
|
||||
c.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String())
|
||||
return resp, errors.New(response.CombineMessage(resp))
|
||||
|
||||
// The only case that should fall down to here is a WARNING response code.
|
||||
// It is currently not used as a response in the scheduler so it is unknown how to handle it.
|
||||
default:
|
||||
r.logger.DebugPrintf("unhandled response code %v received from Aurora\n", responseCode)
|
||||
return nil, errors.Errorf("unhandled response code from Aurora %v\n", responseCode.String())
|
||||
c.logger.DebugPrintf("unhandled response code %v received from Aurora\n", responseCode)
|
||||
return nil, errors.Errorf("unhandled response code from Aurora %v", responseCode.String())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
r.logger.DebugPrintf("it took %v retries to complete this operation\n", curStep)
|
||||
c.logger.DebugPrintf("it took %v retries to complete this operation\n", curStep)
|
||||
|
||||
if curStep > 1 {
|
||||
r.config.logger.Printf("retried this thrift call %d time(s)", curStep)
|
||||
c.config.logger.Printf("retried this thrift call %d time(s)", curStep)
|
||||
}
|
||||
|
||||
// Provide more information to the user wherever possible.
|
||||
|
|
2
runTestsMac.sh
Executable file → Normal file
2
runTestsMac.sh
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues.
|
||||
docker run -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10.3-stretch go test -v github.com/paypal/gorealis
|
||||
docker run --rm -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10-stretch go test -v github.com/paypal/gorealis $@
|
||||
|
|
449
task.go
Normal file
449
task.go
Normal file
|
@ -0,0 +1,449 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
type ResourceType int
|
||||
|
||||
const (
|
||||
CPU ResourceType = iota
|
||||
RAM
|
||||
DISK
|
||||
GPU
|
||||
)
|
||||
|
||||
const (
|
||||
dedicated = "dedicated"
|
||||
portPrefix = "org.apache.aurora.port."
|
||||
)
|
||||
|
||||
type AuroraTask struct {
|
||||
task *aurora.TaskConfig
|
||||
resources map[ResourceType]*aurora.Resource
|
||||
portCount int
|
||||
thermos *ThermosExecutor
|
||||
}
|
||||
|
||||
func NewTask() *AuroraTask {
|
||||
numCpus := &aurora.Resource{}
|
||||
ramMb := &aurora.Resource{}
|
||||
diskMb := &aurora.Resource{}
|
||||
|
||||
numCpus.NumCpus = new(float64)
|
||||
ramMb.RamMb = new(int64)
|
||||
diskMb.DiskMb = new(int64)
|
||||
|
||||
resources := map[ResourceType]*aurora.Resource{CPU: numCpus, RAM: ramMb, DISK: diskMb}
|
||||
|
||||
return &AuroraTask{task: &aurora.TaskConfig{
|
||||
Job: &aurora.JobKey{},
|
||||
MesosFetcherUris: make([]*aurora.MesosFetcherURI, 0),
|
||||
Metadata: make([]*aurora.Metadata, 0),
|
||||
Constraints: make([]*aurora.Constraint, 0),
|
||||
// Container is a Union so one container field must be set. Set Mesos by default.
|
||||
Container: NewMesosContainer().Build(),
|
||||
Resources: []*aurora.Resource{numCpus, ramMb, diskMb},
|
||||
},
|
||||
resources: resources,
|
||||
portCount: 0}
|
||||
}
|
||||
|
||||
// Helper method to convert aurora.TaskConfig to gorealis AuroraTask type
|
||||
func TaskFromThrift(config *aurora.TaskConfig) *AuroraTask {
|
||||
|
||||
newTask := NewTask()
|
||||
|
||||
// Pass values using receivers as much as possible
|
||||
newTask.
|
||||
Environment(config.Job.Environment).
|
||||
Role(config.Job.Role).
|
||||
Name(config.Job.Name).
|
||||
MaxFailure(config.MaxTaskFailures).
|
||||
IsService(config.IsService)
|
||||
|
||||
if config.Tier != nil {
|
||||
newTask.Tier(*config.Tier)
|
||||
}
|
||||
|
||||
if config.ExecutorConfig != nil {
|
||||
newTask.
|
||||
ExecutorName(config.ExecutorConfig.Name).
|
||||
ExecutorData(config.ExecutorConfig.Data)
|
||||
}
|
||||
|
||||
if config.PartitionPolicy != nil {
|
||||
newTask.PartitionPolicy(
|
||||
aurora.PartitionPolicy{
|
||||
Reschedule: config.PartitionPolicy.Reschedule,
|
||||
DelaySecs: thrift.Int64Ptr(*config.PartitionPolicy.DelaySecs),
|
||||
})
|
||||
}
|
||||
|
||||
// Make a deep copy of the task's container
|
||||
if config.Container != nil {
|
||||
if config.Container.Mesos != nil {
|
||||
mesosContainer := NewMesosContainer()
|
||||
|
||||
if config.Container.Mesos.Image != nil {
|
||||
if config.Container.Mesos.Image.Appc != nil {
|
||||
mesosContainer.AppcImage(config.Container.Mesos.Image.Appc.Name, config.Container.Mesos.Image.Appc.ImageId)
|
||||
} else if config.Container.Mesos.Image.Docker != nil {
|
||||
mesosContainer.DockerImage(config.Container.Mesos.Image.Docker.Name, config.Container.Mesos.Image.Docker.Tag)
|
||||
}
|
||||
}
|
||||
|
||||
for _, vol := range config.Container.Mesos.Volumes {
|
||||
mesosContainer.AddVolume(vol.ContainerPath, vol.HostPath, vol.Mode)
|
||||
}
|
||||
|
||||
newTask.Container(mesosContainer)
|
||||
} else if config.Container.Docker != nil {
|
||||
dockerContainer := NewDockerContainer()
|
||||
dockerContainer.Image(config.Container.Docker.Image)
|
||||
|
||||
for _, param := range config.Container.Docker.Parameters {
|
||||
dockerContainer.AddParameter(param.Name, param.Value)
|
||||
}
|
||||
|
||||
newTask.Container(dockerContainer)
|
||||
}
|
||||
}
|
||||
|
||||
// Copy all ports
|
||||
for _, resource := range config.Resources {
|
||||
// Copy only ports. Set CPU, RAM, DISK, and GPU
|
||||
if resource != nil {
|
||||
if resource.NamedPort != nil {
|
||||
newTask.task.Resources = append(
|
||||
newTask.task.Resources,
|
||||
&aurora.Resource{NamedPort: thrift.StringPtr(*resource.NamedPort)},
|
||||
)
|
||||
newTask.portCount++
|
||||
}
|
||||
|
||||
if resource.RamMb != nil {
|
||||
newTask.RAM(*resource.RamMb)
|
||||
}
|
||||
|
||||
if resource.NumCpus != nil {
|
||||
newTask.CPU(*resource.NumCpus)
|
||||
}
|
||||
|
||||
if resource.DiskMb != nil {
|
||||
newTask.Disk(*resource.DiskMb)
|
||||
}
|
||||
|
||||
if resource.NumGpus != nil {
|
||||
newTask.GPU(*resource.NumGpus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy constraints
|
||||
for _, constraint := range config.Constraints {
|
||||
if constraint != nil && constraint.Constraint != nil {
|
||||
|
||||
newConstraint := aurora.Constraint{Name: constraint.Name}
|
||||
|
||||
taskConstraint := constraint.Constraint
|
||||
if taskConstraint.Limit != nil {
|
||||
newConstraint.Constraint = &aurora.TaskConstraint{
|
||||
Limit: &aurora.LimitConstraint{Limit: taskConstraint.Limit.Limit},
|
||||
}
|
||||
newTask.task.Constraints = append(newTask.task.Constraints, &newConstraint)
|
||||
|
||||
} else if taskConstraint.Value != nil {
|
||||
|
||||
values := make([]string, 0)
|
||||
for _, val := range taskConstraint.Value.Values {
|
||||
values = append(values, val)
|
||||
}
|
||||
|
||||
newConstraint.Constraint = &aurora.TaskConstraint{
|
||||
Value: &aurora.ValueConstraint{Negated: taskConstraint.Value.Negated, Values: values}}
|
||||
|
||||
newTask.task.Constraints = append(newTask.task.Constraints, &newConstraint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy labels
|
||||
for _, label := range config.Metadata {
|
||||
newTask.task.Metadata = append(newTask.task.Metadata, &aurora.Metadata{Key: label.Key, Value: label.Value})
|
||||
}
|
||||
|
||||
// Copy Mesos fetcher URIs
|
||||
for _, uri := range config.MesosFetcherUris {
|
||||
newTask.task.MesosFetcherUris = append(
|
||||
newTask.task.MesosFetcherUris,
|
||||
&aurora.MesosFetcherURI{
|
||||
Value: uri.Value,
|
||||
Extract: thrift.BoolPtr(*uri.Extract),
|
||||
Cache: thrift.BoolPtr(*uri.Cache),
|
||||
})
|
||||
}
|
||||
|
||||
return newTask
|
||||
}
|
||||
|
||||
// Set AuroraTask Key environment.
|
||||
func (t *AuroraTask) Environment(env string) *AuroraTask {
|
||||
t.task.Job.Environment = env
|
||||
return t
|
||||
}
|
||||
|
||||
// Set AuroraTask Key Role.
|
||||
func (t *AuroraTask) Role(role string) *AuroraTask {
|
||||
t.task.Job.Role = role
|
||||
return t
|
||||
}
|
||||
|
||||
// Set AuroraTask Key Name.
|
||||
func (t *AuroraTask) Name(name string) *AuroraTask {
|
||||
t.task.Job.Name = name
|
||||
return t
|
||||
}
|
||||
|
||||
// Set name of the executor that will the task will be configured to.
|
||||
func (t *AuroraTask) ExecutorName(name string) *AuroraTask {
|
||||
if t.task.ExecutorConfig == nil {
|
||||
t.task.ExecutorConfig = aurora.NewExecutorConfig()
|
||||
}
|
||||
|
||||
t.task.ExecutorConfig.Name = name
|
||||
return t
|
||||
}
|
||||
|
||||
// Will be included as part of entire task inside the scheduler that will be serialized.
|
||||
func (t *AuroraTask) ExecutorData(data string) *AuroraTask {
|
||||
if t.task.ExecutorConfig == nil {
|
||||
t.task.ExecutorConfig = aurora.NewExecutorConfig()
|
||||
}
|
||||
|
||||
t.task.ExecutorConfig.Data = data
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) CPU(cpus float64) *AuroraTask {
|
||||
*t.resources[CPU].NumCpus = cpus
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) RAM(ram int64) *AuroraTask {
|
||||
*t.resources[RAM].RamMb = ram
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) Disk(disk int64) *AuroraTask {
|
||||
*t.resources[DISK].DiskMb = disk
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) GPU(gpu int64) *AuroraTask {
|
||||
// GPU resource must be set explicitly since the scheduler by default
|
||||
// rejects jobs with GPU resources attached to it.
|
||||
if _, ok := t.resources[GPU]; !ok {
|
||||
t.resources[GPU] = &aurora.Resource{}
|
||||
t.task.Resources = append(t.task.Resources, t.resources[GPU])
|
||||
}
|
||||
|
||||
t.resources[GPU].NumGpus = &gpu
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) Tier(tier string) *AuroraTask {
|
||||
t.task.Tier = &tier
|
||||
return t
|
||||
}
|
||||
|
||||
// How many failures to tolerate before giving up.
|
||||
func (t *AuroraTask) MaxFailure(maxFail int32) *AuroraTask {
|
||||
t.task.MaxTaskFailures = maxFail
|
||||
return t
|
||||
}
|
||||
|
||||
// Restart the job's tasks if they fail
|
||||
func (t *AuroraTask) IsService(isService bool) *AuroraTask {
|
||||
t.task.IsService = isService
|
||||
return t
|
||||
}
|
||||
|
||||
// Add a list of URIs with the same extract and cache configuration. Scheduler must have
|
||||
// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.
|
||||
func (t *AuroraTask) AddURIs(extract bool, cache bool, values ...string) *AuroraTask {
|
||||
for _, value := range values {
|
||||
t.task.MesosFetcherUris = append(
|
||||
t.task.MesosFetcherUris,
|
||||
&aurora.MesosFetcherURI{Value: value, Extract: &extract, Cache: &cache})
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// Adds a Mesos label to the job. Note that Aurora will add the
|
||||
// prefix "org.apache.aurora.metadata." to the beginning of each key.
|
||||
func (t *AuroraTask) AddLabel(key string, value string) *AuroraTask {
|
||||
t.task.Metadata = append(t.task.Metadata, &aurora.Metadata{Key: key, Value: value})
|
||||
return t
|
||||
}
|
||||
|
||||
// Add a named port to the job configuration These are random ports as it's
|
||||
// not currently possible to request specific ports using Aurora.
|
||||
func (t *AuroraTask) AddNamedPorts(names ...string) *AuroraTask {
|
||||
t.portCount += len(names)
|
||||
for _, name := range names {
|
||||
t.task.Resources = append(t.task.Resources, &aurora.Resource{NamedPort: &name})
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
// Adds a request for a number of ports to the job configuration. The names chosen for these ports
|
||||
// will be org.apache.aurora.port.X, where X is the current port count for the job configuration
|
||||
// starting at 0. These are random ports as it's not currently possible to request
|
||||
// specific ports using Aurora.
|
||||
func (t *AuroraTask) AddPorts(num int) *AuroraTask {
|
||||
start := t.portCount
|
||||
t.portCount += num
|
||||
for i := start; i < t.portCount; i++ {
|
||||
portName := portPrefix + strconv.Itoa(i)
|
||||
t.task.Resources = append(t.task.Resources, &aurora.Resource{NamedPort: &portName})
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
// From Aurora Docs:
|
||||
// Add a Value constraint
|
||||
// name - Mesos slave attribute that the constraint is matched against.
|
||||
// If negated = true , treat this as a 'not' - to avoid specific values.
|
||||
// Values - list of values we look for in attribute name
|
||||
func (t *AuroraTask) AddValueConstraint(name string, negated bool, values ...string) *AuroraTask {
|
||||
t.task.Constraints = append(t.task.Constraints,
|
||||
&aurora.Constraint{
|
||||
Name: name,
|
||||
Constraint: &aurora.TaskConstraint{
|
||||
Value: &aurora.ValueConstraint{
|
||||
Negated: negated,
|
||||
Values: values,
|
||||
},
|
||||
Limit: nil,
|
||||
},
|
||||
})
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
// From Aurora Docs:
|
||||
// A constraint that specifies the maximum number of active tasks on a host with
|
||||
// a matching attribute that may be scheduled simultaneously.
|
||||
func (t *AuroraTask) AddLimitConstraint(name string, limit int32) *AuroraTask {
|
||||
t.task.Constraints = append(t.task.Constraints,
|
||||
&aurora.Constraint{
|
||||
Name: name,
|
||||
Constraint: &aurora.TaskConstraint{
|
||||
Value: nil,
|
||||
Limit: &aurora.LimitConstraint{Limit: limit},
|
||||
},
|
||||
})
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
// From Aurora Docs:
|
||||
// dedicated attribute. Aurora treats this specially, and only allows matching jobs
|
||||
// to run on these machines, and will only schedule matching jobs on these machines.
|
||||
// When a job is created, the scheduler requires that the $role component matches
|
||||
// the role field in the job configuration, and will reject the job creation otherwise.
|
||||
// A wildcard (*) may be used for the role portion of the dedicated attribute, which
|
||||
// will allow any owner to elect for a job to run on the host(s)
|
||||
func (t *AuroraTask) AddDedicatedConstraint(role, name string) *AuroraTask {
|
||||
t.AddValueConstraint(dedicated, false, role+"/"+name)
|
||||
return t
|
||||
}
|
||||
|
||||
// Set a container to run for the job configuration to run.
|
||||
func (t *AuroraTask) Container(container Container) *AuroraTask {
|
||||
t.task.Container = container.Build()
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) TaskConfig() *aurora.TaskConfig {
|
||||
return t.task
|
||||
}
|
||||
|
||||
func (t *AuroraTask) JobKey() aurora.JobKey {
|
||||
return *t.task.Job
|
||||
}
|
||||
|
||||
func (t *AuroraTask) Clone() *AuroraTask {
|
||||
newTask := TaskFromThrift(t.task)
|
||||
|
||||
if t.thermos != nil {
|
||||
newTask.ThermosExecutor(*t.thermos.Clone())
|
||||
}
|
||||
|
||||
return newTask
|
||||
}
|
||||
|
||||
func (t *AuroraTask) ThermosExecutor(thermos ThermosExecutor) *AuroraTask {
|
||||
t.thermos = &thermos
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *AuroraTask) BuildThermosPayload() error {
|
||||
if t.thermos != nil {
|
||||
|
||||
// Set the correct resources
|
||||
if t.resources[CPU].NumCpus != nil {
|
||||
t.thermos.cpu(*t.resources[CPU].NumCpus)
|
||||
}
|
||||
|
||||
if t.resources[RAM].RamMb != nil {
|
||||
t.thermos.ram(*t.resources[RAM].RamMb)
|
||||
}
|
||||
|
||||
if t.resources[DISK].DiskMb != nil {
|
||||
t.thermos.disk(*t.resources[DISK].DiskMb)
|
||||
}
|
||||
|
||||
if t.resources[GPU] != nil && t.resources[GPU].NumGpus != nil {
|
||||
t.thermos.gpu(*t.resources[GPU].NumGpus)
|
||||
}
|
||||
|
||||
payload, err := json.Marshal(t.thermos)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
t.ExecutorName(aurora.AURORA_EXECUTOR_NAME)
|
||||
t.ExecutorData(string(payload))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Set a partition policy for the job configuration to implement.
|
||||
func (t *AuroraTask) PartitionPolicy(policy aurora.PartitionPolicy) *AuroraTask {
|
||||
t.task.PartitionPolicy = &policy
|
||||
|
||||
return t
|
||||
}
|
57
task_test.go
Normal file
57
task_test.go
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
realis "github.com/paypal/gorealis/v2"
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAuroraTask_Clone(t *testing.T) {
|
||||
|
||||
task0 := realis.NewTask().
|
||||
Environment("development").
|
||||
Role("ubuntu").
|
||||
Name("this_is_a_test").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData("{fake:payload}").
|
||||
CPU(10).
|
||||
RAM(643).
|
||||
Disk(1000).
|
||||
IsService(true).
|
||||
AddPorts(10).
|
||||
Tier("preferred").
|
||||
MaxFailure(23).
|
||||
AddURIs(true, true, "testURI").
|
||||
AddLabel("Test", "Value").
|
||||
AddNamedPorts("test").
|
||||
AddValueConstraint("test", false, "testing").
|
||||
AddLimitConstraint("test_limit", 1).
|
||||
AddDedicatedConstraint("ubuntu", "name").
|
||||
Container(realis.NewDockerContainer().AddParameter("hello", "world").Image("testImg"))
|
||||
|
||||
task1 := task0.Clone()
|
||||
|
||||
assert.EqualValues(t, task0, task1, "Clone does not return the correct deep copy of AuroraTask")
|
||||
|
||||
task0.Container(realis.NewMesosContainer().
|
||||
AppcImage("test", "testing").
|
||||
AddVolume("test", "test", aurora.Mode_RW))
|
||||
task2 := task0.Clone()
|
||||
assert.EqualValues(t, task0, task2, "Clone does not return the correct deep copy of AuroraTask")
|
||||
}
|
195
thermos.go
Normal file
195
thermos.go
Normal file
|
@ -0,0 +1,195 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ThermosExecutor struct {
|
||||
Task ThermosTask `json:"task""`
|
||||
order *ThermosConstraint `json:"-"`
|
||||
}
|
||||
|
||||
type ThermosTask struct {
|
||||
Processes map[string]*ThermosProcess `json:"processes"`
|
||||
Constraints []*ThermosConstraint `json:"constraints"`
|
||||
Resources thermosResources `json:"resources"`
|
||||
}
|
||||
|
||||
type ThermosConstraint struct {
|
||||
Order []string `json:"order,omitempty"`
|
||||
}
|
||||
|
||||
// This struct should always be controlled by the Aurora job struct.
|
||||
// Therefore it is private.
|
||||
type thermosResources struct {
|
||||
CPU *float64 `json:"cpu,omitempty"`
|
||||
Disk *int64 `json:"disk,omitempty"`
|
||||
RAM *int64 `json:"ram,omitempty"`
|
||||
GPU *int64 `json:"gpu,omitempty"`
|
||||
}
|
||||
|
||||
type ThermosProcess struct {
|
||||
Name string `json:"name"`
|
||||
Cmdline string `json:"cmdline"`
|
||||
Daemon bool `json:"daemon"`
|
||||
Ephemeral bool `json:"ephemeral"`
|
||||
MaxFailures int `json:"max_failures"`
|
||||
MinDuration int `json:"min_duration"`
|
||||
Final bool `json:"final"`
|
||||
}
|
||||
|
||||
func NewThermosProcess(name, command string) ThermosProcess {
|
||||
return ThermosProcess{
|
||||
Name: name,
|
||||
Cmdline: command,
|
||||
MaxFailures: 1,
|
||||
Daemon: false,
|
||||
Ephemeral: false,
|
||||
MinDuration: 5,
|
||||
Final: false}
|
||||
}
|
||||
|
||||
// Processes must have unique names. Adding a process whose name already exists will
|
||||
// result in overwriting the previous version of the process.
|
||||
func (t *ThermosExecutor) AddProcess(process ThermosProcess) *ThermosExecutor {
|
||||
if len(t.Task.Processes) == 0 {
|
||||
t.Task.Processes = make(map[string]*ThermosProcess, 0)
|
||||
}
|
||||
|
||||
t.Task.Processes[process.Name] = &process
|
||||
|
||||
// Add Process to order
|
||||
t.addToOrder(process.Name)
|
||||
return t
|
||||
}
|
||||
|
||||
// Only constraint that should be added for now is the order of execution, therefore this
|
||||
// receiver is private.
|
||||
func (t *ThermosExecutor) addConstraint(constraint *ThermosConstraint) *ThermosExecutor {
|
||||
if len(t.Task.Constraints) == 0 {
|
||||
t.Task.Constraints = make([]*ThermosConstraint, 0)
|
||||
}
|
||||
|
||||
t.Task.Constraints = append(t.Task.Constraints, constraint)
|
||||
return t
|
||||
}
|
||||
|
||||
// Order in which the Processes should be executed. Index 0 will be executed first, index N will be executed last.
|
||||
func (t *ThermosExecutor) ProcessOrder(order ...string) *ThermosExecutor {
|
||||
if t.order == nil {
|
||||
t.order = &ThermosConstraint{}
|
||||
t.addConstraint(t.order)
|
||||
}
|
||||
|
||||
t.order.Order = order
|
||||
return t
|
||||
}
|
||||
|
||||
// Add Process to execution order. By default this is a FIFO setup. Custom order can be given by overriding
|
||||
// with ProcessOrder
|
||||
func (t *ThermosExecutor) addToOrder(name string) {
|
||||
if t.order == nil {
|
||||
t.order = &ThermosConstraint{Order: make([]string, 0)}
|
||||
t.addConstraint(t.order)
|
||||
}
|
||||
|
||||
t.order.Order = append(t.order.Order, name)
|
||||
}
|
||||
|
||||
// Ram is determined by the job object.
|
||||
func (t *ThermosExecutor) ram(ram int64) {
|
||||
// Convert from bytes to MiB
|
||||
ram *= 1024 ^ 2
|
||||
t.Task.Resources.RAM = &ram
|
||||
}
|
||||
|
||||
// Disk is determined by the job object.
|
||||
func (t *ThermosExecutor) disk(disk int64) {
|
||||
// Convert from bytes to MiB
|
||||
disk *= 1024 ^ 2
|
||||
t.Task.Resources.Disk = &disk
|
||||
}
|
||||
|
||||
// CPU is determined by the job object.
|
||||
func (t *ThermosExecutor) cpu(cpu float64) {
|
||||
t.Task.Resources.CPU = &cpu
|
||||
}
|
||||
|
||||
// GPU is determined by the job object.
|
||||
func (t *ThermosExecutor) gpu(gpu int64) {
|
||||
t.Task.Resources.GPU = &gpu
|
||||
}
|
||||
|
||||
// Deep copy of Thermos executor
|
||||
func (t *ThermosExecutor) Clone() *ThermosExecutor {
|
||||
tNew := ThermosExecutor{}
|
||||
|
||||
if t.order != nil {
|
||||
tNew.order = &ThermosConstraint{Order: t.order.Order}
|
||||
|
||||
tNew.addConstraint(tNew.order)
|
||||
}
|
||||
|
||||
tNew.Task.Processes = make(map[string]*ThermosProcess)
|
||||
|
||||
for name, process := range t.Task.Processes {
|
||||
newProcess := *process
|
||||
tNew.Task.Processes[name] = &newProcess
|
||||
}
|
||||
|
||||
tNew.Task.Resources = t.Task.Resources
|
||||
|
||||
return &tNew
|
||||
}
|
||||
|
||||
type thermosTaskJSON struct {
|
||||
Processes []*ThermosProcess `json:"processes"`
|
||||
Constraints []*ThermosConstraint `json:"constraints"`
|
||||
Resources thermosResources `json:"resources"`
|
||||
}
|
||||
|
||||
// Custom Marshaling for Thermos Task to match what Thermos expects
|
||||
func (t *ThermosTask) MarshalJSON() ([]byte, error) {
|
||||
|
||||
// Convert map to array to match what Thermos expects
|
||||
processes := make([]*ThermosProcess, 0)
|
||||
for _, process := range t.Processes {
|
||||
processes = append(processes, process)
|
||||
}
|
||||
|
||||
return json.Marshal(&thermosTaskJSON{
|
||||
Processes: processes,
|
||||
Constraints: t.Constraints,
|
||||
Resources: t.Resources,
|
||||
})
|
||||
}
|
||||
|
||||
// Custom Unmarshaling to match what Thermos would contain
|
||||
func (t *ThermosTask) UnmarshalJSON(data []byte) error {
|
||||
|
||||
// Thermos format
|
||||
aux := &thermosTaskJSON{}
|
||||
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
processes := make(map[string]*ThermosProcess)
|
||||
for _, process := range aux.Processes {
|
||||
processes[process.Name] = process
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
71
thermos_test.go
Normal file
71
thermos_test.go
Normal file
|
@ -0,0 +1,71 @@
|
|||
package realis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestThermosTask(t *testing.T) {
|
||||
|
||||
// Test that we can successfully deserialize a minimum subset of an Aurora generated thermos payload
|
||||
thermosJSON := []byte(
|
||||
`{
|
||||
"task": {
|
||||
"processes": [
|
||||
{
|
||||
"daemon": false,
|
||||
"name": "hello",
|
||||
"ephemeral": false,
|
||||
"max_failures": 1,
|
||||
"min_duration": 5,
|
||||
"cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
|
||||
"final": false
|
||||
}
|
||||
],
|
||||
"resources": {
|
||||
"gpu": 0,
|
||||
"disk": 134217728,
|
||||
"ram": 134217728,
|
||||
"cpu": 1.1
|
||||
},
|
||||
"constraints": [
|
||||
{
|
||||
"order": [
|
||||
"hello"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}`)
|
||||
thermos := ThermosExecutor{}
|
||||
|
||||
err := json.Unmarshal(thermosJSON, &thermos)
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
||||
process := &ThermosProcess{
|
||||
Daemon: false,
|
||||
Name: "hello",
|
||||
Ephemeral: false,
|
||||
MaxFailures: 1,
|
||||
MinDuration: 5,
|
||||
Cmdline: "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
|
||||
Final: false,
|
||||
}
|
||||
|
||||
constraint := &ThermosConstraint{Order: []string{process.Name}}
|
||||
|
||||
thermosExpected := ThermosExecutor{
|
||||
Task: ThermosTask{
|
||||
Processes: map[string]*ThermosProcess{process.Name: process},
|
||||
Constraints: []*ThermosConstraint{constraint},
|
||||
Resources: thermosResources{CPU: thrift.Float64Ptr(1.1),
|
||||
Disk: thrift.Int64Ptr(134217728),
|
||||
RAM: thrift.Int64Ptr(134217728),
|
||||
GPU: thrift.Int64Ptr(0)}}}
|
||||
|
||||
assert.ObjectsAreEqualValues(thermosExpected, thermos)
|
||||
}
|
154
updatejob.go
154
updatejob.go
|
@ -1,154 +0,0 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package realis
|
||||
|
||||
import (
|
||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
// Structure to collect all information required to create job update
|
||||
type UpdateJob struct {
|
||||
Job // SetInstanceCount for job is hidden, access via full qualifier
|
||||
req *aurora.JobUpdateRequest
|
||||
}
|
||||
|
||||
// Create a default UpdateJob object.
|
||||
func NewDefaultUpdateJob(config *aurora.TaskConfig) *UpdateJob {
|
||||
|
||||
req := aurora.NewJobUpdateRequest()
|
||||
req.TaskConfig = config
|
||||
req.Settings = NewUpdateSettings()
|
||||
|
||||
job := NewJob().(*AuroraJob)
|
||||
job.jobConfig.TaskConfig = config
|
||||
|
||||
// Rebuild resource map from TaskConfig
|
||||
for ptr := range config.Resources {
|
||||
if ptr.NumCpus != nil {
|
||||
job.resources["cpu"].NumCpus = ptr.NumCpus
|
||||
continue // Guard against Union violations that Go won't enforce
|
||||
}
|
||||
|
||||
if ptr.RamMb != nil {
|
||||
job.resources["ram"].RamMb = ptr.RamMb
|
||||
continue
|
||||
}
|
||||
|
||||
if ptr.DiskMb != nil {
|
||||
job.resources["disk"].DiskMb = ptr.DiskMb
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Mirrors defaults set by Pystachio
|
||||
req.Settings.UpdateOnlyTheseInstances = make(map[*aurora.Range]bool)
|
||||
req.Settings.UpdateGroupSize = 1
|
||||
req.Settings.WaitForBatchCompletion = false
|
||||
req.Settings.MinWaitInInstanceRunningMs = 45000
|
||||
req.Settings.MaxPerInstanceFailures = 0
|
||||
req.Settings.MaxFailedInstances = 0
|
||||
req.Settings.RollbackOnFailure = true
|
||||
|
||||
//TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior
|
||||
return &UpdateJob{Job: job, req: req}
|
||||
}
|
||||
|
||||
func NewUpdateJob(config *aurora.TaskConfig, settings *aurora.JobUpdateSettings) *UpdateJob {
|
||||
|
||||
req := aurora.NewJobUpdateRequest()
|
||||
req.TaskConfig = config
|
||||
req.Settings = settings
|
||||
|
||||
job := NewJob().(*AuroraJob)
|
||||
job.jobConfig.TaskConfig = config
|
||||
|
||||
// Rebuild resource map from TaskConfig
|
||||
for ptr := range config.Resources {
|
||||
if ptr.NumCpus != nil {
|
||||
job.resources["cpu"].NumCpus = ptr.NumCpus
|
||||
continue // Guard against Union violations that Go won't enforce
|
||||
}
|
||||
|
||||
if ptr.RamMb != nil {
|
||||
job.resources["ram"].RamMb = ptr.RamMb
|
||||
continue
|
||||
}
|
||||
|
||||
if ptr.DiskMb != nil {
|
||||
job.resources["disk"].DiskMb = ptr.DiskMb
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
//TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior
|
||||
return &UpdateJob{Job: job, req: req}
|
||||
}
|
||||
|
||||
// Set instance count the job will have after the update.
|
||||
func (u *UpdateJob) InstanceCount(inst int32) *UpdateJob {
|
||||
u.req.InstanceCount = inst
|
||||
return u
|
||||
}
|
||||
|
||||
// Max number of instances being updated at any given moment.
|
||||
func (u *UpdateJob) BatchSize(size int32) *UpdateJob {
|
||||
u.req.Settings.UpdateGroupSize = size
|
||||
return u
|
||||
}
|
||||
|
||||
// Minimum number of seconds a shard must remain in RUNNING state before considered a success.
|
||||
func (u *UpdateJob) WatchTime(ms int32) *UpdateJob {
|
||||
u.req.Settings.MinWaitInInstanceRunningMs = ms
|
||||
return u
|
||||
}
|
||||
|
||||
// Wait for all instances in a group to be done before moving on.
|
||||
func (u *UpdateJob) WaitForBatchCompletion(batchWait bool) *UpdateJob {
|
||||
u.req.Settings.WaitForBatchCompletion = batchWait
|
||||
return u
|
||||
}
|
||||
|
||||
// Max number of instance failures to tolerate before marking instance as FAILED.
|
||||
func (u *UpdateJob) MaxPerInstanceFailures(inst int32) *UpdateJob {
|
||||
u.req.Settings.MaxPerInstanceFailures = inst
|
||||
return u
|
||||
}
|
||||
|
||||
// Max number of FAILED instances to tolerate before terminating the update.
|
||||
func (u *UpdateJob) MaxFailedInstances(inst int32) *UpdateJob {
|
||||
u.req.Settings.MaxFailedInstances = inst
|
||||
return u
|
||||
}
|
||||
|
||||
// When False, prevents auto rollback of a failed update.
|
||||
func (u *UpdateJob) RollbackOnFail(rollback bool) *UpdateJob {
|
||||
u.req.Settings.RollbackOnFailure = rollback
|
||||
return u
|
||||
}
|
||||
|
||||
func NewUpdateSettings() *aurora.JobUpdateSettings {
|
||||
|
||||
us := new(aurora.JobUpdateSettings)
|
||||
// Mirrors defaults set by Pystachio
|
||||
us.UpdateOnlyTheseInstances = make(map[*aurora.Range]bool)
|
||||
us.UpdateGroupSize = 1
|
||||
us.WaitForBatchCompletion = false
|
||||
us.MinWaitInInstanceRunningMs = 45000
|
||||
us.MaxPerInstanceFailures = 0
|
||||
us.MaxFailedInstances = 0
|
||||
us.RollbackOnFailure = true
|
||||
|
||||
return us
|
||||
}
|
75
util.go
Normal file
75
util.go
Normal file
|
@ -0,0 +1,75 @@
|
|||
package realis
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var ActiveStates = make(map[aurora.ScheduleStatus]bool)
|
||||
var SlaveAssignedStates = make(map[aurora.ScheduleStatus]bool)
|
||||
var LiveStates = make(map[aurora.ScheduleStatus]bool)
|
||||
var TerminalStates = make(map[aurora.ScheduleStatus]bool)
|
||||
var ActiveJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)
|
||||
var AwaitingPulseJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)
|
||||
|
||||
func init() {
|
||||
for _, status := range aurora.ACTIVE_STATES {
|
||||
ActiveStates[status] = true
|
||||
}
|
||||
|
||||
for _, status := range aurora.SLAVE_ASSIGNED_STATES {
|
||||
SlaveAssignedStates[status] = true
|
||||
}
|
||||
|
||||
for _, status := range aurora.LIVE_STATES {
|
||||
LiveStates[status] = true
|
||||
}
|
||||
|
||||
for _, status := range aurora.TERMINAL_STATES {
|
||||
TerminalStates[status] = true
|
||||
}
|
||||
|
||||
for _, status := range aurora.ACTIVE_JOB_UPDATE_STATES {
|
||||
ActiveJobUpdateStates[status] = true
|
||||
}
|
||||
for _, status := range aurora.AWAITNG_PULSE_JOB_UPDATE_STATES {
|
||||
AwaitingPulseJobUpdateStates[status] = true
|
||||
}
|
||||
}
|
||||
|
||||
func validateAuroraAddress(address string) (string, error) {
|
||||
|
||||
// If no protocol defined, assume http
|
||||
if !strings.Contains(address, "://") {
|
||||
address = "http://" + address
|
||||
}
|
||||
|
||||
u, err := url.Parse(address)
|
||||
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error parsing url")
|
||||
}
|
||||
|
||||
// If no path provided assume /api
|
||||
if u.Path == "" {
|
||||
u.Path = "/api"
|
||||
}
|
||||
|
||||
// If no port provided, assume default 8081
|
||||
if u.Port() == "" {
|
||||
u.Host = u.Host + ":8081"
|
||||
}
|
||||
|
||||
if !(u.Scheme == "http" || u.Scheme == "https") {
|
||||
return "", errors.Errorf("only protocols http and https are supported %v\n", u.Scheme)
|
||||
}
|
||||
|
||||
if u.Path != "/api" {
|
||||
return "", errors.Errorf("expected /api path %v\n", u.Path)
|
||||
}
|
||||
|
||||
return u.String(), nil
|
||||
}
|
56
vendor/git.apache.org/thrift.git/.clang-format
generated
vendored
56
vendor/git.apache.org/thrift.git/.clang-format
generated
vendored
|
@ -1,56 +0,0 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
ConstructorInitializerIndentWidth: 2
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
BreakBeforeBinaryOperators: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BinPackParameters: false
|
||||
ColumnLimit: 100
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
DerivePointerAlignment: false
|
||||
IndentCaseLabels: false
|
||||
IndentWrappedFunctionNames: false
|
||||
IndentFunctionDeclarationAfterType: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
NamespaceIndentation: None
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 190
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakString: 10000
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 1200
|
||||
PointerAlignment: Left
|
||||
SpacesBeforeTrailingComments: 1
|
||||
Cpp11BracedListStyle: true
|
||||
Standard: Auto
|
||||
IndentWidth: 2
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
BreakBeforeBraces: Attach
|
||||
SpacesInParentheses: false
|
||||
SpacesInAngles: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
ContinuationIndentWidth: 4
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
SpaceBeforeParens: ControlStatements
|
||||
DisableFormat: false
|
||||
...
|
||||
|
1
vendor/git.apache.org/thrift.git/.dockerignore
generated
vendored
1
vendor/git.apache.org/thrift.git/.dockerignore
generated
vendored
|
@ -1 +0,0 @@
|
|||
.git/
|
112
vendor/git.apache.org/thrift.git/.editorconfig
generated
vendored
112
vendor/git.apache.org/thrift.git/.editorconfig
generated
vendored
|
@ -1,112 +0,0 @@
|
|||
#
|
||||
## Licensed to the Apache Software Foundation (ASF) under one
|
||||
## or more contributor license agreements. See the NOTICE file
|
||||
## distributed with this work for additional information
|
||||
## regarding copyright ownership. The ASF licenses this file
|
||||
## to you 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.
|
||||
##
|
||||
#
|
||||
|
||||
# EditorConfig: http://editorconfig.org
|
||||
# see doc/coding_standards.md
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
# ActionScript
|
||||
# [*.as]
|
||||
|
||||
# C
|
||||
# [*.c]
|
||||
|
||||
# C++
|
||||
[*.cpp]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# C-Sharp
|
||||
# [*.cs]
|
||||
|
||||
# D
|
||||
# [*.d]
|
||||
|
||||
# Erlang
|
||||
# [*.erl]
|
||||
|
||||
# Go-lang
|
||||
[*.go]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
# C header files
|
||||
# [*.h]
|
||||
|
||||
# Haskell
|
||||
# [*.hs]
|
||||
|
||||
# Haxe
|
||||
# [*.hx]
|
||||
|
||||
# Java
|
||||
# [*.java]
|
||||
|
||||
# Javascript
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# JSON
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Lua
|
||||
# [*.lua]
|
||||
|
||||
[*.markdown]
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
# OCaml
|
||||
# [*.ml]
|
||||
|
||||
# Delphi Pascal
|
||||
# [*.pas]
|
||||
|
||||
# PHP
|
||||
# [*.php]
|
||||
|
||||
# Perl
|
||||
# [*.pm]
|
||||
|
||||
# Python
|
||||
# [*.py]
|
||||
|
||||
# Ruby
|
||||
# [*.rb]
|
||||
|
||||
# Typescript
|
||||
# [*.ts]
|
||||
|
||||
# XML
|
||||
# [*.xml]
|
1
vendor/git.apache.org/thrift.git/.gitattributes
generated
vendored
1
vendor/git.apache.org/thrift.git/.gitattributes
generated
vendored
|
@ -1 +0,0 @@
|
|||
* text=auto
|
326
vendor/git.apache.org/thrift.git/.gitignore
generated
vendored
326
vendor/git.apache.org/thrift.git/.gitignore
generated
vendored
|
@ -1,326 +0,0 @@
|
|||
# generic ignores
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
*.deps
|
||||
*.dirstamp
|
||||
*.libs
|
||||
*.log
|
||||
*.trs
|
||||
*.suo
|
||||
*.pyc
|
||||
*.cache
|
||||
*.user
|
||||
*.ipch
|
||||
*.sdf
|
||||
*.jar
|
||||
*.exe
|
||||
*.dll
|
||||
*_ReSharper*
|
||||
*.opensdf
|
||||
*.swp
|
||||
*.hi
|
||||
*~
|
||||
|
||||
.*project
|
||||
junit*.properties
|
||||
.idea
|
||||
gen-*
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
acinclude.m4
|
||||
autom4te.cache
|
||||
cmake-*
|
||||
node_modules
|
||||
compile
|
||||
test-driver
|
||||
erl_crash.dump
|
||||
|
||||
.sonar
|
||||
.DS_Store
|
||||
.svn
|
||||
.vagrant
|
||||
|
||||
/contrib/.vagrant/
|
||||
/aclocal/libtool.m4
|
||||
/aclocal/lt*.m4
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/cmake_*
|
||||
/compiler/cpp/compiler.VC.db
|
||||
/compiler/cpp/compiler.VC.VC.opendb
|
||||
/compiler/cpp/test/plugin/t_cpp_generator.cc
|
||||
/compiler/cpp/src/thrift/plugin/plugin_constants.cpp
|
||||
/compiler/cpp/src/thrift/plugin/plugin_constants.h
|
||||
/compiler/cpp/src/thrift/plugin/plugin_types.cpp
|
||||
/compiler/cpp/src/thrift/plugin/plugin_types.h
|
||||
/compiler/cpp/test/*test
|
||||
/compiler/cpp/test/thrift-gen-*
|
||||
/compiler/cpp/src/thrift/thrift-bootstrap
|
||||
/compiler/cpp/src/thrift/plugin/gen.stamp
|
||||
/compiler/cpp/Debug
|
||||
/compiler/cpp/Release
|
||||
/compiler/cpp/src/thrift/libparse.a
|
||||
/compiler/cpp/src/thrift/thriftl.cc
|
||||
/compiler/cpp/src/thrift/thrifty.cc
|
||||
/compiler/cpp/src/thrift/thrifty.hh
|
||||
/compiler/cpp/src/thrift/windows/version.h
|
||||
/compiler/cpp/thrift
|
||||
/compiler/cpp/thriftl.cc
|
||||
/compiler/cpp/thrifty.cc
|
||||
/compiler/cpp/lex.yythriftl.cc
|
||||
/compiler/cpp/thrifty.h
|
||||
/compiler/cpp/thrifty.hh
|
||||
/compiler/cpp/src/thrift/version.h
|
||||
/config.*
|
||||
/configure
|
||||
/configure.lineno
|
||||
/configure.scan
|
||||
/contrib/fb303/config.cache
|
||||
/contrib/fb303/config.log
|
||||
/contrib/fb303/config.status
|
||||
/contrib/fb303/configure
|
||||
/contrib/fb303/cpp/libfb303.a
|
||||
/contrib/fb303/java/build/
|
||||
/contrib/fb303/py/build/
|
||||
/contrib/fb303/py/fb303/FacebookService-remote
|
||||
/contrib/fb303/py/fb303/FacebookService.py
|
||||
/contrib/fb303/py/fb303/__init__.py
|
||||
/contrib/fb303/py/fb303/constants.py
|
||||
/contrib/fb303/py/fb303/ttypes.py
|
||||
/depcomp
|
||||
/install-sh
|
||||
/lib/cpp/Debug/
|
||||
/lib/cpp/Debug-mt/
|
||||
/lib/cpp/Release/
|
||||
/lib/cpp/Release-mt/
|
||||
/lib/cpp/src/thrift/qt/moc_TQTcpServer.cpp
|
||||
/lib/cpp/src/thrift/qt/moc__TQTcpServer.cpp
|
||||
/lib/cpp/src/thrift/config.h
|
||||
/lib/cpp/src/thrift/stamp-h2
|
||||
/lib/cpp/test/Benchmark
|
||||
/lib/cpp/test/AllProtocolsTest
|
||||
/lib/cpp/test/DebugProtoTest
|
||||
/lib/cpp/test/DenseProtoTest
|
||||
/lib/cpp/test/EnumTest
|
||||
/lib/cpp/test/JSONProtoTest
|
||||
/lib/cpp/test/OptionalRequiredTest
|
||||
/lib/cpp/test/SecurityTest
|
||||
/lib/cpp/test/SpecializationTest
|
||||
/lib/cpp/test/ReflectionTest
|
||||
/lib/cpp/test/RecursiveTest
|
||||
/lib/cpp/test/TFDTransportTest
|
||||
/lib/cpp/test/TFileTransportTest
|
||||
/lib/cpp/test/TInterruptTest
|
||||
/lib/cpp/test/TNonblockingServerTest
|
||||
/lib/cpp/test/TPipedTransportTest
|
||||
/lib/cpp/test/TServerIntegrationTest
|
||||
/lib/cpp/test/TSocketInterruptTest
|
||||
/lib/cpp/test/TransportTest
|
||||
/lib/cpp/test/UnitTests
|
||||
/lib/cpp/test/ZlibTest
|
||||
/lib/cpp/test/OpenSSLManualInitTest
|
||||
/lib/cpp/test/concurrency_test
|
||||
/lib/cpp/test/link_test
|
||||
/lib/cpp/test/processor_test
|
||||
/lib/cpp/test/tests.xml
|
||||
/lib/cpp/concurrency_test
|
||||
/lib/cpp/*.pc
|
||||
/lib/cpp/x64/Debug/
|
||||
/lib/cpp/x64/Debug-mt/
|
||||
/lib/cpp/x64/Release
|
||||
/lib/cpp/x64/Release-mt
|
||||
/lib/c_glib/*.gcda
|
||||
/lib/c_glib/*.gcno
|
||||
/lib/c_glib/*.loT
|
||||
/lib/c_glib/src/thrift/config.h
|
||||
/lib/c_glib/src/thrift/stamp-h3
|
||||
/lib/c_glib/test/*.gcno
|
||||
/lib/c_glib/test/testwrapper.sh
|
||||
/lib/c_glib/test/testwrapper-test*
|
||||
/lib/c_glib/test/testapplicationexception
|
||||
/lib/c_glib/test/testbinaryprotocol
|
||||
/lib/c_glib/test/testcompactprotocol
|
||||
/lib/c_glib/test/testbufferedtransport
|
||||
/lib/c_glib/test/testcontainertest
|
||||
/lib/c_glib/test/testdebugproto
|
||||
/lib/c_glib/test/testfdtransport
|
||||
/lib/c_glib/test/testframedtransport
|
||||
/lib/c_glib/test/testmemorybuffer
|
||||
/lib/c_glib/test/testoptionalrequired
|
||||
/lib/c_glib/test/testsimpleserver
|
||||
/lib/c_glib/test/teststruct
|
||||
/lib/c_glib/test/testthrifttest
|
||||
/lib/c_glib/test/testthrifttestclient
|
||||
/lib/c_glib/test/testtransportsocket
|
||||
/lib/c_glib/test/testserialization
|
||||
/lib/c_glib/thriftc.pc
|
||||
/lib/c_glib/thrift_c_glib.pc
|
||||
/lib/csharp/**/bin/
|
||||
/lib/csharp/**/obj/
|
||||
/lib/csharp/src/packages
|
||||
/lib/d/test/*.pem
|
||||
/lib/d/libthriftd*.a
|
||||
/lib/d/test/async_test
|
||||
/lib/d/test/client_pool_test
|
||||
/lib/d/test/serialization_benchmark
|
||||
/lib/d/test/stress_test_server
|
||||
/lib/d/test/thrift_test_client
|
||||
/lib/d/test/thrift_test_server
|
||||
/lib/d/test/transport_test
|
||||
/lib/d/unittest/
|
||||
/lib/dart/coverage
|
||||
/lib/dart/**/.packages
|
||||
/lib/dart/**/packages
|
||||
/lib/dart/**/.pub/
|
||||
/lib/dart/**/pubspec.lock
|
||||
/lib/delphi/src/*.dcu
|
||||
/lib/delphi/test/*.identcache
|
||||
/lib/delphi/test/*.local
|
||||
/lib/delphi/test/*.dcu
|
||||
/lib/delphi/test/*.2007
|
||||
/lib/delphi/test/*.dproj
|
||||
/lib/delphi/test/*.dproj
|
||||
/lib/delphi/test/codegen/*.bat
|
||||
/lib/delphi/test/skip/*.local
|
||||
/lib/delphi/test/skip/*.identcache
|
||||
/lib/delphi/test/skip/*.identcache
|
||||
/lib/delphi/test/skip/*.dproj
|
||||
/lib/delphi/test/skip/*.dproj
|
||||
/lib/delphi/test/skip/*.2007
|
||||
/lib/delphi/test/serializer/*.identcache
|
||||
/lib/delphi/test/serializer/*.dproj
|
||||
/lib/delphi/test/serializer/*.local
|
||||
/lib/delphi/test/serializer/*.2007
|
||||
/lib/delphi/test/serializer/*.dcu
|
||||
/lib/delphi/test/multiplexed/*.dproj
|
||||
/lib/delphi/test/multiplexed/*.2007
|
||||
/lib/delphi/test/multiplexed/*.local
|
||||
/lib/delphi/test/multiplexed/*.identcache
|
||||
/lib/delphi/test/multiplexed/*.dcu
|
||||
/lib/delphi/test/typeregistry/*.2007
|
||||
/lib/delphi/test/typeregistry/*.dproj
|
||||
/lib/delphi/test/typeregistry/*.identcache
|
||||
/lib/delphi/test/typeregistry/*.local
|
||||
/lib/delphi/test/typeregistry/*.dcu
|
||||
/lib/erl/.generated
|
||||
/lib/erl/.eunit
|
||||
/lib/erl/ebin
|
||||
/lib/erl/deps/
|
||||
/lib/erl/src/thrift.app.src
|
||||
/lib/erl/test/*.hrl
|
||||
/lib/erl/test/*.beam
|
||||
/lib/haxe/test/bin
|
||||
/lib/hs/dist
|
||||
/lib/java/build
|
||||
/lib/js/test/build
|
||||
/lib/nodejs/coverage
|
||||
/lib/nodejs/node_modules/
|
||||
/lib/perl/MANIFEST
|
||||
/lib/perl/MYMETA.json
|
||||
/lib/perl/MYMETA.yml
|
||||
/lib/perl/Makefile-perl.mk
|
||||
/lib/perl/blib
|
||||
/lib/perl/pm_to_blib
|
||||
/lib/py/build
|
||||
/lib/py/thrift.egg-info/
|
||||
/lib/rb/Gemfile.lock
|
||||
/lib/rb/debug_proto_test
|
||||
/lib/rb/.config
|
||||
/lib/rb/ext/conftest.dSYM/
|
||||
/lib/rb/ext/mkmf.log
|
||||
/lib/rb/ext/thrift_native.bundle
|
||||
/lib/rb/ext/thrift_native.so
|
||||
/lib/rb/test/
|
||||
/lib/rb/thrift-*.gem
|
||||
/lib/php/src/ext/thrift_protocol/Makefile.*
|
||||
/lib/php/src/ext/thrift_protocol/build/
|
||||
/lib/php/src/ext/thrift_protocol/config.*
|
||||
/lib/php/src/ext/thrift_protocol/configure
|
||||
/lib/php/src/ext/thrift_protocol/configure.in
|
||||
/lib/php/src/ext/thrift_protocol/install-sh
|
||||
/lib/php/src/ext/thrift_protocol/libtool
|
||||
/lib/php/src/ext/thrift_protocol/ltmain.sh
|
||||
/lib/php/src/ext/thrift_protocol/missing
|
||||
/lib/php/src/ext/thrift_protocol/mkinstalldirs
|
||||
/lib/php/src/ext/thrift_protocol/modules/
|
||||
/lib/php/src/ext/thrift_protocol/php_thrift_protocol.lo
|
||||
/lib/php/src/ext/thrift_protocol/run-tests.php
|
||||
/lib/php/src/ext/thrift_protocol/thrift_protocol.la
|
||||
/lib/php/src/ext/thrift_protocol/tmp-php.ini
|
||||
/lib/php/src/packages/
|
||||
/lib/php/test/TEST-*.xml
|
||||
/lib/php/test/packages/
|
||||
/lib/py/dist/
|
||||
/lib/erl/logs/
|
||||
/lib/go/test/gopath/
|
||||
/lib/go/test/ThriftTest.thrift
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/missing
|
||||
/node_modules/
|
||||
/stamp-h1
|
||||
/test/features/results.json
|
||||
/test/results.json
|
||||
/test/c_glib/test_client
|
||||
/test/c_glib/test_server
|
||||
/test/cpp/StressTest
|
||||
/test/cpp/StressTestNonBlocking
|
||||
/test/cpp/TestClient
|
||||
/test/cpp/TestServer
|
||||
/test/dart/**/.packages
|
||||
/test/dart/**/packages
|
||||
/test/dart/**/.pub/
|
||||
/test/dart/**/pubspec.lock
|
||||
/test/log/
|
||||
/test/test.log
|
||||
/test/erl/.generated
|
||||
/test/erl/ebin
|
||||
/test/go/bin/
|
||||
/test/go/ThriftTest.thrift
|
||||
/test/go/gopath
|
||||
/test/go/pkg/
|
||||
/test/go/src/code.google.com/
|
||||
/test/go/src/github.com/golang/
|
||||
/test/go/src/gen/
|
||||
/test/go/src/thrift
|
||||
/test/haxe/bin
|
||||
/test/hs/TestClient
|
||||
/test/hs/TestServer
|
||||
/test/py.twisted/_trial_temp/
|
||||
/test/rb/Gemfile.lock
|
||||
/tutorial/cpp/TutorialClient
|
||||
/tutorial/cpp/TutorialServer
|
||||
/tutorial/c_glib/tutorial_client
|
||||
/tutorial/c_glib/tutorial_server
|
||||
/tutorial/csharp/CsharpServer/obj
|
||||
/tutorial/csharp/CsharpServer/bin
|
||||
/tutorial/csharp/CsharpClient/obj
|
||||
/tutorial/csharp/CsharpClient/bin
|
||||
/tutorial/d/async_client
|
||||
/tutorial/d/client
|
||||
/tutorial/d/server
|
||||
/tutorial/dart/**/.packages
|
||||
/tutorial/dart/**/packages
|
||||
/tutorial/dart/**/.pub/
|
||||
/tutorial/dart/**/pubspec.lock
|
||||
/tutorial/delphi/*.dsk
|
||||
/tutorial/delphi/*.local
|
||||
/tutorial/delphi/*.tvsconfig
|
||||
/tutorial/delphi/DelphiClient/dcu
|
||||
/tutorial/delphi/DelphiServer/dcu
|
||||
/tutorial/delphi/DelphiClient/*.local
|
||||
/tutorial/delphi/DelphiClient/*.identcache
|
||||
/tutorial/delphi/DelphiServer/*.identcache
|
||||
/tutorial/delphi/DelphiServer/*.local
|
||||
/tutorial/go/go-tutorial
|
||||
/tutorial/go/calculator-remote
|
||||
/tutorial/go/src/shared
|
||||
/tutorial/go/src/tutorial
|
||||
/tutorial/go/src/git.apache.org
|
||||
/tutorial/haxe/bin
|
||||
/tutorial/hs/dist/
|
||||
/tutorial/java/build/
|
||||
/tutorial/js/build/
|
||||
/ylwrap
|
199
vendor/git.apache.org/thrift.git/.travis.yml
generated
vendored
199
vendor/git.apache.org/thrift.git/.travis.yml
generated
vendored
|
@ -1,199 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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 Apache Thrift on Travis CI - https://travis-ci.org/
|
||||
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
install:
|
||||
- (travis_wait ./build/docker/check_unmodified.sh $DISTRO && touch .unmodified) || true
|
||||
- if [ ! -f .unmodified ]; then travis_retry travis_wait docker build -q -t thrift-build:$DISTRO build/docker/$DISTRO; fi
|
||||
|
||||
script:
|
||||
- docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v $(pwd):/thrift/src -it thrift-build:$DISTRO build/docker/scripts/$SCRIPT $BUILD_ARG
|
||||
|
||||
env:
|
||||
global:
|
||||
- TEST_NAME=""
|
||||
- SCRIPT="cmake.sh"
|
||||
- BUILD_ARG=""
|
||||
- BUILD_ENV="-e CC=clang -e CXX=clang++"
|
||||
- DISTRO=ubuntu
|
||||
- BUILD_LIBS="CPP C_GLIB HASKELL JAVA PYTHON TESTING TUTORIALS" # only meaningful for CMake builds
|
||||
|
||||
matrix:
|
||||
- TEST_NAME="Cross Language Tests (Binary and Header Protocols)"
|
||||
SCRIPT="cross-test.sh"
|
||||
BUILD_ARG="-'(binary|header)'"
|
||||
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
|
||||
|
||||
- TEST_NAME="Cross Language Tests (Debian) (Binary and Header Protocols)"
|
||||
SCRIPT="cross-test.sh"
|
||||
BUILD_ARG="-'(binary|header)'"
|
||||
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
|
||||
DISTRO=debian
|
||||
|
||||
- TEST_NAME="Cross Language Tests (Compact and JSON Protocols)"
|
||||
SCRIPT="cross-test.sh"
|
||||
BUILD_ARG="-'(compact|json)'"
|
||||
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
|
||||
|
||||
- TEST_NAME="Cross Language Tests (Debian) (Compact and JSON Protocols)"
|
||||
SCRIPT="cross-test.sh"
|
||||
BUILD_ARG="-'(compact|json)'"
|
||||
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
|
||||
DISTRO=debian
|
||||
|
||||
# TODO: Remove them once migrated to CMake
|
||||
# Autotools builds
|
||||
- TEST_NAME="C C++ C# D Erlang Haxe Go (automake)"
|
||||
SCRIPT="autotools.sh"
|
||||
BUILD_ARG="--without-dart --without-haskell --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby"
|
||||
|
||||
- TEST_NAME="C C++ - GCC (automake)"
|
||||
SCRIPT="autotools.sh"
|
||||
BUILD_ARG="--without-csharp --without-java --without-erlang --without-nodejs --without-lua --without-python --without-perl --without-php --without-php_extension --without-dart --without-ruby --without-haskell --without-go --without-haxe --without-d"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
|
||||
- TEST_NAME="Java Lua PHP Ruby Dart (automake)"
|
||||
SCRIPT="autotools.sh"
|
||||
BUILD_ARG="--without-cpp --without-haskell --without-c_glib --without-csharp --without-d --without-erlang --without-go --without-haxe --without-nodejs --without-python --without-perl"
|
||||
|
||||
# These are flaky (due to cabal and npm network/server failures) and also have lengthy output
|
||||
- TEST_NAME="Haskell Node.js Python Perl (automake)"
|
||||
SCRIPT="autotools.sh"
|
||||
BUILD_ARG="--without-cpp --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe --without-java --without-lua --without-php --without-php_extension --without-ruby"
|
||||
|
||||
# CMake build
|
||||
- TEST_NAME="All"
|
||||
|
||||
- TEST_NAME="All (Debian)"
|
||||
DISTRO=debian
|
||||
|
||||
- TEST_NAME="C C++ - GCC"
|
||||
BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
|
||||
- TEST_NAME="C++ (Boost Thread)"
|
||||
BUILD_LIBS="CPP TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
|
||||
- TEST_NAME="C++ (Boost Thread - GCC)"
|
||||
BUILD_LIBS="CPP TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
|
||||
- TEST_NAME="C++ (Std Thread)"
|
||||
BUILD_LIBS="CPP TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
|
||||
- TEST_NAME="C++ (Std Thread - GCC)"
|
||||
BUILD_LIBS="CPP TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
|
||||
- TEST_NAME="Compiler (mingw)"
|
||||
BUILD_LIBS=""
|
||||
BUILD_ARG="-DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake -DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF"
|
||||
BUILD_ENV=""
|
||||
|
||||
- TEST_NAME="All - GCC (CentOS)"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
DISTRO=centos
|
||||
|
||||
- TEST_NAME="C C++ - Clang (CentOS)"
|
||||
BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
DISTRO=centos
|
||||
|
||||
- TEST_NAME="Python 2.6 (CentOS 6)"
|
||||
BUILD_LIBS="PYTHON TESTING TUTORIALS"
|
||||
BUILD_ARG="-DWITH_PYTHON=ON -DWITH_CPP=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
DISTRO=centos6
|
||||
|
||||
# Distribution
|
||||
- TEST_NAME="make dist"
|
||||
SCRIPT="make-dist.sh"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
|
||||
- TEST_NAME="Debian Packages"
|
||||
SCRIPT="dpkg.sh"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
|
||||
- TEST_NAME="make dist (Debian)"
|
||||
SCRIPT="make-dist.sh"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
DISTRO=debian
|
||||
|
||||
- TEST_NAME="Debian Packages (Debian)"
|
||||
SCRIPT="dpkg.sh"
|
||||
BUILD_ENV="-e CC=gcc -e CXX=g++"
|
||||
DISTRO=debian
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# QA jobs for code analytics and metrics
|
||||
#
|
||||
# C/C++ static code analysis with cppcheck
|
||||
# add --error-exitcode=1 to --enable=all as soon as everything is fixed
|
||||
#
|
||||
# Python code style check with flake8
|
||||
#
|
||||
# search for TODO etc within source tree
|
||||
# some statistics about the code base
|
||||
# some info about the build machine
|
||||
- env: TEST_NAME="cppcheck, flake8, TODO FIXME HACK, LoC and system info"
|
||||
install:
|
||||
- travis_retry sudo apt-get update
|
||||
- travis_retry sudo apt-get install -ym cppcheck sloccount python-flake8
|
||||
script:
|
||||
# Compiler cppcheck (All)
|
||||
- cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src
|
||||
# C++ cppcheck (All)
|
||||
- cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
|
||||
# C Glib cppcheck (All)
|
||||
- cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
|
||||
# Silent error checks
|
||||
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
|
||||
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
|
||||
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
|
||||
# Python code style
|
||||
- flake8 --ignore=E501 lib/py
|
||||
- flake8 tutorial/py
|
||||
- flake8 --ignore=E501 test/py
|
||||
- flake8 test/py.twisted
|
||||
- flake8 test/py.tornado
|
||||
- flake8 --ignore=E501 test/test.py
|
||||
- flake8 --ignore=E501 test/crossrunner
|
||||
- flake8 test/features
|
||||
# TODO etc
|
||||
- grep -r TODO *
|
||||
- grep -r FIXME *
|
||||
- grep -r HACK *
|
||||
# LoC
|
||||
- sloccount .
|
||||
# System Info
|
||||
- dpkg -l
|
||||
- uname -a
|
2366
vendor/git.apache.org/thrift.git/CHANGES
generated
vendored
2366
vendor/git.apache.org/thrift.git/CHANGES
generated
vendored
File diff suppressed because it is too large
Load diff
117
vendor/git.apache.org/thrift.git/CMakeLists.txt
generated
vendored
117
vendor/git.apache.org/thrift.git/CMakeLists.txt
generated
vendored
|
@ -1,117 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project("Apache Thrift")
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
|
||||
|
||||
# TODO: add `git rev-parse --short HEAD`
|
||||
# Read the version information from the Autoconf file
|
||||
file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" CONFIGURE_AC REGEX "AC_INIT\\(.*\\)" )
|
||||
|
||||
# The following variable is used in the version.h.in file
|
||||
string(REGEX REPLACE "AC_INIT\\(\\[.*\\], \\[([0-9]+\\.[0-9]+\\.[0-9]+(-dev)?)\\]\\)" "\\1" PACKAGE_VERSION ${CONFIGURE_AC})
|
||||
message(STATUS "Parsed Thrift package version: ${PACKAGE_VERSION}")
|
||||
|
||||
# These are internal to CMake
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+)(-dev)?" "\\1" thrift_VERSION ${PACKAGE_VERSION})
|
||||
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" thrift_VERSION_MAJOR ${thrift_VERSION})
|
||||
string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" thrift_VERSION_MINOR ${thrift_VERSION})
|
||||
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" thrift_VERSION_PATCH ${thrift_VERSION})
|
||||
message(STATUS "Parsed Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})")
|
||||
|
||||
# Some default settings
|
||||
include(DefineCMakeDefaults)
|
||||
|
||||
# Build time options are defined here
|
||||
include(DefineOptions)
|
||||
include(DefineInstallationPaths)
|
||||
|
||||
# Based on the options set some platform specifics
|
||||
include(DefinePlatformSpecifc)
|
||||
|
||||
# Generate the config.h file
|
||||
include(ConfigureChecks)
|
||||
|
||||
# Package it
|
||||
include(CPackConfig)
|
||||
|
||||
|
||||
find_package(Threads)
|
||||
|
||||
include(CTest)
|
||||
if(BUILD_TESTING)
|
||||
message(STATUS "Building with unittests")
|
||||
|
||||
enable_testing()
|
||||
# Define "make check" as alias for "make test"
|
||||
add_custom_target(check COMMAND ctest)
|
||||
else ()
|
||||
message(STATUS "Building without tests")
|
||||
endif ()
|
||||
|
||||
if(BUILD_COMPILER)
|
||||
if(NOT EXISTS ${THRIFT_COMPILER})
|
||||
set(THRIFT_COMPILER $<TARGET_FILE:thrift-compiler>)
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/compiler/cpp)
|
||||
elseif(EXISTS ${THRIFT_COMPILER})
|
||||
add_executable(thrift-compiler IMPORTED)
|
||||
set_property(TARGET thrift-compiler PROPERTY IMPORTED_LOCATION ${THRIFT_COMPILER})
|
||||
endif()
|
||||
|
||||
if(BUILD_CPP)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp)
|
||||
if(BUILD_TUTORIALS)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tutorial/cpp)
|
||||
endif()
|
||||
if(BUILD_TESTING)
|
||||
if(WITH_LIBEVENT AND WITH_ZLIB AND WITH_OPENSSL)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/cpp)
|
||||
else()
|
||||
message(WARNING "libevent and/or ZLIB and/or OpenSSL not found or disabled; will not build some tests")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_C_GLIB)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/c_glib)
|
||||
endif()
|
||||
|
||||
if(BUILD_JAVA)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/java)
|
||||
endif()
|
||||
|
||||
if(BUILD_PYTHON)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/py)
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/py)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_HASKELL)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/hs)
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/hs)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
PRINT_CONFIG_SUMMARY()
|
49
vendor/git.apache.org/thrift.git/CONTRIBUTING.md
generated
vendored
49
vendor/git.apache.org/thrift.git/CONTRIBUTING.md
generated
vendored
|
@ -1,49 +0,0 @@
|
|||
## How to contribute
|
||||
1. Help to review and verify existing patches
|
||||
1. Make sure your issue is not all ready in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT)
|
||||
1. If not, create a ticket describing the change you're proposing in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT)
|
||||
1. Contribute your patch using one of the two methods below
|
||||
|
||||
### Contributing via a patch
|
||||
|
||||
1. Check out the latest version of the source code
|
||||
|
||||
* git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift
|
||||
|
||||
1. Modify the source to include the improvement/bugfix
|
||||
|
||||
* Remember to provide *tests* for all submited changes
|
||||
* When bugfixing: add test that will isolate bug *before* applying change that fixes it
|
||||
* Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages)
|
||||
|
||||
1. Create a patch from project root directory (e.g. you@dev:~/thrift $ ):
|
||||
|
||||
* git diff > ../thrift-XXX-my-new-feature.patch
|
||||
|
||||
1. Attach the newly generated patch to the issue
|
||||
1. Wait for other contributors or committers to review your new addition
|
||||
1. Wait for a committer to commit your patch
|
||||
|
||||
### Contributing via GitHub pull requests
|
||||
|
||||
1. Create a fork for http://github.com/apache/thrift
|
||||
1. Create a branch for your changes(best practice is issue as branch name, e.g. THRIFT-9999)
|
||||
1. Modify the source to include the improvement/bugfix
|
||||
|
||||
* Remember to provide *tests* for all submited changes
|
||||
* When bugfixing: add test that will isolate bug *before* applying change that fixes it
|
||||
* Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages)
|
||||
* Verify that your change works on other platforms by adding a GitHub service hook to [Travis CI](http://docs.travis-ci.com/user/getting-started/#Step-one%3A-Sign-in) and [AppVeyor](http://www.appveyor.com/docs)
|
||||
|
||||
1. Commit and push changes to your branch (please use issue name and description as commit title, e.g. THRIFT-9999 make it perfect)
|
||||
1. Issue a pull request with the jira ticket number you are working on in it's name
|
||||
1. Wait for other contributors or committers to review your new addition
|
||||
1. Wait for a committer to commit your patch
|
||||
|
||||
### More info
|
||||
|
||||
Plenty of information on why and how to contribute is available on the Apache Software Foundation (ASF) web site. In particular, we recommend the following:
|
||||
|
||||
* [Contributors Tech Guide](http://www.apache.org/dev/contributors)
|
||||
* [Get involved!](http://www.apache.org/foundation/getinvolved.html)
|
||||
* [Legal aspects on Submission of Contributions (Patches)](http://www.apache.org/licenses/LICENSE-2.0.html#contributions)
|
61
vendor/git.apache.org/thrift.git/Dockerfile
generated
vendored
61
vendor/git.apache.org/thrift.git/Dockerfile
generated
vendored
|
@ -1,61 +0,0 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
# Goal: provide a thrift-compiler Docker image
|
||||
#
|
||||
# Usage:
|
||||
# docker run -v "${PWD}:/data" thrift/thrift-compiler -gen cpp -o /data/ /data/test/ThriftTest.thrift
|
||||
#
|
||||
# further details on docker for thrift is here build/docker/
|
||||
#
|
||||
# TODO: push to apache/thrift-compiler instead of thrift/thrift-compiler
|
||||
|
||||
FROM debian:jessie
|
||||
MAINTAINER Apache Thrift <dev@thrift.apache.org>
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
ADD . /thrift
|
||||
|
||||
RUN buildDeps=" \
|
||||
flex \
|
||||
bison \
|
||||
g++ \
|
||||
make \
|
||||
cmake \
|
||||
curl \
|
||||
"; \
|
||||
apt-get update && apt-get install -y --no-install-recommends $buildDeps \
|
||||
&& mkdir /tmp/cmake-build && cd /tmp/cmake-build \
|
||||
&& cmake \
|
||||
-DBUILD_COMPILER=ON \
|
||||
-DBUILD_LIBRARIES=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
/thrift \
|
||||
&& cmake --build . --config Release \
|
||||
&& make install \
|
||||
&& curl -k -sSL "https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz" -o /tmp/go.tar.gz \
|
||||
&& tar xzf /tmp/go.tar.gz -C /tmp \
|
||||
&& cp /tmp/go/bin/gofmt /usr/bin/gofmt \
|
||||
&& apt-get purge -y --auto-remove $buildDeps \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /tmp/* \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT ["thrift"]
|
239
vendor/git.apache.org/thrift.git/LICENSE
generated
vendored
239
vendor/git.apache.org/thrift.git/LICENSE
generated
vendored
|
@ -1,239 +0,0 @@
|
|||
|
||||
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.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
|
||||
--------------------------------------------------
|
||||
SOFTWARE DISTRIBUTED WITH THRIFT:
|
||||
|
||||
The Apache Thrift software includes a number of subcomponents with
|
||||
separate copyright notices and license terms. Your use of the source
|
||||
code for the these subcomponents is subject to the terms and
|
||||
conditions of the following licenses.
|
||||
|
||||
--------------------------------------------------
|
||||
Portions of the following files are licensed under the MIT License:
|
||||
|
||||
lib/erl/src/Makefile.am
|
||||
|
||||
Please see doc/otp-base-license.txt for the full terms of this license.
|
||||
|
||||
--------------------------------------------------
|
||||
For the aclocal/ax_boost_base.m4 and contrib/fb303/aclocal/ax_boost_base.m4 components:
|
||||
|
||||
# Copyright (c) 2007 Thomas Porschberg <thomas@randspringer.de>
|
||||
#
|
||||
# Copying and distribution of this file, with or without
|
||||
# modification, are permitted in any medium without royalty provided
|
||||
# the copyright notice and this notice are preserved.
|
||||
|
||||
--------------------------------------------------
|
||||
For the lib/nodejs/lib/thrift/json_parse.js:
|
||||
|
||||
/*
|
||||
json_parse.js
|
||||
2015-05-02
|
||||
Public Domain.
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
*/
|
||||
(By Douglas Crockford <douglas@crockford.com>)
|
||||
--------------------------------------------------
|
131
vendor/git.apache.org/thrift.git/Makefile.am
generated
vendored
131
vendor/git.apache.org/thrift.git/Makefile.am
generated
vendored
|
@ -1,131 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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 ./aclocal
|
||||
|
||||
if WITH_PLUGIN
|
||||
# To enable bootstrap, build order is lib/cpp -> compiler -> others
|
||||
SUBDIRS = lib/cpp compiler/cpp lib
|
||||
if WITH_TESTS
|
||||
SUBDIRS += lib/cpp/test
|
||||
endif
|
||||
else
|
||||
SUBDIRS = compiler/cpp lib
|
||||
endif
|
||||
|
||||
if WITH_TESTS
|
||||
SUBDIRS += test
|
||||
endif
|
||||
|
||||
if WITH_TUTORIAL
|
||||
SUBDIRS += tutorial
|
||||
endif
|
||||
|
||||
dist-hook:
|
||||
find $(distdir) -type f \( -iname ".DS_Store" -or -iname "._*" -or -iname ".gitignore" \) | xargs rm -rf
|
||||
find $(distdir) -type d \( -iname ".deps" -or -iname ".libs" \) | xargs rm -rf
|
||||
find $(distdir) -type d \( -iname ".svn" -or -iname ".git" \) | xargs rm -rf
|
||||
|
||||
print-version:
|
||||
@echo $(VERSION)
|
||||
|
||||
.PHONY: precross cross
|
||||
precross-%: all
|
||||
$(MAKE) -C $* precross
|
||||
precross: all precross-test precross-lib
|
||||
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
comma := ,
|
||||
|
||||
CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@
|
||||
CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))
|
||||
|
||||
if WITH_PY3
|
||||
CROSS_PY=$(PYTHON3)
|
||||
else
|
||||
CROSS_PY=$(PYTHON)
|
||||
endif
|
||||
|
||||
if WITH_PYTHON
|
||||
crossfeature: precross
|
||||
$(CROSS_PY) test/test.py --retry-count 3 --features .* --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED)
|
||||
else
|
||||
# feature test needs python build
|
||||
crossfeature:
|
||||
endif
|
||||
|
||||
cross-%: precross crossfeature
|
||||
$(CROSS_PY) test/test.py --retry-count 3 --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED) --client $(CROSS_LANGS_COMMA_SEPARATED) --regex "$*"
|
||||
|
||||
cross: cross-.*
|
||||
|
||||
TIMES = 1 2 3
|
||||
fail: precross
|
||||
$(CROSS_PY) test/test.py || true
|
||||
$(CROSS_PY) test/test.py --update-expected-failures=overwrite
|
||||
$(foreach var,$(TIMES),test/test.py -s || true;test/test.py --update-expected-failures=merge;)
|
||||
|
||||
codespell_skip_files = \
|
||||
*.jar \
|
||||
*.class \
|
||||
*.so \
|
||||
*.a \
|
||||
*.la \
|
||||
*.o \
|
||||
*.p12 \
|
||||
*OCamlMakefile \
|
||||
.keystore \
|
||||
.truststore \
|
||||
CHANGES \
|
||||
config.sub \
|
||||
configure \
|
||||
depcomp \
|
||||
libtool.m4 \
|
||||
output.* \
|
||||
rebar \
|
||||
thrift
|
||||
|
||||
skipped_files = $(subst $(space),$(comma),$(codespell_skip_files))
|
||||
|
||||
style-local:
|
||||
codespell --write-changes --skip=$(skipped_files) --disable-colors
|
||||
|
||||
EXTRA_DIST = \
|
||||
.clang-format \
|
||||
.editorconfig \
|
||||
.travis.yml \
|
||||
appveyor.yml \
|
||||
bower.json \
|
||||
build \
|
||||
CMakeLists.txt \
|
||||
composer.json \
|
||||
contrib \
|
||||
CONTRIBUTING.md \
|
||||
debian \
|
||||
doc \
|
||||
doap.rdf \
|
||||
package.json \
|
||||
sonar-project.properties \
|
||||
Dockerfile \
|
||||
LICENSE \
|
||||
CHANGES \
|
||||
NOTICE \
|
||||
README.md \
|
||||
Thrift.podspec
|
5
vendor/git.apache.org/thrift.git/NOTICE
generated
vendored
5
vendor/git.apache.org/thrift.git/NOTICE
generated
vendored
|
@ -1,5 +0,0 @@
|
|||
Apache Thrift
|
||||
Copyright 2006-2010 The Apache Software Foundation.
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
166
vendor/git.apache.org/thrift.git/README.md
generated
vendored
166
vendor/git.apache.org/thrift.git/README.md
generated
vendored
|
@ -1,166 +0,0 @@
|
|||
Apache Thrift
|
||||
=============
|
||||
|
||||
+[](https://travis-ci.org/apache/thrift)
|
||||
- +[](https://ci.appveyor.com/project/apache/thrift)
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
Thrift is a lightweight, language-independent software stack with an
|
||||
associated code generation mechanism for RPC. Thrift provides clean
|
||||
abstractions for data transport, data serialization, and application
|
||||
level processing. The code generation system takes a simple definition
|
||||
language as its input and generates code across programming languages that
|
||||
uses the abstracted stack to build interoperable RPC clients and servers.
|
||||
|
||||
Thrift is specifically designed to support non-atomic version changes
|
||||
across client and server code.
|
||||
|
||||
For more details on Thrift's design and implementation, take a gander at
|
||||
the Thrift whitepaper included in this distribution or at the README.md files
|
||||
in your particular subdirectory of interest.
|
||||
|
||||
Hierarchy
|
||||
=========
|
||||
|
||||
thrift/
|
||||
|
||||
compiler/
|
||||
|
||||
Contains the Thrift compiler, implemented in C++.
|
||||
|
||||
lib/
|
||||
|
||||
Contains the Thrift software library implementation, subdivided by
|
||||
language of implementation.
|
||||
|
||||
cpp/
|
||||
go/
|
||||
java/
|
||||
php/
|
||||
py/
|
||||
rb/
|
||||
|
||||
test/
|
||||
|
||||
Contains sample Thrift files and test code across the target programming
|
||||
languages.
|
||||
|
||||
tutorial/
|
||||
|
||||
Contains a basic tutorial that will teach you how to develop software
|
||||
using Thrift.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
See http://thrift.apache.org/docs/install for an up-to-date list of build requirements.
|
||||
|
||||
Resources
|
||||
=========
|
||||
|
||||
More information about Thrift can be obtained on the Thrift webpage at:
|
||||
|
||||
http://thrift.apache.org
|
||||
|
||||
Acknowledgments
|
||||
===============
|
||||
|
||||
Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo,
|
||||
and also by Google's protocol buffers.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
If you are building from the first time out of the source repository, you will
|
||||
need to generate the configure scripts. (This is not necessary if you
|
||||
downloaded a tarball.) From the top directory, do:
|
||||
|
||||
./bootstrap.sh
|
||||
|
||||
Once the configure scripts are generated, thrift can be configured.
|
||||
From the top directory, do:
|
||||
|
||||
./configure
|
||||
|
||||
You may need to specify the location of the boost files explicitly.
|
||||
If you installed boost in /usr/local, you would run configure as follows:
|
||||
|
||||
./configure --with-boost=/usr/local
|
||||
|
||||
Note that by default the thrift C++ library is typically built with debugging
|
||||
symbols included. If you want to customize these options you should use the
|
||||
CXXFLAGS option in configure, as such:
|
||||
|
||||
./configure CXXFLAGS='-g -O2'
|
||||
./configure CFLAGS='-g -O2'
|
||||
./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
|
||||
|
||||
To enable gcov required options -fprofile-arcs -ftest-coverage enable them:
|
||||
|
||||
./configure --enable-coverage
|
||||
|
||||
Run ./configure --help to see other configuration options
|
||||
|
||||
Please be aware that the Python library will ignore the --prefix option
|
||||
and just install wherever Python's distutils puts it (usually along
|
||||
the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control
|
||||
where the Python modules are installed, set the PY_PREFIX variable.
|
||||
(DESTDIR is respected for Python and C++.)
|
||||
|
||||
Make thrift:
|
||||
|
||||
make
|
||||
|
||||
From the top directory, become superuser and do:
|
||||
|
||||
make install
|
||||
|
||||
Note that some language packages must be installed manually using build tools
|
||||
better suited to those languages (at the time of this writing, this applies
|
||||
to Java, Ruby, PHP).
|
||||
|
||||
Look for the README.md file in the lib/<language>/ folder for more details on the
|
||||
installation of each language library package.
|
||||
|
||||
Testing
|
||||
=======
|
||||
|
||||
There are a large number of client library tests that can all be run
|
||||
from the top-level directory.
|
||||
|
||||
make -k check
|
||||
|
||||
This will make all of the libraries (as necessary), and run through
|
||||
the unit tests defined in each of the client libraries. If a single
|
||||
language fails, the make check will continue on and provide a synopsis
|
||||
at the end.
|
||||
|
||||
To run the cross-language test suite, please run:
|
||||
|
||||
make cross
|
||||
|
||||
This will run a set of tests that use different language clients and
|
||||
servers.
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you 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.
|
18
vendor/git.apache.org/thrift.git/Thrift.podspec
generated
vendored
18
vendor/git.apache.org/thrift.git/Thrift.podspec
generated
vendored
|
@ -1,18 +0,0 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "Thrift"
|
||||
s.version = "0.10.0"
|
||||
s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
|
||||
s.description = <<-DESC
|
||||
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
|
||||
DESC
|
||||
s.homepage = "http://thrift.apache.org"
|
||||
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://raw.github.com/apache/thrift/thrift-0.9.0/LICENSE' }
|
||||
s.author = { "The Apache Software Foundation" => "apache@apache.org" }
|
||||
s.requires_arc = true
|
||||
s.ios.deployment_target = '7.0'
|
||||
s.osx.deployment_target = '10.8'
|
||||
s.ios.framework = 'CFNetwork'
|
||||
s.osx.framework = 'CoreServices'
|
||||
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-0.10.0" }
|
||||
s.source_files = 'lib/cocoa/src/**/*.{h,m,swift}'
|
||||
end
|
54
vendor/git.apache.org/thrift.git/aclocal/ac_prog_bison.m4
generated
vendored
54
vendor/git.apache.org/thrift.git/aclocal/ac_prog_bison.m4
generated
vendored
|
@ -1,54 +0,0 @@
|
|||
dnl
|
||||
dnl Check Bison version
|
||||
dnl AC_PROG_BISON([MIN_VERSION=2.4])
|
||||
dnl
|
||||
dnl Will define BISON_USE_PARSER_H_EXTENSION if Automake is < 1.11
|
||||
dnl for use with .h includes.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([AC_PROG_BISON], [
|
||||
if test "x$1" = "x" ; then
|
||||
bison_required_version="2.4"
|
||||
else
|
||||
bison_required_version="$1"
|
||||
fi
|
||||
|
||||
AC_CHECK_PROG(have_prog_bison, [bison], [yes],[no])
|
||||
|
||||
AC_DEFINE_UNQUOTED([BISON_VERSION], [0.0], [Bison version if bison is not available])
|
||||
|
||||
#Do not use *.h extension for parser header files, use newer *.hh
|
||||
bison_use_parser_h_extension=false
|
||||
|
||||
if test "$have_prog_bison" = "yes" ; then
|
||||
AC_MSG_CHECKING([for bison version >= $bison_required_version])
|
||||
bison_version=`bison --version | head -n 1 | cut '-d ' -f 4`
|
||||
AC_DEFINE_UNQUOTED([BISON_VERSION], [$bison_version], [Defines bison version])
|
||||
if test "$bison_version" \< "$bison_required_version" ; then
|
||||
BISON=:
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Bison version $bison_required_version or higher must be installed on the system!])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
BISON=bison
|
||||
AC_SUBST(BISON)
|
||||
|
||||
#Verify automake version 1.11 headers for yy files are .h, > 1.12 uses .hh
|
||||
automake_version=`automake --version | head -n 1 | cut '-d ' -f 4`
|
||||
AC_DEFINE_UNQUOTED([AUTOMAKE_VERSION], [$automake_version], [Defines automake version])
|
||||
|
||||
if test "$automake_version" \< "1.12" ; then
|
||||
#Use *.h extension for parser header file
|
||||
bison_use_parser_h_extension=true
|
||||
echo "Automake version < 1.12"
|
||||
AC_DEFINE([BISON_USE_PARSER_H_EXTENSION], [1], [Use *.h extension for parser header file])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
BISON=:
|
||||
AC_MSG_RESULT([NO])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([BISON_USE_PARSER_H_EXTENSION], [test x$bison_use_parser_h_extension = xtrue])
|
||||
AC_SUBST(BISON)
|
||||
])
|
272
vendor/git.apache.org/thrift.git/aclocal/ax_boost_base.m4
generated
vendored
272
vendor/git.apache.org/thrift.git/aclocal/ax_boost_base.m4
generated
vendored
|
@ -1,272 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for the Boost C++ libraries of a particular version (or newer)
|
||||
#
|
||||
# If no path to the installed boost library is given the macro searchs
|
||||
# under /usr, /usr/local, /opt and /opt/local and evaluates the
|
||||
# $BOOST_ROOT environment variable. Further documentation is available at
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
||||
# Copyright (c) 2009 Peter Adolphs
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 23
|
||||
|
||||
AC_DEFUN([AX_BOOST_BASE],
|
||||
[
|
||||
AC_ARG_WITH([boost],
|
||||
[AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
|
||||
[use Boost library from a standard location (ARG=yes),
|
||||
from the specified location (ARG=<path>),
|
||||
or disable it (ARG=no)
|
||||
@<:@ARG=yes@:>@ ])],
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ac_boost_path=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ac_boost_path="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"])
|
||||
|
||||
|
||||
AC_ARG_WITH([boost-libdir],
|
||||
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
||||
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
|
||||
[
|
||||
if test -d "$withval"
|
||||
then
|
||||
ac_boost_lib_path="$withval"
|
||||
else
|
||||
AC_MSG_ERROR(--with-boost-libdir expected directory name)
|
||||
fi
|
||||
],
|
||||
[ac_boost_lib_path=""]
|
||||
)
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
||||
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
||||
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
||||
boost_lib_version_req_sub_minor="0"
|
||||
fi
|
||||
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
||||
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
||||
succeeded=no
|
||||
|
||||
dnl On 64-bit systems check for system libraries in both lib64 and lib.
|
||||
dnl The former is specified by FHS, but e.g. Debian does not adhere to
|
||||
dnl this (as it rises problems for generic multi-arch support).
|
||||
dnl The last entry in the list is chosen by default when no libraries
|
||||
dnl are found, e.g. when only header-only libraries are installed!
|
||||
libsubdirs="lib"
|
||||
ax_arch=`uname -m`
|
||||
case $ax_arch in
|
||||
x86_64|ppc64|s390x|sparc64|aarch64)
|
||||
libsubdirs="lib64 lib lib64"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
|
||||
dnl them priority over the other paths since, if libs are found there, they
|
||||
dnl are almost assuredly the ones desired.
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
|
||||
|
||||
case ${host_cpu} in
|
||||
i?86)
|
||||
libsubdirs="lib/i386-${host_os} $libsubdirs"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl first we check the system location for boost libraries
|
||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
||||
dnl or if you install boost with RPM
|
||||
if test "$ac_boost_path" != ""; then
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
||||
for ac_boost_path_tmp in $libsubdirs; do
|
||||
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
|
||||
break
|
||||
fi
|
||||
done
|
||||
elif test "$cross_compiling" != yes; then
|
||||
for ac_boost_path_tmp in $lt_sysroot/usr $lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local ; do
|
||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
dnl overwrite ld flags if we have required special directory with
|
||||
dnl --with-boost-libdir parameter
|
||||
if test "$ac_boost_lib_path" != ""; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_lib_path"
|
||||
fi
|
||||
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
],[
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
|
||||
|
||||
dnl if we found no boost with system layout we search for boost libraries
|
||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
||||
if test "x$succeeded" != "xyes"; then
|
||||
_version=0
|
||||
if test "$ac_boost_path" != ""; then
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
fi
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||
done
|
||||
fi
|
||||
else
|
||||
if test "$cross_compiling" != yes; then
|
||||
for ac_boost_path in $lt_sysroot/usr $lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local ; do
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
best_path=$ac_boost_path
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
||||
if test "$ac_boost_lib_path" = ""; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
BOOST_LDFLAGS="-L$best_path/$libsubdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$BOOST_ROOT" != "x"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
|
||||
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
|
||||
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
||||
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
||||
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
|
||||
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
||||
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
||||
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
],[
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
if test "$succeeded" != "yes" ; then
|
||||
if test "$_version" = "0" ; then
|
||||
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
||||
else
|
||||
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
|
||||
fi
|
||||
# execute ACTION-IF-NOT-FOUND (if present):
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
AC_SUBST(BOOST_LDFLAGS)
|
||||
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
||||
# execute ACTION-IF-FOUND (if present):
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
|
||||
])
|
124
vendor/git.apache.org/thrift.git/aclocal/ax_check_openssl.m4
generated
vendored
124
vendor/git.apache.org/thrift.git/aclocal/ax_check_openssl.m4
generated
vendored
|
@ -1,124 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Look for OpenSSL in a number of default spots, or in a user-selected
|
||||
# spot (via --with-openssl). Sets
|
||||
#
|
||||
# OPENSSL_INCLUDES to the include directives required
|
||||
# OPENSSL_LIBS to the -l directives required
|
||||
# OPENSSL_LDFLAGS to the -L or -R flags required
|
||||
#
|
||||
# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
|
||||
#
|
||||
# This macro sets OPENSSL_INCLUDES such that source files should use the
|
||||
# openssl/ directory in include directives:
|
||||
#
|
||||
# #include <openssl/hmac.h>
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
|
||||
# Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
|
||||
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
|
||||
AC_DEFUN([AX_CHECK_OPENSSL], [
|
||||
found=false
|
||||
AC_ARG_WITH([openssl],
|
||||
[AS_HELP_STRING([--with-openssl=DIR],
|
||||
[root of the OpenSSL directory])],
|
||||
[
|
||||
case "$withval" in
|
||||
"" | y | ye | yes | n | no)
|
||||
AC_MSG_ERROR([Invalid --with-openssl value])
|
||||
;;
|
||||
*) ssldirs="$withval"
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
# if pkg-config is installed and openssl has installed a .pc file,
|
||||
# then use that information and don't search ssldirs
|
||||
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
|
||||
if test x"$PKG_CONFIG" != x""; then
|
||||
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
|
||||
if test $? = 0; then
|
||||
OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
|
||||
OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
|
||||
found=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# no such luck; use some default ssldirs
|
||||
if ! $found; then
|
||||
ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
|
||||
# an 'openssl' subdirectory
|
||||
|
||||
if ! $found; then
|
||||
OPENSSL_INCLUDES=
|
||||
for ssldir in $ssldirs; do
|
||||
AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
|
||||
if test -f "$ssldir/include/openssl/ssl.h"; then
|
||||
OPENSSL_INCLUDES="-I$ssldir/include"
|
||||
OPENSSL_LDFLAGS="-L$ssldir/lib"
|
||||
OPENSSL_LIBS="-lssl -lcrypto"
|
||||
found=true
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
|
||||
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
|
||||
# it will just work!
|
||||
fi
|
||||
|
||||
# try the preprocessor and linker with our new flags,
|
||||
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
|
||||
|
||||
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
|
||||
echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
|
||||
"OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
|
||||
LIBS="$OPENSSL_LIBS $LIBS"
|
||||
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
$1
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
$2
|
||||
])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
AC_SUBST([OPENSSL_INCLUDES])
|
||||
AC_SUBST([OPENSSL_LIBS])
|
||||
AC_SUBST([OPENSSL_LDFLAGS])
|
||||
])
|
165
vendor/git.apache.org/thrift.git/aclocal/ax_cxx_compile_stdcxx_11.m4
generated
vendored
165
vendor/git.apache.org/thrift.git/aclocal/ax_cxx_compile_stdcxx_11.m4
generated
vendored
|
@ -1,165 +0,0 @@
|
|||
# ============================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
||||
# ============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the C++11
|
||||
# standard; if necessary, add switches to CXXFLAGS to enable support.
|
||||
#
|
||||
# The first argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for an extended mode.
|
||||
#
|
||||
# The second argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline C++11 support is required and that the macro
|
||||
# should error out if no mode with that support is found. If specified
|
||||
# 'optional', then configuration proceeds regardless, after defining
|
||||
# HAVE_CXX11 if and only if a supporting mode is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 10
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
struct Base {
|
||||
virtual void f() {}
|
||||
};
|
||||
struct Child : public Base {
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
auto l = [](){};
|
||||
// Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable]
|
||||
struct use_l { use_l() { l(); } };
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
|
||||
namespace test_template_alias_sfinae {
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() {
|
||||
func<foo>(0);
|
||||
}
|
||||
}
|
||||
]])
|
||||
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||
m4_if([$1], [], [],
|
||||
[$1], [ext], [],
|
||||
[$1], [noext], [],
|
||||
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
||||
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
|
||||
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
|
||||
[$2], [optional], [ax_cxx_compile_cxx11_required=false],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
||||
ax_cv_cxx_compile_cxx11,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[ax_cv_cxx_compile_cxx11=yes],
|
||||
[ax_cv_cxx_compile_cxx11=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$1], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=gnu++11 -std=gnu++0x; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$1], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=c++11 -std=c++0x; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx11_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
||||
fi
|
||||
else
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX11=0
|
||||
AC_MSG_NOTICE([No compiler with C++11 support was found])
|
||||
else
|
||||
HAVE_CXX11=1
|
||||
AC_DEFINE(HAVE_CXX11,1,
|
||||
[define if the compiler supports basic C++11 syntax])
|
||||
fi
|
||||
|
||||
AC_SUBST(HAVE_CXX11)
|
||||
fi
|
||||
])
|
107
vendor/git.apache.org/thrift.git/aclocal/ax_dmd.m4
generated
vendored
107
vendor/git.apache.org/thrift.git/aclocal/ax_dmd.m4
generated
vendored
|
@ -1,107 +0,0 @@
|
|||
dnl @synopsis AX_DMD
|
||||
dnl
|
||||
dnl Test for the presence of a DMD-compatible D2 compiler, and (optionally)
|
||||
dnl specified modules on the import path.
|
||||
dnl
|
||||
dnl If "DMD" is defined in the environment, that will be the only
|
||||
dnl dmd command tested. Otherwise, a hard-coded list will be used.
|
||||
dnl
|
||||
dnl After AX_DMD runs, the shell variables "success" and "ax_dmd" are set to
|
||||
dnl "yes" or "no", and "DMD" is set to the appropriate command. Furthermore,
|
||||
dnl "dmd_optlink" will be set to "yes" or "no" depending on whether OPTLINK is
|
||||
dnl used as the linker (DMD/Windows), and "dmd_of_dirsep" will be set to the
|
||||
dnl directory separator to use when passing -of to DMD (OPTLINK requires a
|
||||
dnl backslash).
|
||||
dnl
|
||||
dnl AX_CHECK_D_MODULE must be run after AX_DMD. It tests for the presence of a
|
||||
dnl module in the import path of the chosen compiler, and sets the shell
|
||||
dnl variable "success" to "yes" or "no".
|
||||
dnl
|
||||
dnl @category D
|
||||
dnl @version 2011-05-31
|
||||
dnl @license AllPermissive
|
||||
dnl
|
||||
dnl Copyright (C) 2009 David Reiss
|
||||
dnl Copyright (C) 2011 David Nadlinger
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
|
||||
|
||||
AC_DEFUN([AX_DMD],
|
||||
[
|
||||
dnl Hard-coded default commands to test.
|
||||
DMD_PROGS="dmd,gdmd,ldmd"
|
||||
|
||||
dnl Allow the user to specify an alternative.
|
||||
if test -n "$DMD" ; then
|
||||
DMD_PROGS="$DMD"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for DMD)
|
||||
|
||||
# std.algorithm as a quick way to check for D2/Phobos.
|
||||
echo "import std.algorithm; void main() {}" > configtest_ax_dmd.d
|
||||
success=no
|
||||
oIFS="$IFS"
|
||||
|
||||
IFS=","
|
||||
for DMD in $DMD_PROGS ; do
|
||||
IFS="$oIFS"
|
||||
|
||||
echo "Running \"$DMD configtest_ax_dmd.d\"" >&AS_MESSAGE_LOG_FD
|
||||
if $DMD configtest_ax_dmd.d >&AS_MESSAGE_LOG_FD 2>&1 ; then
|
||||
success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test "$success" != "yes" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
DMD=""
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
ax_dmd="$success"
|
||||
|
||||
# Test whether OPTLINK is used by trying if DMD accepts -L/? without
|
||||
# erroring out.
|
||||
if test "$success" == "yes" ; then
|
||||
AC_MSG_CHECKING(whether DMD uses OPTLINK)
|
||||
echo "Running \”$DMD -L/? configtest_ax_dmd.d\"" >&AS_MESSAGE_LOG_FD
|
||||
if $DMD -L/? configtest_ax_dmd.d >&AS_MESSAGE_LOG_FD 2>&1 ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
dmd_optlink="yes"
|
||||
|
||||
# This actually produces double slashes in the final configure
|
||||
# output, but at least it works.
|
||||
dmd_of_dirsep="\\\\"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
dmd_optlink="no"
|
||||
dmd_of_dirsep="/"
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f configtest_ax_dmd*
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_CHECK_D_MODULE],
|
||||
[
|
||||
AC_MSG_CHECKING(for D module [$1])
|
||||
|
||||
echo "import $1; void main() {}" > configtest_ax_dmd.d
|
||||
|
||||
echo "Running \"$DMD configtest_ax_dmd.d\"" >&AS_MESSAGE_LOG_FD
|
||||
if $DMD -c configtest_ax_dmd.d >&AS_MESSAGE_LOG_FD 2>&1 ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
success=yes
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
success=no
|
||||
fi
|
||||
|
||||
rm -f configtest_ax_dmd*
|
||||
])
|
129
vendor/git.apache.org/thrift.git/aclocal/ax_javac_and_java.m4
generated
vendored
129
vendor/git.apache.org/thrift.git/aclocal/ax_javac_and_java.m4
generated
vendored
|
@ -1,129 +0,0 @@
|
|||
dnl @synopsis AX_JAVAC_AND_JAVA
|
||||
dnl @synopsis AX_CHECK_JAVA_CLASS(CLASSNAME)
|
||||
dnl
|
||||
dnl Test for the presence of a JDK, and (optionally) specific classes.
|
||||
dnl
|
||||
dnl If "JAVA" is defined in the environment, that will be the only
|
||||
dnl java command tested. Otherwise, a hard-coded list will be used.
|
||||
dnl Similarly for "JAVAC".
|
||||
dnl
|
||||
dnl AX_JAVAC_AND_JAVA does not currently support testing for a particular
|
||||
dnl Java version, testing for only one of "java" and "javac", or
|
||||
dnl compiling or running user-provided Java code.
|
||||
dnl
|
||||
dnl After AX_JAVAC_AND_JAVA runs, the shell variables "success" and
|
||||
dnl "ax_javac_and_java" are set to "yes" or "no", and "JAVAC" and
|
||||
dnl "JAVA" are set to the appropriate commands.
|
||||
dnl
|
||||
dnl AX_CHECK_JAVA_CLASS must be run after AX_JAVAC_AND_JAVA.
|
||||
dnl It tests for the presence of a class based on a fully-qualified name.
|
||||
dnl It sets the shell variable "success" to "yes" or "no".
|
||||
dnl
|
||||
dnl @category Java
|
||||
dnl @version 2009-02-09
|
||||
dnl @license AllPermissive
|
||||
dnl
|
||||
dnl Copyright (C) 2009 David Reiss
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
|
||||
|
||||
AC_DEFUN([AX_JAVAC_AND_JAVA],
|
||||
[
|
||||
|
||||
dnl Hard-coded default commands to test.
|
||||
JAVAC_PROGS="javac,jikes,gcj -C"
|
||||
JAVA_PROGS="java,kaffe"
|
||||
|
||||
dnl Allow the user to specify an alternative.
|
||||
if test -n "$JAVAC" ; then
|
||||
JAVAC_PROGS="$JAVAC"
|
||||
fi
|
||||
if test -n "$JAVA" ; then
|
||||
JAVA_PROGS="$JAVA"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for javac and java)
|
||||
|
||||
echo "public class configtest_ax_javac_and_java { public static void main(String args@<:@@:>@) { } }" > configtest_ax_javac_and_java.java
|
||||
success=no
|
||||
oIFS="$IFS"
|
||||
|
||||
IFS=","
|
||||
for JAVAC in $JAVAC_PROGS ; do
|
||||
IFS="$oIFS"
|
||||
|
||||
echo "Running \"$JAVAC configtest_ax_javac_and_java.java\"" >&AS_MESSAGE_LOG_FD
|
||||
if $JAVAC configtest_ax_javac_and_java.java >&AS_MESSAGE_LOG_FD 2>&1 ; then
|
||||
|
||||
# prevent $JAVA VM issues with UTF-8 path names (THRIFT-3271)
|
||||
oLC_ALL="$LC_ALL"
|
||||
LC_ALL=""
|
||||
|
||||
IFS=","
|
||||
for JAVA in $JAVA_PROGS ; do
|
||||
IFS="$oIFS"
|
||||
|
||||
echo "Running \"$JAVA configtest_ax_javac_and_java\"" >&AS_MESSAGE_LOG_FD
|
||||
if $JAVA configtest_ax_javac_and_java >&AS_MESSAGE_LOG_FD 2>&1 ; then
|
||||
success=yes
|
||||
break 2
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# restore LC_ALL
|
||||
LC_ALL="$oLC_ALL"
|
||||
oLC_ALL=""
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
rm -f configtest_ax_javac_and_java.java configtest_ax_javac_and_java.class
|
||||
|
||||
if test "$success" != "yes" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
JAVAC=""
|
||||
JAVA=""
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
ax_javac_and_java="$success"
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_CHECK_JAVA_CLASS],
|
||||
[
|
||||
AC_MSG_CHECKING(for Java class [$1])
|
||||
|
||||
echo "import $1; public class configtest_ax_javac_and_java { public static void main(String args@<:@@:>@) { } }" > configtest_ax_javac_and_java.java
|
||||
|
||||
echo "Running \"$JAVAC configtest_ax_javac_and_java.java\"" >&AS_MESSAGE_LOG_FD
|
||||
if $JAVAC configtest_ax_javac_and_java.java >&AS_MESSAGE_LOG_FD 2>&1 ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
success=yes
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
success=no
|
||||
fi
|
||||
|
||||
rm -f configtest_ax_javac_and_java.java configtest_ax_javac_and_java.class
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_CHECK_ANT_VERSION],
|
||||
[
|
||||
AC_MSG_CHECKING(for ant version > $2)
|
||||
ANT_VALID=`expr $($1 -version 2>/dev/null | sed -n 's/.*version \(@<:@0-9\.@:>@*\).*/\1/p') \>= $2`
|
||||
if test "x$ANT_VALID" = "x1" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
ANT=""
|
||||
fi
|
||||
])
|
||||
|
194
vendor/git.apache.org/thrift.git/aclocal/ax_lib_event.m4
generated
vendored
194
vendor/git.apache.org/thrift.git/aclocal/ax_lib_event.m4
generated
vendored
|
@ -1,194 +0,0 @@
|
|||
dnl @synopsis AX_LIB_EVENT([MINIMUM-VERSION])
|
||||
dnl
|
||||
dnl Test for the libevent library of a particular version (or newer).
|
||||
dnl
|
||||
dnl If no path to the installed libevent is given, the macro will first try
|
||||
dnl using no -I or -L flags, then searches under /usr, /usr/local, /opt,
|
||||
dnl and /opt/libevent.
|
||||
dnl If these all fail, it will try the $LIBEVENT_ROOT environment variable.
|
||||
dnl
|
||||
dnl This macro requires that #include <sys/types.h> works and defines u_char.
|
||||
dnl
|
||||
dnl This macro calls:
|
||||
dnl AC_SUBST(LIBEVENT_CPPFLAGS)
|
||||
dnl AC_SUBST(LIBEVENT_LDFLAGS)
|
||||
dnl AC_SUBST(LIBEVENT_LIBS)
|
||||
dnl
|
||||
dnl And (if libevent is found):
|
||||
dnl AC_DEFINE(HAVE_LIBEVENT)
|
||||
dnl
|
||||
dnl It also leaves the shell variables "success" and "ax_have_libevent"
|
||||
dnl set to "yes" or "no".
|
||||
dnl
|
||||
dnl NOTE: This macro does not currently work for cross-compiling,
|
||||
dnl but it can be easily modified to allow it. (grep "cross").
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @category C
|
||||
dnl @version 2007-09-12
|
||||
dnl @license AllPermissive
|
||||
dnl
|
||||
dnl Copyright (C) 2009 David Reiss
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
|
||||
dnl Input: ax_libevent_path, WANT_LIBEVENT_VERSION
|
||||
dnl Output: success=yes/no
|
||||
AC_DEFUN([AX_LIB_EVENT_DO_CHECK],
|
||||
[
|
||||
# Save our flags.
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LIBS_SAVED="$LIBS"
|
||||
LD_LIBRARY_PATH_SAVED="$LD_LIBRARY_PATH"
|
||||
|
||||
# Set our flags if we are checking a specific directory.
|
||||
if test -n "$ax_libevent_path" ; then
|
||||
LIBEVENT_CPPFLAGS="-I$ax_libevent_path/include"
|
||||
LIBEVENT_LDFLAGS="-L$ax_libevent_path/lib"
|
||||
LD_LIBRARY_PATH="$ax_libevent_path/lib:$LD_LIBRARY_PATH"
|
||||
else
|
||||
LIBEVENT_CPPFLAGS=""
|
||||
LIBEVENT_LDFLAGS=""
|
||||
fi
|
||||
|
||||
# Required flag for libevent.
|
||||
LIBEVENT_LIBS="-levent"
|
||||
|
||||
# Prepare the environment for compilation.
|
||||
CPPFLAGS="$CPPFLAGS $LIBEVENT_CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $LIBEVENT_LDFLAGS"
|
||||
LIBS="$LIBS $LIBEVENT_LIBS"
|
||||
export CPPFLAGS
|
||||
export LDFLAGS
|
||||
export LIBS
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
success=no
|
||||
|
||||
# Compile, link, and run the program. This checks:
|
||||
# - event.h is available for including.
|
||||
# - event_get_version() is available for linking.
|
||||
# - The event version string is lexicographically greater
|
||||
# than the required version.
|
||||
AC_LANG_PUSH([C])
|
||||
dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling,
|
||||
dnl but then the version cannot be checked.
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <sys/types.h>
|
||||
#include <event.h>
|
||||
]], [[
|
||||
const char* lib_version = event_get_version();
|
||||
const char* wnt_version = "$WANT_LIBEVENT_VERSION";
|
||||
int lib_digits;
|
||||
int wnt_digits;
|
||||
for (;;) {
|
||||
/* If we reached the end of the want version. We have it. */
|
||||
if (*wnt_version == '\0' || *wnt_version == '-') {
|
||||
return 0;
|
||||
}
|
||||
/* If the want version continues but the lib version does not, */
|
||||
/* we are missing a letter. We don't have it. */
|
||||
if (*lib_version == '\0' || *lib_version == '-') {
|
||||
return 1;
|
||||
}
|
||||
/* In the 1.4 version numbering style, if there are more digits */
|
||||
/* in one version than the other, that one is higher. */
|
||||
for (lib_digits = 0;
|
||||
lib_version[lib_digits] >= '0' &&
|
||||
lib_version[lib_digits] <= '9';
|
||||
lib_digits++)
|
||||
;
|
||||
for (wnt_digits = 0;
|
||||
wnt_version[wnt_digits] >= '0' &&
|
||||
wnt_version[wnt_digits] <= '9';
|
||||
wnt_digits++)
|
||||
;
|
||||
if (lib_digits > wnt_digits) {
|
||||
return 0;
|
||||
}
|
||||
if (lib_digits < wnt_digits) {
|
||||
return 1;
|
||||
}
|
||||
/* If we have greater than what we want. We have it. */
|
||||
if (*lib_version > *wnt_version) {
|
||||
return 0;
|
||||
}
|
||||
/* If we have less, we don't. */
|
||||
if (*lib_version < *wnt_version) {
|
||||
return 1;
|
||||
}
|
||||
lib_version++;
|
||||
wnt_version++;
|
||||
}
|
||||
return 0;
|
||||
]])], [
|
||||
success=yes
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
# Restore flags.
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
LIBS="$LIBS_SAVED"
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH_SAVED"
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_LIB_EVENT],
|
||||
[
|
||||
|
||||
dnl Allow search path to be overridden on the command line.
|
||||
AC_ARG_WITH([libevent],
|
||||
AS_HELP_STRING([--with-libevent@<:@=DIR@:>@], [use libevent [default=yes]. Optionally specify the root prefix dir where libevent is installed]),
|
||||
[
|
||||
if test "x$withval" = "xno"; then
|
||||
want_libevent="no"
|
||||
elif test "x$withval" = "xyes"; then
|
||||
want_libevent="yes"
|
||||
ax_libevent_path=""
|
||||
else
|
||||
want_libevent="yes"
|
||||
ax_libevent_path="$withval"
|
||||
fi
|
||||
],
|
||||
[ want_libevent="yes" ; ax_libevent_path="" ])
|
||||
|
||||
|
||||
if test "$want_libevent" = "yes"; then
|
||||
WANT_LIBEVENT_VERSION=ifelse([$1], ,1.2,$1)
|
||||
|
||||
AC_MSG_CHECKING(for libevent >= $WANT_LIBEVENT_VERSION)
|
||||
|
||||
# Run tests.
|
||||
if test -n "$ax_libevent_path"; then
|
||||
AX_LIB_EVENT_DO_CHECK
|
||||
else
|
||||
for ax_libevent_path in "" $lt_sysroot/usr $lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local $lt_sysroot/opt/libevent "$LIBEVENT_ROOT" ; do
|
||||
AX_LIB_EVENT_DO_CHECK
|
||||
if test "$success" = "yes"; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test "$success" != "yes" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
LIBEVENT_CPPFLAGS=""
|
||||
LIBEVENT_LDFLAGS=""
|
||||
LIBEVENT_LIBS=""
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_LIBEVENT,,[define if libevent is available])
|
||||
ax_have_libevent_[]m4_translit([$1], [.], [_])="yes"
|
||||
fi
|
||||
|
||||
ax_have_libevent="$success"
|
||||
|
||||
AC_SUBST(LIBEVENT_CPPFLAGS)
|
||||
AC_SUBST(LIBEVENT_LDFLAGS)
|
||||
AC_SUBST(LIBEVENT_LIBS)
|
||||
fi
|
||||
|
||||
])
|
173
vendor/git.apache.org/thrift.git/aclocal/ax_lib_zlib.m4
generated
vendored
173
vendor/git.apache.org/thrift.git/aclocal/ax_lib_zlib.m4
generated
vendored
|
@ -1,173 +0,0 @@
|
|||
dnl @synopsis AX_LIB_ZLIB([MINIMUM-VERSION])
|
||||
dnl
|
||||
dnl Test for the libz library of a particular version (or newer).
|
||||
dnl
|
||||
dnl If no path to the installed zlib is given, the macro will first try
|
||||
dnl using no -I or -L flags, then searches under /usr, /usr/local, /opt,
|
||||
dnl and /opt/zlib.
|
||||
dnl If these all fail, it will try the $ZLIB_ROOT environment variable.
|
||||
dnl
|
||||
dnl This macro calls:
|
||||
dnl AC_SUBST(ZLIB_CPPFLAGS)
|
||||
dnl AC_SUBST(ZLIB_LDFLAGS)
|
||||
dnl AC_SUBST(ZLIB_LIBS)
|
||||
dnl
|
||||
dnl And (if zlib is found):
|
||||
dnl AC_DEFINE(HAVE_ZLIB)
|
||||
dnl
|
||||
dnl It also leaves the shell variables "success" and "ax_have_zlib"
|
||||
dnl set to "yes" or "no".
|
||||
dnl
|
||||
dnl NOTE: This macro does not currently work for cross-compiling,
|
||||
dnl but it can be easily modified to allow it. (grep "cross").
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @category C
|
||||
dnl @version 2007-09-12
|
||||
dnl @license AllPermissive
|
||||
dnl
|
||||
dnl Copyright (C) 2009 David Reiss
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
|
||||
dnl Input: ax_zlib_path, WANT_ZLIB_VERSION
|
||||
dnl Output: success=yes/no
|
||||
AC_DEFUN([AX_LIB_ZLIB_DO_CHECK],
|
||||
[
|
||||
# Save our flags.
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LIBS_SAVED="$LIBS"
|
||||
LD_LIBRARY_PATH_SAVED="$LD_LIBRARY_PATH"
|
||||
|
||||
# Set our flags if we are checking a specific directory.
|
||||
if test -n "$ax_zlib_path" ; then
|
||||
ZLIB_CPPFLAGS="-I$ax_zlib_path/include"
|
||||
ZLIB_LDFLAGS="-L$ax_zlib_path/lib"
|
||||
LD_LIBRARY_PATH="$ax_zlib_path/lib:$LD_LIBRARY_PATH"
|
||||
else
|
||||
ZLIB_CPPFLAGS=""
|
||||
ZLIB_LDFLAGS=""
|
||||
fi
|
||||
|
||||
# Required flag for zlib.
|
||||
ZLIB_LIBS="-lz"
|
||||
|
||||
# Prepare the environment for compilation.
|
||||
CPPFLAGS="$CPPFLAGS $ZLIB_CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
|
||||
LIBS="$LIBS $ZLIB_LIBS"
|
||||
export CPPFLAGS
|
||||
export LDFLAGS
|
||||
export LIBS
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
success=no
|
||||
|
||||
# Compile, link, and run the program. This checks:
|
||||
# - zlib.h is available for including.
|
||||
# - zlibVersion() is available for linking.
|
||||
# - ZLIB_VERNUM is greater than or equal to the desired version.
|
||||
# - ZLIB_VERSION (defined in zlib.h) matches zlibVersion()
|
||||
# (defined in the library).
|
||||
AC_LANG_PUSH([C])
|
||||
dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling.
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <zlib.h>
|
||||
#if ZLIB_VERNUM >= 0x$WANT_ZLIB_VERSION
|
||||
#else
|
||||
# error zlib is too old
|
||||
#endif
|
||||
]], [[
|
||||
const char* lib_version = zlibVersion();
|
||||
const char* hdr_version = ZLIB_VERSION;
|
||||
for (;;) {
|
||||
if (*lib_version != *hdr_version) {
|
||||
/* If this happens, your zlib header doesn't match your zlib */
|
||||
/* library. That is really bad. */
|
||||
return 1;
|
||||
}
|
||||
if (*lib_version == '\0') {
|
||||
break;
|
||||
}
|
||||
lib_version++;
|
||||
hdr_version++;
|
||||
}
|
||||
return 0;
|
||||
]])], [
|
||||
success=yes
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
# Restore flags.
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
LIBS="$LIBS_SAVED"
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH_SAVED"
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_LIB_ZLIB],
|
||||
[
|
||||
|
||||
dnl Allow search path to be overridden on the command line.
|
||||
AC_ARG_WITH([zlib],
|
||||
AS_HELP_STRING([--with-zlib@<:@=DIR@:>@], [use zlib (default is yes) - it is possible to specify an alternate root directory for zlib]),
|
||||
[
|
||||
if test "x$withval" = "xno"; then
|
||||
want_zlib="no"
|
||||
elif test "x$withval" = "xyes"; then
|
||||
want_zlib="yes"
|
||||
ax_zlib_path=""
|
||||
else
|
||||
want_zlib="yes"
|
||||
ax_zlib_path="$withval"
|
||||
fi
|
||||
],
|
||||
[want_zlib="yes" ; ax_zlib_path="" ])
|
||||
|
||||
|
||||
if test "$want_zlib" = "yes"; then
|
||||
# Parse out the version.
|
||||
zlib_version_req=ifelse([$1], ,1.2.3,$1)
|
||||
zlib_version_req_major=`expr $zlib_version_req : '\([[0-9]]*\)'`
|
||||
zlib_version_req_minor=`expr $zlib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
zlib_version_req_patch=`expr $zlib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
if test -z "$zlib_version_req_patch" ; then
|
||||
zlib_version_req_patch="0"
|
||||
fi
|
||||
WANT_ZLIB_VERSION=`expr $zlib_version_req_major \* 1000 \+ $zlib_version_req_minor \* 100 \+ $zlib_version_req_patch \* 10`
|
||||
|
||||
AC_MSG_CHECKING(for zlib >= $zlib_version_req)
|
||||
|
||||
# Run tests.
|
||||
if test -n "$ax_zlib_path"; then
|
||||
AX_LIB_ZLIB_DO_CHECK
|
||||
else
|
||||
for ax_zlib_path in "" /usr /usr/local /opt /opt/zlib "$ZLIB_ROOT" ; do
|
||||
AX_LIB_ZLIB_DO_CHECK
|
||||
if test "$success" = "yes"; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test "$success" != "yes" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
ZLIB_CPPFLAGS=""
|
||||
ZLIB_LDFLAGS=""
|
||||
ZLIB_LIBS=""
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_ZLIB,,[define if zlib is available])
|
||||
fi
|
||||
|
||||
ax_have_zlib="$success"
|
||||
|
||||
AC_SUBST(ZLIB_CPPFLAGS)
|
||||
AC_SUBST(ZLIB_LDFLAGS)
|
||||
AC_SUBST(ZLIB_LIBS)
|
||||
fi
|
||||
|
||||
])
|
664
vendor/git.apache.org/thrift.git/aclocal/ax_lua.m4
generated
vendored
664
vendor/git.apache.org/thrift.git/aclocal/ax_lua.m4
generated
vendored
|
@ -1,664 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_lua.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PROG_LUA[([MINIMUM-VERSION], [TOO-BIG-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
# AX_LUA_HEADERS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
# AX_LUA_LIBS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
# AX_LUA_READLINE[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Detect a Lua interpreter, optionally specifying a minimum and maximum
|
||||
# version number. Set up important Lua paths, such as the directories in
|
||||
# which to install scripts and modules (shared libraries).
|
||||
#
|
||||
# Also detect Lua headers and libraries. The Lua version contained in the
|
||||
# header is checked to match the Lua interpreter version exactly. When
|
||||
# searching for Lua libraries, the version number is used as a suffix.
|
||||
# This is done with the goal of supporting multiple Lua installs (5.1,
|
||||
# 5.2, and 5.3 side-by-side).
|
||||
#
|
||||
# A note on compatibility with previous versions: This file has been
|
||||
# mostly rewritten for serial 18. Most developers should be able to use
|
||||
# these macros without needing to modify configure.ac. Care has been taken
|
||||
# to preserve each macro's behavior, but there are some differences:
|
||||
#
|
||||
# 1) AX_WITH_LUA is deprecated; it now expands to the exact same thing as
|
||||
# AX_PROG_LUA with no arguments.
|
||||
#
|
||||
# 2) AX_LUA_HEADERS now checks that the version number defined in lua.h
|
||||
# matches the interpreter version. AX_LUA_HEADERS_VERSION is therefore
|
||||
# unnecessary, so it is deprecated and does not expand to anything.
|
||||
#
|
||||
# 3) The configure flag --with-lua-suffix no longer exists; the user
|
||||
# should instead specify the LUA precious variable on the command line.
|
||||
# See the AX_PROG_LUA description for details.
|
||||
#
|
||||
# Please read the macro descriptions below for more information.
|
||||
#
|
||||
# This file was inspired by Andrew Dalke's and James Henstridge's
|
||||
# python.m4 and Tom Payne's, Matthieu Moy's, and Reuben Thomas's ax_lua.m4
|
||||
# (serial 17). Basically, this file is a mash-up of those two files. I
|
||||
# like to think it combines the best of the two!
|
||||
#
|
||||
# AX_PROG_LUA: Search for the Lua interpreter, and set up important Lua
|
||||
# paths. Adds precious variable LUA, which may contain the path of the Lua
|
||||
# interpreter. If LUA is blank, the user's path is searched for an
|
||||
# suitable interpreter.
|
||||
#
|
||||
# If MINIMUM-VERSION is supplied, then only Lua interpreters with a
|
||||
# version number greater or equal to MINIMUM-VERSION will be accepted. If
|
||||
# TOO-BIG-VERSION is also supplied, then only Lua interpreters with a
|
||||
# version number greater or equal to MINIMUM-VERSION and less than
|
||||
# TOO-BIG-VERSION will be accepted.
|
||||
#
|
||||
# The Lua version number, LUA_VERSION, is found from the interpreter, and
|
||||
# substituted. LUA_PLATFORM is also found, but not currently supported (no
|
||||
# standard representation).
|
||||
#
|
||||
# Finally, the macro finds four paths:
|
||||
#
|
||||
# luadir Directory to install Lua scripts.
|
||||
# pkgluadir $luadir/$PACKAGE
|
||||
# luaexecdir Directory to install Lua modules.
|
||||
# pkgluaexecdir $luaexecdir/$PACKAGE
|
||||
#
|
||||
# These paths are found based on $prefix, $exec_prefix, Lua's
|
||||
# package.path, and package.cpath. The first path of package.path
|
||||
# beginning with $prefix is selected as luadir. The first path of
|
||||
# package.cpath beginning with $exec_prefix is used as luaexecdir. This
|
||||
# should work on all reasonable Lua installations. If a path cannot be
|
||||
# determined, a default path is used. Of course, the user can override
|
||||
# these later when invoking make.
|
||||
#
|
||||
# luadir Default: $prefix/share/lua/$LUA_VERSION
|
||||
# luaexecdir Default: $exec_prefix/lib/lua/$LUA_VERSION
|
||||
#
|
||||
# These directories can be used by Automake as install destinations. The
|
||||
# variable name minus 'dir' needs to be used as a prefix to the
|
||||
# appropriate Automake primary, e.g. lua_SCRIPS or luaexec_LIBRARIES.
|
||||
#
|
||||
# If an acceptable Lua interpreter is found, then ACTION-IF-FOUND is
|
||||
# performed, otherwise ACTION-IF-NOT-FOUND is preformed. If ACTION-IF-NOT-
|
||||
# FOUND is blank, then it will default to printing an error. To prevent
|
||||
# the default behavior, give ':' as an action.
|
||||
#
|
||||
# AX_LUA_HEADERS: Search for Lua headers. Requires that AX_PROG_LUA be
|
||||
# expanded before this macro. Adds precious variable LUA_INCLUDE, which
|
||||
# may contain Lua specific include flags, e.g. -I/usr/include/lua5.1. If
|
||||
# LUA_INCLUDE is blank, then this macro will attempt to find suitable
|
||||
# flags.
|
||||
#
|
||||
# LUA_INCLUDE can be used by Automake to compile Lua modules or
|
||||
# executables with embedded interpreters. The *_CPPFLAGS variables should
|
||||
# be used for this purpose, e.g. myprog_CPPFLAGS = $(LUA_INCLUDE).
|
||||
#
|
||||
# This macro searches for the header lua.h (and others). The search is
|
||||
# performed with a combination of CPPFLAGS, CPATH, etc, and LUA_INCLUDE.
|
||||
# If the search is unsuccessful, then some common directories are tried.
|
||||
# If the headers are then found, then LUA_INCLUDE is set accordingly.
|
||||
#
|
||||
# The paths automatically searched are:
|
||||
#
|
||||
# * /usr/include/luaX.Y
|
||||
# * /usr/include/lua/X.Y
|
||||
# * /usr/include/luaXY
|
||||
# * /usr/local/include/luaX.Y
|
||||
# * /usr/local/include/lua-X.Y
|
||||
# * /usr/local/include/lua/X.Y
|
||||
# * /usr/local/include/luaXY
|
||||
#
|
||||
# (Where X.Y is the Lua version number, e.g. 5.1.)
|
||||
#
|
||||
# The Lua version number found in the headers is always checked to match
|
||||
# the Lua interpreter's version number. Lua headers with mismatched
|
||||
# version numbers are not accepted.
|
||||
#
|
||||
# If headers are found, then ACTION-IF-FOUND is performed, otherwise
|
||||
# ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then
|
||||
# it will default to printing an error. To prevent the default behavior,
|
||||
# set the action to ':'.
|
||||
#
|
||||
# AX_LUA_LIBS: Search for Lua libraries. Requires that AX_PROG_LUA be
|
||||
# expanded before this macro. Adds precious variable LUA_LIB, which may
|
||||
# contain Lua specific linker flags, e.g. -llua5.1. If LUA_LIB is blank,
|
||||
# then this macro will attempt to find suitable flags.
|
||||
#
|
||||
# LUA_LIB can be used by Automake to link Lua modules or executables with
|
||||
# embedded interpreters. The *_LIBADD and *_LDADD variables should be used
|
||||
# for this purpose, e.g. mymod_LIBADD = $(LUA_LIB).
|
||||
#
|
||||
# This macro searches for the Lua library. More technically, it searches
|
||||
# for a library containing the function lua_load. The search is performed
|
||||
# with a combination of LIBS, LIBRARY_PATH, and LUA_LIB.
|
||||
#
|
||||
# If the search determines that some linker flags are missing, then those
|
||||
# flags will be added to LUA_LIB.
|
||||
#
|
||||
# If libraries are found, then ACTION-IF-FOUND is performed, otherwise
|
||||
# ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then
|
||||
# it will default to printing an error. To prevent the default behavior,
|
||||
# set the action to ':'.
|
||||
#
|
||||
# AX_LUA_READLINE: Search for readline headers and libraries. Requires the
|
||||
# AX_LIB_READLINE macro, which is provided by ax_lib_readline.m4 from the
|
||||
# Autoconf Archive.
|
||||
#
|
||||
# If a readline compatible library is found, then ACTION-IF-FOUND is
|
||||
# performed, otherwise ACTION-IF-NOT-FOUND is performed.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 Reuben Thomas <rrt@sc3d.org>
|
||||
# Copyright (c) 2014 Tim Perkins <tprk77@gmail.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# 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 39
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
|
||||
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_PROG_LUA],
|
||||
[
|
||||
dnl Check for required tools.
|
||||
AC_REQUIRE([AC_PROG_GREP])
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
|
||||
dnl Make LUA a precious variable.
|
||||
AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1])
|
||||
|
||||
dnl Find a Lua interpreter.
|
||||
m4_define_default([_AX_LUA_INTERPRETER_LIST],
|
||||
[lua lua5.3 lua53 lua5.2 lua52 lua5.1 lua51 lua50])
|
||||
|
||||
m4_if([$1], [],
|
||||
[ dnl No version check is needed. Find any Lua interpreter.
|
||||
AS_IF([test "x$LUA" = 'x'],
|
||||
[AC_PATH_PROGS([LUA], [_AX_LUA_INTERPRETER_LIST], [:])])
|
||||
ax_display_LUA='lua'
|
||||
|
||||
AS_IF([test "x$LUA" != 'x:'],
|
||||
[ dnl At least check if this is a Lua interpreter.
|
||||
AC_MSG_CHECKING([if $LUA is a Lua interpreter])
|
||||
_AX_LUA_CHK_IS_INTRP([$LUA],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([not a Lua interpreter])
|
||||
])
|
||||
])
|
||||
],
|
||||
[ dnl A version check is needed.
|
||||
AS_IF([test "x$LUA" != 'x'],
|
||||
[ dnl Check if this is a Lua interpreter.
|
||||
AC_MSG_CHECKING([if $LUA is a Lua interpreter])
|
||||
_AX_LUA_CHK_IS_INTRP([$LUA],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([not a Lua interpreter])
|
||||
])
|
||||
dnl Check the version.
|
||||
m4_if([$2], [],
|
||||
[_ax_check_text="whether $LUA version >= $1"],
|
||||
[_ax_check_text="whether $LUA version >= $1, < $2"])
|
||||
AC_MSG_CHECKING([$_ax_check_text])
|
||||
_AX_LUA_CHK_VER([$LUA], [$1], [$2],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([version is out of range for specified LUA])])
|
||||
ax_display_LUA=$LUA
|
||||
],
|
||||
[ dnl Try each interpreter until we find one that satisfies VERSION.
|
||||
m4_if([$2], [],
|
||||
[_ax_check_text="for a Lua interpreter with version >= $1"],
|
||||
[_ax_check_text="for a Lua interpreter with version >= $1, < $2"])
|
||||
AC_CACHE_CHECK([$_ax_check_text],
|
||||
[ax_cv_pathless_LUA],
|
||||
[ for ax_cv_pathless_LUA in _AX_LUA_INTERPRETER_LIST none; do
|
||||
test "x$ax_cv_pathless_LUA" = 'xnone' && break
|
||||
_AX_LUA_CHK_IS_INTRP([$ax_cv_pathless_LUA], [], [continue])
|
||||
_AX_LUA_CHK_VER([$ax_cv_pathless_LUA], [$1], [$2], [break])
|
||||
done
|
||||
])
|
||||
dnl Set $LUA to the absolute path of $ax_cv_pathless_LUA.
|
||||
AS_IF([test "x$ax_cv_pathless_LUA" = 'xnone'],
|
||||
[LUA=':'],
|
||||
[AC_PATH_PROG([LUA], [$ax_cv_pathless_LUA])])
|
||||
ax_display_LUA=$ax_cv_pathless_LUA
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test "x$LUA" = 'x:'],
|
||||
[ dnl Run any user-specified action, or abort.
|
||||
m4_default([$4], [AC_MSG_ERROR([cannot find suitable Lua interpreter])])
|
||||
],
|
||||
[ dnl Query Lua for its version number.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA version],
|
||||
[ax_cv_lua_version],
|
||||
[ dnl Get the interpreter version in X.Y format. This should work for
|
||||
dnl interpreters version 5.0 and beyond.
|
||||
ax_cv_lua_version=[`$LUA -e '
|
||||
-- return a version number in X.Y format
|
||||
local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)")
|
||||
print(ver)'`]
|
||||
])
|
||||
AS_IF([test "x$ax_cv_lua_version" = 'x'],
|
||||
[AC_MSG_ERROR([invalid Lua version number])])
|
||||
AC_SUBST([LUA_VERSION], [$ax_cv_lua_version])
|
||||
AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | $SED 's|\.||'`])
|
||||
|
||||
dnl The following check is not supported:
|
||||
dnl At times (like when building shared libraries) you may want to know
|
||||
dnl which OS platform Lua thinks this is.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA platform],
|
||||
[ax_cv_lua_platform],
|
||||
[ax_cv_lua_platform=[`$LUA -e 'print("unknown")'`]])
|
||||
AC_SUBST([LUA_PLATFORM], [$ax_cv_lua_platform])
|
||||
|
||||
dnl Use the values of $prefix and $exec_prefix for the corresponding
|
||||
dnl values of LUA_PREFIX and LUA_EXEC_PREFIX. These are made distinct
|
||||
dnl variables so they can be overridden if need be. However, the general
|
||||
dnl consensus is that you shouldn't need this ability.
|
||||
AC_SUBST([LUA_PREFIX], ['${prefix}'])
|
||||
AC_SUBST([LUA_EXEC_PREFIX], ['${exec_prefix}'])
|
||||
|
||||
dnl Lua provides no way to query the script directory, and instead
|
||||
dnl provides LUA_PATH. However, we should be able to make a safe educated
|
||||
dnl guess. If the built-in search path contains a directory which is
|
||||
dnl prefixed by $prefix, then we can store scripts there. The first
|
||||
dnl matching path will be used.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA script directory],
|
||||
[ax_cv_lua_luadir],
|
||||
[ AS_IF([test "x$prefix" = 'xNONE'],
|
||||
[ax_lua_prefix=$ac_default_prefix],
|
||||
[ax_lua_prefix=$prefix])
|
||||
|
||||
dnl Initialize to the default path.
|
||||
ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION"
|
||||
|
||||
dnl Try to find a path with the prefix.
|
||||
_AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [script])
|
||||
AS_IF([test "x$ax_lua_prefixed_path" != 'x'],
|
||||
[ dnl Fix the prefix.
|
||||
_ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'`
|
||||
ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \
|
||||
$SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"`
|
||||
])
|
||||
])
|
||||
AC_SUBST([luadir], [$ax_cv_lua_luadir])
|
||||
AC_SUBST([pkgluadir], [\${luadir}/$PACKAGE])
|
||||
|
||||
dnl Lua provides no way to query the module directory, and instead
|
||||
dnl provides LUA_PATH. However, we should be able to make a safe educated
|
||||
dnl guess. If the built-in search path contains a directory which is
|
||||
dnl prefixed by $exec_prefix, then we can store modules there. The first
|
||||
dnl matching path will be used.
|
||||
AC_CACHE_CHECK([for $ax_display_LUA module directory],
|
||||
[ax_cv_lua_luaexecdir],
|
||||
[ AS_IF([test "x$exec_prefix" = 'xNONE'],
|
||||
[ax_lua_exec_prefix=$ax_lua_prefix],
|
||||
[ax_lua_exec_prefix=$exec_prefix])
|
||||
|
||||
dnl Initialize to the default path.
|
||||
ax_cv_lua_luaexecdir="$LUA_EXEC_PREFIX/lib/lua/$LUA_VERSION"
|
||||
|
||||
dnl Try to find a path with the prefix.
|
||||
_AX_LUA_FND_PRFX_PTH([$LUA],
|
||||
[$ax_lua_exec_prefix], [module])
|
||||
AS_IF([test "x$ax_lua_prefixed_path" != 'x'],
|
||||
[ dnl Fix the prefix.
|
||||
_ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'`
|
||||
ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \
|
||||
$SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"`
|
||||
])
|
||||
])
|
||||
AC_SUBST([luaexecdir], [$ax_cv_lua_luaexecdir])
|
||||
AC_SUBST([pkgluaexecdir], [\${luaexecdir}/$PACKAGE])
|
||||
|
||||
dnl Run any user specified action.
|
||||
$3
|
||||
])
|
||||
])
|
||||
|
||||
dnl AX_WITH_LUA is now the same thing as AX_PROG_LUA.
|
||||
AC_DEFUN([AX_WITH_LUA],
|
||||
[
|
||||
AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA instead]])
|
||||
AX_PROG_LUA
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl _AX_LUA_CHK_IS_INTRP(PROG, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([_AX_LUA_CHK_IS_INTRP],
|
||||
[
|
||||
dnl A minimal Lua factorial to prove this is an interpreter. This should work
|
||||
dnl for Lua interpreters version 5.0 and beyond.
|
||||
_ax_lua_factorial=[`$1 2>/dev/null -e '
|
||||
-- a simple factorial
|
||||
function fact (n)
|
||||
if n == 0 then
|
||||
return 1
|
||||
else
|
||||
return n * fact(n-1)
|
||||
end
|
||||
end
|
||||
print("fact(5) is " .. fact(5))'`]
|
||||
AS_IF([test "$_ax_lua_factorial" = 'fact(5) is 120'],
|
||||
[$2], [$3])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl _AX_LUA_CHK_VER(PROG, MINIMUM-VERSION, [TOO-BIG-VERSION],
|
||||
dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([_AX_LUA_CHK_VER],
|
||||
[
|
||||
dnl Check that the Lua version is within the bounds. Only the major and minor
|
||||
dnl version numbers are considered. This should work for Lua interpreters
|
||||
dnl version 5.0 and beyond.
|
||||
_ax_lua_good_version=[`$1 -e '
|
||||
-- a script to compare versions
|
||||
function verstr2num(verstr)
|
||||
local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)")
|
||||
if majorver and minorver then
|
||||
return tonumber(majorver) * 100 + tonumber(minorver)
|
||||
end
|
||||
end
|
||||
local minver = verstr2num("$2")
|
||||
local _, _, trimver = string.find(_VERSION, "^Lua (.*)")
|
||||
local ver = verstr2num(trimver)
|
||||
local maxver = verstr2num("$3") or 1e9
|
||||
if minver <= ver and ver < maxver then
|
||||
print("yes")
|
||||
else
|
||||
print("no")
|
||||
end'`]
|
||||
AS_IF([test "x$_ax_lua_good_version" = "xyes"],
|
||||
[$4], [$5])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, SCRIPT-OR-MODULE-DIR)
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([_AX_LUA_FND_PRFX_PTH],
|
||||
[
|
||||
dnl Get the script or module directory by querying the Lua interpreter,
|
||||
dnl filtering on the given prefix, and selecting the shallowest path. If no
|
||||
dnl path is found matching the prefix, the result will be an empty string.
|
||||
dnl The third argument determines the type of search, it can be 'script' or
|
||||
dnl 'module'. Supplying 'script' will perform the search with package.path
|
||||
dnl and LUA_PATH, and supplying 'module' will search with package.cpath and
|
||||
dnl LUA_CPATH. This is done for compatibility with Lua 5.0.
|
||||
|
||||
ax_lua_prefixed_path=[`$1 -e '
|
||||
-- get the path based on search type
|
||||
local searchtype = "$3"
|
||||
local paths = ""
|
||||
if searchtype == "script" then
|
||||
paths = (package and package.path) or LUA_PATH
|
||||
elseif searchtype == "module" then
|
||||
paths = (package and package.cpath) or LUA_CPATH
|
||||
end
|
||||
-- search for the prefix
|
||||
local prefix = "'$2'"
|
||||
local minpath = ""
|
||||
local mindepth = 1e9
|
||||
string.gsub(paths, "(@<:@^;@:>@+)",
|
||||
function (path)
|
||||
path = string.gsub(path, "%?.*$", "")
|
||||
path = string.gsub(path, "/@<:@^/@:>@*$", "")
|
||||
if string.find(path, prefix) then
|
||||
local depth = string.len(string.gsub(path, "@<:@^/@:>@", ""))
|
||||
if depth < mindepth then
|
||||
minpath = path
|
||||
mindepth = depth
|
||||
end
|
||||
end
|
||||
end)
|
||||
print(minpath)'`]
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_LUA_HEADERS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_LUA_HEADERS],
|
||||
[
|
||||
dnl Check for LUA_VERSION.
|
||||
AC_MSG_CHECKING([if LUA_VERSION is defined])
|
||||
AS_IF([test "x$LUA_VERSION" != 'x'],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([cannot check Lua headers without knowing LUA_VERSION])
|
||||
])
|
||||
|
||||
dnl Make LUA_INCLUDE a precious variable.
|
||||
AC_ARG_VAR([LUA_INCLUDE], [The Lua includes, e.g. -I/usr/include/lua5.1])
|
||||
|
||||
dnl Some default directories to search.
|
||||
LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'`
|
||||
m4_define_default([_AX_LUA_INCLUDE_LIST],
|
||||
[ /usr/include/lua$LUA_VERSION \
|
||||
/usr/include/lua-$LUA_VERSION \
|
||||
/usr/include/lua/$LUA_VERSION \
|
||||
/usr/include/lua$LUA_SHORT_VERSION \
|
||||
/usr/local/include/lua$LUA_VERSION \
|
||||
/usr/local/include/lua-$LUA_VERSION \
|
||||
/usr/local/include/lua/$LUA_VERSION \
|
||||
/usr/local/include/lua$LUA_SHORT_VERSION \
|
||||
])
|
||||
|
||||
dnl Try to find the headers.
|
||||
_ax_lua_saved_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
|
||||
AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
|
||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
||||
|
||||
dnl Try some other directories if LUA_INCLUDE was not set.
|
||||
AS_IF([test "x$LUA_INCLUDE" = 'x' &&
|
||||
test "x$ac_cv_header_lua_h" != 'xyes'],
|
||||
[ dnl Try some common include paths.
|
||||
for _ax_include_path in _AX_LUA_INCLUDE_LIST; do
|
||||
test ! -d "$_ax_include_path" && continue
|
||||
|
||||
AC_MSG_CHECKING([for Lua headers in])
|
||||
AC_MSG_RESULT([$_ax_include_path])
|
||||
|
||||
AS_UNSET([ac_cv_header_lua_h])
|
||||
AS_UNSET([ac_cv_header_lualib_h])
|
||||
AS_UNSET([ac_cv_header_lauxlib_h])
|
||||
AS_UNSET([ac_cv_header_luaconf_h])
|
||||
|
||||
_ax_lua_saved_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS -I$_ax_include_path"
|
||||
AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
|
||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
||||
|
||||
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
|
||||
[ LUA_INCLUDE="-I$_ax_include_path"
|
||||
break
|
||||
])
|
||||
done
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
|
||||
[ dnl Make a program to print LUA_VERSION defined in the header.
|
||||
dnl TODO It would be really nice if we could do this without compiling a
|
||||
dnl program, then it would work when cross compiling. But I'm not sure how
|
||||
dnl to do this reliably. For now, assume versions match when cross compiling.
|
||||
|
||||
AS_IF([test "x$cross_compiling" != 'xyes'],
|
||||
[ AC_CACHE_CHECK([for Lua header version],
|
||||
[ax_cv_lua_header_version],
|
||||
[ _ax_lua_saved_cppflags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
|
||||
AC_RUN_IFELSE(
|
||||
[ AC_LANG_SOURCE([[
|
||||
#include <lua.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
if(argc > 1) printf("%s", LUA_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
]])
|
||||
],
|
||||
[ ax_cv_lua_header_version=`./conftest$EXEEXT p | \
|
||||
$SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"`
|
||||
],
|
||||
[ax_cv_lua_header_version='unknown'])
|
||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
||||
])
|
||||
|
||||
dnl Compare this to the previously found LUA_VERSION.
|
||||
AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION])
|
||||
AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
ax_header_version_match='yes'
|
||||
],
|
||||
[ AC_MSG_RESULT([no])
|
||||
ax_header_version_match='no'
|
||||
])
|
||||
],
|
||||
[ AC_MSG_WARN([cross compiling so assuming header version number matches])
|
||||
ax_header_version_match='yes'
|
||||
])
|
||||
])
|
||||
|
||||
dnl Was LUA_INCLUDE specified?
|
||||
AS_IF([test "x$ax_header_version_match" != 'xyes' &&
|
||||
test "x$LUA_INCLUDE" != 'x'],
|
||||
[AC_MSG_ERROR([cannot find headers for specified LUA_INCLUDE])])
|
||||
|
||||
dnl Test the final result and run user code.
|
||||
AS_IF([test "x$ax_header_version_match" = 'xyes'], [$1],
|
||||
[m4_default([$2], [AC_MSG_ERROR([cannot find Lua includes])])])
|
||||
])
|
||||
|
||||
dnl AX_LUA_HEADERS_VERSION no longer exists, use AX_LUA_HEADERS.
|
||||
AC_DEFUN([AX_LUA_HEADERS_VERSION],
|
||||
[
|
||||
AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS instead]])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_LUA_LIBS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_LUA_LIBS],
|
||||
[
|
||||
dnl TODO Should this macro also check various -L flags?
|
||||
|
||||
dnl Check for LUA_VERSION.
|
||||
AC_MSG_CHECKING([if LUA_VERSION is defined])
|
||||
AS_IF([test "x$LUA_VERSION" != 'x'],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([cannot check Lua libs without knowing LUA_VERSION])
|
||||
])
|
||||
|
||||
dnl Make LUA_LIB a precious variable.
|
||||
AC_ARG_VAR([LUA_LIB], [The Lua library, e.g. -llua5.1])
|
||||
|
||||
AS_IF([test "x$LUA_LIB" != 'x'],
|
||||
[ dnl Check that LUA_LIBS works.
|
||||
_ax_lua_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
AC_SEARCH_LIBS([lua_load], [],
|
||||
[_ax_found_lua_libs='yes'],
|
||||
[_ax_found_lua_libs='no'])
|
||||
LIBS=$_ax_lua_saved_libs
|
||||
|
||||
dnl Check the result.
|
||||
AS_IF([test "x$_ax_found_lua_libs" != 'xyes'],
|
||||
[AC_MSG_ERROR([cannot find libs for specified LUA_LIB])])
|
||||
],
|
||||
[ dnl First search for extra libs.
|
||||
_ax_lua_extra_libs=''
|
||||
|
||||
_ax_lua_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
AC_SEARCH_LIBS([exp], [m])
|
||||
AC_SEARCH_LIBS([dlopen], [dl])
|
||||
LIBS=$_ax_lua_saved_libs
|
||||
|
||||
AS_IF([test "x$ac_cv_search_exp" != 'xno' &&
|
||||
test "x$ac_cv_search_exp" != 'xnone required'],
|
||||
[_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_exp"])
|
||||
|
||||
AS_IF([test "x$ac_cv_search_dlopen" != 'xno' &&
|
||||
test "x$ac_cv_search_dlopen" != 'xnone required'],
|
||||
[_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_dlopen"])
|
||||
|
||||
dnl Try to find the Lua libs.
|
||||
_ax_lua_saved_libs=$LIBS
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
AC_SEARCH_LIBS([lua_load],
|
||||
[ lua$LUA_VERSION \
|
||||
lua$LUA_SHORT_VERSION \
|
||||
lua-$LUA_VERSION \
|
||||
lua-$LUA_SHORT_VERSION \
|
||||
lua \
|
||||
],
|
||||
[_ax_found_lua_libs='yes'],
|
||||
[_ax_found_lua_libs='no'],
|
||||
[$_ax_lua_extra_libs])
|
||||
LIBS=$_ax_lua_saved_libs
|
||||
|
||||
AS_IF([test "x$ac_cv_search_lua_load" != 'xno' &&
|
||||
test "x$ac_cv_search_lua_load" != 'xnone required'],
|
||||
[LUA_LIB="$ac_cv_search_lua_load $_ax_lua_extra_libs"])
|
||||
])
|
||||
|
||||
dnl Test the result and run user code.
|
||||
AS_IF([test "x$_ax_found_lua_libs" = 'xyes'], [$1],
|
||||
[m4_default([$2], [AC_MSG_ERROR([cannot find Lua libs])])])
|
||||
])
|
||||
|
||||
|
||||
dnl =========================================================================
|
||||
dnl AX_LUA_READLINE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl =========================================================================
|
||||
AC_DEFUN([AX_LUA_READLINE],
|
||||
[
|
||||
AX_LIB_READLINE
|
||||
AS_IF([test "x$ac_cv_header_readline_readline_h" != 'x' &&
|
||||
test "x$ac_cv_header_readline_history_h" != 'x'],
|
||||
[ LUA_LIBS_CFLAGS="-DLUA_USE_READLINE $LUA_LIBS_CFLAGS"
|
||||
$1
|
||||
],
|
||||
[$2])
|
||||
])
|
60
vendor/git.apache.org/thrift.git/aclocal/ax_prog_haxe_version.m4
generated
vendored
60
vendor/git.apache.org/thrift.git/aclocal/ax_prog_haxe_version.m4
generated
vendored
|
@ -1,60 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_prog_haxe_version.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PROG_HAXE_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Makes sure that haxe supports the version indicated. If true the shell
|
||||
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
|
||||
# ACTION-IF-FALSE are run. The $HAXE_VERSION variable will be filled with
|
||||
# the detected version.
|
||||
#
|
||||
# This macro uses the $HAXE variable to perform the check. If $HAXE is not
|
||||
# set prior to calling this macro, the macro will fail.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# AC_PATH_PROG([HAXE],[haxe])
|
||||
# AC_PROG_HAXE_VERSION([3.1.3],[ ... ],[ ... ])
|
||||
#
|
||||
# Searches for Haxe, then checks if at least version 3.1.3 is present.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 Jens Geyer <jensg@apache.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 1
|
||||
|
||||
AC_DEFUN([AX_PROG_HAXE_VERSION],[
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
|
||||
AS_IF([test -n "$HAXE"],[
|
||||
ax_haxe_version="$1"
|
||||
|
||||
AC_MSG_CHECKING([for haxe version])
|
||||
haxe_version=`$HAXE -version 2>&1 | $SED -e 's/^.* \( @<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\) .*/\1/'`
|
||||
AC_MSG_RESULT($haxe_version)
|
||||
|
||||
AC_SUBST([HAXE_VERSION],[$haxe_version])
|
||||
|
||||
AX_COMPARE_VERSION([$ax_haxe_version],[le],[$haxe_version],[
|
||||
:
|
||||
$2
|
||||
],[
|
||||
:
|
||||
$3
|
||||
])
|
||||
],[
|
||||
AC_MSG_WARN([could not find Haxe])
|
||||
$3
|
||||
])
|
||||
])
|
77
vendor/git.apache.org/thrift.git/aclocal/ax_prog_perl_modules.m4
generated
vendored
77
vendor/git.apache.org/thrift.git/aclocal/ax_prog_perl_modules.m4
generated
vendored
|
@ -1,77 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Checks to see if the given perl modules are available. If true the shell
|
||||
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
|
||||
# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
|
||||
# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
|
||||
# will be run.
|
||||
#
|
||||
# MODULES is a space separated list of module names. To check for a
|
||||
# minimum version of a module, append the version number to the module
|
||||
# name, separated by an equals sign.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
|
||||
# AC_MSG_WARN(Need some Perl modules)
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Dean Povey <povey@wedgetail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
|
||||
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
|
||||
|
||||
m4_define([ax_perl_modules])
|
||||
m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
|
||||
[
|
||||
m4_append([ax_perl_modules],
|
||||
[']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
|
||||
])
|
||||
|
||||
# Make sure we have perl
|
||||
if test -z "$PERL"; then
|
||||
AC_CHECK_PROG(PERL,perl,perl)
|
||||
fi
|
||||
|
||||
if test "x$PERL" != x; then
|
||||
ax_perl_modules_failed=0
|
||||
for ax_perl_module in ax_perl_modules; do
|
||||
AC_MSG_CHECKING(for perl module $ax_perl_module)
|
||||
|
||||
# Would be nice to log result here, but can't rely on autoconf internals
|
||||
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_RESULT(no);
|
||||
ax_perl_modules_failed=1
|
||||
else
|
||||
AC_MSG_RESULT(ok);
|
||||
fi
|
||||
done
|
||||
|
||||
# Run optional shell commands
|
||||
if test "$ax_perl_modules_failed" = 0; then
|
||||
:
|
||||
$2
|
||||
else
|
||||
:
|
||||
$3
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN(could not find perl)
|
||||
fi])dnl
|
127
vendor/git.apache.org/thrift.git/aclocal/ax_signed_right_shift.m4
generated
vendored
127
vendor/git.apache.org/thrift.git/aclocal/ax_signed_right_shift.m4
generated
vendored
|
@ -1,127 +0,0 @@
|
|||
dnl @synopsis AX_SIGNED_RIGHT_SHIFT
|
||||
dnl
|
||||
dnl Tests the behavior of a right shift on a negative signed int.
|
||||
dnl
|
||||
dnl This macro calls:
|
||||
dnl AC_DEFINE(SIGNED_RIGHT_SHIFT_IS)
|
||||
dnl AC_DEFINE(ARITHMETIC_RIGHT_SHIFT)
|
||||
dnl AC_DEFINE(LOGICAL_RIGHT_SHIFT)
|
||||
dnl AC_DEFINE(UNKNOWN_RIGHT_SHIFT)
|
||||
dnl
|
||||
dnl SIGNED_RIGHT_SHIFT_IS will be equal to one of the other macros.
|
||||
dnl It also leaves the shell variables "ax_signed_right_shift"
|
||||
dnl set to "arithmetic", "logical", or "unknown".
|
||||
dnl
|
||||
dnl NOTE: This macro does not work for cross-compiling.
|
||||
dnl
|
||||
dnl @category C
|
||||
dnl @version 2009-03-25
|
||||
dnl @license AllPermissive
|
||||
dnl
|
||||
dnl Copyright (C) 2009 David Reiss
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
|
||||
AC_DEFUN([AX_SIGNED_RIGHT_SHIFT],
|
||||
[
|
||||
|
||||
AC_MSG_CHECKING(the behavior of a signed right shift)
|
||||
|
||||
success_arithmetic=no
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
return
|
||||
/* 0xffffffff */
|
||||
-1 >> 1 != -1 ||
|
||||
-1 >> 2 != -1 ||
|
||||
-1 >> 3 != -1 ||
|
||||
-1 >> 4 != -1 ||
|
||||
-1 >> 8 != -1 ||
|
||||
-1 >> 16 != -1 ||
|
||||
-1 >> 24 != -1 ||
|
||||
-1 >> 31 != -1 ||
|
||||
/* 0x80000000 */
|
||||
(-2147483647 - 1) >> 1 != -1073741824 ||
|
||||
(-2147483647 - 1) >> 2 != -536870912 ||
|
||||
(-2147483647 - 1) >> 3 != -268435456 ||
|
||||
(-2147483647 - 1) >> 4 != -134217728 ||
|
||||
(-2147483647 - 1) >> 8 != -8388608 ||
|
||||
(-2147483647 - 1) >> 16 != -32768 ||
|
||||
(-2147483647 - 1) >> 24 != -128 ||
|
||||
(-2147483647 - 1) >> 31 != -1 ||
|
||||
/* 0x90800000 */
|
||||
-1870659584 >> 1 != -935329792 ||
|
||||
-1870659584 >> 2 != -467664896 ||
|
||||
-1870659584 >> 3 != -233832448 ||
|
||||
-1870659584 >> 4 != -116916224 ||
|
||||
-1870659584 >> 8 != -7307264 ||
|
||||
-1870659584 >> 16 != -28544 ||
|
||||
-1870659584 >> 24 != -112 ||
|
||||
-1870659584 >> 31 != -1 ||
|
||||
0;
|
||||
]])], [
|
||||
success_arithmetic=yes
|
||||
])
|
||||
|
||||
|
||||
success_logical=no
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
return
|
||||
/* 0xffffffff */
|
||||
-1 >> 1 != (signed)((unsigned)-1 >> 1) ||
|
||||
-1 >> 2 != (signed)((unsigned)-1 >> 2) ||
|
||||
-1 >> 3 != (signed)((unsigned)-1 >> 3) ||
|
||||
-1 >> 4 != (signed)((unsigned)-1 >> 4) ||
|
||||
-1 >> 8 != (signed)((unsigned)-1 >> 8) ||
|
||||
-1 >> 16 != (signed)((unsigned)-1 >> 16) ||
|
||||
-1 >> 24 != (signed)((unsigned)-1 >> 24) ||
|
||||
-1 >> 31 != (signed)((unsigned)-1 >> 31) ||
|
||||
/* 0x80000000 */
|
||||
(-2147483647 - 1) >> 1 != (signed)((unsigned)(-2147483647 - 1) >> 1) ||
|
||||
(-2147483647 - 1) >> 2 != (signed)((unsigned)(-2147483647 - 1) >> 2) ||
|
||||
(-2147483647 - 1) >> 3 != (signed)((unsigned)(-2147483647 - 1) >> 3) ||
|
||||
(-2147483647 - 1) >> 4 != (signed)((unsigned)(-2147483647 - 1) >> 4) ||
|
||||
(-2147483647 - 1) >> 8 != (signed)((unsigned)(-2147483647 - 1) >> 8) ||
|
||||
(-2147483647 - 1) >> 16 != (signed)((unsigned)(-2147483647 - 1) >> 16) ||
|
||||
(-2147483647 - 1) >> 24 != (signed)((unsigned)(-2147483647 - 1) >> 24) ||
|
||||
(-2147483647 - 1) >> 31 != (signed)((unsigned)(-2147483647 - 1) >> 31) ||
|
||||
/* 0x90800000 */
|
||||
-1870659584 >> 1 != (signed)((unsigned)-1870659584 >> 1) ||
|
||||
-1870659584 >> 2 != (signed)((unsigned)-1870659584 >> 2) ||
|
||||
-1870659584 >> 3 != (signed)((unsigned)-1870659584 >> 3) ||
|
||||
-1870659584 >> 4 != (signed)((unsigned)-1870659584 >> 4) ||
|
||||
-1870659584 >> 8 != (signed)((unsigned)-1870659584 >> 8) ||
|
||||
-1870659584 >> 16 != (signed)((unsigned)-1870659584 >> 16) ||
|
||||
-1870659584 >> 24 != (signed)((unsigned)-1870659584 >> 24) ||
|
||||
-1870659584 >> 31 != (signed)((unsigned)-1870659584 >> 31) ||
|
||||
0;
|
||||
]])], [
|
||||
success_logical=yes
|
||||
])
|
||||
|
||||
|
||||
AC_DEFINE([ARITHMETIC_RIGHT_SHIFT], 1, [Possible value for SIGNED_RIGHT_SHIFT_IS])
|
||||
AC_DEFINE([LOGICAL_RIGHT_SHIFT], 2, [Possible value for SIGNED_RIGHT_SHIFT_IS])
|
||||
AC_DEFINE([UNKNOWN_RIGHT_SHIFT], 3, [Possible value for SIGNED_RIGHT_SHIFT_IS])
|
||||
|
||||
if test "$success_arithmetic" = "yes" && test "$success_logical" = "yes" ; then
|
||||
AC_MSG_ERROR("Right shift appears to be both arithmetic and logical!")
|
||||
elif test "$success_arithmetic" = "yes" ; then
|
||||
ax_signed_right_shift=arithmetic
|
||||
AC_DEFINE([SIGNED_RIGHT_SHIFT_IS], 1,
|
||||
[Indicates the effect of the right shift operator
|
||||
on negative signed integers])
|
||||
elif test "$success_logical" = "yes" ; then
|
||||
ax_signed_right_shift=logical
|
||||
AC_DEFINE([SIGNED_RIGHT_SHIFT_IS], 2,
|
||||
[Indicates the effect of the right shift operator
|
||||
on negative signed integers])
|
||||
else
|
||||
ax_signed_right_shift=unknown
|
||||
AC_DEFINE([SIGNED_RIGHT_SHIFT_IS], 3,
|
||||
[Indicates the effect of the right shift operator
|
||||
on negative signed integers])
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($ax_signed_right_shift)
|
||||
])
|
28
vendor/git.apache.org/thrift.git/aclocal/ax_thrift_internal.m4
generated
vendored
28
vendor/git.apache.org/thrift.git/aclocal/ax_thrift_internal.m4
generated
vendored
|
@ -1,28 +0,0 @@
|
|||
dnl @synopsis AX_THRIFT_GEN(SHORT_LANGUAGE, LONG_LANGUAGE, DEFAULT)
|
||||
dnl @synopsis AX_THRIFT_LIB(SHORT_LANGUAGE, LONG_LANGUAGE, DEFAULT)
|
||||
dnl
|
||||
dnl Allow a particular language generator to be disabled.
|
||||
dnl Allow a particular language library to be disabled.
|
||||
dnl
|
||||
dnl These macros have poor error handling and are poorly documented.
|
||||
dnl They are intended only for internal use by the Thrift compiler.
|
||||
dnl
|
||||
dnl @version 2008-02-20
|
||||
dnl @license AllPermissive
|
||||
dnl
|
||||
dnl Copyright (C) 2009 David Reiss
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
|
||||
AC_DEFUN([AX_THRIFT_LIB],
|
||||
[
|
||||
AC_ARG_WITH($1,
|
||||
AC_HELP_STRING([--with-$1], [build the $2 library @<:@default=$3@:>@]),
|
||||
[with_$1="$withval"],
|
||||
[with_$1=$3]
|
||||
)
|
||||
have_$1=no
|
||||
dnl What we do here is going to vary from library to library,
|
||||
dnl so we can't really generalize (yet!).
|
||||
])
|
177
vendor/git.apache.org/thrift.git/aclocal/m4_ax_compare_version.m4
generated
vendored
177
vendor/git.apache.org/thrift.git/aclocal/m4_ax_compare_version.m4
generated
vendored
|
@ -1,177 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro compares two version strings. Due to the various number of
|
||||
# minor-version numbers that can exist, and the fact that string
|
||||
# comparisons are not compatible with numeric comparisons, this is not
|
||||
# necessarily trivial to do in a autoconf script. This macro makes doing
|
||||
# these comparisons easy.
|
||||
#
|
||||
# The six basic comparisons are available, as well as checking equality
|
||||
# limited to a certain number of minor-version levels.
|
||||
#
|
||||
# The operator OP determines what type of comparison to do, and can be one
|
||||
# of:
|
||||
#
|
||||
# eq - equal (test A == B)
|
||||
# ne - not equal (test A != B)
|
||||
# le - less than or equal (test A <= B)
|
||||
# ge - greater than or equal (test A >= B)
|
||||
# lt - less than (test A < B)
|
||||
# gt - greater than (test A > B)
|
||||
#
|
||||
# Additionally, the eq and ne operator can have a number after it to limit
|
||||
# the test to that number of minor versions.
|
||||
#
|
||||
# eq0 - equal up to the length of the shorter version
|
||||
# ne0 - not equal up to the length of the shorter version
|
||||
# eqN - equal up to N sub-version levels
|
||||
# neN - not equal up to N sub-version levels
|
||||
#
|
||||
# When the condition is true, shell commands ACTION-IF-TRUE are run,
|
||||
# otherwise shell commands ACTION-IF-FALSE are run. The environment
|
||||
# variable 'ax_compare_version' is always set to either 'true' or 'false'
|
||||
# as well.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
|
||||
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
|
||||
#
|
||||
# would both be true.
|
||||
#
|
||||
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
|
||||
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
|
||||
#
|
||||
# would both be false.
|
||||
#
|
||||
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
|
||||
#
|
||||
# would be true because it is only comparing two minor versions.
|
||||
#
|
||||
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
|
||||
#
|
||||
# would be true because it is only comparing the lesser number of minor
|
||||
# versions of the two values.
|
||||
#
|
||||
# Note: The characters that separate the version numbers do not matter. An
|
||||
# empty string is the same as version 0. OP is evaluated by autoconf, not
|
||||
# configure, so must be a string, not a variable.
|
||||
#
|
||||
# The author would like to acknowledge Guido Draheim whose advice about
|
||||
# the m4_case and m4_ifvaln functions make this macro only include the
|
||||
# portions necessary to perform the specific comparison specified by the
|
||||
# OP argument in the final configure script.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 11
|
||||
|
||||
dnl #########################################################################
|
||||
AC_DEFUN([AX_COMPARE_VERSION], [
|
||||
AC_REQUIRE([AC_PROG_AWK])
|
||||
|
||||
# Used to indicate true or false condition
|
||||
ax_compare_version=false
|
||||
|
||||
# Convert the two version strings to be compared into a format that
|
||||
# allows a simple string comparison. The end result is that a version
|
||||
# string of the form 1.12.5-r617 will be converted to the form
|
||||
# 0001001200050617. In other words, each number is zero padded to four
|
||||
# digits, and non digits are removed.
|
||||
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
|
||||
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
|
||||
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
|
||||
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||
-e 's/[[^0-9]]//g'`
|
||||
|
||||
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
|
||||
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
|
||||
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
|
||||
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||
-e 's/[[^0-9]]//g'`
|
||||
|
||||
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
|
||||
dnl # then the first line is used to determine if the condition is true.
|
||||
dnl # The sed right after the echo is to remove any indented white space.
|
||||
m4_case(m4_tolower($2),
|
||||
[lt],[
|
||||
ax_compare_version=`echo "x$A
|
||||
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
|
||||
],
|
||||
[gt],[
|
||||
ax_compare_version=`echo "x$A
|
||||
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
|
||||
],
|
||||
[le],[
|
||||
ax_compare_version=`echo "x$A
|
||||
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
|
||||
],
|
||||
[ge],[
|
||||
ax_compare_version=`echo "x$A
|
||||
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
|
||||
],[
|
||||
dnl Split the operator from the subversion count if present.
|
||||
m4_bmatch(m4_substr($2,2),
|
||||
[0],[
|
||||
# A count of zero means use the length of the shorter version.
|
||||
# Determine the number of characters in A and B.
|
||||
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
|
||||
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
|
||||
|
||||
# Set A to no more than B's length and B to no more than A's length.
|
||||
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
|
||||
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
|
||||
],
|
||||
[[0-9]+],[
|
||||
# A count greater than zero means use only that many subversions
|
||||
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
|
||||
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
|
||||
],
|
||||
[.+],[
|
||||
AC_WARNING(
|
||||
[illegal OP numeric parameter: $2])
|
||||
],[])
|
||||
|
||||
# Pad zeros at end of numbers to make same length.
|
||||
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
|
||||
B="$B`echo $A | sed 's/./0/g'`"
|
||||
A="$ax_compare_version_tmp_A"
|
||||
|
||||
# Check for equality or inequality as necessary.
|
||||
m4_case(m4_tolower(m4_substr($2,0,2)),
|
||||
[eq],[
|
||||
test "x$A" = "x$B" && ax_compare_version=true
|
||||
],
|
||||
[ne],[
|
||||
test "x$A" != "x$B" && ax_compare_version=true
|
||||
],[
|
||||
AC_WARNING([illegal OP parameter: $2])
|
||||
])
|
||||
])
|
||||
|
||||
AS_VAR_POPDEF([A])dnl
|
||||
AS_VAR_POPDEF([B])dnl
|
||||
|
||||
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
|
||||
if test "$ax_compare_version" = "true" ; then
|
||||
m4_ifvaln([$4],[$4],[:])dnl
|
||||
m4_ifvaln([$5],[else $5])dnl
|
||||
fi
|
||||
]) dnl AX_COMPARE_VERSION
|
93
vendor/git.apache.org/thrift.git/appveyor.yml
generated
vendored
93
vendor/git.apache.org/thrift.git/appveyor.yml
generated
vendored
|
@ -1,93 +0,0 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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 Apache Thrift on AppVeyor - https://ci.appveyor.com
|
||||
|
||||
shallow_clone: true
|
||||
clone_depth: 10
|
||||
|
||||
version: '{build}'
|
||||
os:
|
||||
# - Windows Server 2012 R2
|
||||
- Visual Studio 2015
|
||||
|
||||
environment:
|
||||
BOOST_ROOT: C:\Libraries\boost_1_59_0
|
||||
BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0
|
||||
# Unfurtunately, this version needs manual update because old versions are quickly deleted.
|
||||
ANT_VERSION: 1.9.7
|
||||
|
||||
install:
|
||||
- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64'
|
||||
- cd \
|
||||
# Zlib
|
||||
- appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.tar.gz
|
||||
- 7z x v1.2.8.tar.gz -so | 7z x -si -ttar > nul
|
||||
- cd zlib-1.2.8
|
||||
- cmake -G "Visual Studio 14 2015 Win64" .
|
||||
- cmake --build . --config release
|
||||
- cd ..
|
||||
# OpenSSL
|
||||
- C:\Python35-x64\python %APPVEYOR_BUILD_FOLDER%\build\appveyor\download_openssl.py
|
||||
- ps: Start-Process "Win64OpenSSL.exe" -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes" -Wait
|
||||
# Libevent
|
||||
- appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
|
||||
- 7z x libevent-2.0.22-stable.tar.gz -so | 7z x -si -ttar > nul
|
||||
- cd libevent-2.0.22-stable
|
||||
- nmake -f Makefile.nmake
|
||||
- mkdir lib
|
||||
- move *.lib lib\
|
||||
- move WIN32-Code\event2\* include\event2\
|
||||
- move *.h include\
|
||||
- cd ..
|
||||
- appveyor-retry cinst -y winflexbison
|
||||
- appveyor DownloadFile http://www.us.apache.org/dist/ant/binaries/apache-ant-%ANT_VERSION%-bin.zip
|
||||
- 7z x apache-ant-%ANT_VERSION%-bin.zip > nul
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
# TODO: Enable Haskell build
|
||||
# - cinst HaskellPlatform -version 2014.2.0.0
|
||||
|
||||
|
||||
build_script:
|
||||
- set PATH=C:\ProgramData\chocolatey\bin;C:\apache-ant-%ANT_VERSION%\bin;%PATH%
|
||||
- set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
|
||||
- set PATH=%JAVA_HOME%\bin;%PATH%
|
||||
# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin
|
||||
# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin
|
||||
- set PATH=C:\Python27-x64\scripts;C:\Python27-x64;%PATH%
|
||||
- pip install ipaddress backports.ssl_match_hostname tornado twisted
|
||||
- mkdir cmake-build
|
||||
- cd cmake-build
|
||||
- cmake -G "Visual Studio 14 2015 Win64" -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=C:\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=C:\zlib-1.2.8 -DZLIB_LIBRARY=C:\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..
|
||||
- findstr /b /e BUILD_COMPILER:BOOL=ON CMakeCache.txt
|
||||
- findstr /b /e BUILD_CPP:BOOL=ON CMakeCache.txt
|
||||
- findstr /b /e BUILD_JAVA:BOOL=ON CMakeCache.txt
|
||||
- findstr /b /e BUILD_PYTHON:BOOL=ON CMakeCache.txt
|
||||
# - findstr /b /e BUILD_C_GLIB:BOOL=ON CMakeCache.txt
|
||||
# - findstr /b /e BUILD_HASKELL:BOOL=ON CMakeCache.txt
|
||||
- findstr /b /e BUILD_TESTING:BOOL=ON CMakeCache.txt
|
||||
# - cmake --build .
|
||||
- cmake --build . --config Release
|
||||
# TODO: Fix cpack
|
||||
# - cpack
|
||||
# TODO: Run more tests
|
||||
# CTest fails to invoke ant seemingly due to "ant.bat" v.s. "ant" (shell script) conflict.
|
||||
# Currently, everything that involves OpenSSL seems to hang forever on our Appveyor setup.
|
||||
# Also a few C++ tests hang (on Appveyor or on Windows in general).
|
||||
- ctest -C Release --timeout 600 -VV -E "(StressTestNonBlocking|PythonTestSSLSocket|python_test$|^Java)"
|
||||
# TODO make it perfect ;-r
|
54
vendor/git.apache.org/thrift.git/bootstrap.sh
generated
vendored
54
vendor/git.apache.org/thrift.git/bootstrap.sh
generated
vendored
|
@ -1,54 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
./cleanup.sh
|
||||
if test -d lib/php/src/ext/thrift_protocol ; then
|
||||
if phpize -v >/dev/null 2>/dev/null ; then
|
||||
(cd lib/php/src/ext/thrift_protocol && phpize)
|
||||
fi
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
# libtoolize is called "glibtoolize" on OSX.
|
||||
if libtoolize --version 1 >/dev/null 2>/dev/null; then
|
||||
LIBTOOLIZE=libtoolize
|
||||
elif glibtoolize --version 1 >/dev/null 2>/dev/null; then
|
||||
LIBTOOLIZE=glibtoolize
|
||||
else
|
||||
echo >&2 "Couldn't find libtoolize!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# we require automake 1.13 or later
|
||||
# check must happen externally due to use of newer macro
|
||||
AUTOMAKE_VERSION=`automake --version | grep automake | egrep -o '([0-9]{1,}\.)+[0-9]{1,}'`
|
||||
if [ "$AUTOMAKE_VERSION" \< "1.13" ]; then
|
||||
echo >&2 "automake version $AUTOMAKE_VERSION is too old (need 1.13 or later)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
autoscan
|
||||
$LIBTOOLIZE --copy --automake
|
||||
aclocal -I ./aclocal
|
||||
autoheader
|
||||
autoconf
|
||||
automake --copy --add-missing --foreign
|
16
vendor/git.apache.org/thrift.git/bower.json
generated
vendored
16
vendor/git.apache.org/thrift.git/bower.json
generated
vendored
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "thrift",
|
||||
"version": "0.10.0",
|
||||
"homepage": "https://git-wip-us.apache.org/repos/asf/thrift.git",
|
||||
"authors": [
|
||||
"Apache Thrift <dev@thrift.apache.org>"
|
||||
],
|
||||
"description": "Apache Thrift",
|
||||
"main": "lib/js/src/thrift.js",
|
||||
"keywords": [
|
||||
"thrift"
|
||||
],
|
||||
"license": "Apache v2",
|
||||
"ignore": [
|
||||
]
|
||||
}
|
41
vendor/git.apache.org/thrift.git/build/appveyor/download_openssl.py
generated
vendored
41
vendor/git.apache.org/thrift.git/build/appveyor/download_openssl.py
generated
vendored
|
@ -1,41 +0,0 @@
|
|||
import urllib.request
|
||||
import sys
|
||||
|
||||
OUT = 'Win64OpenSSL.exe'
|
||||
|
||||
URL_STR = 'https://slproweb.com/download/Win64OpenSSL-%s.exe'
|
||||
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 0
|
||||
VERSION_PATCH = 2
|
||||
VERSION_SUFFIX = 'j'
|
||||
VERSION_STR = '%d_%d_%d%s'
|
||||
|
||||
TRY_COUNT = 4
|
||||
|
||||
|
||||
def main():
|
||||
for patch in range(VERSION_PATCH, TRY_COUNT):
|
||||
for suffix in range(TRY_COUNT):
|
||||
if patch == VERSION_PATCH:
|
||||
s = VERSION_SUFFIX
|
||||
else:
|
||||
s = 'a'
|
||||
s = chr(ord(s) + suffix)
|
||||
ver = VERSION_STR % (VERSION_MAJOR, VERSION_MINOR, patch, s)
|
||||
url = URL_STR % ver
|
||||
try:
|
||||
with urllib.request.urlopen(url) as res:
|
||||
if res.getcode() == 200:
|
||||
with open(OUT, 'wb') as out:
|
||||
out.write(res.read())
|
||||
print('successfully downloaded from ' + url)
|
||||
return 0
|
||||
except urllib.error.HTTPError:
|
||||
pass
|
||||
print('failed to download from ' + url, file=sys.stderr)
|
||||
print('could not download openssl', file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
68
vendor/git.apache.org/thrift.git/build/cmake/CPackConfig.cmake
generated
vendored
68
vendor/git.apache.org/thrift.git/build/cmake/CPackConfig.cmake
generated
vendored
|
@ -1,68 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
#TODO: Should we bundle system libraries for DLLs?
|
||||
#include(InstallRequiredSystemLibraries)
|
||||
|
||||
# For help take a look at:
|
||||
# http://www.cmake.org/Wiki/CMake:CPackConfiguration
|
||||
|
||||
### general settings
|
||||
set(CPACK_PACKAGE_NAME "thrift")
|
||||
set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Thrift")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_VENDOR "Apache Software Foundation")
|
||||
set(CPACK_PACKAGE_CONTACT "dev@thrift.apache.org")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
||||
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
### versions
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${thrift_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${thrift_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${thrift_VERSION_PATCH})
|
||||
|
||||
### source generator
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
|
||||
### zip generator
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "thrift")
|
||||
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(CPACK_GENERATOR "NSIS")
|
||||
set(CPACK_NSIS_HELP_LINK "http://thrift.apache.org")
|
||||
set(CPACK_NSIS_MENU_LINKS
|
||||
"http://thrift.apache.org" "Apache Thrift - Web Site"
|
||||
"https://issues.apache.org/jira/browse/THRIFT" "Apache Thrift - Issues")
|
||||
set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
|
||||
set(CPACK_NSIS_MODIFY_PATH "ON")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
||||
else()
|
||||
set(CPACK_GENERATOR "DEB" )
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
||||
endif()
|
||||
|
||||
|
||||
include(CPack)
|
76
vendor/git.apache.org/thrift.git/build/cmake/ConfigureChecks.cmake
generated
vendored
76
vendor/git.apache.org/thrift.git/build/cmake/ConfigureChecks.cmake
generated
vendored
|
@ -1,76 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
include(CheckSymbolExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
|
||||
# If AI_ADDRCONFIG is not defined we define it as 0
|
||||
check_symbol_exists(AI_ADDRCONFIG "sys/types.h;sys/socket.h;netdb.h" HAVE_AI_ADDRCONFIG)
|
||||
if(NOT HAVE_AI_ADDRCONFIG)
|
||||
set(AI_ADDRCONFIG 1)
|
||||
endif(NOT HAVE_AI_ADDRCONFIG)
|
||||
|
||||
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
|
||||
check_include_file(fcntl.h HAVE_FCNTL_H)
|
||||
check_include_file(getopt.h HAVE_GETOPT_H)
|
||||
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file(netdb.h HAVE_NETDB_H)
|
||||
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||
check_include_file(pthread.h HAVE_PTHREAD_H)
|
||||
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
|
||||
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
|
||||
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
|
||||
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_file(sys/un.h HAVE_SYS_UN_H)
|
||||
check_include_file(sys/poll.h HAVE_SYS_POLL_H)
|
||||
check_include_file(sys/select.h HAVE_SYS_SELECT_H)
|
||||
check_include_file(sched.h HAVE_SCHED_H)
|
||||
check_include_file(strings.h HAVE_STRINGS_H)
|
||||
|
||||
check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
|
||||
check_function_exists(gethostbyname_r HAVE_GETHOSTBYNAME_R)
|
||||
check_function_exists(strerror_r HAVE_STRERROR_R)
|
||||
check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX)
|
||||
check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN)
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
check_cxx_source_compiles(
|
||||
"
|
||||
#include <string.h>
|
||||
int main(){char b;char *a = strerror_r(0, &b, 0); return(0);}
|
||||
"
|
||||
STRERROR_R_CHAR_P)
|
||||
|
||||
|
||||
set(PACKAGE ${PACKAGE_NAME})
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(VERSION ${thrift_VERSION})
|
||||
|
||||
# generate a config.h file
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/thrift/config.h")
|
||||
# HACK: Some files include thrift/config.h and some config.h so we include both. This should be cleaned up.
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/thrift" "${CMAKE_CURRENT_BINARY_DIR}")
|
70
vendor/git.apache.org/thrift.git/build/cmake/DefineCMakeDefaults.cmake
generated
vendored
70
vendor/git.apache.org/thrift.git/build/cmake/DefineCMakeDefaults.cmake
generated
vendored
|
@ -1,70 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# Always include srcdir and builddir in include path
|
||||
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
|
||||
# about every subdir
|
||||
# since cmake 2.4.0
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# Put the include dirs which are in the source or build tree
|
||||
# before all other include dirs, so the headers in the sources
|
||||
# are preferred over the already installed ones
|
||||
# since cmake 2.4.1
|
||||
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
||||
|
||||
# Use colored output
|
||||
# since cmake 2.4.0
|
||||
set(CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
# Define the generic version of the libraries here
|
||||
set(GENERIC_LIB_VERSION "0.10.0")
|
||||
set(GENERIC_LIB_SOVERSION "0")
|
||||
|
||||
# Set the default build type to release with debug info
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo
|
||||
CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
)
|
||||
endif (NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# Create the compile command database for clang by default
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Put the libraries and binaries that get built into directories at the
|
||||
# top of the build tree rather than in hard-to-find leaf
|
||||
# directories. This simplifies manual testing and the use of the build
|
||||
# tree rather than installed thrift libraries.
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
#
|
||||
# "rpath" support.
|
||||
# See http://www.itk.org/Wiki/index.php?title=CMake_RPATH_handling
|
||||
#
|
||||
# On MacOSX, for shared libraries, enable rpath support.
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
#
|
||||
# On any OS, for executables, allow linking with shared libraries in non-system
|
||||
# locations and running the executables without LD_PRELOAD or similar.
|
||||
# This requires the library to be built with rpath support.
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
26
vendor/git.apache.org/thrift.git/build/cmake/DefineInstallationPaths.cmake
generated
vendored
26
vendor/git.apache.org/thrift.git/build/cmake/DefineInstallationPaths.cmake
generated
vendored
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# Define the default install paths
|
||||
set(BIN_INSTALL_DIR "bin" CACHE PATH "The binary install dir (default: bin)")
|
||||
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The library install dir (default: lib${LIB_SUFFIX})")
|
||||
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "The library install dir (default: include)")
|
||||
set(CMAKE_INSTALL_DIR "cmake" CACHE PATH "The subdirectory to install cmake config files (default: cmake)")
|
||||
set(DOC_INSTALL_DIR "share/doc" CACHE PATH "The subdirectory to install documentation files (default: share/doc)")
|
210
vendor/git.apache.org/thrift.git/build/cmake/DefineOptions.cmake
generated
vendored
210
vendor/git.apache.org/thrift.git/build/cmake/DefineOptions.cmake
generated
vendored
|
@ -1,210 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
set(THRIFT_COMPILER "" CACHE FILEPATH "External Thrift compiler to use during build")
|
||||
|
||||
# Additional components
|
||||
option(BUILD_COMPILER "Build Thrift compiler" ON)
|
||||
|
||||
if(BUILD_COMPILER OR EXISTS ${THRIFT_COMPILER})
|
||||
set(HAVE_COMPILER ON)
|
||||
endif()
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_TESTING "Build with unit tests" ON "HAVE_COMPILER" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_EXAMPLES "Build examples" ON "HAVE_COMPILER" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_TUTORIALS "Build Thrift tutorials" ON "HAVE_COMPILER" OFF)
|
||||
option(BUILD_LIBRARIES "Build Thrift libraries" ON)
|
||||
|
||||
# Libraries to build
|
||||
|
||||
# Each language library can be enabled or disabled using the WITH_<LANG> flag.
|
||||
# By default CMake checks if the required dependencies for a language are present
|
||||
# and enables the library if all are found. This means the default is to build as
|
||||
# much as possible but leaving out libraries if their dependencies are not met.
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(WITH_BOOST_STATIC "Build with Boost static link library" OFF "NOT MSVC" ON)
|
||||
set(Boost_USE_STATIC_LIBS ${WITH_BOOST_STATIC})
|
||||
if (NOT WITH_BOOST_STATIC)
|
||||
add_definitions(-DBOOST_ALL_DYN_LINK)
|
||||
add_definitions(-DBOOST_TEST_DYN_LINK)
|
||||
endif()
|
||||
|
||||
# C++
|
||||
option(WITH_CPP "Build C++ Thrift library" ON)
|
||||
if(WITH_CPP)
|
||||
find_package(Boost 1.53 QUIET)
|
||||
# NOTE: Currently the following options are C++ specific,
|
||||
# but in future other libraries might reuse them.
|
||||
# So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
|
||||
# has no effect.
|
||||
if(ZLIB_LIBRARY)
|
||||
# FindZLIB.cmake does not normalize path so we need to do it ourselves.
|
||||
file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY)
|
||||
endif()
|
||||
find_package(ZLIB QUIET)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
|
||||
"ZLIB_FOUND" OFF)
|
||||
find_package(Libevent QUIET)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON
|
||||
"Libevent_FOUND" OFF)
|
||||
find_package(Qt4 QUIET COMPONENTS QtCore QtNetwork)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_QT4 "Build with Qt4 support" ON
|
||||
"QT4_FOUND" OFF)
|
||||
find_package(Qt5 QUIET COMPONENTS Core Network)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_QT5 "Build with Qt5 support" ON
|
||||
"Qt5_FOUND" OFF)
|
||||
if(${WITH_QT4} AND ${WITH_QT5} AND ${CMAKE_MAJOR_VERSION} LESS 3)
|
||||
# cmake < 3.0.0 causes conflict when building both Qt4 and Qt5
|
||||
set(WITH_QT4 OFF)
|
||||
endif()
|
||||
find_package(OpenSSL QUIET)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
|
||||
"OPENSSL_FOUND" OFF)
|
||||
option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" OFF
|
||||
"NOT WITH_STDTHREADS;Boost_FOUND" OFF)
|
||||
endif()
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_CPP "Build C++ library" ON
|
||||
"BUILD_LIBRARIES;WITH_CPP;Boost_FOUND" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_PLUGIN "Build compiler plugin support" ON
|
||||
"BUILD_COMPILER;BUILD_CPP" OFF)
|
||||
|
||||
# C GLib
|
||||
option(WITH_C_GLIB "Build C (GLib) Thrift library" ON)
|
||||
if(WITH_C_GLIB)
|
||||
find_package(GLIB QUIET COMPONENTS gobject)
|
||||
endif()
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_C_GLIB "Build C (GLib) library" ON
|
||||
"BUILD_LIBRARIES;WITH_C_GLIB;GLIB_FOUND" OFF)
|
||||
|
||||
if(BUILD_CPP)
|
||||
set(boost_components)
|
||||
if(WITH_BOOSTTHREADS OR BUILD_TESTING)
|
||||
list(APPEND boost_components system thread)
|
||||
endif()
|
||||
if(BUILD_TESTING)
|
||||
list(APPEND boost_components unit_test_framework filesystem chrono program_options)
|
||||
endif()
|
||||
if(boost_components)
|
||||
find_package(Boost 1.53 REQUIRED COMPONENTS ${boost_components})
|
||||
endif()
|
||||
elseif(BUILD_C_GLIB AND BUILD_TESTING)
|
||||
find_package(Boost 1.53 REQUIRED)
|
||||
endif()
|
||||
|
||||
# Java
|
||||
option(WITH_JAVA "Build Java Thrift library" ON)
|
||||
if(ANDROID)
|
||||
find_package(Gradle QUIET)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_JAVA "Build Java library" ON
|
||||
"BUILD_LIBRARIES;WITH_JAVA;GRADLE_FOUND" OFF)
|
||||
else()
|
||||
find_package(Java QUIET)
|
||||
find_package(Ant QUIET)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_JAVA "Build Java library" ON
|
||||
"BUILD_LIBRARIES;WITH_JAVA;JAVA_FOUND;ANT_FOUND" OFF)
|
||||
endif()
|
||||
|
||||
# Python
|
||||
option(WITH_PYTHON "Build Python Thrift library" ON)
|
||||
find_package(PythonInterp QUIET) # for Python executable
|
||||
find_package(PythonLibs QUIET) # for Python.h
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build Python library" ON
|
||||
"BUILD_LIBRARIES;WITH_PYTHON;PYTHONLIBS_FOUND" OFF)
|
||||
|
||||
# Haskell
|
||||
option(WITH_HASKELL "Build Haskell Thrift library" ON)
|
||||
find_package(GHC QUIET)
|
||||
find_package(Cabal QUIET)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_HASKELL "Build GHC library" ON
|
||||
"BUILD_LIBRARIES;WITH_HASKELL;GHC_FOUND;CABAL_FOUND" OFF)
|
||||
|
||||
# Common library options
|
||||
option(WITH_SHARED_LIB "Build shared libraries" ON)
|
||||
option(WITH_STATIC_LIB "Build static libraries" ON)
|
||||
if (NOT WITH_SHARED_LIB AND NOT WITH_STATIC_LIB)
|
||||
message(FATAL_ERROR "Cannot build with both shared and static outputs disabled!")
|
||||
endif()
|
||||
|
||||
#NOTE: C++ compiler options are defined in the lib/cpp/CMakeLists.txt
|
||||
|
||||
# Visual Studio only options
|
||||
if(MSVC)
|
||||
option(WITH_MT "Build using MT instead of MD (MSVC only)" OFF)
|
||||
endif(MSVC)
|
||||
|
||||
macro(MESSAGE_DEP flag summary)
|
||||
if(NOT ${flag})
|
||||
message(STATUS " - ${summary}")
|
||||
endif()
|
||||
endmacro(MESSAGE_DEP flag summary)
|
||||
|
||||
macro(PRINT_CONFIG_SUMMARY)
|
||||
message(STATUS "----------------------------------------------------------")
|
||||
message(STATUS "Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})")
|
||||
message(STATUS "Thrift package version: ${PACKAGE_VERSION}")
|
||||
message(STATUS "Build configuration Summary")
|
||||
message(STATUS " Build Thrift compiler: ${BUILD_COMPILER}")
|
||||
message(STATUS " Build compiler plugin support: ${WITH_PLUGIN}")
|
||||
MESSAGE_DEP(PLUGIN_COMPILER_NOT_TOO_OLD "Disabled due to older compiler")
|
||||
message(STATUS " Build with unit tests: ${BUILD_TESTING}")
|
||||
MESSAGE_DEP(HAVE_COMPILER "Disabled because BUILD_THRIFT=OFF and no valid THRIFT_COMPILER is given")
|
||||
message(STATUS " Build examples: ${BUILD_EXAMPLES}")
|
||||
MESSAGE_DEP(HAVE_COMPILER "Disabled because BUILD_THRIFT=OFF and no valid THRIFT_COMPILER is given")
|
||||
message(STATUS " Build Thrift libraries: ${BUILD_LIBRARIES}")
|
||||
message(STATUS " Language libraries:")
|
||||
message(STATUS " Build C++ library: ${BUILD_CPP}")
|
||||
MESSAGE_DEP(WITH_CPP "Disabled by WITH_CPP=OFF")
|
||||
MESSAGE_DEP(Boost_FOUND "Boost headers missing")
|
||||
message(STATUS " Build C (GLib) library: ${BUILD_C_GLIB}")
|
||||
MESSAGE_DEP(WITH_C_GLIB "Disabled by WITH_C_GLIB=OFF")
|
||||
MESSAGE_DEP(GLIB_FOUND "GLib missing")
|
||||
message(STATUS " Build Java library: ${BUILD_JAVA}")
|
||||
MESSAGE_DEP(WITH_JAVA "Disabled by WITH_JAVA=OFF")
|
||||
if(ANDROID)
|
||||
MESSAGE_DEP(GRADLE_FOUND "Gradle missing")
|
||||
else()
|
||||
MESSAGE_DEP(JAVA_FOUND "Java Runtime missing")
|
||||
MESSAGE_DEP(ANT_FOUND "Ant missing")
|
||||
endif()
|
||||
message(STATUS " Build Python library: ${BUILD_PYTHON}")
|
||||
MESSAGE_DEP(WITH_PYTHON "Disabled by WITH_PYTHON=OFF")
|
||||
MESSAGE_DEP(PYTHONLIBS_FOUND "Python libraries missing")
|
||||
message(STATUS " Build Haskell library: ${BUILD_HASKELL}")
|
||||
MESSAGE_DEP(WITH_HASKELL "Disabled by WITH_HASKELL=OFF")
|
||||
MESSAGE_DEP(GHC_FOUND "GHC missing")
|
||||
MESSAGE_DEP(CABAL_FOUND "Cabal missing")
|
||||
message(STATUS " Library features:")
|
||||
message(STATUS " Build shared libraries: ${WITH_SHARED_LIB}")
|
||||
message(STATUS " Build static libraries: ${WITH_STATIC_LIB}")
|
||||
message(STATUS " Build with ZLIB support: ${WITH_ZLIB}")
|
||||
message(STATUS " Build with libevent support: ${WITH_LIBEVENT}")
|
||||
message(STATUS " Build with Qt4 support: ${WITH_QT4}")
|
||||
message(STATUS " Build with Qt5 support: ${WITH_QT5}")
|
||||
message(STATUS " Build with OpenSSL support: ${WITH_OPENSSL}")
|
||||
message(STATUS " Build with Boost thread support: ${WITH_BOOSTTHREADS}")
|
||||
message(STATUS " Build with C++ std::thread support: ${WITH_STDTHREADS}")
|
||||
message(STATUS " Build with Boost static link library: ${WITH_BOOST_STATIC}")
|
||||
if(MSVC)
|
||||
message(STATUS " - Enabled for Visual C++")
|
||||
endif()
|
||||
message(STATUS "----------------------------------------------------------")
|
||||
endmacro(PRINT_CONFIG_SUMMARY)
|
106
vendor/git.apache.org/thrift.git/build/cmake/DefinePlatformSpecifc.cmake
generated
vendored
106
vendor/git.apache.org/thrift.git/build/cmake/DefinePlatformSpecifc.cmake
generated
vendored
|
@ -1,106 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# Visual Studio specific options
|
||||
if(MSVC)
|
||||
#For visual studio the library naming is as following:
|
||||
# Dynamic libraries:
|
||||
# - thrift.dll for release library
|
||||
# - thriftd.dll for debug library
|
||||
#
|
||||
# Static libraries:
|
||||
# - thriftmd.lib for /MD release build
|
||||
# - thriftmt.lib for /MT release build
|
||||
#
|
||||
# - thriftmdd.lib for /MD debug build
|
||||
# - thriftmtd.lib for /MT debug build
|
||||
#
|
||||
# the same holds for other libraries like libthriftz etc.
|
||||
|
||||
# For Debug build types, append a "d" to the library names.
|
||||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE)
|
||||
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set release library postfix" FORCE)
|
||||
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "Set release library postfix" FORCE)
|
||||
|
||||
# Build using /MT option instead of /MD if the WITH_MT options is set
|
||||
if(WITH_MT)
|
||||
set(CompilerFlags
|
||||
CMAKE_CXX_FLAGS
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
foreach(CompilerFlag ${CompilerFlags})
|
||||
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||
endforeach()
|
||||
set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE)
|
||||
else(WITH_MT)
|
||||
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
|
||||
endif(WITH_MT)
|
||||
|
||||
# Disable Windows.h definition of macros for min and max
|
||||
add_definitions("-DNOMINMAX")
|
||||
|
||||
# Disable boost auto linking pragmas - cmake includes the right files
|
||||
add_definitions("-DBOOST_ALL_NO_LIB")
|
||||
|
||||
# Windows build does not know how to make a shared library yet
|
||||
# as there are no __declspec(dllexport) or exports files in the project.
|
||||
if (WITH_SHARED_LIB)
|
||||
message (FATAL_ERROR "Windows build does not support shared library output yet, please set -DWITH_SHARED_LIB=off")
|
||||
endif()
|
||||
|
||||
elseif(UNIX)
|
||||
find_program( MEMORYCHECK_COMMAND valgrind )
|
||||
set( MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=all --leak-check=full" )
|
||||
set( MEMORYCHECK_SUPPRESSIONS_FILE "${PROJECT_SOURCE_DIR}/test/valgrind.suppress" )
|
||||
endif()
|
||||
|
||||
# WITH_*THREADS selects which threading library to use
|
||||
if(WITH_BOOSTTHREADS)
|
||||
add_definitions("-DUSE_BOOST_THREAD=1")
|
||||
elseif(WITH_STDTHREADS)
|
||||
add_definitions("-DUSE_STD_THREAD=1")
|
||||
endif()
|
||||
|
||||
# GCC and Clang.
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# FIXME -pedantic can not be used at the moment because of: https://issues.apache.org/jira/browse/THRIFT-2784
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra -pedantic")
|
||||
# FIXME enabling c++11 breaks some Linux builds on Travis by triggering a g++ bug, see
|
||||
# https://travis-ci.org/apache/thrift/jobs/58017022
|
||||
# on the other hand, both MacOSX and FreeBSD need c++11
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If gcc older than 4.8 is detected, disable new compiler plug-in support (see THRIFT-3937)
|
||||
set(PLUGIN_COMPILER_NOT_TOO_OLD ON) # simplifies messaging in DefineOptions summary
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8" AND WITH_PLUGIN)
|
||||
message(STATUS "Disabling compiler plug-in support to work with older gcc compiler")
|
||||
set(WITH_PLUGIN OFF)
|
||||
set(PLUGIN_COMPILER_NOT_TOO_OLD OFF)
|
||||
endif()
|
||||
|
30
vendor/git.apache.org/thrift.git/build/cmake/FindAnt.cmake
generated
vendored
30
vendor/git.apache.org/thrift.git/build/cmake/FindAnt.cmake
generated
vendored
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# ANT_FOUND - system has Ant
|
||||
# Ant_EXECUTABLE - the Ant executable
|
||||
#
|
||||
# It will search the environment variable ANT_HOME if it is set
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_program(Ant_EXECUTABLE NAMES ant PATHS $ENV{ANT_HOME}/bin)
|
||||
find_package_handle_standard_args(Ant DEFAULT_MSG Ant_EXECUTABLE)
|
||||
mark_as_advanced(Ant_EXECUTABLE)
|
30
vendor/git.apache.org/thrift.git/build/cmake/FindCabal.cmake
generated
vendored
30
vendor/git.apache.org/thrift.git/build/cmake/FindCabal.cmake
generated
vendored
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# Cabal_FOUND - system has Cabal
|
||||
# Cabal - the Cabal executable
|
||||
#
|
||||
# It will search the environment variable CABAL_HOME if it is set
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_program(CABAL NAMES cabal PATHS $ENV{HOME}/.cabal/bin $ENV{CABAL_HOME}/bin)
|
||||
find_package_handle_standard_args(CABAL DEFAULT_MSG CABAL)
|
||||
mark_as_advanced(CABAL)
|
36
vendor/git.apache.org/thrift.git/build/cmake/FindGHC.cmake
generated
vendored
36
vendor/git.apache.org/thrift.git/build/cmake/FindGHC.cmake
generated
vendored
|
@ -1,36 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# GHC_FOUND - system has GHC
|
||||
# GHC - the GHC executable
|
||||
# RUN_HASKELL_FOUND - system has runhaskell
|
||||
# RUN_HASKELL - the runhaskell executable
|
||||
#
|
||||
# It will search the environment variable GHC_HOME if it is set
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_program(GHC NAMES ghc PATHS $ENV{GHC_HOME}/bin)
|
||||
find_package_handle_standard_args(GHC DEFAULT_MSG GHC)
|
||||
mark_as_advanced(GHC)
|
||||
|
||||
find_program(RUN_HASKELL NAMES runhaskell PATHS $ENV{GHC_HOME}/bin)
|
||||
find_package_handle_standard_args(RUN_HASKELL DEFAULT_MSG RUN_HASKELL)
|
||||
mark_as_advanced(RUN_HASKELL)
|
122
vendor/git.apache.org/thrift.git/build/cmake/FindGLIB.cmake
generated
vendored
122
vendor/git.apache.org/thrift.git/build/cmake/FindGLIB.cmake
generated
vendored
|
@ -1,122 +0,0 @@
|
|||
# - Try to find Glib and its components (gio, gobject etc)
|
||||
# Once done, this will define
|
||||
#
|
||||
# GLIB_FOUND - system has Glib
|
||||
# GLIB_INCLUDE_DIRS - the Glib include directories
|
||||
# GLIB_LIBRARIES - link these to use Glib
|
||||
#
|
||||
# Optionally, the COMPONENTS keyword can be passed to find_package()
|
||||
# and Glib components can be looked for. Currently, the following
|
||||
# components can be used, and they define the following variables if
|
||||
# found:
|
||||
#
|
||||
# gio: GLIB_GIO_LIBRARIES
|
||||
# gobject: GLIB_GOBJECT_LIBRARIES
|
||||
# gmodule: GLIB_GMODULE_LIBRARIES
|
||||
# gthread: GLIB_GTHREAD_LIBRARIES
|
||||
#
|
||||
# Note that the respective _INCLUDE_DIR variables are not set, since
|
||||
# all headers are in the same directory as GLIB_INCLUDE_DIRS.
|
||||
#
|
||||
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. 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.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS 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 HOLDER OR ITS
|
||||
# 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.
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_GLIB QUIET glib-2.0)
|
||||
|
||||
find_library(GLIB_LIBRARIES
|
||||
NAMES glib-2.0
|
||||
HINTS ${PC_GLIB_LIBDIR}
|
||||
${PC_GLIB_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
# Files in glib's main include path may include glibconfig.h, which,
|
||||
# for some odd reason, is normally in $LIBDIR/glib-2.0/include.
|
||||
get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH)
|
||||
find_path(GLIBCONFIG_INCLUDE_DIR
|
||||
NAMES glibconfig.h
|
||||
HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR}
|
||||
${PC_GLIB_INCLUDEDIR} ${PC_GLIB_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES glib-2.0/include
|
||||
)
|
||||
|
||||
find_path(GLIB_INCLUDE_DIR
|
||||
NAMES glib.h
|
||||
HINTS ${PC_GLIB_INCLUDEDIR}
|
||||
${PC_GLIB_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES glib-2.0
|
||||
)
|
||||
|
||||
set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR})
|
||||
|
||||
if(GLIBCONFIG_INCLUDE_DIR)
|
||||
# Version detection
|
||||
file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS)
|
||||
string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
|
||||
set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
|
||||
set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
|
||||
set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}")
|
||||
set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}")
|
||||
endif()
|
||||
|
||||
# Additional Glib components. We only look for libraries, as not all of them
|
||||
# have corresponding headers and all headers are installed alongside the main
|
||||
# glib ones.
|
||||
foreach (_component ${GLIB_FIND_COMPONENTS})
|
||||
if (${_component} STREQUAL "gio")
|
||||
find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES)
|
||||
elseif (${_component} STREQUAL "gobject")
|
||||
find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES)
|
||||
elseif (${_component} STREQUAL "gmodule")
|
||||
find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES)
|
||||
elseif (${_component} STREQUAL "gthread")
|
||||
find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES)
|
||||
elseif (${_component} STREQUAL "gio-unix")
|
||||
# gio-unix is compiled as part of the gio library, but the include paths
|
||||
# are separate from the shared glib ones. Since this is currently only used
|
||||
# by WebKitGTK+ we don't go to extraordinary measures beyond pkg-config.
|
||||
pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0)
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS}
|
||||
VERSION_VAR GLIB_VERSION)
|
||||
|
||||
mark_as_advanced(
|
||||
GLIBCONFIG_INCLUDE_DIR
|
||||
GLIB_GIO_LIBRARIES
|
||||
GLIB_GIO_UNIX_LIBRARIES
|
||||
GLIB_GMODULE_LIBRARIES
|
||||
GLIB_GOBJECT_LIBRARIES
|
||||
GLIB_GTHREAD_LIBRARIES
|
||||
GLIB_INCLUDE_DIR
|
||||
GLIB_INCLUDE_DIRS
|
||||
GLIB_LIBRARIES
|
||||
)
|
30
vendor/git.apache.org/thrift.git/build/cmake/FindGradle.cmake
generated
vendored
30
vendor/git.apache.org/thrift.git/build/cmake/FindGradle.cmake
generated
vendored
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
# GRADLE_FOUND - system has Gradle
|
||||
# GRADLE_EXECUTABLE - the Gradle executable
|
||||
#
|
||||
# It will search the environment variable ANT_HOME if it is set
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_program(GRADLE_EXECUTABLE NAMES gradle PATHS $ENV{GRADLE_HOME}/bin NO_CMAKE_FIND_ROOT_PATH)
|
||||
find_package_handle_standard_args(Gradle DEFAULT_MSG GRADLE_EXECUTABLE)
|
||||
mark_as_advanced(GRADLE_EXECUTABLE)
|
41
vendor/git.apache.org/thrift.git/build/cmake/FindLibevent.cmake
generated
vendored
41
vendor/git.apache.org/thrift.git/build/cmake/FindLibevent.cmake
generated
vendored
|
@ -1,41 +0,0 @@
|
|||
# find LibEvent
|
||||
# an event notification library (http://libevent.org/)
|
||||
#
|
||||
# Usage:
|
||||
# LIBEVENT_INCLUDE_DIRS, where to find LibEvent headers
|
||||
# LIBEVENT_LIBRARIES, LibEvent libraries
|
||||
# Libevent_FOUND, If false, do not try to use libevent
|
||||
|
||||
set(LIBEVENT_ROOT CACHE PATH "Root directory of libevent installation")
|
||||
set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}" ${LIBEVENT_ROOT})
|
||||
foreach(prefix ${LibEvent_EXTRA_PREFIXES})
|
||||
list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
|
||||
list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib")
|
||||
endforeach()
|
||||
|
||||
find_path(LIBEVENT_INCLUDE_DIRS event.h PATHS ${LibEvent_INCLUDE_PATHS})
|
||||
# "lib" prefix is needed on Windows
|
||||
find_library(LIBEVENT_LIBRARIES NAMES event libevent PATHS ${LibEvent_LIBRARIES_PATHS})
|
||||
|
||||
if (LIBEVENT_LIBRARIES AND LIBEVENT_INCLUDE_DIRS)
|
||||
set(Libevent_FOUND TRUE)
|
||||
set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES})
|
||||
else ()
|
||||
set(Libevent_FOUND FALSE)
|
||||
endif ()
|
||||
|
||||
if (Libevent_FOUND)
|
||||
if (NOT Libevent_FIND_QUIETLY)
|
||||
message(STATUS "Found libevent: ${LIBEVENT_LIBRARIES}")
|
||||
endif ()
|
||||
else ()
|
||||
if (LibEvent_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could NOT find libevent.")
|
||||
endif ()
|
||||
message(STATUS "libevent NOT found.")
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(
|
||||
LIBEVENT_LIBRARIES
|
||||
LIBEVENT_INCLUDE_DIRS
|
||||
)
|
60
vendor/git.apache.org/thrift.git/build/cmake/README.md
generated
vendored
60
vendor/git.apache.org/thrift.git/build/cmake/README.md
generated
vendored
|
@ -1,60 +0,0 @@
|
|||
# Apache Thrift - CMake build
|
||||
|
||||
## Goal
|
||||
Extend Apache Thrift's *make cross* approach to the build system.
|
||||
|
||||
Due to growing the field of operating system support, a proper executable
|
||||
and library detection mechanism running on as much platforms as possible
|
||||
becomes required. The other aspect to simplify the release process and
|
||||
package generation process.
|
||||
|
||||
As nice side benefit of CMake is the generation of development environment
|
||||
specific soultion files. => No solution files within source tree.
|
||||
|
||||
|
||||
## Usage
|
||||
just do this:
|
||||
|
||||
mkdir cmake-build && cd cmake-build
|
||||
cmake ..
|
||||
|
||||
if you use a specific toolchain pass it to cmake, the same for options:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake ..
|
||||
cmake -DCMAKE_C_COMPILER=clang-3.5 -DCMAKE_CXX_COMPILER=clang++-3.5 ..
|
||||
cmake -DTHRIFT_COMPILER_HS=OFF ..
|
||||
cmake -DWITH_ZLIB=ON ..
|
||||
|
||||
or on Windows
|
||||
|
||||
cmake -G "Visual Studio 12 2013 Win64" \
|
||||
-DBOOST_ROOT=C:/3rdparty/boost_1_58_0 \
|
||||
-DZLIB_ROOT=C:/3rdparty/zlib128-dll \
|
||||
-DWITH_SHARED_LIB=off -DWITH_BOOSTTHREADS=ON ..
|
||||
|
||||
and open the development environment you like with the solution or do this:
|
||||
|
||||
make
|
||||
make check
|
||||
make cross
|
||||
make dist
|
||||
|
||||
to generate an installer and distribution package do this:
|
||||
|
||||
cpack
|
||||
|
||||
## TODO
|
||||
* git hash or tag based versioning depending on source state
|
||||
* build tutorial
|
||||
* build test
|
||||
* with/without language lib/<lang>/
|
||||
* enable/disable
|
||||
* make cross
|
||||
* make dist (create an alias to make package_source)
|
||||
* make doc
|
||||
* cpack (C++ and make dist only ?)
|
||||
* thrift-compiler
|
||||
* libthrift
|
||||
* tutorial
|
||||
* test
|
||||
* merge into /README.md
|
105
vendor/git.apache.org/thrift.git/build/cmake/ThriftMacros.cmake
generated
vendored
105
vendor/git.apache.org/thrift.git/build/cmake/ThriftMacros.cmake
generated
vendored
|
@ -1,105 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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.
|
||||
#
|
||||
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE)
|
||||
|
||||
|
||||
macro(ADD_LIBRARY_THRIFT name)
|
||||
|
||||
if(WITH_SHARED_LIB)
|
||||
add_library(${name} SHARED ${ARGN})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
OUTPUT_NAME ${name}
|
||||
VERSION ${thrift_VERSION}
|
||||
SOVERSION ${thrift_VERSION} )
|
||||
#set_target_properties(${name} PROPERTIES PUBLIC_HEADER "${thriftcpp_HEADERS}")
|
||||
install(TARGETS ${name}
|
||||
RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
if(WITH_STATIC_LIB)
|
||||
add_library(${name}_static STATIC ${ARGN})
|
||||
set_target_properties(${name}_static PROPERTIES
|
||||
OUTPUT_NAME ${name}${STATIC_POSTFIX}
|
||||
VERSION ${thrift_VERSION}
|
||||
SOVERSION ${thrift_VERSION} )
|
||||
install(TARGETS ${name}_static
|
||||
RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
|
||||
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
endmacro(ADD_LIBRARY_THRIFT)
|
||||
|
||||
|
||||
macro(TARGET_INCLUDE_DIRECTORIES_THRIFT name)
|
||||
|
||||
if(WITH_SHARED_LIB)
|
||||
target_include_directories(${name} ${ARGN})
|
||||
endif()
|
||||
|
||||
if(WITH_STATIC_LIB)
|
||||
target_include_directories(${name}_static ${ARGN})
|
||||
endif()
|
||||
|
||||
endmacro(TARGET_INCLUDE_DIRECTORIES_THRIFT)
|
||||
|
||||
|
||||
macro(TARGET_LINK_LIBRARIES_THRIFT name)
|
||||
|
||||
if(WITH_SHARED_LIB)
|
||||
target_link_libraries(${name} ${ARGN})
|
||||
endif()
|
||||
|
||||
if(WITH_STATIC_LIB)
|
||||
target_link_libraries(${name}_static ${ARGN})
|
||||
endif()
|
||||
|
||||
endmacro(TARGET_LINK_LIBRARIES_THRIFT)
|
||||
|
||||
|
||||
macro(LINK_AGAINST_THRIFT_LIBRARY target libname)
|
||||
|
||||
if (WITH_SHARED_LIB)
|
||||
target_link_libraries(${target} ${libname})
|
||||
elseif (WITH_STATIC_LIB)
|
||||
target_link_libraries(${target} ${libname}_static)
|
||||
else()
|
||||
message(FATAL "Not linking with shared or static libraries?")
|
||||
endif()
|
||||
|
||||
endmacro(LINK_AGAINST_THRIFT_LIBRARY)
|
||||
|
||||
|
||||
macro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY target libname)
|
||||
|
||||
if(WITH_SHARED_LIB)
|
||||
target_link_libraries(${target} ${ARGN} ${libname})
|
||||
endif()
|
||||
|
||||
if(WITH_STATIC_LIB)
|
||||
target_link_libraries(${target}_static ${ARGN} ${libname}_static)
|
||||
endif()
|
||||
|
||||
endmacro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY)
|
26
vendor/git.apache.org/thrift.git/build/cmake/android-toolchain.cmake
generated
vendored
26
vendor/git.apache.org/thrift.git/build/cmake/android-toolchain.cmake
generated
vendored
|
@ -1,26 +0,0 @@
|
|||
set(ANDROID_NDK "/opt/android-ndk" CACHE)
|
||||
set(ANDROID_PLATFORM "android-15" CACHE)
|
||||
set(ANDROID_ARCH "arch-arm" CACHE)
|
||||
set(ANDROID_TOOL_ARCH "android-arm" CACHE)
|
||||
set(ANDROID_CPU "armeabi-v7a" CACHE)
|
||||
set(ANDROID_GCC_VERSION 4.9 CACHE)
|
||||
set(HOST_ARCH linux-x86_64 CACHE)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Android)
|
||||
set(ANDROID_SYSROOT "${ANDROID_NDK}/platforms/${ANDROID_PLATFORM}/${ANDROID_ARCH}")
|
||||
set(ANDROID_TRIPLET arm-linux-androideabi)
|
||||
set(ANDROID_STL "${ANDROID_NDK}/sources/cxx-stl/gnu-libstd++/${ANDROID_GCC_VERSION}")
|
||||
|
||||
set(_COMPILER_ROOT ${ANDROID_NDK}/prebuilt/${ANDROID_TRIPLET}-${ANDROID_GCC_VERSION}/prebuilt/${HOST_ARCH})
|
||||
set(CMAKE_C_COMPILER ${_COMPILER_ROOT}/bin/${ANDROID_TRIPLET}-gcc)
|
||||
set(CMAKE_CXCX_COMPILER ${_COMPILER_ROOT}/bin/${ANDROID_TRIPLET}-g++)
|
||||
|
||||
include_directories(
|
||||
${ANDROID_STL}/include
|
||||
${ANDROID_STL}/libs/${ANDROID_CPU}/include)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${ANDROID_SYSROOT})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
157
vendor/git.apache.org/thrift.git/build/cmake/config.h.in
generated
vendored
157
vendor/git.apache.org/thrift.git/build/cmake/config.h.in
generated
vendored
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.
|
||||
*/
|
||||
|
||||
/* config.h generated by CMake from config.h.in */
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
||||
/* Name of package */
|
||||
#cmakedefine PACKAGE "${PACKAGE}"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#cmakedefine PACKAGE_TARNAME "${PACKAGE_TARNAME}"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#cmakedefine PACKAGE_URL "${PACKAGE_URL}"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "${PACKAGE_VERSION}"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "${PACKAGE_STRING}"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "${VERSION}"
|
||||
|
||||
/************************** DEFINES *************************/
|
||||
|
||||
/* Define if the AI_ADDRCONFIG symbol is unavailable */
|
||||
#cmakedefine AI_ADDRCONFIG 0
|
||||
|
||||
/* Possible value for SIGNED_RIGHT_SHIFT_IS */
|
||||
/* TODO: This is just set to 1 for the moment
|
||||
port the macro aclocal/ax_signed_right_shift.m4 to CMake to make this work */
|
||||
#define ARITHMETIC_RIGHT_SHIFT 1
|
||||
|
||||
/* Indicates the effect of the right shift operator on negative signed
|
||||
integers */
|
||||
/* TODO: This is just set to 1 for the moment */
|
||||
#define SIGNED_RIGHT_SHIFT_IS 1
|
||||
|
||||
/* Use *.h extension for parser header file */
|
||||
/* TODO: This might now be necessary anymore as it is set only for automake < 1.11
|
||||
see: aclocal/ac_prog_bison.m4 */
|
||||
#cmakedefine BISON_USE_PARSER_H_EXTENSION 1
|
||||
|
||||
/* replaces POSIX pthread by boost::thread */
|
||||
#cmakedefine USE_BOOST_THREAD 1
|
||||
|
||||
/* replaces POSIX pthread by std::thread */
|
||||
#cmakedefine USE_STD_THREAD 1
|
||||
|
||||
/* Define to 1 if strerror_r returns char *. */
|
||||
#cmakedefine STRERROR_R_CHAR_P 1
|
||||
|
||||
|
||||
/************************** HEADER FILES *************************/
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#cmakedefine HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#cmakedefine HAVE_NETDB_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#cmakedefine HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#cmakedefine HAVE_PTHREAD_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#cmakedefine HAVE_SYS_RESOURCE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#cmakedefine HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#cmakedefine HAVE_SYS_UN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
#cmakedefine HAVE_SYS_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#cmakedefine HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
#cmakedefine HAVE_SCHED_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/*************************** FUNCTIONS ***************************/
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname' function. */
|
||||
#cmakedefine HAVE_GETHOSTBYNAME 1
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname_r' function. */
|
||||
#cmakedefine HAVE_GETHOSTBYNAME_R 1
|
||||
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
#cmakedefine HAVE_STRERROR_R 1
|
||||
|
||||
/* Define to 1 if you have the `sched_get_priority_max' function. */
|
||||
#cmakedefine HAVE_SCHED_GET_PRIORITY_MAX 1
|
||||
|
||||
/* Define to 1 if you have the `sched_get_priority_min' function. */
|
||||
#cmakedefine HAVE_SCHED_GET_PRIORITY_MIN 1
|
||||
|
||||
|
||||
/* Define to 1 if strerror_r returns char *. */
|
||||
#cmakedefine STRERROR_R_CHAR_P 1
|
||||
|
||||
#endif
|
24
vendor/git.apache.org/thrift.git/build/cmake/mingw32-toolchain.cmake
generated
vendored
24
vendor/git.apache.org/thrift.git/build/cmake/mingw32-toolchain.cmake
generated
vendored
|
@ -1,24 +0,0 @@
|
|||
# CMake mingw32 cross compile toolchain file
|
||||
|
||||
# the name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
|
||||
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
|
||||
SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# programs in the host environment
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "-static")
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-static-libgcc")
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-static-libstdc++")
|
27
vendor/git.apache.org/thrift.git/build/docker/README.md
generated
vendored
27
vendor/git.apache.org/thrift.git/build/docker/README.md
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
# Apache Thrift Docker containers
|
||||
A set of docker containers used to build and test Apache Thrift
|
||||
|
||||
### Available Containers
|
||||
|
||||
* Ubuntu - based on ubuntu:trusty (14.04)
|
||||
* Centos - based on centos:6.6
|
||||
|
||||
## Dependencies
|
||||
|
||||
* A working Docker environment. A Vagrantfile is provided which will setup an Ubuntu host and working Docker environment as well as build the Apache Thrift Docker container for testing and development
|
||||
|
||||
## Usage
|
||||
From the Apache Thrift code base root
|
||||
|
||||
* Build
|
||||
|
||||
docker build -t thrift build/docker/ubuntu
|
||||
|
||||
or
|
||||
|
||||
docker build -t thrift build/docker/centos
|
||||
|
||||
* Run
|
||||
|
||||
docker run -v $(pwd):/thrift/src -it thrift /bin/bash
|
||||
|
59
vendor/git.apache.org/thrift.git/build/docker/Vagrantfile
generated
vendored
59
vendor/git.apache.org/thrift.git/build/docker/Vagrantfile
generated
vendored
|
@ -1,59 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Base system bootstrap script
|
||||
$bootstrap_script = <<__BOOTSTRAP__
|
||||
echo "Provisioning defaults"
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
|
||||
# Install default packages
|
||||
sudo apt-get install -y build-essential curl git
|
||||
|
||||
# Install latest Docker version
|
||||
sudo curl -sSL https://get.docker.io/gpg | sudo apt-key add -
|
||||
sudo echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y linux-image-extra-`uname -r` aufs-tools
|
||||
sudo apt-get install -y lxc-docker
|
||||
|
||||
echo "Finished provisioning defaults"
|
||||
__BOOTSTRAP__
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "trusty64"
|
||||
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
config.vm.provider :virtualbox do |vbox|
|
||||
vbox.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
vbox.customize ["modifyvm", :id, "--cpus", "2"]
|
||||
end
|
||||
|
||||
# Setup the default bootstrap script for our ubuntu base box image
|
||||
config.vm.provision "shell", inline: $bootstrap_script
|
||||
|
||||
# Setup the custom docker image from our Ubuntu Dockerfile
|
||||
config.vm.provision "docker" do |d|
|
||||
d.build_image "/vagrant/ubuntu", args: "-t thrift"
|
||||
end
|
||||
|
||||
# Setup the custom docker image from our Centos Dockerfile
|
||||
#config.vm.provision "docker" do |d|
|
||||
# d.build_image "/vagrant/centos", args: "-t thrift-centos"
|
||||
#end
|
||||
|
||||
end
|
142
vendor/git.apache.org/thrift.git/build/docker/centos/Dockerfile
generated
vendored
142
vendor/git.apache.org/thrift.git/build/docker/centos/Dockerfile
generated
vendored
|
@ -1,142 +0,0 @@
|
|||
# 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.
|
||||
|
||||
# Apache Thrift Docker build environment for Centos
|
||||
#
|
||||
# Known missing client libraries:
|
||||
# - D
|
||||
# - Haxe
|
||||
# - Lua
|
||||
#
|
||||
|
||||
FROM centos:7
|
||||
MAINTAINER Apache Thrift <dev@thrift.apache.org>
|
||||
|
||||
RUN yum install -y epel-release
|
||||
|
||||
# General dependencies
|
||||
RUN yum install -y \
|
||||
tar \
|
||||
m4 \
|
||||
perl \
|
||||
clang \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
git \
|
||||
libtool \
|
||||
autoconf \
|
||||
make \
|
||||
bison \
|
||||
bison-devel \
|
||||
flex
|
||||
|
||||
# C++ dependencies
|
||||
RUN yum install -y \
|
||||
boost-devel-static \
|
||||
zlib-devel \
|
||||
openssl-devel \
|
||||
libevent-devel
|
||||
|
||||
# Java Dependencies
|
||||
RUN yum install -y \
|
||||
ant \
|
||||
junit \
|
||||
ant-junit \
|
||||
java-1.7.0-openjdk-devel
|
||||
|
||||
# Python Dependencies
|
||||
RUN yum install -y \
|
||||
python-devel \
|
||||
python-pip \
|
||||
python-setuptools \
|
||||
python-six \
|
||||
python-twisted-web && \
|
||||
pip install -U backports.ssl_match_hostname ipaddress tornado
|
||||
|
||||
# Ruby Dependencies
|
||||
RUN yum install -y \
|
||||
ruby \
|
||||
ruby-devel \
|
||||
rubygems && \
|
||||
gem install bundler rake
|
||||
|
||||
# Perl Dependencies
|
||||
RUN yum install -y \
|
||||
perl-Bit-Vector \
|
||||
perl-Class-Accessor \
|
||||
perl-ExtUtils-MakeMaker \
|
||||
perl-Test-Simple \
|
||||
perl-IO-Socket-SSL \
|
||||
perl-Net-SSLeay \
|
||||
perl-Crypt-SSLeay
|
||||
|
||||
# PHP Dependencies
|
||||
RUN yum install -y \
|
||||
php \
|
||||
php-devel \
|
||||
php-pear \
|
||||
re2c \
|
||||
php-phpunit-PHPUnit \
|
||||
bzip2
|
||||
|
||||
# GLibC Dependencies
|
||||
RUN yum install -y glib2-devel
|
||||
|
||||
# Erlang Dependencies
|
||||
RUN curl -sSL http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.repo -o /etc/yum.repos.d/erlang_solutions.repo && \
|
||||
yum install -y \
|
||||
erlang-kernel \
|
||||
erlang-erts \
|
||||
erlang-stdlib \
|
||||
erlang-eunit \
|
||||
erlang-rebar \
|
||||
erlang-tools
|
||||
|
||||
# Go Dependencies
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
|
||||
ENV PATH /usr/local/go/bin:$PATH
|
||||
|
||||
# Haskell Dependencies
|
||||
RUN yum -y install haskell-platform
|
||||
|
||||
# Node.js Dependencies
|
||||
RUN yum install -y \
|
||||
nodejs \
|
||||
nodejs-devel \
|
||||
npm
|
||||
|
||||
# C# Dependencies
|
||||
RUN yum install -y \
|
||||
mono-core \
|
||||
mono-devel \
|
||||
mono-web-devel \
|
||||
mono-extras \
|
||||
|
||||
# MinGW Dependencies
|
||||
RUN yum install -y \
|
||||
mingw32-binutils \
|
||||
mingw32-crt \
|
||||
mingw32-nsis
|
||||
|
||||
# CMake
|
||||
RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.0.tar.gz | tar -xz && \
|
||||
cd cmake-3.4.0 && ./bootstrap && make -j4 && make install && \
|
||||
cd .. && rm -rf cmake-3.4.0
|
||||
|
||||
# Clean up
|
||||
RUN rm -rf /tmp/* && \
|
||||
yum clean all
|
||||
|
||||
ENV THRIFT_ROOT /thrift
|
||||
RUN mkdir -p $THRIFT_ROOT/src
|
||||
COPY Dockerfile $THRIFT_ROOT/
|
||||
WORKDIR $THRIFT_ROOT/src
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue