ARMaelalip_appman_ext
Attachment 'get_list.patch'
Download 1 357a358,448
2 > // push_front()/sort()/unique() check length might be better???
3 > int PMP_if_new_add(list<string> & required, string pkg_name)
4 > {
5 > // My first attempt at overcoming circular dependencies
6 > // If package already in list - skip
7 > for(list<string>::iterator s = required.begin(); s != required.end(); s++)
8 > {
9 > if(!s->compare(pkg_name))
10 > {
11 > printf("PMP Already processed - %s\n", pkg_name.c_str());
12 > return 0;
13 > }
14 > }
15 > printf("PMP %s not already in the required list\n", pkg_name.c_str());
16 > required.push_front(pkg_name);
17 > return 1;
18 > }
19 > static int safety_limit = 0;
20 > #define LIMIT 30
21 > // Currently I believe the DepIterator is really a RelationshipIterator
22 > // Dependency is one type of relationship
23 > // apt-pkg/pkgcache.h
24 > // struct Dep
25 > // {
26 > // enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,Conflicts=5,Replaces=6,Obsoletes=7,DpkgBreaks=8,Enhances=9};
27 > // enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,Greater=0x4,Equals=0x5,NotEquals=0x6};
28 > // };
29 > // dep is the dependency list for pkg_name
30 > int PMP_process_relationship_list(pkgCache::DepIterator dep, string pkg_name, list<string> & required)
31 > {
32 > // Recursion protection
33 > safety_limit++;
34 > if(safety_limit > LIMIT )
35 > {
36 > printf("PMP Touched bottom\n");
37 > safety_limit = 0;
38 > return 0;
39 > }
40 > if (!(safety_limit%10))
41 > {
42 > _error->Error(_("PMP Down to %d"), safety_limit);
43 > }
44 >
45 > printf("PMP start for package %s - level %d\n", pkg_name.c_str(), safety_limit);
46 > // Name of the package of this dependency is dep.TargetPkg().Name()
47 > printf("PMP Current list contents\n");
48 > for(pkgCache::DepIterator d1 = dep; !d1.end(); d1++)
49 > {
50 > string d1_name = d1.TargetPkg().Name();
51 > printf("PMP d1[%lu] is package %s, type %d\n", d1.Index(), d1_name.c_str(), d1->Type);
52 > }
53 >
54 > if(!PMP_if_new_add(required, pkg_name))
55 > return 0;
56 >
57 > for(pkgCache::DepIterator d = dep; !d.end(); d++)
58 > {
59 > string dep_name = d.TargetPkg().Name();
60 > printf("PMP d[%lu] is package %s, type %d\n", d.Index(), dep_name.c_str(), d->Type);
61 > if(d->Type == pkgCache::Dep::Depends)
62 > {
63 > printf("PMP Find dependencyList for package %s\n", dep_name.c_str());
64 > pkgCache::PkgIterator pkg = (*apt_cache_file)->FindPkg(dep_name);
65 > if(pkg.end())
66 > {
67 > printf("PMP Could not find package %s\n", dep_name.c_str());
68 > return 0;
69 > }
70 > else
71 > {
72 > // TODO:: More checking & understanding here
73 > pkgCache::VerIterator v = pkg.VersionList();
74 > if(v.IsGood())
75 > {
76 > printf("PMP Recursive call for d[%lu]\n", d.Index());
77 > if(!v.DependsList().end())
78 > PMP_process_relationship_list(v.DependsList(), dep_name, required);
79 > else
80 > printf("PMP no depends for %s - add it to list here\n", dep_name.c_str());
81 > PMP_if_new_add(required, dep_name);
82 > }
83 > else
84 > {
85 > printf("PMP Bad VersionList in package %s\n", dep_name.c_str());
86 > }
87 > }
88 > }
89 > }
90 > printf("PMP End return \n");
91 > return 0;
92 > }
93 419a511,525
94 >
95 > // PMP
96 > list<string> PMPTotalList;
97 > printf("PMP PMP_process_relationship_list for package %s\n", pkg.Name());
98 > PMP_process_relationship_list(ver.DependsList(), pkg.Name(), PMPTotalList);
99 >
100 > printf("======\n");
101 > for(list<string>::iterator l = PMPTotalList.begin(); l != PMPTotalList.end(); l++)
102 > {
103 > printf("%s\n", l->c_str());
104 > }
105 > printf("======\n");
106 >
107 >
108 >
109 454a561,572
110 > /*
111 > if(!is_pattern)
112 > {
113 > pkg=(*apt_cache_file)->FindPkg(name);
114 >
115 > if(pkg.end())
116 > {
117 > _error->Error(_("Unable to locate package %s"), s.c_str());
118 > return false;
119 > }
120 > }
121 > */
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.