For building ARM packages, we need to be able to set the 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
'osc build' needs this change, too. Otherwise we'd end up with a wrong autodetection when doing a osc build on real hardware > armv5.
$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");
}
xen.conf \
getmacros \
getoptflags \
+ getchangetarget \
common_functions \
init_buildsystem \
initscript_qemu_vm \
PERSONALITY_SYSCALL=
INCARNATION=
DISTURL=
+CHANGETARGET=
export PATH=$BUILD_DIR:/sbin:/usr/sbin:$PATH
# 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
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
--- /dev/null
+#!/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";