Skip to content

Commit fa9dae4

Browse files
committed
skip dedicated layers if package is too small
1 parent 110313e commit fa9dae4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/rechunk/alg.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,22 @@ def process_meta(
314314

315315
if added_files:
316316
# Only add if it has files to prevent wasting layers
317+
dedicated = contents.get("dedicated", True)
318+
319+
if dedicated and total_size < 5e6:
320+
# Some times, a KDE image will include a single gnome package
321+
# Which will make rechunk make a dedicated layer for it.
322+
# Force disable dedicated layers if the size is too small.
323+
logger.warning(f"Meta package '{name}' is too small ({total_size} < 2MB). Disabling dedicated layer.")
324+
dedicated = False
325+
317326
npkg = MetaPackage(
318327
index=len(new_packages),
319328
name=name,
320329
nevra=tuple(meta_packages.keys()),
321330
size=total_size,
322331
updates=tuple(meta_updates),
323-
dedicated=contents.get("dedicated", True),
332+
dedicated=dedicated,
324333
meta=True,
325334
)
326335
if npkg.name == "unpackaged":

0 commit comments

Comments
 (0)