Bug 9189 - [meta-swupd] Creates a lot of duplicate files
Summary: [meta-swupd] Creates a lot of duplicate files
Status: RESOLVED FIXED
Alias: None
Product: Other YP Layers
Classification: Build System, Metadata & Runtime
Component: meta-swupd (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: 2.3 M1
Assignee: Patrick Ohly
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-03-01 09:35 UTC by Joshua Lock
Modified: 2016-12-08 17:44 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Lock 2016-03-01 09:35:08 UTC
Due to the way swupd works by processing chroot-like bundle directories on each os release we potentially end up carrying a lot of duplicate files in DEPLOY_DIR_SWUPD. 

We should look at using the hardlink program (or possibly fdupes) to replace duplicate files in that directory with hard links in order to save disk space.
Comment 1 Igor Stoppa 2016-05-11 11:14:28 UTC
Could this be a requirement for swupd?
Anyway it seems like an optional step.
If one makes lots of throwaway builds, it might be faster to jsut bear with the duplicated files.

I think it would be ok to have it enabled by default only if the overhead of identifying duplicates is minimum (could the hash from the manifests of previous releases help?)
Comment 2 Joshua Lock 2016-05-11 18:46:49 UTC
(In reply to comment #1)
> Could this be a requirement for swupd?

At least partially, yes. In fact swupd-server introduced a feature to use hardlinks when possible during swupd_make_pack

https://github.com/clearlinux/swupd-server/releases/tag/v3.1.2

I haven't had any chance to investigate it yet, nor try to determine whether it needs to be enabled or whether it requires extra utilities on the host (i.e. a hardlink-native).

> Anyway it seems like an optional step.
> If one makes lots of throwaway builds, it might be faster to jsut bear with
> the duplicated files.
> 
> I think it would be ok to have it enabled by default only if the overhead of
> identifying duplicates is minimum (could the hash from the manifests of
> previous releases help?)

This is useful feedback, thanks. ISTR the request for hardlink support came from a colleague on the Ostro team? If the demand isn't still there I shall push this out to a later milestone.
Comment 3 Patrick Ohly 2016-11-02 14:45:21 UTC
The right approach for avoiding duplicate files in the www directory is to create updates from the last build: swupd_create_update then automatically reuses existing, unmodified files. As an added bonus, that also reduces time spent in swupd_make_fullfiles because only new or modified files need to be handled.

I'm currently working on some code which does that. Note that this is different from computing deltas.
Comment 4 Patrick Ohly 2016-11-02 14:46:20 UTC
Let's pull this in. Concern about disk space in the update repo was also mentioned by other parties interested in using meta-swupd.
Comment 5 Patrick Ohly 2016-12-08 17:44:06 UTC
Current meta-swupd master (today's commit 07ad71b78) supports incremental builds, so no files get duplicated anymore.