Mailinglist Archive: opensuse-buildservice (239 mails)

< Previous Next >
[opensuse-buildservice] [Patch] obs/build : allow change of rpmbuilds --target through a macro in prjconf
  • From: "Jan-Simon Möller" <dl9pf@xxxxxx>
  • Date: Fri, 29 May 2009 14:39:28 +0200
  • Message-id: <200905291439.28616.dl9pf@xxxxxx>
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
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
< Previous Next >
This Thread
  • No further messages