zhengzkkai / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

opkg-cl configure doesn't seems to take dependences into account #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Extract two package package-a, package-b (wich depends on package-a)
2. Under some condition when package are flagged as extracted
   opkg-cl configure will configure package-b before package-a

What is the expected output? What do you see instead?
opkg should configure package-a before package-b

Original issue reported on code.google.com by pixdamix@gmail.com on 8 Feb 2010 at 5:02

GoogleCodeExporter commented 9 years ago
Sounds like issue #41. Do you have a specific test case to reproduce this?

Original comment by graham.g...@gmail.com on 8 Feb 2010 at 10:21

GoogleCodeExporter commented 9 years ago
Indeed, it's the same as issue #41.

Here's the test case:
#
# Make sure package{a,b} are not installed
#
root@opkg-test:~# opkg remove package-a
No packages removed.
root@opkg-test:~# opkg remove package-b
No packages removed.

#
# Try to install package-a
#
root@opkg-test:~#  opkg install /tmp/package-a_1.0-r1.1-debug_i686.ipk 
Installing package-a (1.0-r1.1-debug) to root...
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for package-a:
 * satisfy_dependencies_for:    package-b * 
 * opkg_install_cmd: Cannot install package package-a.

#
# Install the two simultaneously
#
root@opkg-test:~# opkg install /tmp/package-a_1.0-r1.1-debug_i686.ipk \
   /tmp/package-b_1.0-r1.1-debug_i686.ipk
Installing package-a (1.0-r1.1-debug) to root...
Installing package-b (1.0-r1.1-debug) to root...
Package package-b (1.0-r1.1-debug) installed in root is up to date.
Configuring package-a.
Configuring package-b.

#
# package-a is configured before package-b
# if package-a rely on b in it's post install
# it will fail. Same problem here:
#
root@opkg-test:~# opkg flag unpacked package-a
Setting flags for package package-a to unpacked.
root@opkg-test:~# opkg flag unpacked package-b
Setting flags for package package-b to unpacked.
root@opkg-test:~# opkg configure              
Configuring package-a.
Configuring package-b.

Samples are attached.

Original comment by pixdamix@gmail.com on 9 Feb 2010 at 7:59

Attachments:

GoogleCodeExporter commented 9 years ago
#
# Maybe there's something fishy here too ?
#

root@opkg-test:~#  opkg install /tmp/package-b_1.0-r1.1-debug_i686.ipk \
    /tmp/package-a_1.0-r1.1-debug_i686.ipk
Installing package-b (1.0-r1.1-debug) to root...
Installing package-a (1.0-r1.1-debug) to root...
Configuring package-a.
Configuring package-b.

root@opkg-test:~#  opkg install /tmp/package-a_1.0-r1.1-debug_i686.ipk \
    /tmp/package-b_1.0-r1.1-debug_i686.ipk
Installing package-a (1.0-r1.1-debug) to root...
Installing package-b (1.0-r1.1-debug) to root...
Package package-b (1.0-r1.1-debug) installed in root is up to date.
Configuring package-a.
Configuring package-b.

Original comment by pixdamix@gmail.com on 9 Feb 2010 at 8:03

GoogleCodeExporter commented 9 years ago
# Could you take a look ? I think there may be a problem here
# 

diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index fceffdd..87a7960 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -390,8 +390,8 @@ opkg_configure_packages(char *pkg_name)
         goto error;
      }

-     for(i = 0; i < all->len; i++) {
-     pkg = all->pkgs[i];
+     for(i = 0; i < ordered->len; i++) {
+     pkg = ordered->pkgs[i];

      if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) 
           continue;

Original comment by pixdamix@gmail.com on 9 Feb 2010 at 8:31

Attachments:

GoogleCodeExporter commented 9 years ago
I suspect I could not reproduce this previously because the dependency I was 
testing
was alphanumerically ordered. E.g. I had package-b depending on package-a; as 
soon as
the dependency is reversed, this bug is reproducible.

Your patch is correct. Feel free to commit it.

Original comment by graham.g...@gmail.com on 9 Feb 2010 at 10:55

GoogleCodeExporter commented 9 years ago
Resolved in r521

Original comment by pixdamix@gmail.com on 10 Feb 2010 at 8:54