4 unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
10 my ($dist, $archs, $configdir, $manifest);
14 if ($ARGV[0] eq '--dist') {
19 if ($ARGV[0] eq '--archpath') {
24 if ($ARGV[0] eq '--configdir') {
26 $configdir = shift @ARGV;
29 if (@ARGV && $ARGV[0] eq '--manifest') {
31 $manifest = shift @ARGV;
37 die("usage: order [--manifest manifest] cachedir [packages...]\n") unless @ARGV;
38 my $cachedir = shift @ARGV;
42 if ($manifest eq '-') {
46 open(F, '<', $manifest) || die("$manifest: $!\n");
55 my $config = Build::read_config_dist($dist, $archs, $configdir);
62 for my $suf ('rpm', 'deb', 'arch') {
63 next unless -f "$cachedir/$p.$suf";
64 $q = Build::query("$cachedir/$p.$suf", 'filelist' => 1, 'alldeps' => 1);
65 die("bad binary: $p.$suf\n") unless $q;
66 push @{$q->{'provides'}}, @{$q->{'filelist'}} if $suf eq 'rpm' && $q->{'filelist'};
67 delete $q->{'filelist'};
70 die("binary not found: $p\n") unless $q;
74 Build::readdeps($config, undef, \%deps);
75 @p = Build::order($config, @p);