Message ID | 20200103151849.10956-8-heiko.thiery@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | pkg-stats json output improvements | expand |
On Fri, 3 Jan 2020 16:18:44 +0100
Heiko Thiery <heiko.thiery@gmail.com> wrote:
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Storing those dependencies do not make sense, because dependencies are
completely different depending on the Buildroot configuration. Packages
have optional dependencies, some dependencies on host packages only
exist depending on the system configuration, etc. So exposing those
dependencies is never going to give anything that is correct.
Best regards,
Thomas
Am Fr., 3. Jan. 2020 um 16:29 Uhr schrieb Thomas Petazzoni <thomas.petazzoni@bootlin.com>: > > On Fri, 3 Jan 2020 16:18:44 +0100 > Heiko Thiery <heiko.thiery@gmail.com> wrote: > > > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> > > Storing those dependencies do not make sense, because dependencies are > completely different depending on the Buildroot configuration. Packages > have optional dependencies, some dependencies on host packages only > exist depending on the system configuration, etc. So exposing those > dependencies is never going to give anything that is correct. Thought it is a good idea because I saw that on the https://layers.openembedded.org/layerindex/recipe/45257/. They also show the dependencies with a note that this can differ dependent on the real used configuration. But if you think it is too confusing I can drop that. > Best regards, > > Thomas > -- > Thomas Petazzoni, CTO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com
On Fri, 3 Jan 2020 17:39:13 +0100 Heiko Thiery <heiko.thiery@gmail.com> wrote: > Thought it is a good idea because I saw that on the > https://layers.openembedded.org/layerindex/recipe/45257/. They also > show the dependencies with a note that this can differ dependent on > the real used configuration. But if you think it is too confusing I > can drop that. Don't get me wrong, it would be nice to have the dependencies of packages, but it is simply not possible. Consider a package like this: FOO_DEPENDENCIES = bar baz ifeq ($(BR2_PACKAGE_LIBPNG),y) FOO_DEPENDENCIES += libpng endif If you run "make VARS=FOO_DEPENDENCIES printvars" with no Buildroot configuration defined, or with a Buildroot configuration defined that has the libpng package disabled, it will return: FOO_DEPENDENCIES=bar baz If however, you run the same command with a Buildroot configuration defined that has the libpng package enabled, it will return: FOO_DEPENDENCIES=bar baz libpng So as you can see, there is nothing like "the list of all dependencies of a package" that you can get with printvars. Lots of dependencies are optional. Some are even conflicting, like a package can depend on A *or* B, but not both. Etc. This is why I think it is not a good idea to show those dependencies, because they simply cannot be correct "in general": they can only be correct within the context of a particular Buildroot configuration. Best regards, Thomas
Hi Am Sa., 4. Jan. 2020 um 10:39 Uhr schrieb Thomas Petazzoni <thomas.petazzoni@bootlin.com>: > > On Fri, 3 Jan 2020 17:39:13 +0100 > Heiko Thiery <heiko.thiery@gmail.com> wrote: > > > Thought it is a good idea because I saw that on the > > https://layers.openembedded.org/layerindex/recipe/45257/. They also > > show the dependencies with a note that this can differ dependent on > > the real used configuration. But if you think it is too confusing I > > can drop that. > > Don't get me wrong, it would be nice to have the dependencies of > packages, but it is simply not possible. > > Consider a package like this: > > FOO_DEPENDENCIES = bar baz > > ifeq ($(BR2_PACKAGE_LIBPNG),y) > FOO_DEPENDENCIES += libpng > endif > > If you run "make VARS=FOO_DEPENDENCIES printvars" with no Buildroot > configuration defined, or with a Buildroot configuration defined that > has the libpng package disabled, it will return: > > FOO_DEPENDENCIES=bar baz > > If however, you run the same command with a Buildroot configuration > defined that has the libpng package enabled, it will return: > > FOO_DEPENDENCIES=bar baz libpng > > So as you can see, there is nothing like "the list of all dependencies > of a package" that you can get with printvars. Lots of dependencies are > optional. Some are even conflicting, like a package can depend on A > *or* B, but not both. Etc. > > This is why I think it is not a good idea to show those dependencies, > because they simply cannot be correct "in general": they can only be > correct within the context of a particular Buildroot configuration. It is no problem for ... Just thought it is a good idea. but I will drop that > Best regards, > > Thomas > -- > Thomas Petazzoni, CTO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com
diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index a5e87a7167..324700adbf 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -92,6 +92,7 @@ class Package: all_licenses = dict() all_license_files = list() all_versions = dict() + all_dependencies = dict() def __init__(self, name, path): self.name = name @@ -106,6 +107,7 @@ class Package: self.patches = {'count':0, 'files': None} self.warnings = 0 self.current_version = None + self.dependencies = None self.url = None self.url_status = None self.url_worker = None @@ -182,6 +184,14 @@ class Package: if var in self.all_versions: self.current_version = self.all_versions[var] + def set_dependencies(self): + """ + Fills in the .dependencies field + """ + var = self.pkgvar() + if var in self.all_dependencies: + self.dependencies = self.all_dependencies[var] + def set_check_package_warnings(self): """ Fills in the .warnings field @@ -284,7 +294,7 @@ def get_pkglist(npackages, package_list): def package_init_make_info(): # Fetch all variables at once variables = subprocess.check_output(["make", "BR2_HAVE_DOT_CONFIG=y", "-s", "printvars", - "VARS=%_LICENSE %_LICENSE_FILES %_VERSION"]) + "VARS=%_LICENSE %_LICENSE_FILES %_VERSION %_DEPENDENCIES"]) variable_list = variables.splitlines() # We process first the host package VERSION, and then the target @@ -318,6 +328,11 @@ def package_init_make_info(): pkgvar = pkgvar[:-8] Package.all_versions[pkgvar] = value + elif pkgvar.endswith("_FINAL_DEPENDENCIES"): + value = [v for v in value.split(' ') if not v.startswith('host-')] + pkgvar = pkgvar[:-19] + Package.all_dependencies[pkgvar] = value + def check_url_status_worker(url, url_status): if url_status != "Missing" and url_status != "No Config.in": @@ -801,6 +816,7 @@ def __main__(): pkg.set_patch_count() pkg.set_check_package_warnings() pkg.set_current_version() + pkg.set_dependencies() pkg.set_url() pkg.set_developers(developers) print("Checking URL status")
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> --- support/scripts/pkg-stats | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)