Skip to contentSkip to conversation

opkg and BAD_RECOMMENDATIONS in thud 2.6.2

DISCUSSION Quentin Schulz 2 participants 8 messages May 31, 2019 – Jun 3, 2019

lore
Share & tools
lore
#0 lore raw

Hi all,

I've been hit with a rather unsettling bug when building an image with PACKAGE_CLASSES = "ipk" in Thud 2.6.2.

The error message is the following:
ERROR: meh-1.0-r0 do_rootfs: Unable to install packages. Command
'/tmp/yocto/temp/work/machine-poky-linux/meh/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /tmp/yocto/temp/work/machine-poky-linux/meh/1.0-r0/opkg.conf -t /tmp/yocto/temp/work/machine-poky-linux/meh/1.0-r0/temp/ipktemp/ -o /tmp/yocto/temp/work/machine-poky-linux/meh/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version --force-maintainer --force-overwrite install packagegroup-base-extended packagegroup-core-boot plop run-postinsts' returned 2:
Collected errors:
* Solver encountered 2 problem(s):
* Problem 1/2:
* - nothing provides bluez5 needed by plop-1.0-r0.aarch64
*
* Solution 1:
* - do not ask to install a package providing plop

* Problem 2/2:
* - nothing provides bluez5 needed by packagegroup-base-bluetooth-1.0-r83.stream1832prime
*
* Solution 1:
* - do not ask to install a package providing packagegroup-base-extended

ERROR: meh-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /tmp/yocto/temp/work/machine-poky-linux/meh/1.0-r0/temp/log.do_rootfs.30869
ERROR: Task (/media/qschulz/yocto/build/oe/recipes-images/nsdk/meh.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3059 tasks of which 3046 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/media/qschulz/yocto/build/oe/recipes-images/nsdk/meh.bb:do_rootfs
Summary: There were 7 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

I could reproduce it with an image meh.bb (I still have other layers included, including custom ones and I'm using a custom machine, so it might not be reproducible with solely poky and the following):
inherit core-image

CORE_IMAGE_EXTRA_INSTALL += "plop"

BAD_RECOMMENDATIONS += "bluez5"

with plop.bb being:
DESCRIPTION = "Plap"
LICENSE = "CLOSED"

RDEPENDS_${PN} += "bluez5"

do_install() {
        install -d ${D}${bindir}
        echo "plip" > ${D}${bindir}/plep
}

I took me a while to find out that it's an issue with opkg itself and nothing could be done in Yocto to fix it but I found the three following patches in yocto-2.7:

https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d8e12f2bfc4deaa0dc7530cf3af905e18e8037f6
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=c76c50df6498d85e7a6254002ff8f5e0ef3e67f7
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5bcb626cf49d2295ccca45d6fc7e1617cca932d6

With those three applied on top of thud 2.6.2, my image is built without complaints.

So now, the question:
I see that there is a planned 2.6.3 release. What is your policy in backporting patches? Could you please consider adding at least the first patch patching the python scripts since I can't do a bbappend of those in my layers and I'm pretty reluctant in applying patches on top of the upstream Thud release, as I like to keep upstream sources vanilla.

Thanks,
Quentin

Signature · 3 lines
StreamUnlimited Engineering GmbH
High Tech Campus Vienna, Gutheil-Schoder-Gasse 10, 1100 Vienna, Austria
[email protected], www.streamunlimited.com
#1 lore raw
Quoted 8 lines · Quentin Schulz

CORE_IMAGE_EXTRA_INSTALL += "plop"

BAD_RECOMMENDATIONS += "bluez5"

with plop.bb being:
DESCRIPTION = "Plap"
LICENSE = "CLOSED"

Quoted 6 lines

RDEPENDS_${PN} += "bluez5"

do_install() {
        install -d ${D}${bindir}
        echo "plip" > ${D}${bindir}/plep
}

Do you mean RDEPENDS_${PN} += "bluez5" above or RRECOMMENDS?

Cheers,

Richard

#2 lore raw

Hi Richard,

Quoted 9 lines · Richard Purdie
Quoted 8 lines · Quentin Schulz

CORE_IMAGE_EXTRA_INSTALL += "plop"

BAD_RECOMMENDATIONS += "bluez5"

with plop.bb being:
DESCRIPTION = "Plap"
LICENSE = "CLOSED"

Quoted 9 lines
Quoted 6 lines

RDEPENDS_${PN} += "bluez5"

do_install() {
        install -d ${D}${bindir}
        echo "plip" > ${D}${bindir}/plep
}

Do you mean RDEPENDS_${PN} += "bluez5" above or RRECOMMENDS?

I mean RDEPENDS_${PN}. If it is RRECOMMENDS, then my understanding is that it won't be packaged, in that case BAD_RECOMMENDATIONS and RRECOMMENDS works as expected.

However, BAD_RECOMMENDATIONS and RDEPENDS_${PN} (we have RRECOMMENDS elsewhere but I think it does not really matter for the big picture as it gets "cancelled" by BAD_RECOMMENDATIONS anyway?) don't seem to work well together in that case.

Quentin

Signature · 4 lines
StreamUnlimited Engineering GmbH
High Tech Campus Vienna, Gutheil-Schoder-Gasse 10, 1100 Vienna, Austria
Fax: +43 1 667 20 02 4401
[email protected], www.streamunlimited.com
#3 lore raw
Quoted 19 lines · Quentin Schulz

Hi Richard,

Quoted 16 lines · Richard Purdie
Quoted 14 lines · Quentin Schulz

CORE_IMAGE_EXTRA_INSTALL += "plop"

BAD_RECOMMENDATIONS += "bluez5"

with plop.bb being:
DESCRIPTION = "Plap"
LICENSE = "CLOSED"

RDEPENDS_${PN} += "bluez5"

do_install() {
        install -d ${D}${bindir}
        echo "plip" > ${D}${bindir}/plep
}
Quoted 5 lines
Quoted 2 lines

Do you mean RDEPENDS_${PN} += "bluez5" above or RRECOMMENDS?

I mean RDEPENDS_${PN}. If it is RRECOMMENDS, then my understanding is that it won't be packaged

That is not correct.

Quoted 9 lines

, in that case BAD_RECOMMENDATIONS and
RRECOMMENDS works as expected.

However, BAD_RECOMMENDATIONS and RDEPENDS_${PN} (we have RRECOMMENDS elsewhere but I think it does not really matter for the big picture as
it gets "cancelled" by BAD_RECOMMENDATIONS anyway?) don't seem to work
well together in that case.

RDEPENDS is a hard dependency. BAD_RECOMMENDATIONS only affects RRECOMMENDS, not RDEPENDS.

Cheers,

Richard

#4 lore raw

Hi Richard,

Quoted 38 lines · On Fri, May 31, 2019 at 02:46:07PM +0100, [email protected]…
Quoted 19 lines · Quentin Schulz

Hi Richard,

Quoted 16 lines · Richard Purdie
Quoted 14 lines · Quentin Schulz

CORE_IMAGE_EXTRA_INSTALL += "plop"

BAD_RECOMMENDATIONS += "bluez5"

with plop.bb being:
DESCRIPTION = "Plap"
LICENSE = "CLOSED"

RDEPENDS_${PN} += "bluez5"

do_install() {
        install -d ${D}${bindir}
        echo "plip" > ${D}${bindir}/plep
}
Quoted 5 lines
Quoted 2 lines

Do you mean RDEPENDS_${PN} += "bluez5" above or RRECOMMENDS?

I mean RDEPENDS_${PN}. If it is RRECOMMENDS, then my understanding is that it won't be packaged

That is not correct.

Quoted 9 lines

, in that case BAD_RECOMMENDATIONS and
RRECOMMENDS works as expected.

However, BAD_RECOMMENDATIONS and RDEPENDS_${PN} (we have RRECOMMENDS elsewhere but I think it does not really matter for the big picture as
it gets "cancelled" by BAD_RECOMMENDATIONS anyway?) don't seem to work
well together in that case.

Quoted 3 lines

RDEPENDS is a hard dependency. BAD_RECOMMENDATIONS only affects RRECOMMENDS, not RDEPENDS.

Yes indeed.

Why is my package unable to be installed by opkg then?

Let me give more light on the actual setup.

Multiple images/multiple machines, some have bluetooth enabled, others don't. Some recipes RRECOMMENDS bluez5 but it does not make sense to have it packaged for the build of bluetooth-disabled machines/images, that is the reason why bluez5 is a BAD_RECOMMENDATIONS.

However, some packages absolutely need bluez5 as RDEPENDS. RDEPENDS will then take precedence over BAD_RECOMMENDATIONS and will be built. It works. It really does from Yocto POV. Until opkg tries to install all the packages, the bluez5 package is not found by opkg (it is there though, at the same place as other ipk are, in the list of available packages, etc.). Then the rootfs build fails with the log provided in the original mail.

Why? RDEPENDS should take precedence over BAD_RECOMMENDATIONS, that is what is expected and what is stated in the documentation. However, it isn't the case for us in this case as opkg just does not find a bluez5 package even though it is there, where all others are, available in the same list of packages.

With the patches given in the opening mail, Yocto build finished without complaints.

Quentin

Signature · 3 lines
StreamUnlimited Engineering GmbH
High Tech Campus Vienna, Gutheil-Schoder-Gasse 10, 1100 Vienna, Austria
[email protected], www.streamunlimited.com
#5 lore raw
In reply to Quentin Schulz
Quoted 10 lines · Quentin Schulz

I took me a while to find out that it's an issue with opkg itself and nothing could be done in Yocto to fix it but I found the three following patches in yocto-2.7:

https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d8e12f2bfc4deaa0dc7530cf3af905e18e8037f6
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=c76c50df6498d85e7a6254002ff8f5e0ef3e67f7
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5bcb626cf49d2295ccca45d6fc7e1617cca932d6

With those three applied on top of thud 2.6.2, my image is built without complaints.

Does it work with just the first two? I think those may be possibilities for backporting. Adding the stable maintainer (Armin) to cc. The thrid one (the upgrade) probably isn't a candidate.

Cheers,

Richard

#6 lore raw
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Quentin Schulz

I took me a while to find out that it's an issue with opkg itself and nothing could be done in Yocto to fix it but I found the three following patches in yocto-2.7:

https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d8e12f2bfc4deaa0dc7530cf3af905e18e8037f6
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=c76c50df6498d85e7a6254002ff8f5e0ef3e67f7
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5bcb626cf49d2295ccca45d6fc7e1617cca932d6

Quoted 7 lines
Quoted 2 lines

With those three applied on top of thud 2.6.2, my image is built without complaints.

Does it work with just the first two? I think those may be possibilities for backporting. Adding the stable maintainer (Armin) to cc. The thrid one (the upgrade) probably isn't a candidate.

The patch file didn't apply cleanly but after doing the changes manually, it seems that only the first two commits above are needed indeed. You can find the patch attached.

I can only test on Monday if it works as expected (i.e. bluez5 in the image), so I'll let you know then.

Have a nice week-end,
Quentin

Signature · 3 lines
StreamUnlimited Engineering GmbH
High Tech Campus Vienna, Gutheil-Schoder-Gasse 10, 1100 Vienna, Austria
[email protected], www.streamunlimited.com

From 2eca28b6a37be92e4e835c51872c7df34ec6dedd Mon Sep 17 00:00:00 2001
From: Quentin Schulz <[email protected]>
Date: Fri, 31 May 2019 17:30:40 +0200
Subject: [PATCH] [PATCH] libopkg: add --add-ignore-recommends option

Add option to ignore specific recommended packages. On the libsolv backed, this feature will only work on libsolv version > 0.7.2 [1].

[1] https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openSUSE_libsolv_issues_254&d=DwIBaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=wNcrL2akRn6jfxhHaKavUrJB_C9JAMXtynjLd8ZzgXQ&m=GObNHzFJpWpf_PripIrf-K2RhsktYdAUEieAJexXOKw&s=3G-meChUqClFggFPqsrAxIZBfLnRKIHm62Uuy1X6nQQ&e=

Upstream-Status: Accepted

---
 libopkg/opkg_conf.c                           |  2 +
 libopkg/opkg_conf.h                           |  1 +
 .../solvers/internal/pkg_depends_internal.c   |  3 +-
 libopkg/solvers/libsolv/opkg_solver_libsolv.c | 21 ++++++-
 man/opkg.1.in                                 |  3 +
 src/opkg.c                                    |  6 ++
 tests/Makefile                                |  1 +
 tests/core/43_add_ignore_recommends.py        | 62 +++++++++++++++++++
 8 files changed, 97 insertions(+), 2 deletions(-)
 create mode 100644 tests/core/43_add_ignore_recommends.py
libopkg/opkg_conf.c +2 -0
index 06880a1..f2330cd 100644
@@ -597,6 +597,7 @@ int opkg_conf_init(void)
     pkg_dest_list_init(&opkg_config->tmp_dest_list);
     nv_pair_list_init(&opkg_config->arch_list);
     str_list_init(&opkg_config->exclude_list);
+    str_list_init(&opkg_config->ignore_recommends_list);
 
     return 0;
 }
@@ -938,6 +939,7 @@ void opkg_conf_deinit(void)
     pkg_dest_list_deinit(&opkg_config->pkg_dest_list);
     nv_pair_list_deinit(&opkg_config->arch_list);
     str_list_deinit(&opkg_config->exclude_list);
+    str_list_deinit(&opkg_config->ignore_recommends_list);
 
     if (opkg_config->verbosity >= DEBUG) {
         hash_print_stats(&opkg_config->pkg_hash);
libopkg/opkg_conf.h +1 -0
index dc11516..fc42de3 100644
@@ -61,6 +61,7 @@ typedef struct opkg_conf {
     pkg_dest_list_t tmp_dest_list;
     nv_pair_list_t arch_list;
     str_list_t exclude_list;
+    str_list_t ignore_recommends_list;
 
     int restrict_to_default_dest;
     pkg_dest_t *default_dest;
libopkg/solvers/internal/pkg_depends_internal.c +2 -1
index cd56d84..5deee70 100644
@@ -228,7 +228,8 @@ int pkg_hash_fetch_unsatisfied_dependencies(pkg_t *pkg,
                             || compound_depend->type == SUGGEST)
                         && (satisfying_pkg->state_want == SW_DEINSTALL
                             || satisfying_pkg->state_want == SW_PURGE
-                            || opkg_config->no_install_recommends);
+                            || opkg_config->no_install_recommends
+                            || str_list_contains(&opkg_config->ignore_recommends_list, satisfying_pkg->name));
                 if (ignore) {
                     opkg_msg(NOTICE,
                              "%s: ignoring recommendation for "
libopkg/solvers/libsolv/opkg_solver_libsolv.c +20 -1
index bf0b72c..ea00a37 100644
@@ -484,6 +484,7 @@ static void pkg2solvable(pkg_t *pkg, Solvable *solvable_out)
 static void populate_installed_repo(libsolv_solver_t *libsolv_solver)
 {
     int i;
+    Id what;
 
     pkg_vec_t *installed_pkgs = pkg_vec_alloc();
 
@@ -507,6 +508,15 @@ static void populate_installed_repo(libsolv_solver_t *libsolv_solver)
         /* set solvable attributes */
         pkg2solvable(pkg, solvable);
 
+        /* if the package is in ignore-recommends-list, disfavor installation */
+        if (str_list_contains(&opkg_config->ignore_recommends_list, pkg->name)) {
+            opkg_message(NOTICE, "Disfavor package: %s\n",
+                         pkg->name);
+            what = pool_str2id(libsolv_solver->pool, pkg->name, 1);
+            queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE_NAME
+                        | SOLVER_DISFAVOR, what);
+        }
+
         /* if the package is not autoinstalled, mark it as user installed */
         if (!pkg->auto_installed)
             queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE
@@ -533,7 +543,7 @@ static void populate_available_repos(libsolv_solver_t *libsolv_solver)
 {
     int i;
     Solvable *solvable;
-    Id solvable_id;
+    Id solvable_id, what;
 
     pkg_vec_t *available_pkgs = pkg_vec_alloc();
 
@@ -602,6 +612,15 @@ static void populate_available_repos(libsolv_solver_t *libsolv_solver)
         solvable = pool_id2solvable(libsolv_solver->pool, solvable_id);
         pkg2solvable(pkg, solvable);
 
+        /* if the package is in ignore-recommends-list, disfavor installation */
+        if (str_list_contains(&opkg_config->ignore_recommends_list, pkg->name)) {
+            opkg_message(NOTICE, "Disfavor package: %s\n",
+                         pkg->name);
+            what = pool_str2id(libsolv_solver->pool, pkg->name, 1);
+            queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE_NAME
+                        | SOLVER_DISFAVOR, what);
+        }
+
         /* if the --force-depends option is specified make dependencies weak */
         if (opkg_config->force_depends)
             queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE
man/opkg.1.in +3 -0
index 026fb15..c0d4bf3 100644
@@ -143,6 +143,9 @@ conjunction with \fB\--dest\fP
 \fB\--add-arch <\fIarch\fP>:<\fIprio\fP>\fR
 Register the package architecture \fIarch\fP with the numeric
 priority \fIprio\fP. Lower priorities take precedence.
+.TP
+\fB\--add-ignore-recommends <\fIname\fP>\fR
+Register package to be ignored as a recomendee
 .SS FORCE OPTIONS
 .TP
 \fB\--force-depends \fR
src/opkg.c +6 -0
index f23467d..5181065 100644
@@ -51,6 +51,7 @@ enum {
     ARGS_OPT_ADD_DEST,
     ARGS_OPT_SIZE,
     ARGS_OPT_ADD_EXCLUDE,
+    ARGS_OPT_ADD_IGNORE_RECOMMENDS,
     ARGS_OPT_NOACTION,
     ARGS_OPT_DOWNLOAD_ONLY,
     ARGS_OPT_NODEPS,
@@ -110,6 +111,7 @@ static struct option long_options[] = {
     {"add-dest", 1, 0, ARGS_OPT_ADD_DEST},
     {"size", 0, 0, ARGS_OPT_SIZE},
     {"add-exclude", 1, 0, ARGS_OPT_ADD_EXCLUDE},
+    {"add-ignore-recommends", 1, 0, ARGS_OPT_ADD_IGNORE_RECOMMENDS},
     {"test", 0, 0, ARGS_OPT_NOACTION},
     {"tmp-dir", 1, 0, 't'},
     {"tmp_dir", 1, 0, 't'},
@@ -235,6 +237,9 @@ static int args_parse(int argc, char *argv[])
         case ARGS_OPT_ADD_EXCLUDE:
             str_list_append(&opkg_config->exclude_list, optarg);
             break;
+        case ARGS_OPT_ADD_IGNORE_RECOMMENDS:
+            str_list_append(&opkg_config->ignore_recommends_list, optarg);
+            break;
         case ARGS_OPT_SIZE:
             opkg_config->size = 1;
             break;
@@ -335,6 +340,7 @@ static void usage()
     printf("\t--add-arch <arch>:<prio>        Register architecture with given priority\n");
     printf("\t--add-dest <name>:<path>        Register destination with given path\n");
     printf("\t--add-exclude <name>            Register package to be excluded from install\n");
+    printf("\t--add-ignore-recommends <name>  Register package to be ignored as a recomendee\n");
     printf("\t--prefer-arch-to-version        Use the architecture priority package rather\n");
     printf("\t                                than the higher version one if more\n");
     printf("\t                                than one candidate is found.\n");
tests/Makefile +1 -0
index 148c844..ddf027f 100644
@@ -38,6 +38,7 @@ REGRESSION_TESTS := core/01_install.py \
 		    core/37_globs.py \
 		    core/38_install_constrained_version.py \
 		    core/39_distupgrade.py \
+		    core/43_add_ignore_recommends.py \
 		    regress/issue26.py \
 		    regress/issue31.py \
 		    regress/issue32.py \
tests/core/43_add_ignore_recommends.py new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.17.1
#7 lore raw
In reply to Richard Purdie
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Quentin Schulz

I took me a while to find out that it's an issue with opkg itself and nothing could be done in Yocto to fix it but I found the three following patches in yocto-2.7:

https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d8e12f2bfc4deaa0dc7530cf3af905e18e8037f6
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=c76c50df6498d85e7a6254002ff8f5e0ef3e67f7
https://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5bcb626cf49d2295ccca45d6fc7e1617cca932d6

Quoted 7 lines
Quoted 2 lines

With those three applied on top of thud 2.6.2, my image is built without complaints.

Does it work with just the first two? I think those may be possibilities for backporting. Adding the stable maintainer (Armin) to cc. The thrid one (the upgrade) probably isn't a candidate.

The patch file didn't apply cleanly but after doing the changes manually, it seems that only the first two commits above are needed indeed. You can find the patch attached.

It seems to work fine. I have libbluetooth.so* installed on my target.

Let me know if there's anything I can do,
Thanks,
Quentin

Signature · 3 lines
StreamUnlimited Engineering GmbH
High Tech Campus Vienna, Gutheil-Schoder-Gasse 10, 1100 Vienna, Austria
[email protected], www.streamunlimited.com

From 2eca28b6a37be92e4e835c51872c7df34ec6dedd Mon Sep 17 00:00:00 2001
From: Quentin Schulz <[email protected]>
Date: Fri, 31 May 2019 17:30:40 +0200
Subject: [PATCH] [PATCH] libopkg: add --add-ignore-recommends option

Add option to ignore specific recommended packages. On the libsolv backed, this feature will only work on libsolv version > 0.7.2 [1].

[1] https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openSUSE_libsolv_issues_254&d=DwIBaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=wNcrL2akRn6jfxhHaKavUrJB_C9JAMXtynjLd8ZzgXQ&m=GObNHzFJpWpf_PripIrf-K2RhsktYdAUEieAJexXOKw&s=3G-meChUqClFggFPqsrAxIZBfLnRKIHm62Uuy1X6nQQ&e=

Upstream-Status: Accepted

---
 libopkg/opkg_conf.c                           |  2 +
 libopkg/opkg_conf.h                           |  1 +
 .../solvers/internal/pkg_depends_internal.c   |  3 +-
 libopkg/solvers/libsolv/opkg_solver_libsolv.c | 21 ++++++-
 man/opkg.1.in                                 |  3 +
 src/opkg.c                                    |  6 ++
 tests/Makefile                                |  1 +
 tests/core/43_add_ignore_recommends.py        | 62 +++++++++++++++++++
 8 files changed, 97 insertions(+), 2 deletions(-)
 create mode 100644 tests/core/43_add_ignore_recommends.py
libopkg/opkg_conf.c +2 -0
index 06880a1..f2330cd 100644
@@ -597,6 +597,7 @@ int opkg_conf_init(void)
     pkg_dest_list_init(&opkg_config->tmp_dest_list);
     nv_pair_list_init(&opkg_config->arch_list);
     str_list_init(&opkg_config->exclude_list);
+    str_list_init(&opkg_config->ignore_recommends_list);
 
     return 0;
 }
@@ -938,6 +939,7 @@ void opkg_conf_deinit(void)
     pkg_dest_list_deinit(&opkg_config->pkg_dest_list);
     nv_pair_list_deinit(&opkg_config->arch_list);
     str_list_deinit(&opkg_config->exclude_list);
+    str_list_deinit(&opkg_config->ignore_recommends_list);
 
     if (opkg_config->verbosity >= DEBUG) {
         hash_print_stats(&opkg_config->pkg_hash);
libopkg/opkg_conf.h +1 -0
index dc11516..fc42de3 100644
@@ -61,6 +61,7 @@ typedef struct opkg_conf {
     pkg_dest_list_t tmp_dest_list;
     nv_pair_list_t arch_list;
     str_list_t exclude_list;
+    str_list_t ignore_recommends_list;
 
     int restrict_to_default_dest;
     pkg_dest_t *default_dest;
libopkg/solvers/internal/pkg_depends_internal.c +2 -1
index cd56d84..5deee70 100644
@@ -228,7 +228,8 @@ int pkg_hash_fetch_unsatisfied_dependencies(pkg_t *pkg,
                             || compound_depend->type == SUGGEST)
                         && (satisfying_pkg->state_want == SW_DEINSTALL
                             || satisfying_pkg->state_want == SW_PURGE
-                            || opkg_config->no_install_recommends);
+                            || opkg_config->no_install_recommends
+                            || str_list_contains(&opkg_config->ignore_recommends_list, satisfying_pkg->name));
                 if (ignore) {
                     opkg_msg(NOTICE,
                              "%s: ignoring recommendation for "
libopkg/solvers/libsolv/opkg_solver_libsolv.c +20 -1
index bf0b72c..ea00a37 100644
@@ -484,6 +484,7 @@ static void pkg2solvable(pkg_t *pkg, Solvable *solvable_out)
 static void populate_installed_repo(libsolv_solver_t *libsolv_solver)
 {
     int i;
+    Id what;
 
     pkg_vec_t *installed_pkgs = pkg_vec_alloc();
 
@@ -507,6 +508,15 @@ static void populate_installed_repo(libsolv_solver_t *libsolv_solver)
         /* set solvable attributes */
         pkg2solvable(pkg, solvable);
 
+        /* if the package is in ignore-recommends-list, disfavor installation */
+        if (str_list_contains(&opkg_config->ignore_recommends_list, pkg->name)) {
+            opkg_message(NOTICE, "Disfavor package: %s\n",
+                         pkg->name);
+            what = pool_str2id(libsolv_solver->pool, pkg->name, 1);
+            queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE_NAME
+                        | SOLVER_DISFAVOR, what);
+        }
+
         /* if the package is not autoinstalled, mark it as user installed */
         if (!pkg->auto_installed)
             queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE
@@ -533,7 +543,7 @@ static void populate_available_repos(libsolv_solver_t *libsolv_solver)
 {
     int i;
     Solvable *solvable;
-    Id solvable_id;
+    Id solvable_id, what;
 
     pkg_vec_t *available_pkgs = pkg_vec_alloc();
 
@@ -602,6 +612,15 @@ static void populate_available_repos(libsolv_solver_t *libsolv_solver)
         solvable = pool_id2solvable(libsolv_solver->pool, solvable_id);
         pkg2solvable(pkg, solvable);
 
+        /* if the package is in ignore-recommends-list, disfavor installation */
+        if (str_list_contains(&opkg_config->ignore_recommends_list, pkg->name)) {
+            opkg_message(NOTICE, "Disfavor package: %s\n",
+                         pkg->name);
+            what = pool_str2id(libsolv_solver->pool, pkg->name, 1);
+            queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE_NAME
+                        | SOLVER_DISFAVOR, what);
+        }
+
         /* if the --force-depends option is specified make dependencies weak */
         if (opkg_config->force_depends)
             queue_push2(&libsolv_solver->solver_jobs, SOLVER_SOLVABLE
man/opkg.1.in +3 -0
index 026fb15..c0d4bf3 100644
@@ -143,6 +143,9 @@ conjunction with \fB\--dest\fP
 \fB\--add-arch <\fIarch\fP>:<\fIprio\fP>\fR
 Register the package architecture \fIarch\fP with the numeric
 priority \fIprio\fP. Lower priorities take precedence.
+.TP
+\fB\--add-ignore-recommends <\fIname\fP>\fR
+Register package to be ignored as a recomendee
 .SS FORCE OPTIONS
 .TP
 \fB\--force-depends \fR
src/opkg.c +6 -0
index f23467d..5181065 100644
@@ -51,6 +51,7 @@ enum {
     ARGS_OPT_ADD_DEST,
     ARGS_OPT_SIZE,
     ARGS_OPT_ADD_EXCLUDE,
+    ARGS_OPT_ADD_IGNORE_RECOMMENDS,
     ARGS_OPT_NOACTION,
     ARGS_OPT_DOWNLOAD_ONLY,
     ARGS_OPT_NODEPS,
@@ -110,6 +111,7 @@ static struct option long_options[] = {
     {"add-dest", 1, 0, ARGS_OPT_ADD_DEST},
     {"size", 0, 0, ARGS_OPT_SIZE},
     {"add-exclude", 1, 0, ARGS_OPT_ADD_EXCLUDE},
+    {"add-ignore-recommends", 1, 0, ARGS_OPT_ADD_IGNORE_RECOMMENDS},
     {"test", 0, 0, ARGS_OPT_NOACTION},
     {"tmp-dir", 1, 0, 't'},
     {"tmp_dir", 1, 0, 't'},
@@ -235,6 +237,9 @@ static int args_parse(int argc, char *argv[])
         case ARGS_OPT_ADD_EXCLUDE:
             str_list_append(&opkg_config->exclude_list, optarg);
             break;
+        case ARGS_OPT_ADD_IGNORE_RECOMMENDS:
+            str_list_append(&opkg_config->ignore_recommends_list, optarg);
+            break;
         case ARGS_OPT_SIZE:
             opkg_config->size = 1;
             break;
@@ -335,6 +340,7 @@ static void usage()
     printf("\t--add-arch <arch>:<prio>        Register architecture with given priority\n");
     printf("\t--add-dest <name>:<path>        Register destination with given path\n");
     printf("\t--add-exclude <name>            Register package to be excluded from install\n");
+    printf("\t--add-ignore-recommends <name>  Register package to be ignored as a recomendee\n");
     printf("\t--prefer-arch-to-version        Use the architecture priority package rather\n");
     printf("\t                                than the higher version one if more\n");
     printf("\t                                than one candidate is found.\n");
tests/Makefile +1 -0
index 148c844..ddf027f 100644
@@ -38,6 +38,7 @@ REGRESSION_TESTS := core/01_install.py \
 		    core/37_globs.py \
 		    core/38_install_constrained_version.py \
 		    core/39_distupgrade.py \
+		    core/43_add_ignore_recommends.py \
 		    regress/issue26.py \
 		    regress/issue31.py \
 		    regress/issue32.py \
tests/core/43_add_ignore_recommends.py new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.17.1