3 ################################################################
5 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 or 3 as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program (see the file COPYING); if not, write to the
18 # Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 ################################################################
24 unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
30 my ($dist, $archs, $configdir, $manifest);
32 $configdir = ($::ENV{'BUILD_DIR'} || '/usr/lib/build') . '/configs';
35 if ($ARGV[0] eq '--dist') {
40 if ($ARGV[0] eq '--archpath') {
45 if ($ARGV[0] eq '--configdir') {
47 $configdir = shift @ARGV;
50 if (@ARGV && $ARGV[0] eq '--manifest') {
52 $manifest = shift @ARGV;
58 die("usage: order [--manifest manifest] cachedir [packages...]\n") unless @ARGV;
59 my $cachedir = shift @ARGV;
60 my $missedpkgfile = shift @ARGV;
63 if ($manifest eq '-') {
67 open(F, '<', $manifest) || die("$manifest: $!\n");
76 my $config = Build::read_config_dist($dist, $archs, $configdir);
83 for my $suf ('rpm', 'deb', 'arch') {
84 next unless -f "$cachedir/$p.$suf";
85 if (! -s "$cachedir/$p.$suf") {
86 $q = {'provides' => [], 'requires' => []}; # package from preinstallimage, no need to order
89 $q = Build::query("$cachedir/$p.$suf", 'filelist' => 1, 'alldeps' => 1, 'addselfprovides' => 1, 'normalizedeps' => 1);
90 die("bad binary: $p.$suf\n") unless $q;
91 push @{$q->{'provides'}}, @{$q->{'filelist'}} if $suf eq 'rpm' && $q->{'filelist'};
92 delete $q->{'filelist'};
96 open(MISS, ">$missedpkgfile");
99 die("binary not found: $p, try to download it again!\n");
104 Build::readdeps($config, undef, \%deps);
105 @p = Build::order($config, @p);