3 # Archlinux support, based on the GSoC work of Nikolay Rysev <mad.f3ka@gmail.com>
5 ################################################################
7 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2 or 3 as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program (see the file COPYING); if not, write to the
20 # Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 ################################################################
26 unshift @INC, ($::ENV{"BUILD_DIR"} || "/usr/lib/build");
36 Getopt::Long::Configure("no_ignore_case");
38 my $cachedir = "/var/cache/build";
42 return $1 if "/$url/" =~ /.*\/([^\/]+)\/os\//;
46 GetOptions("cachedir=s" => \$cachedir) or exit(1);
49 die("$url: not an remote Archlinux repo") unless $url =~ /^(:?ftps?|https?):\/\/([^\/]*)\/?/;
50 my $reponame = getreponame($url);
51 die("could not determine reponame from url $url\n") unless defined $reponame;
52 my $repoid = Digest::MD5::md5_hex($url);
53 my $dir = "$cachedir/$repoid";
54 $url .= '/' unless $url =~ /\/$/;
55 File::Path::mkpath($dir);
56 system("$INC[0]/download", $dir, "$url$reponame.db");
57 Build::Archrepo::parse("$dir/$reponame.db", sub { Build::writedeps(\*STDOUT, $_[0], $url) }, 'addselfprovides' => 1);