Mailinglist Archive: opensuse-kernel (87 mails)

< Previous Next >
[opensuse-kernel] combine shell script and .spec file into one .spec file to do the whole job.
  • From: <doiggl@xxxxxxxxxxxxxxxxxx>
  • Date: Tue, 10 Aug 2010 00:43:26 +1000
  • Message-id: <8d5027fd0a8e6de3fc8fed59b950e8aa@xxxxxxxxxxxxxxxxxxxxxxx>
Hello,
I need help to combine this shell script [1] and .spec file [2]into one
.spec file to do the whole job and run from obs.

Can someone help at joining the two together and list what the new .spec
file would look like.
The reason I ask is I can run the script locally and its builds the rpms
and I want obs to do the building instead.
Here is start when script was run[3]
Here is a copy of the make rpm-pkg .spec file[2]
Here is a sample log of a successful build with a script [4]
I posted on packaging and kernel as this is a but of a mix of both.
Thanks for your help
Cheers Glenn

[1] {shell script this works ok locally}
========================================
version="35"
cd /usr/src
rm -rf linux-2.6.$version linux
cp -v /media/disk/kernel/2.6.$version/final/linux-2.6.$version.tar.bz2 .
rm linux-2.6.35.tar
bunzip2 -v linux-2.6.$version.tar.bz2
tar -xvf linux-2.6.$version.tar
ln -s linux-2.6.$version linux
cp -v /boot/config-$(uname -r) /usr/src/linux-2.6.$version/.config
cd /usr/src/linux
patch -p1 < /patch/reiser4-for-2.6.$version.patch
cp -v /source/new.config /usr/src/linux-2.6.35/.config
make rpm-pkg | tee reiser4enabledkernel.log

[2] {.spec file content part of make rpm-pkg} # cat kernel.spec
===============================================================
Name: kernel
Summary: The Linux Kernel
Version: 2.6.3512desktop
Release: 1
License: GPL
Group: System Environment/Kernel
Vendor: The Linux Community
URL: http://www.kernel.org
Source: kernel-2.6.3512desktop.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
Provides: kernel-2.6.35-12-desktop
%define __spec_install_post /usr/lib/rpm/brp-compress || :
%define debug_package %{nil}

%description
The Linux Kernel, the operating system core itself

%prep
%setup -q

%build
make clean && make %{?_smp_mflags}

%install
%ifarch ia64
mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules
mkdir -p $RPM_BUILD_ROOT/lib/firmware
%else
mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules
mkdir -p $RPM_BUILD_ROOT/lib/firmware
%endif
INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC=
modules_install
%ifarch ia64
cp $KBUILD_IMAGE $RPM_BUILD_ROOT/boot/efi/vmlinuz-2.6.35-12-desktop
ln -s efi/vmlinuz-2.6.35-12-desktop $RPM_BUILD_ROOT/boot/
%else
%ifarch ppc64
cp vmlinux arch/powerpc/boot
cp arch/powerpc/boot/$KBUILD_IMAGE
$RPM_BUILD_ROOT/boot/vmlinuz-2.6.35-12-desktop
%else
cp $KBUILD_IMAGE $RPM_BUILD_ROOT/boot/vmlinuz-2.6.35-12-desktop
%endif
%endif
cp System.map $RPM_BUILD_ROOT/boot/System.map-2.6.35-12-desktop
cp .config $RPM_BUILD_ROOT/boot/config-2.6.35-12-desktop
%ifnarch ppc64
cp vmlinux vmlinux.orig
bzip2 -9 vmlinux
mv vmlinux.bz2 $RPM_BUILD_ROOT/boot/vmlinux-2.6.35-12-desktop.bz2
mv vmlinux.orig vmlinux
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
%dir /lib/modules
/lib/modules/2.6.35-12-desktop
/lib/firmware
/boot/*


[3] {start when script was run}
===============================
/bin/sh /media/disk/src/linux-2.6.35/scripts/package/mkspec >
/media/disk/src/linux-2.6.35/kernel.spec
make clean
set -e; cd ..; ln -sf /media/disk/src/linux-2.6.35 kernel-2.6.3512desktop
/bin/sh /media/disk/src/linux-2.6.35/scripts/setlocalversion
--save-scmversion
set -e; cd ..; tar -cz --exclude SCCS --exclude BitKeeper --exclude .svn
--exclude CVS --exclude .pc --exclude .hg --exclude .git -f
kernel-2.6.3512desktop.tar.gz kernel-2.6.3512desktop/.
set -e; cd ..; rm kernel-2.6.3512desktop
rm -f /media/disk/src/linux-2.6.35/.scmversion
set -e; \
/bin/sh /media/disk/src/linux-2.6.35/scripts/mkversion >
/media/disk/src/linux-2.6.35/.tmp_version
set -e; \
mv -f /media/disk/src/linux-2.6.35/.tmp_version
/media/disk/src/linux-2.6.35/.version
rpmbuild --target x86_64 -ta ../kernel-2.6.3512desktop.tar.gz
Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.pNRVVF
+ umask 022

[4] {content of local compilation}
==================================
https://build.opensuse.org/package/view_file?file=reiser4enabledkernel.log&package=reiser4&project=home%3Adoiggl

--
To unsubscribe, e-mail: opensuse-kernel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-kernel+help@xxxxxxxxxxxx

< Previous Next >