Commit b782ebbffb225dc1933004d029337d5a5634b1d5

Authored by Silvan Calarco
1 parent ce32dea9ed
Exists in master

reports.c: fix indentation warning reported by recent gcc

Showing 3 changed files with 5 additions and 5 deletions Inline Diff

1 VERSION = 1.4.5 1 VERSION = 1.4.6
2 2
1 # Italian translations for distromatic package. 1 # Italian translations for distromatic package.
2 # Copyright (C) 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 2 # Copyright (C) 2013 Silvan Calarco <silvan.calarco@mambasoft.it>
3 # This file is distributed under the same license as the distromatic package. 3 # This file is distributed under the same license as the distromatic package.
4 # Silvan Calarco <silvan.calarco@mambasoft.it>, 2013. 4 # Silvan Calarco <silvan.calarco@mambasoft.it>, 2013.
5 # 5 #
6 msgid "" 6 msgid ""
7 msgstr "" 7 msgstr ""
8 "Project-Id-Version: distromatic 1.4.1\n" 8 "Project-Id-Version: distromatic 1.4.1\n"
9 "Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n" 9 "Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
10 "POT-Creation-Date: 2015-05-16 13:07+0200\n" 10 "POT-Creation-Date: 2016-10-21 20:39+0200\n"
11 "PO-Revision-Date: 2013-10-14 01:19+0200\n" 11 "PO-Revision-Date: 2013-10-14 01:19+0200\n"
12 "Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n" 12 "Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
13 "Language-Team: Italian\n" 13 "Language-Team: Italian\n"
14 "Language: it\n" 14 "Language: it\n"
15 "MIME-Version: 1.0\n" 15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n" 16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n" 17 "Content-Transfer-Encoding: 8bit\n"
18 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19 19
20 #: src/distroquery.c:186 20 #: src/distroquery.c:186
21 msgid "Source" 21 msgid "Source"
22 msgstr "Sorgente" 22 msgstr "Sorgente"
23 23
24 #: src/distroquery.c:333 24 #: src/distroquery.c:333
25 msgid "Search" 25 msgid "Search"
26 msgstr "Cerca" 26 msgstr "Cerca"
27 27
28 #: src/distroquery.c:371 28 #: src/distroquery.c:371
29 msgid "sources" 29 msgid "sources"
30 msgstr "sorgenti" 30 msgstr "sorgenti"
31 31
32 #: src/distroquery.c:375 32 #: src/distroquery.c:375
33 msgid "files" 33 msgid "files"
34 msgstr "file" 34 msgstr "file"
35 35
36 #: src/distroquery.c:386 36 #: src/distroquery.c:386
37 msgid "Search software packages" 37 msgid "Search software packages"
38 msgstr "Cerca pacchetti software" 38 msgstr "Cerca pacchetti software"
39 39
40 #: src/distroquery.c:476 40 #: src/distroquery.c:476
41 msgid "Provider(s)" 41 msgid "Provider(s)"
42 msgstr "Fornito da" 42 msgstr "Fornito da"
43 43
44 #: src/distroquery.c:627 src/distroquery.c:637 src/distroquery.c:1162 44 #: src/distroquery.c:627 src/distroquery.c:637 src/distroquery.c:1162
45 #: src/distroquery.c:1429 45 #: src/distroquery.c:1429
46 msgid "Download" 46 msgid "Download"
47 msgstr "Scarica" 47 msgstr "Scarica"
48 48
49 #: src/distroquery.c:647 49 #: src/distroquery.c:647
50 msgid "Details" 50 msgid "Details"
51 msgstr "Dettagli" 51 msgstr "Dettagli"
52 52
53 #: src/distroquery.c:666 src/distroquery.c:721 53 #: src/distroquery.c:666 src/distroquery.c:721
54 #, c-format 54 #, c-format
55 msgid "Other results in " 55 msgid "Other results in "
56 msgstr "Altri risultati in " 56 msgstr "Altri risultati in "
57 57
58 #: src/distroquery.c:667 src/distroquery.c:722 58 #: src/distroquery.c:667 src/distroquery.c:722
59 #, c-format 59 #, c-format
60 msgid "Results in" 60 msgid "Results in"
61 msgstr "Risultati in" 61 msgstr "Risultati in"
62 62
63 #: src/distroquery.c:670 src/distroquery.c:725 63 #: src/distroquery.c:670 src/distroquery.c:725
64 msgid "for arch " 64 msgid "for arch "
65 msgstr "per l'architettura " 65 msgstr "per l'architettura "
66 66
67 #: src/distroquery.c:686 src/distroquery.c:697 67 #: src/distroquery.c:686 src/distroquery.c:697
68 msgid "provides" 68 msgid "provides"
69 msgstr "fornisce" 69 msgstr "fornisce"
70 70
71 #: src/distroquery.c:738 71 #: src/distroquery.c:738
72 msgid "provides directory" 72 msgid "provides directory"
73 msgstr "fornisce la cartella" 73 msgstr "fornisce la cartella"
74 74
75 #: src/distroquery.c:740 75 #: src/distroquery.c:740
76 msgid "provides symbolic link" 76 msgid "provides symbolic link"
77 msgstr "fornisce il link simbolico" 77 msgstr "fornisce il link simbolico"
78 78
79 #: src/distroquery.c:742 79 #: src/distroquery.c:742
80 msgid "provides file" 80 msgid "provides file"
81 msgstr "fornisce il file" 81 msgstr "fornisce il file"
82 82
83 #: src/distroquery.c:831 83 #: src/distroquery.c:831
84 msgid "result(s) shown" 84 msgid "result(s) shown"
85 msgstr "risultati mostrati" 85 msgstr "risultati mostrati"
86 86
87 #: src/distroquery.c:833 87 #: src/distroquery.c:833
88 msgid "result(s) found" 88 msgid "result(s) found"
89 msgstr "risultati trovati" 89 msgstr "risultati trovati"
90 90
91 #: src/distroquery.c:855 91 #: src/distroquery.c:855
92 msgid "Search results for" 92 msgid "Search results for"
93 msgstr "Risultati della ricerca per" 93 msgstr "Risultati della ricerca per"
94 94
95 #: src/distroquery.c:932 95 #: src/distroquery.c:932
96 msgid "Updates" 96 msgid "Updates"
97 msgstr "Aggiorna" 97 msgstr "Aggiorna"
98 98
99 #: src/distroquery.c:949 99 #: src/distroquery.c:949
100 msgid "Has older version than upstream package in" 100 msgid "Has older version than upstream package in"
101 msgstr "Ha una versione più vecchia del pacchetto corrente in" 101 msgstr "Ha una versione più vecchia del pacchetto corrente in"
102 102
103 #: src/distroquery.c:959 103 #: src/distroquery.c:959
104 msgid "Has same version as upstream package in" 104 msgid "Has same version as upstream package in"
105 msgstr "Ha la stessa versione del pacchetto corrente in" 105 msgstr "Ha la stessa versione del pacchetto corrente in"
106 106
107 #: src/distroquery.c:980 107 #: src/distroquery.c:980
108 msgid "Packages for" 108 msgid "Packages for"
109 msgstr "Pacchetti per" 109 msgstr "Pacchetti per"
110 110
111 #: src/distroquery.c:997 111 #: src/distroquery.c:997
112 msgid "Needs port to" 112 msgid "Needs port to"
113 msgstr "Richiede il porting per" 113 msgstr "Richiede il porting per"
114 114
115 #: src/distroquery.c:1006 115 #: src/distroquery.c:1006
116 msgid "Latest changes:" 116 msgid "Latest changes:"
117 msgstr "Modifiche recenti:" 117 msgstr "Modifiche recenti:"
118 118
119 #: src/distroquery.c:1127 src/distroquery.c:1391 119 #: src/distroquery.c:1127 src/distroquery.c:1391
120 msgid "Version" 120 msgid "Version"
121 msgstr "Versione" 121 msgstr "Versione"
122 122
123 #: src/distroquery.c:1132 123 #: src/distroquery.c:1132
124 msgid "Size" 124 msgid "Size"
125 msgstr "Dimensione" 125 msgstr "Dimensione"
126 126
127 #: src/distroquery.c:1135 127 #: src/distroquery.c:1135
128 msgid "Related packages" 128 msgid "Related packages"
129 msgstr "Pacchetti collegati" 129 msgstr "Pacchetti collegati"
130 130
131 #: src/distroquery.c:1164 src/distroquery.c:1431 131 #: src/distroquery.c:1164 src/distroquery.c:1431
132 msgid "Developers details" 132 msgid "Developers details"
133 msgstr "Dettagli per gli sviluppatori" 133 msgstr "Dettagli per gli sviluppatori"
134 134
135 #: src/distroquery.c:1166 135 #: src/distroquery.c:1166
136 msgid "Source package" 136 msgid "Source package"
137 msgstr "Pacchetto sorgente" 137 msgstr "Pacchetto sorgente"
138 138
139 #: src/distroquery.c:1176 src/distroquery.c:1178 139 #: src/distroquery.c:1176 src/distroquery.c:1178
140 msgid "Specfile" 140 msgid "Specfile"
141 msgstr "Specfile" 141 msgstr "Specfile"
142 142
143 #: src/distroquery.c:1181 src/distroquery.c:1433 143 #: src/distroquery.c:1181 src/distroquery.c:1433
144 msgid "Maintainer" 144 msgid "Maintainer"
145 msgstr "Manutentore" 145 msgstr "Manutentore"
146 146
147 #: src/distroquery.c:1182 src/distroquery.c:1434 147 #: src/distroquery.c:1182 src/distroquery.c:1434
148 msgid "Build date" 148 msgid "Build date"
149 msgstr "Data di compilazione" 149 msgstr "Data di compilazione"
150 150
151 #: src/distroquery.c:1192 151 #: src/distroquery.c:1192
152 msgid "Obsoletes" 152 msgid "Obsoletes"
153 msgstr "Rende obsoleti" 153 msgstr "Rende obsoleti"
154 154
155 #: src/distroquery.c:1210 155 #: src/distroquery.c:1210
156 msgid "Provides" 156 msgid "Provides"
157 msgstr "Fornisce" 157 msgstr "Fornisce"
158 158
159 #: src/distroquery.c:1228 159 #: src/distroquery.c:1228
160 msgid "Requires" 160 msgid "Requires"
161 msgstr "Richiede" 161 msgstr "Richiede"
162 162
163 #: src/distroquery.c:1262 163 #: src/distroquery.c:1262
164 msgid "Required in" 164 msgid "Required in"
165 msgstr "Richiesto in" 165 msgstr "Richiesto in"
166 166
167 #: src/distroquery.c:1262 src/distroquery.c:1298 167 #: src/distroquery.c:1262 src/distroquery.c:1298
168 msgid "by" 168 msgid "by"
169 msgstr "da" 169 msgstr "da"
170 170
171 #: src/distroquery.c:1269 src/distroquery.c:1304 171 #: src/distroquery.c:1269 src/distroquery.c:1304
172 msgid "requires" 172 msgid "requires"
173 msgstr "richiede" 173 msgstr "richiede"
174 174
175 #: src/distroquery.c:1298 175 #: src/distroquery.c:1298
176 msgid "Build required in" 176 msgid "Build required in"
177 msgstr "Richiesto per la compilazione in" 177 msgstr "Richiesto per la compilazione in"
178 178
179 #: src/distroquery.c:1317 179 #: src/distroquery.c:1317
180 msgid "Files list" 180 msgid "Files list"
181 msgstr "Lista dei file" 181 msgstr "Lista dei file"
182 182
183 #: src/distroquery.c:1398 183 #: src/distroquery.c:1398
184 msgid "Built packages" 184 msgid "Built packages"
185 msgstr "Pacchetti compilati" 185 msgstr "Pacchetti compilati"
186 186
187 #: src/distroquery.c:1437 187 #: src/distroquery.c:1437
188 msgid "Source files" 188 msgid "Source files"
189 msgstr "File sorgenti" 189 msgstr "File sorgenti"
190 190
191 #: src/distroquery.c:1447 191 #: src/distroquery.c:1447
192 msgid "Patches" 192 msgid "Patches"
193 msgstr "Patch" 193 msgstr "Patch"
194 194
195 #: src/distroquery.c:1458 195 #: src/distroquery.c:1458
196 msgid "Build requirements" 196 msgid "Build requirements"
197 msgstr "Requisiti per la compilazione" 197 msgstr "Requisiti per la compilazione"
198 198
199 #: src/distroquery.c:1472 199 #: src/distroquery.c:1472
200 msgid "Changelog" 200 msgid "Changelog"
201 msgstr "Modifiche" 201 msgstr "Modifiche"
202 202
203 #~ msgid "current path" 203 #~ msgid "current path"
204 #~ msgstr "percorso corrente" 204 #~ msgstr "percorso corrente"
205 205
1 /* 1 /*
2 * distromatic - tool for RPM based repositories 2 * distromatic - tool for RPM based repositories
3 * 3 *
4 * Copyright (C) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it> 4 * Copyright (C) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
5 * Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com> 5 * Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it under 7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of version 2 of the GNU General Public License as published by the 8 * the terms of version 2 of the GNU General Public License as published by the
9 * Free Software Foundation. 9 * Free Software Foundation.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT 11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY, to the extent permitted by law; without even the implied 12 * ANY WARRANTY, to the extent permitted by law; without even the implied
13 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details. 14 * See the GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License along with 16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21 #ifdef HAVE_CONFIG_H 21 #ifdef HAVE_CONFIG_H
22 # include "config.h" 22 # include "config.h"
23 #endif 23 #endif
24 24
25 #if HAVE_STRING_H 25 #if HAVE_STRING_H
26 # if !STDC_HEADERS && HAVE_MEMORY_H 26 # if !STDC_HEADERS && HAVE_MEMORY_H
27 # include <memory.h> 27 # include <memory.h>
28 # endif 28 # endif
29 # include <string.h> 29 # include <string.h>
30 #endif 30 #endif
31 #if HAVE_STRINGS_H 31 #if HAVE_STRINGS_H
32 # include <strings.h> 32 # include <strings.h>
33 #endif 33 #endif
34 34
35 #include "changelog.h" 35 #include "changelog.h"
36 #include "reports.h" 36 #include "reports.h"
37 #include "rpmfunctions.h" 37 #include "rpmfunctions.h"
38 #include "functions.h" 38 #include "functions.h"
39 #include "requirelist.h" 39 #include "requirelist.h"
40 #include <errno.h> 40 #include <errno.h>
41 #include <time.h> 41 #include <time.h>
42 42
43 #define HTMLSTATS_NUM 200 43 #define HTMLSTATS_NUM 200
44 #define HTMLOLDSTATS_NUM 200 44 #define HTMLOLDSTATS_NUM 200
45 #define RSSSTATS_NUM 20 45 #define RSSSTATS_NUM 20
46 46
47 char *groupdirname(char *group,char *dest,unsigned int max) 47 char *groupdirname(char *group,char *dest,unsigned int max)
48 { 48 {
49 strncpy(dest,group,max); 49 strncpy(dest,group,max);
50 50
51 unsigned int i=0; 51 unsigned int i=0;
52 52
53 while (dest[i] && i<max) { 53 while (dest[i] && i<max) {
54 switch (dest[i]) { 54 switch (dest[i]) {
55 case '/': dest[i]=':'; break; 55 case '/': dest[i]=':'; break;
56 case ' ': dest[i]='_'; break; 56 case ' ': dest[i]='_'; break;
57 default: break; 57 default: break;
58 } 58 }
59 i++; 59 i++;
60 } 60 }
61 return dest; 61 return dest;
62 } 62 }
63 63
64 int 64 int
65 comparePackagers(const void *ptr1, const void *ptr2) 65 comparePackagers(const void *ptr1, const void *ptr2)
66 { 66 {
67 int ret; 67 int ret;
68 68
69 if (! (*(struct headerSourceList **)ptr1)->packager) return -1; 69 if (! (*(struct headerSourceList **)ptr1)->packager) return -1;
70 else if (! (*(struct headerSourceList **)ptr2)->packager) return +1; 70 else if (! (*(struct headerSourceList **)ptr2)->packager) return +1;
71 else { 71 else {
72 ret=strcasecmp((*(struct headerSourceList **)ptr1)->packager->name, 72 ret=strcasecmp((*(struct headerSourceList **)ptr1)->packager->name,
73 (*(struct headerSourceList **)ptr2)->packager->name); 73 (*(struct headerSourceList **)ptr2)->packager->name);
74 74
75 if (!ret) { 75 if (!ret) {
76 ret=strcasecmp((*(struct headerSourceList **)ptr1)->name, 76 ret=strcasecmp((*(struct headerSourceList **)ptr1)->name,
77 (*(struct headerSourceList **)ptr2)->name); 77 (*(struct headerSourceList **)ptr2)->name);
78 } 78 }
79 return ret; 79 return ret;
80 } 80 }
81 } 81 }
82 82
83 int 83 int
84 printHTMLWarnings(FILE *fout, struct configTag *configtag, struct headerSourceList* pkg, int mode) { 84 printHTMLWarnings(FILE *fout, struct configTag *configtag, struct headerSourceList* pkg, int mode) {
85 85
86 char warningsfile[PATH_MAX]; 86 char warningsfile[PATH_MAX];
87 char buf[PATH_MAX]; 87 char buf[PATH_MAX];
88 struct stat s; 88 struct stat s;
89 FILE *fin; 89 FILE *fin;
90 int n; 90 int n;
91 struct warningList *firstwarning,*currwarning; 91 struct warningList *firstwarning,*currwarning;
92 92
93 if (!pkg) return 0; 93 if (!pkg) return 0;
94 94
95 snprintf(warningsfile,PATH_MAX,"%swarnings/%s.in",configtag->html_dir,pkg->name); 95 snprintf(warningsfile,PATH_MAX,"%swarnings/%s.in",configtag->html_dir,pkg->name);
96 96
97 /* find pointer to first warning also looking into old packages */ 97 /* find pointer to first warning also looking into old packages */
98 firstwarning = pkg->firstwarning; 98 firstwarning = pkg->firstwarning;
99 while (!firstwarning && pkg->old) { 99 while (!firstwarning && pkg->old) {
100 pkg = pkg->old; 100 pkg = pkg->old;
101 firstwarning = pkg->firstwarning; 101 firstwarning = pkg->firstwarning;
102 } 102 }
103 103
104 if (firstwarning || !stat(warningsfile,&s)) { 104 if (firstwarning || !stat(warningsfile,&s)) {
105 if (mode == 0) { 105 if (mode == 0) {
106 fprintf(fout, 106 fprintf(fout,
107 "<img src=\"%s/warning-icon.png\" title=\"", 107 "<img src=\"%s/warning-icon.png\" title=\"",
108 configtag->configdefaults->url_dir); 108 configtag->configdefaults->url_dir);
109 } else if (mode == 1) { 109 } else if (mode == 1) {
110 fprintf(fout, 110 fprintf(fout,
111 "<div class=\"warning\"><img src=\"%s/warning-icon.png\" title=\"Beware: this package has warnings.\">&nbsp;<b>Beware, this package has warnings:</b><br>", 111 "<div class=\"warning\"><img src=\"%s/warning-icon.png\" title=\"Beware: this package has warnings.\">&nbsp;<b>Beware, this package has warnings:</b><br>",
112 configtag->configdefaults->url_dir); 112 configtag->configdefaults->url_dir);
113 } 113 }
114 } 114 }
115 115
116 if (!stat(warningsfile,&s)) { 116 if (!stat(warningsfile,&s)) {
117 117
118 if ((fin = fopen(warningsfile, "r")) == NULL) { 118 if ((fin = fopen(warningsfile, "r")) == NULL) {
119 perror(warningsfile); 119 perror(warningsfile);
120 return 0; 120 return 0;
121 } 121 }
122 122
123 fprintf(fout,"&nbsp;&bull;&nbsp;Comment:"); 123 fprintf(fout,"&nbsp;&bull;&nbsp;Comment:");
124 while (!feof(fin)) { 124 while (!feof(fin)) {
125 n = fread(buf, 1, sizeof(buf), fin); 125 n = fread(buf, 1, sizeof(buf), fin);
126 fwrite(buf,1,n,fout); 126 fwrite(buf,1,n,fout);
127 } 127 }
128 if (mode == 0) { 128 if (mode == 0) {
129 fprintf(fout,"\n"); 129 fprintf(fout,"\n");
130 } else if (mode == 1) { 130 } else if (mode == 1) {
131 fprintf(fout,"<br>"); 131 fprintf(fout,"<br>");
132 } 132 }
133 fclose(fin); 133 fclose(fin);
134 } 134 }
135 135
136 currwarning = firstwarning; 136 currwarning = firstwarning;
137 while (currwarning || pkg->old) { 137 while (currwarning || pkg->old) {
138 if (currwarning) { 138 if (currwarning) {
139 if (mode == 0) { 139 if (mode == 0) {
140 fprintf(fout,"&nbsp;&bull;&nbsp;%s\n",currwarning->text); 140 fprintf(fout,"&nbsp;&bull;&nbsp;%s\n",currwarning->text);
141 } else if (mode == 1) { 141 } else if (mode == 1) {
142 fprintf(fout,"&nbsp;&bull;&nbsp;%s<br>",currwarning->text); 142 fprintf(fout,"&nbsp;&bull;&nbsp;%s<br>",currwarning->text);
143 } else if (mode == 2) { 143 } else if (mode == 2) {
144 fprintf(fout,"%s %s\n",pkg->name,currwarning->text); 144 fprintf(fout,"%s %s\n",pkg->name,currwarning->text);
145 } 145 }
146 currwarning = currwarning->next; 146 currwarning = currwarning->next;
147 } 147 }
148 while (!currwarning && pkg->old) { 148 while (!currwarning && pkg->old) {
149 /* print warnings coming from updated packages */ 149 /* print warnings coming from updated packages */
150 pkg = pkg->old; 150 pkg = pkg->old;
151 currwarning = pkg->firstwarning; 151 currwarning = pkg->firstwarning;
152 } 152 }
153 } 153 }
154 if (firstwarning || !stat(warningsfile,&s)) { 154 if (firstwarning || !stat(warningsfile,&s)) {
155 if (mode == 0) { 155 if (mode == 0) {
156 fprintf(fout,"\">"); 156 fprintf(fout,"\">");
157 } else if (mode == 1) { 157 } else if (mode == 1) {
158 fprintf(fout,"</div><br>\n"); 158 fprintf(fout,"</div><br>\n");
159 } 159 }
160 return 1; 160 return 1;
161 } 161 }
162 return 0; 162 return 0;
163 } 163 }
164 164
165 void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s) { 165 void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s) {
166 166
167 char buffer[PATH_MAX]; 167 char buffer[PATH_MAX];
168 char strdate[16]; 168 char strdate[16];
169 int i; 169 int i;
170 170
171 if (s->old) { 171 if (s->old) {
172 fprintf(fout, 172 fprintf(fout,
173 "<img src=\"%s/pkgup.png\" ", 173 "<img src=\"%s/pkgup.png\" ",
174 configtag->configdefaults->url_dir); 174 configtag->configdefaults->url_dir);
175 } else { 175 } else {
176 fprintf(fout, 176 fprintf(fout,
177 "<img src=\"%s/pkg.png\" ", 177 "<img src=\"%s/pkg.png\" ",
178 configtag->configdefaults->url_dir); 178 configtag->configdefaults->url_dir);
179 } 179 }
180 180
181 if (s->changelog) { 181 if (s->changelog) {
182 simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate); 182 simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
183 fprintf(fout, 183 fprintf(fout,
184 "title=\"%s - %s (%s)\n%s", 184 "title=\"%s - %s (%s)\n%s",
185 strdate, 185 strdate,
186 s->changelog->pkg->name, 186 s->changelog->pkg->name,
187 s->changelog->release, 187 s->changelog->release,
188 htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX)); 188 htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX));
189 if (s->changelog->next) { 189 if (s->changelog->next) {
190 simpleTimeToHuman(s->changelog->next->time, (humanDate *) & strdate); 190 simpleTimeToHuman(s->changelog->next->time, (humanDate *) & strdate);
191 fprintf(fout, 191 fprintf(fout,
192 "\n%s - %s (%s)\n%s", 192 "\n%s - %s (%s)\n%s",
193 strdate, 193 strdate,
194 s->changelog->next->pkg->name, 194 s->changelog->next->pkg->name,
195 s->changelog->next->release, 195 s->changelog->next->release,
196 htmlcleanNoBr(s->changelog->next->text,buffer,PATH_MAX)); 196 htmlcleanNoBr(s->changelog->next->text,buffer,PATH_MAX));
197 } 197 }
198 } else { 198 } else {
199 fprintf(fout, 199 fprintf(fout,
200 "title=\"WARNING: missing changelog"); 200 "title=\"WARNING: missing changelog");
201 } 201 }
202 202
203 fprintf(fout,"\n\nArchs:"); 203 fprintf(fout,"\n\nArchs:");
204 for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) { 204 for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
205 if (s->firstchild[i]) fprintf(fout," %s", configtag->arch[i]); 205 if (s->firstchild[i]) fprintf(fout," %s", configtag->arch[i]);
206 } 206 }
207 207
208 if (s->old) { 208 if (s->old) {
209 fprintf(fout, 209 fprintf(fout,
210 "\n\nUpdates %s(%s,%s,%ld:%s-%s)\">", 210 "\n\nUpdates %s(%s,%s,%ld:%s-%s)\">",
211 s->old->name, 211 s->old->name,
212 configtag->repository[s->old->altrepository]->tag, 212 configtag->repository[s->old->altrepository]->tag,
213 s->old->arch, 213 s->old->arch,
214 s->old->epoch, 214 s->old->epoch,
215 s->old->version, 215 s->old->version,
216 s->old->release); 216 s->old->release);
217 } else { 217 } else {
218 fprintf(fout, "\">"); 218 fprintf(fout, "\">");
219 } 219 }
220 220
221 } 221 }
222 222
223 int 223 int
224 generateMaintainersPages(struct configTag *configtag) 224 generateMaintainersPages(struct configTag *configtag)
225 { 225 {
226 char idxfile[PATH_MAX],outfile[PATH_MAX],unmaintfile[PATH_MAX]; 226 char idxfile[PATH_MAX],outfile[PATH_MAX],unmaintfile[PATH_MAX];
227 FILE *idx=NULL,*out=NULL,*unmaint=NULL; 227 FILE *idx=NULL,*out=NULL,*unmaint=NULL;
228 int i,pkgnum,unmaintpkgnum; 228 int i,pkgnum,unmaintpkgnum;
229 struct stat buf; 229 struct stat buf;
230 struct Packager *currpackager = NULL; 230 struct Packager *currpackager = NULL;
231 231
232 /* sort headersourcelistvec by packager name */ 232 /* sort headersourcelistvec by packager name */
233 qsort((void *) &configtag->stats.headersourcelistvec[0], 233 qsort((void *) &configtag->stats.headersourcelistvec[0],
234 configtag->stats.headersourcecount, sizeof(struct headerSourceList *), 234 configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
235 comparePackagers); 235 comparePackagers);
236 236
237 snprintf(outfile, PATH_MAX, "%smaintainers", configtag->html_dir); 237 snprintf(outfile, PATH_MAX, "%smaintainers", configtag->html_dir);
238 if (stat(outfile,&buf)) { 238 if (stat(outfile,&buf)) {
239 if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { 239 if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
240 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile); 240 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
241 exit(1); 241 exit(1);
242 } 242 }
243 } else { 243 } else {
244 if (!S_ISDIR(buf.st_mode)) { 244 if (!S_ISDIR(buf.st_mode)) {
245 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",outfile); 245 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",outfile);
246 exit(1); 246 exit(1);
247 } 247 }
248 } 248 }
249 249
250 snprintf(idxfile, PATH_MAX, "%s_maintainers.inc", configtag->html_dir); 250 snprintf(idxfile, PATH_MAX, "%s_maintainers.inc", configtag->html_dir);
251 251
252 if ((idx = fopen(idxfile, "w")) == NULL) { 252 if ((idx = fopen(idxfile, "w")) == NULL) {
253 perror(idxfile); 253 perror(idxfile);
254 return 1; 254 return 1;
255 } 255 }
256 256
257 fprintf(idx, 257 fprintf(idx,
258 "<br>Maintainers for packages in the <b>%s</b> repository (%s):<br><br>\n", 258 "<br>Maintainers for packages in the <b>%s</b> repository (%s):<br><br>\n",
259 configtag->tag, 259 configtag->tag,
260 configtag->description); 260 configtag->description);
261 261
262 snprintf(unmaintfile, PATH_MAX, "%smaintainers/unmaintained.inc", configtag->html_dir); 262 snprintf(unmaintfile, PATH_MAX, "%smaintainers/unmaintained.inc", configtag->html_dir);
263 263
264 if ((unmaint = fopen(unmaintfile, "w")) == NULL) { 264 if ((unmaint = fopen(unmaintfile, "w")) == NULL) {
265 perror(unmaintfile); 265 perror(unmaintfile);
266 return 1; 266 return 1;
267 } 267 }
268 268
269 fprintf(unmaint, 269 fprintf(unmaint,
270 "<br>Packages that are <b>unmaintained</b> in the %s repository:<br><br>\n",configtag->tag); 270 "<br>Packages that are <b>unmaintained</b> in the %s repository:<br><br>\n",configtag->tag);
271 271
272 i=0; 272 i=0;
273 out=NULL; 273 out=NULL;
274 pkgnum=0; 274 pkgnum=0;
275 unmaintpkgnum=0; 275 unmaintpkgnum=0;
276 276
277 while (i < configtag->stats.headersourcecount) { 277 while (i < configtag->stats.headersourcecount) {
278 if ((configtag->stats.headersourcelistvec[i])->packager) { 278 if ((configtag->stats.headersourcelistvec[i])->packager) {
279 279
280 if ((i == 0) || 280 if ((i == 0) ||
281 ((configtag->stats.headersourcelistvec[i-1])->packager != (configtag->stats.headersourcelistvec[i])->packager)) { 281 ((configtag->stats.headersourcelistvec[i-1])->packager != (configtag->stats.headersourcelistvec[i])->packager)) {
282 282
283 if ((configtag->stats.headersourcelistvec[i])->packager->role & 283 if ((configtag->stats.headersourcelistvec[i])->packager->role &
284 PACKAGER_ROLE_MAINTAINER) { 284 PACKAGER_ROLE_MAINTAINER) {
285 285
286 snprintf(outfile, PATH_MAX, "%smaintainers/%s.inc", 286 snprintf(outfile, PATH_MAX, "%smaintainers/%s.inc",
287 configtag->html_dir, 287 configtag->html_dir,
288 (configtag->stats.headersourcelistvec[i])->packager->name); 288 (configtag->stats.headersourcelistvec[i])->packager->name);
289 289
290 if ((out = fopen(outfile, "w")) == NULL) { 290 if ((out = fopen(outfile, "w")) == NULL) {
291 perror(outfile); 291 perror(outfile);
292 return 1; 292 return 1;
293 } 293 }
294 294
295 fprintf(out, 295 fprintf(out,
296 "<br>Packages maintained by <b>%s</b> in the %s repository:<br><br>\n", 296 "<br>Packages maintained by <b>%s</b> in the %s repository:<br><br>\n",
297 (configtag->stats.headersourcelistvec[i])->packager->name, 297 (configtag->stats.headersourcelistvec[i])->packager->name,
298 configtag->tag); 298 configtag->tag);
299 } // new maintainer file created 299 } // new maintainer file created
300 300
301 } // check for changed packager 301 } // check for changed packager
302 302
303 if ((configtag->stats.headersourcelistvec[i])->packager->role & PACKAGER_ROLE_MAINTAINER) { 303 if ((configtag->stats.headersourcelistvec[i])->packager->role & PACKAGER_ROLE_MAINTAINER) {
304 fprintf(out, 304 fprintf(out,
305 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a>: %s<br>\n", 305 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a>: %s<br>\n",
306 configtag->configdefaults->url_prefix, 306 configtag->configdefaults->url_prefix,
307 configtag->tag, 307 configtag->tag,
308 (configtag->stats.headersourcelistvec)[i]->name, 308 (configtag->stats.headersourcelistvec)[i]->name,
309 (configtag->stats.headersourcelistvec)[i]->name, 309 (configtag->stats.headersourcelistvec)[i]->name,
310 (configtag->stats.headersourcelistvec)[i]->summary); 310 (configtag->stats.headersourcelistvec)[i]->summary);
311 pkgnum++; 311 pkgnum++;
312 312
313 if ((i+1 >= configtag->stats.headersourcecount) || 313 if ((i+1 >= configtag->stats.headersourcecount) ||
314 ((configtag->stats.headersourcelistvec[i])->packager != 314 ((configtag->stats.headersourcelistvec[i])->packager !=
315 (configtag->stats.headersourcelistvec[i+1])->packager)) { 315 (configtag->stats.headersourcelistvec[i+1])->packager)) {
316 316
317 fprintf(idx, 317 fprintf(idx,
318 "<a href=\"%stag=%s&amp;maintainer=%s\">%s </a>(pkg:%d; act:%5.2f%%)<br>\n", 318 "<a href=\"%stag=%s&amp;maintainer=%s\">%s </a>(pkg:%d; act:%5.2f%%)<br>\n",
319 configtag->configdefaults->url_prefix, 319 configtag->configdefaults->url_prefix,
320 configtag->tag, 320 configtag->tag,
321 configtag->stats.headersourcelistvec[i]->packager->name, 321 configtag->stats.headersourcelistvec[i]->packager->name,
322 configtag->stats.headersourcelistvec[i]->packager->name, 322 configtag->stats.headersourcelistvec[i]->packager->name,
323 pkgnum, 323 pkgnum,
324 ((double)(configtag->stats.headersourcelistvec[i]->packager->changes_count) * 100) / configtag->stats.changelog_total ); 324 ((double)(configtag->stats.headersourcelistvec[i]->packager->changes_count) * 100) / configtag->stats.changelog_total );
325 pkgnum=0; 325 pkgnum=0;
326 fclose(out); 326 fclose(out);
327 327
328 } 328 }
329 329
330 } else { // unmaintained package 330 } else { // unmaintained package
331 331
332 fprintf(unmaint, 332 fprintf(unmaint,
333 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a>: %s<br>\n", 333 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a>: %s<br>\n",
334 configtag->configdefaults->url_prefix, 334 configtag->configdefaults->url_prefix,
335 configtag->tag, 335 configtag->tag,
336 (configtag->stats.headersourcelistvec)[i]->name, 336 (configtag->stats.headersourcelistvec)[i]->name,
337 (configtag->stats.headersourcelistvec)[i]->name, 337 (configtag->stats.headersourcelistvec)[i]->name,
338 (configtag->stats.headersourcelistvec)[i]->summary); 338 (configtag->stats.headersourcelistvec)[i]->summary);
339 unmaintpkgnum++; 339 unmaintpkgnum++;
340 340
341 } 341 }
342 342
343 } 343 }
344 i++; 344 i++;
345 } // while 345 } // while
346 346
347 fclose(unmaint); 347 fclose(unmaint);
348 348
349 currpackager = firstPackager(); 349 currpackager = firstPackager();
350 350
351 // write stats for maintainer with 0 packages but changes (e.g. autodist) 351 // write stats for maintainer with 0 packages but changes (e.g. autodist)
352 while (currpackager) { 352 while (currpackager) {
353 if ((currpackager->role & PACKAGER_ROLE_MAINTAINER) && 353 if ((currpackager->role & PACKAGER_ROLE_MAINTAINER) &&
354 (currpackager->packages_count == 0) && 354 (currpackager->packages_count == 0) &&
355 (currpackager->changes_count > 0) ) { 355 (currpackager->changes_count > 0) ) {
356 fprintf(idx, 356 fprintf(idx,
357 "%s (pkg:%d; act:%5.2f%%)<br>\n", 357 "%s (pkg:%d; act:%5.2f%%)<br>\n",
358 currpackager->name, 358 currpackager->name,
359 0, 359 0,
360 ((double)(currpackager->changes_count) * 100) / configtag->stats.changelog_total ); 360 ((double)(currpackager->changes_count) * 100) / configtag->stats.changelog_total );
361 } 361 }
362 /* else { 362 /* else {
363 printf("skipped %s packages:%d changes:%d\n",currpackager->name,currpackager->packages_count,currpackager->changes_count); 363 printf("skipped %s packages:%d changes:%d\n",currpackager->name,currpackager->packages_count,currpackager->changes_count);
364 }*/ 364 }*/
365 currpackager = currpackager->next; 365 currpackager = currpackager->next;
366 } 366 }
367 367
368 if (unmaintpkgnum) 368 if (unmaintpkgnum)
369 fprintf(idx, 369 fprintf(idx,
370 "<a href=\"%stag=%s&amp;maintainer=unmaintained\">unmaintained packages</a> (pkg:%d)<br>\n", 370 "<a href=\"%stag=%s&amp;maintainer=unmaintained\">unmaintained packages</a> (pkg:%d)<br>\n",
371 configtag->configdefaults->url_prefix, 371 configtag->configdefaults->url_prefix,
372 configtag->tag, 372 configtag->tag,
373 unmaintpkgnum); 373 unmaintpkgnum);
374 374
375 fclose(idx); 375 fclose(idx);
376 376
377 return 0; 377 return 0;
378 } 378 }
379 379
380 int 380 int
381 generateStats(struct configTag *configtag,int arch) 381 generateStats(struct configTag *configtag,int arch)
382 { 382 {
383 char outfile[PATH_MAX]; 383 char outfile[PATH_MAX];
384 char rssfile[PATH_MAX]; 384 char rssfile[PATH_MAX];
385 char buffer[PATH_MAX]; 385 char buffer[PATH_MAX];
386 FILE *htmlout=NULL,*htmloldout,*rssout,*groupout; 386 FILE *htmlout=NULL,*htmloldout,*rssout,*groupout;
387 struct stat buf; 387 struct stat buf;
388 int i,pkgnum; 388 int i,pkgnum;
389 humanDate strdate,strolddate; 389 humanDate strdate,strolddate;
390 sizeString strsize; 390 sizeString strsize;
391 391
392 struct tm *ytm; 392 struct tm *ytm;
393 time_t timesec; 393 time_t timesec;
394 394
395 timesec = time(&timesec); 395 timesec = time(&timesec);
396 ytm = localtime((time_t *) &timesec); 396 ytm = localtime((time_t *) &timesec);
397 ytm->tm_sec = 0; 397 ytm->tm_sec = 0;
398 ytm->tm_min = 0; 398 ytm->tm_min = 0;
399 ytm->tm_hour = 0; 399 ytm->tm_hour = 0;
400 ytm->tm_mday = 1; 400 ytm->tm_mday = 1;
401 ytm->tm_mon = 0; 401 ytm->tm_mon = 0;
402 timesec = mktime(ytm); 402 timesec = mktime(ytm);
403 403
404 if (!configtag->configdefaults->html_basedir) { 404 if (!configtag->configdefaults->html_basedir) {
405 return 2; 405 return 2;
406 } 406 }
407 407
408 /* sort headersourcelistvec by Group */ 408 /* sort headersourcelistvec by Group */
409 qsort((void *) &configtag->stats.headersourcelistvec[0], 409 qsort((void *) &configtag->stats.headersourcelistvec[0],
410 configtag->stats.headersourcecount, sizeof(struct headerSourceList *), 410 configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
411 compareGroup); 411 compareGroup);
412 412
413 snprintf(outfile, PATH_MAX, "%s_groups.inc", configtag->html_dir); 413 snprintf(outfile, PATH_MAX, "%s_groups.inc", configtag->html_dir);
414 414
415 if ((groupout = fopen(outfile, "w")) == NULL) { 415 if ((groupout = fopen(outfile, "w")) == NULL) {
416 perror(outfile); 416 perror(outfile);
417 return 1; 417 return 1;
418 } 418 }
419 419
420 /* create groups directory */ 420 /* create groups directory */
421 snprintf(outfile, PATH_MAX, "%sgroups",configtag->html_dir); 421 snprintf(outfile, PATH_MAX, "%sgroups",configtag->html_dir);
422 if (stat(outfile,&buf)) { 422 if (stat(outfile,&buf)) {
423 if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { 423 if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
424 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile); 424 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
425 exit(1); 425 exit(1);
426 } 426 }
427 } else { 427 } else {
428 if (!S_ISDIR(buf.st_mode)) { 428 if (!S_ISDIR(buf.st_mode)) {
429 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",outfile); 429 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",outfile);
430 exit(1); 430 exit(1);
431 } 431 }
432 } 432 }
433 433
434 fprintf(groupout, 434 fprintf(groupout,
435 "<br>Groups in the <b>%s</b> repository (%s):<br><br>\n", 435 "<br>Groups in the <b>%s</b> repository (%s):<br><br>\n",
436 configtag->tag, 436 configtag->tag,
437 configtag->description); 437 configtag->description);
438 438
439 i=0; 439 i=0;
440 pkgnum=0; 440 pkgnum=0;
441 if (configtag->stats.headersourcecount) do { 441 if (configtag->stats.headersourcecount) do {
442 442
443 if (pkgnum==0) { 443 if (pkgnum==0) {
444 444
445 snprintf(outfile, PATH_MAX, "%sgroups/%s", 445 snprintf(outfile, PATH_MAX, "%sgroups/%s",
446 configtag->html_dir, 446 configtag->html_dir,
447 groupdirname(configtag->stats.headersourcelistvec[i]->group,buffer,PATH_MAX)); 447 groupdirname(configtag->stats.headersourcelistvec[i]->group,buffer,PATH_MAX));
448 448
449 if (stat(outfile,&buf)) { 449 if (stat(outfile,&buf)) {
450 if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { 450 if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
451 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile); 451 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
452 exit(1); 452 exit(1);
453 } 453 }
454 } else { 454 } else {
455 if (!S_ISDIR(buf.st_mode)) { 455 if (!S_ISDIR(buf.st_mode)) {
456 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",outfile); 456 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",outfile);
457 exit(1); 457 exit(1);
458 } 458 }
459 } 459 }
460 strncat(outfile, "/_index.inc", sizeof(outfile) - strlen(outfile)); 460 strncat(outfile, "/_index.inc", sizeof(outfile) - strlen(outfile));
461 if ((htmlout = fopen(outfile, "w")) == NULL) { 461 if ((htmlout = fopen(outfile, "w")) == NULL) {
462 perror(outfile); 462 perror(outfile);
463 return 1; 463 return 1;
464 } 464 }
465 465
466 fprintf(htmlout, 466 fprintf(htmlout,
467 "<br>Packages in the <b>%s</b> group of the <b>%s</b> repository (%s):<br><br>\n", 467 "<br>Packages in the <b>%s</b> group of the <b>%s</b> repository (%s):<br><br>\n",
468 configtag->stats.headersourcelistvec[i]->group, 468 configtag->stats.headersourcelistvec[i]->group,
469 configtag->tag, 469 configtag->tag,
470 configtag->description); 470 configtag->description);
471 471
472 } 472 }
473 fprintf(htmlout, 473 fprintf(htmlout,
474 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a>: %s<br>\n", 474 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a>: %s<br>\n",
475 configtag->configdefaults->url_prefix, 475 configtag->configdefaults->url_prefix,
476 configtag->tag, 476 configtag->tag,
477 (configtag->stats.headersourcelistvec)[i]->name, 477 (configtag->stats.headersourcelistvec)[i]->name,
478 (configtag->stats.headersourcelistvec)[i]->name, 478 (configtag->stats.headersourcelistvec)[i]->name,
479 (configtag->stats.headersourcelistvec)[i]->summary); 479 (configtag->stats.headersourcelistvec)[i]->summary);
480 i++; 480 i++;
481 pkgnum++; 481 pkgnum++;
482 482
483 if ((i >= configtag->stats.headersourcecount) || 483 if ((i >= configtag->stats.headersourcecount) ||
484 (strcmp(configtag->stats.headersourcelistvec[i-1]->group, 484 (strcmp(configtag->stats.headersourcelistvec[i-1]->group,
485 configtag->stats.headersourcelistvec[i]->group))) { 485 configtag->stats.headersourcelistvec[i]->group))) {
486 fprintf(groupout, 486 fprintf(groupout,
487 "<a href=\"%stag=%s&amp;group=%s\">%s <b>(%d)</b></a><br>\n", 487 "<a href=\"%stag=%s&amp;group=%s\">%s <b>(%d)</b></a><br>\n",
488 configtag->configdefaults->url_prefix, 488 configtag->configdefaults->url_prefix,
489 configtag->tag, 489 configtag->tag,
490 groupdirname(configtag->stats.headersourcelistvec[i-1]->group,buffer,PATH_MAX), 490 groupdirname(configtag->stats.headersourcelistvec[i-1]->group,buffer,PATH_MAX),
491 (configtag->stats.headersourcelistvec)[i-1]->group, 491 (configtag->stats.headersourcelistvec)[i-1]->group,
492 pkgnum); 492 pkgnum);
493 pkgnum=0; 493 pkgnum=0;
494 fclose(htmlout); 494 fclose(htmlout);
495 } 495 }
496 496
497 } while (i < configtag->stats.headersourcecount); 497 } while (i < configtag->stats.headersourcecount);
498 498
499 if (i>0) { 499 if (i>0) {
500 fclose(groupout); 500 fclose(groupout);
501 } 501 }
502 502
503 strncpy(outfile, configtag->html_dir, PATH_MAX); 503 strncpy(outfile, configtag->html_dir, PATH_MAX);
504 strncat(outfile, "_recent.inc", sizeof(outfile) - strlen(outfile)); 504 strncat(outfile, "_recent.inc", sizeof(outfile) - strlen(outfile));
505 if ((htmlout = fopen(outfile, "w")) == NULL) { 505 if ((htmlout = fopen(outfile, "w")) == NULL) {
506 perror(outfile); 506 perror(outfile);
507 return 1; 507 return 1;
508 } 508 }
509 /*else { 509 /*else {
510 fprintf(htmlout, "<a href=\"%s/%s/recent.rss\">" 510 fprintf(htmlout, "<a href=\"%s/%s/recent.rss\">"
511 "<img src=\"%s/feed-icon.png\" " 511 "<img src=\"%s/feed-icon.png\" "
512 "alt=\"RSS 2.0 news feed\"></a>", 512 "alt=\"RSS 2.0 news feed\"></a>",
513 configtag->configdefaults->url_dir, 513 configtag->configdefaults->url_dir,
514 configtag->tag, 514 configtag->tag,
515 configtag->configdefaults->url_dir); 515 configtag->configdefaults->url_dir);
516 fprintf(htmlout, "Recent builds:<br>\n"); 516 fprintf(htmlout, "Recent builds:<br>\n");
517 }*/ 517 }*/
518 518
519 strncpy(outfile, configtag->html_dir, PATH_MAX); 519 strncpy(outfile, configtag->html_dir, PATH_MAX);
520 strncat(outfile, "_oldest.inc", sizeof(outfile) - strlen(outfile)); 520 strncat(outfile, "_oldest.inc", sizeof(outfile) - strlen(outfile));
521 if ((htmloldout = fopen(outfile, "w")) == NULL) { 521 if ((htmloldout = fopen(outfile, "w")) == NULL) {
522 perror(outfile); 522 perror(outfile);
523 return 1; 523 return 1;
524 } 524 }
525 525
526 /* else { 526 /* else {
527 fprintf(htmloldout, "Oldest builds:<br>\n"); 527 fprintf(htmloldout, "Oldest builds:<br>\n");
528 }*/ 528 }*/
529 529
530 strncpy(rssfile, configtag->html_dir, PATH_MAX); 530 strncpy(rssfile, configtag->html_dir, PATH_MAX);
531 strncat(rssfile, "recent.rss", sizeof(rssfile) - strlen(rssfile)); 531 strncat(rssfile, "recent.rss", sizeof(rssfile) - strlen(rssfile));
532 if ((rssout = fopen(rssfile, "w")) == NULL) { 532 if ((rssout = fopen(rssfile, "w")) == NULL) {
533 perror(rssfile); 533 perror(rssfile);
534 return 1; 534 return 1;
535 } else { 535 } else {
536 fprintf(rssout,"<?xml version=\"1.0\" ?>\n"); 536 fprintf(rssout,"<?xml version=\"1.0\" ?>\n");
537 fprintf(rssout,"<rss version=\"2.0\">\n"); 537 fprintf(rssout,"<rss version=\"2.0\">\n");
538 fprintf(rssout,"<channel>\n"); 538 fprintf(rssout,"<channel>\n");
539 fprintf(rssout," <title>Recent packages for the %s repository</title>\n",configtag->tag); 539 fprintf(rssout," <title>Recent packages for the %s repository</title>\n",configtag->tag);
540 fprintf(rssout," <link>http://%s/%s</link>\n", 540 fprintf(rssout," <link>http://%s/%s</link>\n",
541 configtag->configdefaults->url_address, 541 configtag->configdefaults->url_address,
542 configtag->configdefaults->url_prefix); 542 configtag->configdefaults->url_prefix);
543 //fprintf(rssout," <description></description>\n"); 543 //fprintf(rssout," <description></description>\n");
544 fprintf(rssout," <language>en-us</language>\n"); 544 fprintf(rssout," <language>en-us</language>\n");
545 fprintf(rssout," <docs>http://blogs.law.harvard.edu/tech/rss</docs>"); 545 fprintf(rssout," <docs>http://blogs.law.harvard.edu/tech/rss</docs>");
546 fprintf(rssout," <generator>Distromatic %s</generator>\n",VERSION); 546 fprintf(rssout," <generator>Distromatic %s</generator>\n",VERSION);
547 } 547 }
548 548
549 /* sort headersourcelistvec by BuildDate */ 549 /* sort headersourcelistvec by BuildDate */
550 qsort((void *) &configtag->stats.headersourcelistvec[0], 550 qsort((void *) &configtag->stats.headersourcelistvec[0],
551 configtag->stats.headersourcecount, sizeof(struct headerSourceList *), 551 configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
552 compareSourceHeaderBuildDate); 552 compareSourceHeaderBuildDate);
553 553
554 fprintf(htmlout, "<a href=\"%stag=%s\">SRPMS</a>(%d;%s)", 554 fprintf(htmlout, "<a href=\"%stag=%s\">SRPMS</a>(%d;%s)",
555 configtag->configdefaults->url_prefix, 555 configtag->configdefaults->url_prefix,
556 configtag->tag, 556 configtag->tag,
557 configtag->stats.headersourcecount, 557 configtag->stats.headersourcecount,
558 humanSize(configtag->stats.headersourcesize, &strsize)); 558 humanSize(configtag->stats.headersourcesize, &strsize));
559 for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) { 559 for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
560 fprintf(htmlout, " <a href=\"%stag=%s&arch=%s\">%s</a>(%d;%s) ", 560 fprintf(htmlout, " <a href=\"%stag=%s&arch=%s\">%s</a>(%d;%s) ",
561 configtag->configdefaults->url_prefix, 561 configtag->configdefaults->url_prefix,
562 configtag->tag, 562 configtag->tag,
563 configtag->arch[i], 563 configtag->arch[i],
564 configtag->arch[i], 564 configtag->arch[i],
565 configtag->stats.headercount[i], 565 configtag->stats.headercount[i],
566 humanSize(configtag->stats.headersize[i], &strsize)); 566 humanSize(configtag->stats.headersize[i], &strsize));
567 if (i % 2 == 0) fprintf(htmlout,"<br>"); 567 if (i % 2 == 0) fprintf(htmlout,"<br>");
568 } 568 }
569 if (i % 2 == 0) fprintf(htmlout,"<br>"); 569 if (i % 2 == 0) fprintf(htmlout,"<br>");
570 570
571 i=0; 571 i=0;
572 while ((i < configtag->stats.headersourcecount) && 572 while ((i < configtag->stats.headersourcecount) &&
573 ((i < HTMLSTATS_NUM) || (i < RSSSTATS_NUM))) { 573 ((i < HTMLSTATS_NUM) || (i < RSSSTATS_NUM))) {
574 if ((configtag->stats.headersourcelistvec)[i]->buildtime < timesec) { 574 if ((configtag->stats.headersourcelistvec)[i]->buildtime < timesec) {
575 simpleTimeToTemplate( 575 simpleTimeToTemplate(
576 (configtag->stats.headersourcelistvec)[i]->buildtime, 576 (configtag->stats.headersourcelistvec)[i]->buildtime,
577 "%Y/%m/%d",&strdate); 577 "%Y/%m/%d",&strdate);
578 } else { 578 } else {
579 simpleTimeToTemplate( 579 simpleTimeToTemplate(
580 (configtag->stats.headersourcelistvec)[i]->buildtime, 580 (configtag->stats.headersourcelistvec)[i]->buildtime,
581 "%m/%d",&strdate); 581 "%m/%d",&strdate);
582 } 582 }
583 if (i < HTMLSTATS_NUM) { 583 if (i < HTMLSTATS_NUM) {
584 // HTML statistics 584 // HTML statistics
585 printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i]); 585 printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i]);
586 fprintf(htmlout, 586 fprintf(htmlout,
587 "<a href=\"%stag=%s&amp;pkg=%s.source\" title=\"%s\">%s %s %s-%s</a>&nbsp;", 587 "<a href=\"%stag=%s&amp;pkg=%s.source\" title=\"%s\">%s %s %s-%s</a>&nbsp;",
588 configtag->configdefaults->url_prefix, 588 configtag->configdefaults->url_prefix,
589 configtag->tag, 589 configtag->tag,
590 (configtag->stats.headersourcelistvec)[i]->name, 590 (configtag->stats.headersourcelistvec)[i]->name,
591 htmlclean((configtag->stats.headersourcelistvec)[i]->summary,buffer,PATH_MAX), 591 htmlclean((configtag->stats.headersourcelistvec)[i]->summary,buffer,PATH_MAX),
592 strdate, 592 strdate,
593 (configtag->stats.headersourcelistvec)[i]->name, 593 (configtag->stats.headersourcelistvec)[i]->name,
594 (configtag->stats.headersourcelistvec)[i]->version, 594 (configtag->stats.headersourcelistvec)[i]->version,
595 (configtag->stats.headersourcelistvec)[i]->release); 595 (configtag->stats.headersourcelistvec)[i]->release);
596 596
597 // FIXME: warnings are printed before SRPMS warning are added below so SRPMS warning are missing in HTML pages 597 // FIXME: warnings are printed before SRPMS warning are added below so SRPMS warning are missing in HTML pages
598 printHTMLWarnings(htmlout,configtag,(configtag->stats.headersourcelistvec)[i],0); 598 printHTMLWarnings(htmlout,configtag,(configtag->stats.headersourcelistvec)[i],0);
599 fprintf(htmlout,"<br>\n"); 599 fprintf(htmlout,"<br>\n");
600 } 600 }
601 601
602 if (i < HTMLOLDSTATS_NUM) { 602 if (i < HTMLOLDSTATS_NUM) {
603 // HTML statistics 603 // HTML statistics
604 simpleTimeToTemplate((configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->buildtime,"%Y/%m/%d",&strolddate); 604 simpleTimeToTemplate((configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->buildtime,"%Y/%m/%d",&strolddate);
605 605
606 fprintf(htmloldout, 606 fprintf(htmloldout,
607 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s %s %s-%s</a><br>\n", 607 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s %s %s-%s</a><br>\n",
608 configtag->configdefaults->url_prefix, 608 configtag->configdefaults->url_prefix,
609 configtag->tag, 609 configtag->tag,
610 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->name, 610 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->name,
611 strolddate, 611 strolddate,
612 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->name, 612 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->name,
613 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->version, 613 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->version,
614 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->release); 614 (configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->release);
615 } 615 }
616 616
617 if (i < RSSSTATS_NUM) { 617 if (i < RSSSTATS_NUM) {
618 // RSS recent packages 618 // RSS recent packages
619 fprintf(rssout," <item>\n"); 619 fprintf(rssout," <item>\n");
620 fprintf(rssout," <title>%s %s %s-%s</title>\n", 620 fprintf(rssout," <title>%s %s %s-%s</title>\n",
621 strdate, 621 strdate,
622 (configtag->stats.headersourcelistvec)[i]->name, 622 (configtag->stats.headersourcelistvec)[i]->name,
623 (configtag->stats.headersourcelistvec)[i]->version, 623 (configtag->stats.headersourcelistvec)[i]->version,
624 (configtag->stats.headersourcelistvec)[i]->release); 624 (configtag->stats.headersourcelistvec)[i]->release);
625 625
626 fprintf(rssout," <link>http://%s%stag=%s&amp;pkg=%s.source</link>\n", 626 fprintf(rssout," <link>http://%s%stag=%s&amp;pkg=%s.source</link>\n",
627 configtag->configdefaults->url_address, 627 configtag->configdefaults->url_address,
628 configtag->configdefaults->url_prefix, 628 configtag->configdefaults->url_prefix,
629 configtag->tag, 629 configtag->tag,
630 (configtag->stats.headersourcelistvec)[i]->name); 630 (configtag->stats.headersourcelistvec)[i]->name);
631 fprintf(rssout," </item>\n"); 631 fprintf(rssout," </item>\n");
632 } 632 }
633 i++; 633 i++;
634 } 634 }
635 635
636 636
637 fclose(htmlout); 637 fclose(htmlout);
638 638
639 // fprintf(rssout, "</feed>\n"); 639 // fprintf(rssout, "</feed>\n");
640 640
641 fprintf(rssout, "</channel>\n"); 641 fprintf(rssout, "</channel>\n");
642 fprintf(rssout, "</rss>\n"); 642 fprintf(rssout, "</rss>\n");
643 fclose(rssout); 643 fclose(rssout);
644 644
645 /* create APT repository file */ 645 /* create APT repository file */
646 snprintf(outfile, PATH_MAX, "%s%s-%s.list", 646 snprintf(outfile, PATH_MAX, "%s%s-%s.list",
647 configtag->html_dir, 647 configtag->html_dir,
648 configtag->configdefaults->distribution_name, 648 configtag->configdefaults->distribution_name,
649 configtag->tag); 649 configtag->tag);
650 650
651 if ((htmlout = fopen(outfile, "w")) == NULL) { 651 if ((htmlout = fopen(outfile, "w")) == NULL) {
652 perror(outfile); 652 perror(outfile);
653 return 1; 653 return 1;
654 } else { 654 } else {
655 655
656 /* remove final slashes from download_prefix as required by apt */ 656 /* remove final slashes from download_prefix as required by apt */
657 strncpy(buffer, configtag->download_dir, PATH_MAX); 657 strncpy(buffer, configtag->download_dir, PATH_MAX);
658 658
659 i=strlen(buffer); 659 i=strlen(buffer);
660 while ((i > 0) && (buffer[i-1] == '/' )) { 660 while ((i > 0) && (buffer[i-1] == '/' )) {
661 buffer[i-1]='\0'; 661 buffer[i-1]='\0';
662 i--; 662 i--;
663 } 663 }
664 664
665 fprintf(htmlout, "#\n# %s %s repository sources list for APT\n#\n\n", 665 fprintf(htmlout, "#\n# %s %s repository sources list for APT\n#\n\n",
666 configtag->configdefaults->distribution_name, 666 configtag->configdefaults->distribution_name,
667 configtag->tag); 667 configtag->tag);
668 fprintf(htmlout, "#\n# %s %s repository from %s\n#\n", 668 fprintf(htmlout, "#\n# %s %s repository from %s\n#\n",
669 configtag->tag, 669 configtag->tag,
670 configtag->arch[arch], 670 configtag->arch[arch],
671 configtag->configdefaults->url_address); 671 configtag->configdefaults->url_address);
672 fprintf(htmlout, "rpm http://%s %s %s\n\n", 672 fprintf(htmlout, "rpm http://%s %s %s\n\n",
673 configtag->configdefaults->url_address, 673 configtag->configdefaults->url_address,
674 buffer, 674 buffer,
675 configtag->arch[arch]); 675 configtag->arch[arch]);
676 fprintf(htmlout, "#\n# %s sources repository from %s\n#\n", 676 fprintf(htmlout, "#\n# %s sources repository from %s\n#\n",
677 configtag->tag, 677 configtag->tag,
678 configtag->configdefaults->url_address); 678 configtag->configdefaults->url_address);
679 fprintf(htmlout, "rpm-src http://%s %s base\n\n", 679 fprintf(htmlout, "rpm-src http://%s %s base\n\n",
680 configtag->configdefaults->url_address, 680 configtag->configdefaults->url_address,
681 buffer); 681 buffer);
682 fclose(htmlout); 682 fclose(htmlout);
683 } 683 }
684 684
685 /* create Smart Package Manager channel file */ 685 /* create Smart Package Manager channel file */
686 snprintf(outfile, PATH_MAX, "%s%s-%s.smart", 686 snprintf(outfile, PATH_MAX, "%s%s-%s.smart",
687 configtag->html_dir, 687 configtag->html_dir,
688 configtag->configdefaults->distribution_name, 688 configtag->configdefaults->distribution_name,
689 configtag->tag); 689 configtag->tag);
690 690
691 if ((htmlout = fopen(outfile, "w")) == NULL) { 691 if ((htmlout = fopen(outfile, "w")) == NULL) {
692 perror(outfile); 692 perror(outfile);
693 return 1; 693 return 1;
694 } else { 694 } else {
695 /* remove final slashes from download_prefix as required by apt */ 695 /* remove final slashes from download_prefix as required by apt */
696 strncpy(buffer, configtag->download_dir, PATH_MAX); 696 strncpy(buffer, configtag->download_dir, PATH_MAX);
697 697
698 i=strlen(buffer); 698 i=strlen(buffer);
699 while ((i > 0) && (buffer[i-1] == '/' )) { 699 while ((i > 0) && (buffer[i-1] == '/' )) {
700 buffer[i-1]='\0'; 700 buffer[i-1]='\0';
701 i--; 701 i--;
702 } 702 }
703 703
704 fprintf(htmlout, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n", 704 fprintf(htmlout, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n",
705 configtag->configdefaults->distribution_name, 705 configtag->configdefaults->distribution_name,
706 configtag->tag); 706 configtag->tag);
707 fprintf(htmlout, "[%s]\ntype = apt-rpm\n", 707 fprintf(htmlout, "[%s]\ntype = apt-rpm\n",
708 configtag->tag); 708 configtag->tag);
709 fprintf(htmlout, "name = %s\n", 709 fprintf(htmlout, "name = %s\n",
710 configtag->description); 710 configtag->description);
711 fprintf(htmlout, "baseurl = http://%s%s\n", 711 fprintf(htmlout, "baseurl = http://%s%s\n",
712 configtag->configdefaults->url_address, buffer); 712 configtag->configdefaults->url_address, buffer);
713 fprintf(htmlout, "components ="); 713 fprintf(htmlout, "components =");
714 for (i = 0; i < ARCHS_MAX; i++) { 714 for (i = 0; i < ARCHS_MAX; i++) {
715 if (configtag->arch[i]) fprintf(htmlout," %s", configtag->arch[i]); 715 if (configtag->arch[i]) fprintf(htmlout," %s", configtag->arch[i]);
716 } 716 }
717 fprintf(htmlout, "\n"); 717 fprintf(htmlout, "\n");
718 fclose(htmlout); 718 fclose(htmlout);
719 } 719 }
720 720
721 /* create Changelog page */ 721 /* create Changelog page */
722 struct tm tmdate; 722 struct tm tmdate;
723 tmdate.tm_min = 0; 723 tmdate.tm_min = 0;
724 tmdate.tm_hour = 0; 724 tmdate.tm_hour = 0;
725 tmdate.tm_sec = 0; 725 tmdate.tm_sec = 0;
726 tmdate.tm_year = 90; 726 tmdate.tm_year = 90;
727 tmdate.tm_mday = 1; 727 tmdate.tm_mday = 1;
728 tmdate.tm_mon = 0; 728 tmdate.tm_mon = 0;
729 729
730 snprintf(outfile, PATH_MAX, "%s_changelog.inc", configtag->html_dir); 730 snprintf(outfile, PATH_MAX, "%s_changelog.inc", configtag->html_dir);
731 731
732 if ((htmlout = fopen(outfile, "w")) == NULL) { 732 if ((htmlout = fopen(outfile, "w")) == NULL) {
733 perror(outfile); 733 perror(outfile);
734 return 1; 734 return 1;
735 } 735 }
736 736
737 fprintf(htmlout, 737 fprintf(htmlout,
738 "<h1>Changelog for the <b>%s</b> repository (%s):</h1>\n", 738 "<h1>Changelog for the <b>%s</b> repository (%s):</h1>\n",
739 configtag->tag, 739 configtag->tag,
740 configtag->description); 740 configtag->description);
741 741
742 printChangelogSince(htmlout, configtag, &tmdate, 1); 742 printChangelogSince(htmlout, configtag, &tmdate, 1);
743 743
744 fclose(htmlout); 744 fclose(htmlout);
745 return 0; 745 return 0;
746 } 746 }
747 747
748 int 748 int
749 generateHTMLMainIndex(struct configTag *configtag) 749 generateHTMLMainIndex(struct configTag *configtag)
750 { 750 {
751 char indexfile[PATH_MAX],smartfile[PATH_MAX],buffer[PATH_MAX],smartpyfile[PATH_MAX]; 751 char indexfile[PATH_MAX],smartfile[PATH_MAX],buffer[PATH_MAX],smartpyfile[PATH_MAX];
752 FILE *fout,*fsmart,*fsmartpy; 752 FILE *fout,*fsmart,*fsmartpy;
753 int i; 753 int i;
754 754
755 if (!configtag->configdefaults->html_basedir) { 755 if (!configtag->configdefaults->html_basedir) {
756 return 2; 756 return 2;
757 } 757 }
758 758
759 strncpy(indexfile, configtag->configdefaults->html_basedir, PATH_MAX); 759 strncpy(indexfile, configtag->configdefaults->html_basedir, PATH_MAX);
760 strncat(indexfile, "_index.inc", sizeof(indexfile) - strlen(indexfile)); 760 strncat(indexfile, "_index.inc", sizeof(indexfile) - strlen(indexfile));
761 761
762 if ((fout = fopen(indexfile, "w")) == NULL) { 762 if ((fout = fopen(indexfile, "w")) == NULL) {
763 perror(indexfile); 763 perror(indexfile);
764 return 1; 764 return 1;
765 } 765 }
766 766
767 /* create Smart Package Manager channel files */ 767 /* create Smart Package Manager channel files */
768 snprintf(smartfile,PATH_MAX,"%s%s.smart", 768 snprintf(smartfile,PATH_MAX,"%s%s.smart",
769 configtag->configdefaults->html_basedir, 769 configtag->configdefaults->html_basedir,
770 configtag->configdefaults->distribution_name); 770 configtag->configdefaults->distribution_name);
771 snprintf(smartpyfile,PATH_MAX,"%s%s.smart.py", 771 snprintf(smartpyfile,PATH_MAX,"%s%s.smart.py",
772 configtag->configdefaults->html_basedir, 772 configtag->configdefaults->html_basedir,
773 configtag->configdefaults->distribution_name); 773 configtag->configdefaults->distribution_name);
774 774
775 if ((fsmart = fopen(smartfile, "w")) == NULL) { 775 if ((fsmart = fopen(smartfile, "w")) == NULL) {
776 perror(smartfile); 776 perror(smartfile);
777 return 1; 777 return 1;
778 } 778 }
779 if ((fsmartpy = fopen(smartpyfile, "w")) == NULL) { 779 if ((fsmartpy = fopen(smartpyfile, "w")) == NULL) {
780 perror(smartpyfile); 780 perror(smartpyfile);
781 return 1; 781 return 1;
782 } 782 }
783 783
784 fprintf(fout,"<b>Available repositories:</b><br><br>\n"); 784 fprintf(fout,"<b>Available repositories:</b><br><br>\n");
785 while (configtag) { 785 while (configtag) {
786 786
787 fprintf(fout, 787 fprintf(fout,
788 "<a href=\"%stag=%s\">%s</a>: %s<br>", 788 "<a href=\"%stag=%s\">%s</a>: %s<br>",
789 configtag->configdefaults->url_prefix, 789 configtag->configdefaults->url_prefix,
790 configtag->tag, 790 configtag->tag,
791 configtag->tag, 791 configtag->tag,
792 configtag->description); 792 configtag->description);
793 793
794 /* remove final slashes from download_prefix as required by apt */ 794 /* remove final slashes from download_prefix as required by apt */
795 strncpy(buffer, configtag->download_dir, PATH_MAX); 795 strncpy(buffer, configtag->download_dir, PATH_MAX);
796 i=strlen(buffer); 796 i=strlen(buffer);
797 while ((i > 0) && (buffer[i-1] == '/' )) { 797 while ((i > 0) && (buffer[i-1] == '/' )) {
798 buffer[i-1]='\0'; 798 buffer[i-1]='\0';
799 i--; 799 i--;
800 } 800 }
801 fprintf(fsmart, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n", 801 fprintf(fsmart, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n",
802 configtag->configdefaults->distribution_name, 802 configtag->configdefaults->distribution_name,
803 configtag->tag); 803 configtag->tag);
804 fprintf(fsmart, "[%s]\ntype = apt-rpm\n", 804 fprintf(fsmart, "[%s]\ntype = apt-rpm\n",
805 configtag->tag); 805 configtag->tag);
806 fprintf(fsmart, "name = %s\n", 806 fprintf(fsmart, "name = %s\n",
807 configtag->description); 807 configtag->description);
808 fprintf(fsmart, "disabled = yes\n"); 808 fprintf(fsmart, "disabled = yes\n");
809 fprintf(fsmart, "baseurl = http://%s%s\n", 809 fprintf(fsmart, "baseurl = http://%s%s\n",
810 configtag->configdefaults->url_address, buffer); 810 configtag->configdefaults->url_address, buffer);
811 fprintf(fsmart, "components = %s\n\n", 811 fprintf(fsmart, "components = %s\n\n",
812 configtag->arch[0]); 812 configtag->arch[0]);
813 fprintf(fsmartpy, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n", 813 fprintf(fsmartpy, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n",
814 configtag->configdefaults->distribution_name, 814 configtag->configdefaults->distribution_name,
815 configtag->tag); 815 configtag->tag);
816 fprintf(fsmartpy, "if not sysconf.get((\"channels\", \"%s\")):\n", 816 fprintf(fsmartpy, "if not sysconf.get((\"channels\", \"%s\")):\n",
817 configtag->tag); 817 configtag->tag);
818 fprintf(fsmartpy, "\tsysconf.set((\"channels\", \"%s\"),\n", 818 fprintf(fsmartpy, "\tsysconf.set((\"channels\", \"%s\"),\n",
819 configtag->tag); 819 configtag->tag);
820 fprintf(fsmartpy, "\t\t\t{\"alias\": \"%s\",\n", 820 fprintf(fsmartpy, "\t\t\t{\"alias\": \"%s\",\n",
821 configtag->tag); 821 configtag->tag);
822 fprintf(fsmartpy, "\t\t\t\"type\": \"apt-rpm\",\n"); 822 fprintf(fsmartpy, "\t\t\t\"type\": \"apt-rpm\",\n");
823 fprintf(fsmartpy, "\t\t\t\"name\": \"%s\",\n", 823 fprintf(fsmartpy, "\t\t\t\"name\": \"%s\",\n",
824 configtag->description); 824 configtag->description);
825 fprintf(fsmartpy, "\t\t\t\"disabled\": \"yes\",\n"); 825 fprintf(fsmartpy, "\t\t\t\"disabled\": \"yes\",\n");
826 fprintf(fsmartpy, "\t\t\t\"baseurl\": \"http://%s%s\",\n", 826 fprintf(fsmartpy, "\t\t\t\"baseurl\": \"http://%s%s\",\n",
827 configtag->configdefaults->url_address, buffer); 827 configtag->configdefaults->url_address, buffer);
828 fprintf(fsmartpy, "\t\t\t\"components\": \"%s\"})\n\n", 828 fprintf(fsmartpy, "\t\t\t\"components\": \"%s\"})\n\n",
829 configtag->arch[0]); 829 configtag->arch[0]);
830 830
831 configtag = configtag->next; 831 configtag = configtag->next;
832 832
833 } 833 }
834 fclose(fout); 834 fclose(fout);
835 fclose(fsmart); 835 fclose(fsmart);
836 fclose(fsmartpy); 836 fclose(fsmartpy);
837 837
838 return 0; 838 return 0;
839 } 839 }
840 840
841 int 841 int
842 generateHTML_SRPMSFiles(struct configTag *configtag) 842 generateHTML_SRPMSFiles(struct configTag *configtag)
843 { 843 {
844 844
845 humanDate strdate; 845 humanDate strdate;
846 char indexfile[PATH_MAX]; 846 char indexfile[PATH_MAX];
847 char htmlfile[PATH_MAX]; 847 char htmlfile[PATH_MAX];
848 char warningsdir[PATH_MAX]; 848 char warningsdir[PATH_MAX];
849 char buffer[PATH_MAX],buffer2[PATH_MAX]; 849 char buffer[PATH_MAX],buffer2[PATH_MAX];
850 int c,i,j,arch,idx; 850 int c,i,j,arch,idx;
851 char *st; 851 char *st;
852 char curr_letter,curr_anchor ='a'-1; 852 char curr_letter,curr_anchor ='a'-1;
853 FILE *findexout[ARCHS_MAX+1], *fout; 853 FILE *findexout[ARCHS_MAX+1], *fout;
854 struct changeLog *currchangelog; 854 struct changeLog *currchangelog;
855 struct headerSourceList *currheadersourcelist; 855 struct headerSourceList *currheadersourcelist;
856 struct headerList *currchild; 856 struct headerList *currchild;
857 struct stat buf; 857 struct stat buf;
858 sizeString strsize; 858 sizeString strsize;
859 859
860 // create packages directory 860 // create packages directory
861 snprintf(buffer,PATH_MAX,"%spackages",configtag->html_dir); 861 snprintf(buffer,PATH_MAX,"%spackages",configtag->html_dir);
862 if (stat(buffer,&buf)) { 862 if (stat(buffer,&buf)) {
863 if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { 863 if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
864 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer); 864 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer);
865 exit(1); 865 exit(1);
866 } 866 }
867 } else { 867 } else {
868 if (!S_ISDIR(buf.st_mode)) { 868 if (!S_ISDIR(buf.st_mode)) {
869 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer); 869 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer);
870 exit(1); 870 exit(1);
871 } 871 }
872 } 872 }
873 873
874 // write an empty index.html file to avoid directory files browsing 874 // write an empty index.html file to avoid directory files browsing
875 snprintf(indexfile,PATH_MAX,"%sindex.html",configtag->html_dir); 875 snprintf(indexfile,PATH_MAX,"%sindex.html",configtag->html_dir);
876 876
877 if ((fout = fopen(indexfile, "w")) == NULL) { 877 if ((fout = fopen(indexfile, "w")) == NULL) {
878 perror(indexfile); 878 perror(indexfile);
879 return 1; 879 return 1;
880 } 880 }
881 fclose(fout); 881 fclose(fout);
882 882
883 // create warnings directory 883 // create warnings directory
884 snprintf(warningsdir,PATH_MAX,"%swarnings",configtag->html_dir); 884 snprintf(warningsdir,PATH_MAX,"%swarnings",configtag->html_dir);
885 if (stat(warningsdir,&buf)) { 885 if (stat(warningsdir,&buf)) {
886 if (mkdir(warningsdir,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { 886 if (mkdir(warningsdir,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
887 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",warningsdir); 887 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",warningsdir);
888 exit(1); 888 exit(1);
889 } 889 }
890 } else { 890 } else {
891 if (!S_ISDIR(buf.st_mode)) { 891 if (!S_ISDIR(buf.st_mode)) {
892 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",warningsdir); 892 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",warningsdir);
893 exit(1); 893 exit(1);
894 } 894 }
895 } 895 }
896 896
897 /* open full SRPM index file */ 897 /* open full SRPM index file */
898 snprintf(indexfile,PATH_MAX,"%s_index.inc",configtag->html_dir); 898 snprintf(indexfile,PATH_MAX,"%s_index.inc",configtag->html_dir);
899 if ((findexout[0] = fopen(indexfile, "w")) == NULL) { 899 if ((findexout[0] = fopen(indexfile, "w")) == NULL) {
900 perror(indexfile); 900 perror(indexfile);
901 return 1; 901 return 1;
902 } 902 }
903 903
904 /* open arch specific SRPM index files */ 904 /* open arch specific SRPM index files */
905 for (arch = 0; arch < ARCHS_MAX; arch++) { 905 for (arch = 0; arch < ARCHS_MAX; arch++) {
906 if (configtag->arch[arch]) { 906 if (configtag->arch[arch]) {
907 snprintf(indexfile,PATH_MAX,"%s_index-%s.inc",configtag->html_dir,configtag->arch[arch]); 907 snprintf(indexfile,PATH_MAX,"%s_index-%s.inc",configtag->html_dir,configtag->arch[arch]);
908 if ((findexout[arch+1] = fopen(indexfile, "w")) == NULL) { 908 if ((findexout[arch+1] = fopen(indexfile, "w")) == NULL) {
909 perror(indexfile); 909 perror(indexfile);
910 return 1; 910 return 1;
911 } 911 }
912 } else { 912 } else {
913 findexout[arch+1] = NULL; 913 findexout[arch+1] = NULL;
914 } 914 }
915 } 915 }
916 916
917 for (arch = 0; arch < ARCHS_MAX + 1 && findexout[arch]; arch++) { 917 for (arch = 0; arch < ARCHS_MAX + 1 && findexout[arch]; arch++) {
918 fprintf(findexout[arch], 918 fprintf(findexout[arch],
919 "<h1><b>%s</b> - %s</h1>\n", 919 "<h1><b>%s</b> - %s</h1>\n",
920 configtag->tag, 920 configtag->tag,
921 configtag->description); 921 configtag->description);
922 if (configtag->repository_level > 0) { 922 if (configtag->repository_level > 0) {
923 fprintf(findexout[arch],"<h2>Depends on:</h2> "); 923 fprintf(findexout[arch],"<h2>Depends on:</h2> ");
924 for (c=0; c < configtag->repository_level; c++) { 924 for (c=0; c < configtag->repository_level; c++) {
925 fprintf(findexout[arch],"<a href=\"%stag=%s\">%s</a>&nbsp;- %s<br>", 925 fprintf(findexout[arch],"<a href=\"%stag=%s\">%s</a>&nbsp;- %s<br>",
926 configtag->configdefaults->url_prefix, 926 configtag->configdefaults->url_prefix,
927 configtag->repository[c]->tag, 927 configtag->repository[c]->tag,
928 configtag->repository[c]->tag, 928 configtag->repository[c]->tag,
929 configtag->repository[c]->description); 929 configtag->repository[c]->description);
930 } 930 }
931 fprintf(findexout[arch],"\n"); 931 fprintf(findexout[arch],"\n");
932 } 932 }
933 fprintf(findexout[arch], 933 fprintf(findexout[arch],
934 "<br><h2>List of packages:</h2>\n[ "); 934 "<br><h2>List of packages:</h2>\n[ ");
935 // <th width=18></th><th nowrap align=left><b>Source</b></th><th nowrap align=left><b>Release</b></th><th width=100%% nowrap align=left><b>Builds</b></th></tr>\n"); 935 // <th width=18></th><th nowrap align=left><b>Source</b></th><th nowrap align=left><b>Release</b></th><th width=100%% nowrap align=left><b>Builds</b></th></tr>\n");
936 936
937 for (c='a'; c <= 'z'; c++) { 937 for (c='a'; c <= 'z'; c++) {
938 fprintf(findexout[arch],"<a href=\"#%c\">%c</a>&nbsp;&nbsp;",c,c); 938 fprintf(findexout[arch],"<a href=\"#%c\">%c</a>&nbsp;&nbsp;",c,c);
939 } 939 }
940 fprintf(findexout[arch]," ]<br><br><table>\n"); 940 fprintf(findexout[arch]," ]<br><br><table>\n");
941 } 941 }
942 942
943 currheadersourcelist = configtag->headersourcelist; 943 currheadersourcelist = configtag->headersourcelist;
944 944
945 while (currheadersourcelist) { 945 while (currheadersourcelist) {
946 if ((configtag->repository_level == 0) || 946 if ((configtag->repository_level == 0) ||
947 (currheadersourcelist->altrepository == configtag->repository_level)) { 947 (currheadersourcelist->altrepository == configtag->repository_level)) {
948 948
949 curr_letter=currheadersourcelist->name[0]; 949 curr_letter=currheadersourcelist->name[0];
950 if (curr_letter >= 'A' && curr_letter <= 'Z') curr_letter=curr_letter+'a'-'A'; 950 if (curr_letter >= 'A' && curr_letter <= 'Z') curr_letter=curr_letter+'a'-'A';
951 951
952 snprintf(htmlfile,PATH_MAX,"%spackages/%s.source.inc",configtag->html_dir,currheadersourcelist->name); 952 snprintf(htmlfile,PATH_MAX,"%spackages/%s.source.inc",configtag->html_dir,currheadersourcelist->name);
953 953
954 if ((fout = fopen(htmlfile, "w")) == NULL) { 954 if ((fout = fopen(htmlfile, "w")) == NULL) {
955 perror(htmlfile); 955 perror(htmlfile);
956 return 1; 956 return 1;
957 } 957 }
958 958
959 get_favicon_from_url(currheadersourcelist->url, buffer2, PATH_MAX); 959 get_favicon_from_url(currheadersourcelist->url, buffer2, PATH_MAX);
960 960
961 fprintf(fout, 961 fprintf(fout,
962 "<h1><img src=\"%s\" width=\"16\" height=\"16\">" 962 "<h1><img src=\"%s\" width=\"16\" height=\"16\">"
963 "&nbsp;%s: %s (source)</h1><table class=\"pkgpage\" width=\"100%%\">\n", 963 "&nbsp;%s: %s (source)</h1><table class=\"pkgpage\" width=\"100%%\">\n",
964 buffer2, 964 buffer2,
965 currheadersourcelist->name, 965 currheadersourcelist->name,
966 htmlclean(currheadersourcelist->summary,buffer,PATH_MAX)); 966 htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));
967 967
968 fprintf(fout,"<p>"); 968 fprintf(fout,"<p>");
969 printHTMLWarnings(fout,configtag,currheadersourcelist,1); 969 printHTMLWarnings(fout,configtag,currheadersourcelist,1);
970 970
971 fprintf(fout, 971 fprintf(fout,
972 "<tr><td width=\"25%%\">Name:</td><td><b>%s</b></td></tr>\n", 972 "<tr><td width=\"25%%\">Name:</td><td><b>%s</b></td></tr>\n",
973 currheadersourcelist->name); 973 currheadersourcelist->name);
974 if (currheadersourcelist->epoch > 0) { 974 if (currheadersourcelist->epoch > 0) {
975 fprintf(fout, 975 fprintf(fout,
976 "<tr><td>Release:</td><td><b>%ld:%s-%s</b></td></tr>\n", 976 "<tr><td>Release:</td><td><b>%ld:%s-%s</b></td></tr>\n",
977 currheadersourcelist->epoch, 977 currheadersourcelist->epoch,
978 currheadersourcelist->version, 978 currheadersourcelist->version,
979 currheadersourcelist->release); 979 currheadersourcelist->release);
980 } else { 980 } else {
981 fprintf(fout, 981 fprintf(fout,
982 "<tr><td>Release:</td><td><b>%s-%s</b></td></tr>\n", 982 "<tr><td>Release:</td><td><b>%s-%s</b></td></tr>\n",
983 currheadersourcelist->version, 983 currheadersourcelist->version,
984 currheadersourcelist->release); 984 currheadersourcelist->release);
985 } 985 }
986 /* fprintf(fout, 986 /* fprintf(fout,
987 "<tr><td>Summary:</td><td><b>%s</b></td></tr>\n", 987 "<tr><td>Summary:</td><td><b>%s</b></td></tr>\n",
988 htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));*/ 988 htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));*/
989 fprintf(fout, 989 fprintf(fout,
990 "<tr><td>Group:</td><td><a href=\"%stag=%s&amp;group=%s\">%s</a></td></tr>\n", 990 "<tr><td>Group:</td><td><a href=\"%stag=%s&amp;group=%s\">%s</a></td></tr>\n",
991 configtag->configdefaults->url_prefix, 991 configtag->configdefaults->url_prefix,
992 configtag->tag, 992 configtag->tag,
993 groupdirname(currheadersourcelist->group, buffer2, PATH_MAX), 993 groupdirname(currheadersourcelist->group, buffer2, PATH_MAX),
994 htmlclean(currheadersourcelist->group,buffer,PATH_MAX)); 994 htmlclean(currheadersourcelist->group,buffer,PATH_MAX));
995 995
996 fprintf(fout, 996 fprintf(fout,
997 "<tr><td>Maintainer:</td><td>"); 997 "<tr><td>Maintainer:</td><td>");
998 998
999 if (currheadersourcelist->packager && 999 if (currheadersourcelist->packager &&
1000 (currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) { 1000 (currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) {
1001 fprintf(fout, 1001 fprintf(fout,
1002 "<a href=\"%stag=%s&amp;maintainer=%s\">%s</a></td></tr>\n", 1002 "<a href=\"%stag=%s&amp;maintainer=%s\">%s</a></td></tr>\n",
1003 configtag->configdefaults->url_prefix, 1003 configtag->configdefaults->url_prefix,
1004 configtag->tag, 1004 configtag->tag,
1005 currheadersourcelist->packager->name, 1005 currheadersourcelist->packager->name,
1006 currheadersourcelist->packager->name); 1006 currheadersourcelist->packager->name);
1007 // currheadersourcelist->packager->packages_count++; 1007 // currheadersourcelist->packager->packages_count++;
1008 } else 1008 } else
1009 fprintf(fout, 1009 fprintf(fout,
1010 "<a href=\"%stag=%s&amp;maintainer=unmaintained\"><b>unmaintained</b></a></td></tr>\n", 1010 "<a href=\"%stag=%s&amp;maintainer=unmaintained\"><b>unmaintained</b></a></td></tr>\n",
1011 configtag->configdefaults->url_prefix, 1011 configtag->configdefaults->url_prefix,
1012 configtag->tag); 1012 configtag->tag);
1013 1013
1014 fprintf(fout, 1014 fprintf(fout,
1015 "<tr><td>Description:</td><td><font size=\"-1\">%s</font></td></tr>\n", 1015 "<tr><td>Description:</td><td><font size=\"-1\">%s</font></td></tr>\n",
1016 htmlclean(currheadersourcelist->description,buffer,PATH_MAX)); 1016 htmlclean(currheadersourcelist->description,buffer,PATH_MAX));
1017 fprintf(fout, 1017 fprintf(fout,
1018 "<tr><td>License:</td><td><font size=\"-1\">%s</font></td></tr>\n", 1018 "<tr><td>License:</td><td><font size=\"-1\">%s</font></td></tr>\n",
1019 currheadersourcelist->license); 1019 currheadersourcelist->license);
1020 fprintf(fout, 1020 fprintf(fout,
1021 "<tr><td>Size:</td><td><font size=\"-1\">%s</font></td></tr>\n", 1021 "<tr><td>Size:</td><td><font size=\"-1\">%s</font></td></tr>\n",
1022 humanSize(currheadersourcelist->size, &strsize)); 1022 humanSize(currheadersourcelist->size, &strsize));
1023 1023
1024 if (configtag->download_prefix) { 1024 if (configtag->download_prefix) {
1025 1025
1026 fprintf(fout,"<tr><td>Download:</td><td><font size=\"-1\">"); 1026 fprintf(fout,"<tr><td>Download:</td><td><font size=\"-1\">");
1027 1027
1028 fprintf(fout,"<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\">%s-%s-%s.src.rpm</a>", 1028 fprintf(fout,"<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\">%s-%s-%s.src.rpm</a>",
1029 configtag->download_prefix, 1029 configtag->download_prefix,
1030 configtag->download_dir, 1030 configtag->download_dir,
1031 currheadersourcelist->name, 1031 currheadersourcelist->name,
1032 currheadersourcelist->version, 1032 currheadersourcelist->version,
1033 currheadersourcelist->release, 1033 currheadersourcelist->release,
1034 currheadersourcelist->name, 1034 currheadersourcelist->name,
1035 currheadersourcelist->version, 1035 currheadersourcelist->version,
1036 currheadersourcelist->release); 1036 currheadersourcelist->release);
1037 fprintf(fout,"</font></td></tr>\n"); 1037 fprintf(fout,"</font></td></tr>\n");
1038 } 1038 }
1039 1039
1040 if (currheadersourcelist->url) 1040 if (currheadersourcelist->url)
1041 fprintf(fout, 1041 fprintf(fout,
1042 "<tr><td>URL:</td><td><font size=\"-1\"><a href=\"%s\" target=\"_new\">%s</a></font></td></tr>\n", 1042 "<tr><td>URL:</td><td><font size=\"-1\"><a href=\"%s\" target=\"_new\">%s</a></font></td></tr>\n",
1043 currheadersourcelist->url, 1043 currheadersourcelist->url,
1044 currheadersourcelist->url); 1044 currheadersourcelist->url);
1045 1045
1046 fprintf(fout, 1046 fprintf(fout,
1047 "<tr><td>Specfile:</td><td><font size=\"-1\"><a href=\"%s%s/specs/%s.spec\">%s.spec</a>", 1047 "<tr><td>Specfile:</td><td><font size=\"-1\"><a href=\"%s%s/specs/%s.spec\">%s.spec</a>",
1048 configtag->showfile_prefix, 1048 configtag->showfile_prefix,
1049 configtag->download_dir, 1049 configtag->download_dir,
1050 currheadersourcelist->name, 1050 currheadersourcelist->name,
1051 currheadersourcelist->name); 1051 currheadersourcelist->name);
1052 1052
1053 if (currheadersourcelist->source) { 1053 if (currheadersourcelist->source) {
1054 fprintf(fout,"<tr><td>Sources:</td><td><font size=\"-1\">"); 1054 fprintf(fout,"<tr><td>Sources:</td><td><font size=\"-1\">");
1055 1055
1056 i=0; 1056 i=0;
1057 while (currheadersourcelist->source[i+1]) i++; 1057 while (currheadersourcelist->source[i+1]) i++;
1058 1058
1059 for (; i>=0; i--) 1059 for (; i>=0; i--)
1060 fprintf(fout,"%s ",currheadersourcelist->source[i]); 1060 fprintf(fout,"%s ",currheadersourcelist->source[i]);
1061 1061
1062 fprintf(fout,"</font></td></tr>\n"); 1062 fprintf(fout,"</font></td></tr>\n");
1063 } 1063 }
1064 1064
1065 if (currheadersourcelist->patch) { 1065 if (currheadersourcelist->patch) {
1066 fprintf(fout,"<tr><td>Patches:</td><td><font size=\"-1\">"); 1066 fprintf(fout,"<tr><td>Patches:</td><td><font size=\"-1\">");
1067 1067
1068 i=0; 1068 i=0;
1069 while (currheadersourcelist->patch[i+1]) i++; 1069 while (currheadersourcelist->patch[i+1]) i++;
1070 1070
1071 for (; i>=0; i--) 1071 for (; i>=0; i--)
1072 // fprintf(fout,"%s ",currheadersourcelist->patch[i]); 1072 // fprintf(fout,"%s ",currheadersourcelist->patch[i]);
1073 fprintf(fout,"<a href=\"%s%s/patches/%s\">%s</a>&nbsp;", 1073 fprintf(fout,"<a href=\"%s%s/patches/%s\">%s</a>&nbsp;",
1074 configtag->showfile_prefix, 1074 configtag->showfile_prefix,
1075 configtag->download_dir, 1075 configtag->download_dir,
1076 currheadersourcelist->patch[i], 1076 currheadersourcelist->patch[i],
1077 currheadersourcelist->patch[i]); 1077 currheadersourcelist->patch[i]);
1078 1078
1079 fprintf(fout,"</font></td></tr>\n"); 1079 fprintf(fout,"</font></td></tr>\n");
1080 } 1080 }
1081 1081
1082 fprintf(fout, 1082 fprintf(fout,
1083 "<tr><td>Build time:</td><td><font size=\"-1\">%s</font></td></tr>\n", 1083 "<tr><td>Build time:</td><td><font size=\"-1\">%s</font></td></tr>\n",
1084 *simpleTimeToHuman(currheadersourcelist->buildtime, 1084 *simpleTimeToHuman(currheadersourcelist->buildtime,
1085 & strdate)); 1085 & strdate));
1086 1086
1087 for (idx = 0; idx < ARCHS_MAX + 1; idx++) { 1087 for (idx = 0; idx < ARCHS_MAX + 1; idx++) {
1088 if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue; 1088 if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue;
1089 if (curr_anchor < curr_letter) { 1089 if (curr_anchor < curr_letter) {
1090 fprintf(findexout[idx],"<tr><td>"); 1090 fprintf(findexout[idx],"<tr><td>");
1091 while (curr_anchor < curr_letter) { 1091 while (curr_anchor < curr_letter) {
1092 curr_anchor += 1; 1092 curr_anchor += 1;
1093 fprintf(findexout[idx],"<a name=\"%c\"></a>",curr_anchor); 1093 fprintf(findexout[idx],"<a name=\"%c\"></a>",curr_anchor);
1094 } 1094 }
1095 fprintf(findexout[idx],"</td></tr>"); 1095 fprintf(findexout[idx],"</td></tr>");
1096 } 1096 }
1097 fprintf(findexout[idx],"<tr><td>"); 1097 fprintf(findexout[idx],"<tr><td>");
1098 printpkgicon(findexout[idx], configtag, currheadersourcelist); 1098 printpkgicon(findexout[idx], configtag, currheadersourcelist);
1099 fprintf(findexout[idx],"</td><td><b>%s</b>: <i>%s</i>",currheadersourcelist->name,htmlclean(currheadersourcelist->summary,buffer,PATH_MAX)); 1099 fprintf(findexout[idx],"</td><td><b>%s</b>: <i>%s</i>",currheadersourcelist->name,htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));
1100 st=strstr(currheadersourcelist->url,"://"); 1100 st=strstr(currheadersourcelist->url,"://");
1101 if (st) { 1101 if (st) {
1102 strncpy(buffer,st+3,PATH_MAX); 1102 strncpy(buffer,st+3,PATH_MAX);
1103 st=strchr(buffer,'/'); 1103 st=strchr(buffer,'/');
1104 if (st) st[0]='\0'; 1104 if (st) st[0]='\0';
1105 fprintf(findexout[idx], 1105 fprintf(findexout[idx],
1106 " <a href=\"%s\" target=\"_new\"><img src=\"%s/external.png\" title=\"%s\" ></a>", 1106 " <a href=\"%s\" target=\"_new\"><img src=\"%s/external.png\" title=\"%s\" ></a>",
1107 currheadersourcelist->url, 1107 currheadersourcelist->url,
1108 configtag->configdefaults->url_dir, 1108 configtag->configdefaults->url_dir,
1109 buffer); 1109 buffer);
1110 } 1110 }
1111 fprintf(findexout[idx],"</td></tr><tr><td></td><td><i>"); 1111 fprintf(findexout[idx],"</td></tr><tr><td></td><td><i>");
1112 1112
1113 if (currheadersourcelist->epoch) { 1113 if (currheadersourcelist->epoch) {
1114 fprintf(findexout[idx],"%ld:%s-%s", 1114 fprintf(findexout[idx],"%ld:%s-%s",
1115 currheadersourcelist->epoch, 1115 currheadersourcelist->epoch,
1116 currheadersourcelist->version, 1116 currheadersourcelist->version,
1117 currheadersourcelist->release); 1117 currheadersourcelist->release);
1118 1118
1119 } else { 1119 } else {
1120 fprintf(findexout[idx], 1120 fprintf(findexout[idx],
1121 "%s-%s", 1121 "%s-%s",
1122 currheadersourcelist->version, 1122 currheadersourcelist->version,
1123 currheadersourcelist->release); 1123 currheadersourcelist->release);
1124 } 1124 }
1125 1125
1126 fprintf(findexout[idx]," - "); 1126 fprintf(findexout[idx]," - ");
1127 } 1127 }
1128 1128
1129 fprintf(fout,"<tr><td>Built RPMS:</td><td><font size=\"-1\">"); 1129 fprintf(fout,"<tr><td>Built RPMS:</td><td><font size=\"-1\">");
1130 for (arch = 0; arch < ARCHS_MAX && configtag->arch[arch]; arch++) { 1130 for (arch = 0; arch < ARCHS_MAX && configtag->arch[arch]; arch++) {
1131 /* write children to both fout and findexout */ 1131 /* write children to both fout and findexout */
1132 currchild = currheadersourcelist->firstchild[arch]; 1132 currchild = currheadersourcelist->firstchild[arch];
1133 1133
1134 c = 0; 1134 c = 0;
1135 while (currchild) { 1135 while (currchild) {
1136 for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { 1136 for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) {
1137 if ((idx > 0) && ((!configtag->arch[idx-1]) || (arch != idx -1))) continue; 1137 if ((idx > 0) && ((!configtag->arch[idx-1]) || (arch != idx -1))) continue;
1138 fprintf(findexout[idx], 1138 fprintf(findexout[idx],
1139 "<a href=\"%stag=%s&amp;pkg=%s.%s\">%s(%s)</a><a href=\"apt:%s\"><img src=\"%s/pkg.png\" title=\"Install\" ></a> ", 1139 "<a href=\"%stag=%s&amp;pkg=%s.%s\">%s(%s)</a><a href=\"apt:%s\"><img src=\"%s/pkg.png\" title=\"Install\" ></a> ",
1140 configtag->configdefaults->url_prefix, 1140 configtag->configdefaults->url_prefix,
1141 configtag->tag, currchild->name, configtag->arch[arch], 1141 configtag->tag, currchild->name, configtag->arch[arch],
1142 currchild->name, configtag->arch[arch], 1142 currchild->name, configtag->arch[arch],
1143 currchild->name, 1143 currchild->name,
1144 configtag->configdefaults->url_dir); 1144 configtag->configdefaults->url_dir);
1145 } 1145 }
1146 fprintf(fout, 1146 fprintf(fout,
1147 "<a href=\"%stag=%s&amp;pkg=%s.%s\">%s(%s)</a> ", 1147 "<a href=\"%stag=%s&amp;pkg=%s.%s\">%s(%s)</a> ",
1148 configtag->configdefaults->url_prefix, 1148 configtag->configdefaults->url_prefix,
1149 configtag->tag, currchild->name, configtag->arch[arch], 1149 configtag->tag, currchild->name, configtag->arch[arch],
1150 currchild->name, configtag->arch[arch]); 1150 currchild->name, configtag->arch[arch]);
1151 1151
1152 currchild = currchild->nextbrother; 1152 currchild = currchild->nextbrother;
1153 c++; 1153 c++;
1154 } 1154 }
1155 } 1155 }
1156 fprintf(fout, "</font></td></tr>\n"); 1156 fprintf(fout, "</font></td></tr>\n");
1157 1157
1158 for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { 1158 for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) {
1159 if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue; 1159 if ((idx > 0) && ((!configtag->arch[idx-1]) || (!currheadersourcelist->firstchild[idx-1]))) continue;
1160 fprintf(findexout[idx], 1160 fprintf(findexout[idx],
1161 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s(source)</a></td></tr><tr><td colspan=2><hr></td></tr>\n", 1161 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s(source)</a></td></tr><tr><td colspan=2><hr></td></tr>\n",
1162 configtag->configdefaults->url_prefix, 1162 configtag->configdefaults->url_prefix,
1163 configtag->tag, 1163 configtag->tag,
1164 currheadersourcelist->name, 1164 currheadersourcelist->name,
1165 currheadersourcelist->name); 1165 currheadersourcelist->name);
1166 } 1166 }
1167 1167
1168 /* list build requirements */ 1168 /* list build requirements */
1169 fprintf(fout, "<tr><td nowrap>Build requirements:</td><td><font size=\"-1\">"); 1169 fprintf(fout, "<tr><td nowrap>Build requirements:</td><td><font size=\"-1\">");
1170 1170
1171 for (i = 0; i < currheadersourcelist->requirecount; i++) { 1171 for (i = 0; i < currheadersourcelist->requirecount; i++) {
1172 if (currheadersourcelist->require[i]->resolved) { 1172 if (currheadersourcelist->require[i]->resolved) {
1173 if (currheadersourcelist->require[i]->resolved->numbuildproviders == 0) { 1173 if (currheadersourcelist->require[i]->resolved->numbuildproviders == 0) {
1174 // missing provider 1174 // missing provider
1175 fprintf(fout,"<b>%s(unresolved)</b>",currheadersourcelist->require[i]->resolved->name); 1175 fprintf(fout,"<b>%s(unresolved)</b>",currheadersourcelist->require[i]->resolved->name);
1176 } else if (currheadersourcelist->require[i]->resolved->numbuildproviders == 1) { 1176 } else if (currheadersourcelist->require[i]->resolved->numbuildproviders == 1) {
1177 // single provider 1177 // single provider
1178 if ((i == 0 || 1178 if ((i == 0 ||
1179 strcmp(currheadersourcelist->require[i-1]->name, 1179 strcmp(currheadersourcelist->require[i-1]->name,
1180 currheadersourcelist->require[i]->name)) && 1180 currheadersourcelist->require[i]->name)) &&
1181 strcmp(currheadersourcelist->name, 1181 strcmp(currheadersourcelist->name,
1182 currheadersourcelist->require[i]->name)) { 1182 currheadersourcelist->require[i]->name)) {
1183 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>", 1183 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>",
1184 configtag->configdefaults->url_prefix, 1184 configtag->configdefaults->url_prefix,
1185 configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository]->tag, 1185 configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository]->tag,
1186 currheadersourcelist->require[i]->resolved->name, 1186 currheadersourcelist->require[i]->resolved->name,
1187 configtag->arch[0], 1187 configtag->arch[0],
1188 currheadersourcelist->require[i]->resolved->name); 1188 currheadersourcelist->require[i]->resolved->name);
1189 if ((configtag->repository_level > 0) && 1189 if ((configtag->repository_level > 0) &&
1190 currheadersourcelist->require[i]->resolved->buildprovider[0]->sourceheader && 1190 currheadersourcelist->require[i]->resolved->buildprovider[0]->sourceheader &&
1191 (currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository == configtag->repository_level)) { 1191 (currheadersourcelist->require[i]->resolved->buildprovider[0]->altrepository == configtag->repository_level)) {
1192 snprintf(buffer, PATH_MAX, "has build requirement %s which is only provided in this repository", 1192 snprintf(buffer, PATH_MAX, "has build requirement %s which is only provided in this repository",
1193 currheadersourcelist->require[i]->resolved->name); 1193 currheadersourcelist->require[i]->resolved->name);
1194 addWarning(currheadersourcelist, buffer); 1194 addWarning(currheadersourcelist, buffer);
1195 } 1195 }
1196 } 1196 }
1197 } else { 1197 } else {
1198 // multiple providers 1198 // multiple providers
1199 if (i == 0 || 1199 if (i == 0 ||
1200 strcmp(currheadersourcelist->require[i-1]->resolved->name, 1200 strcmp(currheadersourcelist->require[i-1]->resolved->name,
1201 currheadersourcelist->require[i]->resolved->name)) 1201 currheadersourcelist->require[i]->resolved->name))
1202 fprintf(fout,"<i>%s</i>(",currheadersourcelist->require[i]->resolved->name); 1202 fprintf(fout,"<i>%s</i>(",currheadersourcelist->require[i]->resolved->name);
1203 for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) { 1203 for (j = 0; j < currheadersourcelist->require[i]->resolved->numbuildproviders; j++) {
1204 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>", 1204 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>",
1205 configtag->configdefaults->url_prefix, 1205 configtag->configdefaults->url_prefix,
1206 configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[j]->altrepository]->tag, 1206 configtag->repository[currheadersourcelist->require[i]->resolved->buildprovider[j]->altrepository]->tag,
1207 currheadersourcelist->require[i]->resolved->buildprovider[j]->name, 1207 currheadersourcelist->require[i]->resolved->buildprovider[j]->name,
1208 configtag->arch[0], 1208 configtag->arch[0],
1209 currheadersourcelist->require[i]->resolved->buildprovider[j]->name); 1209 currheadersourcelist->require[i]->resolved->buildprovider[j]->name);
1210 if (j+1 < currheadersourcelist->require[i]->resolved->numbuildproviders) fprintf(fout,"|"); 1210 if (j+1 < currheadersourcelist->require[i]->resolved->numbuildproviders) fprintf(fout,"|");
1211 } 1211 }
1212 fprintf(fout,")"); 1212 fprintf(fout,")");
1213 } // if numproviders 1213 } // if numproviders
1214 if (currheadersourcelist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { 1214 if (currheadersourcelist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) {
1215 fprintf(fout,"["); 1215 fprintf(fout,"[");
1216 if (currheadersourcelist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<"); 1216 if (currheadersourcelist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<");
1217 if (currheadersourcelist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">"); 1217 if (currheadersourcelist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">");
1218 if (currheadersourcelist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "="); 1218 if (currheadersourcelist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "=");
1219 fprintf(fout, "%s", currheadersourcelist->require[i]->version); 1219 fprintf(fout, "%s", currheadersourcelist->require[i]->version);
1220 fprintf(fout,"]"); 1220 fprintf(fout,"]");
1221 } 1221 }
1222 fprintf(fout," "); 1222 fprintf(fout," ");
1223 } // if required 1223 } // if required
1224 } // for 1224 } // for
1225 fprintf(fout, "</font></td></tr>\n"); 1225 fprintf(fout, "</font></td></tr>\n");
1226 1226
1227 /* print changelog to fout */ 1227 /* print changelog to fout */
1228 fprintf(fout, 1228 fprintf(fout,
1229 "<tr><td>Changelog:</td><td><font size=\"-1\" face=\"Courier,Courier New,monospace\">"); 1229 "<tr><td>Changelog:</td><td><font size=\"-1\" face=\"Courier,Courier New,monospace\">");
1230 1230
1231 currchangelog = currheadersourcelist->changelog; 1231 currchangelog = currheadersourcelist->changelog;
1232 1232
1233 while (currchangelog) { 1233 while (currchangelog) {
1234 // changelog_total++; 1234 // changelog_total++;
1235 simpleTimeToHuman(currchangelog->time, 1235 simpleTimeToHuman(currchangelog->time,
1236 (humanDate *) & strdate); 1236 (humanDate *) & strdate);
1237 1237
1238 if (currchangelog->pkg) { 1238 if (currchangelog->pkg) {
1239 if ((currchangelog->pkg->role & PACKAGER_ROLE_MAINTAINER) && 1239 if ((currchangelog->pkg->role & PACKAGER_ROLE_MAINTAINER) &&
1240 (currchangelog->pkg->packages_count)) { 1240 (currchangelog->pkg->packages_count)) {
1241 fprintf(fout, "%s - <a href=\"%stag=%s&amp;maintainer=%s\">%s</a> (%s)<br>%s<br>", 1241 fprintf(fout, "%s - <a href=\"%stag=%s&amp;maintainer=%s\">%s</a> (%s)<br>%s<br>",
1242 &strdate[0], 1242 &strdate[0],
1243 configtag->configdefaults->url_prefix, 1243 configtag->configdefaults->url_prefix,
1244 configtag->tag, 1244 configtag->tag,
1245 currchangelog->pkg->name, 1245 currchangelog->pkg->name,
1246 currchangelog->pkg->name, 1246 currchangelog->pkg->name,
1247 currchangelog->release, 1247 currchangelog->release,
1248 htmlclean(currchangelog->text,buffer,PATH_MAX)); 1248 htmlclean(currchangelog->text,buffer,PATH_MAX));
1249 // currchangelog->pkg->changes_count++; 1249 // currchangelog->pkg->changes_count++;
1250 } else { 1250 } else {
1251 fprintf(fout, "%s - %s (%s)<br>%s<br>", 1251 fprintf(fout, "%s - %s (%s)<br>%s<br>",
1252 &strdate[0], 1252 &strdate[0],
1253 currchangelog->pkg->name, 1253 currchangelog->pkg->name,
1254 currchangelog->release, 1254 currchangelog->release,
1255 htmlclean(currchangelog->text,buffer,PATH_MAX)); 1255 htmlclean(currchangelog->text,buffer,PATH_MAX));
1256 // currchangelog->pkg->changes_count++; 1256 // currchangelog->pkg->changes_count++;
1257 } 1257 }
1258 } else 1258 } else
1259 fprintf(fout, "%s - (noname) (%s)<br>%s<br>", 1259 fprintf(fout, "%s - (noname) (%s)<br>%s<br>",
1260 &strdate[0], 1260 &strdate[0],
1261 currchangelog->release, 1261 currchangelog->release,
1262 htmlclean(currchangelog->text,buffer,PATH_MAX)); 1262 htmlclean(currchangelog->text,buffer,PATH_MAX));
1263 1263
1264 currchangelog = currchangelog->next; 1264 currchangelog = currchangelog->next;
1265 } 1265 }
1266 1266
1267 /* close fout */ 1267 /* close fout */
1268 fprintf(fout, "</font></td></tr></table>"); 1268 fprintf(fout, "</font></td></tr></table>");
1269 fclose(fout); 1269 fclose(fout);
1270 } 1270 }
1271 currheadersourcelist = currheadersourcelist->next; 1271 currheadersourcelist = currheadersourcelist->next;
1272 } 1272 }
1273 for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) { 1273 for (idx = 0; idx < ARCHS_MAX + 1 && findexout[idx]; idx++) {
1274 fprintf(findexout[idx], "</table>\n"); 1274 fprintf(findexout[idx], "</table>\n");
1275 fclose(findexout[idx]); 1275 fclose(findexout[idx]);
1276 } 1276 }
1277 return 0; 1277 return 0;
1278 } 1278 }
1279 1279
1280 static int 1280 static int
1281 htmlincselector(const struct dirent *entry) 1281 htmlincselector(const struct dirent *entry)
1282 { 1282 {
1283 char *ptr; 1283 char *ptr;
1284 1284
1285 ptr = strstr(entry->d_name, ".inc"); 1285 ptr = strstr(entry->d_name, ".inc");
1286 if (entry->d_type != DT_REG) return 0; /* skip if not a file */ 1286 if (entry->d_type != DT_REG) return 0; /* skip if not a file */
1287 if (ptr == NULL) { 1287 if (ptr == NULL) {
1288 return 0; 1288 return 0;
1289 } 1289 }
1290 return 1; 1290 return 1;
1291 } 1291 }
1292 1292
1293 int 1293 int
1294 cleanHTMLFilesInc(char* dir) 1294 cleanHTMLFilesInc(char* dir)
1295 { 1295 {
1296 int n,cnt,r; 1296 int n,cnt,r;
1297 struct dirent **namelist; 1297 struct dirent **namelist;
1298 const char* errstr; 1298 const char* errstr;
1299 char uf[PATH_MAX]; 1299 char uf[PATH_MAX];
1300 1300
1301 n = scansdir(dir, &namelist, htmlincselector, NULL); 1301 n = scansdir(dir, &namelist, htmlincselector, NULL);
1302 if (n < 0) { 1302 if (n < 0) {
1303 errstr = strerror(errno); 1303 errstr = strerror(errno);
1304 logmsg(LOG_ERROR, "cannot scan directory '%s' (%s)", dir, errstr); 1304 logmsg(LOG_ERROR, "cannot scan directory '%s' (%s)", dir, errstr);
1305 return 1; 1305 return 1;
1306 } 1306 }
1307 1307
1308 for (cnt = 0; cnt < n; ++cnt) { 1308 for (cnt = 0; cnt < n; ++cnt) {
1309 snprintf(uf,PATH_MAX,"%s/%s",dir,namelist[cnt]->d_name); 1309 snprintf(uf,PATH_MAX,"%s/%s",dir,namelist[cnt]->d_name);
1310 logmsg(LOG_DEBUG,"unlinking %s",uf); 1310 logmsg(LOG_DEBUG,"unlinking %s",uf);
1311 r=unlink(uf); 1311 r=unlink(uf);
1312 if (r < 0) { 1312 if (r < 0) {
1313 errstr = strerror(errno); 1313 errstr = strerror(errno);
1314 logmsg(LOG_WARNING, "cannot remove file '%s' (%s)", uf, errstr); 1314 logmsg(LOG_WARNING, "cannot remove file '%s' (%s)", uf, errstr);
1315 } 1315 }
1316 } 1316 }
1317 return 0; 1317 return 0;
1318 } 1318 }
1319 1319
1320 int 1320 int
1321 cleanHTMLPackagesFiles(struct configTag *ct) 1321 cleanHTMLPackagesFiles(struct configTag *ct)
1322 { 1322 {
1323 char dir[PATH_MAX]; 1323 char dir[PATH_MAX];
1324 1324
1325 snprintf(dir,PATH_MAX,"%spackages",ct->html_dir); 1325 snprintf(dir,PATH_MAX,"%spackages",ct->html_dir);
1326 if (cleanHTMLFilesInc(dir)) { 1326 if (cleanHTMLFilesInc(dir)) {
1327 logmsg(LOG_WARNING,"cannot clean %s directory",dir); 1327 logmsg(LOG_WARNING,"cannot clean %s directory",dir);
1328 } 1328 }
1329 return 0; 1329 return 0;
1330 } 1330 }
1331 1331
1332 int 1332 int
1333 cleanHTMLFiles(struct configTag *ct) 1333 cleanHTMLFiles(struct configTag *ct)
1334 { 1334 {
1335 int s; 1335 int s;
1336 char uf[PATH_MAX],dir[PATH_MAX]; 1336 char uf[PATH_MAX],dir[PATH_MAX];
1337 const char* clean_subdir[] = { "", "maintainers" }; 1337 const char* clean_subdir[] = { "", "maintainers" };
1338 struct headerSourceList *currheadersourcelist; 1338 struct headerSourceList *currheadersourcelist;
1339 struct stat buf; 1339 struct stat buf;
1340 1340
1341 for (s = 0; s < 2; s++) { 1341 for (s = 0; s < 2; s++) {
1342 snprintf(dir,PATH_MAX,"%s%s",ct->html_dir,clean_subdir[s]); 1342 snprintf(dir,PATH_MAX,"%s%s",ct->html_dir,clean_subdir[s]);
1343 if (cleanHTMLFilesInc(dir)) { 1343 if (cleanHTMLFilesInc(dir)) {
1344 logmsg(LOG_WARNING,"cannot clean %s directory",dir); 1344 logmsg(LOG_WARNING,"cannot clean %s directory",dir);
1345 } 1345 }
1346 } 1346 }
1347 1347
1348 currheadersourcelist = ct->headersourcelist; 1348 currheadersourcelist = ct->headersourcelist;
1349 while (currheadersourcelist) { 1349 while (currheadersourcelist) {
1350 snprintf(dir, PATH_MAX, "%sgroups/%s", 1350 snprintf(dir, PATH_MAX, "%sgroups/%s",
1351 ct->html_dir, 1351 ct->html_dir,
1352 groupdirname(currheadersourcelist->group,uf,PATH_MAX)); 1352 groupdirname(currheadersourcelist->group,uf,PATH_MAX));
1353 1353
1354 if (!stat(dir,&buf)) { 1354 if (!stat(dir,&buf)) {
1355 logmsg(LOG_DEBUG,"removing directory %s",dir); 1355 logmsg(LOG_DEBUG,"removing directory %s",dir);
1356 if (cleanHTMLFilesInc(dir)) { 1356 if (cleanHTMLFilesInc(dir)) {
1357 logmsg(LOG_ERROR,"cannot clean %s directory; aborting",dir); 1357 logmsg(LOG_ERROR,"cannot clean %s directory; aborting",dir);
1358 exit(1); 1358 exit(1);
1359 } 1359 }
1360 if (rmdir(dir)) { 1360 if (rmdir(dir)) {
1361 logmsg(LOG_ERROR,"cannot remove %s directory; aborting.",dir); 1361 logmsg(LOG_ERROR,"cannot remove %s directory; aborting.",dir);
1362 exit(1); 1362 exit(1);
1363 } 1363 }
1364 } 1364 }
1365 1365
1366 /* legacy: clean old group dirs */ 1366 /* legacy: clean old group dirs */
1367 snprintf(dir, PATH_MAX, "%s%s", 1367 snprintf(dir, PATH_MAX, "%s%s",
1368 ct->html_dir, 1368 ct->html_dir,
1369 groupdirname(currheadersourcelist->group,uf,PATH_MAX)); 1369 groupdirname(currheadersourcelist->group,uf,PATH_MAX));
1370 1370
1371 if (!stat(dir,&buf)) { 1371 if (!stat(dir,&buf)) {
1372 logmsg(LOG_DEBUG,"removing legacy directory %s",dir); 1372 logmsg(LOG_DEBUG,"removing legacy directory %s",dir);
1373 if (cleanHTMLFilesInc(dir)) { 1373 if (cleanHTMLFilesInc(dir)) {
1374 logmsg(LOG_ERROR,"cannot clean %s directory; aborting.",dir); 1374 logmsg(LOG_ERROR,"cannot clean %s directory; aborting.",dir);
1375 exit(1); 1375 exit(1);
1376 } 1376 }
1377 if (rmdir(dir)) { 1377 if (rmdir(dir)) {
1378 logmsg(LOG_ERROR,"cannot remove %s directory; aborting.",dir); 1378 logmsg(LOG_ERROR,"cannot remove %s directory; aborting.",dir);
1379 exit(1); 1379 exit(1);
1380 } 1380 }
1381 } 1381 }
1382 currheadersourcelist = currheadersourcelist->next; 1382 currheadersourcelist = currheadersourcelist->next;
1383 } 1383 }
1384 1384
1385 return 0; 1385 return 0;
1386 } 1386 }
1387 1387
1388 1388
1389 int 1389 int
1390 generateHTMLFiles(struct configTag *ct, int arch) 1390 generateHTMLFiles(struct configTag *ct, int arch)
1391 { 1391 {
1392 1392
1393 char buffer[PATH_MAX]; 1393 char buffer[PATH_MAX];
1394 char htmlfile[PATH_MAX]; 1394 char htmlfile[PATH_MAX];
1395 int i,j; 1395 int i,j;
1396 sizeString strsize; 1396 sizeString strsize;
1397 FILE *fout; 1397 FILE *fout;
1398 struct headerList *currheaderlist, *auxheaderlist; 1398 struct headerList *currheaderlist, *auxheaderlist;
1399 struct headerSourceList *auxheadersourcelist; 1399 struct headerSourceList *auxheadersourcelist;
1400 int found; 1400 int found;
1401 struct stat buf; 1401 struct stat buf;
1402 1402
1403 snprintf(buffer,PATH_MAX,"%spackages",ct->html_dir); 1403 snprintf(buffer,PATH_MAX,"%spackages",ct->html_dir);
1404 if (stat(buffer,&buf)) { 1404 if (stat(buffer,&buf)) {
1405 if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { 1405 if (mkdir(buffer,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
1406 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer); 1406 logmsg(LOG_ERROR,"cannot create %s directory; aborting.",buffer);
1407 exit(1); 1407 exit(1);
1408 } 1408 }
1409 } else { 1409 } else {
1410 if (!S_ISDIR(buf.st_mode)) { 1410 if (!S_ISDIR(buf.st_mode)) {
1411 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer); 1411 logmsg(LOG_ERROR,"cannot create %s directory, a file with this name already exists; aborting.",buffer);
1412 exit(1); 1412 exit(1);
1413 } 1413 }
1414 } 1414 }
1415 1415
1416 currheaderlist = ct->headerlist[arch]; 1416 currheaderlist = ct->headerlist[arch];
1417 1417
1418 while (currheaderlist) { 1418 while (currheaderlist) {
1419 if ((ct->repository_level == 0) || 1419 if ((ct->repository_level == 0) ||
1420 ((currheaderlist->sourceheader) && 1420 ((currheaderlist->sourceheader) &&
1421 (currheaderlist->altrepository == ct->repository_level))) { 1421 (currheaderlist->altrepository == ct->repository_level))) {
1422 1422
1423 logmsg(LOG_DEBUG,"generating HTML pages for %s",currheaderlist->name); 1423 logmsg(LOG_DEBUG,"generating HTML pages for %s",currheaderlist->name);
1424 snprintf(htmlfile,PATH_MAX,"%spackages/%s.%s.inc",ct->html_dir,currheaderlist->name,ct->arch[arch]); 1424 snprintf(htmlfile,PATH_MAX,"%spackages/%s.%s.inc",ct->html_dir,currheaderlist->name,ct->arch[arch]);
1425 1425
1426 if ((fout = fopen(htmlfile, "w")) == NULL) { 1426 if ((fout = fopen(htmlfile, "w")) == NULL) {
1427 perror(htmlfile); 1427 perror(htmlfile);
1428 return 1; 1428 return 1;
1429 } 1429 }
1430 get_favicon_from_url(currheaderlist->sourceheader->url, buffer, PATH_MAX); 1430 get_favicon_from_url(currheaderlist->sourceheader->url, buffer, PATH_MAX);
1431 1431
1432 fprintf(fout, 1432 fprintf(fout,
1433 "<h1><img src=\"%s\" width=\"16\" height=\"16\">" 1433 "<h1><img src=\"%s\" width=\"16\" height=\"16\">"
1434 "&nbsp;%s: %s</h1><table class=\"pkgpage\" width=\"100%%\">", 1434 "&nbsp;%s: %s</h1><table class=\"pkgpage\" width=\"100%%\">",
1435 buffer, 1435 buffer,
1436 currheaderlist->name, 1436 currheaderlist->name,
1437 currheaderlist->summary); 1437 currheaderlist->summary);
1438 fprintf(fout, 1438 fprintf(fout,
1439 "<tr><td width=\"15%%\">Name:</td><td><b>%s</b></td></tr>\n", 1439 "<tr><td width=\"15%%\">Name:</td><td><b>%s</b></td></tr>\n",
1440 currheaderlist->name); 1440 currheaderlist->name);
1441 fprintf(fout, 1441 fprintf(fout,
1442 "<tr><td>Release:</td><td><b>%s-%s</b></td></tr>\n", 1442 "<tr><td>Release:</td><td><b>%s-%s</b></td></tr>\n",
1443 currheaderlist->version, currheaderlist->release); 1443 currheaderlist->version, currheaderlist->release);
1444 fprintf(fout, 1444 fprintf(fout,
1445 "<tr><td>Architecture:</td><td>%s</td></tr>\n", 1445 "<tr><td>Architecture:</td><td>%s</td></tr>\n",
1446 currheaderlist->arch); 1446 currheaderlist->arch);
1447 /* fprintf(fout, 1447 /* fprintf(fout,
1448 "<tr><td>Summary:</td><td><b>%s</b></td></tr>\n", 1448 "<tr><td>Summary:</td><td><b>%s</b></td></tr>\n",
1449 htmlclean(currheaderlist->summary,buffer,PATH_MAX));*/ 1449 htmlclean(currheaderlist->summary,buffer,PATH_MAX));*/
1450 fprintf(fout, 1450 fprintf(fout,
1451 "<tr><td>Group:</td><td>%s</td></tr>\n", 1451 "<tr><td>Group:</td><td>%s</td></tr>\n",
1452 htmlclean(currheaderlist->group,buffer,PATH_MAX)); 1452 htmlclean(currheaderlist->group,buffer,PATH_MAX));
1453 fprintf(fout, "<tr><td>Description:</td><td>%s</td></tr>\n", 1453 fprintf(fout, "<tr><td>Description:</td><td>%s</td></tr>\n",
1454 htmlclean(currheaderlist->description,buffer,PATH_MAX)); 1454 htmlclean(currheaderlist->description,buffer,PATH_MAX));
1455 fprintf(fout, 1455 fprintf(fout,
1456 "<tr><td>Size:</td><td><font size=\"-1\">%s</font></td></tr>\n", 1456 "<tr><td>Size:</td><td><font size=\"-1\">%s</font></td></tr>\n",
1457 humanSize(currheaderlist->size, &strsize)); 1457 humanSize(currheaderlist->size, &strsize));
1458 1458
1459 /* fprintf(fout, 1459 /* fprintf(fout,
1460 "<tr><td>Arch:</td><td><font size=\"-1\">%s</font></td></tr>\n", 1460 "<tr><td>Arch:</td><td><font size=\"-1\">%s</font></td></tr>\n",
1461 currheaderlist->arch);*/ 1461 currheaderlist->arch);*/
1462 1462
1463 if (ct->download_prefix) { 1463 if (ct->download_prefix) {
1464 1464
1465 fprintf(fout,"<tr><td>Download:</td><td><font size=\"-1\">"); 1465 fprintf(fout,"<tr><td>Download:</td><td><font size=\"-1\">");
1466 1466
1467 fprintf(fout,"<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\">%s-%s-%s.%s.rpm</a>", 1467 fprintf(fout,"<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\">%s-%s-%s.%s.rpm</a>",
1468 ct->download_prefix, 1468 ct->download_prefix,
1469 ct->download_dir, 1469 ct->download_dir,
1470 ct->arch[arch], 1470 ct->arch[arch],
1471 currheaderlist->name, 1471 currheaderlist->name,
1472 currheaderlist->version, 1472 currheaderlist->version,
1473 currheaderlist->release, 1473 currheaderlist->release,
1474 currheaderlist->arch, 1474 currheaderlist->arch,
1475 currheaderlist->name, 1475 currheaderlist->name,
1476 currheaderlist->version, 1476 currheaderlist->version,
1477 currheaderlist->release, 1477 currheaderlist->release,
1478 currheaderlist->arch); 1478 currheaderlist->arch);
1479 1479
1480 fprintf(fout,"</font></td></tr>\n"); 1480 fprintf(fout,"</font></td></tr>\n");
1481 } 1481 }
1482 1482
1483 if (currheaderlist->sourcename 1483 if (currheaderlist->sourcename
1484 && currheaderlist->sourceheader) { 1484 && currheaderlist->sourceheader) {
1485 fprintf(fout, 1485 fprintf(fout,
1486 "<tr><td>Source RPM:</td><td><font size=\"-1\"><a href=\"%stag=%s&amp;pkg=%s.source\">%s</a></font></td></tr>\n", 1486 "<tr><td>Source RPM:</td><td><font size=\"-1\"><a href=\"%stag=%s&amp;pkg=%s.source\">%s</a></font></td></tr>\n",
1487 ct->configdefaults->url_prefix, 1487 ct->configdefaults->url_prefix,
1488 ct->tag, 1488 ct->tag,
1489 currheaderlist->sourceheader->name, 1489 currheaderlist->sourceheader->name,
1490 currheaderlist->sourcename); 1490 currheaderlist->sourcename);
1491 } 1491 }
1492 1492
1493 /* list obsoletes */ 1493 /* list obsoletes */
1494 if (currheaderlist->obsoletecount > 0) { 1494 if (currheaderlist->obsoletecount > 0) {
1495 fprintf(fout, 1495 fprintf(fout,
1496 "<tr><td>Obsoletes:</td><td><font size=\"-1\">"); 1496 "<tr><td>Obsoletes:</td><td><font size=\"-1\">");
1497 for (i = 0; i < currheaderlist->obsoletecount; i++) { 1497 for (i = 0; i < currheaderlist->obsoletecount; i++) {
1498 fprintf(fout, "%s", currheaderlist->obsoletename[i]); 1498 fprintf(fout, "%s", currheaderlist->obsoletename[i]);
1499 if (currheaderlist->obsoleteflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { 1499 if (currheaderlist->obsoleteflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) {
1500 fprintf(fout, "["); 1500 fprintf(fout, "[");
1501 if (currheaderlist->obsoleteflags[i] & RPMSENSE_LESS) fprintf(fout, "<"); 1501 if (currheaderlist->obsoleteflags[i] & RPMSENSE_LESS) fprintf(fout, "<");
1502 if (currheaderlist->obsoleteflags[i] & RPMSENSE_GREATER) fprintf(fout, ">"); 1502 if (currheaderlist->obsoleteflags[i] & RPMSENSE_GREATER) fprintf(fout, ">");
1503 if (currheaderlist->obsoleteflags[i] & RPMSENSE_EQUAL) fprintf(fout, "="); 1503 if (currheaderlist->obsoleteflags[i] & RPMSENSE_EQUAL) fprintf(fout, "=");
1504 fprintf(fout, "%s]", currheaderlist->obsoleteversion[i]); 1504 fprintf(fout, "%s]", currheaderlist->obsoleteversion[i]);
1505 } 1505 }
1506 fprintf(fout," "); 1506 fprintf(fout," ");
1507 } 1507 }
1508 fprintf(fout, "</font></td></tr>\n"); 1508 fprintf(fout, "</font></td></tr>\n");
1509 } 1509 }
1510 1510
1511 /* list provides */ 1511 /* list provides */
1512 fprintf(fout, 1512 fprintf(fout,
1513 "<tr><td>Provides:</td><td><font size=\"-1\">"); 1513 "<tr><td>Provides:</td><td><font size=\"-1\">");
1514 for (i = 0; i < currheaderlist->providecount; i++) { 1514 for (i = 0; i < currheaderlist->providecount; i++) {
1515 fprintf(fout, "%s", currheaderlist->providename[i]); 1515 fprintf(fout, "%s", currheaderlist->providename[i]);
1516 if (currheaderlist->provideflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { 1516 if (currheaderlist->provideflags[i] & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) {
1517 fprintf(fout, "["); 1517 fprintf(fout, "[");
1518 if (currheaderlist->provideflags[i] & RPMSENSE_LESS) fprintf(fout, "<"); 1518 if (currheaderlist->provideflags[i] & RPMSENSE_LESS) fprintf(fout, "<");
1519 if (currheaderlist->provideflags[i] & RPMSENSE_GREATER) fprintf(fout, ">"); 1519 if (currheaderlist->provideflags[i] & RPMSENSE_GREATER) fprintf(fout, ">");
1520 if (currheaderlist->provideflags[i] & RPMSENSE_EQUAL) fprintf(fout, "="); 1520 if (currheaderlist->provideflags[i] & RPMSENSE_EQUAL) fprintf(fout, "=");
1521 fprintf(fout, "%s]", currheaderlist->provideversion[i]); 1521 fprintf(fout, "%s]", currheaderlist->provideversion[i]);
1522 } 1522 }
1523 fprintf(fout," "); 1523 fprintf(fout," ");
1524 } 1524 }
1525 fprintf(fout, "</font></td></tr>\n"); 1525 fprintf(fout, "</font></td></tr>\n");
1526 1526
1527 /* list requires */ 1527 /* list requires */
1528 fprintf(fout, 1528 fprintf(fout,
1529 "<tr><td>Requires:</td><td><font size=\"-1\">"); 1529 "<tr><td>Requires:</td><td><font size=\"-1\">");
1530 for (i = 0; i < currheaderlist->requirecount; i++) { 1530 for (i = 0; i < currheaderlist->requirecount; i++) {
1531 if (currheaderlist->require[i]->resolved) { 1531 if (currheaderlist->require[i]->resolved) {
1532 if (currheaderlist->require[i]->resolved->numproviders == 0) { 1532 if (currheaderlist->require[i]->resolved->numproviders == 0) {
1533 // no provider 1533 // no provider
1534 fprintf(fout,"%s",currheaderlist->require[i]->resolved->name); 1534 fprintf(fout,"%s",currheaderlist->require[i]->resolved->name);
1535 } else if (currheaderlist->require[i]->resolved->numproviders == 1) { 1535 } else if (currheaderlist->require[i]->resolved->numproviders == 1) {
1536 // single provider 1536 // single provider
1537 if (currheaderlist->require[i]->resolved->provider[0]->sourceheader) { 1537 if (currheaderlist->require[i]->resolved->provider[0]->sourceheader) {
1538 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>", 1538 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>",
1539 ct->configdefaults->url_prefix, 1539 ct->configdefaults->url_prefix,
1540 ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag, 1540 ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag,
1541 currheaderlist->require[i]->resolved->provider[0]->name, 1541 currheaderlist->require[i]->resolved->provider[0]->name,
1542 ct->arch[arch], 1542 ct->arch[arch],
1543 currheaderlist->require[i]->resolved->name); 1543 currheaderlist->require[i]->resolved->name);
1544 } else { 1544 } else {
1545 fprintf(fout,"%s",currheaderlist->require[i]->resolved->name); 1545 fprintf(fout,"%s",currheaderlist->require[i]->resolved->name);
1546 } 1546 }
1547 } else { 1547 } else {
1548 // multiple providers 1548 // multiple providers
1549 logmsg(LOG_DEBUG,"Requirement %s has multiple providers",currheaderlist->require[i]->resolved->name); 1549 logmsg(LOG_DEBUG,"Requirement %s has multiple providers",currheaderlist->require[i]->resolved->name);
1550 fprintf(fout,"<i>%s</i>(",currheaderlist->require[i]->resolved->name); 1550 fprintf(fout,"<i>%s</i>(",currheaderlist->require[i]->resolved->name);
1551 for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { 1551 for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) {
1552 if (currheaderlist->require[i]->resolved->provider[j]->sourceheader) 1552 if (currheaderlist->require[i]->resolved->provider[j]->sourceheader)
1553 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>", 1553 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>",
1554 ct->configdefaults->url_prefix, 1554 ct->configdefaults->url_prefix,
1555 ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag, 1555 ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag,
1556 currheaderlist->require[i]->resolved->provider[j]->name, 1556 currheaderlist->require[i]->resolved->provider[j]->name,
1557 ct->arch[arch], 1557 ct->arch[arch],
1558 currheaderlist->require[i]->resolved->provider[j]->name); 1558 currheaderlist->require[i]->resolved->provider[j]->name);
1559 else 1559 else
1560 fprintf(fout,"%s",currheaderlist->require[i]->resolved->provider[j]->name); 1560 fprintf(fout,"%s",currheaderlist->require[i]->resolved->provider[j]->name);
1561 if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|"); 1561 if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|");
1562 } 1562 }
1563 fprintf(fout,")"); 1563 fprintf(fout,")");
1564 } // if numproviders 1564 } // if numproviders
1565 if (currheaderlist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) { 1565 if (currheaderlist->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL)) {
1566 fprintf(fout,"["); 1566 fprintf(fout,"[");
1567 if (currheaderlist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<"); 1567 if (currheaderlist->require[i]->flags & RPMSENSE_LESS) fprintf(fout, "<");
1568 if (currheaderlist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">"); 1568 if (currheaderlist->require[i]->flags & RPMSENSE_GREATER) fprintf(fout, ">");
1569 if (currheaderlist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "="); 1569 if (currheaderlist->require[i]->flags & RPMSENSE_EQUAL) fprintf(fout, "=");
1570 fprintf(fout, "%s", currheaderlist->require[i]->version); 1570 fprintf(fout, "%s", currheaderlist->require[i]->version);
1571 fprintf(fout,"]"); 1571 fprintf(fout,"]");
1572 } 1572 }
1573 fprintf(fout," "); 1573 fprintf(fout," ");
1574 } // if required 1574 } // if required
1575 } // for 1575 } // for
1576 fprintf(fout, "</font></td></tr>\n"); 1576 fprintf(fout, "</font></td></tr>\n");
1577 1577
1578 /* list RPM requirements */ 1578 /* list RPM requirements */
1579 fprintf(fout, "<tr><td>RPM requirements:</td><td><font size=\"-1\">"); 1579 fprintf(fout, "<tr><td>RPM requirements:</td><td><font size=\"-1\">");
1580 1580
1581 for (i = 0; i < currheaderlist->requirecount; i++) { 1581 for (i = 0; i < currheaderlist->requirecount; i++) {
1582 if (currheaderlist->require[i]->resolved) { 1582 if (currheaderlist->require[i]->resolved) {
1583 if (currheaderlist->require[i]->resolved->numproviders == 0) { 1583 if (currheaderlist->require[i]->resolved->numproviders == 0) {
1584 // missing provider 1584 // missing provider
1585 fprintf(fout,"<b>%s(unresolved)</b> ",currheaderlist->require[i]->resolved->name); 1585 fprintf(fout,"<b>%s(unresolved)</b> ",currheaderlist->require[i]->resolved->name);
1586 } else if (currheaderlist->require[i]->resolved->numproviders == 1) { 1586 } else if (currheaderlist->require[i]->resolved->numproviders == 1) {
1587 // single provider 1587 // single provider
1588 if ((i == 0 || 1588 if ((i == 0 ||
1589 !currheaderlist->require[i-1]->resolved || 1589 !currheaderlist->require[i-1]->resolved ||
1590 !currheaderlist->require[i-1]->resolved->numproviders || 1590 !currheaderlist->require[i-1]->resolved->numproviders ||
1591 strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name, 1591 strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name,
1592 currheaderlist->require[i]->resolved->provider[0]->name)) && 1592 currheaderlist->require[i]->resolved->provider[0]->name)) &&
1593 strcmp(currheaderlist->name, 1593 strcmp(currheaderlist->name,
1594 currheaderlist->require[i]->resolved->provider[0]->name)) { 1594 currheaderlist->require[i]->resolved->provider[0]->name)) {
1595 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a> ", 1595 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a> ",
1596 ct->configdefaults->url_prefix, 1596 ct->configdefaults->url_prefix,
1597 ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag, 1597 ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag,
1598 currheaderlist->require[i]->resolved->provider[0]->name, 1598 currheaderlist->require[i]->resolved->provider[0]->name,
1599 ct->arch[arch], 1599 ct->arch[arch],
1600 currheaderlist->require[i]->resolved->provider[0]->name); 1600 currheaderlist->require[i]->resolved->provider[0]->name);
1601 if ((ct->repository_level > 0) && 1601 if ((ct->repository_level > 0) &&
1602 (currheaderlist->sourceheader != currheaderlist->require[i]->resolved->provider[0]->sourceheader) && 1602 (currheaderlist->sourceheader != currheaderlist->require[i]->resolved->provider[0]->sourceheader) &&
1603 (currheaderlist->require[i]->resolved->provider[0]->altrepository == ct->repository_level)) { 1603 (currheaderlist->require[i]->resolved->provider[0]->altrepository == ct->repository_level)) {
1604 snprintf(buffer, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) which is only in this repository", 1604 snprintf(buffer, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) which is only in this repository",
1605 currheaderlist->name, 1605 currheaderlist->name,
1606 ct->arch[arch], 1606 ct->arch[arch],
1607 ct->repository[currheaderlist->altrepository]->tag, 1607 ct->repository[currheaderlist->altrepository]->tag,
1608 currheaderlist->require[i]->resolved->provider[0]->name, 1608 currheaderlist->require[i]->resolved->provider[0]->name,
1609 ct->arch[arch], 1609 ct->arch[arch],
1610 ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag); 1610 ct->repository[currheaderlist->require[i]->resolved->provider[0]->altrepository]->tag);
1611 addWarning(currheaderlist->sourceheader, buffer); 1611 addWarning(currheaderlist->sourceheader, buffer);
1612 } 1612 }
1613 } 1613 }
1614 } else { 1614 } else {
1615 // multiple providers 1615 // multiple providers
1616 if (i == 0 || 1616 if (i == 0 ||
1617 !currheaderlist->require[i-1]->resolved || 1617 !currheaderlist->require[i-1]->resolved ||
1618 !currheaderlist->require[i-1]->resolved->numproviders || 1618 !currheaderlist->require[i-1]->resolved->numproviders ||
1619 strcmp(currheaderlist->require[i-1]->resolved->name, 1619 strcmp(currheaderlist->require[i-1]->resolved->name,
1620 currheaderlist->require[i]->resolved->name)) { 1620 currheaderlist->require[i]->resolved->name)) {
1621 fprintf(fout,"<i>%s</i>(",currheaderlist->require[i]->resolved->name); 1621 fprintf(fout,"<i>%s</i>(",currheaderlist->require[i]->resolved->name);
1622 for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) { 1622 for (j = 0; j < currheaderlist->require[i]->resolved->numproviders; j++) {
1623 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>", 1623 fprintf(fout,"<a href=\"%stag=%s&amp;pkg=%s.%s\">%s</a>",
1624 ct->configdefaults->url_prefix, 1624 ct->configdefaults->url_prefix,
1625 ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag, 1625 ct->repository[currheaderlist->require[i]->resolved->provider[j]->altrepository]->tag,
1626 currheaderlist->require[i]->resolved->provider[j]->name, 1626 currheaderlist->require[i]->resolved->provider[j]->name,
1627 ct->arch[arch], 1627 ct->arch[arch],
1628 currheaderlist->require[i]->resolved->provider[j]->name); 1628 currheaderlist->require[i]->resolved->provider[j]->name);
1629 if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|"); 1629 if (j+1 < currheaderlist->require[i]->resolved->numproviders) fprintf(fout,"|");
1630 } 1630 }
1631 fprintf(fout,") "); 1631 fprintf(fout,") ");
1632 } 1632 }
1633 } // if numproviders 1633 } // if numproviders
1634 } // if required 1634 } // if required
1635 } // for 1635 } // for
1636 fprintf(fout, "</font></td></tr>\n"); 1636 fprintf(fout, "</font></td></tr>\n");
1637 1637
1638 /* list required by */ 1638 /* list required by */
1639 fprintf(fout, 1639 fprintf(fout,
1640 "<tr><td>Required by:</td><td><font size=\"-1\">"); 1640 "<tr><td>Required by:</td><td><font size=\"-1\">");
1641 auxheaderlist = ct->headerlist[arch]; 1641 auxheaderlist = ct->headerlist[arch];
1642 while (auxheaderlist) { 1642 while (auxheaderlist) {
1643 found = 0; 1643 found = 0;
1644 if (auxheaderlist != currheaderlist) { 1644 if (auxheaderlist != currheaderlist) {
1645 for (i = 0; i < auxheaderlist->requirecount; i++) { 1645 for (i = 0; i < auxheaderlist->requirecount; i++) {
1646 if (auxheaderlist->require[i]->resolved) { 1646 if (auxheaderlist->require[i]->resolved) {
1647 for (j = 0; j < auxheaderlist->require[i]->resolved->numproviders; j++) { 1647 for (j = 0; j < auxheaderlist->require[i]->resolved->numproviders; j++) {
1648 if (!strcmp(auxheaderlist->require[i]->resolved->provider[j]->name, currheaderlist->name)) { 1648 if (!strcmp(auxheaderlist->require[i]->resolved->provider[j]->name, currheaderlist->name)) {
1649 fprintf(fout, 1649 fprintf(fout,
1650 "<a href=\"%stag=%s&amp;pkg=%s.%s\">%s(%s)</a> ", 1650 "<a href=\"%stag=%s&amp;pkg=%s.%s\">%s(%s)</a> ",
1651 ct->configdefaults->url_prefix, 1651 ct->configdefaults->url_prefix,
1652 ct->repository[auxheaderlist->altrepository]->tag, 1652 ct->repository[auxheaderlist->altrepository]->tag,
1653 auxheaderlist->name, 1653 auxheaderlist->name,
1654 ct->arch[arch], 1654 ct->arch[arch],
1655 auxheaderlist->name, 1655 auxheaderlist->name,
1656 ct->arch[arch]); 1656 ct->arch[arch]);
1657 found = 1; 1657 found = 1;
1658 } 1658 }
1659 if (found) break; 1659 if (found) break;
1660 } 1660 }
1661 } 1661 }
1662 if (found) break; 1662 if (found) break;
1663 } 1663 }
1664 } 1664 }
1665 auxheaderlist = auxheaderlist->next; 1665 auxheaderlist = auxheaderlist->next;
1666 } 1666 }
1667 fprintf(fout, "</font></td></tr>\n"); 1667 fprintf(fout, "</font></td></tr>\n");
1668 1668
1669 /* list build required by */ 1669 /* list build required by */
1670 fprintf(fout, 1670 fprintf(fout,
1671 "<tr><td nowrap>Build required by:</td><td><font size=\"-1\">"); 1671 "<tr><td nowrap>Build required by:</td><td><font size=\"-1\">");
1672 auxheadersourcelist = ct->headersourcelist; 1672 auxheadersourcelist = ct->headersourcelist;
1673 while (auxheadersourcelist) { 1673 while (auxheadersourcelist) {
1674 found=0; 1674 found=0;
1675 if (auxheadersourcelist != currheaderlist->sourceheader) { 1675 if (auxheadersourcelist != currheaderlist->sourceheader) {
1676 for (i = 0; i < auxheadersourcelist->requirecount; i++) { 1676 for (i = 0; i < auxheadersourcelist->requirecount; i++) {
1677 if (auxheadersourcelist->require[i]->resolved) { 1677 if (auxheadersourcelist->require[i]->resolved) {
1678 for (j = 0; j < auxheadersourcelist->require[i]->resolved->numbuildproviders; j++) { 1678 for (j = 0; j < auxheadersourcelist->require[i]->resolved->numbuildproviders; j++) {
1679 if (!strcmp(auxheadersourcelist->require[i]->resolved->buildprovider[j]->name, 1679 if (!strcmp(auxheadersourcelist->require[i]->resolved->buildprovider[j]->name,
1680 currheaderlist->name)) { 1680 currheaderlist->name)) {
1681 fprintf(fout, 1681 fprintf(fout,
1682 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a> ", 1682 "<a href=\"%stag=%s&amp;pkg=%s.source\">%s</a> ",
1683 ct->configdefaults->url_prefix, 1683 ct->configdefaults->url_prefix,
1684 ct->repository[auxheadersourcelist->altrepository]->tag, 1684 ct->repository[auxheadersourcelist->altrepository]->tag,
1685 auxheadersourcelist->name, 1685 auxheadersourcelist->name,
1686 auxheadersourcelist->name); 1686 auxheadersourcelist->name);
1687 found=1; 1687 found=1;
1688 } 1688 }
1689 } 1689 }
1690 } 1690 }
1691 if (found) break; 1691 if (found) break;
1692 } 1692 }
1693 } 1693 }
1694 auxheadersourcelist = auxheadersourcelist->next; 1694 auxheadersourcelist = auxheadersourcelist->next;
1695 } 1695 }
1696 fprintf(fout, "</font></td></tr>\n"); 1696 fprintf(fout, "</font></td></tr>\n");
1697 1697
1698 /* list filenames */ 1698 /* list filenames */
1699 fprintf(fout, 1699 fprintf(fout,
1700 "<tr><td>Filenames:</td><td><font size=\"-1\">"); 1700 "<tr><td>Filenames:</td><td><font size=\"-1\">");
1701 for (i = 0; i < currheaderlist->filenamecount; i++) { 1701 for (i = 0; i < currheaderlist->filenamecount; i++) {
1702 ftname((currheaderlist->file)[i], 1702 ftname((currheaderlist->file)[i],
1703 buffer, PATH_MAX); 1703 buffer, PATH_MAX);
1704 1704
1705 fprintf(fout, "/%s ",buffer); 1705 fprintf(fout, "/%s ",buffer);
1706 } 1706 }
1707 fprintf(fout, "</font></td></tr></table>\n"); 1707 fprintf(fout, "</font></td></tr></table>\n");
1708 fclose(fout); 1708 fclose(fout);
1709 } 1709 }
1710 currheaderlist = currheaderlist->next; 1710 currheaderlist = currheaderlist->next;
1711 } 1711 }
1712 1712
1713 return 0; 1713 return 0;
1714 } 1714 }
1715 1715
1716 char *ftname(struct fileTree* ft, char* buf, unsigned int bufsize) { 1716 char *ftname(struct fileTree* ft, char* buf, unsigned int bufsize) {
1717 1717
1718 buf[0]='\0'; 1718 buf[0]='\0';
1719 int l; 1719 int l;
1720 1720
1721 if (ft) { 1721 if (ft) {
1722 strncpy(buf,ft->name,bufsize); 1722 strncpy(buf,ft->name,bufsize);
1723 ft=ft->parent; 1723 ft=ft->parent;
1724 } 1724 }
1725 1725
1726 while (ft) { 1726 while (ft) {
1727 l=strlen(ft->name); 1727 l=strlen(ft->name);
1728 if (strlen(buf)+l+1 <= bufsize) { 1728 if (strlen(buf)+l+1 <= bufsize) {
1729 memmove(buf+l+1,buf,strlen(buf)+1); 1729 memmove(buf+l+1,buf,strlen(buf)+1);
1730 memcpy(buf,ft->name,l); 1730 memcpy(buf,ft->name,l);
1731 buf[l]='/'; 1731 buf[l]='/';
1732 } else break; 1732 } else break;
1733 ft=ft->parent; 1733 ft=ft->parent;
1734 } 1734 }
1735 return buf; 1735 return buf;
1736 } 1736 }
1737 1737
1738 void print_contents_subtree(FILE *f, 1738 void print_contents_subtree(FILE *f,
1739 struct fileTree* ft, 1739 struct fileTree* ft,
1740 struct configTag* ct, 1740 struct configTag* ct,
1741 char* buf, int bufsize) { 1741 char* buf, int bufsize) {
1742 int i,j,k; 1742 int i,j,k;
1743 1743
1744 while (ft) { 1744 while (ft) {
1745 if (ft->firstchild) { 1745 if (ft->firstchild) {
1746 print_contents_subtree(f,ft->firstchild,ct,buf,bufsize); 1746 print_contents_subtree(f,ft->firstchild,ct,buf,bufsize);
1747 } else { 1747 } else {
1748 for (k = 0; k < ft->numproviders; k++) { 1748 for (k = 0; k < ft->numproviders; k++) {
1749 if ((ct->repository_level == 0) || 1749 if ((ct->repository_level == 0) ||
1750 ((ft->provider[k]) && 1750 ((ft->provider[k]) &&
1751 (ft->provider[k]->sourceheader) && 1751 (ft->provider[k]->sourceheader) &&
1752 (ft->provider[k]->altrepository == ct->repository_level))) { 1752 (ft->provider[k]->altrepository == ct->repository_level))) {
1753 ftname(ft,buf,bufsize); 1753 ftname(ft,buf,bufsize);
1754 if ((j=strlen(buf)) < 60) { 1754 if ((j=strlen(buf)) < 60) {
1755 for (i=(60-j)/8; i>0; i--) strncat(buf, "\t", bufsize - strlen(buf)); 1755 for (i=(60-j)/8; i>0; i--) strncat(buf, "\t", bufsize - strlen(buf));
1756 while (strlen(buf) < 60) strncat(buf, " ", bufsize - strlen(buf)); 1756 while (strlen(buf) < 60) strncat(buf, " ", bufsize - strlen(buf));
1757 } 1757 }
1758 fprintf(f, "%s %s/%s\n",buf,ct->tag,ft->provider[0]->name); 1758 fprintf(f, "%s %s/%s\n",buf,ct->tag,ft->provider[0]->name);
1759 } 1759 }
1760 } 1760 }
1761 } 1761 }
1762 1762
1763 ft=ft->next; 1763 ft=ft->next;
1764 } 1764 }
1765 1765
1766 } 1766 }
1767 1767
1768 int print_contentslist(struct configTag *ct, int arch) { 1768 int print_contentslist(struct configTag *ct, int arch) {
1769 FILE *fc; 1769 FILE *fc;
1770 char contents_filename[PATH_MAX],buf[PATH_MAX]; 1770 char contents_filename[PATH_MAX],buf[PATH_MAX];
1771 1771
1772 snprintf(contents_filename, PATH_MAX, "%scontentslist-%s", ct->repository_dir, ct->arch[arch]); 1772 snprintf(contents_filename, PATH_MAX, "%scontentslist-%s", ct->repository_dir, ct->arch[arch]);
1773 1773
1774 fc=fopen(contents_filename,"w"); 1774 fc=fopen(contents_filename,"w");
1775 if (!fc) { 1775 if (!fc) {
1776 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", contents_filename); 1776 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", contents_filename);
1777 return 1; 1777 return 1;
1778 } 1778 }
1779 1779
1780 //write contents (filenames) 1780 //write contents (filenames)
1781 logmsg(LOG_DEBUG,"writing contents file"); 1781 logmsg(LOG_DEBUG,"writing contents file");
1782 print_contents_subtree(fc, ct->filetree[arch], ct, buf, PATH_MAX); 1782 print_contents_subtree(fc, ct->filetree[arch], ct, buf, PATH_MAX);
1783 1783
1784 fclose(fc); 1784 fclose(fc);
1785 return 0; 1785 return 0;
1786 } 1786 }
1787 1787
1788 int print_datatables(struct configTag *ct, int arch) { 1788 int print_datatables(struct configTag *ct, int arch) {
1789 1789
1790 FILE *fbd,*fd,*fv,*fb,*fbsh,*fs,*fw; 1790 FILE *fbd,*fd,*fv,*fb,*fbsh,*fs,*fw;
1791 char builddeps_filename[PATH_MAX], deps_filename[PATH_MAX], virtual_filename[PATH_MAX], 1791 char builddeps_filename[PATH_MAX], deps_filename[PATH_MAX], virtual_filename[PATH_MAX],
1792 builds_filename[PATH_MAX], builds_sh_filename[PATH_MAX], sources_filename[PATH_MAX], 1792 builds_filename[PATH_MAX], builds_sh_filename[PATH_MAX], sources_filename[PATH_MAX],
1793 warnings_filename[PATH_MAX]; 1793 warnings_filename[PATH_MAX];
1794 char obsoletebuf[PATH_MAX]; 1794 char obsoletebuf[PATH_MAX];
1795 struct headerList *currheaderlist, *currchild; 1795 struct headerList *currheaderlist, *currchild;
1796 struct headerSourceList *currheadersourcelist, *oldheadersourcelist; 1796 struct headerSourceList *currheadersourcelist, *oldheadersourcelist;
1797 struct rebuildList *currrebuild; 1797 struct rebuildList *currrebuild;
1798 int i, nonobsoletednumproviders; 1798 int i, nonobsoletednumproviders;
1799 1799
1800 snprintf(builddeps_filename, PATH_MAX, "%sbuilddeps-%s", ct->html_dir, ct->arch[arch]); 1800 snprintf(builddeps_filename, PATH_MAX, "%sbuilddeps-%s", ct->html_dir, ct->arch[arch]);
1801 snprintf(deps_filename, PATH_MAX, "%sdeps-%s", ct->html_dir, ct->arch[arch]); 1801 snprintf(deps_filename, PATH_MAX, "%sdeps-%s", ct->html_dir, ct->arch[arch]);
1802 snprintf(virtual_filename, PATH_MAX, "%svirtual-%s", ct->html_dir, ct->arch[arch]); 1802 snprintf(virtual_filename, PATH_MAX, "%svirtual-%s", ct->html_dir, ct->arch[arch]);
1803 snprintf(builds_filename, PATH_MAX, "%sbuilds-%s", ct->html_dir, ct->arch[arch]); 1803 snprintf(builds_filename, PATH_MAX, "%sbuilds-%s", ct->html_dir, ct->arch[arch]);
1804 snprintf(builds_sh_filename, PATH_MAX, "%sbuilds-%s.sh", ct->html_dir, ct->arch[arch]); 1804 snprintf(builds_sh_filename, PATH_MAX, "%sbuilds-%s.sh", ct->html_dir, ct->arch[arch]);
1805 snprintf(sources_filename, PATH_MAX, "%ssources-%s", ct->html_dir, ct->arch[arch]); 1805 snprintf(sources_filename, PATH_MAX, "%ssources-%s", ct->html_dir, ct->arch[arch]);
1806 snprintf(warnings_filename, PATH_MAX, "%swarnings-%s", ct->repository_dir, ct->arch[arch]); 1806 snprintf(warnings_filename, PATH_MAX, "%swarnings-%s", ct->repository_dir, ct->arch[arch]);
1807 1807
1808 fbd=fopen(builddeps_filename,"w"); 1808 fbd=fopen(builddeps_filename,"w");
1809 if (!fbd) { 1809 if (!fbd) {
1810 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builddeps_filename); 1810 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builddeps_filename);
1811 return 1; 1811 return 1;
1812 } 1812 }
1813 1813
1814 fd=fopen(deps_filename,"w"); 1814 fd=fopen(deps_filename,"w");
1815 if (!fd) { 1815 if (!fd) {
1816 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", deps_filename); 1816 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", deps_filename);
1817 return 1; 1817 return 1;
1818 } 1818 }
1819 1819
1820 fv=fopen(virtual_filename,"w"); 1820 fv=fopen(virtual_filename,"w");
1821 if (!fv) { 1821 if (!fv) {
1822 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", virtual_filename); 1822 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", virtual_filename);
1823 return 1; 1823 return 1;
1824 } 1824 }
1825 1825
1826 fb=fopen(builds_filename,"w"); 1826 fb=fopen(builds_filename,"w");
1827 if (!fb) { 1827 if (!fb) {
1828 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename); 1828 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename);
1829 return 1; 1829 return 1;
1830 } 1830 }
1831 1831
1832 fbsh=fopen(builds_sh_filename,"w"); 1832 fbsh=fopen(builds_sh_filename,"w");
1833 if (!fbsh) { 1833 if (!fbsh) {
1834 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename); 1834 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", builds_filename);
1835 return 1; 1835 return 1;
1836 } 1836 }
1837 1837
1838 fs=fopen(sources_filename,"w"); 1838 fs=fopen(sources_filename,"w");
1839 if (!fs) { 1839 if (!fs) {
1840 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", sources_filename); 1840 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", sources_filename);
1841 return 1; 1841 return 1;
1842 } 1842 }
1843 1843
1844 fw=fopen(warnings_filename,"w"); 1844 fw=fopen(warnings_filename,"w");
1845 if (!fw) { 1845 if (!fw) {
1846 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", warnings_filename); 1846 fprintf(stderr, "Error: can't open file for writing: %s. Aborting.\n", warnings_filename);
1847 return 1; 1847 return 1;
1848 } 1848 }
1849 1849
1850 // 1850 //
1851 // headerlist scan: write top of deps and sources files 1851 // headerlist scan: write top of deps and sources files
1852 // 1852 //
1853 fprintf(fd,"ALL_PACKAGES = "); 1853 fprintf(fd,"ALL_PACKAGES = ");
1854 fprintf(fb,"ALL_BUILDS="); 1854 fprintf(fb,"ALL_BUILDS=");
1855 currheaderlist = ct->headerlist[arch]; 1855 currheaderlist = ct->headerlist[arch];
1856 while (currheaderlist) { 1856 while (currheaderlist) {
1857 fprintf(fs,"%s: _%s\n", currheaderlist->name, currheaderlist->sourceheader->name); 1857 fprintf(fs,"%s: _%s\n", currheaderlist->name, currheaderlist->sourceheader->name);
1858 fprintf(fd,"%s ", currheaderlist->name); 1858 fprintf(fd,"%s ", currheaderlist->name);
1859 fprintf(fb,"%s ",currheaderlist->name); 1859 fprintf(fb,"%s ",currheaderlist->name);
1860 currheaderlist = currheaderlist->next; 1860 currheaderlist = currheaderlist->next;
1861 } 1861 }
1862 fprintf(fd,"\n"); 1862 fprintf(fd,"\n");
1863 1863
1864 // 1864 //
1865 // source headerlist scan: write top of deps and sources files 1865 // source headerlist scan: write top of deps and sources files
1866 // 1866 //
1867 fprintf(fbd,"ALL_SOURCES = "); 1867 fprintf(fbd,"ALL_SOURCES = ");
1868 fprintf(fs,"ALL_SOURCES = "); 1868 fprintf(fs,"ALL_SOURCES = ");
1869 currheadersourcelist = ct->headersourcelist; 1869 currheadersourcelist = ct->headersourcelist;
1870 while (currheadersourcelist) { 1870 while (currheadersourcelist) {
1871 if (currheadersourcelist->firstchild[arch]) { 1871 if (currheadersourcelist->firstchild[arch]) {
1872 fprintf(fbd,"%s ", currheadersourcelist->name); 1872 fprintf(fbd,"%s ", currheadersourcelist->name);
1873 fprintf(fs,"_%s ", currheadersourcelist->name); 1873 fprintf(fs,"_%s ", currheadersourcelist->name);
1874 } 1874 }
1875 currheadersourcelist = currheadersourcelist->next; 1875 currheadersourcelist = currheadersourcelist->next;
1876 } 1876 }
1877 fprintf(fbd,"\n"); 1877 fprintf(fbd,"\n");
1878 fprintf(fs,"\n"); 1878 fprintf(fs,"\n");
1879 fprintf(fb,"\n"); 1879 fprintf(fb,"\n");
1880 1880
1881 // write deps file 1881 // write deps file
1882 logmsg(LOG_DEBUG,"writing deps files (1)"); 1882 logmsg(LOG_DEBUG,"writing deps files (1)");
1883 struct providedList* provided = ct->providedlist_idx[arch][0]; 1883 struct providedList* provided = ct->providedlist_idx[arch][0];
1884 while (provided) { 1884 while (provided) {
1885 nonobsoletednumproviders=0; 1885 nonobsoletednumproviders=0;
1886 for (i = 0; i < provided->numproviders; i++) { 1886 for (i = 0; i < provided->numproviders; i++) {
1887 // skip duplicated provides 1887 // skip duplicated provides
1888 if (i > 0) { 1888 if (i > 0) {
1889 if (provided->provider[i] == provided->provider[i-1]) continue; 1889 if (provided->provider[i] == provided->provider[i-1]) continue;
1890 else if (!strcmp(provided->provider[i]->name,provided->provider[i-1]->name) && 1890 else if (!strcmp(provided->provider[i]->name,provided->provider[i-1]->name) &&
1891 !provided->provider[i-1]->obsoleted) continue; 1891 !provided->provider[i-1]->obsoleted) continue;
1892 } 1892 }
1893 if (!provided->provider[i]->obsoleted) nonobsoletednumproviders++; 1893 if (!provided->provider[i]->obsoleted) nonobsoletednumproviders++;
1894 } 1894 }
1895 if (nonobsoletednumproviders > 1) { 1895 if (nonobsoletednumproviders > 1) {
1896 fprintf(fd,"ifndef "); 1896 fprintf(fd,"ifndef ");
1897 fprintf_depstable_filtered_var(fd,provided->name); 1897 fprintf_depstable_filtered_var(fd,provided->name);
1898 fprintf(fd,"\n"); 1898 fprintf(fd,"\n");
1899 fprintf_depstable_filtered_var(fd,provided->name); 1899 fprintf_depstable_filtered_var(fd,provided->name);
1900 fprintf(fd," := "); 1900 fprintf(fd," := ");
1901 fprintf_depstable_filtered_var(fd,provided->name); 1901 fprintf_depstable_filtered_var(fd,provided->name);
1902 fprintf(fd,"_to_be_defined # "); 1902 fprintf(fd,"_to_be_defined # ");
1903 1903
1904 fprintf_depstable_filtered_var(fs,provided->name); 1904 fprintf_depstable_filtered_var(fs,provided->name);
1905 fprintf(fs,":"); 1905 fprintf(fs,":");
1906 for (i = 0; i < provided->numproviders; i++) { 1906 for (i = 0; i < provided->numproviders; i++) {
1907 if (!provided->provider[i]->obsoleted) { 1907 if (!provided->provider[i]->obsoleted) {
1908 fprintf(fd,"%s ",provided->provider[i]->name); 1908 fprintf(fd,"%s ",provided->provider[i]->name);
1909 fprintf(fs," _%s",provided->provider[i]->sourceheader->name); 1909 fprintf(fs," _%s",provided->provider[i]->sourceheader->name);
1910 } 1910 }
1911 } 1911 }
1912 fprintf(fs,"\n"); 1912 fprintf(fs,"\n");
1913 1913
1914 fprintf(fd,"\nendif\n"); 1914 fprintf(fd,"\nendif\n");
1915 fprintf_depstable_filtered_var(fd,provided->name); 1915 fprintf_depstable_filtered_var(fd,provided->name);
1916 fprintf(fd,": "); 1916 fprintf(fd,": ");
1917 fprintf(fd,"$("); 1917 fprintf(fd,"$(");
1918 fprintf_depstable_filtered_var(fd,provided->name); 1918 fprintf_depstable_filtered_var(fd,provided->name);
1919 fprintf(fd,")\n"); 1919 fprintf(fd,")\n");
1920 1920
1921 fprintf(fv,"%s= # ",provided->name); 1921 fprintf(fv,"%s= # ",provided->name);
1922 for (i = 0; i < provided->numproviders; i++) { 1922 for (i = 0; i < provided->numproviders; i++) {
1923 if (!provided->provider[i]->obsoleted) { 1923 if (!provided->provider[i]->obsoleted) {
1924 fprintf(fv,"%s ",provided->provider[i]->name); 1924 fprintf(fv,"%s ",provided->provider[i]->name);
1925 } 1925 }
1926 } 1926 }
1927 fprintf(fv,"\n"); 1927 fprintf(fv,"\n");
1928 } else if (nonobsoletednumproviders == 1) { 1928 } else if (nonobsoletednumproviders == 1) {
1929 for (i = 0; i < provided->numproviders; i++) { 1929 for (i = 0; i < provided->numproviders; i++) {
1930 if (!provided->provider[i]->obsoleted) break; 1930 if (!provided->provider[i]->obsoleted) break;
1931 } 1931 }
1932 if (strcmp(provided->name,provided->provider[i]->name)) { 1932 if (strcmp(provided->name,provided->provider[i]->name)) {
1933 fprintf_depstable_filtered_var(fd,provided->name); 1933 fprintf_depstable_filtered_var(fd,provided->name);
1934 fprintf(fd,": "); 1934 fprintf(fd,": ");
1935 fprintf(fd,"%s\n",provided->provider[i]->name); 1935 fprintf(fd,"%s\n",provided->provider[i]->name);
1936 fprintf_depstable_filtered_var(fs,provided->name); 1936 fprintf_depstable_filtered_var(fs,provided->name);
1937 fprintf(fs,": _%s\n",provided->provider[i]->sourceheader->name); 1937 fprintf(fs,": _%s\n",provided->provider[i]->sourceheader->name);
1938 } 1938 }
1939 } else { 1939 } else {
1940 fprintf_depstable_filtered_var(fd,provided->name); 1940 fprintf_depstable_filtered_var(fd,provided->name);
1941 fprintf(fd,": "); 1941 fprintf(fd,": ");
1942 fprintf(fd,"__missing_provider_for_"); 1942 fprintf(fd,"__missing_provider_for_");
1943 fprintf_depstable_filtered_var(fd,provided->name); 1943 fprintf_depstable_filtered_var(fd,provided->name);
1944 fprintf(fd,"\n"); 1944 fprintf(fd,"\n");
1945 } 1945 }
1946 provided = provided->next; 1946 provided = provided->next;
1947 } 1947 }
1948 1948
1949 logmsg(LOG_DEBUG,"writing deps files (2)"); 1949 logmsg(LOG_DEBUG,"writing deps files (2)");
1950 currheaderlist = ct->headerlist[arch]; 1950 currheaderlist = ct->headerlist[arch];
1951 while (currheaderlist) { 1951 while (currheaderlist) {
1952 fprintf(fd,"%s: ", currheaderlist->name); 1952 fprintf(fd,"%s: ", currheaderlist->name);
1953 for (i = 0; i < currheaderlist->requirecount; i++) { 1953 for (i = 0; i < currheaderlist->requirecount; i++) {
1954 if (currheaderlist->require[i]->resolved) { 1954 if (currheaderlist->require[i]->resolved) {
1955 if (currheaderlist->require[i]->resolved->numproviders == 0) { 1955 if (currheaderlist->require[i]->resolved->numproviders == 0) {
1956 fprintf_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name); 1956 fprintf_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name);
1957 fprintf(fd,"_unresolved_ "); 1957 fprintf(fd,"_unresolved_ ");
1958 } 1958 }
1959 else if (currheaderlist->require[i]->resolved->numproviders == 1) { 1959 else if (currheaderlist->require[i]->resolved->numproviders == 1) {
1960 if ((i == 0 || 1960 if ((i == 0 ||
1961 !currheaderlist->require[i-1]->resolved || 1961 !currheaderlist->require[i-1]->resolved ||
1962 !currheaderlist->require[i-1]->resolved->numproviders || 1962 !currheaderlist->require[i-1]->resolved->numproviders ||
1963 strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name, 1963 strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name,
1964 currheaderlist->require[i]->resolved->provider[0]->name)) && 1964 currheaderlist->require[i]->resolved->provider[0]->name)) &&
1965 strcmp(currheaderlist->name, 1965 strcmp(currheaderlist->name,
1966 currheaderlist->require[i]->resolved->provider[0]->name)) 1966 currheaderlist->require[i]->resolved->provider[0]->name))
1967 fprintf(fd,"%s ",currheaderlist->require[i]->resolved->provider[0]->name); 1967 fprintf(fd,"%s ",currheaderlist->require[i]->resolved->provider[0]->name);
1968 } else { 1968 } else {
1969 if (i == 0 || 1969 if (i == 0 ||
1970 !currheaderlist->require[i-1]->resolved || 1970 !currheaderlist->require[i-1]->resolved ||
1971 !currheaderlist->require[i-1]->resolved->numproviders || 1971 !currheaderlist->require[i-1]->resolved->numproviders ||
1972 strcmp(currheaderlist->require[i-1]->resolved->name, 1972 strcmp(currheaderlist->require[i-1]->resolved->name,
1973 currheaderlist->require[i]->resolved->name)) { 1973 currheaderlist->require[i]->resolved->name)) {
1974 fprintf_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name); 1974 fprintf_depstable_filtered_var(fd,currheaderlist->require[i]->resolved->name);
1975 fprintf(fd," "); 1975 fprintf(fd," ");
1976 } 1976 }
1977 } 1977 }
1978 } 1978 }
1979 } 1979 }
1980 fprintf(fd,"\n"); 1980 fprintf(fd,"\n");
1981 1981
1982 // 1982 //
1983 // write builddeps file 1983 // write builddeps file
1984 // 1984 //
1985 fprintf(fbd,"%s:",currheaderlist->name); 1985 fprintf(fbd,"%s:",currheaderlist->name);
1986 for (i = 0; i < currheaderlist->sourceheader->requirecount; i++) { 1986 for (i = 0; i < currheaderlist->sourceheader->requirecount; i++) {
1987 if (strncmp("rpmlib(",currheaderlist->sourceheader->require[i]->name,7) != 0) { 1987 if (strncmp("rpmlib(",currheaderlist->sourceheader->require[i]->name,7) != 0) {
1988 fprintf(fbd," "); 1988 fprintf(fbd," ");
1989 fprintf_depstable_filtered_var(fbd,currheaderlist->sourceheader->require[i]->name); 1989 fprintf_depstable_filtered_var(fbd,currheaderlist->sourceheader->require[i]->name);
1990 } 1990 }
1991 } 1991 }
1992 1992
1993 fprintf(fbd,"\n"); 1993 fprintf(fbd,"\n");
1994 1994
1995 /* for (i = 0; i < currheaderlist->obsoletecount; i++) { 1995 /* for (i = 0; i < currheaderlist->obsoletecount; i++) {
1996 fprintf(fbd,"%s: %s\n",currheaderlist->obsoletename[i],currheaderlist->name); 1996 fprintf(fbd,"%s: %s\n",currheaderlist->obsoletename[i],currheaderlist->name);
1997 }*/ 1997 }*/
1998 1998
1999 for (i = 0; i < currheaderlist->providecount; i++) { 1999 for (i = 0; i < currheaderlist->providecount; i++) {
2000 if (strncmp(currheaderlist->provided[i]->name,currheaderlist->name,PATH_MAX) != 0) { 2000 if (strncmp(currheaderlist->provided[i]->name,currheaderlist->name,PATH_MAX) != 0) {
2001 fprintf_depstable_filtered_var(fbd,currheaderlist->provided[i]->name); 2001 fprintf_depstable_filtered_var(fbd,currheaderlist->provided[i]->name);
2002 fprintf(fbd,": %s\n",currheaderlist->name); 2002 fprintf(fbd,": %s\n",currheaderlist->name);
2003 } 2003 }
2004 } 2004 }
2005 2005
2006 currheaderlist = currheaderlist->next; 2006 currheaderlist = currheaderlist->next;
2007 } 2007 }
2008 2008
2009 // 2009 //
2010 // headersourcelist scan: write builds and sources files 2010 // headersourcelist scan: write builds and sources files
2011 // 2011 //
2012 logmsg(LOG_DEBUG,"writing builds and sources files (1)"); 2012 logmsg(LOG_DEBUG,"writing builds and sources files (1)");
2013 fprintf(fbsh,"pkg_list=("); 2013 fprintf(fbsh,"pkg_list=(");
2014 currheadersourcelist = ct->headersourcelist; 2014 currheadersourcelist = ct->headersourcelist;
2015 while (currheadersourcelist != NULL) { 2015 while (currheadersourcelist != NULL) {
2016 if (((ct->repository_level == 0) || 2016 if (((ct->repository_level == 0) ||
2017 (currheadersourcelist->altrepository == ct->repository_level)) && 2017 (currheadersourcelist->altrepository == ct->repository_level)) &&
2018 (currheadersourcelist->firstchild[arch])) { 2018 (currheadersourcelist->firstchild[arch])) {
2019 fprintf(fbsh,"%s ",currheadersourcelist->name); 2019 fprintf(fbsh,"%s ",currheadersourcelist->name);
2020 } 2020 }
2021 currheadersourcelist = currheadersourcelist->next; 2021 currheadersourcelist = currheadersourcelist->next;
2022 } 2022 }
2023 fprintf(fbsh,");\n"); 2023 fprintf(fbsh,");\n");
2024 2024
2025 fprintf(fbsh,"needport_list=("); 2025 fprintf(fbsh,"needport_list=(");
2026 currheadersourcelist = ct->headersourcelist; 2026 currheadersourcelist = ct->headersourcelist;
2027 while (currheadersourcelist != NULL) { 2027 while (currheadersourcelist != NULL) {
2028 if (!currheadersourcelist->firstchild[arch] && 2028 if (!currheadersourcelist->firstchild[arch] &&
2029 currheadersourcelist->old && 2029 currheadersourcelist->old &&
2030 currheadersourcelist->old->firstchild[arch] && 2030 currheadersourcelist->old->firstchild[arch] &&
2031 (currheadersourcelist->altrepository == ct->repository_level)) { 2031 (currheadersourcelist->altrepository == ct->repository_level)) {
2032 fprintf(fbsh,"%s ",currheadersourcelist->name); 2032 fprintf(fbsh,"%s ",currheadersourcelist->name);
2033 } 2033 }
2034 currheadersourcelist = currheadersourcelist->next; 2034 currheadersourcelist = currheadersourcelist->next;
2035 } 2035 }
2036 fprintf(fbsh,");\n"); 2036 fprintf(fbsh,");\n");
2037 2037
2038 fprintf(fbsh,"warnings_list=("); 2038 fprintf(fbsh,"warnings_list=(");
2039 currheadersourcelist = ct->headersourcelist; 2039 currheadersourcelist = ct->headersourcelist;
2040 while (currheadersourcelist != NULL) { 2040 while (currheadersourcelist != NULL) {
2041 if ((currheadersourcelist->altrepository == ct->repository_level) && 2041 if ((currheadersourcelist->altrepository == ct->repository_level) &&
2042 (printHTMLWarnings(fw,ct,currheadersourcelist,2) == 1)) { 2042 (printHTMLWarnings(fw,ct,currheadersourcelist,2) == 1)) {
2043 fprintf(fbsh,"%s ",currheadersourcelist->name); 2043 fprintf(fbsh,"%s ",currheadersourcelist->name);
2044 } 2044 }
2045 currheadersourcelist = currheadersourcelist->next; 2045 currheadersourcelist = currheadersourcelist->next;
2046 } 2046 }
2047 fprintf(fbsh,");\n"); 2047 fprintf(fbsh,");\n");
2048 2048
2049 currheadersourcelist = ct->headersourcelist; 2049 currheadersourcelist = ct->headersourcelist;
2050 logmsg(LOG_DEBUG,"writing builds and sources files (2)"); 2050 logmsg(LOG_DEBUG,"writing builds and sources files (2)");
2051 while (currheadersourcelist != NULL) { 2051 while (currheadersourcelist != NULL) {
2052 2052
2053 currchild = currheadersourcelist->firstchild[arch]; 2053 currchild = currheadersourcelist->firstchild[arch];
2054 2054
2055 if (currchild) { 2055 if (currchild) {
2056 2056
2057 if (!strncmp(currheadersourcelist->arch, "noarch", PATH_MAX)) 2057 if (!strncmp(currheadersourcelist->arch, "noarch", PATH_MAX))
2058 snprintf(obsoletebuf, PATH_MAX, "noarch"); 2058 snprintf(obsoletebuf, PATH_MAX, "noarch");
2059 else 2059 else
2060 snprintf(obsoletebuf, PATH_MAX, "%s", ct->arch[arch]); 2060 snprintf(obsoletebuf, PATH_MAX, "%s", ct->arch[arch]);
2061 fprintf(fbsh,"[ \"$pkg\" = \"%s\" ] && { pkg_header=(%s %s %s %s \"%s\" \"%s\" %ld %ld %d %s); ", 2061 fprintf(fbsh,"[ \"$pkg\" = \"%s\" ] && { pkg_header=(%s %s %s %s \"%s\" \"%s\" %ld %ld %d %s); ",
2062 currheadersourcelist->name, 2062 currheadersourcelist->name,
2063 currheadersourcelist->name, 2063 currheadersourcelist->name,
2064 obsoletebuf, 2064 obsoletebuf,
2065 currheadersourcelist->version, 2065 currheadersourcelist->version,
2066 currheadersourcelist->release, 2066 currheadersourcelist->release,
2067 currheadersourcelist->group, 2067 currheadersourcelist->group,
2068 currheadersourcelist->license, 2068 currheadersourcelist->license,
2069 currheadersourcelist->size, 2069 currheadersourcelist->size,
2070 currheadersourcelist->buildtime, 2070 currheadersourcelist->buildtime,
2071 currheadersourcelist->altrepository, 2071 currheadersourcelist->altrepository,
2072 ct->repository[currheadersourcelist->altrepository]->tag); 2072 ct->repository[currheadersourcelist->altrepository]->tag);
2073 fprintf(fb,"%s:", 2073 fprintf(fb,"%s:",
2074 currheadersourcelist->name); 2074 currheadersourcelist->name);
2075 2075
2076 fprintf(fbsh,"pkg_builds=("); 2076 fprintf(fbsh,"pkg_builds=(");
2077 2077
2078 obsoletebuf[0] = '\0'; 2078 obsoletebuf[0] = '\0';
2079 2079
2080 while (currchild) { 2080 while (currchild) {
2081 if (currchild->obsoleted == 0) { 2081 if (currchild->obsoleted == 0) {
2082 fprintf(fbsh,"%s",currchild->name); 2082 fprintf(fbsh,"%s",currchild->name);
2083 fprintf(fb," %s",currchild->name); 2083 fprintf(fb," %s",currchild->name);
2084 } 2084 }
2085 for (i = 0; i < currchild->obsoletecount; i++ ) { 2085 for (i = 0; i < currchild->obsoletecount; i++ ) {
2086 if ((i > 0) && (!strcmp(currchild->obsoletename[i],currchild->obsoletename[i-1]))) continue; 2086 if ((i > 0) && (!strcmp(currchild->obsoletename[i],currchild->obsoletename[i-1]))) continue;
2087 if (strlen(obsoletebuf) + strlen(currchild->obsoletename[i]) >= PATH_MAX - 2) { 2087 if (strlen(obsoletebuf) + strlen(currchild->obsoletename[i]) >= PATH_MAX - 2) {
2088 logmsg(LOG_WARNING, "%s: reached obsoletebuf maximum size (%d); skipping further obsoletes in output file", 2088 logmsg(LOG_WARNING, "%s: reached obsoletebuf maximum size (%d); skipping further obsoletes in output file",
2089 currheadersourcelist->name, PATH_MAX); 2089 currheadersourcelist->name, PATH_MAX);
2090 break; 2090 break;
2091 } 2091 }
2092 if (obsoletebuf[0] != '\0') strncat(obsoletebuf, " ", sizeof(obsoletebuf) - strlen(obsoletebuf)); 2092 if (obsoletebuf[0] != '\0') strncat(obsoletebuf, " ", sizeof(obsoletebuf) - strlen(obsoletebuf));
2093 strncat(obsoletebuf, currchild->obsoletename[i], sizeof(obsoletebuf) - strlen(obsoletebuf)); 2093 strncat(obsoletebuf, currchild->obsoletename[i], sizeof(obsoletebuf) - strlen(obsoletebuf));
2094 } 2094 }
2095 currchild = currchild->nextbrother; 2095 currchild = currchild->nextbrother;
2096 if (currchild) fprintf(fbsh," "); 2096 if (currchild) fprintf(fbsh," ");
2097 } 2097 }
2098 fprintf(fbsh,"); pkg_obsoletes=(%s);",obsoletebuf); 2098 fprintf(fbsh,"); pkg_obsoletes=(%s);",obsoletebuf);
2099 2099
2100 /* find pointer to firstrebuild also looking into old packages */ 2100 /* find pointer to firstrebuild also looking into old packages */
2101 currrebuild = currheadersourcelist->firstrebuild; 2101 currrebuild = currheadersourcelist->firstrebuild;
2102 oldheadersourcelist = currheadersourcelist->old; 2102 oldheadersourcelist = currheadersourcelist->old;
2103 while (!currrebuild && oldheadersourcelist) { 2103 while (!currrebuild && oldheadersourcelist) {
2104 currrebuild = oldheadersourcelist->firstrebuild; 2104 currrebuild = oldheadersourcelist->firstrebuild;
2105 oldheadersourcelist = oldheadersourcelist->old; 2105 oldheadersourcelist = oldheadersourcelist->old;
2106 } 2106 }
2107 fprintf(fbsh," pkg_needrebuild=("); 2107 fprintf(fbsh," pkg_needrebuild=(");
2108 while (currrebuild) { 2108 while (currrebuild) {
2109 fprintf(fbsh, "%s@%s ", currrebuild->sourceheader->name, currrebuild->provider->name); 2109 fprintf(fbsh, "%s@%s ", currrebuild->sourceheader->name, currrebuild->provider->name);
2110 currrebuild = currrebuild->next; 2110 currrebuild = currrebuild->next;
2111 } 2111 }
2112 fprintf(fbsh,"); }\n"); 2112 fprintf(fbsh,"); }\n");
2113 fprintf(fb,"\n"); 2113 fprintf(fb,"\n");
2114 2114
2115 } 2115 }
2116 currheadersourcelist = currheadersourcelist->next; 2116 currheadersourcelist = currheadersourcelist->next;
2117 } 2117 }
2118 2118
2119 fclose(fd); 2119 fclose(fd);
2120 fclose(fv); 2120 fclose(fv);
2121 fclose(fbsh); 2121 fclose(fbsh);
2122 fclose(fb); 2122 fclose(fb);
2123 fclose(fs); 2123 fclose(fs);
2124 fclose(fw); 2124 fclose(fw);
2125 2125
2126 return 0; 2126 return 0;
2127 } 2127 }
2128 2128
2129 int 2129 int
2130 generateSrcPkgList(struct configTag *ct) 2130 generateSrcPkgList(struct configTag *ct)
2131 { 2131 {
2132 FILE *fd; 2132 FILE *fd;
2133 char fn[PATH_MAX]; 2133 char fn[PATH_MAX];
2134 struct headerSourceList *currheadersourcelist; 2134 struct headerSourceList *currheadersourcelist;
2135 humanDate strdate; 2135 humanDate strdate;
2136 int i; 2136 int i;
2137 2137
2138 snprintf(fn, PATH_MAX, "%ssrcpkglist",ct->repository_dir); 2138 snprintf(fn, PATH_MAX, "%ssrcpkglist",ct->repository_dir);
2139 fd=fopen(fn,"w"); 2139 fd=fopen(fn,"w");
2140 2140
2141 if (!fd) { 2141 if (!fd) {
2142 fprintf(stderr, "Error: can't open file for writing: %s\n", fn); 2142 fprintf(stderr, "Error: can't open file for writing: %s\n", fn);
2143 return 1; 2143 return 1;
2144 } 2144 }
2145 2145
2146 currheadersourcelist = ct->headersourcelist; 2146 currheadersourcelist = ct->headersourcelist;
2147 while (currheadersourcelist != NULL) { 2147 while (currheadersourcelist != NULL) {
2148 fprintf(fd, "%s %s %s %s %ld %s ", 2148 fprintf(fd, "%s %s %s %s %ld %s ",
2149 currheadersourcelist->name, 2149 currheadersourcelist->name,
2150 currheadersourcelist->version, 2150 currheadersourcelist->version,
2151 (char *)simpleTimeToTemplate(currheadersourcelist->buildtime,"%Y%m%d",&strdate), 2151 (char *)simpleTimeToTemplate(currheadersourcelist->buildtime,"%Y%m%d",&strdate),
2152 ct->repository[currheadersourcelist->altrepository]->tag, 2152 ct->repository[currheadersourcelist->altrepository]->tag,
2153 currheadersourcelist->epoch, 2153 currheadersourcelist->epoch,
2154 currheadersourcelist->release); 2154 currheadersourcelist->release);
2155 2155
2156 if (currheadersourcelist->source) { 2156 if (currheadersourcelist->source) {
2157 i=0; 2157 i=0;
2158 while (currheadersourcelist->source[i+1]) i++; 2158 while (currheadersourcelist->source[i+1]) i++;
2159 for (; i>=0; i--) 2159 for (; i>=0; i--)
2160 fprintf(fd, "%s ",currheadersourcelist->source[i]); 2160 fprintf(fd, "%s ",currheadersourcelist->source[i]);
2161 } 2161 }
2162 fprintf(fd, "\n"); 2162 fprintf(fd, "\n");
2163 currheadersourcelist = currheadersourcelist->next; 2163 currheadersourcelist = currheadersourcelist->next;
2164 } 2164 }
2165 fclose(fd); 2165 fclose(fd);
2166 2166
2167 return 0; 2167 return 0;
2168 } 2168 }
2169 2169
2170 int 2170 int
2171 generatePkgList(struct configTag *ct, int arch) 2171 generatePkgList(struct configTag *ct, int arch)
2172 { 2172 {
2173 FILE *fd; 2173 FILE *fd;
2174 char fn[PATH_MAX]; 2174 char fn[PATH_MAX];
2175 struct headerList *currheaderlist; 2175 struct headerList *currheaderlist;
2176 2176
2177 snprintf(fn, PATH_MAX, "%spkglist.%s",ct->repository_dir,ct->arch[arch]); 2177 snprintf(fn, PATH_MAX, "%spkglist.%s",ct->repository_dir,ct->arch[arch]);
2178 fd=fopen(fn,"w"); 2178 fd=fopen(fn,"w");
2179 2179
2180 if (!fd) { 2180 if (!fd) {
2181 fprintf(stderr, "Error: can't open file for writing: %s\n", fn); 2181 fprintf(stderr, "Error: can't open file for writing: %s\n", fn);
2182 return 1; 2182 return 1;
2183 } 2183 }
2184 2184
2185 /* currheaderlist = headerlist; */ 2185 /* currheaderlist = headerlist; */
2186 currheaderlist = ct->headerlist[arch]; 2186 currheaderlist = ct->headerlist[arch];
2187 while (currheaderlist != NULL) { 2187 while (currheaderlist != NULL) {
2188 fprintf(fd, "%s %s %ld %d %s %ld %s\n", 2188 fprintf(fd, "%s %s %ld %d %s %ld %s\n",
2189 currheaderlist->name, 2189 currheaderlist->name,
2190 currheaderlist->version, 2190 currheaderlist->version,
2191 currheaderlist->size, currheaderlist->filenamecount, 2191 currheaderlist->size, currheaderlist->filenamecount,
2192 ct->repository[currheaderlist->altrepository]->tag, 2192 ct->repository[currheaderlist->altrepository]->tag,
2193 currheaderlist->epoch, 2193 currheaderlist->epoch,
2194 currheaderlist->release); 2194 currheaderlist->release);
2195 currheaderlist = currheaderlist->next; 2195 currheaderlist = currheaderlist->next;
2196 } 2196 }
2197 fclose(fd); 2197 fclose(fd);
2198 2198
2199 return 0; 2199 return 0;
2200 } 2200 }
2201 2201