diff options
author | Prajwal Mohan <prajwal.karur.mohan@intel.com> | 2012-07-25 15:37:01 -0700 |
---|---|---|
committer | Prajwal Mohan <prajwal.karur.mohan@intel.com> | 2012-07-25 15:37:01 -0700 |
commit | 925443968a5922af051664c3dec9e30fe4921b31 (patch) | |
tree | 1aa77ffe5e0924e954892bd2df27dce4c7af606d | |
parent | 50656b4fc2df2f6f7d3342a1b2570aec5bce5441 (diff) | |
download | rpm-x86-2.0alpha.tar.gz rpm-x86-2.0alpha.tar.bz2 rpm-x86-2.0alpha.zip |
-rw-r--r-- | packaging/baselibs.conf | 2 | ||||
-rw-r--r-- | packaging/binaries_to_prepare | 8 | ||||
-rw-r--r-- | packaging/files_to_ignore | 3 | ||||
-rw-r--r-- | packaging/rpm-x86.changes | 16 | ||||
-rw-r--r-- | packaging/rpm-x86.spec | 306 |
5 files changed, 335 insertions, 0 deletions
diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..657ed9d --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,2 @@ +arch i586 targets armv5tel:arm armv7l:arm armv7hl:arm armv7nhl:arm + diff --git a/packaging/binaries_to_prepare b/packaging/binaries_to_prepare new file mode 100644 index 0000000..4f582aa --- /dev/null +++ b/packaging/binaries_to_prepare @@ -0,0 +1,8 @@ +/bin/rpm +/usr/bin/rpm2cpio +/usr/bin/rpmdb +/usr/bin/rpmquery +/usr/bin/rpmsign +/usr/bin/rpmverify + + diff --git a/packaging/files_to_ignore b/packaging/files_to_ignore new file mode 100644 index 0000000..de35c12 --- /dev/null +++ b/packaging/files_to_ignore @@ -0,0 +1,3 @@ +/usr/share/man +/usr/lib/rpm/debugedit +/var/lib/rpm
\ No newline at end of file diff --git a/packaging/rpm-x86.changes b/packaging/rpm-x86.changes new file mode 100644 index 0000000..467a810 --- /dev/null +++ b/packaging/rpm-x86.changes @@ -0,0 +1,16 @@ +* Sun Apr 24 08:02:35 UTC 2011 - Jan-Simon Möller <jsmoeller@linuxfoundation.org> - 1.0 +- Add baselibs.conf to src.rpm + +* Fri Jan 21 08:13:00 UTC 2011 Carsten Munk <carsten@maemo.org> - 1.0 +- Change ln -s to cp, as 'build' script does a test -x rpmsign from outside the + chroot and this obviously doesn't evaluate correctly. This fixes + build log artifacts such as: + warning: .init_b_cache/kernel-headers.rpm: Header V3 DSA/SHA1 Signature, + key ID 79fc1f8a: NOKEY +- Remove verbose output of scripts + +* Mon Jan 3 21:03:00 UTC 2011 Carsten Munk <carsten@maemo.org> - 1.0 +- Part of BMC#12113 (speedrpm implementation) +- Add armv7hl and armv7nhl support +- Remove /usr/lib/rpm/debugedit in this package, it's part of rpm-build, not rpm +- Initial version on meego.com (based off Jan-Simon Moller's other -x86 packages) diff --git a/packaging/rpm-x86.spec b/packaging/rpm-x86.spec new file mode 100644 index 0000000..3a432bc --- /dev/null +++ b/packaging/rpm-x86.spec @@ -0,0 +1,306 @@ +%define __strip /bin/true +%define _build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.dontuse.rpm +# meta spec file for cross-chroot setup +# +# Copyright (c) 2010 Jan-Simon Möller (jsmoeller@linuxfoundation.org) +# License: GPLv2 + +## README +## +## In this file: +## 1) define name of original package (see oldname) +## +## File binaries_to_prepare: +## 2) fill in the binaries which need to be available to the foreign chroot +## e.g. /bin/bash - this will make a i586 bash available +## + +#\/\/\/\/\/\/\/\/\/\/ +### only changes here +# +# The original package name +%define oldname rpm +# +# The architectures this meta package is built on +%define myexclusive i586 +# +### no changes needed below this line +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + + +### no changes needed +# +# The new package name - convention is %oldname-x86 +%define newname %{oldname}-x86 +# +# The version of the original package is read from its rpm db info +%{expand:%%define newversion %(rpm -q --qf '[%{version}]' %oldname)} +# +# The license of the original package is read from its rpm db info +%{expand:%%define newlicense %(rpm -q --qf '[%{license}]' %oldname)} +# +# The group information of the original package +%{expand:%%define newgroup %(rpm -q --qf '[%{group}]' %oldname)} +# +# The summary of the original package +%{expand:%%define newsummary %(rpm -q --qf '[%{summary} - special version ]' %oldname)} +# +# New rpath to add to files on request +%define newrpath "/emul/ia32-linux/lib:/emul/ia32-linux/usr/lib" +%define newinterpreter /emul/ia32-linux/lib/ld-linux.so.2 +# +# Some automatic checks for availability +# binaries_to_prepare +%define binaries_to_prepare %{expand:%(test -e %{_sourcedir}/binaries_to_prepare && echo 1 || echo 0)} +%define libraries_to_prepare %{expand:%(test -e %{_sourcedir}/libraries_to_prepare && echo 1 || echo 0)} +%define special_script %{expand:%(test -e %{_sourcedir}/special_script && echo 1 || echo 0)} +%define files_to_ignore %{expand:%(test -e %{_sourcedir}/files_to_ignore && echo 1 || echo 0)} +# +### no changes needed below this line +%define nodebug 1 + + +Name: %newname +Version: %newversion +Release: 9 +AutoReqProv: 0 +Provides: %newname +BuildRequires: rpm grep tar patchelf sed -rpmlint-Moblin -rpmlint-mini -post-build-checks +BuildRequires: %oldname +Requires: %oldname +# no auto requirements - they're generated +License: %newlicense +Group: %newgroup +ExclusiveArch: %myexclusive +Summary: Don't use! %newsummary +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if %binaries_to_prepare +Source10: binaries_to_prepare +%endif +%if %libraries_to_prepare +Source20: libraries_to_prepare +%endif +%if %special_script +Source30: special_script +%endif +%if %files_to_ignore +Source40: files_to_ignore +%endif +Source100: baselibs.conf + +%description +This is a meta-package providing %name. +It is not intended to be used on a normal system/device! +Original description: +%{expand:%(rpm -q --qf '[%{description}]' %oldname)} + + + +%prep + +%build + +%install +%if %nodebug +set +x +%endif +mkdir -p %buildroot +rpm -ql %oldname > filestoinclude1 + +# ignore files - construct sed script +sedtmp="sedtmp.$$" +echo "s#^%{_docdir}.*##" >> $sedtmp +echo "s#^%{_mandir}.*##" >> $sedtmp +echo "s#^%{_infodir}.*##" >> $sedtmp + +# evaluate files_to_ignore +%if %files_to_ignore +for i in `cat %{_sourcedir}/files_to_ignore`; do + echo "Ignoring file: $i" + echo "s#^${i}.*##" >> $sedtmp +done + +%endif + +# ignore default filesystem files +for i in `rpm -ql filesystem`; do + echo "s#^${i}\$##" >> $sedtmp +done + +#finish up +echo "/^\$/d" >> $sedtmp + +#execute +sed -f $sedtmp -i filestoinclude1 + +# tar copy to buildroot +tar -T filestoinclude1 -cpf - | ( cd %buildroot && tar -xpf - ) +rm filestoinclude1 + +%if %files_to_ignore +for i in `cat %{_sourcedir}/files_to_ignore`; do + if [ -e %buildroot/$i ]; then + echo "Ignoring file : $i" + rm -f %buildroot/$i + fi +done + +%endif + + +# Todo: refractor +# no directories, in filelist +find %buildroot > filestoinclude2 +cat filestoinclude2 | sed -e "s#%{buildroot}##g" | uniq | sort > filestoinclude1 +for i in `cat filestoinclude1`; do +# no directories + if ! test -d %buildroot/$i ; then + # + echo "$i" >> filestoinclude + fi +done +rm filestoinclude1 +rm filestoinclude2 + +# patchelf the binaries +%if %binaries_to_prepare +echo "" +echo "[ .oO Preparing binaries Oo. ]" +echo "" +mkdir -p %buildroot/%{_prefix}/share/applybinary/ +for binary in `cat %{_sourcedir}/binaries_to_prepare` ; do + echo "Processing binary: $binary" + tmp="tmp.$$" +%if %nodebug + debug= +%else + debug="--debug" +%endif + ldd $binary | grep -v "ld-linux" | grep -v "linux-gate" | sed -e "s#=.*##g" -e "s#^\t*##g" > $tmp + deps=$(for i in `cat $tmp` ; do rpm -q --whatprovides "$i" | grep -v "no package"; done) + cleandeps=$(echo "$cleandeps" "$deps" | sort | uniq | sed -e "s/-[0-9].*//g") + patchelf $debug --set-rpath %newrpath %buildroot/$binary + patchelf $debug --set-interpreter %newinterpreter %buildroot/$binary + patchelf $debug --set-rpath %newrpath %buildroot/$binary + patchelf $debug --set-interpreter %newinterpreter %buildroot/$binary + if test -n "$debug"; then + patchelf --print-rpath %buildroot/$binary + patchelf --print-interpreter %buildroot/$binary + fi + echo "$binary" >> %buildroot/%{_prefix}/share/applybinary/%name + echo "" +done +%endif + +# stub +%if %libraries_to_prepare +echo "" +echo "[ .oO Preparing libraries Oo. ]" +echo "" +%endif + +# stub +%if %special_script +echo "" +echo "[ .oO Executing special script Oo. ]" +echo "" +%endif + +# lets start the shellquote nightmare ;) +shellquote() +{ + for arg; do + arg=${arg//\\/\\\\} +# arg=${arg//\$/\$} # already needs quoting ;( +# arg=${arg/\"/\\\"} # dito +# arg=${arg//\`/\`} # dito + arg=${arg//\\|/\|} + arg=${arg//\\|/|} + echo "$arg" + done +} + + +echo "Creating baselibs_new.conf" +echo "" +rm -rRf /tmp/baselibs_new.conf || true + +shellquote "%{name}" >> /tmp/baselibs_new.conf +shellquote " targettype x86 block!" >> /tmp/baselibs_new.conf +shellquote " targettype 32bit block!" >> /tmp/baselibs_new.conf +shellquote " targettype arm autoreqprov off" >> /tmp/baselibs_new.conf + +# automagically fill in basic requirements +for i in $cleandeps ; do + shellquote " targettype arm requires \"${i}-x86-arm\"" >> /tmp/baselibs_new.conf +done + +# we require the native version +shellquote " targettype arm requires \"%{oldname}\" " >> /tmp/baselibs_new.conf +shellquote " targettype arm prefix /emul/ia32-linux" >> /tmp/baselibs_new.conf +shellquote " targettype arm extension -arm" >> /tmp/baselibs_new.conf +shellquote " targettype arm +/" >> /tmp/baselibs_new.conf + +# safe space and download time +shellquote " targettype arm -/%{_mandir}" >> /tmp/baselibs_new.conf +shellquote " targettype arm -/%{_docdir}" >> /tmp/baselibs_new.conf +shellquote " targettype arm requires \"tizen-accelerator\"" >> /tmp/baselibs_new.conf + +# replace native with x86 binaries as defined in file +%if %binaries_to_prepare +# Todo: error handling if .orig-arm is present +for binary in `cat %{_sourcedir}/binaries_to_prepare` ; do + shellquote " targettype arm post \" if test -e ${binary}.orig-arm; then \" " >> /tmp/baselibs_new.conf + shellquote " targettype arm post \" echo \"${binary}.orig-arm already present - skipping.\" \" " >> /tmp/baselibs_new.conf + shellquote " targettype arm post \" else \" " >> /tmp/baselibs_new.conf + shellquote " targettype arm post \" mv ${binary} ${binary}.orig-arm ; cp <prefix>${binary} ${binary} ; echo ${binary} \"" >> /tmp/baselibs_new.conf + shellquote " targettype arm post \" fi \" " >> /tmp/baselibs_new.conf +done + +# shellquote " targettype arm post \" set -x ; for dbi in Basenames Conflictname Dirnames Group Installtid Name Packages Providename Provideversion Requirename Requireversion Triggername Filedigests Pubkeys Sha1header Sigmd5 Obsoletename __db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 __db.008 __db.009 ; do rm /var/lib/rpm/\$dbi ; touch /var/lib/rpm/\$dbi ; done ; set +x \" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \" set -x; rpm --initdb; rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-tizen; set +x \" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \" set -x; ls /var/lib/rpm; set +x \" " >> /tmp/baselibs_new.conf + +# shellquote " targettype arm post \"# XXX this is klunky and ugly, rpm itself should handle this\" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \"dbstat=/usr/lib/rpm/rpmdb_stat\" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \"if [ -x "\$dbstat" ]; then\" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \" if "\$dbstat" -e -h /var/lib/rpm 2>&1 \| grep -q \"t match environment version\"; then\" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \" file /bin/rpm ; rm -f /var/lib/rpm/__db.* && rpm --rebuilddb \" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \" fi\" " >> /tmp/baselibs_new.conf +# shellquote " targettype arm post \"fi\" " >> /tmp/baselibs_new.conf + + +shellquote " " >> /tmp/baselibs_new.conf +for binary in `cat %{_sourcedir}/binaries_to_prepare` ; do + + shellquote " targettype arm preun \" if test -e ${binary}.orig-arm ; then \"" >> /tmp/baselibs_new.conf + shellquote " targettype arm preun \" rm -f ${binary} ; mv ${binary}.orig-arm ${binary}\"" >> /tmp/baselibs_new.conf + shellquote " targettype arm preun \" fi \"" >> /tmp/baselibs_new.conf + +done +%endif + +cat /tmp/baselibs_new.conf >> %{_sourcedir}/baselibs.conf + +echo "################################################################################" +echo "" +echo "" +echo "REQUIREMENTS:" +grep "requires" %{_sourcedir}/baselibs.conf | sort | uniq | sed -e "s# targettype.*requires ##g" | while read k ; do + echo "CBinstall: $k" +done +echo "Runscripts: %{newname}-arm" +echo "" +echo "" +echo "################################################################################" +set -x + +%clean +rm -rf $RPM_BUILD_ROOT + +%files -f filestoinclude +%defattr(-,root,root) +%if %binaries_to_prepare +/%{_prefix}/share/applybinary/%name +%endif |