编写任何文件时,希望各位在文件末尾 add a new line,方便自己和他人,更方便强迫症患者。
请参考 oEEP-0012,不过这个 openEuler 演进提案 Evolution Proposal 目前还在初始化中,不作为必须要求。
其它规定:
建仓的时候除了 spec 文件和源码,一定要包含一个 yaml 文件。如果 version_control
是 git
,那么 src_repo
就要填写完整的地址。
version_control: github src_repo: KDE/kweathercore tag_prefix: "^v" separator: "."
以 aom 包为例:
Source0: https://aomedia.googlesource.com/%{name}/+archive/%{commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz
目前有宏了,之前没有宏的话需要这样:
%build mkdir %{_target_platform} pushd %{_target_platform} %{cmake_kf5} .. popd %make_build -C %{_target_platform} %install make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
su - abuild For prep: rpmbuild -bp --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec For compile: rpmbuild -bc --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec For install: rpmbuild -bi --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec For wrote rpm: rpmbuild -bb --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec For files(but check): rpmbuild -bl --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec For all: rpmbuild -ba --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec
参考https://bugzilla.redhat.com/show_bug.cgi?id=671210,可以使用 –nodeps
指令,想要寻找这类包也可以直接使用 rpm -Va –nofiles
命令:
# rpm -ivh chromedriver-119.0.6045.159-1.oe2309.riscv64.rpm chromium-119.0.6045.159-1.oe2309.riscv64.rpm chromium-common-119.0.6045.159-1.oe2309.riscv64.rpm error: Failed dependencies: rpmlib(ShortCircuited) <= 4.9.0-1 is needed by chromedriver-119.0.6045.159-1.oe2309.riscv64 rpmlib(ShortCircuited) <= 4.9.0-1 is needed by chromium-119.0.6045.159-1.oe2309.riscv64 rpmlib(ShortCircuited) <= 4.9.0-1 is needed by chromium-common-119.0.6045.159-1.oe2309.riscv64 # rpm -ivh chromedriver-119.0.6045.159-1.oe2309.riscv64.rpm chromium-119.0.6045.159-1.oe2309.riscv64.rpm chromium-common-119.0.6045.159-1.oe2309.riscv64.rpm --nodeps Verifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:chromium-common-119.0.6045.159-1.################################# [ 33%] 2:chromedriver-119.0.6045.159-1.oe2################################# [ 67%] 3:chromium-119.0.6045.159-1.oe2309 ################################# [100%]
一些速查
cmake | 包名 |
---|---|
cmake(Qt5Core) | qt5-qtbase-devel |
cmake(Qt5Gui) | |
cmake(Qt5Widgets) | |
cmake(Qt5DBus) | |
cmake(Qt5Xml) | |
cmake(Qt5Test) | |
cmake(Qt5Network) | |
cmake(Qt5Qml) | qt5-qtdeclarative-devel |
cmake(Qt5QuickControls2) | qt5-qtquickcontrols2-devel |
cmake(Qt5Multimedia) | qt5-qtmultimedia-devel |
cmake(Qt5Svg) | qt5-qtsvg-devel |
openEuler 内没有 “%bcond_with” 这个宏。只有 “%bcond_without”。
在 RPM spec 文件中,“%bcond_without” 是一个条件宏,用于定义一个默认为打开(on)的构建选项。这个宏的工作方式是,如果在构建包时没有明确指定 “–without <option>“,那么这个选项就会被视为打开。这个宏与 ”%bcond_with” 相反,“%bcond_with” 定义的是一个默认为关闭(off)的构建选项。
以下有一个例子:
# 默认没有 cuda %bcond_without cuda %global have_cuda 0 # 如果有 cuda 且为以下架构再设置 %if %{without cuda} %ifarch x86_64 aarch64 %global have_cuda 1 %endif %endif # 检查是否为 1 %if %{have_cuda} BuildRequires: cuda-nvcc %endif
%global common_description %{expand: This package provides a set of C++ libraries for multimedia streaming, using using open standard protocols (RTP/RTCP, RTSP, SIP). These libraries can be used to build streaming applications. The libraries can also be used to stream, receive, and process MPEG, H.263+ or JPEG video, and several audio codecs. They can easily be extended to support additional (audio and/or video) codecs, and can also be used to build basic RTSP or SIP clients and servers, and have been used to add streaming support to existing media player applications.} %description %{common_description}
如果遇到 “%ifarch” 宏不起作用的情况下,可以先看一下 spec 文件内是否有 “BuildArch: noarch” 这一行。
在包为 noarch 的情况下,“%ifarch” 是不起作用的。你可能需要这样的 dirty hack 才行:
BuildArch: noarch %if "%{_arch}" == "riscv64" echo "Do Something" %endif