diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2012-11-22 21:10:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-11-24 15:12:30 +0000 |
commit | 002f48337737a746116fa69cb89c9a9e6b61bd92 (patch) | |
tree | 29e97e315938a3497f100fe1051ac69ea49f940f /meta/recipes-devtools/opkg | |
parent | 9f836a4595dc4524ebd95db02165ef28dda51010 (diff) | |
download | poky-002f48337737a746116fa69cb89c9a9e6b61bd92.tar.gz |
opkg: bump SRCREV and drop applied patches
* only change upstream which wasn't in oe-core is
http://code.google.com/p/opkg/source/detail?r=635
and added testcase for that
(From OE-Core rev: 5fd1d515db5966f45a3b2f936f3c4225f59186e2)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/opkg')
15 files changed, 2 insertions, 1137 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/0001-add-opkg_compare_versions-function.patch b/meta/recipes-devtools/opkg/opkg/0001-add-opkg_compare_versions-function.patch deleted file mode 100644 index 5dc76d4004..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0001-add-opkg_compare_versions-function.patch +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | From 029cf99fd44645b5fe1b6491355c631da3096e09 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Sat, 17 Dec 2011 12:51:07 +0100 | ||
4 | Subject: [PATCH 1/7] add opkg_compare_versions function | ||
5 | |||
6 | * not used in opkg but can be usefull, e.g. instead of | ||
7 | opkg-utils/opkg-compare-versions.c | ||
8 | |||
9 | Upstream-Status: Submitted | ||
10 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
11 | |||
12 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
13 | --- | ||
14 | libopkg/opkg.c | 15 +++++++++++++++ | ||
15 | libopkg/opkg.h | 2 ++ | ||
16 | 2 files changed, 17 insertions(+) | ||
17 | |||
18 | diff --git a/libopkg/opkg.c b/libopkg/opkg.c | ||
19 | index 92f61f4..eaea529 100644 | ||
20 | --- a/libopkg/opkg.c | ||
21 | +++ b/libopkg/opkg.c | ||
22 | @@ -870,3 +870,18 @@ opkg_repository_accessibility_check(void) | ||
23 | |||
24 | return ret; | ||
25 | } | ||
26 | + | ||
27 | +int | ||
28 | +opkg_compare_versions (const char *ver1, const char *ver2) | ||
29 | +{ | ||
30 | + pkg_t *pkg1, *pkg2; | ||
31 | + | ||
32 | + pkg1 = pkg_new(); | ||
33 | + pkg2 = pkg_new(); | ||
34 | + | ||
35 | + parse_version(pkg1, ver1); | ||
36 | + parse_version(pkg2, ver2); | ||
37 | + | ||
38 | + return pkg_compare_versions(pkg1, pkg2); | ||
39 | +} | ||
40 | + | ||
41 | diff --git a/libopkg/opkg.h b/libopkg/opkg.h | ||
42 | index 4fbd404..7aa86eb 100644 | ||
43 | --- a/libopkg/opkg.h | ||
44 | +++ b/libopkg/opkg.h | ||
45 | @@ -58,4 +58,6 @@ pkg_t* opkg_find_package (const char *name, const char *version, const char *arc | ||
46 | |||
47 | int opkg_repository_accessibility_check(void); | ||
48 | |||
49 | +int opkg_compare_versions (const char *ver1, const char *ver2); | ||
50 | + | ||
51 | #endif /* OPKG_H */ | ||
52 | -- | ||
53 | 1.7.12 | ||
54 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0002-Ensure-we-use-the-uname-gname-fields-when-extracting.patch b/meta/recipes-devtools/opkg/opkg/0002-Ensure-we-use-the-uname-gname-fields-when-extracting.patch deleted file mode 100644 index f51cf587ca..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0002-Ensure-we-use-the-uname-gname-fields-when-extracting.patch +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | From 254780ab3b0db398447150251332916598d3b9f4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Fri, 11 Nov 2011 17:17:01 +0000 | ||
4 | Subject: [PATCH 2/7] Ensure we use the uname/gname fields when extracting | ||
5 | tarballs | ||
6 | |||
7 | When updating packages on the target device we ideally want to match | ||
8 | user and group numbers from the existing file system. This patch encourages | ||
9 | opkg to lookup the uname/gname fields first and only use the hardcoded | ||
10 | numerical values if that fails. | ||
11 | |||
12 | Upstream-Status: Submitted | ||
13 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
14 | |||
15 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
16 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
17 | --- | ||
18 | libbb/unarchive.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- | ||
19 | 1 file changed, 47 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/libbb/unarchive.c b/libbb/unarchive.c | ||
22 | index 5d4464f..d583767 100644 | ||
23 | --- a/libbb/unarchive.c | ||
24 | +++ b/libbb/unarchive.c | ||
25 | @@ -22,10 +22,13 @@ | ||
26 | #include <stdio.h> | ||
27 | #include <errno.h> | ||
28 | #include <stdlib.h> | ||
29 | +#include <stdbool.h> | ||
30 | #include <string.h> | ||
31 | #include <unistd.h> | ||
32 | #include <utime.h> | ||
33 | #include <libgen.h> | ||
34 | +#include <grp.h> | ||
35 | +#include <pwd.h> | ||
36 | |||
37 | #include "libbb.h" | ||
38 | |||
39 | @@ -436,6 +439,42 @@ free_header_ar(file_header_t *ar_entry) | ||
40 | free(ar_entry); | ||
41 | } | ||
42 | |||
43 | +static char uname_cache[32] = ""; | ||
44 | +static uid_t uid_cache; | ||
45 | + | ||
46 | +static bool update_unamecache(char *uname) { | ||
47 | + struct passwd *passwd; | ||
48 | + if (!uname) | ||
49 | + return FALSE; | ||
50 | + if (!uname_cache[0] && strcmp(uname_cache, uname) == 0) | ||
51 | + return TRUE; | ||
52 | + passwd = getpwnam(uname); | ||
53 | + if (passwd) { | ||
54 | + uid_cache = passwd->pw_uid; | ||
55 | + strncpy(uname, uname_cache, 32); | ||
56 | + return TRUE; | ||
57 | + } | ||
58 | + return FALSE; | ||
59 | +} | ||
60 | + | ||
61 | +static char gname_cache[32] = ""; | ||
62 | +static gid_t gid_cache; | ||
63 | + | ||
64 | +static bool update_gnamecache(char *gname) { | ||
65 | + struct group *group; | ||
66 | + if (!gname) | ||
67 | + return FALSE; | ||
68 | + if (!gname_cache[0] && strcmp(gname_cache, gname) == 0) | ||
69 | + return TRUE; | ||
70 | + group = getgrnam(gname); | ||
71 | + if (group) { | ||
72 | + gid_cache = group->gr_gid; | ||
73 | + strncpy(gname, gname_cache, 32); | ||
74 | + return TRUE; | ||
75 | + } | ||
76 | + return FALSE; | ||
77 | +} | ||
78 | + | ||
79 | |||
80 | static file_header_t * | ||
81 | get_header_tar(FILE *tar_stream) | ||
82 | @@ -515,8 +554,14 @@ get_header_tar(FILE *tar_stream) | ||
83 | */ | ||
84 | tar_entry->mode = 07777 & strtol(tar.formated.mode, NULL, 8); | ||
85 | |||
86 | - tar_entry->uid = strtol(tar.formated.uid, NULL, 8); | ||
87 | - tar_entry->gid = strtol(tar.formated.gid, NULL, 8); | ||
88 | + if (update_unamecache(tar.formated.uname)) | ||
89 | + tar_entry->uid = uid_cache; | ||
90 | + else | ||
91 | + tar_entry->uid = strtol(tar.formated.uid, NULL, 8); | ||
92 | + if (update_gnamecache(tar.formated.gname)) | ||
93 | + tar_entry->gid = gid_cache; | ||
94 | + else | ||
95 | + tar_entry->gid = strtol(tar.formated.gid, NULL, 8); | ||
96 | tar_entry->size = strtol(tar.formated.size, NULL, 8); | ||
97 | tar_entry->mtime = strtol(tar.formated.mtime, NULL, 8); | ||
98 | |||
99 | -- | ||
100 | 1.7.12 | ||
101 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0003-Fix-dependency-issues-for-preinst-scripts.patch b/meta/recipes-devtools/opkg/opkg/0003-Fix-dependency-issues-for-preinst-scripts.patch deleted file mode 100644 index 195598f287..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0003-Fix-dependency-issues-for-preinst-scripts.patch +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | From 6a294b6dad681b0e95aa061bc368d801d2ddc781 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Thu, 15 Dec 2011 21:08:49 +0000 | ||
4 | Subject: [PATCH 3/7] Fix dependency issues for preinst scripts | ||
5 | |||
6 | There is a problem with dependency order when installing packages. The key | ||
7 | problem revolves around the satisfy_dependencies_for() function which is | ||
8 | called from opkg_install_pkg just before the installation (and preinst) | ||
9 | happens. | ||
10 | |||
11 | The satisfy_dependencies_for() function calls pkg_hash_fetch_unsatisfied_dependencies() | ||
12 | which will only return packages which were previously not marked as | ||
13 | *going* to be installed at some point. For the purposes of | ||
14 | opkg_install_pkg() we really need to know which dependencies haven't been | ||
15 | installed yet. | ||
16 | |||
17 | This patch adds pkg_hash_fetch_satisfied_dependencies() which returns a | ||
18 | list of package dependencies. We can then directly check the status of | ||
19 | these and ensure any hard dependencies (not suggestions or recommendations) | ||
20 | are installed before returning. | ||
21 | |||
22 | Consider the situation (where -> means 'depends on'): | ||
23 | |||
24 | X -> A,E | ||
25 | A -> B,E | ||
26 | E -> B | ||
27 | B -> C | ||
28 | |||
29 | Currently X would install A and E. When installing A the packages B, E | ||
30 | and C would be marked as "to install". When the package B is considered | ||
31 | the second time (as a dependency of E rather than A), it would install | ||
32 | straight away even though C was not currently installed, just marked | ||
33 | as needing to be installed. | ||
34 | |||
35 | The patch changes the behaviour so B can't install until C really is installed. | ||
36 | |||
37 | This change is required to run the postinst scripts in the correct order. | ||
38 | |||
39 | Upstream-Status: Submitted | ||
40 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
41 | |||
42 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
43 | --- | ||
44 | libopkg/opkg_install.c | 21 +++++++++++++ | ||
45 | libopkg/pkg_depends.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
46 | libopkg/pkg_depends.h | 1 + | ||
47 | 3 files changed, 104 insertions(+) | ||
48 | |||
49 | diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c | ||
50 | index 3925f58..1632066 100644 | ||
51 | --- a/libopkg/opkg_install.c | ||
52 | +++ b/libopkg/opkg_install.c | ||
53 | @@ -76,6 +76,27 @@ satisfy_dependencies_for(pkg_t *pkg) | ||
54 | } | ||
55 | |||
56 | if (ndepends <= 0) { | ||
57 | + pkg_vec_free(depends); | ||
58 | + depends = pkg_hash_fetch_satisfied_dependencies(pkg); | ||
59 | + | ||
60 | + for (i = 0; i < depends->len; i++) { | ||
61 | + dep = depends->pkgs[i]; | ||
62 | + /* The package was uninstalled when we started, but another | ||
63 | + dep earlier in this loop may have depended on it and pulled | ||
64 | + it in, so check first. */ | ||
65 | + if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) { | ||
66 | + opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n"); | ||
67 | + err = opkg_install_pkg(dep, 0); | ||
68 | + /* mark this package as having been automatically installed to | ||
69 | + * satisfy a dependency */ | ||
70 | + dep->auto_installed = 1; | ||
71 | + if (err) { | ||
72 | + pkg_vec_free(depends); | ||
73 | + return err; | ||
74 | + } | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | pkg_vec_free(depends); | ||
79 | return 0; | ||
80 | } | ||
81 | diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c | ||
82 | index 1e14d1f..36c76aa 100644 | ||
83 | --- a/libopkg/pkg_depends.c | ||
84 | +++ b/libopkg/pkg_depends.c | ||
85 | @@ -259,6 +259,88 @@ pkg_hash_fetch_unsatisfied_dependencies(pkg_t * pkg, pkg_vec_t *unsatisfied, | ||
86 | return unsatisfied->len; | ||
87 | } | ||
88 | |||
89 | + | ||
90 | +pkg_vec_t * | ||
91 | +pkg_hash_fetch_satisfied_dependencies(pkg_t * pkg) | ||
92 | +{ | ||
93 | + pkg_vec_t *satisfiers; | ||
94 | + int i, j, k; | ||
95 | + int count; | ||
96 | + abstract_pkg_t * ab_pkg; | ||
97 | + | ||
98 | + satisfiers = pkg_vec_alloc(); | ||
99 | + | ||
100 | + /* | ||
101 | + * this is a setup to check for redundant/cyclic dependency checks, | ||
102 | + * which are marked at the abstract_pkg level | ||
103 | + */ | ||
104 | + if (!(ab_pkg = pkg->parent)) { | ||
105 | + opkg_msg(ERROR, "Internal error, with pkg %s.\n", pkg->name); | ||
106 | + return satisfiers; | ||
107 | + } | ||
108 | + | ||
109 | + count = pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count; | ||
110 | + if (!count) | ||
111 | + return satisfiers; | ||
112 | + | ||
113 | + /* foreach dependency */ | ||
114 | + for (i = 0; i < count; i++) { | ||
115 | + compound_depend_t * compound_depend = &pkg->depends[i]; | ||
116 | + depend_t ** possible_satisfiers = compound_depend->possibilities;; | ||
117 | + | ||
118 | + if (compound_depend->type == RECOMMEND || compound_depend->type == SUGGEST) | ||
119 | + continue; | ||
120 | + | ||
121 | + if (compound_depend->type == GREEDY_DEPEND) { | ||
122 | + /* foreach possible satisfier */ | ||
123 | + for (j = 0; j < compound_depend->possibility_count; j++) { | ||
124 | + /* foreach provided_by, which includes the abstract_pkg itself */ | ||
125 | + abstract_pkg_t *abpkg = possible_satisfiers[j]->pkg; | ||
126 | + abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by; | ||
127 | + int nposs = ab_provider_vec->len; | ||
128 | + abstract_pkg_t **ab_providers = ab_provider_vec->pkgs; | ||
129 | + int l; | ||
130 | + for (l = 0; l < nposs; l++) { | ||
131 | + pkg_vec_t *test_vec = ab_providers[l]->pkgs; | ||
132 | + /* if no depends on this one, try the first package that Provides this one */ | ||
133 | + if (!test_vec){ /* no pkg_vec hooked up to the abstract_pkg! (need another feed?) */ | ||
134 | + continue; | ||
135 | + } | ||
136 | + | ||
137 | + /* cruise this possiblity's pkg_vec looking for an installed version */ | ||
138 | + for (k = 0; k < test_vec->len; k++) { | ||
139 | + pkg_t *pkg_scout = test_vec->pkgs[k]; | ||
140 | + /* not installed, and not already known about? */ | ||
141 | + if (pkg_scout->state_want == SW_INSTALL && pkg_scout != pkg) | ||
142 | + pkg_vec_insert(satisfiers, pkg_scout); | ||
143 | + } | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + continue; | ||
148 | + } | ||
149 | + | ||
150 | + /* foreach possible satisfier, look for installed package */ | ||
151 | + for (j = 0; j < compound_depend->possibility_count; j++) { | ||
152 | + /* foreach provided_by, which includes the abstract_pkg itself */ | ||
153 | + depend_t *dependence_to_satisfy = possible_satisfiers[j]; | ||
154 | + abstract_pkg_t *satisfying_apkg = possible_satisfiers[j]->pkg; | ||
155 | + pkg_t *satisfying_pkg = | ||
156 | + pkg_hash_fetch_best_installation_candidate(satisfying_apkg, | ||
157 | + pkg_installed_and_constraint_satisfied, | ||
158 | + dependence_to_satisfy, 0); | ||
159 | + /* Being that I can't test constraing in pkg_hash, I will test it here */ | ||
160 | + if (satisfying_pkg != NULL && satisfying_pkg != pkg) { | ||
161 | + if (pkg_constraint_satisfied(satisfying_pkg, dependence_to_satisfy) && (satisfying_pkg->state_want == SW_INSTALL || satisfying_pkg->state_want == SW_UNKNOWN)) | ||
162 | + pkg_vec_insert(satisfiers, satisfying_pkg); | ||
163 | + } | ||
164 | + | ||
165 | + } | ||
166 | + } | ||
167 | + return satisfiers; | ||
168 | +} | ||
169 | + | ||
170 | + | ||
171 | /*checking for conflicts !in replaces | ||
172 | If a packages conflicts with another but is also replacing it, I should not consider it a | ||
173 | really conflicts | ||
174 | diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h | ||
175 | index 5d1f074..b8072e2 100644 | ||
176 | --- a/libopkg/pkg_depends.h | ||
177 | +++ b/libopkg/pkg_depends.h | ||
178 | @@ -82,6 +82,7 @@ char *pkg_depend_str(pkg_t *pkg, int index); | ||
179 | void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg); | ||
180 | int version_constraints_satisfied(depend_t * depends, pkg_t * pkg); | ||
181 | int pkg_hash_fetch_unsatisfied_dependencies(pkg_t * pkg, pkg_vec_t *depends, char *** unresolved); | ||
182 | +pkg_vec_t * pkg_hash_fetch_satisfied_dependencies(pkg_t * pkg); | ||
183 | pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg); | ||
184 | int pkg_dependence_satisfiable(depend_t *depend); | ||
185 | int pkg_dependence_satisfied(depend_t *depend); | ||
186 | -- | ||
187 | 1.7.12 | ||
188 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0004-Failed-postinst-script-is-not-fatal-with-conf-offlin.patch b/meta/recipes-devtools/opkg/opkg/0004-Failed-postinst-script-is-not-fatal-with-conf-offlin.patch deleted file mode 100644 index 900c150471..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0004-Failed-postinst-script-is-not-fatal-with-conf-offlin.patch +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | From 1f709b4540e12cf7e08592aae0ad7e3e35322cab Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Thu, 15 Dec 2011 21:08:49 +0000 | ||
4 | Subject: [PATCH 4/7] Failed postinst script is not fatal with | ||
5 | conf->offline_root | ||
6 | |||
7 | When we have an offline root and have specified force-postinstall, | ||
8 | attempt to run the postinstall but if it fails, just leave it in the | ||
9 | status file as needing to run. We can issue a NOTICE this is happened | ||
10 | but supress errors. This means the OE class doesn't have to do any | ||
11 | further post processing of the postinstalls itself. | ||
12 | |||
13 | Upstream-Status: Submitted | ||
14 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
15 | |||
16 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
17 | --- | ||
18 | libopkg/opkg_cmd.c | 3 ++- | ||
19 | libopkg/opkg_configure.c | 5 ++++- | ||
20 | libopkg/pkg.c | 5 +++-- | ||
21 | 3 files changed, 9 insertions(+), 4 deletions(-) | ||
22 | |||
23 | diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c | ||
24 | index 11e7867..36ff8eb 100644 | ||
25 | --- a/libopkg/opkg_cmd.c | ||
26 | +++ b/libopkg/opkg_cmd.c | ||
27 | @@ -453,7 +453,8 @@ opkg_configure_packages(char *pkg_name) | ||
28 | pkg->state_flag &= ~SF_PREFER; | ||
29 | opkg_state_changed++; | ||
30 | } else { | ||
31 | - err = -1; | ||
32 | + if (!conf->offline_root) | ||
33 | + err = -1; | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c | ||
38 | index 719da5a..169828d 100644 | ||
39 | --- a/libopkg/opkg_configure.c | ||
40 | +++ b/libopkg/opkg_configure.c | ||
41 | @@ -35,7 +35,10 @@ opkg_configure(pkg_t *pkg) | ||
42 | |||
43 | err = pkg_run_script(pkg, "postinst", "configure"); | ||
44 | if (err) { | ||
45 | - opkg_msg(ERROR, "%s.postinst returned %d.\n", pkg->name, err); | ||
46 | + if (!conf->offline_root) | ||
47 | + opkg_msg(ERROR, "%s.postinst returned %d.\n", pkg->name, err); | ||
48 | + else | ||
49 | + opkg_msg(NOTICE, "%s.postinst returned %d, marking as unpacked only, configuration required on target.\n", pkg->name, err); | ||
50 | return err; | ||
51 | } | ||
52 | |||
53 | diff --git a/libopkg/pkg.c b/libopkg/pkg.c | ||
54 | index d8c3984..6ccbde2 100644 | ||
55 | --- a/libopkg/pkg.c | ||
56 | +++ b/libopkg/pkg.c | ||
57 | @@ -1297,8 +1297,9 @@ pkg_run_script(pkg_t *pkg, const char *script, const char *args) | ||
58 | free(cmd); | ||
59 | |||
60 | if (err) { | ||
61 | - opkg_msg(ERROR, "package \"%s\" %s script returned status %d.\n", | ||
62 | - pkg->name, script, err); | ||
63 | + if (!conf->offline_root) | ||
64 | + opkg_msg(ERROR, "package \"%s\" %s script returned status %d.\n", | ||
65 | + pkg->name, script, err); | ||
66 | return err; | ||
67 | } | ||
68 | |||
69 | -- | ||
70 | 1.7.12 | ||
71 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0005-Do-not-read-etc-opkg-.conf-if-f-is-specified.patch b/meta/recipes-devtools/opkg/opkg/0005-Do-not-read-etc-opkg-.conf-if-f-is-specified.patch deleted file mode 100644 index 3313bf7687..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0005-Do-not-read-etc-opkg-.conf-if-f-is-specified.patch +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | From 541b6b7bd80dc321493e42955d93b277af0c9221 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
3 | Date: Mon, 9 Jul 2012 11:01:15 +0100 | ||
4 | Subject: [PATCH 5/7] Do not read /etc/opkg/*.conf if -f is specified | ||
5 | |||
6 | If a configuration file is specified on the command line, we should | ||
7 | assume it contains all of the configuration and not try to read the | ||
8 | configuration in /etc/opkg. | ||
9 | |||
10 | Upstream-Status: Submitted | ||
11 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
12 | |||
13 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
14 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
15 | --- | ||
16 | libopkg/opkg_conf.c | 55 +++++++++++++++++++++++++++-------------------------- | ||
17 | 1 file changed, 28 insertions(+), 27 deletions(-) | ||
18 | |||
19 | diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c | ||
20 | index 4711ce7..1e65bad 100644 | ||
21 | --- a/libopkg/opkg_conf.c | ||
22 | +++ b/libopkg/opkg_conf.c | ||
23 | @@ -473,39 +473,40 @@ opkg_conf_load(void) | ||
24 | &conf->pkg_src_list, &conf->dist_src_list)) | ||
25 | goto err1; | ||
26 | } | ||
27 | - | ||
28 | - if (conf->offline_root) | ||
29 | - sprintf_alloc(&etc_opkg_conf_pattern, "%s/etc/opkg/*.conf", conf->offline_root); | ||
30 | else { | ||
31 | - const char *conf_file_dir = getenv("OPKG_CONF_DIR"); | ||
32 | - if (conf_file_dir == NULL) | ||
33 | - conf_file_dir = OPKG_CONF_DEFAULT_CONF_FILE_DIR; | ||
34 | - sprintf_alloc(&etc_opkg_conf_pattern, "%s/*.conf", conf_file_dir); | ||
35 | - } | ||
36 | - | ||
37 | - memset(&globbuf, 0, sizeof(globbuf)); | ||
38 | - glob_ret = glob(etc_opkg_conf_pattern, 0, glob_errfunc, &globbuf); | ||
39 | - if (glob_ret && glob_ret != GLOB_NOMATCH) { | ||
40 | - free(etc_opkg_conf_pattern); | ||
41 | - globfree(&globbuf); | ||
42 | - goto err1; | ||
43 | - } | ||
44 | - | ||
45 | - free(etc_opkg_conf_pattern); | ||
46 | + if (conf->offline_root) | ||
47 | + sprintf_alloc(&etc_opkg_conf_pattern, "%s/etc/opkg/*.conf", conf->offline_root); | ||
48 | + else { | ||
49 | + const char *conf_file_dir = getenv("OPKG_CONF_DIR"); | ||
50 | + if (conf_file_dir == NULL) | ||
51 | + conf_file_dir = OPKG_CONF_DEFAULT_CONF_FILE_DIR; | ||
52 | + sprintf_alloc(&etc_opkg_conf_pattern, "%s/*.conf", conf_file_dir); | ||
53 | + } | ||
54 | |||
55 | - for (i = 0; i < globbuf.gl_pathc; i++) { | ||
56 | - if (globbuf.gl_pathv[i]) | ||
57 | - if (conf->conf_file && | ||
58 | - !strcmp(conf->conf_file, globbuf.gl_pathv[i])) | ||
59 | - continue; | ||
60 | - if ( opkg_conf_parse_file(globbuf.gl_pathv[i], | ||
61 | - &conf->pkg_src_list, &conf->dist_src_list)<0) { | ||
62 | + memset(&globbuf, 0, sizeof(globbuf)); | ||
63 | + glob_ret = glob(etc_opkg_conf_pattern, 0, glob_errfunc, &globbuf); | ||
64 | + if (glob_ret && glob_ret != GLOB_NOMATCH) { | ||
65 | + free(etc_opkg_conf_pattern); | ||
66 | globfree(&globbuf); | ||
67 | goto err1; | ||
68 | } | ||
69 | - } | ||
70 | |||
71 | - globfree(&globbuf); | ||
72 | + free(etc_opkg_conf_pattern); | ||
73 | + | ||
74 | + for (i = 0; i < globbuf.gl_pathc; i++) { | ||
75 | + if (globbuf.gl_pathv[i]) | ||
76 | + if (conf->conf_file && | ||
77 | + !strcmp(conf->conf_file, globbuf.gl_pathv[i])) | ||
78 | + continue; | ||
79 | + if ( opkg_conf_parse_file(globbuf.gl_pathv[i], | ||
80 | + &conf->pkg_src_list, &conf->dist_src_list)<0) { | ||
81 | + globfree(&globbuf); | ||
82 | + goto err1; | ||
83 | + } | ||
84 | + } | ||
85 | + | ||
86 | + globfree(&globbuf); | ||
87 | + } | ||
88 | |||
89 | if (conf->offline_root) | ||
90 | sprintf_alloc (&lock_file, "%s/%s", conf->offline_root, OPKGLOCKFILE); | ||
91 | -- | ||
92 | 1.7.12 | ||
93 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch b/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch deleted file mode 100644 index 5cf8618170..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | From f434078a342435ae8a666b599d989c30d4c6a7f5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Sun, 18 Dec 2011 23:54:30 +0000 | ||
4 | Subject: [PATCH 6/7] detect circular dependencies | ||
5 | |||
6 | Add logic to detect circular dependencies. If we see any dependency from | ||
7 | any given parent twice, ignore it the second time and print a notice message | ||
8 | that we did so. | ||
9 | |||
10 | Upstream-Status: Submitted | ||
11 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
12 | |||
13 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
14 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
15 | --- | ||
16 | libopkg/opkg_install.c | 8 ++++++++ | ||
17 | libopkg/pkg.c | 2 ++ | ||
18 | libopkg/pkg.h | 1 + | ||
19 | libopkg/pkg_depends.c | 3 +-- | ||
20 | libopkg/pkg_depends.h | 1 + | ||
21 | 5 files changed, 13 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c | ||
24 | index 1632066..0216914 100644 | ||
25 | --- a/libopkg/opkg_install.c | ||
26 | +++ b/libopkg/opkg_install.c | ||
27 | @@ -84,8 +84,14 @@ satisfy_dependencies_for(pkg_t *pkg) | ||
28 | /* The package was uninstalled when we started, but another | ||
29 | dep earlier in this loop may have depended on it and pulled | ||
30 | it in, so check first. */ | ||
31 | + if (is_pkg_in_pkg_vec(dep->wanted_by, pkg)) { | ||
32 | + opkg_msg(NOTICE,"Breaking cicular dependency on %s for %s.\n", pkg->name, dep->name); | ||
33 | + continue; | ||
34 | + } | ||
35 | if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) { | ||
36 | opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n"); | ||
37 | + if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg)) | ||
38 | + pkg_vec_insert(dep->wanted_by, pkg); | ||
39 | err = opkg_install_pkg(dep, 0); | ||
40 | /* mark this package as having been automatically installed to | ||
41 | * satisfy a dependency */ | ||
42 | @@ -115,6 +121,8 @@ satisfy_dependencies_for(pkg_t *pkg) | ||
43 | /* The package was uninstalled when we started, but another | ||
44 | dep earlier in this loop may have depended on it and pulled | ||
45 | it in, so check first. */ | ||
46 | + if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg)) | ||
47 | + pkg_vec_insert(dep->wanted_by, pkg); | ||
48 | if ((dep->state_status != SS_INSTALLED) | ||
49 | && (dep->state_status != SS_UNPACKED)) { | ||
50 | opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n"); | ||
51 | diff --git a/libopkg/pkg.c b/libopkg/pkg.c | ||
52 | index 6ccbde2..be486ee 100644 | ||
53 | --- a/libopkg/pkg.c | ||
54 | +++ b/libopkg/pkg.c | ||
55 | @@ -86,6 +86,7 @@ pkg_init(pkg_t *pkg) | ||
56 | pkg->section = NULL; | ||
57 | pkg->description = NULL; | ||
58 | pkg->state_want = SW_UNKNOWN; | ||
59 | + pkg->wanted_by = pkg_vec_alloc(); | ||
60 | pkg->state_flag = SF_OK; | ||
61 | pkg->state_status = SS_NOT_INSTALLED; | ||
62 | pkg->depends_str = NULL; | ||
63 | @@ -191,6 +192,7 @@ pkg_deinit(pkg_t *pkg) | ||
64 | pkg->description = NULL; | ||
65 | |||
66 | pkg->state_want = SW_UNKNOWN; | ||
67 | + pkg_vec_free(pkg->wanted_by); | ||
68 | pkg->state_flag = SF_OK; | ||
69 | pkg->state_status = SS_NOT_INSTALLED; | ||
70 | |||
71 | diff --git a/libopkg/pkg.h b/libopkg/pkg.h | ||
72 | index 775b656..5d468cb 100644 | ||
73 | --- a/libopkg/pkg.h | ||
74 | +++ b/libopkg/pkg.h | ||
75 | @@ -129,6 +129,7 @@ struct pkg | ||
76 | char *description; | ||
77 | char *tags; | ||
78 | pkg_state_want_t state_want; | ||
79 | + pkg_vec_t *wanted_by; | ||
80 | pkg_state_flag_t state_flag; | ||
81 | pkg_state_status_t state_status; | ||
82 | char **depends_str; | ||
83 | diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c | ||
84 | index 36c76aa..a72eed7 100644 | ||
85 | --- a/libopkg/pkg_depends.c | ||
86 | +++ b/libopkg/pkg_depends.c | ||
87 | @@ -30,7 +30,6 @@ static int parseDepends(compound_depend_t *compound_depend, char * depend_str); | ||
88 | static depend_t * depend_init(void); | ||
89 | static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx); | ||
90 | static char ** merge_unresolved(char ** oldstuff, char ** newstuff); | ||
91 | -static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); | ||
92 | |||
93 | static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata) | ||
94 | { | ||
95 | @@ -531,7 +530,7 @@ int pkg_dependence_satisfied(depend_t *depend) | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | -static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg) | ||
100 | +int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg) | ||
101 | { | ||
102 | int i; | ||
103 | pkg_t ** pkgs = vec->pkgs; | ||
104 | diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h | ||
105 | index b8072e2..ca0801f 100644 | ||
106 | --- a/libopkg/pkg_depends.h | ||
107 | +++ b/libopkg/pkg_depends.h | ||
108 | @@ -87,5 +87,6 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg); | ||
109 | int pkg_dependence_satisfiable(depend_t *depend); | ||
110 | int pkg_dependence_satisfied(depend_t *depend); | ||
111 | const char* constraint_to_str(enum version_constraint c); | ||
112 | +int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); | ||
113 | |||
114 | #endif | ||
115 | -- | ||
116 | 1.7.12 | ||
117 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0007-merge-newpkg-provides-even-when-oldpkg-provides-exis.patch b/meta/recipes-devtools/opkg/opkg/0007-merge-newpkg-provides-even-when-oldpkg-provides-exis.patch deleted file mode 100644 index f1be7b89ae..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0007-merge-newpkg-provides-even-when-oldpkg-provides-exis.patch +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | From 3340b120909ea353440cfffe01fed43c55387a00 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Wed, 19 Sep 2012 17:31:45 +0200 | ||
4 | Subject: [PATCH 7/7] merge newpkg->provides even when oldpkg->provides | ||
5 | existed | ||
6 | |||
7 | * introduced in http://code.google.com/p/opkg/source/diff?spec=svn277&r=277&format=side&path=/trunk/libopkg/pkg.c | ||
8 | * the problem happens when oldpkg provide 1 and newpkg provide 2 | ||
9 | provides_count is merged to 2, but oldpkg->provides has only 1 entry | ||
10 | causing SIGSEGV: | ||
11 | pkg_formatted_field (fp=fp@entry=0x1444ce0, pkg=pkg@entry=0x120c620, field=<optimized out>, field@entry=0x7ffff7bd2abe "Provides") at pkg.c:739 | ||
12 | 739 fprintf(fp, "%s %s", i == 1 ? "" : ",", | ||
13 | (gdb) bt | ||
14 | #0 pkg_formatted_field (fp=fp@entry=0x1444ce0, pkg=pkg@entry=0x120c620, field=<optimized out>, field@entry=0x7ffff7bd2abe "Provides") at pkg.c:739 | ||
15 | #1 0x00007ffff7bc32fc in pkg_print_status (pkg=0x120c620, file=0x1444ce0) at pkg.c:887 | ||
16 | #2 0x00007ffff7bbff59 in opkg_conf_write_status_files () at opkg_conf.c:400 | ||
17 | #3 0x00007ffff7bbad8a in write_status_files_if_changed () at opkg_cmd.c:65 | ||
18 | #4 0x00007ffff7bbb73e in opkg_upgrade_cmd (argc=<optimized out>, argv=<optimized out>) at opkg_cmd.c:577 | ||
19 | #5 0x00007ffff7bbbcc2 in opkg_cmd_exec (cmd=cmd@entry=0x7ffff7dda080, argc=argc@entry=1, argv=argv@entry=0x7fffffffe768) at opkg_cmd.c:1319 | ||
20 | #6 0x000000000040165f in main (argc=3, argv=0x7fffffffe758) at opkg-cl.c:377 | ||
21 | |||
22 | Upstream-Status: Submitted | ||
23 | http://code.google.com/p/opkg/issues/detail?id=93 | ||
24 | |||
25 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
26 | --- | ||
27 | libopkg/pkg.c | 6 ++---- | ||
28 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
29 | |||
30 | diff --git a/libopkg/pkg.c b/libopkg/pkg.c | ||
31 | index be486ee..255c673 100644 | ||
32 | --- a/libopkg/pkg.c | ||
33 | +++ b/libopkg/pkg.c | ||
34 | @@ -377,10 +377,8 @@ pkg_merge(pkg_t *oldpkg, pkg_t *newpkg) | ||
35 | oldpkg->provides_count = newpkg->provides_count; | ||
36 | newpkg->provides_count = 0; | ||
37 | |||
38 | - if (!oldpkg->provides) { | ||
39 | - oldpkg->provides = newpkg->provides; | ||
40 | - newpkg->provides = NULL; | ||
41 | - } | ||
42 | + oldpkg->provides = newpkg->provides; | ||
43 | + newpkg->provides = NULL; | ||
44 | } | ||
45 | |||
46 | if (!oldpkg->conflicts_count) { | ||
47 | -- | ||
48 | 1.7.12 | ||
49 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0008-select_higher_version.patch b/meta/recipes-devtools/opkg/opkg/0008-select_higher_version.patch deleted file mode 100644 index a9b039c5a0..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0008-select_higher_version.patch +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | Add the --prefer-arch-to-version option | ||
2 | |||
3 | If there were more than one candidate which had the same pkg name in the | ||
4 | candidate list, for example, the same pkg with different versions, then | ||
5 | it would use the last one which was the highest version one in the past, | ||
6 | but it will use the higher arch priority when this option is specified. | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
11 | --- | ||
12 | libopkg/opkg_conf.h | 1 + | ||
13 | libopkg/pkg_hash.c | 18 +++++++++++++++--- | ||
14 | src/opkg-cl.c | 9 +++++++++ | ||
15 | 3 files changed, 25 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h | ||
18 | --- a/libopkg/opkg_conf.h | ||
19 | +++ b/libopkg/opkg_conf.h | ||
20 | @@ -77,6 +77,7 @@ struct opkg_conf | ||
21 | int force_removal_of_essential_packages; | ||
22 | int force_postinstall; | ||
23 | int force_remove; | ||
24 | + int prefer_arch_to_version; | ||
25 | int check_signature; | ||
26 | int nodeps; /* do not follow dependencies */ | ||
27 | char *offline_root; | ||
28 | diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c | ||
29 | --- a/libopkg/pkg_hash.c | ||
30 | +++ b/libopkg/pkg_hash.c | ||
31 | @@ -376,10 +376,22 @@ pkg_hash_fetch_best_installation_candidate(abstract_pkg_t *apkg, | ||
32 | if (constraint_fcn(matching, cdata)) { | ||
33 | opkg_msg(DEBUG, "Candidate: %s %s.\n", | ||
34 | matching->name, matching->version) ; | ||
35 | - good_pkg_by_name = matching; | ||
36 | /* It has been provided by hand, so it is what user want */ | ||
37 | - if (matching->provided_by_hand == 1) | ||
38 | - break; | ||
39 | + if (matching->provided_by_hand == 1) { | ||
40 | + good_pkg_by_name = matching; | ||
41 | + break; | ||
42 | + } | ||
43 | + /* Respect to the arch priorities when given alternatives */ | ||
44 | + if (good_pkg_by_name && conf->prefer_arch_to_version) { | ||
45 | + if (matching->arch_priority >= good_pkg_by_name->arch_priority) { | ||
46 | + good_pkg_by_name = matching; | ||
47 | + opkg_msg(DEBUG, "%s %s wins by priority.\n", | ||
48 | + matching->name, matching->version) ; | ||
49 | + } else | ||
50 | + opkg_msg(DEBUG, "%s %s wins by priority.\n", | ||
51 | + good_pkg_by_name->name, good_pkg_by_name->version) ; | ||
52 | + } else | ||
53 | + good_pkg_by_name = matching; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | diff --git a/src/opkg-cl.c b/src/opkg-cl.c | ||
58 | --- a/src/opkg-cl.c | ||
59 | +++ b/src/opkg-cl.c | ||
60 | @@ -42,6 +42,7 @@ enum { | ||
61 | ARGS_OPT_FORCE_SPACE, | ||
62 | ARGS_OPT_FORCE_POSTINSTALL, | ||
63 | ARGS_OPT_FORCE_REMOVE, | ||
64 | + ARGS_OPT_PREFER_ARCH_TO_VERSION, | ||
65 | ARGS_OPT_ADD_ARCH, | ||
66 | ARGS_OPT_ADD_DEST, | ||
67 | ARGS_OPT_NOACTION, | ||
68 | @@ -83,6 +84,8 @@ static struct option long_options[] = { | ||
69 | {"force_postinstall", 0, 0, ARGS_OPT_FORCE_POSTINSTALL}, | ||
70 | {"force-remove", 0, 0, ARGS_OPT_FORCE_REMOVE}, | ||
71 | {"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE}, | ||
72 | + {"prefer-arch-to-version", 0, 0, ARGS_OPT_PREFER_ARCH_TO_VERSION}, | ||
73 | + {"prefer-arch-to-version", 0, 0, ARGS_OPT_PREFER_ARCH_TO_VERSION}, | ||
74 | {"noaction", 0, 0, ARGS_OPT_NOACTION}, | ||
75 | {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY}, | ||
76 | {"nodeps", 0, 0, ARGS_OPT_NODEPS}, | ||
77 | @@ -173,6 +176,9 @@ args_parse(int argc, char *argv[]) | ||
78 | case ARGS_OPT_FORCE_REMOVE: | ||
79 | conf->force_remove = 1; | ||
80 | break; | ||
81 | + case ARGS_OPT_PREFER_ARCH_TO_VERSION: | ||
82 | + conf->prefer_arch_to_version = 1; | ||
83 | + break; | ||
84 | case ARGS_OPT_NODEPS: | ||
85 | conf->nodeps = 1; | ||
86 | break; | ||
87 | @@ -271,6 +277,9 @@ usage() | ||
88 | printf("\t--offline-root <dir> offline installation of packages.\n"); | ||
89 | printf("\t--add-arch <arch>:<prio> Register architecture with given priority\n"); | ||
90 | printf("\t--add-dest <name>:<path> Register destination with given path\n"); | ||
91 | + printf("\t--prefer-arch-to-version\t Use the architecture priority package rather\n"); | ||
92 | + printf("\t than the higher version one if more\n"); | ||
93 | + printf("\t than one candidate is found.\n"); | ||
94 | |||
95 | printf("\nForce Options:\n"); | ||
96 | printf("\t--force-depends Install/remove despite failed dependencies\n"); | ||
97 | -- | ||
98 | 1.7.1 | ||
99 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0009-pkg_depends-fix-version-constraints.patch b/meta/recipes-devtools/opkg/opkg/0009-pkg_depends-fix-version-constraints.patch deleted file mode 100644 index f7aa4eac91..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0009-pkg_depends-fix-version-constraints.patch +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | From b93ce2249751e0d90dab38e91691a6e9f33c3512 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Sat, 29 Sep 2012 11:38:03 +0200 | ||
4 | Subject: [PATCH 09/10] pkg_depends: fix version constraints | ||
5 | |||
6 | * factor parsing version constraint to str_to_constraint and use that | ||
7 | from pkg (pkg_version_satisfied) and also pkg_depends (parseDepends) | ||
8 | * fix constraint_to_str(), for EARLIER and LATER it was using '<' and | ||
9 | '>' which is parsed later as EARLIER_EQUAL and LATER_EQUAL | ||
10 | * show notice when deprecated '<' or '>' is used | ||
11 | |||
12 | Upstream-Status: Submitted | ||
13 | http://code.google.com/p/opkg/issues/detail?id=94 | ||
14 | |||
15 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
16 | --- | ||
17 | libopkg/pkg.c | 36 +++++++++++-------------- | ||
18 | libopkg/pkg_depends.c | 73 +++++++++++++++++++++++++++++---------------------- | ||
19 | libopkg/pkg_depends.h | 1 + | ||
20 | 3 files changed, 59 insertions(+), 51 deletions(-) | ||
21 | |||
22 | diff --git a/libopkg/pkg.c b/libopkg/pkg.c | ||
23 | index 255c673..1e98b9c 100644 | ||
24 | --- a/libopkg/pkg.c | ||
25 | +++ b/libopkg/pkg.c | ||
26 | @@ -968,28 +968,24 @@ pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op) | ||
27 | int r; | ||
28 | |||
29 | r = pkg_compare_versions(it, ref); | ||
30 | + char *op2 = op; | ||
31 | + enum version_constraint constraint = str_to_constraint(&op2); | ||
32 | |||
33 | - if (strcmp(op, "<=") == 0 || strcmp(op, "<") == 0) { | ||
34 | - return r <= 0; | ||
35 | - } | ||
36 | - | ||
37 | - if (strcmp(op, ">=") == 0 || strcmp(op, ">") == 0) { | ||
38 | - return r >= 0; | ||
39 | - } | ||
40 | - | ||
41 | - if (strcmp(op, "<<") == 0) { | ||
42 | - return r < 0; | ||
43 | - } | ||
44 | - | ||
45 | - if (strcmp(op, ">>") == 0) { | ||
46 | - return r > 0; | ||
47 | - } | ||
48 | - | ||
49 | - if (strcmp(op, "=") == 0) { | ||
50 | - return r == 0; | ||
51 | + switch (constraint) | ||
52 | + { | ||
53 | + case EARLIER_EQUAL: | ||
54 | + return r <= 0; | ||
55 | + case LATER_EQUAL: | ||
56 | + return r >= 0; | ||
57 | + case EARLIER: | ||
58 | + return r < 0; | ||
59 | + case LATER: | ||
60 | + return r > 0; | ||
61 | + case EQUAL: | ||
62 | + return r == 0; | ||
63 | + case NONE: | ||
64 | + opkg_msg(ERROR, "Unknown operator: %s.\n", op); | ||
65 | } | ||
66 | - | ||
67 | - opkg_msg(ERROR, "Unknown operator: %s.\n", op); | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c | ||
72 | index a72eed7..3dd8240 100644 | ||
73 | --- a/libopkg/pkg_depends.c | ||
74 | +++ b/libopkg/pkg_depends.c | ||
75 | @@ -781,7 +781,7 @@ constraint_to_str(enum version_constraint c) | ||
76 | case NONE: | ||
77 | return ""; | ||
78 | case EARLIER: | ||
79 | - return "< "; | ||
80 | + return "<< "; | ||
81 | case EARLIER_EQUAL: | ||
82 | return "<= "; | ||
83 | case EQUAL: | ||
84 | @@ -789,12 +789,51 @@ constraint_to_str(enum version_constraint c) | ||
85 | case LATER_EQUAL: | ||
86 | return ">= "; | ||
87 | case LATER: | ||
88 | - return "> "; | ||
89 | + return ">> "; | ||
90 | } | ||
91 | |||
92 | return ""; | ||
93 | } | ||
94 | |||
95 | +enum version_constraint | ||
96 | +str_to_constraint(char **str) | ||
97 | +{ | ||
98 | + if(!strncmp(*str, "<<", 2)){ | ||
99 | + *str += 2; | ||
100 | + return EARLIER; | ||
101 | + } | ||
102 | + else if(!strncmp(*str, "<=", 2)){ | ||
103 | + *str += 2; | ||
104 | + return EARLIER_EQUAL; | ||
105 | + } | ||
106 | + else if(!strncmp(*str, ">=", 2)){ | ||
107 | + *str += 2; | ||
108 | + return LATER_EQUAL; | ||
109 | + } | ||
110 | + else if(!strncmp(*str, ">>", 2)){ | ||
111 | + *str += 2; | ||
112 | + return LATER; | ||
113 | + } | ||
114 | + else if(!strncmp(*str, "=", 1)){ | ||
115 | + *str += 1; | ||
116 | + return EQUAL; | ||
117 | + } | ||
118 | + /* should these be here to support deprecated designations; dpkg does */ | ||
119 | + else if(!strncmp(*str, "<", 1)){ | ||
120 | + *str += 1; | ||
121 | + opkg_msg(NOTICE, "Deprecated version constraint '<' was used with the same meaning as '<='. Use '<<' for EARLIER constraint.\n"); | ||
122 | + return EARLIER_EQUAL; | ||
123 | + } | ||
124 | + else if(!strncmp(*str, ">", 1)){ | ||
125 | + *str += 1; | ||
126 | + opkg_msg(NOTICE, "Deprecated version constraint '>' was used with the same meaning as '>='. Use '>>' for LATER constraint.\n"); | ||
127 | + return LATER_EQUAL; | ||
128 | + } | ||
129 | + else { | ||
130 | + return NONE; | ||
131 | + } | ||
132 | +} | ||
133 | + | ||
134 | /* | ||
135 | * Returns a printable string for pkg's dependency at the specified idx. The | ||
136 | * resultant string must be passed to free() by the caller. | ||
137 | @@ -949,35 +988,7 @@ static int parseDepends(compound_depend_t *compound_depend, | ||
138 | /* extract constraint and version */ | ||
139 | if(*src == '('){ | ||
140 | src++; | ||
141 | - if(!strncmp(src, "<<", 2)){ | ||
142 | - possibilities[i]->constraint = EARLIER; | ||
143 | - src += 2; | ||
144 | - } | ||
145 | - else if(!strncmp(src, "<=", 2)){ | ||
146 | - possibilities[i]->constraint = EARLIER_EQUAL; | ||
147 | - src += 2; | ||
148 | - } | ||
149 | - else if(!strncmp(src, ">=", 2)){ | ||
150 | - possibilities[i]->constraint = LATER_EQUAL; | ||
151 | - src += 2; | ||
152 | - } | ||
153 | - else if(!strncmp(src, ">>", 2)){ | ||
154 | - possibilities[i]->constraint = LATER; | ||
155 | - src += 2; | ||
156 | - } | ||
157 | - else if(!strncmp(src, "=", 1)){ | ||
158 | - possibilities[i]->constraint = EQUAL; | ||
159 | - src++; | ||
160 | - } | ||
161 | - /* should these be here to support deprecated designations; dpkg does */ | ||
162 | - else if(!strncmp(src, "<", 1)){ | ||
163 | - possibilities[i]->constraint = EARLIER_EQUAL; | ||
164 | - src++; | ||
165 | - } | ||
166 | - else if(!strncmp(src, ">", 1)){ | ||
167 | - possibilities[i]->constraint = LATER_EQUAL; | ||
168 | - src++; | ||
169 | - } | ||
170 | + possibilities[i]->constraint = str_to_constraint(&src); | ||
171 | |||
172 | /* now we have any constraint, pass space to version string */ | ||
173 | while(isspace(*src)) src++; | ||
174 | diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h | ||
175 | index ca0801f..685a722 100644 | ||
176 | --- a/libopkg/pkg_depends.h | ||
177 | +++ b/libopkg/pkg_depends.h | ||
178 | @@ -87,6 +87,7 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg); | ||
179 | int pkg_dependence_satisfiable(depend_t *depend); | ||
180 | int pkg_dependence_satisfied(depend_t *depend); | ||
181 | const char* constraint_to_str(enum version_constraint c); | ||
182 | +enum version_constraint str_to_constraint(char **str); | ||
183 | int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); | ||
184 | |||
185 | #endif | ||
186 | -- | ||
187 | 1.7.12 | ||
188 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/0010-pkg_depends-fix-version_constraints_satisfied.patch b/meta/recipes-devtools/opkg/opkg/0010-pkg_depends-fix-version_constraints_satisfied.patch deleted file mode 100644 index a13d6585c3..0000000000 --- a/meta/recipes-devtools/opkg/opkg/0010-pkg_depends-fix-version_constraints_satisfied.patch +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | From e9add8fe4a63ef14aba8bd238ddde84d5470b611 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Sat, 29 Sep 2012 18:56:01 +0200 | ||
4 | Subject: [PATCH 10/10] pkg_depends: fix version_constraints_satisfied | ||
5 | |||
6 | * with | ||
7 | Package: a | ||
8 | Version: 1 | ||
9 | and | ||
10 | Conflicts: a (<< 1) | ||
11 | we have comparison == 0, but constraint EARLIER is not satisfied! | ||
12 | |||
13 | Upstream-Status: Submitted | ||
14 | http://code.google.com/p/opkg/issues/detail?id=94 | ||
15 | |||
16 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
17 | --- | ||
18 | libopkg/pkg_depends.c | 3 ++- | ||
19 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c | ||
22 | index 3dd8240..be81b7f 100644 | ||
23 | --- a/libopkg/pkg_depends.c | ||
24 | +++ b/libopkg/pkg_depends.c | ||
25 | @@ -464,7 +464,8 @@ int version_constraints_satisfied(depend_t * depends, pkg_t * pkg) | ||
26 | else if((depends->constraint == LATER) && | ||
27 | (comparison > 0)) | ||
28 | return 1; | ||
29 | - else if(comparison == 0) | ||
30 | + else if((depends->constraint == EQUAL) && | ||
31 | + (comparison == 0)) | ||
32 | return 1; | ||
33 | else if((depends->constraint == LATER_EQUAL) && | ||
34 | (comparison >= 0)) | ||
35 | -- | ||
36 | 1.7.12 | ||
37 | |||
diff --git a/meta/recipes-devtools/opkg/opkg/alternatives-ln.patch b/meta/recipes-devtools/opkg/opkg/alternatives-ln.patch deleted file mode 100644 index f257eb0e1c..0000000000 --- a/meta/recipes-devtools/opkg/opkg/alternatives-ln.patch +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | update-alternatives: use 'ln -n' | ||
2 | |||
3 | Using the '-n' option (--no-dereference) is a better way to solve the | ||
4 | do-not-link-into-directory issue. Using only 'ln -sf' can cause problems | ||
5 | on SELinux enabled hosts when target is inaccessible; e.g. when preparing | ||
6 | an offline rootsystem: | ||
7 | |||
8 | | $ cd <offline root> | ||
9 | | $ ln -sf /lib/systemd/systemd sbin/init # alternative #1 | ||
10 | | $ ln -sf /bin/busybox sbin/init # alternative #2 | ||
11 | | ln: accessing `sbin/init': Permission denied | ||
12 | | | ||
13 | | --> strace: | ||
14 | | brk(0) = 0x102b000 | ||
15 | | stat("sbin/init", 0x7fffaa91c900) = -1 EACCES (Permission denied) | ||
16 | | ... | ||
17 | | exit_group(1) = ? | ||
18 | |||
19 | Now with '-n': | ||
20 | |||
21 | | $ ln -snf /bin/busybox sbin/init | ||
22 | | lstat("sbin/init", {st_mode=S_IFLNK|0777, st_size=20, ...}) = 0 | ||
23 | | lstat("sbin/init", {st_mode=S_IFLNK|0777, st_size=20, ...}) = 0 | ||
24 | | stat("/bin/busybox", 0x7fff8c1a3bd0) = -1 ENOENT (No such file or directory) | ||
25 | | symlink("/bin/busybox", "sbin/init") = -1 EEXIST (File exists) | ||
26 | | unlink("sbin/init") = 0 | ||
27 | | symlink("/bin/busybox", "sbin/init") = 0 | ||
28 | |||
29 | |||
30 | The '-n' flag is well supported (coreutils have it at least since | ||
31 | 1999, busybox at least since 0.60.3 (2002)) and it obsoletes the | ||
32 | explicit check whether target is a directory. | ||
33 | |||
34 | Upstream-Status: pending [http://code.google.com/p/opkg/issues/detail?id=95] | ||
35 | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | ||
36 | |||
37 | Index: trunk/utils/update-alternatives.in | ||
38 | =================================================================== | ||
39 | --- trunk.orig/utils/update-alternatives.in | ||
40 | +++ trunk/utils/update-alternatives.in | ||
41 | @@ -113,14 +113,7 @@ find_best_alt() { | ||
42 | if [ ! -d $link_dir ]; then | ||
43 | mkdir -p $link_dir | ||
44 | fi | ||
45 | - if [ -h $link -a -d $link ]; then | ||
46 | - # If $link exists and the target is a directory, | ||
47 | - # 'ln -sf $path $link' doesn't replace the link to | ||
48 | - # that directory, it creates new link inside. | ||
49 | - echo "update-alternatives: Removing $link". | ||
50 | - rm -f $link | ||
51 | - fi | ||
52 | - ln -sf $path $link | ||
53 | + ln -snf $path $link | ||
54 | echo "update-alternatives: Linking $link to $path" | ||
55 | else | ||
56 | echo "update-alternatives: Error: not linking $link to $path since $link exists and is not a link" | ||
diff --git a/meta/recipes-devtools/opkg/opkg/don-t-add-recommends-pkgs-to-depended-upon-by.patch b/meta/recipes-devtools/opkg/opkg/don-t-add-recommends-pkgs-to-depended-upon-by.patch deleted file mode 100644 index e581dc009c..0000000000 --- a/meta/recipes-devtools/opkg/opkg/don-t-add-recommends-pkgs-to-depended-upon-by.patch +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | While removing a package with opkg, the process shouldn't be blocked if | ||
2 | another package RECOMMENDS the package wanted to be removed. This is | ||
3 | because, while generating the dependencies, opkg adds dependencies to | ||
4 | depended_upon_by even if dependency's type is RECOMMEND. The fix is to | ||
5 | skip dependencies of type RECOMMEND while constructing depended_upon_by. | ||
6 | |||
7 | Bug info: | ||
8 | https://bugzilla.yoctoproject.org/show_bug.cgi?id=2431 | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> | ||
12 | |||
13 | Index: trunk/libopkg/pkg_depends.c | ||
14 | =================================================================== | ||
15 | --- trunk.orig/libopkg/pkg_depends.c 2011-09-03 05:54:56.000000000 +0300 | ||
16 | +++ trunk/libopkg/pkg_depends.c 2012-10-20 22:23:03.783573202 +0300 | ||
17 | @@ -785,8 +785,7 @@ | ||
18 | for (i = 0; i < count; i++) { | ||
19 | depends = &pkg->depends[i]; | ||
20 | if (depends->type != PREDEPEND | ||
21 | - && depends->type != DEPEND | ||
22 | - && depends->type != RECOMMEND) | ||
23 | + && depends->type != DEPEND) | ||
24 | continue; | ||
25 | for (j = 0; j < depends->possibility_count; j++) { | ||
26 | ab_depend = depends->possibilities[j]->pkg; | ||
diff --git a/meta/recipes-devtools/opkg/opkg/don-t-print-provides-if-nothing-is-provided.patch b/meta/recipes-devtools/opkg/opkg/don-t-print-provides-if-nothing-is-provided.patch deleted file mode 100644 index 669faef00a..0000000000 --- a/meta/recipes-devtools/opkg/opkg/don-t-print-provides-if-nothing-is-provided.patch +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | Every package provides itself. While printing package information all | ||
2 | fields are printed only if there is any relevant info for them. For | ||
3 | example: a package with no "Replaces" won't get this printed at all. | ||
4 | Packages which provide only themselves, were printing this field but with | ||
5 | no values. This patch skips this field if the package provides only | ||
6 | itself. | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> | ||
10 | |||
11 | Index: trunk/libopkg/pkg.c | ||
12 | =================================================================== | ||
13 | --- trunk.orig/libopkg/pkg.c 2011-12-18 02:11:34.000000000 +0200 | ||
14 | +++ trunk/libopkg/pkg.c 2012-10-20 22:20:04.109201287 +0300 | ||
15 | @@ -731,7 +731,8 @@ | ||
16 | } else if (strcasecmp(field, "Priority") == 0) { | ||
17 | fprintf(fp, "Priority: %s\n", pkg->priority); | ||
18 | } else if (strcasecmp(field, "Provides") == 0) { | ||
19 | - if (pkg->provides_count) { | ||
20 | + /* Don't print provides if this package provides only itself */ | ||
21 | + if (pkg->provides_count > 1) { | ||
22 | fprintf(fp, "Provides:"); | ||
23 | for(i = 1; i < pkg->provides_count; i++) { | ||
24 | fprintf(fp, "%s %s", i == 1 ? "" : ",", | ||
diff --git a/meta/recipes-devtools/opkg/opkg/opkg-no-sync-offline.patch b/meta/recipes-devtools/opkg/opkg/opkg-no-sync-offline.patch deleted file mode 100644 index b1b3453484..0000000000 --- a/meta/recipes-devtools/opkg/opkg/opkg-no-sync-offline.patch +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | When installing into an offline root, calling sync() is pointless and just | ||
2 | hurts performance. Don't let's do that. | ||
3 | |||
4 | Signed-off-by: Phil Blundell <philb@gnu.org> | ||
5 | Upstream-Status: Pending | ||
6 | |||
7 | --- a/libopkg/opkg_cmd.c 2011-09-08 10:53:07.000000000 +0100 | ||
8 | +++ b/libopkg/opkg_cmd.c 2011-10-04 10:45:22.278615584 +0100 | ||
9 | @@ -64,7 +64,8 @@ write_status_files_if_changed(void) | ||
10 | opkg_msg(INFO, "Writing status file.\n"); | ||
11 | opkg_conf_write_status_files(); | ||
12 | pkg_write_changed_filelists(); | ||
13 | - sync(); | ||
14 | + if (!conf->offline_root) | ||
15 | + sync(); | ||
16 | } else { | ||
17 | opkg_msg(DEBUG, "Nothing to be done.\n"); | ||
18 | } | ||
diff --git a/meta/recipes-devtools/opkg/opkg_svn.bb b/meta/recipes-devtools/opkg/opkg_svn.bb index 064cf43af1..ee78488d70 100644 --- a/meta/recipes-devtools/opkg/opkg_svn.bb +++ b/meta/recipes-devtools/opkg/opkg_svn.bb | |||
@@ -1,25 +1,11 @@ | |||
1 | require opkg.inc | 1 | require opkg.inc |
2 | 2 | ||
3 | SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;protocol=http \ | 3 | SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;protocol=http \ |
4 | file://0001-add-opkg_compare_versions-function.patch \ | ||
5 | file://0002-Ensure-we-use-the-uname-gname-fields-when-extracting.patch \ | ||
6 | file://0003-Fix-dependency-issues-for-preinst-scripts.patch \ | ||
7 | file://0004-Failed-postinst-script-is-not-fatal-with-conf-offlin.patch \ | ||
8 | file://0005-Do-not-read-etc-opkg-.conf-if-f-is-specified.patch \ | ||
9 | file://0006-detect-circular-dependencies.patch \ | ||
10 | file://0007-merge-newpkg-provides-even-when-oldpkg-provides-exis.patch \ | ||
11 | file://0008-select_higher_version.patch \ | ||
12 | file://0009-pkg_depends-fix-version-constraints.patch \ | ||
13 | file://0010-pkg_depends-fix-version_constraints_satisfied.patch \ | ||
14 | file://opkg-no-sync-offline.patch \ | ||
15 | file://alternatives-ln.patch \ | ||
16 | file://don-t-add-recommends-pkgs-to-depended-upon-by.patch \ | ||
17 | file://don-t-print-provides-if-nothing-is-provided.patch \ | ||
18 | " | 4 | " |
19 | 5 | ||
20 | S = "${WORKDIR}/trunk" | 6 | S = "${WORKDIR}/trunk" |
21 | 7 | ||
22 | SRCREV = "633" | 8 | SRCREV = "649" |
23 | PV = "0.1.8+svnr${SRCPV}" | 9 | PV = "0.1.8+svnr${SRCPV}" |
24 | 10 | ||
25 | PR = "${INC_PR}.9" | 11 | PR = "${INC_PR}.0" |