使用 --target 时 rpmbuild 因未知原因失败

rpmbuild fails for unknown reason when using --target

我最近将我的开发机器从 Fedora 30 更新到 31,但我仍然需要以 Fedora 30 机器为目标。

我正在尝试使用参数 --target f30 构建 SPEC,但我突然收到 'xargs' 错误...

rpmbuild -bb ~/rpmbuild/SPECS/Project.spec --target f30
Building target platforms: f30
Building for target f30
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.hUazCA
+ umask 022
+ cd /home/matthew/rpmbuild/BUILD
+ cd /home/matthew/rpmbuild/BUILD
+ rm -rf Project-1.9.1
+ /usr/bin/gzip -dc /home/matthew/rpmbuild/SOURCES/Project-1.9.1.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Project-1.9.1
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.TnKydD
+ umask 022
+ cd /home/matthew/rpmbuild/BUILD
+ cd Project-1.9.1
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.GIPsyB
+ umask 022
+ cd /home/matthew/rpmbuild/BUILD
+ '[' '/home/matthew/rpmbuild/BUILDROOT/Project-1.9.1-1.fc31.%{_arch}' '!=' / ']'
+ rm -rf '/home/matthew/rpmbuild/BUILDROOT/Project-1.9.1-1.fc31.%{_arch}'
++ dirname '/home/matthew/rpmbuild/BUILDROOT/Project-1.9.1-1.fc31.%{_arch}'
+ mkdir -p /home/matthew/rpmbuild/BUILDROOT
+ mkdir '/home/matthew/rpmbuild/BUILDROOT/Project-1.9.1-1.fc31.%{_arch}'
+ cd Project-1.9.1
+ mkdir -p '/home/matthew/rpmbuild/BUILDROOT/Project-1.9.1-1.fc31.%{_arch}/opt/Project'
+ cp -a README.md __dump__ __files__ __scripts__ __wheels__ apps dbms dbtools graph.png loc manage.py meta program requirements.txt rgs static veh '/home/matthew/rpmbuild/BUILDROOT/Project-1.9.1-1.fc31.%{_arch}/opt/Project'
+ /usr/lib/rpm/check-buildroot
xargs: invalid number for -P option
Usage: xargs [OPTION]... COMMAND [INITIAL-ARGS]...
Run COMMAND with arguments INITIAL-ARGS and more arguments read from input.

Mandatory and optional arguments to long options are also
mandatory or optional for the corresponding short option.
  -0, --null                   items are separated by a null, not whitespace;
                                 disables quote and backslash processing and
                                 logical EOF processing
  -a, --arg-file=FILE          read arguments from FILE, not standard input
  -d, --delimiter=CHARACTER    items in input stream are separated by CHARACTER,
                                 not by whitespace; disables quote and backslash
                                 processing and logical EOF processing
  -E END                       set logical EOF string; if END occurs as a line
                                 of input, the rest of the input is ignored
                                 (ignored if -0 or -d was specified)
  -e, --eof[=END]              equivalent to -E END if END is specified;
                                 otherwise, there is no end-of-file string
  -I R                         same as --replace=R
  -i, --replace[=R]            replace R in INITIAL-ARGS with names read
                                 from standard input; if R is unspecified,
                                 assume {}
  -L, --max-lines=MAX-LINES    use at most MAX-LINES non-blank input lines per
                                 command line
  -l[MAX-LINES]                similar to -L but defaults to at most one non-
                                 blank input line if MAX-LINES is not specified
  -n, --max-args=MAX-ARGS      use at most MAX-ARGS arguments per command line
  -P, --max-procs=MAX-PROCS    run at most MAX-PROCS processes at a time
  -p, --interactive            prompt before running commands
      --process-slot-var=VAR   set environment variable VAR in child processes
  -r, --no-run-if-empty        if there are no arguments, then do not run COMMAND;
                                 if this option is not given, COMMAND will be
                                 run at least once
  -s, --max-chars=MAX-CHARS    limit length of command line to MAX-CHARS
      --show-limits            show limits on command-line length
  -t, --verbose                print commands before executing them
  -x, --exit                   exit if the size (see -s) is exceeded
      --help                   display this help and exit
      --version                output version information and exit

Report bugs to <bug-findutils@gnu.org>.
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
xargs: invalid number for -P option
Usage: xargs [OPTION]... COMMAND [INITIAL-ARGS]...
Run COMMAND with arguments INITIAL-ARGS and more arguments read from input.

Mandatory and optional arguments to long options are also
mandatory or optional for the corresponding short option.
  -0, --null                   items are separated by a null, not whitespace;
                                 disables quote and backslash processing and
                                 logical EOF processing
  -a, --arg-file=FILE          read arguments from FILE, not standard input
  -d, --delimiter=CHARACTER    items in input stream are separated by CHARACTER,
                                 not by whitespace; disables quote and backslash
                                 processing and logical EOF processing
  -E END                       set logical EOF string; if END occurs as a line
                                 of input, the rest of the input is ignored
                                 (ignored if -0 or -d was specified)
  -e, --eof[=END]              equivalent to -E END if END is specified;
                                 otherwise, there is no end-of-file string
  -I R                         same as --replace=R
  -i, --replace[=R]            replace R in INITIAL-ARGS with names read
                                 from standard input; if R is unspecified,
                                 assume {}
  -L, --max-lines=MAX-LINES    use at most MAX-LINES non-blank input lines per
                                 command line
  -l[MAX-LINES]                similar to -L but defaults to at most one non-
                                 blank input line if MAX-LINES is not specified
  -n, --max-args=MAX-ARGS      use at most MAX-ARGS arguments per command line
  -P, --max-procs=MAX-PROCS    run at most MAX-PROCS processes at a time
  -p, --interactive            prompt before running commands
      --process-slot-var=VAR   set environment variable VAR in child processes
  -r, --no-run-if-empty        if there are no arguments, then do not run COMMAND;
                                 if this option is not given, COMMAND will be
                                 run at least once
  -s, --max-chars=MAX-CHARS    limit length of command line to MAX-CHARS
      --show-limits            show limits on command-line length
  -t, --verbose                print commands before executing them
  -x, --exit                   exit if the size (see -s) is exceeded
      --help                   display this help and exit
      --version                output version information and exit

Report bugs to <bug-findutils@gnu.org>.
error: Bad exit status from /var/tmp/rpm-tmp.GIPsyB (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.GIPsyB (%install)

将非常冗长的 -vv 选项与 'rpmbuild' 一起使用没有提供任何有用的信息。知道问题可能是什么吗?

即使专门针对 f31(平台本身),构建也会失败,但如果不添加默认为 f31 的目标,构建也会成功。

目标选项是针对架构的。甚至只有当你做一些其他低级魔法时才有效。你应该这样做:

rpmbuild -bs ~/rpmbuild/SPECS/Project.spec
# this will produce Project.src.rpm
mock -r fedora-30-x86_64 Project.src.rpm

无论你是在 F30 还是 31 或 CentOS 上都没有关系。