Further removal of code generating config for the obsolete smart package manager

This commit is contained in:
Silvan Calarco 2021-02-17 20:36:08 +01:00
parent 39af94aa1d
commit 32a0b172de

View File

@ -709,8 +709,8 @@ generateStats(struct configTag *configtag,int arch)
int
generateHTMLMainIndex(struct configTag *configtag)
{
char indexfile[PATH_MAX],smartfile[PATH_MAX],buffer[PATH_MAX],smartpyfile[PATH_MAX];
FILE *fout,*fsmart,*fsmartpy;
char indexfile[PATH_MAX],buffer[PATH_MAX];
FILE *fout;
int i;
if (!configtag->configdefaults->html_basedir) {
@ -725,76 +725,25 @@ generateHTMLMainIndex(struct configTag *configtag)
return 1;
}
/* create Smart Package Manager channel files */
snprintf(smartfile,PATH_MAX,"%s%s.smart",
configtag->configdefaults->html_basedir,
configtag->configdefaults->distribution_name);
snprintf(smartpyfile,PATH_MAX,"%s%s.smart.py",
configtag->configdefaults->html_basedir,
configtag->configdefaults->distribution_name);
if ((fsmart = fopen(smartfile, "w")) == NULL) {
perror(smartfile);
return 1;
}
if ((fsmartpy = fopen(smartpyfile, "w")) == NULL) {
perror(smartpyfile);
return 1;
}
fprintf(fout,"<b>Available repositories:</b><br><br>\n");
while (configtag) {
fprintf(fout,
"<a href=\"%stag=%s\">%s</a>: %s<br>",
configtag->configdefaults->url_prefix,
configtag->tag,
configtag->tag,
configtag->description);
fprintf(fout,
"<a href=\"%stag=%s\">%s</a>: %s<br>",
configtag->configdefaults->url_prefix,
configtag->tag,
configtag->tag,
configtag->description);
/* remove final slashes from download_prefix as required by apt */
strcpy(buffer, configtag->download_dir);
i=strlen(buffer);
while ((i > 0) && (buffer[i-1] == '/' )) {
buffer[i-1]='\0';
i--;
}
fprintf(fsmart, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n",
configtag->configdefaults->distribution_name,
configtag->tag);
fprintf(fsmart, "[%s]\ntype = apt-rpm\n",
configtag->tag);
fprintf(fsmart, "name = %s\n",
configtag->description);
fprintf(fsmart, "disabled = yes\n");
fprintf(fsmart, "baseurl = http://%s%s\n",
configtag->configdefaults->url_address, buffer);
fprintf(fsmart, "components = %s\n\n",
configtag->arch[0]);
fprintf(fsmartpy, "#\n# %s %s channel configuration for Smart Package Manager\n#\n\n",
configtag->configdefaults->distribution_name,
configtag->tag);
fprintf(fsmartpy, "if not sysconf.get((\"channels\", \"%s\")):\n",
configtag->tag);
fprintf(fsmartpy, "\tsysconf.set((\"channels\", \"%s\"),\n",
configtag->tag);
fprintf(fsmartpy, "\t\t\t{\"alias\": \"%s\",\n",
configtag->tag);
fprintf(fsmartpy, "\t\t\t\"type\": \"apt-rpm\",\n");
fprintf(fsmartpy, "\t\t\t\"name\": \"%s\",\n",
configtag->description);
fprintf(fsmartpy, "\t\t\t\"disabled\": \"yes\",\n");
fprintf(fsmartpy, "\t\t\t\"baseurl\": \"http://%s%s\",\n",
configtag->configdefaults->url_address, buffer);
fprintf(fsmartpy, "\t\t\t\"components\": \"%s\"})\n\n",
configtag->arch[0]);
configtag = configtag->next;
/* remove final slashes from download_prefix as required by apt */
strcpy(buffer, configtag->download_dir);
i=strlen(buffer);
while ((i > 0) && (buffer[i-1] == '/' )) {
buffer[i-1]='\0';
i--;
}
configtag = configtag->next;
}
fclose(fout);
fclose(fsmart);
fclose(fsmartpy);
return 0;
}