aboutsummaryrefslogtreecommitdiffstats
path: root/rpmgenplatform.in
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-06-26 12:33:08 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-06-26 12:33:08 +0000
commitcf2f39a613e779078c2e94377b68b45bf3199206 (patch)
tree4a22011c5ada628089d9f22ac38769add9a588da /rpmgenplatform.in
parent923107b8174f9bb4605c35f1df14c82745707a01 (diff)
downloadrpm-setup-cf2f39a613e779078c2e94377b68b45bf3199206.tar
rpm-setup-cf2f39a613e779078c2e94377b68b45bf3199206.tar.gz
rpm-setup-cf2f39a613e779078c2e94377b68b45bf3199206.tar.bz2
rpm-setup-cf2f39a613e779078c2e94377b68b45bf3199206.tar.xz
rpm-setup-cf2f39a613e779078c2e94377b68b45bf3199206.zip
- allow to redirect into a file (-o option)
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);