Skip to content

Commit 25e5792

Browse files
kevinjqliugabeiglio
authored andcommitted
add a Makefile to vendor/ (apache#2218)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change Add a Makefile to `vendor/`. This helps with running commands to regenerate `vendor/` ``` # Generate all vendor packages: make all # Generate individual packages: make fb303 # FB303 Thrift client only make hive-metastore # Hive Metastore Thrift definitions only ``` Pulled this change out of apache#2217 # Are these changes tested? Yes, ran `make all` locally # Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent f288493 commit 25e5792

File tree

2 files changed

+67
-13
lines changed

2 files changed

+67
-13
lines changed

vendor/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
# Makefile for generating vendor packages
18+
19+
.PHONY: all clean fb303 hive-metastore
20+
21+
all: fb303 hive-metastore
22+
23+
# FB303 Thrift client generation
24+
fb303:
25+
rm -f /tmp/fb303.thrift
26+
rm -rf fb303
27+
curl -s https://raw.githubusercontent.com/apache/thrift/master/contrib/fb303/if/fb303.thrift > /tmp/fb303.thrift
28+
rm -rf /tmp/gen-py/
29+
thrift -gen py -o /tmp/ /tmp/fb303.thrift
30+
mv /tmp/gen-py/fb303 fb303
31+
32+
# Hive Metastore Thrift definition generation
33+
hive-metastore:
34+
rm -rf /tmp/hive
35+
mkdir -p /tmp/hive/share/fb303/if/
36+
curl -s https://raw.githubusercontent.com/apache/thrift/master/contrib/fb303/if/fb303.thrift > /tmp/hive/share/fb303/if/fb303.thrift
37+
curl -s https://raw.githubusercontent.com/apache/hive/master/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift > /tmp/hive/hive_metastore.thrift
38+
thrift -gen py -o /tmp/hive /tmp/hive/hive_metastore.thrift
39+
rm -rf hive_metastore
40+
mv /tmp/hive/gen-py/hive_metastore hive_metastore

vendor/README.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,42 @@
1818

1919
Some packages we want to maintain in the repository itself, because there is no good 3rd party alternative.
2020

21-
## FB303 Thrift client
21+
## Quick Setup
22+
23+
Generate all vendor packages:
24+
25+
```bash
26+
make all
27+
```
28+
29+
Generate individual packages:
30+
31+
```bash
32+
make fb303 # FB303 Thrift client only
33+
make hive-metastore # Hive Metastore Thrift definitions only
34+
```
35+
36+
## Packages
37+
38+
### FB303 Thrift client
2239

2340
fb303 is a base Thrift service and a common set of functionality for querying stats, options, and other information from a service.
2441

42+
**Generate with Make:**
2543
```bash
26-
rm -f /tmp/fb303.thrift
27-
rm -rf fb303
28-
curl -s https://raw.githubusercontent.com/apache/thrift/master/contrib/fb303/if/fb303.thrift > /tmp/fb303.thrift
29-
rm -rf /tmp/gen-py/
30-
thrift -gen py -o /tmp/ /tmp/fb303.thrift
31-
mv /tmp/gen-py/fb303 fb303
44+
make fb303
3245
```
3346

3447
# Hive Metastore Thrift definition
3548

3649
The thrift definition require the fb303 service as a dependency
3750

51+
**Generate with Make:**
3852
```bash
39-
rm -rf /tmp/hive
40-
mkdir -p /tmp/hive/share/fb303/if/
41-
curl -s https://raw.githubusercontent.com/apache/thrift/master/contrib/fb303/if/fb303.thrift > /tmp/hive/share/fb303/if/fb303.thrift
42-
curl -s https://raw.githubusercontent.com/apache/hive/master/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift > /tmp/hive/hive_metastore.thrift
43-
thrift -gen py -o /tmp/hive /tmp/hive/hive_metastore.thrift
44-
mv /tmp/hive/gen-py/hive_metastore hive_metastore
53+
make hive-metastore
4554
```
55+
56+
## Requirements
57+
58+
- Apache Thrift compiler (`thrift`)
59+
- `curl` for downloading Thrift definitions

0 commit comments

Comments
 (0)