- rename 'changetarget' to 'target' in config ('changetarget' still works)
authorMichael Schroeder <mls@suse.de>
Thu, 29 Apr 2010 10:27:10 +0000 (12:27 +0200)
committerMichael Schroeder <mls@suse.de>
Thu, 29 Apr 2010 10:27:10 +0000 (12:27 +0200)
- rename ABUILD_TARGET_ARCH to ABUILD_TARGET, as the rpm option is just --target
- cleanup changetarget script a bit

Build.pm
build
getchangetarget

index 566538f..6072d45 100644 (file)
--- a/Build.pm
+++ b/Build.pm
@@ -216,8 +216,8 @@ sub read_config {
       $config->{'release'} = $l[0];
     } elsif ($l0 eq 'releaseprg:') {
       $config->{'releaseprg'} = $l[0];
-    } elsif ($l0 eq 'changetarget:') {
-      $config->{'changetarget'} = join(' ', @l);
+    } elsif ($l0 eq 'changetarget:' || $l0 eq 'target:') {
+      $config->{'target'} = join(' ', @l);
     } elsif ($l0 !~ /^[#%]/) {
       warn("unknown keyword in config: $l0\n");
     }
diff --git a/build b/build
index 84e6008..be13776 100755 (executable)
--- a/build
+++ b/build
@@ -51,7 +51,7 @@ CLEAN_BUILD=
 SPECFILES=()
 SRCDIR=
 BUILD_JOBS=
-ABUILD_TARGET_ARCH=
+ABUILD_TARGET=
 CREATE_BASELIBS=
 USEUSEDFORBUILD=
 LIST_STATE=
@@ -690,7 +690,7 @@ while test -n "$1"; do
        export VERIFY_BUILD_SYSTEM=true
       ;;
       *-target)
-       ABUILD_TARGET_ARCH="$ARG"
+       ABUILD_TARGET="$ARG"
        shift
       ;;
       *-jobs)
@@ -1626,10 +1626,9 @@ for SPECFILE in "${SPECFILES[@]}" ; do
        # 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
-       if test -z "$ABUILD_TARGET_ARCH"; then
-           chmod a+x $BUILD_DIR/getchangetarget || cleanup_and_exit 1
-           ABUILD_TARGET_ARCH=$(getchangetarget --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" )
-           test -z "$ABUILD_TARGET_ARCH" || echo "changing target arch to $ABUILD_TARGET_ARCH"
+       if test -z "$ABUILD_TARGET"; then
+           ABUILD_TARGET=$(getchangetarget --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" )
+           test -z "$ABUILD_TARGET" || echo "build target is $ABUILD_TARGET"
        fi
     fi
     if test -f $BUILD_ROOT/.spec.new ; then
@@ -1734,8 +1733,8 @@ for SPECFILE in "${SPECFILES[@]}" ; do
 
        # XXX: move _srcdefattr to macro file?
        rpmbopts=("$BUILD_RPM_BUILD_STAGE" "--define" "_srcdefattr (-,root,root)")
-       if [ -n "$ABUILD_TARGET_ARCH" ]; then
-               rpmbopts[${#rpmbopts[@]}]="--target=$ABUILD_TARGET_ARCH"
+       if [ -n "$ABUILD_TARGET" ]; then
+               rpmbopts[${#rpmbopts[@]}]="--target=$ABUILD_TARGET"
        fi
        if [ -n "$DISTURL" ]; then
                rpmbopts[${#rpmbopts[@]}]='--define'
index d3518f9..c9e51a1 100755 (executable)
@@ -8,7 +8,7 @@ use strict;
 
 use Build;
 
-my ($dist, $archs, $configdir, $debug);
+my ($dist, $archs, $configdir);
 
 while (@ARGV)  {
   if ($ARGV[0] eq '--dist') {
@@ -26,18 +26,10 @@ while (@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;
+die("Usage: getchangetarget --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 "$target";
+print "$cf->{'target'}\n" if $cf->{'target'};