def METHOD_NAME(pkg, fname, dfile, edir, sfx):
    if sfx == "gz":
        cmd = "gunzip"
    elif sfx == "bz2":
        cmd = "bunzip2"
    elif sfx == "xz":
        cmd = "unxz"
    elif sfx == "zst":
        cmd = "unzstd"
    else:
        pkg.error(f"unknown suffix '{sfx}'")
    ofn = pathlib.Path(fname).stem
    opath = pkg.builddir / edir.name / ofn
    with open(opath, "wb") as outf:
        return (
            chroot.enter(
                cmd,
                "-c",
                "-f",
                dfile,
                ro_root=True,
                unshare_all=True,
                stdout=outf,
                wrkdir=edir,
            ).returncode
            == 0
        )