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