Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] core/pkg-generic: only save latest package list
Date: Tue, 1 May 2018 14:04:16 +0200	[thread overview]
Message-ID: <20180501120416.GA29082@scaer> (raw)
In-Reply-To: <20180501111304.17597-1-john@metanate.com>

John, All,

On 2018-05-01 12:13 +0100, John Keeping spake thusly:
> When rebuilding a package, simply appending the package's file list to
> the global list means that the package list grows for every rebuild, as
> does the time taken to check for files installed by multiple packages.
> Furthermore, we get false positives where a file is reported as being
> installed by multiple copies of the same package.
> 
> With this approach we may end up with orphaned files in the target
> filesystem if a package that has been updated and rebuilt no longer
> installs the same set of files, but we know that only a clean build will
> produce reliable results.  In fact it may be helpful to identify these
> orphaned files as evidence that the build is not clean.
> 
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> Changes in v2:
> - Do the sed as a separate step rather than in the same shell invocation
>   as the find (we know that $(BUILD_DIR) is an absolute path); since we
>   no longer ignore the exit status of sed, we also have to ensure that
>   the file exists before executing sed
> 
>  package/pkg-generic.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index bd47ca1964..8ebbacc180 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -63,6 +63,8 @@ GLOBAL_INSTRUMENTATION_HOOKS += step_time
>  # $(2): base directory to search in
>  # $(3): suffix of file  (optional)
>  define step_pkg_size_inner
> +	@>$(BUILD_DIR)/packages-file-list$(3).txt

Have you tested that? In my little experience with dealing with the
shell, this actually truncates the file to a zero-size, and thus we
loose the existing package->file list, even for other packages.

So, just do as I suggested: use touch to ensure the file exists.

(Yeah, one could also use the append-redirection >> instead of touch,
but is that trick really an improvement over touch? touch is well known,
and virtually everyone will recognise a construct that uses touch before
sed-ing a file.)

Regards,
Yann E. MORIN.

> +	$(SED) '/^$(1),/d' $(BUILD_DIR)/packages-file-list$(3).txt
>  	cd $(2); \
>  	find . \( -type f -o -type l \) \
>  		-newer $($(PKG)_DIR)/.stamp_built \
> -- 
> 2.17.0
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2018-05-01 12:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 13:07 [Buildroot] [PATCH] core/pkg-generic: only save latest package list John Keeping
2018-04-30 16:47 ` Yann E. MORIN
2018-04-30 16:56   ` John Keeping
2018-04-30 19:41     ` Yann E. MORIN
2018-05-01 11:13       ` [Buildroot] [PATCH v2] " John Keeping
2018-05-01 12:04         ` Yann E. MORIN [this message]
2018-05-01 12:26           ` John Keeping
2018-05-01 12:28             ` [Buildroot] [PATCH v3] " John Keeping
2018-05-01 12:31               ` Yann E. MORIN
2018-05-01 13:26               ` Thomas Petazzoni
2018-05-01 21:01               ` Peter Korsgaard
2019-01-04 13:12               ` Yann E. MORIN
2019-01-04 15:30                 ` Nicolas Cavallari
2019-01-04 17:51                   ` Yann E. MORIN
2019-01-05 10:23                     ` Nicolas Cavallari
2019-01-05 16:39                       ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501120416.GA29082@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox