revert to old version, use rpm command to query pkgid
[tools/build.git] / gettype
1 #!/usr/bin/perl -w
2
3 BEGIN {
4   unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
5 }
6
7 use strict;
8
9 use Build;
10
11 my ($dist, $archs, $configdir, $debug);
12
13 while (@ARGV)  {
14   if ($ARGV[0] eq '--dist') {
15     shift @ARGV;
16     $dist = shift @ARGV;
17     next;
18   }
19   if ($ARGV[0] eq '--archpath') {
20     shift @ARGV;
21     $archs = shift @ARGV;
22     next;
23   }
24   if ($ARGV[0] eq '--configdir') {
25     shift @ARGV;
26     $configdir = shift @ARGV;
27     next;
28   }
29   last;
30 }
31
32 die("Usage: gettype --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
33
34 my $cf = Build::read_config_dist($dist, $archs, $configdir);
35 exit 0 unless $cf->{'binarytype'};
36 print "$cf->{'binarytype'}\n";