TT Bigdata TT Bigdata
首页
GitHub (opens new window)
JaneTTR

JaneTTR

数据酿造智慧,每一滴都是沉淀!
  • Ambari 深度专题

  • Bigtop 方法论

  • 自定义集成

  • Ambari Server 与 Web

  • Ambari Metrics

  • Ambari Plus 思考

  • Redis集成实战

  • 通用代码模板

    • Bigtop通用组件代码

      • bigtop.bom
      • do-component-build
      • install_通用组件.sh
      • 通用组件.spec
        • 通用组件.spec 文件说明与标准模板
          • 1. 存放位置规范
          • 2. 官方 spec 文件案例
          • 3. 推荐 spec 文件通用模板
  • 各组件代码

  • 技术专题
  • 通用代码模板
  • Bigtop通用组件代码
JaneTTR
2025-07-05
目录
通用组件.spec 文件说明与标准模板
1. 存放位置规范
2. 官方 spec 文件案例
3. 推荐 spec 文件通用模板

通用组件.spec

# 通用组件.spec 文件说明与标准模板

在 Bigtop 项目中,.spec 文件用于定义组件 RPM 包的打包规则和元信息,是实现自动化构建和标准发布的核心配置。 无论你是要集成 bigtop-select,还是任意新组件,只要想要自动打成 rpm 包,都需要为其准备一份规范的 spec 文件。

# 1. 存放位置规范

每个组件的 spec 文件应放置于如下目录:

bigtop-packages/src/rpm/{component}/SPECS/{component}.spec
1

以 bigtop-select 为例,其 spec 文件路径为:

bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec
1

如下图所示:

spec文件结构示意

# 2. 官方 spec 文件案例

以官方 bigtop-select 组件为例,其 .spec 文件内容如下(仅节选,实际内容请参见源码仓库):

Name: bigtop-select
Version: %{bigtop_select_version}
Release: %{bigtop_select_release}
Summary: Collection of useful tools for Bigtop
...
%description
This includes a collection of useful tools and files for Bigtop and Ambari

%prep
%setup -q -T -c
install -p -m 755 %{SOURCE0} .
...
%install
bash %{SOURCE0} \
  --distro-dir=${RPM_SOURCE_DIR} \
  --build-dir=${PWD} \
  --prefix=${RPM_BUILD_ROOT} \
  --parent-dir=%{default_parent_dir} \
  --bigtop-base-version=%{bigtop_base_version}
...
%files
%defattr(-,root,root,-)
%doc LICENSE
%{lib_dir}
%{default_parent_dir}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 3. 推荐 spec 文件通用模板

下面是经过实战总结的通用 spec 文件模板,建议所有新组件均以此为基础,按需替换相关参数:

#代码模板#Bigtop#Stack集成
install_通用组件.sh
do-component-build

← install_通用组件.sh do-component-build→

最近更新
01
当前版本 2026/08
08-29
02
把 Ambari Server HA 稳稳地跑起来
08-17
03
从一次启用操作追到主备就绪
08-17
更多文章>
Theme by Vdoing | Copyright © 2017-2026 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式