diff mbox series

[opkg] libopkg: pkg_hash: print unresolved dependencies

Message ID 20210502205912.23753-1-hauke@hauke-m.de
State Superseded
Delegated to: Hauke Mehrtens
Headers show
Series [opkg] libopkg: pkg_hash: print unresolved dependencies | expand

Commit Message

Hauke Mehrtens May 2, 2021, 8:59 p.m. UTC
When a package is not installed because it has unresolved dependencies
normally we get only an error message like this:
 * pkg_hash_fetch_best_installation_candidate: Packages for ltq-vdsl-app found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package ltq-vdsl-app.

Log in addition the following error message:
 * pkg_hash_check_unresolved: can not find dependency ltq-dsl-base for ltq-vdsl-app

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---

I am not sure if this would happen in normal cases too and spam the 
error log, I only saw this in an error case.

 libopkg/pkg_hash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Daniel Golle May 2, 2021, 11:13 p.m. UTC | #1
On Sun, May 02, 2021 at 10:59:12PM +0200, Hauke Mehrtens wrote:
> When a package is not installed because it has unresolved dependencies
> normally we get only an error message like this:
>  * pkg_hash_fetch_best_installation_candidate: Packages for ltq-vdsl-app found, but incompatible with the architectures configured
>  * opkg_install_cmd: Cannot install package ltq-vdsl-app.
> 
> Log in addition the following error message:
>  * pkg_hash_check_unresolved: can not find dependency ltq-dsl-base for ltq-vdsl-app
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
> 
> I am not sure if this would happen in normal cases too and spam the 
> error log, I only saw this in an error case.
> 
>  libopkg/pkg_hash.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
> index a07a25e..6c04ab2 100644
> --- a/libopkg/pkg_hash.c
> +++ b/libopkg/pkg_hash.c
> @@ -263,8 +263,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
>  	if (unresolved) {
>  		res = 1;
>  		tmp = unresolved;
> -		while (*tmp)
> +		while (*tmp) {
> +			opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp, maybe->name);
                                        ^^^^^^^^^
Should be 'cannot', it's spelled as one word in English (natives:
correct me if I'm wrong!)

>  			free(*(tmp++));
> +		}
>  		free(unresolved);
>  	}
>  	pkg_vec_free(depends);
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Alex Henrie May 3, 2021, 2:45 a.m. UTC | #2
On Sun, May 2, 2021 at 5:16 PM Daniel Golle <daniel@makrotopia.org> wrote:
>
> On Sun, May 02, 2021 at 10:59:12PM +0200, Hauke Mehrtens wrote:
> >
> >  libopkg/pkg_hash.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
> > index a07a25e..6c04ab2 100644
> > --- a/libopkg/pkg_hash.c
> > +++ b/libopkg/pkg_hash.c
> > @@ -263,8 +263,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
> >       if (unresolved) {
> >               res = 1;
> >               tmp = unresolved;
> > -             while (*tmp)
> > +             while (*tmp) {
> > +                     opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp, maybe->name);
>                                         ^^^^^^^^^
> Should be 'cannot', it's spelled as one word in English (natives:
> correct me if I'm wrong!)

"Cannot", "can not", and "can't" are all correct.

-Alex
Baptiste Jonglez May 3, 2021, 12:38 p.m. UTC | #3
Hi,

On 02-05-21, Hauke Mehrtens wrote:
> When a package is not installed because it has unresolved dependencies
> normally we get only an error message like this:
>  * pkg_hash_fetch_best_installation_candidate: Packages for ltq-vdsl-app found, but incompatible with the architectures configured
>  * opkg_install_cmd: Cannot install package ltq-vdsl-app.
> 
> Log in addition the following error message:
>  * pkg_hash_check_unresolved: can not find dependency ltq-dsl-base for ltq-vdsl-app

Since the error has probably nothing to do with "architectures", wouldn't
it make more sense to remove or improve the first error message?  Or
understand why it fails for seemingly unrelated reasons.

> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
> 
> I am not sure if this would happen in normal cases too and spam the 
> error log, I only saw this in an error case.
> 
>  libopkg/pkg_hash.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
> index a07a25e..6c04ab2 100644
> --- a/libopkg/pkg_hash.c
> +++ b/libopkg/pkg_hash.c
> @@ -263,8 +263,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
>  	if (unresolved) {
>  		res = 1;
>  		tmp = unresolved;
> -		while (*tmp)
> +		while (*tmp) {
> +			opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp, maybe->name);
>  			free(*(tmp++));
> +		}
>  		free(unresolved);
>  	}
>  	pkg_vec_free(depends);
Hauke Mehrtens May 3, 2021, 5:46 p.m. UTC | #4
On 5/3/21 2:38 PM, Baptiste Jonglez wrote:
> Hi,
> 
> On 02-05-21, Hauke Mehrtens wrote:
>> When a package is not installed because it has unresolved dependencies
>> normally we get only an error message like this:
>>   * pkg_hash_fetch_best_installation_candidate: Packages for ltq-vdsl-app found, but incompatible with the architectures configured
>>   * opkg_install_cmd: Cannot install package ltq-vdsl-app.
>>
>> Log in addition the following error message:
>>   * pkg_hash_check_unresolved: can not find dependency ltq-dsl-base for ltq-vdsl-app
> 
> Since the error has probably nothing to do with "architectures", wouldn't
> it make more sense to remove or improve the first error message?  Or
> understand why it fails for seemingly unrelated reasons.

This "incompatible with the architectures configured" error message is 
shown for more error cases than the newly added one, see here:
https://lxr.openwrt.org/source/opkg-lede/libopkg/pkg_hash.c#L395

It would probably be good to improve the error messages, but I do not 
understand the full code. If someone has some suggestions on how to 
improve this it would be nice.

>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>
>> I am not sure if this would happen in normal cases too and spam the
>> error log, I only saw this in an error case.
>>
>>   libopkg/pkg_hash.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
>> index a07a25e..6c04ab2 100644
>> --- a/libopkg/pkg_hash.c
>> +++ b/libopkg/pkg_hash.c
>> @@ -263,8 +263,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
>>   	if (unresolved) {
>>   		res = 1;
>>   		tmp = unresolved;
>> -		while (*tmp)
>> +		while (*tmp) {
>> +			opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp, maybe->name);
>>   			free(*(tmp++));
>> +		}
>>   		free(unresolved);
>>   	}
>>   	pkg_vec_free(depends);
Philip Prindeville May 5, 2021, 6:11 p.m. UTC | #5
> On May 2, 2021, at 5:13 PM, Daniel Golle <daniel@makrotopia.org> wrote:
> 
> On Sun, May 02, 2021 at 10:59:12PM +0200, Hauke Mehrtens wrote:
>> When a package is not installed because it has unresolved dependencies
>> normally we get only an error message like this:
>> * pkg_hash_fetch_best_installation_candidate: Packages for ltq-vdsl-app found, but incompatible with the architectures configured
>> * opkg_install_cmd: Cannot install package ltq-vdsl-app.
>> 
>> Log in addition the following error message:
>> * pkg_hash_check_unresolved: can not find dependency ltq-dsl-base for ltq-vdsl-app
>> 
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>> 
>> I am not sure if this would happen in normal cases too and spam the 
>> error log, I only saw this in an error case.
>> 
>> libopkg/pkg_hash.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
>> index a07a25e..6c04ab2 100644
>> --- a/libopkg/pkg_hash.c
>> +++ b/libopkg/pkg_hash.c
>> @@ -263,8 +263,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
>> 	if (unresolved) {
>> 		res = 1;
>> 		tmp = unresolved;
>> -		while (*tmp)
>> +		while (*tmp) {
>> +			opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp, maybe->name);
>                                        ^^^^^^^^^
> Should be 'cannot', it's spelled as one word in English (natives:
> correct me if I'm wrong!)


Correct.


> 
>> 			free(*(tmp++));
>> +		}
>> 		free(unresolved);
>> 	}
>> 	pkg_vec_free(depends);
>> -- 
>> 2.30.2
>> 
>> 
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Sven Roederer May 18, 2021, 10:41 p.m. UTC | #6
Hi,

Am Montag, 3. Mai 2021, 19:46:22 CEST schrieb Hauke Mehrtens:
> On 5/3/21 2:38 PM, Baptiste Jonglez wrote:
> > Hi,
> > 
> > On 02-05-21, Hauke Mehrtens wrote:
> >> When a package is not installed because it has unresolved dependencies
> >> 
> >> normally we get only an error message like this:
> >>   * pkg_hash_fetch_best_installation_candidate: Packages for ltq-vdsl-app
> >>   found, but incompatible with the architectures configured *
> >>   opkg_install_cmd: Cannot install package ltq-vdsl-app.
> >> 
> >> Log in addition the following error message:
> >>   * pkg_hash_check_unresolved: can not find dependency ltq-dsl-base for
> >>   ltq-vdsl-app> 
> > Since the error has probably nothing to do with "architectures", wouldn't
> > it make more sense to remove or improve the first error message?  Or
> > understand why it fails for seemingly unrelated reasons.
> 
> This "incompatible with the architectures configured" error message is
> shown for more error cases than the newly added one, see here:
> https://lxr.openwrt.org/source/opkg-lede/libopkg/pkg_hash.c#L395
> 
> It would probably be good to improve the error messages, but I do not
> understand the full code. If someone has some suggestions on how to
> improve this it would be nice.
> 

Hauke mentioined this patch in relation to FS#3814. I build a patched version 
myself and gave it a test - It fixes the problem

Having no packagelist avail an trying to install luci-proto-ipip results in a 
message pointing towards the missing dependent package

~# opkg install /tmp/luci-proto-ipip_git-19.307.61018-284918b_all.ipk 
Unknown package 'luci-proto-ipip'.
Collected errors:
 * pkg_hash_check_unresolved: can not find dependency ipip for luci-proto-ipip
 * pkg_hash_fetch_best_installation_candidate: Packages for luci-proto-ipip 
found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package luci-proto-ipip.


The "Unknown package 'luci-proto-ipip'." line is still incorrect, but "can not 
find dependency ipip" is the key.
So maybe not the last change to the code, but a big improvement.

Sven

> >> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> >> ---
> >> 
> >> I am not sure if this would happen in normal cases too and spam the
> >> error log, I only saw this in an error case.
> >> 
> >>   libopkg/pkg_hash.c | 4 +++-
> >>   1 file changed, 3 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
> >> index a07a25e..6c04ab2 100644
> >> --- a/libopkg/pkg_hash.c
> >> +++ b/libopkg/pkg_hash.c
> >> @@ -263,8 +263,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
> >> 
> >>   	if (unresolved) {
> >>   	
> >>   		res = 1;
> >>   		tmp = unresolved;
> >> 
> >> -		while (*tmp)
> >> +		while (*tmp) {
> >> +			opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp,
> >> maybe->name);>> 
> >>   			free(*(tmp++));
> >> 
> >> +		}
> >> 
> >>   		free(unresolved);
> >>   	
> >>   	}
> >>   	pkg_vec_free(depends);
diff mbox series

Patch

diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index a07a25e..6c04ab2 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -263,8 +263,10 @@  pkg_hash_check_unresolved(pkg_t *maybe)
 	if (unresolved) {
 		res = 1;
 		tmp = unresolved;
-		while (*tmp)
+		while (*tmp) {
+			opkg_msg(ERROR, "can not find dependency %s for %s\n", *tmp, maybe->name);
 			free(*(tmp++));
+		}
 		free(unresolved);
 	}
 	pkg_vec_free(depends);