尝试安装根据 RPM 规范文件构建的 RPM 时出现 yum 事务错误

尝试安装根据 RPM 规范文件构建的 RPM 时出现 yum 事务错误

我使用元包来管理多个实验室系统中的软件和常见依赖项,到目前为止,它运行良好。但是,在最近的构建之后,当我尝试安装构建的 RPM 时,每个用于复制文件的 RPM 规范文件指令都会导致 yum 抛出事务检查错误。

构建/安装至 CentOS 7。

RPM 规范文件:

Name:           lab-meta
Url:            http://pkgs.local/EL/7
License:        GPL
Group:          User Interface/Desktops
Version:        1.8.1
Release:        2%{?dist}


Summary:        lab meta package
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source2:    R-update.sh
Source3:    R_labSelectInstall-03.R
Source5:        lab-init.el
Source6:        texlive.sh
Source7:        jabref
Source8:        JabRef-4.3.1.jar
Source9:        JabRef.desktop
Source10:        JabRef_Icon.png
Source11:        yum-update-nightly

Requires:       R, emacs, emacs-ess, texlive-datetime, texlive-ifthenx
Requires:   texlive-relsize, texlive-graphbox
Requires:   jags4, jags4-devel, jags4-debuginfo
Requires:   xfce4-places-plugin
Obsoletes:  jags3, jags3-devel, jags3-debuginfo
Requires:   python34, python-matplotlib, python-matplotlib-doc
Requires:   python-matplotlib-qt4, python-matplotlib-tk, scipy, python34-tools
Requires:   python-pandas, python34-numpy,python34-numpy-f2py
Requires:   numpy, numpy-f2py, pandoc-citeproc
Requires:   pspp, git-lfs 
Requires:   xorg-x11-server-Xvfb, qca-ossl,
Requires:   postgresql-devel,
Requires:   cdo, cdo-debuginfo, chromium
Requires:   chromium, chromium-libs, chromium-libs-media
Requires:   libreoffice-TexMaths, libreoffice-math, libreoffice-nlpsolver
Requires:   libreoffice-librelogo, libreoffice-filters
Requires:    gdal-devel, gdal,  proj-devel, proj-epsg, proj-static, proj-nad

# Required for JabRef 4.3.1:
Requires:    jdk1.8

Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

%define __jar_repack %{nil}

%description
A meta package for the lab systems


%install
rm -rf %{buildroot}
mkdir -p %{buildroot}

mkdir -p %{buildroot}/usr/local/bin
mkdir -p %{buildroot}/etc/cron.daily
install -m 755 %{SOURCE2} %{buildroot}/etc/cron.daily/R-update.sh
install -m 755 %{SOURCE3} %{buildroot}/usr/local/bin/R_labSelectInstall-03.R

# add the yum nightly updater script to cron daily
install -m 755 %{SOURCE11} %{buildroot}/etc/cron.daily/yum-update-nightly

mkdir -p %{buildroot}/usr/share/emacs/site-lisp/site-start.d
install -m 755 %{SOURCE5} %{buildroot}/usr/share/emacs/site-lisp/site-start.d/lab-init.el
mkdir -p %{buildroot}/etc/profile.d
install -m 755 %{SOURCE6} %{buildroot}/etc/profile.d/texlive.sh

# Create the directories and copy files for JabRef 4.3.1
mkdir -p %{buildroot}/usr/share/applications
mkdir -p %{buildroot}/usr/share/icons
install -m 755 %{SOURCE7} %{buildroot}/usr/local/bin/jabref
install -m 755 %{SOURCE8} %{buildroot}/usr/local/bin/JabRef-4.3.1.jar
install -m 755 %{SOURCE9} %{buildroot}/usr/share/applications/JabRef.desktop
install -m 755 %{SOURCE10} %{buildroot}/usr/share/icons/JabRef_Icon.png

%clean
rm -rf %{buildroot}

%post
/sbin/ldconfig
/usr/bin/git lfs install --system
# set Oracle JDK as default
/usr/sbin/alternatives --set java /usr/java/jdk1.8.0_181-amd64/jre/bin/java
R CMD javareconf

%postun -p /sbin/ldconfig


%files 
%defattr(-,root,root,-)
/usr
/etc

这构建得很好,但是当我尝试使用安装生成的 RPM 时,sudo yum install ./lab-meta-1.8.1-2EL7.x86_64.rpm收到以下错误:

Running transaction check
Running transaction test


Transaction check error:
  file /usr/share/emacs from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package emacs-filesystem-1:25.1-2.el7.centos.noarch
  file /usr/share/emacs/site-lisp from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package emacs-filesystem-1:25.1-2.el7.centos.noarch
  file /usr/share/emacs/site-lisp/site-start.d from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package emacs-filesystem-1:25.1-2.el7.centos.noarch
  file /usr/share/emacs/site-lisp from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package emacs-common-1:25.1-2.el7.centos.x86_64
  file /usr/share/emacs/site-lisp/site-start.d from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package emacs-common-1:25.1-2.el7.centos.x86_64
  file /etc from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package createrepo-0.9.9-28.el7.noarch
  file /etc/cron.daily from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package crontabs-1.11-6.20121102git.el7.noarch
  file /usr from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package jdk1.8-2000:1.8.0_181-fcs.x86_64
  file /usr/share/emacs from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package autoconf-2.69-11.el7.noarch
  file /usr/share/emacs/site-lisp from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package autoconf-2.69-11.el7.noarch
  file /etc/profile.d from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package setup-2.8.71-9.el7.noarch
  file /etc from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64
  file /usr from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64
  file /usr/local from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64
  file /usr/local/bin from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64
  file /usr/share from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64
  file /usr/share/applications from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64
  file /usr/share/icons from install of lab-meta-1.8.1-2EL7.x86_64 conflicts with file from package filesystem-3.2-25.el7.x86_64

Error Summary
-------------

显然我无法删除冲突的软件包,因为它们是核心系统软件包。我无法在网上或 SE 上找到任何类似的信息。我确信我只是在某个地方打错了,但我似乎找不到它。任何帮助都将不胜感激!

答案1

当您指定

%files
/usr

您正在打包/usr目录及其所有子目录。您需要更具体地打包真正属于您的包的文件和目录:

%files
/usr/share/emacs/site-lisp
/etc/cron.daily/*

等等...

相关内容