diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-15 21:08:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-16 16:05:37 +0000 |
commit | 1855e94280bdbce2de84cb81cdd61f01950d05d9 (patch) | |
tree | 7e7eb13a71ced54a5a7ad36f66c1d4547f4d5a41 /meta/recipes-devtools/opkg | |
parent | c7335bd21b2413582cee1dec79700c3ac70a65e5 (diff) | |
download | poky-1855e94280bdbce2de84cb81cdd61f01950d05d9.tar.gz |
opkg: Update svn 625 -> 633 and fix preinst issues
There is a major issue with opkg images at the moment as preinst
functions are not being executed before their dependencies are installed
and this is leading to corruption of images containing avahi/dbus in
particular.
There are various changes in upstream opkg in the last 8 revisions which
make changes in this area but sadly these aren't enough to get things
working for us. I've updated to the latest svn revision with this patch
since it makes sense to pull in those changes first and then supplement
them with the attached patches.
There is a full description of the patches in the patch headers but in
summary they:
a) Ensure preinst functions execute with their dependencies installed.
This is a pretty invasive change as it changes the package install
ordering in general.
b) Ensure opkg sets $D, not $PKG_ROOT which we don't use
c) Change opkg to allow execution of postinstall functions which fail
resulting in execution on the target device as rootfs_ipk.bbclass
currently does manually.
The remaining changes interface this with the rest of the OE build
infrastructure, adding in the option to tell opkg to run the preinst and
postinst functions, ensure the correct environment is present for the
postinst scripts and removing the now unneeded rootfs_ipk class code
which opkg now does itself.
[YOCTO #1711]
(From OE-Core rev: 2feba313c991170747381c7cf821a45c2cd04632)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/opkg')
4 files changed, 256 insertions, 2 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/fix_installorder.patch b/meta/recipes-devtools/opkg/opkg/fix_installorder.patch new file mode 100644 index 0000000000..e782ce738d --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/fix_installorder.patch | |||
@@ -0,0 +1,174 @@ | |||
1 | There is a problem with dependency order when installing packages. The key | ||
2 | problem revolves around the satisfy_dependencies_for() function which is | ||
3 | called from opkg_install_pkg just before the installation (and preinst) | ||
4 | happens. | ||
5 | |||
6 | The satisfy_dependencies_for() function calls pkg_hash_fetch_unsatisfied_dependencies() | ||
7 | which will only return packages which were previously not marked as | ||
8 | *going* to be installed at some point. For the purposes of | ||
9 | opkg_install_pkg() we really need to know which dependencies haven't been | ||
10 | installed yet. | ||
11 | |||
12 | This patch adds pkg_hash_fetch_satisfied_dependencies() which returns a | ||
13 | list of package dependencies. We can then directly check the status of | ||
14 | these and ensure any hard dependencies (not suggestions or recommendations) | ||
15 | are installed before returning. | ||
16 | |||
17 | Consider the situation (where -> means 'depends on'): | ||
18 | |||
19 | X -> A,E | ||
20 | A -> B,E | ||
21 | E -> B | ||
22 | B -> C | ||
23 | |||
24 | Currently X would install A and E. When installing A the packages B, E | ||
25 | and C would be marked as "to install". When the package B is considered | ||
26 | the second time (as a dependency of E rather than A), it would install | ||
27 | straight away even though C was not currently installed, just marked | ||
28 | as needing to be installed. | ||
29 | |||
30 | The patch changes the behaviour so B can't install until C really is installed. | ||
31 | |||
32 | This change is required to run the postinst scripts in the correct order. | ||
33 | |||
34 | Upstream-Status: Pending | ||
35 | |||
36 | RP 2011/12/15 | ||
37 | |||
38 | Index: trunk/libopkg/opkg_install.c | ||
39 | =================================================================== | ||
40 | --- trunk.orig/libopkg/opkg_install.c 2011-12-15 15:58:39.000000000 +0000 | ||
41 | +++ trunk/libopkg/opkg_install.c 2011-12-15 15:58:41.838334788 +0000 | ||
42 | @@ -76,6 +77,27 @@ | ||
43 | } | ||
44 | |||
45 | if (ndepends <= 0) { | ||
46 | + pkg_vec_free(depends); | ||
47 | + depends = pkg_hash_fetch_satisfied_dependencies(pkg); | ||
48 | + | ||
49 | + for (i = 0; i < depends->len; i++) { | ||
50 | + dep = depends->pkgs[i]; | ||
51 | + /* The package was uninstalled when we started, but another | ||
52 | + dep earlier in this loop may have depended on it and pulled | ||
53 | + it in, so check first. */ | ||
54 | + if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) { | ||
55 | + opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n"); | ||
56 | + err = opkg_install_pkg(dep, 0); | ||
57 | + /* mark this package as having been automatically installed to | ||
58 | + * satisfy a dependancy */ | ||
59 | + dep->auto_installed = 1; | ||
60 | + if (err) { | ||
61 | + pkg_vec_free(depends); | ||
62 | + return err; | ||
63 | + } | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | pkg_vec_free(depends); | ||
68 | return 0; | ||
69 | } | ||
70 | Index: trunk/libopkg/pkg_depends.c | ||
71 | =================================================================== | ||
72 | --- trunk.orig/libopkg/pkg_depends.c 2010-12-22 16:04:43.000000000 +0000 | ||
73 | +++ trunk/libopkg/pkg_depends.c 2011-12-15 15:58:41.838334788 +0000 | ||
74 | @@ -259,6 +259,88 @@ | ||
75 | return unsatisfied->len; | ||
76 | } | ||
77 | |||
78 | + | ||
79 | +pkg_vec_t * | ||
80 | +pkg_hash_fetch_satisfied_dependencies(pkg_t * pkg) | ||
81 | +{ | ||
82 | + pkg_vec_t *satisfiers; | ||
83 | + int i, j, k; | ||
84 | + int count; | ||
85 | + abstract_pkg_t * ab_pkg; | ||
86 | + | ||
87 | + satisfiers = pkg_vec_alloc(); | ||
88 | + | ||
89 | + /* | ||
90 | + * this is a setup to check for redundant/cyclic dependency checks, | ||
91 | + * which are marked at the abstract_pkg level | ||
92 | + */ | ||
93 | + if (!(ab_pkg = pkg->parent)) { | ||
94 | + opkg_msg(ERROR, "Internal error, with pkg %s.\n", pkg->name); | ||
95 | + return satisfiers; | ||
96 | + } | ||
97 | + | ||
98 | + count = pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count; | ||
99 | + if (!count) | ||
100 | + return satisfiers; | ||
101 | + | ||
102 | + /* foreach dependency */ | ||
103 | + for (i = 0; i < count; i++) { | ||
104 | + compound_depend_t * compound_depend = &pkg->depends[i]; | ||
105 | + depend_t ** possible_satisfiers = compound_depend->possibilities;; | ||
106 | + | ||
107 | + if (compound_depend->type == RECOMMEND || compound_depend->type == SUGGEST) | ||
108 | + continue; | ||
109 | + | ||
110 | + if (compound_depend->type == GREEDY_DEPEND) { | ||
111 | + /* foreach possible satisfier */ | ||
112 | + for (j = 0; j < compound_depend->possibility_count; j++) { | ||
113 | + /* foreach provided_by, which includes the abstract_pkg itself */ | ||
114 | + abstract_pkg_t *abpkg = possible_satisfiers[j]->pkg; | ||
115 | + abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by; | ||
116 | + int nposs = ab_provider_vec->len; | ||
117 | + abstract_pkg_t **ab_providers = ab_provider_vec->pkgs; | ||
118 | + int l; | ||
119 | + for (l = 0; l < nposs; l++) { | ||
120 | + pkg_vec_t *test_vec = ab_providers[l]->pkgs; | ||
121 | + /* if no depends on this one, try the first package that Provides this one */ | ||
122 | + if (!test_vec){ /* no pkg_vec hooked up to the abstract_pkg! (need another feed?) */ | ||
123 | + continue; | ||
124 | + } | ||
125 | + | ||
126 | + /* cruise this possiblity's pkg_vec looking for an installed version */ | ||
127 | + for (k = 0; k < test_vec->len; k++) { | ||
128 | + pkg_t *pkg_scout = test_vec->pkgs[k]; | ||
129 | + /* not installed, and not already known about? */ | ||
130 | + if (pkg_scout->state_want == SW_INSTALL && pkg_scout != pkg) | ||
131 | + pkg_vec_insert(satisfiers, pkg_scout); | ||
132 | + } | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + continue; | ||
137 | + } | ||
138 | + | ||
139 | + /* foreach possible satisfier, look for installed package */ | ||
140 | + for (j = 0; j < compound_depend->possibility_count; j++) { | ||
141 | + /* foreach provided_by, which includes the abstract_pkg itself */ | ||
142 | + depend_t *dependence_to_satisfy = possible_satisfiers[j]; | ||
143 | + abstract_pkg_t *satisfying_apkg = possible_satisfiers[j]->pkg; | ||
144 | + pkg_t *satisfying_pkg = | ||
145 | + pkg_hash_fetch_best_installation_candidate(satisfying_apkg, | ||
146 | + pkg_installed_and_constraint_satisfied, | ||
147 | + dependence_to_satisfy, 1); | ||
148 | + /* Being that I can't test constraing in pkg_hash, I will test it here */ | ||
149 | + if (satisfying_pkg != NULL && satisfying_pkg != pkg) { | ||
150 | + if (pkg_constraint_satisfied(satisfying_pkg, dependence_to_satisfy) && satisfying_pkg->state_want == SW_INSTALL) | ||
151 | + pkg_vec_insert(satisfiers, satisfying_pkg); | ||
152 | + } | ||
153 | + | ||
154 | + } | ||
155 | + } | ||
156 | + return satisfiers; | ||
157 | +} | ||
158 | + | ||
159 | + | ||
160 | /*checking for conflicts !in replaces | ||
161 | If a packages conflicts with another but is also replacing it, I should not consider it a | ||
162 | really conflicts | ||
163 | Index: trunk/libopkg/pkg_depends.h | ||
164 | =================================================================== | ||
165 | --- trunk.orig/libopkg/pkg_depends.h 2010-12-22 16:04:43.000000000 +0000 | ||
166 | +++ trunk/libopkg/pkg_depends.h 2011-12-15 15:58:41.838334788 +0000 | ||
167 | @@ -82,6 +82,7 @@ | ||
168 | void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg); | ||
169 | int version_constraints_satisfied(depend_t * depends, pkg_t * pkg); | ||
170 | int pkg_hash_fetch_unsatisfied_dependencies(pkg_t * pkg, pkg_vec_t *depends, char *** unresolved); | ||
171 | +pkg_vec_t * pkg_hash_fetch_satisfied_dependencies(pkg_t * pkg); | ||
172 | pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg); | ||
173 | int pkg_dependence_satisfiable(depend_t *depend); | ||
174 | int pkg_dependence_satisfied(depend_t *depend); | ||
diff --git a/meta/recipes-devtools/opkg/opkg/offline_postinstall.patch b/meta/recipes-devtools/opkg/opkg/offline_postinstall.patch new file mode 100644 index 0000000000..b197f6b731 --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/offline_postinstall.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | When we have an offline root and have specified force-postinstall, | ||
2 | attempt to run the postinstall but if it fails, just leave it in the | ||
3 | status file as neeing to run. We can issue a NOTICE this is happened | ||
4 | but supress errors. This means the OE class doesn't have to do any | ||
5 | further post processing of the postinstalls itself. | ||
6 | |||
7 | Upstream-Status: Pending | ||
8 | |||
9 | RP 2011/12/15 | ||
10 | |||
11 | |||
12 | Index: trunk/libopkg/pkg.c | ||
13 | =================================================================== | ||
14 | --- trunk.orig/libopkg/pkg.c 2011-12-15 15:58:39.000000000 +0000 | ||
15 | +++ trunk/libopkg/pkg.c 2011-12-15 20:04:50.109992736 +0000 | ||
16 | @@ -1297,8 +1297,9 @@ | ||
17 | free(cmd); | ||
18 | |||
19 | if (err) { | ||
20 | - opkg_msg(ERROR, "package \"%s\" %s script returned status %d.\n", | ||
21 | - pkg->name, script, err); | ||
22 | + if (!conf->offline_root) | ||
23 | + opkg_msg(ERROR, "package \"%s\" %s script returned status %d.\n", | ||
24 | + pkg->name, script, err); | ||
25 | return err; | ||
26 | } | ||
27 | |||
28 | Index: trunk/libopkg/opkg_cmd.c | ||
29 | =================================================================== | ||
30 | --- trunk.orig/libopkg/opkg_cmd.c 2011-12-15 19:49:25.826014150 +0000 | ||
31 | +++ trunk/libopkg/opkg_cmd.c 2011-12-15 19:50:52.346012148 +0000 | ||
32 | @@ -453,7 +453,8 @@ | ||
33 | pkg->state_flag &= ~SF_PREFER; | ||
34 | opkg_state_changed++; | ||
35 | } else { | ||
36 | - err = -1; | ||
37 | + if (!conf->offline_root) | ||
38 | + err = -1; | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | Index: trunk/libopkg/opkg_configure.c | ||
43 | =================================================================== | ||
44 | --- trunk.orig/libopkg/opkg_configure.c 2011-12-15 19:50:11.586013081 +0000 | ||
45 | +++ trunk/libopkg/opkg_configure.c 2011-12-15 19:52:15.082010347 +0000 | ||
46 | @@ -35,7 +35,10 @@ | ||
47 | |||
48 | err = pkg_run_script(pkg, "postinst", "configure"); | ||
49 | if (err) { | ||
50 | - opkg_msg(ERROR, "%s.postinst returned %d.\n", pkg->name, err); | ||
51 | + if (!conf->offline_root) | ||
52 | + opkg_msg(ERROR, "%s.postinst returned %d.\n", pkg->name, err); | ||
53 | + else | ||
54 | + opkg_msg(NOTICE, "%s.postinst returned %d, marking as unpacked only, configuration required on target.\n", pkg->name, err); | ||
55 | return err; | ||
56 | } | ||
57 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/offlineroot_varname.patch b/meta/recipes-devtools/opkg/opkg/offlineroot_varname.patch new file mode 100644 index 0000000000..a67f389bac --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/offlineroot_varname.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | OE uses D as the offline install directory in its scripts, not PKG_ROOT. | ||
2 | |||
3 | Upstream-Status: Inappropriate [OE specific usage] | ||
4 | |||
5 | RP 2011/12/15 | ||
6 | |||
7 | Index: trunk/libopkg/pkg.c | ||
8 | =================================================================== | ||
9 | --- trunk.orig/libopkg/pkg.c 2011-12-15 15:58:39.000000000 +0000 | ||
10 | +++ trunk/libopkg/pkg.c 2011-12-15 20:04:50.109992736 +0000 | ||
11 | @@ -1280,7 +1280,7 @@ | ||
12 | |||
13 | opkg_msg(INFO, "Running script %s.\n", path); | ||
14 | |||
15 | - setenv("PKG_ROOT", | ||
16 | + setenv("D", | ||
17 | pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1); | ||
18 | |||
19 | if (! file_exists(path)) { | ||
20 | |||
diff --git a/meta/recipes-devtools/opkg/opkg_svn.bb b/meta/recipes-devtools/opkg/opkg_svn.bb index acb21f2cb9..2645d52c81 100644 --- a/meta/recipes-devtools/opkg/opkg_svn.bb +++ b/meta/recipes-devtools/opkg/opkg_svn.bb | |||
@@ -12,13 +12,16 @@ RREPLACES_${PN} = "opkg-nogpg" | |||
12 | SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;proto=http \ | 12 | SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;proto=http \ |
13 | file://add_vercmp.patch \ | 13 | file://add_vercmp.patch \ |
14 | file://add_uname_support.patch \ | 14 | file://add_uname_support.patch \ |
15 | file://fix_installorder.patch \ | ||
16 | file://offline_postinstall.patch\ | ||
17 | file://offlineroot_varname.patch \ | ||
15 | " | 18 | " |
16 | 19 | ||
17 | S = "${WORKDIR}/trunk" | 20 | S = "${WORKDIR}/trunk" |
18 | 21 | ||
19 | SRCREV = "625" | 22 | SRCREV = "633" |
20 | PV = "0.1.8+svnr${SRCPV}" | 23 | PV = "0.1.8+svnr${SRCPV}" |
21 | PR = "r4" | 24 | PR = "r2" |
22 | 25 | ||
23 | PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}" | 26 | PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}" |
24 | 27 | ||