cd /etc/mock
rm default.cfg
ln -s epel-6-x86_64.cfg default.cfg
vim default.cfg
禁用beta回购。启用base和update回购
初始化构建树(/var/lib/mock是默认的)
mock --init
If we were building from SOURCES then this is where we would employ the SPEC file and use mock --buildsrpm . . .. But in this case we go directly to the binary build step:
这将解析构建依赖项并将它们(大约95个包)下载到干净的构建根目录中。然后,它将提取源代码并从所提供的SRPM构建二进制文件,并将其留在/var/lib/mock/epel-6-x86_64/result中;或者在您提供的任何自定义构建根位置和体系结构中。这需要很长时间。这个方案有很多内容;尤其是文档。< / p >
如果一切顺利,那么您应该最终得到一套适合安装的RPM包,以取代发行版版本。这是我最后得到的结果:
ll /var/lib/mock/epel-6-x86_64/result
total 34996
-rw-rw-r--. 1 byrnejb mock 448455 Oct 30 10:09 build.log
-rw-rw-r--. 1 byrnejb mock 52464 Oct 30 10:09 emacs-git2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 47228 Oct 30 10:09 emacs-git2u-el-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 8474478 Oct 30 09:57 git2u-2.5.3-1.ius.el6.src.rpm
-rw-rw-r--. 1 byrnejb mock 8877584 Oct 30 10:09 git2u-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 27284 Oct 30 10:09 git2u-all-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 27800 Oct 30 10:09 git2u-bzr-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 112564 Oct 30 10:09 git2u-cvs-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 436176 Oct 30 10:09 git2u-daemon-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 15858600 Oct 30 10:09 git2u-debuginfo-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 60556 Oct 30 10:09 git2u-email-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 274888 Oct 30 10:09 git2u-gui-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 79176 Oct 30 10:09 git2u-p4-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 483132 Oct 30 10:09 git2u-svn-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 173732 Oct 30 10:09 gitk2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 115692 Oct 30 10:09 gitweb2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 57196 Oct 30 10:09 perl-Git2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 89900 Oct 30 10:09 perl-Git2u-SVN-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 101026 Oct 30 10:09 root.log
-rw-rw-r--. 1 byrnejb mock 980 Oct 30 10:09 state.log
Install using yum or rpm.
You will require git2u-2.5.3-1.ius.el6.x86_64.rpm at a minimum and such additional support packages as it requires (perl-Git2u-2.5.3-1.ius.el6.noarch.rpm) or you desire.
This build has a cyclic dependency: git2u-2.5.3-1.ius.el6.x86_64.rpm depends upon perl-Git2u-2.5.3-1.ius.el6.noarch.rpm and perl-Git2u-2.5.3-1.ius.el6.noarch.rpm depends upon git2u-2.5.3-1.ius.el6.x86_64.rpm. A straight install with rpm will thus fail.
I am including my LocalFile.repo file below as it contains instructions on how to do this and provides the necessary repo file at the same time.
cat /etc/yum.repos.d/LocalFile.repo
# LocalFile.repo
#
# This repo is used with a local filesystem repo.
#
# To use this repo place the rpm package in /root/RPMS/yum.repo/Packages.
# Then run: createrepo --database --update /root/RPMS/yum.repo.
#
# To use:
# yum --enablerepo=localfile [command]
#
# or to use only ONLY this repo, do this:
#
# yum --disablerepo=\* --enablerepo=localfile [command]
[localfile]
baseurl=file:///root/RPMS/yum.repo
name=CentOS-$releasever - Local Filesystem repo
# Before persistently enabling this repo see the priority note below.
enabled=0
gpgcheck=0
# When this repo is enabled all packages in repos with priority>5
# will not be updated even when they have a more recent version.
# Be careful with this.
priority=5
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
export GIT_VERSION=2.6.4
mkdir /root/git
cd /root/git
wget "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz"
tar xvzf "git-${GIT_VERSION}.tar.gz"
cd git-${GIT_VERSION}
make prefix=/usr/local all
make prefix=/usr/local install
yum remove -y git
git --version # should be GIT_VERSION
Add yourself into group mock (you might need to re-login to server after this change):
sudo usermod -a -G mock $USER
Download git
Download git sources:
fedpkg clone -a git && cd git
fedpkg sources
Verify sources:
sha512sum -c sources
Build rpm
Create srmp. Use el6 for RHEL6, el7 for RHEL7.
fedpkg --dist el7 srpm
Build package in mock:
mock -r epel-7-x86_64 git-2.16.0-1.el7.src.rpm
Install latest version of git rpm from /var/lib/mock/epel-7-x86_64/result/. Note, you might need to uninstall existing version of the git from your system first.