View previous topic :: View next topic |
Author |
Message |
tipp98 Tux's lil' helper
Joined: 28 Jan 2007 Posts: 113
|
Posted: Wed Jan 02, 2013 4:30 pm Post subject: Using gentoo to build packages for an rpm based distro? |
|
|
I've got a PC that I use to do all my building and I would like to set up an environment to build packages for CentOS.
Since portage can build rpm's and already knows things that would go into a package spec file, it seems logical to use portage to build packages that are not available for that OS.
Has anyone tried this?
I am interested to know what successes or failures people have had. |
|
Back to top |
|
|
floppymaster Developer
Joined: 07 Jul 2010 Posts: 229 Location: Detroit, MI, USA
|
Posted: Wed Jan 02, 2013 5:22 pm Post subject: |
|
|
CentOS uses much older versions of most packages, so building them on an up-to-date Gentoo system isn't going to produce anything useful.
If you are going to build packages for a binary distro, you need to build against the same libc, gcc, etc.
Does portage actually create spec files? I thought it just cpio-ed ${D} and created a dummy rpm wrapper. |
|
Back to top |
|
|
tipp98 Tux's lil' helper
Joined: 28 Jan 2007 Posts: 113
|
Posted: Wed Jan 02, 2013 6:00 pm Post subject: |
|
|
My initial thought was to create a chroot and align those core packages using package.mask/unmask so that all of the deps would be seen by portage. But, on second thought I am trying a bootstrapped centos chroot that I shall attempt to install portage into. I am completely unfamiliar with the portage rpm build feature, you are probably right. But, if I can get a package that will install I will be happy.
Currently I've got 'yum groupinstall "Development Tools"' running. My next step will be to install portage and see where I can go from there. |
|
Back to top |
|
|
srs5694 Guru
Joined: 08 Mar 2004 Posts: 434 Location: Woonsocket, RI
|
Posted: Wed Jan 02, 2013 6:11 pm Post subject: |
|
|
I don't know about emerge integration, but it is possible to build RPMs in Gentoo. The problem is, as floppymaster suggests, that library differences can make some binary RPMs unusable, particularly if the binary relies on very many libraries and/or if the build environment is newer than the target environment. Setting up the target environment and then using chroot to move into it for part of the process may help work around those problems, though.
Another option is to use the OpenSUSE Build Service (OBS). You can either upload your packages to their Web site and let their servers do the building or you can set up an OBS installation locally. (IIRC, they use Xen-based virtual machines to do the work, so it's likely to be a bit of a hassle to set up unless you're already using something similar.) |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9524 Location: beyond the rim
|
Posted: Fri Jan 04, 2013 7:25 am Post subject: |
|
|
The rpm support in portage is very limited, it will basically just put the image directory in an rpm container and add the most basic metadata so the data can be unpacked by rpm. The following is all portage does for the rpm phase:
Code: | __dyn_spec() {
local sources_dir=${T}/rpmbuild/SOURCES
mkdir -p "${sources_dir}"
declare -a tar_args=("${EBUILD}")
[[ -d ${FILESDIR} ]] && tar_args=("${EBUILD}" "${FILESDIR}")
tar czf "${sources_dir}/${PF}.tar.gz" \
"${tar_args[@]}" || \
die "Failed to create base rpm tarball."
cat <<__END1__ > ${PF}.spec
Summary: ${DESCRIPTION}
Name: ${PN}
Version: ${PV}
Release: ${PR}
License: GPL
Group: portage/${CATEGORY}
Source: ${PF}.tar.gz
%description
${DESCRIPTION}
${HOMEPAGE}
%prep
%setup -c
%build
%install
%clean
%files
/
__END1__
}
__dyn_rpm() {
if ! ___eapi_has_prefix_variables; then
local EPREFIX=
fi
cd "${T}" || die "cd failed"
local machine_name=${CHOST%%-*}
local dest_dir=${T}/rpmbuild/RPMS/${machine_name}
addwrite "${RPMDIR}"
__dyn_spec
HOME=${T} \
rpmbuild -bb --clean --rmsource "${PF}.spec" --buildroot "${D}" --target "${CHOST}" || die "Failed to integrate rpm spec file"
install -D "${dest_dir}/${PN}-${PV}-${PR}.${machine_name}.rpm" \
"${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm" || \
die "Failed to move rpm"
} |
I would recommend to not use this for any kind of productive use.
And as others have mentioned, CentOS and Gentoo aren't necessarily compatible when it comes to library versions, init system, filesystem layout, ... |
|
Back to top |
|
|
tipp98 Tux's lil' helper
Joined: 28 Jan 2007 Posts: 113
|
Posted: Tue Jan 08, 2013 12:15 am Post subject: |
|
|
I understand the disclaimers on the rpm's and I think I ran into the CentOS is too old problem. I wrote a script to translate the rpm packages into a portage readable packages.provided file, and all deps are satisfied when I run emerge -av --config-root=/opt/centos6-i686 --root=/opt/centos6-i686 portage. But, when I try to emerge portage from within the chroot I get
Code: | Traceback (most recent call last):
File "/usr/lib/portage/bin/emerge", line 48, in <module>
retval = emerge_main()
File "/usr/lib/portage/pym/_emerge/main.py", line 1021, in emerge_main
gc_locals=locals().clear)
File "/usr/lib/portage/pym/_emerge/actions.py", line 3835, in run_action
display_news_notification(root_config, myopts)
File "/usr/lib/portage/pym/portage/proxy/objectproxy.py", line 31, in __call__
return result(*args, **kwargs)
File "/usr/lib/portage/pym/_emerge/post_emerge.py", line 43, in display_news_notification
news_counts = count_unread_news(portdb, vardb)
File "/usr/lib/portage/pym/portage/news.py", line 386, in count_unread_news
count = manager.getUnreadItems(repo, update=True)
File "/usr/lib/portage/pym/portage/news.py", line 179, in getUnreadItems
unread_lock = lockfile(unread_filename, wantnewlockfile=1)
File "/usr/lib/portage/pym/portage/locks.py", line 116, in lockfile
os.chown(lockfilename, -1, portage_gid)
File "/usr/lib/portage/pym/portage/__init__.py", line 225, in __call__
rval = self._func(*wrapped_args, **wrapped_kwargs)
TypeError: group id must be integer |
I added a print of wrapped_args to see what was being passed ...
Code: | ['/var/lib/gentoo/news/.news-gentoo.unread.portage_lockfile', -1, 250] |
So it seems there is a problem converting 250(unicode I presume) into an integer.
CentOS 6.3 uses python-2.6.6, which is not even in the tree any more and I am guessing portage requires something newer. |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9524 Location: beyond the rim
|
Posted: Wed Jan 09, 2013 9:59 pm Post subject: |
|
|
That error is probably from CentOS not having the same UID/GID setup as Gentoo (250 is the GID of the portage group). If you want to use Portage within a non-Gentoo system you better use a prefix install. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|