12 #include "repoinfo_config_debian.h"
17 read_repoinfos_debian(Pool *pool, int *nrepoinfosp)
23 char *kp, *url, *distro;
24 struct repoinfo *repoinfos = 0, *cinfo;
29 fp = fopen("/etc/apt/sources.list", "r");
36 dir = opendir("/etc/apt/sources.list.d");
40 if ((ent = readdir(dir)) == 0)
45 if (ent->d_name[0] == '.')
47 l = strlen(ent->d_name);
48 if (l < 5 || strcmp(ent->d_name + l - 5, ".list") != 0)
50 snprintf(buf, sizeof(buf), "%s/%s", "/etc/apt/sources.list.d", ent->d_name);
51 if (!(fp = fopen(buf, "r")))
54 while(fgets(buf2, sizeof(buf2), fp))
59 while (l && (buf2[l - 1] == '\n' || buf2[l - 1] == ' ' || buf2[l - 1] == '\t'))
62 while (*kp == ' ' || *kp == '\t')
64 if (!*kp || *kp == '#')
66 if (strncmp(kp, "deb", 3) != 0)
69 if (*kp != ' ' && *kp != '\t')
71 while (*kp == ' ' || *kp == '\t')
76 while (*kp && *kp != ' ' && *kp != '\t')
80 while (*kp == ' ' || *kp == '\t')
85 while (*kp && *kp != ' ' && *kp != '\t')
89 while (*kp == ' ' || *kp == '\t')
93 repoinfos = solv_extend(repoinfos, nrepoinfos, 1, sizeof(*repoinfos), 15);
94 cinfo = repoinfos + nrepoinfos++;
95 memset(cinfo, 0, sizeof(*cinfo));
96 cinfo->baseurl = strdup(url);
97 cinfo->alias = solv_dupjoin(url, "/", distro);
98 cinfo->name = strdup(distro);
99 cinfo->type = TYPE_DEBIAN;
101 cinfo->autorefresh = 1;
102 cinfo->repo_gpgcheck = 1;
103 cinfo->metadata_expire = METADATA_EXPIRE;
107 while (*kp == ' ' || *kp == '\t')
112 while (*kp && *kp != ' ' && *kp != '\t')
116 cinfo->components = solv_extend(cinfo->components, cinfo->ncomponents, 1, sizeof(*cinfo->components), 15);
117 cinfo->components[cinfo->ncomponents++] = strdup(compo);
123 *nrepoinfosp = nrepoinfos;