Planex 是维护本地 yum 源批量重构的工具,可用于维护第三方源或定制发行版。在某个基础包发生变化时,会按需自动重构所有依赖这个基础包的其它包。
- 预先已经准备好 mock 的环境和用户(下面设为 cheese)
一、安装 planex
- 下载 spec 文件和源码
-
修改 spec 文件两处地方以适配 Fedora 26
- 删除 Requires: python-argparse
- %config%{_sysconfdir}/bash_completion.d/planex.bash 改为 %exclude %{_sysconfdir}/bash_completion.d/planex.bash
- 构建
-
安装 rpm
- sudo dnf install /home/cheese/rpmbuild/RPMS/noarch/planex-2.1.0-1.fc26.noarch.rpm
-
planex 默认使用 createrepo 命令,但 Python 版本的 createrepo 无法正常和 dnf 兼容使用,需要替换使用 createrepo_c
- sudo dnf install createrepo_c
- sudo mv /usr/bin/createrepo_c /usr/bin/createrepo
二、从头创建 planex 项目环境(构建两个 rpm)
-
初始化目录结构
- mkdir buildenv
- cd buildenv
-
planex-init
- 运行之后会创建一个 Makefile 文件
- mkdir SPECS
- ln -s _build/RPMS .
-
根据当前默认 mock root 修改 Makefile
- ls -l /etc/mock/default.cfg
- 因此要修改 Makefile 变成 DIST?=.fc26
- 将下面两个文件分别保存成对应的 spec 文件,放置于 SPECS 目录
Name: perl-Furl Version: 3.03 Release: 1%{?dist} Summary: Lightning-fast URL fetcher License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/Furl/ Source0: http://www.cpan.org/authors/id/T/TO/TOKUHIROM/Furl-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: perl-generators BuildRequires: perl(Class::Accessor::Lite) BuildRequires: perl(Compress::Raw::Zlib) BuildRequires: perl(Encode) BuildRequires: perl(File::Temp) BuildRequires: perl(HTTP::CookieJar) BuildRequires: perl(HTTP::Parser::XS) >= 0.11 BuildRequires: perl(IO::Socket::SSL) BuildRequires: perl(Module::Build) BuildRequires: perl(Mozilla::CA) BuildRequires: perl(Net::IDN::Encode) BuildRequires: perl(Scalar::Util) BuildRequires: perl(Socket) BuildRequires: perl(Test::More) >= 0.96 BuildRequires: perl(Test::Requires) BuildRequires: perl(Test::TCP) >= 1.06 BuildRequires: perl(Time::HiRes) # Required for extra tests BuildRequires: perl(HTTP::Proxy) BuildRequires: perl(IO::Callback) BuildRequires: perl(Starlet) BuildRequires: perl(HTTP::Proxy::HeaderFilter::simple) BuildRequires: perl(Test::Fake::HTTPD) Requires: perl(Class::Accessor::Lite) Requires: perl(Compress::Raw::Zlib) Requires: perl(Encode) Requires: perl(HTTP::CookieJar) Requires: perl(HTTP::Parser::XS) >= 0.11 Requires: perl(IO::Socket::SSL) Requires: perl(Mozilla::CA) Requires: perl(Net::IDN::Encode) Requires: perl(Scalar::Util) Requires: perl(Socket) Requires: perl(Time::HiRes) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description Furl is yet another HTTP client library. LWP is the de facto standard HTTP client for Perl 5, but it is too slow for some critical jobs, and too complex for weekend hacking. Furl resolves these issues. Enjoy it! %prep %setup -q -n Furl-%{version} %build %{__perl} Build.PL installdirs=vendor ./Build %install rm -rf $RPM_BUILD_ROOT ./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %{_fixperms} $RPM_BUILD_ROOT/* %check %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc Changes cpanfile LICENSE META.json README.md TODO %{perl_vendorlib}/* %{_mandir}/man3/* %changelog * Sat Sep 13 2014 Robin Lee <cheeselee@fedoraproject.org> 3.03-1 - Specfile autogenerated by cpanspec 1.78.
Name: perl-IO-Callback Version: 1.12 Release: 1%{?dist} Summary: IO::Callback Perl module License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/IO-Callback/ Source0: http://www.cpan.org/authors/id/T/TO/TOBYINK/IO-Callback-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: perl-interpreter >= 0:5.006 BuildRequires: perl-generators BuildRequires: perl(Carp) BuildRequires: perl(Fatal) BuildRequires: perl(File::Slurp) BuildRequires: perl(File::Temp) BuildRequires: perl(IO::String) BuildRequires: perl(Module::Build) BuildRequires: perl(Test::Exception) BuildRequires: perl(Test::More) BuildRequires: perl(Test::NoWarnings) # required for extra tests #BuildRequires: perl(Pod::Snippets) Requires: perl(Carp) Requires: perl(IO::String) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description "IO::Callback" provides an easy way to produce a phoney read-only filehandle that calls back to your own code when it needs data to satisfy a read. This is useful if you want to use a library module that expects to read data from a filehandle, but you want the data to come from some other source and you don't want to read it all into memory and use IO::String. %prep %setup -q -n IO-Callback-%{version} %build %{__perl} Build.PL installdirs=vendor ./Build %install rm -rf $RPM_BUILD_ROOT ./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %{_fixperms} $RPM_BUILD_ROOT/* %check %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc Changes META.json README %{perl_vendorlib}/* %{_mandir}/man3/* %changelog * Sat Sep 13 2014 Robin Lee <cheeselee@fedoraproject.org> 1.12-1 - Specfile autogenerated by cpanspec 1.78.
- 运行 make,最终 RPMS 目录就是一个 yum 源
三、其它现成 planex 项目环境(都在 XenServer 项目下)
https://github.com/xenserver/xen-api-libs-specs
https://github.com/xenserver/xen-api-base-specs
https://github.com/xenserver/unified-specs
https://github.com/xenserver/buildroot