11.2 : BuildRoot tag incorrect

Hi all !
I’ve just added 11.2 repo to my OBS project and I’m having a problem with building.
I make Java applications, which have built fine with 11.1 repositories. Now that I’ve tried the 11.2, I see a little error when the rpm builder collects files. RPM_BUILD_ROOT is not my

BuildRoot: %{_builddir}/%{name}-root 

, instead I get something like if that was interpreted like RPM_BUILD_ROOT=%{_builddir}/%{name}-%{version}-%{rpmbuildnumber}… Which is not possible to access within my ant pre-rpm-build-install task, that uses a /usr/src/packages/BUILD/${name}-root string.
:expressionless:

Hi
For 1120> it uses the BUILDROOT now, for < 1120 it should work fine,
let OBS take care of the build like so;


%if 0%{?suse_version} < 1120
BuildRoot:  %{_tmppath}/%{name}-%{version}-build
%endif

and instead of %clean use

%if 0%{?suse_version} < 1120
%clean
%{__rm} -rf '%{buildroot}'
%endif

You will need to modify to use above…


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.37-0.1-default
up 5 days 19:43, 2 users, load average: 0.38, 0.23, 0.20
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

For 1120> it uses the BUILDROOT now,

thx,but is that possible to define a self build root path for >= 1120, for I’ not able to get the OBS release number within ant scripts, am I?

see how it logs from osc build .spec openSUSE_11.2_non-oss

This is ANT :

<property name="rpm-build-root.dir" location="/usr/src/packages/BUILD/${ant.project.name}-root"/>

    <target name="pre-rpm-build-install" depends="build-jar" description="compile and install into ${rpm-build-root.dir}/usr
/share/games/${ant.project.name}">
        <copy overwrite="true" file="${resources.props.all.dir}/run-${ant.project.name}" tofile="${rpm-build-root.dir}/usr/g
ames/${ant.project.name}">
            <filterset refid="filtertokens"/>
        </copy>
        <exec dir="${dist}" executable="chmod">
            <arg line="a+x '${rpm-build-root.dir}/usr/games/${ant.project.name}'"/>
        </exec>
        <mkdir dir="${rpm-build-root.dir}/usr/share/games/${ant.project.name}"/>
        <copy overwrite="true" todir="${rpm-build-root.dir}/usr/share/games/${ant.project.name}">
            <fileset refid="resources.os.all.jars"/>
            <fileset refid="resources.all.jars"/>
            <fileset refid="installed.files"/>
        </copy>
    </target>

This is .SPEC :

%prep
%setup -q
%build
%ant clean
%ant build-jar
%install
%ant pre-rpm-build-install

then OBS log :

pre-rpm-build-install:
     [copy] Copying 1 file to /usr/src/packages/BUILD/sf3jswing-jxakernel-root/usr/games
    [mkdir] Created dir: /usr/src/packages/BUILD/sf3jswing-jxakernel-root/usr/share/games/sf3jswing-jxakernel
     [copy] Copying 1 file to /usr/src/packages/BUILD/sf3jswing-jxakernel-root/usr/share/games/sf3jswing-jxakernel

BUILD SUCCESSFUL
Total time: 8 seconds
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/packages/BUILD/sf3jswing-jxakernel-1.0.5
+ RPM_BUILD_ROOT=/usr/src/packages/BUILDROOT/sf3jswing-jxakernel-1.0.5-02.i386    
+ export RPM_BUILD_ROOT                          

RPM build errors:
    File not found: /usr/src/packages/BUILDROOT/sf3jswing-jxakernel-1.0.5-02.i386/usr/games/sf3jswing-jxakernel
    File not found: /usr/src/packages/BUILDROOT/sf3jswing-jxakernel-1.0.5-02.i386/usr/share/games/sf3jswing-jxakernel

OH sorry for my oddness, I know how to change the ant code… ain’t no OBS release number…
thank you anyway !
BUILDROOT/sf3jswing-jxakernel-1.0.5-02.i386 => <property name=“rpm-build-root.dir” location="/usr/src/packages/BUILD/${ant.project.name}-${version}-${release}.${unix-arch}"/>

finally, i had to export an environment variable from within the .spec script to get it read with the ant script.

(...)
%if 0%{?suse_version} < 1120
BuildRoot:  %{_builddir}/%{name}-%{version}-%{release}.build
%endif
BuildRequires: java-1_6_0-sun-devel, ant
Requires: java-1_6_0-sun
%prep
%setup -q
%build
%ant clean
%ant build-jar
%install
export MYRPM_BUILDROOT=%{buildroot}
%ant pre-rpm-build-install
%if 0%{?suse_version} < 1120
%clean
%{__rm} -rf '%{buildroot}'
%endif
%ant clean
%files
%defattr(-,root,root)
/usr/games/%name
/usr/share/games/%name/
%changelog

ant :

<property environment="env"/>
<property name="MYRPM_BUILDROOT" value="${env.MYRPM_BUILDROOT}"/>
<property name="rpm-build-root.dir" value="${MYRPM_BUILDROOT}"/>
    
    <target name="pre-rpm-build-install" depends="build-jar" description="compile and install into ${rpm-build-root.dir}/usr/share/games/${ant.project.name}">
        <copy overwrite="true" file="${resources.props.all.dir}/run-${ant.project.name}" tofile="${rpm-build-root.dir}/usr/games/${ant.project.name}">
            <filterset refid="filtertokens"/>
        </copy>
        <exec dir="${dist}" executable="chmod">
            <arg line="a+x '${rpm-build-root.dir}/usr/games/${ant.project.name}'"/>
        </exec>
        <mkdir dir="${rpm-build-root.dir}/usr/share/games/${ant.project.name}"/>
        <copy overwrite="true" todir="${rpm-build-root.dir}/usr/share/games/${ant.project.name}">
            <fileset refid="resources.os.all.jars"/>
            <fileset refid="resources.all.jars"/>
            <fileset refid="installed.files"/>
        </copy> 
    </target>    
    

Thanks for all your help ! rotfl!