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 = "2.7";
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-".$version."/kde4/",
22 "xfce|sepen@crux.nu|rsync|crux.nu::ports/crux-".$version."/xfce/",
23 "aba|abaumann@yahoo.com|httpup|http://www.andreasbaumann.cc/crux/ports/", #Andreas Baumann
24 "ako|alexko256@gmail.com|httpup|http://ports.ako.serveftp.org/", # Alex Kostrewa
25 "alan|alan+crux@mizrahi.com.ve|httpup|http://www.mizrahi.com.ve/crux/pkgs/",
26 "aubic|ales@hushmail.com|rsync|gleam.dyndns.org::cruxports/",
27 "augustao|augustao@augustao.org|httpup|http://augustao.org/ports/", #Augusto Pereira
28 "bashy|ronny.kornexl@t-online.de|httpup|http://ronny-kornexl.homepage.t-online.de/crux/ports/", #Ronny Kornexl
29 "bdfy|jean@mosk.ru|httpup|http://bdfy.googlecode.com/svn/trunk/", #Ivan Rodionov
30 "captlloyd|captlloyd@gmail.com|httpup|http://lloyd.is.an.evil-genius.net/crux/ports/", #Justin W. Lloyd
31 "chw|chw@tks6.net|httpup|http://iacs.epfl.ch/~winkelma/crux_ports/", # Christoph Winkelmann
32 "cruxpl|sirmacik@crux.org.pl|httpup|http://sirmacik.net/static/download/cruxpl-ports/", # CRUX Poland (Marcin Karpezo)
33 "df|wyatt@prairieturtle.ca|httpup|http://home.cc.umanitoba.ca/~fonsecah/crux/ports/", # Daryl Fonseca-Holt (nthwyatt)
34 #"diederick|diederick@diederickdevries.net|httpup|http://www.diederickdevries.net/repo/", #Diederick de Vries
35 "dokpm0|Kevin@RawFedDogs.net|httpup|http://crux.RawFedDogs.net/", #Kevin Monceaux
36 "e17|pitillo@ono.com|rsync|lokalix.dyndns.org::ports/e17/",
37 "ecarux|kontakt@ecarux.de|httpup|http://ecarux.de/ports/", #Hannes Mayer
38 "falcony|falcony@users.sourceforge.net|httpup|http://falcony.googlecode.com/svn/trunk/falcony/", #Maxim Falcony
39 "fho|holler_f@informatik.haw-hamburg.de|httpup|http://users.informatik.haw-hamburg.de/~holler_f/crux_ports/", # Fabian Holler
40 "flaveur|grim@asu.ntu-kpi.kiev.ua|httpup|http://flaveur.googlecode.com/svn/trunk/ports/", #Oleksiy Khilkevich
41 "f1y|dwanasciegroszy@o2.pl|httpup|http://pierwszeliceum.bedzin.pl:8080/~f1y/httpup/", #Bartosz Sobel
42 "haikob|haiko.brandes@stud.uni-goettingen.de|httpup|http://www.stud.uni-goettingen.de/~s462320/crux/",
43 "haskell|moritz+crux@wzff.de|rsync|rsync.wzff.de::haskell/", #Moritz Wilhelmy's haskell collection
44 "hnc|bile@landofbile.com|httpup|http://www.landofbile.com/crux_ports/", #Antonio SJ Musumeci
45 "jaeger|jaeger@morpheus.net|rsync|morpheus.net::cruxports/", #Matt Housh
46 "jdolan|jasonthomasdolan@yahoo.com|httpup|http://jdolan.dyndns.org/jaydolan/ports/",
47 "jue|jue@jue.li|httpup|http://jue.li/crux/ports/",
48 "jw|jw@smts.ch|httpup|http://jw.smts.ch/files/crux/ports/",
49 "karpunix|sirmacik@gmail.com|httpup|http://download.sirmacik.lin4all.org/crux/ports/", # Marcin Karpezo
50 "kp4|vs@kp4.ru|httpup|http://crux.kp4.ru/", # Vitaly Sinilin
51 "larryn|wawrzek@gmail.com|httpup|http://wawrzek.name/Crux/Ports/",
52 "lennart|devel@lennart.sauerbeck.org|rsync|code-monkey.de::lennarts-crux-ports/", #Lennart Sauerbeck
53 "linoports|benemue@googlemail.com|rsync|karif.server-speed.net::linoports/", #Benedikt Muller
54 "lxde|rotwang@crux.org.pl|httpup|http://crux.org.pl/ports/lxde/", #Bartlomeij Palmowski
55 "malster|clover@mail.nnov.ru|httpup|http://malster.nnov.ru/ports/",
56 "mason|msonderegger@aon.at|httpup|http://www.tip9ug.jp/who/dude/webdir/lunix/CRUX/", #Markus Sonderegger
57 "mhedenskog|mattias@hedenskog.se|httpup|http://magog.se/crux/",
58 "mike_attic|mike@openbunker.org|httpup|http://www.openbunker.org/crux/ports/mike_attic/", #Mikhail Kolesnik
59 "mike|mike@openbunker.org|httpup|http://openbunker.org/crux/ports/mike/", #Mikhail Kolesnik
60 "mono|nymacro@gmail.com|httpup|http://members.optusnet.com.au/dfmarks/crux/mono/",
61 "mruiz|manuel.tienza@gmail.com|httpup|http://www.tienza.es/crux/ports/", #Manuel Tienza
62 "namenlos|richard.poettler@gmail.com|httpup|http://www.sti2.at/~richardp/ports/", #Richard Poettler
63 "nexscrp|jkr@nex.scrapping.cc|httpup|http://nex.scrapping.cc/crux/ports/", #Jonas Kramer
64 "ninuzzo|ant@venus.deis.unical.it|httpup|http://monitor.deis.unical.it/ant/crux/",
65 "nipul|lucas@die.net.au|httpup|http://nipul.die.net.au/ports/", #Lucas Hazel
66 "nthuynh|nthuynh@fastmail.fm|httpup|http://nthuynh.yazzy.org/crux/httpup/",
67 "nym|nymacro@gmail.com|httpup|http://members.optushome.com.au/dfmarks/crux/ports/",
68 "patroclo7|patroclo7@gmail.com|httpup|http://www.patroclo7.org/crux/ports/patroclo7/", #Giorgio Lando
69 "pitillo|pitillo@ono.com|rsync|lokalix.dyndns.org::ports/pitillo/",
70 "predatorfreak|predatorfreak@dcaf-security.org|httpup|http://www.dcaf-security.org/ports/", #Brett Andrew Goulder
71 "prologic|prologic@shortcircuit.net.au|httpup|http://bitbucket.org/prologic/ports/raw/tip/", #James Mills
72 "qba|teoqba@gmail.com|httpup|http://escher.unige.ch/~qba/crux/ports/", #Kuba Kaminski
73 "rehabdoll|fredrik@obra.se|rsync|obra.se::ports/", #Fredrik Rinnest
74 "rho|rho@thinkingspot.ch|httpup|http://www.thinkingspot.ch/crux/ports/",
75 "rk|crux@roeschu.ch|httpup|http://www.roeschu.ch/ports/crux/",
76 "roliveira|crux@roliveira.eu|httpup|http://roliveira.eu/crux/ports/", #Ricardo Oliveira
77 "romster|monster.romster@gmail.com|httpup|http://romster.dyndns.org:8080/linux/ports/crux/romster/", #Danny Rawlins
78 "rotwang|rotwang@crux.org.pl|httpup|http://crux.org.pl/ports/rotwang/", #Bartlomiej Palmowski
79 "rugek|rugek@btcl.de|httpup|http://rugek.dirtyhack.net/crux-ports/rugek/",
80 "schniggie|root@schniggie.de|httpup|http://www.schniggie.de/content/projects/crux/",
81 "sepen|sepen@crux.nu|rsync|sepen.mine.nu::crux/ports/sepen/", #Jose V Beneyto
82 "sgtmcd|sgtmcd@sgtmcd.com|httpup|http://crux.sgtmcd.com/ports/",
83 "shin|shin@sterneck.asia|httpup|http://ports.sterneck.asia/shin/", #Shin Sterneck
84 "singular|arbor@mail.ru|httpup|http://singular.ru/ports/",
85 "slapdash|dave-slapdash@weller-fahy.com|httpup|http://slapdash.caterva.org/", #David J. Weller-Fahy
86 "stdevel|webmaster@stankowic-development.net|httpup|http://crux.stankowic-development.net/", #Christian Stankowic
87 "strw|strawi@googlemail.com|httpup|http://www.gnoedi.org/~straw/crux/ports/",
88 "syl|syl@clyl.net|rsync|rsync.clyl.net::crux/", # Pierre Chaussee
89 "tadzik|tadzikes@gmail.com|httpup|http://mhroczny.abuser.eu/~tadzik/ports/", #Tadeus Sosnierz (irc handle: tadzik)
90 "thenschel|thenschel@henschelsoft.de|httpup|http://www.henschelsoft.de/cruxports/",
91 "thomas|t.mausbach@netcologne.de|httpup|http://www.mausbach.mynetcologne.de/crux/httpup/thomas/",
92 "ticklestix|npardoe@ticklestix.co.uk|httpup|http://www.ticklestix.co.uk/crux/", #Nathan Pardoe
93 "tillb|tillbiedermann@yahoo.de|httpup|http://still2come.net/crux/ports/tillb/", #Till Biedermann
94 "tilman|tilman@code-monkey.de|rsync|crux.nu::ports/crux-master/tilman/",
95 "tsubasa|nickp102@gmail.com|httpup|http://tsubasa.googlecode.com/svn/trunk/tsubasa/", #Sasha Chernyavsky
96 "uhlu|crux@uhlu.com|httpup|http://ports.uhlu.com/repository/",
97 "vico|vico@bicisport.de|httpup|http://vico.kleinplanet.de/files/repo/",
98 "vni|younghead@ukr.net|httpup|http://vni.org.ua/crux/ports/vni/", #Vasylchyshyn Nikolay
99 "wzff|moritz+crux@wzff.de|rsync|barfooze.de::crux/", #Moritz Wilhelmy
100 "xen|syl@clyl.net|rsync|rsync.clyl.net::crux-xen/", # Pierre Chaussee
101 "yhafri|ycrux@club-internet.fr|httpup|http://perso.club-internet.fr/yhafri/crux/",
102 "zh_current|zh@despammed.com|httpup|http://zh.yazzy.org/crux/httpup/current/",
103 "zh_embed|zh@despammed.com|httpup|http://zh.yazzy.org/crux/httpup/embed/",
104 );
105
106 # inactive or unavailable repositories
107 # "a1650g|polachok@gmail.com|httpup|http://koluthcka.ru/fwm/crux/", #Alexander Polakov
108 # "alpa|genki@codeguru.li|httpup|http://www.mobillinux.de/crux/",
109 # "anttinyk|aon@iki.fi|httpup|http://aon.iki.fi/crux-ports/",
110 # "arg|arg@suckless.org|httpup|http://suckless.org/crux/arg/",
111 # "brointhemix|bro@fast-stable-secure.net|httpup|http://fast-stable-secure.net/crux/crux-repo/", #Bart Kos
112 # "buddy|percent20@gmail.com|httpup|http://www.buddylindsey.com/crux/ports/",
113 # "ca|ca256@gmx.net|httpup|http://egge.portland.co.uk/crux/ca/",
114 # "cpwi|ulughbegh@bluebottle.com|httpup|http://www.scmerkezi.org/crux/ports/",
115 # "crux.spb.ru|tzong@crux.spb.ru|httpup|http://crux.spb.ru/ports/",
116 # "viper|viper@hometux.de|httpup|http://hometux.de/crux/ports/",
117 # "dahl|dahl@c64.org|httpup|http://dahl.varnamo.nu/httpup/",
118 # "ea|crux@eckigesauge.de|httpup|http://www.eckigesauge.de/crux/ports/",
119 # "acrux|acrux_it@libero.it|httpup|http://acrux.homelinux.org:8080/crux/repos/",
120 # "danieldk|danieldk@pobox.com|httpup|http://danieldk.org/ports/",
121 # "danm|daniel@danm.de|httpup|http://www.danm.de/ports/",
122 # "dektria|dektria@users.sourceforge.net|httpup|http://dektria.org.ua/CRUX/ports/",
123 # "falcon|raider@behid.net|httpup|http://crux.thunder.homeunix.org/ports/",
124 # "han|han@mijncomputer.nl|httpup|http://www.xs4all.nl/~hanb/software/crux/han/",
125 # "heidi|forum@heidi.linuxpl.com|httpup|http://heidi.linuxpl.com/ports/heidi/",
126 # "j2|jjasghar@gmail.com|httpup|http://tito.homelinux.org/repo/",
127 # "jason|jason5876@gmail.com|httpup|http://74.237.17.82/crux/ports/", #Jason Williams
128 # "jolupa|jolupa@ya.com|httpup|http://www.jolupatech.info/crux/",
129 # "loophole|loophole@morpheus.net|httpup|http://loophole.morpheus.net/linux/ports/",
130 # "mark|mark@borkware.net|httpup|http://borkware.net/crux/ports/",
131 # "monad|arbor@mail.ru|httpup|http://monad.ru/ports/",
132 # "mrks|markus.messmer@googlemail.com|httpup|http://mrks.homelinux.org/ports/", #Markus Messmer
133 # "ndeubert|ndeubert@gmail.com|httpup|http://nd.dyndns.org:81/crux/ports/", #Nick Deubert
134 # "niklas|niklas@ulug.org|httpup|http://www.drummel.net/crux/",
135 # "noneus|noneus@noneus.de|httpup|http://noneus.de/crux-ports/",
136 # "obbl|mo@obbl-net.de|httpup|http://obbl.homeunix.org/~crux/ports/",
137 # "ogg|ogg@linux.se|httpup|http://ogg.kicks-ass.net/crux/ports/",
138 # "pazo|off_pazo@shiba.dk|httpup|http://shiba.dk/pazo/ports/",
139 # "per-olov|teozal@chem.uni.torun.pl|httpup|http://sapho.chem.uni.torun.pl/~teozal/crux/ports/per-olov/",
140 # "phire|michael.auchter@gmail.com|httpup|http://ports.phire.org/",
141 # "phoul|Phoul@bastardoperatorfromhell.org|httpup|http://crux.phoul.phrackattack.net/upload/", #Colin Childs
142 # "pkw|pkw@lupulin.net|httpup|http://lupulin.net/crux/ports/pkw/", #Paul Wisehart
143 # "predatorfreak|predatorfreak@dcaf-security.org|httpup|http://www.dcaf-security.org/ports/",
144 # "prologic|prologic@shortcircuit.net.au|httpup|http://crux.shortcircuit.net.au/ports/",
145 # "radix|luke.hoersten@gmail.com|httpup|http://www.theradixpoint.com/crux/ports/",
146 # "rox|romster@shortcircuit.net.au|rsync|data.shortcircuit.net.au::crux-rox-ports/",
147 # "ruhl|r.uhl@xaipete.de|httpup|http://www.xaipete.de/crux/ports/", #Robert Uhl
148 # "rxi|rxi@westnet.com.au|httpup|http://www.rxi.net.au/crux/rxi/", #Peter Banks
149 # "ryo|ryo.saeba@gmx.de|httpup|http://ryo-saeba.de/crux/ports/",
150 # "scree|jonathanr@bluebottle.com|httpup|http://s89775182.onlinehome.us/scree/ports/",
151 # "sigi|sigi@0x2a.at|httpup|http://crux.0x2a.at/", #Christoph Sieghart
152 # "ssimon|swsimon@gmail.com|httpup|http://lumina.ig3.net/linux/crux/ports/",
153 # "steini|steini@kieselsteini.de|httpup|http://kieselsteini.de/dateien/ports/",
154 # "sten|nick.steeves@shaw.ca|httpup|http://members.shaw.ca/nick.steeves/ports/",
155 # "stsp|stsp@binarchy.net|httpup|http://guerila.com/stsp/crux/ports/",
156 # "syslinx|phil@syslinx.org|httpup|http://www.syslinx.org/crux/ports/",
157 # "uibds|Schick.Johannes@gmail.com|httpup|http://www.stud.uni-karlsruhe.de/~uibds/ports/",
158 # "ukraine|artur@idt.org.ua|httpup|http://crux.org.ua/repo/ukraine",
159 # "wimpress|crux@flexion.plus.com|httpup|http://www.flexion.plus.com/stable/",
160 # "yazicivo|v1lkany@yahoo.com|httpup|http://yazicivo.fateback.com/ports/",
161 # "yom|yom@iaelu.net|httpup|http://iaelu.net:6981/ports/yom/",
162
163 $dsn = 'sqlite:////home/crux/public_html/local/portdb.db';
164
165 # End of configuration ######################################################
166
167 $db =& DB::connect($dsn);
168 if (DB::isError($db)) die("Cannot connect to database");
169 $db->setFetchMode(DB_FETCHMODE_ASSOC);
170
171 # Clean existing entries
172 $sql = "delete from ports";
173 $res = $db->simpleQuery($sql);
174 if (DB::isError($res)) die("Query error (delete)");
175 $sql = "delete from collections";
176 $res = $db->simpleQuery($sql);
177 if (DB::isError($res)) die("Query error (delete)");
178 $sql = "vacuum";
179 $res = $db->simpleQuery($sql);
180 if (DB::isError($res)) die("Query error (delete)");
181
182
183
184 foreach ($collections as $coll) {
185 $ports = getCollection($coll);
186 if ($ports !== FALSE) {
187 storeCollection($coll, $ports);
188 } else {
189 $fields = explode('|', $coll);
190 echo "Errors while retrieving collection ". $fields[0]."\n";
191 }
192 }
193
194 function getCollection($coll) {
195 $fields = explode('|', $coll);
196 switch ($fields[2]) {
197 case "httpup":
198 return getHttpupCollection($coll);
199 break;
200 case "rsync":
201 return getRsyncCollection($coll);
202 break;
203 default:
204 return FALSE;
205 }
206 }
207
208 function getRsyncCollection($coll) {
209 $ports = array();
210 $out = array();
211 $fields = explode('|', $coll);
212 $res = -1;
213 exec("/usr/bin/rsync --list-only $fields[3]", $out, $res);
214 if ($res !== 0)
215 return FALSE;
216 foreach ($out as $line) {
217 if ($line[0] == "d") {
218 $sp = explode(' ', $line);
219 $portname = $sp[count($sp)-1];
220 if ($portname != ".")
221 $ports[] = $portname;
222 }
223 }
224 if (count($ports)>0)
225 return $ports;
226 return FALSE;
227 }
228
229 function getHttpupCollection($coll){
230 $ports = array();
231 $fields = explode('|', $coll);
232 $lines = file($fields[3]."REPO");
233 if ($lines === FALSE)
234 return FALSE;
235 foreach ($lines as $line) {
236 if (substr($line, 0, 2) == "d:") {
237 $ports[] = trim(substr($line,2));
238 }
239 }
240 if (count($ports)>0)
241 return $ports;
242 return FALSE;
243 }
244
245 function storeCollection($coll, $ports) {
246 global $db;
247 $fields = explode('|', $coll);
248 foreach ($ports as $port) {
249 $vals = array($port, $fields[0]);
250 $sth = $db->prepare("insert into ports values (NULL, ?, ?)");
251 $res = $db->execute($sth, $vals);
252 if (DB::isError($res)) die("Query error (port)");
253 }
254 $vals = explode('|', $coll);
255 $sth = $db->prepare("insert into collections values (NULL, ?, ?, ?, ?)");
256 $res = $db->execute($sth, $vals);
257 if (DB::isError($res)) die("Query error (collection)");
258 }
259
260
261
262 ?>
|