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