Skip to content

Commit

Permalink
- rename 'changetarget' to 'target' in config ('changetarget' still w…
Browse files Browse the repository at this point in the history
…orks)

- rename ABUILD_TARGET_ARCH to ABUILD_TARGET, as the rpm option is just --target
- cleanup changetarget script a bit
  • Loading branch information
mlschroe committed Apr 29, 2010
1 parent 545a315 commit d7e88d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Build.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
15 changes: 7 additions & 8 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CLEAN_BUILD=
SPECFILES=()
SRCDIR=
BUILD_JOBS=
ABUILD_TARGET_ARCH=
ABUILD_TARGET=
CREATE_BASELIBS=
USEUSEDFORBUILD=
LIST_STATE=
Expand Down Expand Up @@ -690,7 +690,7 @@ while test -n "$1"; do
export VERIFY_BUILD_SYSTEM=true
;;
*-target)
ABUILD_TARGET_ARCH="$ARG"
ABUILD_TARGET="$ARG"
shift
;;
*-jobs)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
14 changes: 3 additions & 11 deletions getchangetarget
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use strict;

use Build;

my ($dist, $archs, $configdir, $debug);
my ($dist, $archs, $configdir);

while (@ARGV) {
if ($ARGV[0] eq '--dist') {
Expand All @@ -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'};

0 comments on commit d7e88d1

Please sign in to comment.