Commit f15c8bf7500a55f66c889d7f82c38898b4829837

Authored by Silvan Calarco
1 parent 5deae1025b
Exists in master

distroquery: improvements in latest packages output

Showing 4 changed files with 284 additions and 125 deletions Side-by-side Diff

... ... @@ -8,7 +8,7 @@
8 8 msgstr ""
9 9 "Project-Id-Version: distromatic 1.4.1\n"
10 10 "Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
11   -"POT-Creation-Date: 2013-10-22 11:52+0200\n"
  11 +"POT-Creation-Date: 2013-10-27 19:23+0100\n"
12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
15 15  
16 16  
17 17  
18 18  
19 19  
20 20  
21 21  
22 22  
23 23  
24 24  
25 25  
26 26  
27 27  
28 28  
29 29  
30 30  
31 31  
32 32  
33 33  
34 34  
35 35  
36 36  
37 37  
38 38  
39 39  
40 40  
41 41  
42 42  
43 43  
44 44  
45 45  
46 46  
47 47  
48 48  
49 49  
50 50  
51 51  
52 52  
... ... @@ -17,165 +17,185 @@
17 17 "Content-Type: text/plain; charset=CHARSET\n"
18 18 "Content-Transfer-Encoding: 8bit\n"
19 19  
20   -#: src/distroquery.c:185
  20 +#: src/distroquery.c:186
21 21 msgid "Source"
22 22 msgstr ""
23 23  
24   -#: src/distroquery.c:271
  24 +#: src/distroquery.c:332
25 25 msgid "Search"
26 26 msgstr ""
27 27  
28   -#: src/distroquery.c:305
  28 +#: src/distroquery.c:366
29 29 msgid "sources"
30 30 msgstr ""
31 31  
32   -#: src/distroquery.c:309
  32 +#: src/distroquery.c:370
33 33 msgid "files"
34 34 msgstr ""
35 35  
36   -#: src/distroquery.c:320
  36 +#: src/distroquery.c:381
37 37 msgid "Search software packages"
38 38 msgstr ""
39 39  
40   -#: src/distroquery.c:369
41   -msgid "current path"
42   -msgstr ""
43   -
44   -#: src/distroquery.c:411
  40 +#: src/distroquery.c:471
45 41 msgid "Provider(s)"
46 42 msgstr ""
47 43  
48   -#: src/distroquery.c:547 src/distroquery.c:870 src/distroquery.c:1138
  44 +#: src/distroquery.c:620 src/distroquery.c:1139 src/distroquery.c:1406
49 45 msgid "Download"
50 46 msgstr ""
51 47  
52   -#: src/distroquery.c:556
  48 +#: src/distroquery.c:629
53 49 msgid "Details"
54 50 msgstr ""
55 51  
56   -#: src/distroquery.c:575 src/distroquery.c:629
  52 +#: src/distroquery.c:648 src/distroquery.c:702
57 53 #, c-format
58 54 msgid "Other results in "
59 55 msgstr ""
60 56  
61   -#: src/distroquery.c:576 src/distroquery.c:630
  57 +#: src/distroquery.c:649 src/distroquery.c:703
62 58 #, c-format
63 59 msgid "Results in"
64 60 msgstr ""
65 61  
66   -#: src/distroquery.c:579 src/distroquery.c:633
  62 +#: src/distroquery.c:652 src/distroquery.c:706
67 63 msgid "for arch "
68 64 msgstr ""
69 65  
70   -#: src/distroquery.c:594 src/distroquery.c:605
  66 +#: src/distroquery.c:667 src/distroquery.c:678
71 67 msgid "provides"
72 68 msgstr ""
73 69  
74   -#: src/distroquery.c:646
  70 +#: src/distroquery.c:719
75 71 msgid "provides directory"
76 72 msgstr ""
77 73  
78   -#: src/distroquery.c:648
  74 +#: src/distroquery.c:721
79 75 msgid "provides symbolic link"
80 76 msgstr ""
81 77  
82   -#: src/distroquery.c:650
  78 +#: src/distroquery.c:723
83 79 msgid "provides file"
84 80 msgstr ""
85 81  
86   -#: src/distroquery.c:738
  82 +#: src/distroquery.c:811
87 83 msgid "result(s) shown"
88 84 msgstr ""
89 85  
90   -#: src/distroquery.c:740
  86 +#: src/distroquery.c:813
91 87 msgid "result(s) found"
92 88 msgstr ""
93 89  
94   -#: src/distroquery.c:762
  90 +#: src/distroquery.c:835
95 91 msgid "Search results for"
96 92 msgstr ""
97 93  
98   -#: src/distroquery.c:835 src/distroquery.c:1100
  94 +#: src/distroquery.c:909
  95 +msgid "Updates"
  96 +msgstr ""
  97 +
  98 +#: src/distroquery.c:926
  99 +msgid "Has older version than upstream package in"
  100 +msgstr ""
  101 +
  102 +#: src/distroquery.c:936
  103 +msgid "Has same version as upstream package in"
  104 +msgstr ""
  105 +
  106 +#: src/distroquery.c:957
  107 +msgid "Packages for"
  108 +msgstr ""
  109 +
  110 +#: src/distroquery.c:974
  111 +msgid "Needs port to"
  112 +msgstr ""
  113 +
  114 +#: src/distroquery.c:983
  115 +msgid "Latest changes:"
  116 +msgstr ""
  117 +
  118 +#: src/distroquery.c:1104 src/distroquery.c:1368
99 119 msgid "Version"
100 120 msgstr ""
101 121  
102   -#: src/distroquery.c:840
  122 +#: src/distroquery.c:1109
103 123 msgid "Size"
104 124 msgstr ""
105 125  
106   -#: src/distroquery.c:843
  126 +#: src/distroquery.c:1112
107 127 msgid "Related packages"
108 128 msgstr ""
109 129  
110   -#: src/distroquery.c:872 src/distroquery.c:1140
  130 +#: src/distroquery.c:1141 src/distroquery.c:1408
111 131 msgid "Developers details"
112 132 msgstr ""
113 133  
114   -#: src/distroquery.c:874
  134 +#: src/distroquery.c:1143
115 135 msgid "Source package"
116 136 msgstr ""
117 137  
118   -#: src/distroquery.c:884 src/distroquery.c:886
  138 +#: src/distroquery.c:1153 src/distroquery.c:1155
119 139 msgid "Specfile"
120 140 msgstr ""
121 141  
122   -#: src/distroquery.c:889 src/distroquery.c:1142
  142 +#: src/distroquery.c:1158 src/distroquery.c:1410
123 143 msgid "Maintainer"
124 144 msgstr ""
125 145  
126   -#: src/distroquery.c:890 src/distroquery.c:1143
  146 +#: src/distroquery.c:1159 src/distroquery.c:1411
127 147 msgid "Build date"
128 148 msgstr ""
129 149  
130   -#: src/distroquery.c:900
  150 +#: src/distroquery.c:1169
131 151 msgid "Obsoletes"
132 152 msgstr ""
133 153  
134   -#: src/distroquery.c:918
  154 +#: src/distroquery.c:1187
135 155 msgid "Provides"
136 156 msgstr ""
137 157  
138   -#: src/distroquery.c:936
  158 +#: src/distroquery.c:1205
139 159 msgid "Requires"
140 160 msgstr ""
141 161  
142   -#: src/distroquery.c:967
  162 +#: src/distroquery.c:1239
143 163 msgid "Required in"
144 164 msgstr ""
145 165  
146   -#: src/distroquery.c:967 src/distroquery.c:1004
  166 +#: src/distroquery.c:1239 src/distroquery.c:1275
147 167 msgid "by"
148 168 msgstr ""
149 169  
150   -#: src/distroquery.c:974 src/distroquery.c:1010
  170 +#: src/distroquery.c:1246 src/distroquery.c:1281
151 171 msgid "requires"
152 172 msgstr ""
153 173  
154   -#: src/distroquery.c:1004
  174 +#: src/distroquery.c:1275
155 175 msgid "Build required in"
156 176 msgstr ""
157 177  
158   -#: src/distroquery.c:1023
  178 +#: src/distroquery.c:1294
159 179 msgid "Files list"
160 180 msgstr ""
161 181  
162   -#: src/distroquery.c:1107
  182 +#: src/distroquery.c:1375
163 183 msgid "Built packages"
164 184 msgstr ""
165 185  
166   -#: src/distroquery.c:1146
  186 +#: src/distroquery.c:1414
167 187 msgid "Source files"
168 188 msgstr ""
169 189  
170   -#: src/distroquery.c:1156
  190 +#: src/distroquery.c:1424
171 191 msgid "Patches"
172 192 msgstr ""
173 193  
174   -#: src/distroquery.c:1167
  194 +#: src/distroquery.c:1435
175 195 msgid "Build requirements"
176 196 msgstr ""
177 197  
178   -#: src/distroquery.c:1181
  198 +#: src/distroquery.c:1449
179 199 msgid "Changelog"
180 200 msgstr ""
No preview for this file type
... ... @@ -7,175 +7,198 @@
7 7 msgstr ""
8 8 "Project-Id-Version: distromatic 1.4.1\n"
9 9 "Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
10   -"POT-Creation-Date: 2013-10-22 11:52+0200\n"
  10 +"POT-Creation-Date: 2013-10-27 19:23+0100\n"
11 11 "PO-Revision-Date: 2013-10-14 01:19+0200\n"
12 12 "Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
13 13 "Language-Team: Italian\n"
14 14 "Language: it\n"
15 15 "MIME-Version: 1.0\n"
16   -"Content-Type: text/plain; charset=ASCII\n"
  16 +"Content-Type: text/plain; charset=UTF-8\n"
17 17 "Content-Transfer-Encoding: 8bit\n"
18 18 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19 19  
20   -#: src/distroquery.c:185
  20 +#: src/distroquery.c:186
21 21 msgid "Source"
22 22 msgstr "Sorgente"
23 23  
24   -#: src/distroquery.c:271
  24 +#: src/distroquery.c:332
25 25 msgid "Search"
26 26 msgstr "Cerca"
27 27  
28   -#: src/distroquery.c:305
  28 +#: src/distroquery.c:366
29 29 msgid "sources"
30 30 msgstr "sorgenti"
31 31  
32   -#: src/distroquery.c:309
  32 +#: src/distroquery.c:370
33 33 msgid "files"
34 34 msgstr "file"
35 35  
36   -#: src/distroquery.c:320
  36 +#: src/distroquery.c:381
37 37 msgid "Search software packages"
38 38 msgstr "Cerca pacchetti software"
39 39  
40   -#: src/distroquery.c:369
41   -msgid "current path"
42   -msgstr "percorso corrente"
43   -
44   -#: src/distroquery.c:411
  40 +#: src/distroquery.c:471
45 41 msgid "Provider(s)"
46 42 msgstr "Fornito da"
47 43  
48   -#: src/distroquery.c:547 src/distroquery.c:870 src/distroquery.c:1138
  44 +#: src/distroquery.c:620 src/distroquery.c:1139 src/distroquery.c:1406
49 45 msgid "Download"
50 46 msgstr "Scarica"
51 47  
52   -#: src/distroquery.c:556
  48 +#: src/distroquery.c:629
53 49 msgid "Details"
54 50 msgstr "Dettagli"
55 51  
56   -#: src/distroquery.c:575 src/distroquery.c:629
  52 +#: src/distroquery.c:648 src/distroquery.c:702
57 53 #, c-format
58 54 msgid "Other results in "
59 55 msgstr "Altri risultati in "
60 56  
61   -#: src/distroquery.c:576 src/distroquery.c:630
  57 +#: src/distroquery.c:649 src/distroquery.c:703
62 58 #, c-format
63 59 msgid "Results in"
64 60 msgstr "Risultati in"
65 61  
66   -#: src/distroquery.c:579 src/distroquery.c:633
  62 +#: src/distroquery.c:652 src/distroquery.c:706
67 63 msgid "for arch "
68 64 msgstr "per l'architettura "
69 65  
70   -#: src/distroquery.c:594 src/distroquery.c:605
  66 +#: src/distroquery.c:667 src/distroquery.c:678
71 67 msgid "provides"
72 68 msgstr "fornisce"
73 69  
74   -#: src/distroquery.c:646
  70 +#: src/distroquery.c:719
75 71 msgid "provides directory"
76 72 msgstr "fornisce la cartella"
77 73  
78   -#: src/distroquery.c:648
  74 +#: src/distroquery.c:721
79 75 msgid "provides symbolic link"
80 76 msgstr "fornisce il link simbolico"
81 77  
82   -#: src/distroquery.c:650
  78 +#: src/distroquery.c:723
83 79 msgid "provides file"
84 80 msgstr "fornisce il file"
85 81  
86   -#: src/distroquery.c:738
  82 +#: src/distroquery.c:811
87 83 msgid "result(s) shown"
88 84 msgstr "risultati mostrati"
89 85  
90   -#: src/distroquery.c:740
  86 +#: src/distroquery.c:813
91 87 msgid "result(s) found"
92 88 msgstr "risultati trovati"
93 89  
94   -#: src/distroquery.c:762
  90 +#: src/distroquery.c:835
95 91 msgid "Search results for"
96 92 msgstr "Risultati della ricerca per"
97 93  
98   -#: src/distroquery.c:835 src/distroquery.c:1100
  94 +#: src/distroquery.c:909
  95 +msgid "Updates"
  96 +msgstr "Aggiorna"
  97 +
  98 +#: src/distroquery.c:926
  99 +msgid "Has older version than upstream package in"
  100 +msgstr "Ha una versione più vecchia del pacchetto corrente in"
  101 +
  102 +#: src/distroquery.c:936
  103 +msgid "Has same version as upstream package in"
  104 +msgstr "Ha la stessa versione del pacchetto corrente in"
  105 +
  106 +#: src/distroquery.c:957
  107 +msgid "Packages for"
  108 +msgstr "Pacchetti per"
  109 +
  110 +#: src/distroquery.c:974
  111 +msgid "Needs port to"
  112 +msgstr "Richiede il porting per"
  113 +
  114 +#: src/distroquery.c:983
  115 +msgid "Latest changes:"
  116 +msgstr "Modifiche recenti:"
  117 +
  118 +#: src/distroquery.c:1104 src/distroquery.c:1368
99 119 msgid "Version"
100 120 msgstr "Versione"
101 121  
102   -#: src/distroquery.c:840
  122 +#: src/distroquery.c:1109
103 123 msgid "Size"
104 124 msgstr "Dimensione"
105 125  
106   -#: src/distroquery.c:843
  126 +#: src/distroquery.c:1112
107 127 msgid "Related packages"
108 128 msgstr "Pacchetti collegati"
109 129  
110   -#: src/distroquery.c:872 src/distroquery.c:1140
  130 +#: src/distroquery.c:1141 src/distroquery.c:1408
111 131 msgid "Developers details"
112 132 msgstr "Dettagli per gli sviluppatori"
113 133  
114   -#: src/distroquery.c:874
  134 +#: src/distroquery.c:1143
115 135 msgid "Source package"
116 136 msgstr "Pacchetto sorgente"
117 137  
118   -#: src/distroquery.c:884 src/distroquery.c:886
  138 +#: src/distroquery.c:1153 src/distroquery.c:1155
119 139 msgid "Specfile"
120 140 msgstr "Specfile"
121 141  
122   -#: src/distroquery.c:889 src/distroquery.c:1142
  142 +#: src/distroquery.c:1158 src/distroquery.c:1410
123 143 msgid "Maintainer"
124 144 msgstr "Manutentore"
125 145  
126   -#: src/distroquery.c:890 src/distroquery.c:1143
  146 +#: src/distroquery.c:1159 src/distroquery.c:1411
127 147 msgid "Build date"
128 148 msgstr "Data di compilazione"
129 149  
130   -#: src/distroquery.c:900
  150 +#: src/distroquery.c:1169
131 151 msgid "Obsoletes"
132 152 msgstr "Rende obsoleti"
133 153  
134   -#: src/distroquery.c:918
  154 +#: src/distroquery.c:1187
135 155 msgid "Provides"
136 156 msgstr "Fornisce"
137 157  
138   -#: src/distroquery.c:936
  158 +#: src/distroquery.c:1205
139 159 msgid "Requires"
140 160 msgstr "Richiede"
141 161  
142   -#: src/distroquery.c:967
  162 +#: src/distroquery.c:1239
143 163 msgid "Required in"
144 164 msgstr "Richiesto in"
145 165  
146   -#: src/distroquery.c:967 src/distroquery.c:1004
  166 +#: src/distroquery.c:1239 src/distroquery.c:1275
147 167 msgid "by"
148 168 msgstr "da"
149 169  
150   -#: src/distroquery.c:974 src/distroquery.c:1010
  170 +#: src/distroquery.c:1246 src/distroquery.c:1281
151 171 msgid "requires"
152 172 msgstr "richiede"
153 173  
154   -#: src/distroquery.c:1004
  174 +#: src/distroquery.c:1275
155 175 msgid "Build required in"
156 176 msgstr "Richiesto per la compilazione in"
157 177  
158   -#: src/distroquery.c:1023
  178 +#: src/distroquery.c:1294
159 179 msgid "Files list"
160 180 msgstr "Lista dei file"
161 181  
162   -#: src/distroquery.c:1107
  182 +#: src/distroquery.c:1375
163 183 msgid "Built packages"
164 184 msgstr "Pacchetti compilati"
165 185  
166   -#: src/distroquery.c:1146
  186 +#: src/distroquery.c:1414
167 187 msgid "Source files"
168 188 msgstr "File sorgenti"
169 189  
170   -#: src/distroquery.c:1156
  190 +#: src/distroquery.c:1424
171 191 msgid "Patches"
172 192 msgstr "Patch"
173 193  
174   -#: src/distroquery.c:1167
  194 +#: src/distroquery.c:1435
175 195 msgid "Build requirements"
176 196 msgstr "Requisiti per la compilazione"
177 197  
178   -#: src/distroquery.c:1181
  198 +#: src/distroquery.c:1449
179 199 msgid "Changelog"
180 200 msgstr "Modifiche"
  201 +
  202 +#~ msgid "current path"
  203 +#~ msgstr "percorso corrente"
... ... @@ -230,6 +230,28 @@
230 230 return buffer;
231 231 }
232 232  
  233 +sqlite3* openRepositoryDatabase(struct configTag* ct, char* arch) {
  234 + char dbname[PATH_MAX];
  235 + sqlite3* db;
  236 +
  237 + if (arch) {
  238 + snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, arch);
  239 + if (sqlite3_open_v2(dbname, (sqlite3**)&db, SQLITE_OPEN_READONLY, NULL)) {
  240 + if (db) sqlite3_close(db);
  241 + fprintf(stderr, "ERROR: unable to open sqlite3 db %s\n", dbname);
  242 + return NULL;
  243 + }
  244 + } else {
  245 + snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
  246 + if (sqlite3_open_v2(dbname, (sqlite3**)&db, SQLITE_OPEN_READONLY, NULL)) {
  247 + if (db) sqlite3_close(db);
  248 + fprintf(stderr, "ERROR: unable to open sqlite3 db %s\n", dbname);
  249 + return NULL;
  250 + }
  251 + }
  252 + return db;
  253 +}
  254 +
233 255 void attachCtDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
234 256 char dbname[PATH_MAX];
235 257 int i=0;
... ... @@ -239,7 +261,7 @@
239 261 while (ct->repository[i]) {
240 262 if (arch) {
241 263 snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository[i]->repository_dir, ct->repository[i]->tag, arch);
242   - snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s'", dbname, ct->repository[i]->tag);
  264 + snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_%s'", dbname, ct->repository[i]->tag, arch);
243 265 if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
244 266 fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
245 267 }
246 268  
247 269  
248 270  
249 271  
250 272  
... ... @@ -254,34 +276,38 @@
254 276 }
255 277 }
256 278  
257   -void attachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
  279 +void attachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch, int source) {
258 280 char dbname[PATH_MAX];
259 281 char sql[PATH_MAX];
260 282 char *errmsg;
261 283  
262 284 snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, arch);
263   - snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s'", dbname, ct->tag);
  285 + snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_%s'", dbname, ct->tag, arch);
264 286 if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
265 287 fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
266 288 }
267   - snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
268   - snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_sources'", dbname, ct->tag);
269   - if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
270   - fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
  289 + if (source) {
  290 + snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
  291 + snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_sources'", dbname, ct->tag);
  292 + if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
  293 + fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
  294 + }
271 295 }
272 296 }
273 297  
274   -void detachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
  298 +void detachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch, int source) {
275 299 char sql[PATH_MAX];
276 300 char *errmsg;
277 301  
278   - snprintf(sql, PATH_MAX, "DETACH DATABASE '%s'", ct->tag);
  302 + snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_%s'", ct->tag, arch);
279 303 if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
280 304 fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
281 305 }
282   - snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_sources'", ct->tag);
283   - if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
284   - fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
  306 + if (source) {
  307 + snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_sources'", ct->tag);
  308 + if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
  309 + fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
  310 + }
285 311 }
286 312 }
287 313  
... ... @@ -401,8 +427,7 @@
401 427  
402 428 if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
403 429  
404   - printf("<hr>Repository %s, %s: ", query_repository, _("current path"));
405   -
  430 + if (!query_arch) query_arch=strdup(ARCHS[0]);
406 431 snprintf(dbname, PATH_MAX, "%s%s-%s-files.db", ct->repository_dir, ct->tag, query_arch);
407 432 if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) {
408 433 startid = findFileIdFromPath(dbf, &query_path);
... ... @@ -474,6 +499,19 @@
474 499  
475 500 }
476 501  
  502 +int packageVerCmp(int e1, const char* v1, const char* r1, int e2, const char* v2, const char* r2) {
  503 + int vcmp = rpmvercmp(v1,v2);
  504 + int rcmp = rpmvercmp(r1,r2);
  505 +
  506 + if ((e1 > e2) ||
  507 + ((e1 == e2) && (vcmp > 0)) ||
  508 + ((e1 == e2) && (vcmp == 0) && (rcmp >= 0)))
  509 + return 1;
  510 + else if ((e1 == e2) && (vcmp == 0) && (rcmp == 0))
  511 + return 0;
  512 + return -1;
  513 +}
  514 +
477 515 void printQueryResponse() {
478 516  
479 517 int a, i, j, k, numresults = 0, otherresults = 0, localresults = 0, localprovidesresults = 0, localsourceresults = 0;
480 518  
481 519  
482 520  
... ... @@ -811,14 +849,15 @@
811 849 void printSpecialQueryResponse() {
812 850 char *repository;
813 851 char sql[PATH_MAX];
814   - char dbname[PATH_MAX];
815 852 char buffer[PATH_MAX];
816 853 sqlite3 *db;
  854 + sqlite3 *dbb = NULL;
817 855 sqlite3_stmt *statement, *stmt1;
818 856 struct configTag* ct;
819   - int i;
  857 + int i,a, id, built_for_arch[ARCHS_MAX], built_for_arch_upstream[ARCHS_MAX];
820 858 long buildtime;
821 859 char updates[PATH_MAX];
  860 + char warning[PATH_MAX];
822 861 humanDate strdate;
823 862  
824 863 struct tm *ytm;
825 864  
826 865  
827 866  
828 867  
... ... @@ -834,23 +873,32 @@
834 873 timesec = mktime(ytm);
835 874  
836 875 if (strstr(query, "$latest$") == query) {
  876 + /* latest packages in a repository */
837 877 repository = query + 8;
838 878 ct = findRepositoryByTag(repository);
839 879 if (!ct) return;
840   - /* latest packages in a repository */
841   - snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
842   - if (sqlite3_open_v2(dbname, (sqlite3**)&db, SQLITE_OPEN_READONLY, NULL)) {
843   - if (db) sqlite3_close(db);
844   - fprintf(stderr, "ERROR: unable to open sqlite3 db %s\n", dbname);
845   - return;
846   - }
  880 + db = openRepositoryDatabase(ct, NULL);
847 881 attachCtDatabases(ct, db, NULL);
  882 +
  883 + if (ct->arch[0]) {
  884 + dbb = openRepositoryDatabase(ct, NULL);
  885 + if (!dbb) return;
  886 + for (a = 0; a < ARCHS_MAX && ct->arch[a]; a++) {
  887 + attachRepositoryDatabases(ct, dbb, ct->arch[a], 0);
  888 + }
  889 + }
  890 +
848 891 if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
849 892 snprintf(sql, PATH_MAX, "SELECT * FROM sources ORDER BY buildtime DESC LIMIT 100");
850 893 if (db && (sqlite3_prepare_v2(db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
  894 + /* loop packages in repository */
851 895 while (sqlite3_step(statement) == SQLITE_ROW) {
852 896 i=0;
853 897 updates[0]=0;
  898 + warning[0]=0;
  899 +
  900 + /* package in upstream repositories */
  901 + for (a = 0; a < ARCHS_MAX; a++) built_for_arch_upstream[a] = 0;
854 902 while (ct->repository[i]) {
855 903 if (ct->repository[i] == ct) break;
856 904 snprintf(sql, PATH_MAX, "SELECT * FROM '%s_sources'.sources WHERE name='%s'",
857 905  
858 906  
859 907  
860 908  
... ... @@ -858,23 +906,81 @@
858 906 (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")));
859 907 if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
860 908 if (sqlite3_step(stmt1) == SQLITE_ROW) {
861   - snprintf(updates, PATH_MAX, "%s %s(%s,%s-%s)", _("Updates"),
  909 + snprintf(updates, PATH_MAX, "%s %s(%s,%s-%s)\n", _("Updates"),
862 910 (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
863 911 ct->repository[i]->tag,
864 912 (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")),
865 913 (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")));
  914 + id = sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id"));
  915 + a = packageVerCmp(
  916 + sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "epoch")),
  917 + (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
  918 + (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
  919 + sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "epoch")),
  920 + (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")),
  921 + (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")));
  922 + if (a <= 0) {
  923 + if (a < 0)
  924 + snprintf(warning + strlen(warning), PATH_MAX - strlen(warning),
  925 + "%s %s (%d:%s-%s <= %d:%s-%s)\n",
  926 + _("Has older version than upstream package in"),
  927 + ct->repository[i]->tag,
  928 + sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "epoch")),
  929 + (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
  930 + (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
  931 + sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "epoch")),
  932 + (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")),
  933 + (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")));
  934 + else
  935 + snprintf(warning + strlen(warning), PATH_MAX - strlen(warning), "%s %s",
  936 + _("Has same version as upstream package in"),
  937 + ct->repository[i]->tag);
  938 + }
  939 + sqlite3_finalize(stmt1);
  940 + /* upstream built for archs */
  941 + for (a = 0; a < ARCHS_MAX && ct->repository[i]->arch[a]; a++) {
  942 + attachRepositoryDatabases(ct->repository[i], dbb, ct->repository[i]->arch[a], 0);
  943 + snprintf(sql, PATH_MAX, "SELECT id FROM '%s_%s'.packages WHERE id_source='%d'",
  944 + ct->repository[i]->tag, ct->repository[i]->arch[a], id);
  945 + if (sqlite3_prepare_v2(dbb, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
  946 + while (sqlite3_step(stmt1) == SQLITE_ROW) built_for_arch_upstream[a]++;
  947 + sqlite3_finalize(stmt1);
  948 + }
  949 + detachRepositoryDatabases(ct->repository[i], dbb, ct->repository[i]->arch[a], 0);
  950 + }
866 951 }
867   - sqlite3_finalize(stmt1);
868 952 }
869 953 i++;
870 954 }
871 955  
  956 + /* built for archs */
  957 + snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s: ", _("Packages for"));
  958 + for (a = 0; a < ARCHS_MAX; a++) built_for_arch[a] = 0;
  959 + for (a = 0; a < ARCHS_MAX && ct->arch[a]; a++) {
  960 + snprintf(sql, PATH_MAX, "SELECT id FROM '%s_%s'.packages WHERE id_source='%d'",
  961 + ct->repository[i]->tag, ct->arch[a],
  962 + sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
  963 + if (sqlite3_prepare_v2(dbb, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
  964 + while (sqlite3_step(stmt1) == SQLITE_ROW) built_for_arch[a]++;
  965 + }
  966 + sqlite3_finalize(stmt1);
  967 + if (built_for_arch[a])
  968 + snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "%s(%d) ", ct->arch[a], built_for_arch[a]);
  969 + }
  970 + snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n");
  971 +
  972 + for (a = 0; a < ARCHS_MAX; a++) {
  973 + if (built_for_arch_upstream[a] && ! built_for_arch[a])
  974 + snprintf(warning + strlen(warning), PATH_MAX - strlen(updates), "%s %s\n", _("Needs port to"), ct->arch[a]);
  975 + }
  976 +
  977 + /* changelog */
872 978 snprintf(sql, PATH_MAX, "SELECT * FROM changelog,packagers "
873 979 "WHERE id_source=%d AND changelog.id_packager=packagers.id "
874 980 "ORDER BY changelog.time DESC LIMIT 2",
875 981 sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
876 982 if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
877   - snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n\n%s", _("Latest changes:"));
  983 + snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s", _("Latest changes:"));
878 984 while (sqlite3_step(stmt1) == SQLITE_ROW) {
879 985 snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s - %s (%s)\n%s",
880 986 (char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate),
881 987  
882 988  
... ... @@ -882,14 +988,16 @@
882 988 (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")),
883 989 (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
884 990 }
  991 + snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n");
885 992 // strncat(updates + strlen(updates) - 1, buffer, PATH_MAX - strlen(updates));
886 993 }
887 994  
888 995 get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
889 996 if (updates[0] != 0) {
890   - printf("<img src=\"/pub/openmamba/distromatic/pkgup.png\" title=\"%s\" width\"14\" height=\"14\">&nbsp;", updates);
  997 + printf("<img src=\"%s/pkgup.png\" title=\"%s\" width=\"14\" height=\"14\">&nbsp;",
  998 + ct->configdefaults->url_dir, updates);
891 999 } else {
892   - printf("<img src=\"/pub/openmamba/distromatic/pkg.png\" width\"14\" height=\"14\">&nbsp;");
  1000 + printf("<img src=\"%s/pkg.png\" width=\"14\" height=\"14\">&nbsp;", ct->configdefaults->url_dir);
893 1001 }
894 1002  
895 1003 buildtime = sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime"));
896 1004  
... ... @@ -902,13 +1010,19 @@
902 1010 printf("%s <img src=\"%s\" width\"12\" height=\"12\">&nbsp;", strdate, buffer);
903 1011 printf("<b><a href='/distribution/search.html?"
904 1012 "repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery' title=\"%s\">"
905   - "%s</a></b> %s-%s<br>",
  1013 + "%s</a></b> %s-%s",
906 1014 ct->tag,
907 1015 (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
908 1016 htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX),
909 1017 (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
910 1018 (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
911 1019 (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")));
  1020 + if (warning[0] != 0) {
  1021 + printf("<img src=\"%s/warning-icon.png\" title=\"%s\" width=\"14\" height=\"14\">",
  1022 + ct->configdefaults->url_dir, warning);
  1023 +
  1024 + }
  1025 + printf("<br>");
912 1026 }
913 1027 sqlite3_finalize(statement);
914 1028 }
915 1029  
... ... @@ -1101,13 +1215,13 @@
1101 1215 sqlite3_finalize(statement); /* need to finalize all statements before detaching databases */
1102 1216 /* required by */
1103 1217 for (i = 0; query_repositories[i] != NULL; i++) {
1104   - attachRepositoryDatabases(query_repositories[i], db, query_arch);
  1218 + attachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
1105 1219 snprintf(sql, PATH_MAX,
1106 1220 "SELECT packagesup.name AS requiredbyname, "
1107 1221 "requiresup.requireflags AS requiredflags, "
1108 1222 "requiresup.requireversion AS requiredversion "
1109   - "FROM '%s'.packages AS packagesup,'%s'.requires AS requiresup,"
1110   - "'%s'.provided AS providedup,provided,provides "
  1223 + "FROM '%s_%s'.packages AS packagesup,'%s_%s'.requires AS requiresup,"
  1224 + "'%s_%s'.provided AS providedup,provided,provides "
1111 1225 "WHERE provides.id_package=%d AND provided.id=provides.id_provided "
1112 1226 "AND packagesup.id=requiresup.id_package "
1113 1227 "AND requiresup.id_provided=providedup.id "
... ... @@ -1115,7 +1229,9 @@
1115 1229 "AND NOT packagesup.name='%s' "
1116 1230 "GROUP BY packagesup.name "
1117 1231 "ORDER BY packagesup.name",
1118   - query_repositories[i]->tag, query_repositories[i]->tag, query_repositories[i]->tag,
  1232 + query_repositories[i]->tag, query_arch,
  1233 + query_repositories[i]->tag, query_arch,
  1234 + query_repositories[i]->tag, query_arch,
1119 1235 package_id, query_package);
1120 1236 if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
1121 1237 j=0;
1122 1238  
... ... @@ -1134,12 +1250,12 @@
1134 1250 }
1135 1251 sqlite3_finalize(stmt1);
1136 1252 }
1137   - detachRepositoryDatabases(query_repositories[i], db, query_arch);
  1253 + detachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
1138 1254 }
1139 1255  
1140 1256 /* build required by */
1141 1257 for (i = 0; query_repositories[i] != NULL; i++) {
1142   - attachRepositoryDatabases(query_repositories[i], db, query_arch);
  1258 + attachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
1143 1259 snprintf(sql, PATH_MAX,
1144 1260 "SELECT sourcesup.name as buildrequiredbyname, "
1145 1261 "buildrequiresup.buildrequireflags as buildrequireflags, "
... ... @@ -1169,7 +1285,7 @@
1169 1285 }
1170 1286 sqlite3_finalize(stmt1);
1171 1287 }
1172   - detachRepositoryDatabases(query_repositories[i], db, query_arch);
  1288 + detachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
1173 1289 }
1174 1290  
1175 1291 /* files list */