# splitter-demo **Repository Path**: baigj/splitter-demo ## Basic Information - **Project Name**: splitter-demo - **Description**: No description available - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-03-10 - **Last Updated**: 2025-03-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # splitter简介 在openEuler官方软件包的基础上,对软件包中的文件经行切分处理,提取程序运行所需的最小文件集合。通过对软件包更小粒度的切分,更精细的梳理软件包切片的依赖关系, 从而进一步减小无用切片依赖的引入, 整体上减少应用的体积,目前实践于制作distroless容器镜像的原材料。 ![img.png](docs/img.png) 上述软件包依赖关系中,软件包A和B被切分为多个切片。在软件包的依赖中,软件包B依赖于软件包A。但实际上,软件包A中可能存在软件包B不需要的文件A_slice3, 去掉后并不会影响程序的功能。 # splitter安装 安装系统依赖 ```angular2html dnf install python3-dnf git python3-pip rpm2cpio cpio ``` - [python3-dnf](https://dnf.readthedocs.io/en/latest/api.html): 加载指定的软件包源配置,下载软件包 - [rpm2cpio](http://ftp.rpm.org/max-rpm/s1-rpm-miscellania-rpm2cpio.html): 提取rpm包中的内容,转换为cpio格式 - [cpio](https://en.wikipedia.org/wiki/Cpio#Implementations) 归档工具,创建和提取cpio格式的文件 克隆软件仓库 ```angular2html git clone https://gitee.com/openeuler/splitter.git ``` 安装软件依赖 ```angular2html pip install -r requirements.txt ``` # 命令行 splitter使用cut命令行对软件包切分提取切片内容,查看命令行工具说明 ``` splitter cut --help Usage: splitter cut [OPTIONS] [PARTS]... Split parts from openEuler packages. Options: -r, --release TEXT This decides which openEuler release you will use, such as `openEuler-24.03-LTS-SP1`. [required] -a, --arch TEXT The architecture you need. [required] -o, --output TEXT The path to output generated parts. [required] --help Show this message and exit. ``` 示例: splitter工具依赖切片仓库发布的软件包切片文件,切片时指定openEuler的版本和需要的切片内容。 ```angular2html splitter cut -r 24.03-LTS -a x86_64 -o /path/to/output python3.11_standard python3.11_utils ``` 上述命令行会下载24.03-LTS版本发布的切片中提取python3.11_standard和python3.11_utils切片中的内容,并且会递归的提取它们依赖的切片内容。 最终的rootfs的文件系统会在`/path/to/output`目录中。