[pacman-dev] output issue with requiredby when syncing

James Rosten seinfeld90 at gmail.com
Sun Mar 18 14:48:47 EDT 2007


This was reported by stonecrest in IRC and after a lengthy conversation
with him and Dan and lots of digging through code and learning about the
existance of cscope (very helpful by the way), I finally decided that
because we use PM_DEP_TYPE_DEPEND and PM_DEP_TYPE_REQUIRED exactly the
same way in the code (they are values of enum pmdeptype_t), that they
can safely be merged, which I did.

The patch is below, and I ran make check and everything but
upgrade051.py passed (I'm not sure if its failure is already known
about).  Also in the process I wrote two new pactest cases, which are
below also (my numbers for them were pure guesses on the numbering
scheme).

~ Jamie / yankees26

Signed-off-by: James Rosten <seinfeld90 at gmail.com>

============================================================
--- OLD/lib/libalpm/alpm.h  c03ac784425cc9f185b169790623bad258c518e6
+++ NEW/lib/libalpm/alpm.h  141e295deed23b259b3d92e04bf63bacffd1a896
@@ -371,7 +371,6 @@ typedef enum _pmdeptype_t {
 
 typedef enum _pmdeptype_t {
    PM_DEP_TYPE_DEPEND = 1,
-   PM_DEP_TYPE_REQUIRED,
    PM_DEP_TYPE_CONFLICT
 } pmdeptype_t;
 
============================================================
--- OLD/lib/libalpm/deps.c  065f3a78b9a5a454c73651416ce7cb03c59fcb54
+++ NEW/lib/libalpm/deps.c  a5fb70e5573401f9ad4a0b8e6d9290dd0285eb59
@@ -288,7 +288,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
                        if(!satisfied) {
                            _alpm_log(PM_LOG_DEBUG, _("checkdeps: updated '%s' won't satisfy a dependency of '%s'"),
                                                alpm_pkg_get_name(oldpkg), alpm_pkg_get_name(p));
-                           miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend->mod,
+                           miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_DEPEND, depend->mod,
                                                                             depend->name, depend->version);
                            if(!_alpm_depmiss_isin(miss, baddeps)) {
                                baddeps = alpm_list_add(baddeps, miss);
@@ -408,7 +408,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
                    if(!found) {
                        _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
                                reqname, alpm_pkg_get_name(tp));
-                       miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), PM_DEP_TYPE_REQUIRED,
+                       miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), PM_DEP_TYPE_DEPEND,
                                                                         PM_DEP_MOD_ANY, j->data, NULL);
                        if(!_alpm_depmiss_isin(miss, baddeps)) {
                            baddeps = alpm_list_add(baddeps, miss);
============================================================
--- OLD/src/pacman/sync.c   c5a404fc8494f5b8653d2c8e77911aa7735f0bf6
+++ NEW/src/pacman/sync.c   b00cd269bd70e927cf1f4d29eec65f34b6296942
@@ -618,10 +618,8 @@ int pacman_sync(alpm_list_t *targets)
            case PM_ERR_UNSATISFIED_DEPS:
                for(i = data; i; i = alpm_list_next(i)) {
                    pmdepmissing_t *miss = alpm_list_getdata(i);
-                   MSG(NL, ":: %s %s %s", alpm_dep_get_target(miss),
-                       alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ?
-                                   _("requires") : _("is required by"),
-                                   alpm_dep_get_name(miss));
+                   MSG(NL, ":: %s %s %s", alpm_dep_get_target(miss), _("requires"),
+                           alpm_dep_get_name(miss));
                    switch(alpm_dep_get_mod(miss)) {
                        case PM_DEP_MOD_ANY:
                            break;

============================================================
--- OLD/pactest/tests/sync1000.py   0403cb1f047ab45d519782f1124b5cc685823cdc
+++ NEW/pactest/tests/sync1000.py   0403cb1f047ab45d519782f1124b5cc685823cdc
@@ -0,0 +1,19 @@
+# If someone else can come up with a better name, please do so
+self.description = "stonecrest's problem"
+
+sp = pmpkg("dummy", "1.1-1")
+sp.requiredby = [ "pkg" ]
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("dummy", "1.0-1")
+lp1.requiredby = [ "pkg" ]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg")
+lp2.depends = [ "dummy=1.0" ]
+self.addpkg2db("local", lp2)
+
+self.args = "-Su"
+
+self.addrule("!PACMAN_RETCODE=0")
+self.addrule("!PKG_VERSION=dummy|1.1-1")
============================================================
--- OLD/pactest/tests/upgrade058.py 5a35d3264695e5589384fe2624ebec27faaa468b
+++ NEW/pactest/tests/upgrade058.py 5a35d3264695e5589384fe2624ebec27faaa468b
@@ -0,0 +1,17 @@
+self.description = "Upgrade a package that's older version is required by another package."
+
+lp1 = pmpkg("pkg1")
+lp1.depends = [ "pkg2=1.0" ]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+lp2.requiredby = [ "pkg1" ]
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg2", "1.1-1")
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_VERSION=pkg2|1.1")





More information about the pacman-dev mailing list