[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensuse-buildservice
Subject:    [opensuse-buildservice] [Patch] obs/build :  allow change of rpmbuilds --target through a macro in p
From:       "Jan-Simon =?utf-8?q?M=C3=B6ller?=" <dl9pf () gmx ! de>
Date:       2009-05-29 12:39:28
Message-ID: 200905291439.28616.dl9pf () gmx ! de
[Download RAW message or body]

Hi !

Please review the attached patch - if there're no objections, i'd like to commit it to svn.

Reasoning:
For the ARM port, we need to be able to set target of the build because in the qemu-usermode environment
this is not what rpmbuild autodetects. With this patch we can use this in the prjconf:

%ifarch armv5el
Changetarget: armv5tel-suse-linux
%endif

%ifarch armv7el
Changetarget: armv7l-suse-linux
%endif

Thus we've flexible with the target and could also adress different subtargets if we differ repo-names.

Another important point is "osc build". The "build" package needs this change, too. Otherwise we'd end 
up with a wrong autodetection when doing a osc build e.g. on a beagleboard. 

I put guards around this code-path to only execute this for ARM.

Best,
Jan-Simon

["build_changetarget.patch" (text/x-diff)]

Index: src/build/getchangetarget
===================================================================
--- src/build/getchangetarget	(Revision 0)
+++ src/build/getchangetarget	(Revision 0)
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
+}
+
+use strict;
+
+use Build;
+
+my ($dist, $archs, $configdir, $debug);
+
+while (@ARGV)  {
+  if ($ARGV[0] eq '--dist') {
+    shift @ARGV;
+    $dist = shift @ARGV;
+    next;
+  }
+  if ($ARGV[0] eq '--archpath') {
+    shift @ARGV;
+    $archs = shift @ARGV;
+    next;
+  }
+  if ($ARGV[0] eq '--configdir') {
+    shift @ARGV;
+    $configdir = shift @ARGV;
+    next;
+  }
+  if ($ARGV[0] eq '--debug') {
+    shift @ARGV;
+    $debug = 1;
+    next;
+  }
+  last;
+}
+
+die("Usage: getchangetargetarch --dist <dist> --archpath <archpath> [--configdir \
<configdir>]\n") if @ARGV; +
+my $cf = Build::read_config_dist($dist, $archs, $configdir);
+exit 0 unless $cf->{'changetarget'};
+my $target = $cf->{'changetarget'};
+$target = defined($target) && $target ne '' ? "$target" : '';
+print "$arch";

Eigenschaftsänderungen: src/build/getchangetarget
___________________________________________________________________
HinzugefĂĽgt: svn:executable
   + *

Index: src/build/Build.pm
===================================================================
--- src/build/Build.pm	(Revision 7456)
+++ src/build/Build.pm	(Arbeitskopie)
@@ -216,6 +216,8 @@
       $config->{'patterntype'} = [ @l ];
     } elsif ($l0 eq 'release:') {
       $config->{'release'} = $l[0];
+    } elsif ($l0 eq 'changetarget:') {
+      $config->{'changetarget'} = join(' ', @l);
     } elsif ($l0 !~ /^[#%]/) {
       warn("unknown keyword in config: $l0\n");
     }
Index: src/build/build
===================================================================
--- src/build/build	(Revision 7456)
+++ src/build/build	(Arbeitskopie)
@@ -62,6 +62,7 @@
 PERSONALITY_SYSCALL=
 INCARNATION=
 DISTURL=
+CHANGETARGET=
 
 export PATH=$BUILD_DIR:/sbin:/usr/sbin:$PATH
 
@@ -1261,6 +1262,14 @@
 	# extract optflags from configuration
 	getoptflags --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath \
"$BUILD_ARCH" ${BUILD_DEBUG:+--debug} > $BUILD_ROOT/root/.rpmrc  test $BUILD_USER = \
abuild && cp -p $BUILD_ROOT/root/.rpmrc $BUILD_ROOT/home/abuild/.rpmrc +	# case arm, \
extract changetarget +	# this is restricted to arm to make sure it doesn't interfere \
with x86 +	buildarchtest=$( echo $BUILD_ARCH | grep -i arm )
+	if [ x"$buildarchtest" != x"" ]; then
+	    echo "changing targetarch" 
+	    CHANGETARGET=$(getchangetarget --dist "$BUILD_DIST" --configdir \
"$BUILD_DIR/configs" --archpath "$BUILD_ARCH" ) +	    echo "NEW TARGET: \
$CHANGETARGET" +	fi
     fi
     if test -f $BUILD_ROOT/.spec.new ; then
 	if ! cmp -s $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE $BUILD_ROOT/.spec.new ; then
@@ -1343,6 +1352,10 @@
 		rpmbopts[${#rpmbopts[@]}]='--eval'
 		rpmbopts[${#rpmbopts[@]}]="%suse_insert_debug_package"
 	fi
+	if [ -n "$CHANGETARGET" ]; then
+		rpmbopts[${#rpmbopts[@]}]='--target'
+		rpmbopts[${#rpmbopts[@]}]="$CHANGETARGET"
+	fi
 	rpmbuild=rpmbuild
 
 	test -x $BUILD_ROOT/usr/bin/rpmbuild || rpmbuild=rpm


-- 
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-buildservice+help@opensuse.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic