Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
openeuler_risc-v-fixing [2024/01/04 03:35] – Add qt5 cmake section misaka00251openeuler_risc-v-fixing [2024/04/03 03:55] (current) – Add noarch misaka00251
Line 2: Line 2:
  
 编写任何文件时,希望各位在文件末尾 add a new line,方便自己和他人,更方便强迫症患者。 编写任何文件时,希望各位在文件末尾 add a new line,方便自己和他人,更方便强迫症患者。
 +
 +===== openEuler 软件包 Patch 补丁编号顺序 =====
 +
 +请参考 oEEP-0012,不过这个 **openEuler 演进提案 Evolution Proposal** 目前还在初始化中,不作为必须要求。
 +
 +  * 所有来自同一版本 upstream 的补丁声明范围为 0001-0999
 +  * 所有架构相关的补丁声明范围为 1000 - 1999
 +  * 预留补丁编号范围 2000 - 2999
 +  * 所有CVE漏洞修复及上游其他版本backport 补丁,声明范围为 3000 - 4999
 +  * 所有 openEuler 特性补丁声明范围为 5000 -
 +
 +其它规定:
 +
 +  * 原则上不按架构分别打补丁,rpm spec 文件中出现 ifarch 宏的,必须在之前一行通过注释的方式明确说明原因和当前技术限制。
 +  * 补丁名称显式说明是否已经被 upstream 接纳,或来自某个特定版本的backport,便于版本升级时处理。
 +  * 原则上新增架构相关代码文件,和修改架构相关代码的补丁应明确分开,不在同一个补丁中既修改代码,又新增文件。
 +  * 对于修改架构相关代码的补丁,一个补丁尽量不要包含太多文件修改,尽量拆分,可使用 split-patch 工具,一个补丁最多包括5个文件修改(暂定)。
 +  * 对于同一个文件的不同架构补丁,原则上按架构相对稳定程度排序,优先应用架构稳定的补丁。不同软件包维护者可根据实际情况选择,但在不同文件的补丁应用中应保持一致。
 +
 ===== yaml ===== ===== yaml =====
  
 建仓的时候除了 spec 文件和源码,一定要包含一个 yaml 文件。如果 ''version_control'' 是 ''git'',那么 ''src_repo'' 就要填写完整的地址。 建仓的时候除了 spec 文件和源码,一定要包含一个 yaml 文件。如果 ''version_control'' 是 ''git'',那么 ''src_repo'' 就要填写完整的地址。
  
-<code yaml>+<file yaml kweathercore.yaml>
 version_control: github version_control: github
 src_repo: KDE/kweathercore src_repo: KDE/kweathercore
 tag_prefix: "^v" tag_prefix: "^v"
 separator: "." separator: "."
-</code>+</file>
  
 ===== upstream 源码包名字跟仓内不一样 ===== ===== upstream 源码包名字跟仓内不一样 =====
Line 25: Line 44:
 目前有宏了,之前没有宏的话需要这样: 目前有宏了,之前没有宏的话需要这样:
  
-<code>+<file spec example.spec>
 %build %build
 mkdir %{_target_platform} mkdir %{_target_platform}
Line 35: Line 54:
 %install %install
 make install/fast DESTDIR=%{buildroot} -C %{_target_platform} make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
-</code>+</file>
  
 ===== 单 part 执行 ===== ===== 单 part 执行 =====
Line 59: Line 78:
 For all: For all:
 rpmbuild -ba --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec rpmbuild -ba --define "_srcdefattr (-.root,root)" --nosignature --short-circuit /home/abuild/rpmbuild/SOURCES/texlive-base.spec
 +</code>
 +
 +==== 安装单 part 执行 ====
 +
 +参考[[这个 bugzilla|https://bugzilla.redhat.com/show_bug.cgi?id=671210]],可以使用 ''--nodeps'' 指令,想要寻找这类包也可以直接使用 ''rpm -Va --nofiles'' 命令:
 +
 +<code bash>
 +# 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%]
 </code> </code>
  
Line 77: Line 115:
 | cmake(Qt5Multimedia) | qt5-qtmultimedia-devel | | cmake(Qt5Multimedia) | qt5-qtmultimedia-devel |
 | cmake(Qt5Svg) | qt5-qtsvg-devel | | cmake(Qt5Svg) | qt5-qtsvg-devel |
 +
 +===== bcond with & without =====
 +
 +openEuler 内没有 "%bcond_with" 这个宏。只有 "%bcond_without"
 +
 +在 RPM spec 文件中,"%bcond_without" 是一个条件宏,用于定义一个默认为打开(on)的构建选项。这个宏的工作方式是,如果在构建包时没有明确指定 "--without <option>",那么这个选项就会被视为打开。这个宏与 "%bcond_with" 相反,"%bcond_with" 定义的是一个默认为关闭(off)的构建选项。
 +
 +以下有一个例子:
 +
 +<file spec example.spec>
 +# 默认没有 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
 +</file>
 +
 +===== expand macro =====
 +
 +<file spec example.spec>
 +%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}
 +</file>
 +
 +===== 碰到 noarch 怎么办 =====
 +
 +如果遇到 "%ifarch" 宏不起作用的情况下,可以先看一下 spec 文件内是否有 "BuildArch: noarch" 这一行。
 +
 +在包为 noarch 的情况下,"%ifarch" 是不起作用的。你可能需要这样的 dirty hack 才行:
 +
 +<file spec example.spec>
 +BuildArch: noarch
 +%if "%{_arch}" == "riscv64"
 +echo "Do Something"
 +%endif
 +</file>