OpenCode Skill Share: Automatic .deb to .rpm Package Conversion / OpenCode 实用技能分享:.deb 软件包转 .rpm 自动化技能 (deb-to-rpm)
If you are using Fedora, RHEL, or openSUSE, you’ve probably run into this frustrating scenario: you find a perfect Linux application, but the developer only provides a Debian .deb package.
Say goodbye to dependency hell and manual unpacking! Today, I am excited to share my latest OpenCode skill: deb-to-rpm. It completely automates the process of converting Debian packages into Red Hat/Fedora compatible RPM packages, handling everything from metadata mapping to environment detection smoothly.
🌟 Key Features
1. Smart Environment Auto-Detection
Whether you are running in a standard Linux terminal, a rootless environment, or constrained inside a Flatpak sandbox (like OpenCode), this skill auto-detects its surroundings.
- In Flatpak: It smartly utilizes 'flatpak-spawn --host' to delegate the build to your host machine.
- No 'rpmbuild'? It tells you exactly what to install for your specific distro (Fedora, openSUSE, Mageia) and resumes automatically!
2. Deep Metadata & Script Mapping
It doesn't just repackage files; it translates the package's "soul". It maps Debian 'control' fields directly to RPM 'spec' fields (Name, Version, Architecture, Description, and Dependencies). It even migrates lifecycle scripts like 'postinst' into RPM '%post' sections!
3. No More Debuginfo Crashes
Converting third-party proprietary binaries often causes 'rpmbuild' to crash due to missing debug symbols. 'deb-to-rpm' injects strict anti-debug directives into the '.spec' top layer, ensuring your build succeeds every single time.
🛠️ How It Works (The Workflow)
[ .deb Input ]
│
▼
Extract Archive ──────> (Uses Python if 'ar' command is missing)
│
▼Parse Metadata ──────> (Maps Package, Version, Depends -> Spec fields)
│
▼Create Structure ────> (BUILD/, RPMS/, SOURCES/, SPECS/, build.sh)
│
▼Inject Safeguards ───> (Disables debuginfo, fixes executable %attr)
│
▼Smart Auto-Build ────> (Executes directly OR guides via flatpak-spawn)
│
▼
[ .rpm Output & Auto-Install Prompt! ]Extraction: Splits the '.deb' into 'control.tar' and 'data.tar' (fallback to Python if 'ar' is missing).
Spec Generation: Automatically writes the perfectly tuned '.spec' file and repacks the source tarball.
Execution: Compiles the RPM package directly without making you copy-paste commands manually.
Proactive Installation: Once built successfully, it asks if you want to install it right away using 'dnf' or 'zypper'!
🧑💻 Spec Snippet: The Secret Sauce
To bypass the notorious third-party binary extraction failure, the skill injects this foolproof block into your spec files:
%define debug_package %{nil}
%global _enable_debug_package 0
%global __debug_package 0
%global __strip /bin/true
%global __objdump /bin/true
%global _unpackaged_files_terminate_build 0
💾 Download Link
You can download the deb-to-rpm skill package here:
- Download URL: https://url69.ctfile.com/s/469b4c271d88f657dc5b2ab5d029260a?p=480279
- Access Password: 480279
- Archive Decompression Password: deb-to-rpm.7z
📣 Get Started with OpenCode!
This skill follows the ultimate principle of automation: Never ask the user to do what the machine can do automatically.
If you are using OpenCode, simply trigger it with:
- convert .deb to rpm
What do you think of this skill? Let me know in the comments below, and don't forget to Upvote and Follow for more Linux development tools and OpenCode skills! 🐧💻
Steemit 的朋友们,大家好!🌟
如果你正在使用 Fedora、RHEL 或 openSUSE,你一定遇到过这种烦恼:好不容易找到一个绝赞的 Linux 应用,开发者却只提供了 Debian 系的 .deb 安装包。
告别繁琐的手动解压和依赖地狱!今天,我非常高兴向大家分享我为 OpenCode 平台最新开发的技能:deb-to-rpm。它实现了将 Debian 软件包完美转换为兼容 Red Hat/Fedora 的 RPM 软件包,从元数据映射到环境自适应,全流程自动化!
🌟 核心亮点
1. 智能环境自适应
无论你是运行在标准的 Linux 终端、无 Root 权限环境,还是受限于 Flatpak 沙盒(如 OpenCode 环境),本技能都能精准识别并变换策略:
- 沙盒环境中:智能通过 'flatpak-spawn --host' 借助宿主机进行构建。
- 缺少 'rpmbuild'?自动识别你的发行版(Fedora, openSUSE, Mageia)并给出精准的单条安装命令,安装后自动继续!
2. 深度元数据与脚本映射
它绝不只是简单地换个后缀,而是深度翻译软件包的“灵魂”。自动解析 Debian 的 'control' 字段并无缝映射到 RPM 的 'spec' 属性(如名称、版本、架构、描述及依赖),甚至连 'postinst' 等安装前后置脚本也能完美迁移至 RPM 的 '%post' 等分段中!
3. 彻底解决 Debuginfo 报错
转换第三方闭源商业软件时,常常因为缺失调试符号导致 'rpmbuild' 报错中断。本技能在生成的 '.spec' 头部注入了严苛的禁用指令,确保闭源软件也能一次打包成功!
🛠️ 工作流程解析
[ .deb 输入 ]
│
▼
解压提取 ──────> (无 'ar' 命令时自动启用 Python 兜底)
│
▼解析元数据 ────> (映射名称、版本、依赖等字段到 Spec 文件)
│
▼创建目录结构 ──> (BUILD/, RPMS/, SOURCES/, SPECS/, build.sh)
│
▼注入安全防护 ──> (禁用 debuginfo,修正可执行文件 %attr 权限)
│
▼智能自动构建 ──> (直接执行或通过 flatpak-spawn 引导宿主机构建)
│
▼
[ 生成 .rpm 输出并弹出自动安装提示! ]解压提取:将 '.deb' 拆解为元数据与实际数据流(无 'ar' 命令时自动启用 Python 兜底)。
规范生成:自动编写针对性的 '.spec' 文件,并对可执行文件、库文件精准赋予 '%attr(0755,root,root)' 权限。
自动化构建:无需用户复制粘贴命令,自动调用后端引擎完成构建。
主动问询安装:构建成功后,主动根据系统发行版提供 'dnf' 或 'zypper' 安装向导!
🧑💻 核心技术内幕
为了完美绕过第三方二进制文件提取失败的通病,技能会自动在 Spec 头部注入以下配置:
%define debug_package %{nil}
%global _enable_debug_package 0
%global __debug_package 0
%global __strip /bin/true
%global __objdump /bin/true
%global _unpackaged_files_terminate_build 0
💾 资源下载
您可以点击下方链接下载封装好的 deb-to-rpm 技能文件:
- 下载地址: https://url69.ctfile.com/s/469b4c271d88f657dc5b2ab5d029260a?p=480279
- 网盘提取码: 480279
- 压缩包解压密码: deb-to-rpm.7z
📣 立即在 OpenCode 中体验!
本技能始终坚守自动化领域的至高原则:能自动完成的,绝不让用户手动操作。

Upvoted! Thank you for supporting witness @jswit.