Skip to contentSkip to conversation

core/pkg-generic: store package<->files for staging and host

PATCH Superseded Yann E. MORIN 3 participants 12 messages Apr 5, 2017 – Apr 10, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover core/pkg-generic: store package<->files for staging and host

Hello All!

This small series does for staging and host as we do for target:
store the list of installed files and relate them to the package that installed each.

---
Changes v1 -> v2:
- split in three patches
- in addition to staging, also store for host

Regards,
Yann E. MORIN.

The following changes since commit 4f50f4928ca3855d9d1b1b9699d2cb37e4ca65da

Add out-of-source U-Boot device tree support (2017-04-05 22:29:23 +0200)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 44910f2975b83c91148d08f3df11ea048eea0609

core/pkg-generic: store file->package list for staging and host too (2017-04-05 23:15:27 +0200)

----------------------------------------------------------------
Yann E. MORIN (3):
core/pkg-generic: rmove intermediate file-list files core/pk-generic: redirect only wsa when listing package's isntalled files core/pkg-generic: store file->package list for staging and host too

 package/pkg-generic.mk | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/3 core/pkg-generic: rmove intermediate file-list files

To compute the list of files added by a package, we first store the list of files before the install, do the install, list the files after the install, and finally compare the two lists. The two lists are stored in dot-files, hidden in the package's build dir.

We currently keep those two files, and only list the files installed in target/

In followup patches, we'll also list files installed in staging/ as well as files installed in host/.

Rather than add even more internal, hidden files in the package build dir, we'll just re-use the same two temporary files to store the bfore and after lists.

So, remove them after the comparison is done.

Cc Thomas Petazzoni <[email protected]>
---
 package/pkg-generic.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-generic.mk +1 -0
index 31dbc54..6b3c69c 100644
@@ -78,6 +78,7 @@ define step_pkg_size_end
 		while read hash file ; do \
 			echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
 		done
+	rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after
 endef
 
 define step_pkg_size
Signature · 1 line
2.9.3
#2 lore raw

PATCH v2 1/3 core/pkg-generic: rmove intermediate file-list files

Hello,

Quoted 4 lines · Yann E. MORIN

To compute the list of files added by a package, we first store the list of files before the install, do the install, list the files after the install, and finally compare the two lists. The two lists are stored in dot-files, hidden in the package's build dir.

Typo in commit title: rmove -> remove

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH v2 1/3 core/pkg-generic: rmove intermediate file-list files

In reply to Yann E. MORIN

s/rmove/remove/

Quoted 5 lines · Yann E. MORIN

To compute the list of files added by a package, we first store the list of files before the install, do the install, list the files after the install, and finally compare the two lists. The two lists are stored in dot-files, hidden in the package's build dir.

Quoted 8 lines

We currently keep those two files, and only list the files installed in target/

In followup patches, we'll also list files installed in staging/ as well as files installed in host/.

Rather than add even more internal, hidden files in the package build dir, we'll just re-use the same two temporary files to store the bfore

                                                                    ^e
Quoted 1 line

and after lists.

Actually, I like to have as much as possible build info lingering around, so
I'd tend not to do this removal and instead rename to something with 'target' in it. For example, I think we have no other way at the moment to detect when two packages write the same file. IMO having internal hidden files in the package build dir doesn't hurt anyone. I certainly do like the applied patches list!

That said, I don't see any other reason to keep those files, and we probably
want explicit support for detecting collisions, so I'm OK with removing them after all.

Regards,
Arnout

Quoted 22 lines

So, remove them after the comparison is done.

Cc Thomas Petazzoni <[email protected]>
---
 package/pkg-generic.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-generic.mk +1 -0
index 31dbc54..6b3c69c 100644
@@ -78,6 +78,7 @@ define step_pkg_size_end
 		while read hash file ; do \
 			echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
 		done
+	rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after
 endef
 
 define step_pkg_size
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH v2 1/3 core/pkg-generic: rmove intermediate file-list files

Quoted 16 lines · Arnout Vandecappelle

s/rmove/remove/

Quoted 5 lines · Yann E. MORIN

To compute the list of files added by a package, we first store the list of files before the install, do the install, list the files after the install, and finally compare the two lists. The two lists are stored in dot-files, hidden in the package's build dir.

Quoted 8 lines

We currently keep those two files, and only list the files installed in target/

In followup patches, we'll also list files installed in staging/ as well as files installed in host/.

Rather than add even more internal, hidden files in the package build dir, we'll just re-use the same two temporary files to store the bfore

Quoted 7 lines
                                                                    ^e
Quoted 1 line

and after lists.

Actually, I like to have as much as possible build info lingering around, so
I'd tend not to do this removal and instead rename to something with 'target' in it. For example, I think we have no other way at the moment to detect when two packages write the same file.

D'oh, the file will of course simply appear twice in packages-file-list if two
packages write it... Silly me.

Regards,
Arnout

Quoted 6 lines

IMO having internal hidden files in the package
build dir doesn't hurt anyone. I certainly do like the applied patches list!

That said, I don't see any other reason to keep those files, and we probably
want explicit support for detecting collisions, so I'm OK with removing them after all.

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH v2 2/3 core/pk-generic: redirect only wsa when listing package's isntalled files

In reply to Yann E. MORIN

There is no need to redirect again and again for each new file added to the list; we can just redirect once and for all.

Cc Thomas Petazzoni <[email protected]>
---
 package/pkg-generic.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +2 -2
index 6b3c69c..166efd6 100644
@@ -76,8 +76,8 @@ define step_pkg_size_end
 		$($(PKG)_DIR)/.br_filelist_after
 	comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \
 		while read hash file ; do \
-			echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
-		done
+			echo "$(1),$${file}" ; \
+		done >> $(BUILD_DIR)/packages-file-list.txt
 	rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after
 endef
 
Signature · 1 line
2.9.3
#6 lore raw

PATCH v2 2/3 core/pk-generic: redirect only wsa when listing package's isntalled files

Hello,

Quoted 2 lines · Yann E. MORIN

There is no need to redirect again and again for each new file added to the list; we can just redirect once and for all.

Typoes in the commit title:

pk-generic -> pkg-generic

then I'm not even sure was you meant with "redirect only wsa when"

And isntalled -> installed.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

PATCH v2 2/3 core/pk-generic: redirect only wsa when listing package's isntalled files

Thomas, All,

On 2017-04-06 08:02 +0200, Thomas Petazzoni spake thusly:

Quoted 9 lines · Yann E. MORIN
Quoted 2 lines

There is no need to redirect again and again for each new file added to the list; we can just redirect once and for all.

Typoes in the commit title:

pk-generic -> pkg-generic

then I'm not even sure was you meant with "redirect only wsa when"

Neither do I. Finger-fart...

Will fix and resend. Thanks! :-)

Regards,
Yann E. MORIN.

Quoted 9 lines

And isntalled -> installed.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH v2 2/3 core/pk-generic: redirect only wsa when listing package's isntalled files

In reply to Yann E. MORIN
Quoted 5 lines · Yann E. MORIN

There is no need to redirect again and again for each new file added to the list; we can just redirect once and for all.

Cc Thomas Petazzoni <[email protected]>

Regards,
Arnout

Quoted 20 lines
---
 package/pkg-generic.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +2 -2
index 6b3c69c..166efd6 100644
@@ -76,8 +76,8 @@ define step_pkg_size_end
 		$($(PKG)_DIR)/.br_filelist_after
 	comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \
 		while read hash file ; do \
-			echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
-		done
+			echo "$(1),$${file}" ; \
+		done >> $(BUILD_DIR)/packages-file-list.txt
 	rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after
 endef
 
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#9 lore raw

PATCH v2 3/3 core/pkg-generic: store file->package list for staging and host too

In reply to Yann E. MORIN

Currently, we store the list of files installed in target/ and associate each of them to the package that installed it.

However, we sometime may need to know what package installed which file in staging/, for example to debug header collision, or in host/, to debug what package installed what host tool.

Enhance the step instrumentation to also generate the list for staging/ and host/.

Cc Thomas Petazzoni <[email protected]>
---
 package/pkg-generic.mk | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
package/pkg-generic.mk +11 -5
index 166efd6..725a543 100644
@@ -62,7 +62,7 @@ GLOBAL_INSTRUMENTATION_HOOKS += step_time
 # 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 -print0 | xargs -0 md5sum) | sort > \
+	(cd $(2) ; find . -type f -print0 | xargs -0 md5sum) | sort > \
 		$($(PKG)_DIR)/.br_filelist_before
 endef
 
@@ -72,19 +72,25 @@ endef
 # a diff with the .br_filelist_before to compute the list of files
 # installed by this package.
 define step_pkg_size_end
-	(cd $(TARGET_DIR); find . -type f -print0 | xargs -0 md5sum) | sort > \
+	(cd $(2); find . -type f -print0 | xargs -0 md5sum) | sort > \
 		$($(PKG)_DIR)/.br_filelist_after
 	comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \
 		while read hash file ; do \
 			echo "$(1),$${file}" ; \
-		done >> $(BUILD_DIR)/packages-file-list.txt
+		done >> $(BUILD_DIR)/packages-file-list$(3).txt
 	rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after
 endef
 
 define step_pkg_size
 	$(if $(filter install-target,$(2)),\
-		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3))) \
-		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3))))
+		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(TARGET_DIR))) \
+		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(TARGET_DIR))))
+	$(if $(filter install-staging,$(2)),\
+		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(STAGING_DIR),-staging)) \
+		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(STAGING_DIR),-staging)))
+	$(if $(filter install-host,$(2)),\
+		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(HOST_DIR),-host)) \
+		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(HOST_DIR),-host)))
 endef
 GLOBAL_INSTRUMENTATION_HOOKS += step_pkg_size
 
Signature · 1 line
2.9.3
#10 lore raw

PATCH v2 3/3 core/pkg-generic: store file->package list for staging and host too

+1 to this feature.

Quoted 4 lines · Yann E. MORIN

Currently, we store the list of files installed in target/ and associate each of them to the package that installed it.

However, we sometime may need to know what package installed which file

                      ^s
Quoted 42 lines

in staging/, for example to debug header collision, or in host/, to debug what package installed what host tool.

Enhance the step instrumentation to also generate the list for staging/ and host/.

Cc Thomas Petazzoni <[email protected]>
---
 package/pkg-generic.mk | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
package/pkg-generic.mk +3 -3
index 166efd6..725a543 100644
@@ -62,7 +62,7 @@ GLOBAL_INSTRUMENTATION_HOOKS += step_time
 # 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 -print0 | xargs -0 md5sum) | sort > \
+	(cd $(2) ; find . -type f -print0 | xargs -0 md5sum) | sort > \
 		$($(PKG)_DIR)/.br_filelist_before
 endef
 
@@ -72,19 +72,25 @@ endef
 # a diff with the .br_filelist_before to compute the list of files
 # installed by this package.
 define step_pkg_size_end
-	(cd $(TARGET_DIR); find . -type f -print0 | xargs -0 md5sum) | sort > \
+	(cd $(2); find . -type f -print0 | xargs -0 md5sum) | sort > \
 		$($(PKG)_DIR)/.br_filelist_after
 	comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \
 		while read hash file ; do \
 			echo "$(1),$${file}" ; \
-		done >> $(BUILD_DIR)/packages-file-list.txt
+		done >> $(BUILD_DIR)/packages-file-list$(3).txt
 	rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after
 endef
 
 define step_pkg_size
 	$(if $(filter install-target,$(2)),\

package/pkg-generic.mk endef · line 93

Quoted 10 lines
package/pkg-generic.mk +8 -2
-		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3))) \
-		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3))))
+		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(TARGET_DIR))) \
+		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(TARGET_DIR))))
+	$(if $(filter install-staging,$(2)),\
+		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(STAGING_DIR),-staging)) \
+		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(STAGING_DIR),-staging)))
+	$(if $(filter install-host,$(2)),\
+		$(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(HOST_DIR),-host)) \
+		$(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(HOST_DIR),-host)))

How about the following alternative:

---

package/pkg-generic.mk +6 -4
index 166efd630f..c27a76194c 100644
@@ -62,8 +62,9 @@ GLOBAL_INSTRUMENTATION_HOOKS += step_time
 # 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 -print0 | xargs -0 md5sum) | sort > \
-               $($(PKG)_DIR)/.br_filelist_before
+       (cd $($(call UPPERCASE,$(2))_DIR); \
+               find . -type f -print0 | xargs -0 md5sum) | sort > \
+                       $($(PKG)_DIR)/.br_filelist_before
 endef
 
 # This hook will be called after the target installation of a
@@ -72,19 +73,19 @@ endef
 # a diff with the .br_filelist_before to compute the list of files
 # installed by this package.
 define step_pkg_size_end
-       (cd $(TARGET_DIR); find . -type f -print0 | xargs -0 md5sum) | sort > \
-               $($(PKG)_DIR)/.br_filelist_after
+       (cd $($(call UPPERCASE,$(2))_DIR); \
+               find . -type f -print0 | xargs -0 md5sum) | sort > \
+                       $($(PKG)_DIR)/.br_filelist_after
        comm -13 $($(PKG)_DIR)/.br_filelist_before
$($(PKG)_DIR)/.br_filelist_after | \
                while read hash file ; do \
                        echo "$(1),$${file}" ; \
-               done >> $(BUILD_DIR)/packages-file-list.txt
+               done >> $(BUILD_DIR)/packages-file-list-$(2).txt
        rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after

endef

define step_pkg_size
- $(if $(filter install-target,$(2)),\
- $(if $(filter start,$(1)),$(call step_pkg_size_start,$(3))) \
- $(if $(filter end,$(1)),$(call step_pkg_size_end,$(3))))
+ $(if $(filter install-%,$(2)),\
+ $(call step_pkg_size_$(1),$(3),$(subst install-,,$(2))))
endef
GLOBAL_INSTRUMENTATION_HOOKS += step_pkg_size
---

Combine that with the refactoring by ThomasDS and you get something nice and
compact that is still very readable IMO. Oh, and if before/after is renamed to start/end it becomes even better.

Perhaps the refactoring of passing target as an argument should be a separate
patch, but I don't think so (it's kind of useless on its own and hard to understand without the host and staging options).

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#11 lore raw

v2 cover core/pkg-generic: store package<->files for staging and host

In reply to Yann E. MORIN
Quoted 5 lines · Yann E. MORIN

Hello All!

This small series does for staging and host as we do for target:
store the list of installed files and relate them to the package that installed each.

This series collides with ThomasDS'es extension with symlinks and directories
(http://patchwork.ozlabs.org/patch/724235/ and
http://patchwork.ozlabs.org/patch/724236/). Could you perhaps merge the series?

Regards,
Arnout

Quoted 34 lines

---
Changes v1 -> v2:
- split in three patches
- in addition to staging, also store for host

Regards,
Yann E. MORIN.

The following changes since commit 4f50f4928ca3855d9d1b1b9699d2cb37e4ca65da

Add out-of-source U-Boot device tree support (2017-04-05 22:29:23 +0200)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 44910f2975b83c91148d08f3df11ea048eea0609

core/pkg-generic: store file->package list for staging and host too (2017-04-05 23:15:27 +0200)

----------------------------------------------------------------
Yann E. MORIN (3):
core/pkg-generic: rmove intermediate file-list files core/pk-generic: redirect only wsa when listing package's isntalled files core/pkg-generic: store file->package list for staging and host too

 package/pkg-generic.mk | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF