1 #!/usr/bin/php
2 <?php
3 require('DB.php');
4 # Collect port info from 3rd-party repositories into a sqlite database
5 # Written by Simone Rota <sip@crux.nu>
6 #
7 # Configuration #############################################################
8 #
9 # Collections: name|Maintainer <email>|type|url
10 # Supported types: httpup, rsync
11
12 $version = "3.0";
13
14 $collections = array (
15 "core|core-ports@crux.nu|rsync|crux.nu::ports/crux-".$version."/core/",
16 "opt|crux@crux.nu|rsync|crux.nu::ports/crux-".$version."/opt/",
17 "xorg|xorg-ports@crux.nu|rsync|crux.nu::ports/crux-".$version."/xorg/",
18 "compat-32|compat-32-ports@crux.nu|rsync|crux.nu::ports/crux-".$version."/compat-32/",
19 "contrib|crux@crux.nu|rsync|crux.nu::ports/crux-".$version."/contrib/",
20 #"gnome|jaeger@morpheus.net|rsync|morpheus.net::gnome/tags/current/", #Matt Housh
21 "kde|alan+crux@mizrahi.com.ve|rsync|crux.nu::ports/crux-2.5/kde/",
22 "kde4|alan+crux@mizrahi.com.ve|rsync|crux.nu::ports/crux-2.8/kde4/",
23 "xfce|sepen@crux.nu|rsync|crux.nu::ports/crux-".$version."/xfce/",
24 "e17|pitillo@ono.com|rsync|crux.nu::ports/crux-".$version."/e17/",
25 "aba|abaumann@yahoo.com|httpup|http://www.andreasbaumann.cc/crux/ports/", #Andreas Baumann
26 "ako|alexko256@gmail.com|httpup|http://ports.ako.serveftp.org/", #Alex Kostrewa
27 "alan|alan+crux@mizrahi.com.ve|httpup|http://www.mizrahi.com.ve/crux/pkgs/",
28 "andrew|hello@andrewrose.co.uk|httpup|http://crux.andrewrose.co.uk/pkgs/", #Andrew Rose
29 "aubic|ales@hushmail.com|httpup|http://crux.org.pl/ports/aubic/",
30 "augustao|augustao@augustao.org|httpup|http://augustao.org/ports/", #Augusto Pereira
31 "bashy|ronny.kornexl@t-online.de|httpup|http://ronny-kornexl.homepage.t-online.de/crux/ports/", #Ronny Kornexl
32 "bdfy|jean@mosk.ru|httpup|http://bdfy.googlecode.com/svn/trunk/", #Ivan Rodionov
33 "captlloyd|captlloyd@gmail.com|httpup|http://lloyd.is.an.evil-genius.net/crux/ports/", #Justin W. Lloyd
34 "chw|chw@tks6.net|httpup|http://iacs.epfl.ch/~winkelma/crux_ports/", # Christoph Winkelmann
35 "crshd|crshd@mail.com|httpup|http://crshd.users.anapnea.net/linux/crux/ports/", #Christian Brassat
36 "cruxab|abaranov.anton@gmail.com|httpup|http://cruxab.comlu.com/crux/ports/", #Anton Baranov
37 "cruxpl|sirmacik@crux.org.pl|httpup|http://sirmacik.net/static/download/cruxpl-ports/", # CRUX Poland (Marcin Karpezo)
38 "df|wyatt@prairieturtle.ca|httpup|http://home.cc.umanitoba.ca/~fonsecah/crux/ports/", # Daryl Fonseca-Holt (nthwyatt)
39 "dokpm0|Kevin@RawFedDogs.net|httpup|http://crux.RawFedDogs.net/", #Kevin Monceaux
40 "ecarux|kontakt@ecarux.de|httpup|http://ecarux.de/ports/", #Hannes Mayer
41 "emulators|nogagplz@gmail.com|httpup|http://crux.ster.so/ports/emulators/", #Neville Phillips (responsible: Danny Rawlinks)
42 "emulators-i686|monster.romster@gmail.com|httpup|http://crux.ster.so/ports/emulators-i686/", #Danny Rawlins
43 "falcony|falcony@users.sourceforge.net|httpup|http://falcony.googlecode.com/svn/trunk/falcony/", #Maxim Falcony
44 "fho|holler_f@informatik.haw-hamburg.de|httpup|http://users.informatik.haw-hamburg.de/~holler_f/crux_ports/", # Fabian Holler
45 "fillo|fillo@fillo.me|httpup|http://cruxports.fillo.me/", # Dimitry (fillo)
46 "flaveur|grim@asu.ntu-kpi.kiev.ua|httpup|http://flaveur.googlecode.com/svn/trunk/ports/", #Oleksiy Khilkevich
47 "f1y|dwanasciegroszy@o2.pl|httpup|http://pierwszeliceum.bedzin.pl:8080/~f1y/httpup/", #Bartosz Sobel
48 "haikob|haiko.brandes@stud.uni-goettingen.de|httpup|http://www.stud.uni-goettingen.de/~s462320/crux/",
49 "haskell|moritz+crux@wzff.de|rsync|rsync.wzff.de::crux-haskell/", #Moritz Wilhelmy's haskell collection
50 "hnc|bile@landofbile.com|httpup|http://www.landofbile.com/crux_ports/", #Antonio SJ Musumeci
51 "jaeger|jaeger@morpheus.net|rsync|morpheus.net::cruxports/", #Matt Housh
52 "jdolan|jasonthomasdolan@yahoo.com|httpup|http://jdolan.dyndns.org/jaydolan/ports/",
53 "joacim|joacim@joac.im|httpup|http://raw.github.com/joacimot/CRUX-Ports/master/", #Joacim Olsen Tangen
54 "joe9|joe9mail@gmail.com|httpup|http://crux.ster.so/ports/joe9/", #Joe M
55 "jue|jue@jue.li|httpup|http://jue.li/crux/ports/",
56 "jw|jw@smts.ch|httpup|http://jw.smts.ch/files/crux/ports/",
57 "karpunix|sirmacik@gmail.com|httpup|http://download.sirmacik.lin4all.org/crux/ports/", # Marcin Karpezo
58 "kp4|vs@kp4.ru|httpup|http://crux.kp4.ru/", # Vitaly Sinilin
59 "larryn|wawrzek@gmail.com|httpup|http://wawrzek.name/Crux/Ports/",
60 "lennart|devel@lennart.sauerbeck.org|rsync|code-monkey.de::lennarts-crux-ports/", #Lennart Sauerbeck
61 "linoports|benemue@googlemail.com|rsync|karif.server-speed.net::linoports/", #Benedikt Muller
62 "lxde|rotwang@crux.org.pl|httpup|http://crux.org.pl/ports/lxde/", #Bartlomeij Palmowski
63 "malster|clover@mail.nnov.ru|httpup|http://malster.nnov.ru/ports/",
64 "mason|msonderegger@aon.at|httpup|http://www.tip9ug.jp/who/dude/webdir/lunix/CRUX/", #Markus Sonderegger
65 "mhedenskog|mattias@hedenskog.se|httpup|http://magog.se/crux/",
66 "mike_attic|mike@openbunker.org|httpup|http://www.openbunker.org/crux/ports/mike_attic/", #Mikhail Kolesnik
67 "mike|mike@openbunker.org|httpup|http://openbunker.org/crux/ports/mike/", #Mikhail Kolesnik
68 "mono|nymacro@gmail.com|httpup|http://members.optusnet.com.au/dfmarks/crux/mono/",
69 "mruiz|manuel.tienza@gmail.com|httpup|http://www.tienza.es/crux/ports/", #Manuel Tienza
70 "namenlos|richard.poettler@gmail.com|httpup|http://www.sti2.at/~richardp/ports/", #Richard Poettler
71 "nexscrp|jkr@nex.scrapping.cc|httpup|http://nex.scrapping.cc/crux/ports/", #Jonas Kramer
72 "niklaswe|niklas@allow.se|rsync|www.allow.se::ports/", #Niklas Wennerstrand
73 "ninuzzo|ant@venus.deis.unical.it|httpup|http://monitor.deis.unical.it/ant/crux/",
74 "nipul|lucas@die.net.au|httpup|http://nipul.die.net.au/ports/", #Lucas Hazel
75 "nogagplz|nogagplz@gmail.com|httpup|http://crux.ster.so/ports/nogagplz/", #Neville Phillips (responsible: Danny Rawlinks)
76 "nyc|nyc@nyc.pp.ua|httpup|http://nyc.pp.ua/prt/", #Svyatoslav Mishyn
77 "nym|nymacro@gmail.com|httpup|http://members.optushome.com.au/dfmarks/crux/ports/",
78 "patroclo7|patroclo7@gmail.com|httpup|http://www.patroclo7.org/crux/ports/patroclo7/", #Giorgio Lando
79 "pitillo|pitillo@ono.com|rsync|lokalix.dyndns.org::ports/pitillo/",
80 "pitman|mad.skipjack@mail.ru|httpup|http://raw.github.com/KonstantinLepa/crux-ports/master/", #Konstantin Lepa
81 "predatorfreak|predatorfreak@dcaf-security.org|httpup|http://www.dcaf-security.org/ports/", #Brett Andrew Goulder
82 "prologic|prologic@shortcircuit.net.au|httpup|http://crux.shortcircuit.net.au/", #James Mills
83 "qba|teoqba@gmail.com|httpup|http://escher.unige.ch/~qba/crux/ports/", #Kuba Kaminski
84 "rehabdoll|fredrik@obra.se|rsync|obra.se::ports/", #Fredrik Rinnest
85 "rho|rho@thinkingspot.ch|httpup|http://www.thinkingspot.ch/crux/ports/",
86 "rines|richard@nespithal.com|httpup|http://crux.richardnespithal.com/", #Richard Nespithal
87 "rk|crux@roeschu.ch|httpup|http://www.roeschu.ch/ports/crux/",
88 "rmull|rmmullen@gmail.com|httpup|http://lug.bu.edu/mirror/crux/ports/", #Ryan Mullen
89 "roliveira|crux@roliveira.eu|httpup|http://roliveira.eu/crux/ports/", #Ricardo Oliveira
90 "romster|monster.romster@gmail.com|httpup|http://crux.ster.so/ports/romster/", #Danny Rawlins
91 "rotwang|rotwang@crux.org.pl|httpup|http://crux.org.pl/ports/rotwang/", #Bartlomiej Palmowski
92 "rugek|rugek@btcl.de|httpup|http://rugek.dirtyhack.net/crux-ports/rugek/",
93 "sepen|sepen@crux.nu|rsync|sepen.it.cx::ports/current/sepen/", #Jose V Beneyto
94 "sgtmcd|sgtmcd@sgtmcd.com|httpup|http://crux.sgtmcd.com/ports/",
95 "shin|shin@sterneck.asia|httpup|http://ports.sterneck.asia/shin/", #Shin Sterneck
96 "singular|arbor@mail.ru|httpup|http://singular.ru/ports/",
97 "slapdash|dave-slapdash@weller-fahy.com|httpup|http://slapdash.caterva.org/", #David J. Weller-Fahy
98 "stdevel|webmaster@stankowic-development.net|httpup|http://crux.stankowic-development.net/", #Christian Stankowic
99 "strw|strawi@googlemail.com|httpup|http://www.gnoedi.org/~straw/crux/ports/",
100 "swhitton|spw@sdf.org|httpup|http://spw.sdf.org/crux/", #Sean Whitton
101 "syl|syl@clyl.net|rsync|rsync.clyl.net::crux/", # Pierre Chaussee
102 "tadzik|tadzikes@gmail.com|httpup|http://mhroczny.abuser.eu/~tadzik/ports/", #Tadeus Sosnierz (irc handle: tadzik)
103 "thenschel|thenschel@henschelsoft.de|httpup|http://www.henschelsoft.de/cruxports/",
104 "ticklestix|npardoe@ticklestix.co.uk|httpup|http://www.ticklestix.co.uk/crux/", #Nathan Pardoe
105 "tillb|tillbiedermann@yahoo.de|httpup|http://still2come.net/crux/ports/tillb/", #Till Biedermann
106 "tilman|tilman@code-monkey.de|rsync|crux.nu::ports/crux-master/tilman/",
107 "timcowchip|timcowchip@gmail.com|httpup|http://crux.ster.so/ports/timcowchip/", #Chris Farrell
108 "tsubasa|nickp102@gmail.com|httpup|http://tsubasa.googlecode.com/svn/trunk/tsubasa/", #Sasha Chernyavsky
109 "uhlu|crux@uhlu.com|httpup|http://ports.uhlu.com/repository/",
110 "vico|vico@bicisport.de|httpup|http://vico.kleinplanet.de/files/repo/",
111 "vni|younghead@ukr.net|httpup|http://vni.org.ua/crux/ports/vni/", #Vasylchyshyn Nikolay
112 "wzff|moritz+crux@wzff.de|rsync|rsync.wzff.de::crux-wzff/", #Moritz Wilhelmy
113 "xen|syl@clyl.net|rsync|rsync.clyl.net::crux-xen/", # Pierre Chaussee
114 "yhafri|ycrux@club-internet.fr|httpup|http://perso.club-internet.fr/yhafri/crux/",
115 );
116
117 $dsn = 'sqlite:////home/crux/public_html/local/portdb.db';
118
119 # End of configuration ######################################################
120
121 $db =& DB::connect($dsn);
122 if (DB::isError($db)) die("Cannot connect to database");
123 $db->setFetchMode(DB_FETCHMODE_ASSOC);
124
125 # Clean existing entries
126 $sql = "delete from ports";
127 $res = $db->simpleQuery($sql);
128 if (DB::isError($res)) die("Query error (delete)");
129 $sql = "delete from collections";
130 $res = $db->simpleQuery($sql);
131 if (DB::isError($res)) die("Query error (delete)");
132 $sql = "vacuum";
133 $res = $db->simpleQuery($sql);
134 if (DB::isError($res)) die("Query error (delete)");
135
136
137
138 foreach ($collections as $coll) {
139 $ports = getCollection($coll);
140 if ($ports !== FALSE) {
141 storeCollection($coll, $ports);
142 } else {
143 $fields = explode('|', $coll);
144 echo "Errors while retrieving collection ". $fields[0]."\n";
145 }
146 }
147
148 function getCollection($coll) {
149 $fields = explode('|', $coll);
150 switch ($fields[2]) {
151 case "httpup":
152 return getHttpupCollection($coll);
153 break;
154 case "rsync":
155 return getRsyncCollection($coll);
156 break;
157 default:
158 return FALSE;
159 }
160 }
161
162 function getRsyncCollection($coll) {
163 $ports = array();
164 $out = array();
165 $fields = explode('|', $coll);
166 $res = -1;
167 exec("/usr/bin/rsync --list-only $fields[3]", $out, $res);
168 if ($res !== 0)
169 return FALSE;
170 foreach ($out as $line) {
171 if ($line[0] == "d") {
172 $sp = explode(' ', $line);
173 $portname = $sp[count($sp)-1];
174 if ($portname != ".")
175 $ports[] = $portname;
176 }
177 }
178 if (count($ports)>0)
179 return $ports;
180 return FALSE;
181 }
182
183 function getHttpupCollection($coll){
184 $ports = array();
185 $fields = explode('|', $coll);
186 $lines = file($fields[3]."REPO");
187 if ($lines === FALSE)
188 return FALSE;
189 foreach ($lines as $line) {
190 if (substr($line, 0, 2) == "d:") {
191 $ports[] = trim(substr($line,2));
192 }
193 }
194 if (count($ports)>0)
195 return $ports;
196 return FALSE;
197 }
198
199 function storeCollection($coll, $ports) {
200 global $db;
201 $fields = explode('|', $coll);
202 foreach ($ports as $port) {
203 $vals = array($port, $fields[0]);
204 $sth = $db->prepare("insert into ports values (NULL, ?, ?)");
205 $res = $db->execute($sth, $vals);
206 if (DB::isError($res)) die("Query error (port)");
207 }
208 $vals = explode('|', $coll);
209 $sth = $db->prepare("insert into collections values (NULL, ?, ?, ?, ?)");
210 $res = $db->execute($sth, $vals);
211 if (DB::isError($res)) die("Query error (collection)");
212 }
213
214
215
216 ?>
|