1 #if defined(ENABLE_RPMDB) || defined(ENABLE_RPMPKG)
13 #include "repo_autopattern.h"
16 #include "repoinfo_cache.h"
17 #include "repoinfo_download.h"
18 #include "repoinfo_type_rpmmd.h"
19 #include "ext/repo_rpmdb.h"
21 static inline int endswith(const char* str, const char* suf)
23 if (strlen(str) < strlen(suf))
25 return strcmp(str + strlen(str) - strlen(suf), suf) == 0;
29 plaindir_load(struct repoinfo *cinfo, Pool **sigpoolp)
31 Repo *repo = cinfo->repo;
37 printf("plaindir repo '%s':", cinfo->alias);
39 if (stat(cinfo->path, &stb))
44 calc_cookie_stat(&stb, REPOKEY_TYPE_SHA256, NULL, cinfo->cookie);
46 if (usecachedrepo(cinfo, 0, 1))
52 if ((dp = opendir(cinfo->path)) == 0)
57 while ((de = readdir(dp)) != 0)
59 if (de->d_name[0] == 0 || de->d_name[0] == '.')
61 if (!endswith(de->d_name, ".rpm") || endswith(de->d_name, ".delta.rpm") || endswith(de->d_name, ".patch.rpm"))
63 char* fn = solv_dupjoin(cinfo->path, "/", de->d_name);
64 repo_add_rpm(repo, fn, 0);
70 repo_add_autopattern(repo, 0);
72 data = repo_add_repodata(repo, 0);
73 repodata_internalize(data);
74 writecachedrepo(cinfo, 0, 0);
75 repodata_create_stubs(repo_last_repodata(repo));