[Buildroot] [PATCHv2 2/4] pkg-generic: add step_pkg_size global instrumentation hook

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Tue Dec 2 12:23:49 UTC 2014


Dear Jérôme Pouiller,

On Tue, 02 Dec 2014 12:00:51 +0100, Jérôme Pouiller wrote:

> > +# This hook will be called before the target installation of a
> > +# package. We store in a file named $(1).filelist_before the list of
> > +# files currently installed in the target. Note that the MD5 is also
> > +# stored, in order to identify if the files are overwritten.
> > +define step_pkg_size_start
> > +	(cd $(TARGET_DIR) ; find . -type f | xargs md5sum) | sort > \
> > +		$(BUILD_DIR)/$(1).filelist_before
> > +endef
> I think this does not work if filename contains spaces.

Hum, yes, very possible. But is Buildroot really working fine as a
whole if some file in the target filesystem has some spaces?

> > +# This hook will be called after the target installation of a
> > +# package. We store in a file named $(1).filelist_after the list
> > +# of files (and their MD5) currently installed in the target. We then
> > +# do a diff with the $(1).filelist_before to compute the list of
> > +# files installed by this package.
> > +define step_pkg_size_end
> > +	(cd $(TARGET_DIR); find . -type f | xargs md5sum) | sort > \
> > +		$(BUILD_DIR)/$(1).filelist_after
> > +	comm -13 $(BUILD_DIR)/$(1).filelist_before $(BUILD_DIR)/$(1).filelist_after | \
> > +		while read hash file ; do \
> > +			echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
> > +		done
> Does it would make sense if we also record removed lines? We may wrote 
> another script that detect if a file was in conflict between two packages.

I'm not sure to follow you here. We already take care of packages
installing the same file, that's the whole point of storing the MD5 of
each file. By using comm -13, we keep only the lines that are unique in
the second file (compared to the first file). So we keep lines for
either new files added by this package, or files already installed but
overwritten by the package (detected using the MD5).

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


More information about the buildroot mailing list