如何创建可重定位的rpm包,不进行编译

问题描述 投票:0回答:2

我正在尝试创建一堆脚本和.png文件的“可重定位RPM”。没有构建/编译。我写的


    Name:       utp
    Version:    1.0
    Release:    1%{?dist}
    Summary:    some summary

    Group:      Applications/Engineering
    License:    Proprietary
    URL:        http://www.example.com
    Source0:    %{name}-%{version}.tgz
    BuildArch:  noarch
    Prefix:     /opt

    %description
    A very nice description

    %prep
    echo "=== prep ... done"

    %setup -n utp
    echo "=== setup ... done"

    # %files -f %{_tmppath}/files.list
    %files

我知道


    medi@medi:~/work> rpm -qi -p rpmbuild/RPMS/noarch/utp-1.0-1.el8.noarch.rpm 
    Name        : utp
    Version     : 1.0
    Release     : 1.el8
    Architecture: noarch
    Install Date: (not installed)
    Group       : Applications/Engineering
    Size        : 0
    License     : Proprietary
    Signature   : (none)
    Source RPM  : utp-1.0-1.el8.src.rpm
    Build Date  : Mon 17 Feb 2020 03:44:00 PM PST
    Build Host  : medi.example.com
    Relocations : /opt 
    URL         : http://www.example.com
    Summary     : some summary
    Description :
    A very nice description

    medi@medi:~/work> rpm -ql -p rpmbuild/RPMS/noarch/utp-1.0-1.el8.noarch.rpm 
    (contains no files)
    medi@medi:~/work> 

最有可能是'%files'问题。我试图指定一个列表(现在已注释掉),但是遇到了以下问题

    Processing files: utp-1.0-1.el8.noarch
    error: Directory not found: /home/medi/work/rpmbuild/BUILDROOT/utp-1.0-1.el8.x86_64/opt/utp
    error: File not found: /home/medi/work/rpmbuild/BUILDROOT/utp-1.0-1.el8.x86_64/opt/utp/utg
    error: File not found: /home/medi/work/rpmbuild/BUILDROOT/utp-1.0-1.el8.x86_64/opt/utp/utg/UserGuide.txt

我的file.list看起来在哪里


    /opt/utp/
    /opt/utp/utg
    /opt/utp/utg/UserGuide.txt
    /opt/utp/utg/install.txt

由于我想使它可重定位(请参见前缀:/ opt),所以我将'/ opt'作为前缀。

总体上,我感到困惑。是的,我确实阅读过该文档,但是我很想念它。

rpm rpmbuild rpm-spec
2个回答
0
投票

您的%build%install节应该仍然存在;一个解压缩您的图像源,另一个将它们复制到buildroot中的最终位置。


0
投票

第一个观察结果,为什么StackOverflow合作如此愚蠢?它说,如果您想添加评论,请编辑您的原始帖子。那是非常糟糕的工作流程(或评论流程)。

回到原始故事,pkg没有内容的原因是因为%file指令为空,并且使用-f时,必须注意文件的位置。经过多次阅读,我发现%file默认情况下会在%{buildroot}中查找文件,因此这种组合解决了它

%install 
cp -r ./* %{buildroot}

%files
/%{name}

所以,现在我有内容了,但是后来遇到了shebang_mangling,我不得不禁用它。

© www.soinside.com 2019 - 2024. All rights reserved.