aboutsummaryrefslogtreecommitdiffstats
path: root/rpmgenplatform.in
diff options
context:
space:
mode:
Diffstat (limited to 'rpmgenplatform.in')
-rw-r--r--rpmgenplatform.in16
1 files changed, 15 insertions, 1 deletions
diff --git a/rpmgenplatform.in b/rpmgenplatform.in
index 458ccef..885b526 100644
--- a/rpmgenplatform.in
+++ b/rpmgenplatform.in
@@ -3,6 +3,11 @@
# $Id$
use strict;
use warnings;
+use Getopt::Long;
+
+GetOptions(
+ 'o=s' => \my $output,
+);
my @ALLARCH=qw{
noarch
@@ -14,6 +19,13 @@ my $suffix = '-@RPMCANONVENDOR@-@RPMOS@-gnu';
my $canonarch = $ARGV[0] || `uname -m`;
chomp($canonarch);
+my $houtput;
+if ($output && $output ne '-') {
+ open($houtput, '>', $output) or die "Cannot open `$output': $!\n";
+} else {
+ $houtput = *STDOUT;
+}
+
foreach my $suf ($suffix, $anysuffix) {
my $found = 0;
my %done = ();
@@ -22,6 +34,8 @@ foreach my $suf ($suffix, $anysuffix) {
$found or next;
$done{$arch} and next;
$done{$arch} = 1;
- print "$arch$suf\n";
+ print $houtput "$arch$suf\n";
}
}
+
+close($houtput) if ($houtput);