openEuler 20.03 LTS SP1 使用alien转换rpm和deb包

2024-05-31 13:48

本文主要是介绍openEuler 20.03 LTS SP1 使用alien转换rpm和deb包,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!


Debian的DEB与redhat的RPM,是linux下比较经典的两种软件二进制安装包格式.
使用alien可以实现这两种格式之间的互换.

一 os环境


# cat /etc/openEuler-release
openEuler release 20.03 (LTS-SP1)

# uname -r
4.19.90-2012.5.0.0054.oe1.x86_64

# cat /etc/yum.repos.d/openEuler.repo
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/$basearch/RPM-GPG-KEY-openEuler


[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/EPOL/$basearch/
enabled=1
gpgcheck=0
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler


二 创建alien相关repo仓库

# dnf install -y createrepo
# mkdir -p /root/alien
# cp dir/*.rpm /root/alien
# cd /root/alien
# ls  *.rpm
a2ps-4.14-48.oe1.x86_64.rpm
alien-8.95-15.oe1.noarch.rpm
cdbs-0.4.163-2.oe1.noarch.rpm
debconf-1.5.74-7.oe1.noarch.rpm
debconf-doc-1.5.74-7.oe1.noarch.rpm
debconf-gnome-1.5.74-7.oe1.noarch.rpm
debconf-i18n-1.5.74-7.oe1.noarch.rpm
debconf-LDAP-1.5.74-7.oe1.noarch.rpm
debconf-utils-1.5.74-7.oe1.noarch.rpm
debhelper-12.7.3-6.oe1.noarch.rpm
dh-autoreconf-19-10.oe1.noarch.rpm
dpkg-1.19.7-9.oe1.x86_64.rpm
dpkg-dev-1.19.7-9.oe1.noarch.rpm
dpkg-devel-1.19.7-9.oe1.x86_64.rpm
dpkg-perl-1.19.7-9.oe1.noarch.rpm
dselect-1.19.7-9.oe1.x86_64.rpm
html2ps-1.0-0.39.b7.oe1.noarch.rpm
perl-App-cpanminus-1.7044-11.oe1.noarch.rpm
perl-Cairo-1.109-2.oe1.x86_64.rpm
perl-Cairo-GObject-1.005-5.oe1.x86_64.rpm
perl-Class-Data-Inheritable-0.08-37.oe1.noarch.rpm
perl-Convert-ASN1-0.27-22.oe1.noarch.rpm
perl-Convert-ASN1-tests-0.27-22.oe1.noarch.rpm
perl-Convert-BinHex-1.125-17.oe1.noarch.rpm
perl-CPAN-DistnameInfo-0.12-21.oe1.noarch.rpm
perl-CPAN-Meta-Check-0.014-15.oe1.noarch.rpm
perl-Data-Dumper-Names-0.03-36.oe1.noarch.rpm
perl-Devel-StackTrace-2.04-8.oe1.noarch.rpm
perl-Email-Abstract-3.008-19.oe1.noarch.rpm
perl-Email-Address-1.912-9.oe1.noarch.rpm
perl-Email-Address-XS-1.04-10.oe1.x86_64.rpm
perl-Email-MessageID-1.406-18.oe1.noarch.rpm
perl-Email-MIME-1.949-4.oe1.noarch.rpm
perl-Email-MIME-ContentType-1.026-2.oe1.noarch.rpm
perl-Email-MIME-Encodings-1.315-21.oe1.noarch.rpm
perl-Email-Simple-2.216-10.oe1.noarch.rpm
perl-Exception-Class-1.44-11.oe1.noarch.rpm
perl-ExtUtils-Depends-0.8000-7.oe1.noarch.rpm
perl-ExtUtils-PkgConfig-1.16-14.oe1.noarch.rpm
perl-File-FcntlLock-0.22-20.oe1.x86_64.rpm
perl-Font-AFM-1.20-35.oe1.noarch.rpm
perl-Geography-Countries-2009041301-31.oe1.noarch.rpm
perl-Glib-1.3293-4.oe1.x86_64.rpm
perl-Glib-devel-1.3293-4.oe1.x86_64.rpm
perl-Glib-Object-Introspection-0.049-3.oe1.x86_64.rpm
perl-Gtk3-0.037-4.oe1.noarch.rpm
perl-HTML-Formatter-2.16-15.oe1.noarch.rpm
perl-HTML-Tree-5.07-14.oe1.noarch.rpm
perli11ndoc-0.049-3.oe1.noarch.rpm
perl-Image-ExifTool-12.16-2.oe1.noarch.rpm
perl-LDAP-0.68-2.oe1.noarch.rpm
perl-LDAP-tests-0.68-2.oe1.noarch.rpm
perl-Mail-Box-3.009-2.oe1.noarch.rpm
perl-Mail-Message-3.010-2.oe1.noarch.rpm
perl-Mail-Transport-3.005-2.oe1.noarch.rpm
perl-MIME-tools-5.509-14.oe1.noarch.rpm
perl-Module-CPANfile-1.1004-10.oe1.noarch.rpm
perl-Module-Pluggable-5.2-16.oe1.noarch.rpm
perl-Object-Realize-Later-0.21-11.oe1.noarch.rpm
perl-PadWalker-2.5-2.oe1.x86_64.rpm
perl-Parse-PMFile-0.43-2.oe1.noarch.rpm
perl-Regexp-Assemble-0.38-12.oe1.noarch.rpm
perl-Test-Differences-0.6700-7.oe1.noarch.rpm
perl-Test-File-Contents-0.23-15.oe1.noarch.rpm
perl-Test-Most-0.37-4.oe1.noarch.rpm
perl-Test-Number-Delta-1.06-19.oe1.noarch.rpm
perl-Test-Warn-0.36-11.oe1.noarch.rpm
perl-TeX-Hyphen-1.18-14.oe1.noarch.rpm
perl-Text-Autoformat-1.750000-5.oe1.noarch.rpm
perl-Text-Iconv-1.7-41.oe1.x86_64.rpm
perl-Text-Reform-1.20-29.oe1.noarch.rpm
perl-Text-Soundex-3.05-18.oe1.x86_64.rpm
perl-User-Identity-1.00-2.oe1.noarch.rpm
po-debconf-1.0.21-5.oe1.noarch.rpm
python3-pdfrw-0.4-13.oe1.noarch.rpm
python3-smartypants-2.0.1-9.oe1.noarch.rpm
python-smartypants-doc-2.0.1-9.oe1.noarch.rpm
rst2pdf-0.97-5.oe1.noarch.rpm
xhtml2ps-1.0-0.39.b7.oe1.noarch.rpm

创建repo仓库
# createrepo alien

三 安装alien

通过三个仓库安装alien包()
# dnf --repofrompath=repo1,/root/alien --enablerepo=repo1 --nogpgcheck install -y alien

四 使用alien

# which alien
/usr/bin/alien

# alien -V
alien version 8.95

# alien -h
Usage: alien [options] file [...]
  file [...]                Package file or files to convert.
  -d, --to-deb              Generate a Debian deb package (default).
     Enables these options:
       --patch=<patch>      Specify patch file to use instead of automatically
                            looking for patch in /var/lib/alien.
       --nopatch        Do not use patches.
       --anypatch           Use even old version os patches.
       -s, --single         Like --generate, but do not create .orig
                            directory.
       --fixperms           Munge/fix permissions and owners.
       --test               Test generated packages with lintian.
  -r, --to-rpm              Generate a Red Hat rpm package.
      --to-slp              Generate a Stampede slp package.
  -l, --to-lsb              Generate a LSB package.
  -t, --to-tgz              Generate a Slackware tgz package.
     Enables these options:
       --description=<desc> Specify package description.
       --version=<version>  Specify package version.
  -p, --to-pkg              Generate a Solaris pkg package.
  -i, --install             Install generated package.
  -g, --generate            Generate build tree, but do not build package.
  -c, --scripts             Include scripts in package.
      --target=<arch>       Set architecture of the generated package.
  -v, --verbose             Display each command alien runs.
      --veryverbose         Be verbose, and also display output of run commands.
  -k, --keep-version        Do not change version of generated package.
      --bump=number         Increment package version by this number.
  -h, --help                Display this help message.
  -V, --version            Display alien's version number.


示例:

-k 保持version版本信息,否则自动+1
-v 详细信息输出
-r 转换为rpm格式

转换RPM为DEB

# alien -kv hello-1-1.oe1.noarch.rpm
    LANG=C rpm -qp --queryformat %{NAME} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{VERSION} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{RELEASE} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{ARCH} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{CHANGELOGTEXT} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{SUMMARY} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{DESCRIPTION} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{PREFIXES} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{POSTUN} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{LICENSE} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{POSTIN} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{PREUN} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qp --queryformat %{PREIN} 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qcp 'hello-1-1.oe1.noarch.rpm'
    rpm -qpi 'hello-1-1.oe1.noarch.rpm'
    LANG=C rpm -qpl 'hello-1-1.oe1.noarch.rpm'
    mkdir hello-1
    chmod 755 hello-1
    rpm2cpio 'hello-1-1.oe1.noarch.rpm' | lzma -t -q > /dev/null 2>&1
    rpm2cpio 'hello-1-1.oe1.noarch.rpm' | (cd hello-1;  cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>&1
    chmod 755 'hello-1/./'
    chmod 755 'hello-1/./tmp'
    chown 0:0 hello-1//tmp/aaa.txt
    chmod 644 hello-1//tmp/aaa.txt
    mkdir hello-1/debian
    hostname
    date -R
    hostname
    date -R
    chmod 755 hello-1/debian/rules
    debian/rules binary 2>&1
hello_1-1.oe1_all.deb generated
    find hello-1 -type d -exec chmod 755 {} ;
    rm -rf hello-1

# ls hello*
hello_1-1.oe1_all.deb  hello-1-1.oe1.noarch.rpm

转换DEB至RPM

# alien -kvr hello_1-1.oe1_all.deb
    dpkg-deb --info 'hello_1-1.oe1_all.deb' control 2>/dev/null
    dpkg-deb --info 'hello_1-1.oe1_all.deb' control 2>/dev/null
    dpkg-deb --info 'hello_1-1.oe1_all.deb' conffiles 2>/dev/null
    dpkg-deb --fsys-tarfile 'hello_1-1.oe1_all.deb' | tar tf -
    dpkg-deb --info 'hello_1-1.oe1_all.deb' postinst 2>/dev/null
    dpkg-deb --info 'hello_1-1.oe1_all.deb' postrm 2>/dev/null
    dpkg-deb --info 'hello_1-1.oe1_all.deb' preinst 2>/dev/null
    dpkg-deb --info 'hello_1-1.oe1_all.deb' prerm 2>/dev/null
    mkdir hello-1
    chmod 755 hello-1
    dpkg-deb -x hello_1-1.oe1_all.deb hello-1
    rpm --showrc
    cd hello-1; rpmbuild --buildroot='/root/hello-1' -bb --target noarch 'hello-1-1.oe1.spec' 2>&1
hello-1-1.oe1.noarch.rpm generated


# dnf install -y hello-1-1.oe1.noarch.rpm

# rpm -qa |grep hello
hello-1-1.oe1.noarch

 

这篇关于openEuler 20.03 LTS SP1 使用alien转换rpm和deb包的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1018099

相关文章

使用Dify访问mysql数据库详细代码示例

《使用Dify访问mysql数据库详细代码示例》:本文主要介绍使用Dify访问mysql数据库的相关资料,并详细讲解了如何在本地搭建数据库访问服务,使用ngrok暴露到公网,并创建知识库、数据库访... 1、在本地搭建数据库访问的服务,并使用ngrok暴露到公网。#sql_tools.pyfrom

使用mvn deploy命令上传jar包的实现

《使用mvndeploy命令上传jar包的实现》本文介绍了使用mvndeploy:deploy-file命令将本地仓库中的JAR包重新发布到Maven私服,文中通过示例代码介绍的非常详细,对大家的学... 目录一、背景二、环境三、配置nexus上传账号四、执行deploy命令上传包1. 首先需要把本地仓中要

Spring Cloud之注册中心Nacos的使用详解

《SpringCloud之注册中心Nacos的使用详解》本文介绍SpringCloudAlibaba中的Nacos组件,对比了Nacos与Eureka的区别,展示了如何在项目中引入SpringClo... 目录Naacos服务注册/服务发现引⼊Spring Cloud Alibaba依赖引入Naco编程s依

Java springBoot初步使用websocket的代码示例

《JavaspringBoot初步使用websocket的代码示例》:本文主要介绍JavaspringBoot初步使用websocket的相关资料,WebSocket是一种实现实时双向通信的协... 目录一、什么是websocket二、依赖坐标地址1.springBoot父级依赖2.springBoot依赖

Java使用Mail构建邮件功能的完整指南

《Java使用Mail构建邮件功能的完整指南》JavaMailAPI是一个功能强大的工具,它可以帮助开发者轻松实现邮件的发送与接收功能,本文将介绍如何使用JavaMail发送和接收邮件,希望对大家有所... 目录1、简述2、主要特点3、发送样例3.1 发送纯文本邮件3.2 发送 html 邮件3.3 发送带

Java实现将byte[]转换为File对象

《Java实现将byte[]转换为File对象》这篇文章将通过一个简单的例子为大家演示Java如何实现byte[]转换为File对象,并将其上传到外部服务器,感兴趣的小伙伴可以跟随小编一起学习一下... 目录前言1. 问题背景2. 环境准备3. 实现步骤3.1 从 URL 获取图片字节数据3.2 将字节数组

使用DeepSeek搭建个人知识库(在笔记本电脑上)

《使用DeepSeek搭建个人知识库(在笔记本电脑上)》本文介绍了如何在笔记本电脑上使用DeepSeek和开源工具搭建个人知识库,通过安装DeepSeek和RAGFlow,并使用CherryStudi... 目录部署环境软件清单安装DeepSeek安装Cherry Studio安装RAGFlow设置知识库总

Python FastAPI入门安装使用

《PythonFastAPI入门安装使用》FastAPI是一个现代、快速的PythonWeb框架,用于构建API,它基于Python3.6+的类型提示特性,使得代码更加简洁且易于绶护,这篇文章主要介... 目录第一节:FastAPI入门一、FastAPI框架介绍什么是ASGI服务(WSGI)二、FastAP

Spring-AOP-ProceedingJoinPoint的使用详解

《Spring-AOP-ProceedingJoinPoint的使用详解》:本文主要介绍Spring-AOP-ProceedingJoinPoint的使用方式,具有很好的参考价值,希望对大家有所帮... 目录ProceedingJoinPoijsnt简介获取环绕通知方法的相关信息1.proceed()2.g

Maven pom.xml文件中build,plugin标签的使用小结

《Mavenpom.xml文件中build,plugin标签的使用小结》本文主要介绍了Mavenpom.xml文件中build,plugin标签的使用小结,文中通过示例代码介绍的非常详细,对大家的学... 目录<build> 标签Plugins插件<build> 标签<build> 标签是 pom.XML