-/* vim: sw=2 et cino=>4,n-2,{1s
- */
-
/*
- * Copyright (c) 2009, Novell Inc.
+ * Copyright (c) 2009-2015, SUSE LLC
*
* This program is licensed under the BSD license, read LICENSE.BSD
* for further information
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <zlib.h>
#include "pool.h"
#include "poolarch.h"
#ifdef ENABLE_DEBIAN
#include "repo_deb.h"
#endif
+#ifdef ENABLE_ARCHREPO
+#include "repo_arch.h"
+#endif
#include "solver.h"
#include "solv_xfopen.h"
+#ifdef _WIN32
+#include "strfncs.h"
+#endif
void
usage(char** argv)
exit(1);
}
+#if defined(ENABLE_SUSEREPO) || defined(ENABLE_RPMMD) || defined(ENABLE_DEBIAN) || defined(ENABLE_ARCHREPO)
+static size_t
+strlen_comp(const char *str)
+{
+ const char *suf = strrchr(str, '.');
+ return strlen(str) - (suf && solv_xfopen_iscompressed(suf) ? strlen(suf) : 0);
+}
+#endif
int
main(int argc, char **argv)
for (i = 2; i < argc; i++)
{
FILE *fp;
- int r, l;
+ int r;
+#if defined(ENABLE_SUSEREPO) || defined(ENABLE_RPMMD) || defined(ENABLE_DEBIAN) || defined(ENABLE_ARCHREPO)
+ size_t l;
+#endif
if (!strcmp(argv[i], "--withsrc"))
{
++i;
continue;
}
- l = strlen(argv[i]);
+#if defined(ENABLE_SUSEREPO) || defined(ENABLE_RPMMD) || defined(ENABLE_DEBIAN) || defined(ENABLE_ARCHREPO)
+ l = strlen_comp(argv[i]);
+#endif
if (!strcmp(argv[i], "-"))
fp = stdin;
else if ((fp = solv_xfopen(argv[i], 0)) == 0)
{
}
#ifdef ENABLE_SUSEREPO
- else if (l >= 8 && !strcmp(argv[i] + l - 8, "packages"))
- {
- r = repo_add_susetags(repo, fp, 0, 0, 0);
- }
- else if (l >= 11 && !strcmp(argv[i] + l - 11, "packages.gz"))
+ else if (l >= 8 && !strncmp(argv[i] + l - 8, "packages", 8))
{
r = repo_add_susetags(repo, fp, 0, 0, 0);
}
#endif
#ifdef ENABLE_RPMMD
- else if (l >= 14 && !strcmp(argv[i] + l - 14, "primary.xml.gz"))
+ else if (l >= 11 && !strncmp(argv[i] + l - 11, "primary.xml", 11))
{
r = repo_add_rpmmd(repo, fp, 0, 0);
+ if (!r && i + 1 < argc)
+ {
+ l = strlen_comp(argv[i + 1]);
+ if (l >= 13 && !strncmp(argv[i + 1] + l - 13, "filelists.xml", 13))
+ {
+ i++;
+ fclose(fp);
+ if ((fp = solv_xfopen(argv[i], 0)) == 0)
+ {
+ perror(argv[i]);
+ exit(1);
+ }
+ r = repo_add_rpmmd(repo, fp, 0, REPO_EXTEND_SOLVABLES|REPO_LOCALPOOL);
+ }
+ }
}
#endif
#ifdef ENABLE_DEBIAN
- else if (l >= 8 && !strcmp(argv[i] + l - 8, "Packages"))
- {
- r = repo_add_debpackages(repo, fp, 0);
- }
- else if (l >= 11 && !strcmp(argv[i] + l - 11, "Packages.gz"))
+ else if (l >= 8 && !strncmp(argv[i] + l - 8, "Packages", 8))
{
r = repo_add_debpackages(repo, fp, 0);
}
#endif
+#ifdef ENABLE_ARCHREPO
+ else if (l >= 7 && (!strncmp(argv[i] + l - 7, ".db.tar", 7)))
+ {
+ r = repo_add_arch_repo(repo, fp, 0);
+ }
+#endif
else
r = repo_add_solv(repo, fp, 0);
if (r)
cand.elements[j++] = p;
continue;
}
-#if 0
- Solvable *s = pool->solvables + p;
- if (!strcmp(pool_id2str(pool, s->name), "libusb-compat-devel"))
- {
- cand.elements[j++] = p;
- continue;
- }
-#endif
}
cand.count = j;
if (i == j)
if (problemcount)
{
Id problem = 0;
- Solvable *s2;
status = 1;
printf("can't install %s:\n", pool_solvable2str(pool, s));
solver_allruleinfos(solv, probr, &rinfo);
for (k = 0; k < rinfo.count; k += 4)
{
- Id dep, source, target;
+ Id type, dep, source, target;
+ type = rinfo.elements[k];
source = rinfo.elements[k + 1];
target = rinfo.elements[k + 2];
dep = rinfo.elements[k + 3];
- switch (rinfo.elements[k])
+
+ /* special casing */
+ switch (type)
{
case SOLVER_RULE_DISTUPGRADE:
- break;
- case SOLVER_RULE_INFARCH:
- s = pool_id2solvable(pool, source);
- printf(" %s has inferior architecture\n", pool_solvable2str(pool, s));
- break;
- case SOLVER_RULE_UPDATE:
- s = pool_id2solvable(pool, source);
- printf(" %s can not be updated\n", pool_solvable2str(pool, s));
- break;
case SOLVER_RULE_JOB:
case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
case SOLVER_RULE_JOB_UNSUPPORTED:
break;
- case SOLVER_RULE_RPM:
- printf(" some dependency problem\n");
- break;
- case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
- printf(" nothing provides requested %s\n", pool_dep2str(pool, dep));
- break;
- case SOLVER_RULE_RPM_NOT_INSTALLABLE:
- s = pool_id2solvable(pool, source);
- printf(" package %s is not installable\n", pool_solvable2str(pool, s));
+ case SOLVER_RULE_UPDATE:
+ printf(" %s can not be updated\n", pool_solvid2str(pool, source));
break;
- case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP:
- s = pool_id2solvable(pool, source);
- printf(" nothing provides %s needed by %s\n", pool_dep2str(pool, dep), pool_solvable2str(pool, s));
+ case SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP:
+ printf(" %s\n", solver_problemruleinfo2str(solv, type, source, target, dep));
if (ISRELDEP(dep))
{
Reldep *rd = GETRELDEP(pool, dep);
}
}
break;
- case SOLVER_RULE_RPM_SAME_NAME:
- s = pool_id2solvable(pool, source);
- s2 = pool_id2solvable(pool, target);
- printf(" cannot install both %s and %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, s2));
- break;
- case SOLVER_RULE_RPM_PACKAGE_CONFLICT:
- s = pool_id2solvable(pool, source);
- s2 = pool_id2solvable(pool, target);
- printf(" package %s conflicts with %s provided by %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, dep), pool_solvable2str(pool, s2));
- break;
- case SOLVER_RULE_RPM_PACKAGE_OBSOLETES:
- s = pool_id2solvable(pool, source);
- s2 = pool_id2solvable(pool, target);
- printf(" package %s obsoletes %s provided by %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, dep), pool_solvable2str(pool, s2));
- break;
- case SOLVER_RULE_RPM_PACKAGE_REQUIRES:
- s = pool_id2solvable(pool, source);
- printf(" package %s requires %s, but none of the providers can be installed\n", pool_solvable2str(pool, s), pool_dep2str(pool, dep));
- break;
- case SOLVER_RULE_RPM_SELF_CONFLICT:
- s = pool_id2solvable(pool, source);
- printf(" package %s conflicts with %s provided by itself\n", pool_solvable2str(pool, s), pool_dep2str(pool, dep));
+ default:
+ printf(" %s\n", solver_problemruleinfo2str(solv, type, source, target, dep));
break;
}
}
}
}
}
-#if 0
- else
- {
- if (!strcmp(pool_id2str(pool, s->name), "libusb-compat-devel"))
- {
- solver_printdecisions(solv);
- }
- }
-#endif
}
solver_free(solv);
exit(status);