]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-deps-fix.patch
- release 1, works
[packages/poldek.git] / poldek-deps-fix.patch
1 Index: pkg.c
2 ===================================================================
3 RCS file: /cvsroot/installer/poldek/pkg.c,v
4 retrieving revision 1.51.4.5
5 diff -u -r1.51.4.5 pkg.c
6 --- pkg.c       5 May 2004 16:56:43 -0000       1.51.4.5
7 +++ pkg.c       11 Aug 2004 13:20:15 -0000
8 @@ -949,20 +949,31 @@
9      return rc;
10  }
11  
12 +static int do_pkg_match_req(const struct pkg *pkg, const struct capreq *req,
13 +                            int strict, int pkgnvr)
14 +{
15 +    if (pkgnvr && pkg_evr_match_req(pkg, req, strict))
16 +        return 1;
17 +    return pkg_caps_match_req(pkg, req, strict);
18 +}
19 +
20 +
21  int pkg_match_req(const struct pkg *pkg, const struct capreq *req, int strict)
22  {
23 +    int rc, v = strcmp(pkg->name, capreq_name(req)) == 0;
24 +    
25 +    rc = do_pkg_match_req(pkg, req, 1, v);
26  #if 0    
27 -    if (strcmp(pkg->name, "nspr") == 0 && strcmp(pkg->name, capreq_name(req)) == 0) {
28 -        printf("\nMATCH %d %s %s => %d\n", strict,
29 -               pkg_snprintf_epoch_s(pkg), capreq_snprintf_s(req),
30 -               pkg_evr_match_req(pkg, req, strict));
31 +    if (strcmp(capreq_name(req), "XFree86-OpenGL-core") == 0) {
32 +        printf("\n");
33 +        DBGF_F("%s, %s => %d; strict %d\n", pkg_snprintf_epoch_s(pkg),
34 +               capreq_snprintf_s(req), rc, strict);
35      }
36  #endif    
37 -    
38 -    if (strcmp(pkg->name, capreq_name(req)) == 0 && pkg_evr_match_req(pkg, req, strict))
39 -        return 1;
40 -    
41 -    return pkg_caps_match_req(pkg, req, strict);
42 +    if (!rc && !strict)
43 +        rc = do_pkg_match_req(pkg, req, 0, v);
44 +
45 +    return rc;
46  }
47  
48  
49 Index: pkgset-install.c
50 ===================================================================
51 RCS file: /cvsroot/installer/poldek/pkgset-install.c,v
52 retrieving revision 1.82.4.13
53 diff -u -r1.82.4.13 pkgset-install.c
54 --- pkgset-install.c    6 Jul 2004 18:18:00 -0000       1.82.4.13
55 +++ pkgset-install.c    11 Aug 2004 13:20:15 -0000
56 @@ -706,7 +706,7 @@
57  {
58      struct db_dep *db_dep;
59      struct capreq *req;
60 -
61 +    
62      DBGF("VUN %s: %s\n", pkg_snprintf_s(pkg), capreq_snprintf_s(cap));
63      if ((db_dep = db_deps_contains(upg->db_deps, cap, 0)) == NULL) {
64          DBGF("  [1] -> NO in db_deps\n");
65 @@ -728,7 +728,7 @@
66          return 1;
67      }
68  
69 -    if (db_dep->spkg && installset_provides(db_dep->spkg, req, ps, upg)) {
70 +    if (db_dep->spkg && installset_provides(NULL, req, ps, upg)) {
71          if (verbose > 1)
72              logn(LOGWARN, "cap %s satisfied by install set, shouldn't happen",
73                   capreq_snprintf_s(req));
74 @@ -837,6 +837,7 @@
75  {
76      int n, i;
77      rpmdb dbh = upg->inst->db->dbh;
78 +    tn_array *orphans;
79      
80      if (upg->inst->flags & INSTS_INSTALL)
81          return;
82 @@ -854,88 +855,84 @@
83      n = 0;
84      for (i=0; i < n_array_size(upg->uninst_set->dbpkgs); i++) {
85          struct dbpkg *dbpkg = n_array_nth(upg->uninst_set->dbpkgs, i);
86 -        if ((dbpkg->flags & DBPKG_TOUCHED) == 0) {
87 +        if ((dbpkg->flags & DBPKG_TOUCHED))
88 +            continue;
89 +        
90 +        dbpkg->flags |= DBPKG_TOUCHED;    
91 +        msgn_i(1, indent, _("%s obsoleted by %s"), dbpkg_snprintf_s(dbpkg),
92 +               pkg_snprintf_s(pkg));
93 +        pkg_rm_mark(dbpkg->pkg);
94 +        db_deps_remove_pkg(upg->db_deps, dbpkg->pkg);
95 +        db_deps_remove_pkg_caps(upg->db_deps, pkg,
96 +                                (ps->flags & PSDBDIRS_LOADED) == 0);
97              
98 -            msgn_i(1, indent, _("%s obsoleted by %s"), dbpkg_snprintf_s(dbpkg),
99 -                   pkg_snprintf_s(pkg));
100 -            pkg_rm_mark(dbpkg->pkg);
101 -            db_deps_remove_pkg(upg->db_deps, dbpkg->pkg);
102 -            db_deps_remove_pkg_caps(upg->db_deps, pkg,
103 -                                    (ps->flags & PSDBDIRS_LOADED) == 0);
104 -            
105 -            dbpkg->flags |= DBPKG_TOUCHED;
106 -            
107 -            if (dbpkg->pkg->caps) {
108 -                int j;
109 -                for (j=0; j < n_array_size(dbpkg->pkg->caps); j++) {
110 -                    struct capreq *cap = n_array_nth(dbpkg->pkg->caps, j);
111 -                    verify_unistalled_cap(indent, cap, dbpkg->pkg, ps, upg);
112 -                }
113 +        
114 +        if (dbpkg->pkg->caps) {
115 +            int j;
116 +            for (j=0; j < n_array_size(dbpkg->pkg->caps); j++) {
117 +                struct capreq *cap = n_array_nth(dbpkg->pkg->caps, j);
118 +                verify_unistalled_cap(indent, cap, dbpkg->pkg, ps, upg);
119              }
120 +        }
121  
122 -            if (pkg->fl && dbpkg->pkg->fl) {
123 -                struct capreq *cap;
124 -                int j, k;
125 -
126 +        if (pkg->fl && dbpkg->pkg->fl) {
127 +            struct capreq *cap;
128 +            int j, k;
129 +                
130                  
131 -                cap = alloca(sizeof(cap) + PATH_MAX);
132 -                memset(cap, 0, sizeof(*cap));
133 -                cap->_buf[0] = '\0';
134 -                
135 -                for (j=0; j < n_array_size(dbpkg->pkg->fl); j++) {
136 -                    struct pkgfl_ent *flent = n_array_nth(dbpkg->pkg->fl, j);
137 -                    char *path, *endp;
138 -                    int path_left_size;
139 +            cap = alloca(sizeof(cap) + PATH_MAX);
140 +            memset(cap, 0, sizeof(*cap));
141 +            cap->_buf[0] = '\0';
142 +                
143 +            for (j=0; j < n_array_size(dbpkg->pkg->fl); j++) {
144 +                struct pkgfl_ent *flent = n_array_nth(dbpkg->pkg->fl, j);
145 +                char *path, *endp;
146 +                int path_left_size;
147                      
148 -                    endp = path = &cap->_buf[1];
149 +                endp = path = &cap->_buf[1];
150  
151 -                    // not needed cause depdirs module is used 
152 -                    //if (n_array_bsearch(ps->depdirs, flent->dirname) == NULL)
153 -                    //    continue;
154 +                // not needed cause depdirs module is used 
155 +                //if (n_array_bsearch(ps->depdirs, flent->dirname) == NULL)
156 +                //    continue;
157                      
158 -                    if (*flent->dirname != '/')
159 -                        *endp++ = '/';
160 +                if (*flent->dirname != '/')
161 +                    *endp++ = '/';
162                              
163 -                    endp = n_strncpy(endp, flent->dirname, PATH_MAX);
164 -                    if (*(endp - 1) != '/')
165 -                            *endp++ = '/';
166 +                endp = n_strncpy(endp, flent->dirname, PATH_MAX);
167 +                if (*(endp - 1) != '/')
168 +                    *endp++ = '/';
169                      
170 -                    path_left_size = PATH_MAX - (endp - path);
171 +                path_left_size = PATH_MAX - (endp - path);
172                      
173 -                    for (k=0; k < flent->items; k++) {
174 -                        struct flfile *file = flent->files[k];
175 +                for (k=0; k < flent->items; k++) {
176 +                    struct flfile *file = flent->files[k];
177                          
178 -                        n_strncpy(endp, file->basename, path_left_size);
179 -                        verify_unistalled_cap(indent, cap, dbpkg->pkg, ps, upg);
180 -                    }
181 +                    n_strncpy(endp, file->basename, path_left_size);
182 +                    verify_unistalled_cap(indent, cap, dbpkg->pkg, ps, upg);
183                  }
184              }
185 -            
186 -            n += process_pkg_orphans(dbpkg->pkg, ps, upg);
187          }
188 +        
189 +        n += process_pkg_orphans(dbpkg->pkg, ps, upg);
190      }
191 +    
192 +    if (n == 0)
193 +        return;
194  
195 -    if (n) 
196 -        for (i=0; i<n_array_size(upg->orphan_dbpkgs); i++) {
197 -            struct dbpkg *dbpkg = n_array_nth(upg->orphan_dbpkgs, i);
198 -            int process_as;
199 -            
200 -            if (dbpkg->flags & DBPKG_DEPS_PROCESSED)
201 -                continue;
202 +    orphans = pkgs_array_new(n_array_size(upg->orphan_dbpkgs));
203 +    for (i=0; i<n_array_size(upg->orphan_dbpkgs); i++) {
204 +        struct dbpkg *dbpkg = n_array_nth(upg->orphan_dbpkgs, i);
205 +        if ((dbpkg->flags & DBPKG_DEPS_PROCESSED) == 0) {
206              dbpkg->flags |= DBPKG_DEPS_PROCESSED;
207 -#if 0
208 -            if ((pkg = is_pkg_obsoletedby_installset(ps, dbpkg->pkg))) {
209 -                process_as = PROCESS_AS_NEW;
210 -                
211 -            } else
212 -#endif                
213 -             {
214 -                pkg = dbpkg->pkg;
215 -                process_as = PROCESS_AS_ORPHAN;
216 -             }
217 -            
218 -            process_pkg_deps(indent, pkg, ps, upg, process_as);
219 +            n_array_push(orphans, pkg_link(dbpkg->pkg));
220          }
221 +    }
222 +
223 +    for (i=0; i<n_array_size(orphans); i++) {
224 +        struct pkg *dbpkg = n_array_nth(orphans, i);
225 +        process_pkg_deps(indent, dbpkg, ps, upg, PROCESS_AS_ORPHAN);
226 +    }
227 +    n_array_free(orphans);
228  }
229  
230  static
This page took 0.039611 seconds and 4 git commands to generate.