summaryrefslogtreecommitdiff
path: root/Document_Classification.spec
blob: bba6d1d846feac585f02e105c60a16e7ec7a2ba6 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 软件包名称
Name: Document_Classification
# 软件包版本号
Version: 1.0.0
# 发布号,每次发布时递增,初始可以为 1
Release: 1%{?dist}
# 软件包的简短描述,简要说明软件包的功能
Summary: This is a sample package for [文件分类]
# 软件包的许可证,修改为你的软件包所使用的许可证(如 GPL、MIT 等)
License: GPLv3
# 软件包的主页 URL,如果有,修改为实际的项目网址
URL: https://gitee.com/crayon-xiaoxin-xin/XiaoWu.git

# 定义软件包的原始源代码的获取位置和文件名格式
Source0:  %{name}-%{version}.tar.gz

# 生成调试相关的软件包内容
%define debug_package %{nil}

# 软件包的详细描述
%description
This is a more detailed description of my_package.
It includes [文件分类,将一个路径下的文件夹和子文件夹遍历,按照文件类型移动到file、doc、exe、txt,其中file属于其他文件].


# 准备阶段的命令,通常用于解压源代码等操作
%prep
# 输出开始进入%prep阶段的提示信息
echo "开始进入%prep阶段..."
# 输出当前所在的工作目录,用于确认是否是期望的目录
echo "当前工作目录:$(pwd)"
# 检查构建所需的源文件是否存在,如果不存在则输出提示信息并终止构建
if [ ! -f "/builddir/build/SOURCES/Document_Classification-1.0.0.tar.gz" ]; then
    echo "未找到源文件Document_Classification-1.0.0.tar.gz,构建将会失败。"
    exit 1
fi
# 输出源文件的详细信息(权限等情况)
ls -l "/builddir/build/SOURCES/Document_Classification-1.0.0.tar.gz"
# 注释掉%autosetup,改为手动进行解压操作
#%autosetup
# 使用tar命令解压源文件,并通过判断命令返回值来进行错误处理
tar -xzf "/builddir/build/SOURCES/Document_Classification-1.0.0.tar.gz"
if [ $? -ne 0 ]; then
    echo "解压源文件失败,构建将会失败。"
    exit 1
fi
# 检查解压后是否成功进入对应的源文件目录,如果没有则输出提示信息并可能导致构建失败
# 修正basename命令,去除多余的.tar.gz
if [ ! -d "$(basename /builddir/build/SOURCES/Document_Classification-1.0.0.tar.gz .tar.gz)" ]; then
    echo "解压后未能进入对应的源文件目录,构建可能会失败。"
    exit 1
fi
# 输出已进入的源文件目录信息
echo "已进入的源文件目录:$(pwd)"



# 构建阶段的命令,根据项目的实际构建过程进行修改
%build
cjpm build

# 安装阶段的命令,指定软件包的安装路径和要安装的文件
%install
mkdir -p %{buildroot}/root/Document_Classification/bin
mkdir -p %{buildroot}/root/Document_Classification/conf
cp -r %{_builddir}/%{name}-%{version}/target/release/bin/* %{buildroot}/root/Document_Classification

# 定义软件包中的文件和目录的权限设置
%files
/root/Document_Classification/bin/*