From c1c6297db71cbb6604c262ea0f6f02731274ef74 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sun, 29 May 2022 09:28:34 +0200 Subject: [PATCH] move copying files into shared directory from coverage.sh to coverage.py --- coverage.py | 28 ++++++++++++++++++++ coverage.sh | 75 ----------------------------------------------------- 2 files changed, 28 insertions(+), 75 deletions(-) diff --git a/coverage.py b/coverage.py index fbdb772..80ad269 100755 --- a/coverage.py +++ b/coverage.py @@ -76,6 +76,34 @@ def main(): ) args = parser.parse_args() + # copy over files from git or as distributed + for (git, dist, target) in [ + ("./mmdebstrap", "/usr/bin/mmdebstrap", "mmdebstrap"), + ("./taridshift", "/usr/bin/mmtaridshift", "taridshift"), + ("./tarfilter", "/usr/bin/mmtarfilter", "tarfilter"), + ( + "./proxysolver", + "/usr/lib/apt/solvers/mmdebstrap-dump-solution", + "proxysolver", + ), + ( + "./ldconfig.fakechroot", + "/usr/libexec/mmdebstrap/ldconfig.fakechroot", + "ldconfig.fakechroot", + ), + ]: + if os.path.exists(git): + shutil.copy(git, f"shared/{target}") + else: + shutil.copy(dist, f"shared/{target}") + # copy over hooks from git or as distributed + if os.path.exists("hooks"): + shutil.copytree("hooks", "shared/hooks", dirs_exist_ok=True) + else: + shutil.copytree( + "/usr/share/mmdebstrap/hooks", "shared/hooks", dirs_exist_ok=True + ) + onlyrun = None if len(sys.argv) > 1: onlyrun = sys.argv[1] diff --git a/coverage.sh b/coverage.sh index 9fe5d6d..0649000 100755 --- a/coverage.sh +++ b/coverage.sh @@ -63,81 +63,6 @@ if [ "$notfound" -ne 0 ]; then exit 1 fi -# only copy if necessary -if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then - if [ -e ./mmdebstrap ]; then - cp -a mmdebstrap shared - else - cp -a /usr/bin/mmdebstrap shared - fi -fi -if [ ! -e shared/taridshift ] || [ taridshift -nt shared/taridshift ]; then - if [ -e ./taridshift ]; then - cp -a ./taridshift shared - else - cp -a /usr/bin/mmtaridshift shared/taridshift - fi -fi -if [ ! -e shared/tarfilter ] || [ tarfilter -nt shared/tarfilter ]; then - if [ -e ./tarfilter ]; then - cp -a tarfilter shared - else - cp -a /usr/bin/mmtarfilter shared/tarfilter - fi -fi -if [ ! -e shared/proxysolver ] || [ proxysolver -nt shared/proxysolver ]; then - if [ -e ./proxysolver ]; then - cp -a proxysolver shared - else - cp -a /usr/lib/apt/solvers/mmdebstrap-dump-solution shared/proxysolver - fi -fi -if [ ! -e shared/ldconfig.fakechroot ] || [ ldconfig.fakechroot -nt shared/ldconfig.fakechroot ]; then - if [ -e ./ldconfig.fakechroot ]; then - cp -a ldconfig.fakechroot shared - else - cp -a /usr/libexec/mmdebstrap/ldconfig.fakechroot shared/ldconfig.fakechroot - fi -fi -mkdir -p shared/hooks/merged-usr -if [ ! -e shared/hooks/merged-usr/setup00.sh ] || [ hooks/merged-usr/setup00.sh -nt shared/hooks/merged-usr/setup00.sh ]; then - if [ -e hooks/merged-usr/setup00.sh ]; then - cp -a hooks/merged-usr/setup00.sh shared/hooks/merged-usr/ - else - cp -a /usr/share/mmdebstrap/hooks/merged-usr/setup00.sh shared/hooks/merged-usr/ - fi -fi -mkdir -p shared/hooks/eatmydata -if [ ! -e shared/hooks/eatmydata/extract.sh ] || [ hooks/eatmydata/extract.sh -nt shared/hooks/eatmydata/extract.sh ]; then - if [ -e hooks/eatmydata/extract.sh ]; then - cp -a hooks/eatmydata/extract.sh shared/hooks/eatmydata/ - else - cp -a /usr/share/mmdebstrap/hooks/eatmydata/extract.sh shared/hooks/eatmydata/ - fi -fi -if [ ! -e shared/hooks/eatmydata/customize.sh ] || [ hooks/eatmydata/customize.sh -nt shared/hooks/eatmydata/customize.sh ]; then - if [ -e hooks/eatmydata/customize.sh ]; then - cp -a hooks/eatmydata/customize.sh shared/hooks/eatmydata/ - else - cp -a /usr/share/mmdebstrap/hooks/eatmydata/customize.sh shared/hooks/eatmydata/ - fi -fi -mkdir -p shared/hooks/file-mirror-automount -if [ ! -e shared/hooks/file-mirror-automount/setup00.sh ] || [ hooks/file-mirror-automount/setup00.sh -nt shared/hooks/file-mirror-automount/setup00.sh ]; then - if [ -e hooks/file-mirror-automount/setup00.sh ]; then - cp -a hooks/file-mirror-automount/setup00.sh shared/hooks/file-mirror-automount/ - else - cp -a /usr/share/mmdebstrap/hooks/file-mirror-automount/setup00.sh shared/hooks/file-mirror-automount/ - fi -fi -if [ ! -e shared/hooks/file-mirror-automount/customize00.sh ] || [ hooks/file-mirror-automount/customize00.sh -nt shared/hooks/file-mirror-automount/customize00.sh ]; then - if [ -e hooks/file-mirror-automount/customize00.sh ]; then - cp -a hooks/file-mirror-automount/customize00.sh shared/hooks/file-mirror-automount/ - else - cp -a /usr/share/mmdebstrap/hooks/file-mirror-automount/customize00.sh shared/hooks/file-mirror-automount/ - fi -fi - # choose the timestamp of the unstable Release file, so that we get # reproducible results for the same mirror timestamp SOURCE_DATE_EPOCH=$(date --date="$(grep-dctrl -s Date -n '' "$mirrordir/dists/$DEFAULT_DIST/Release")" +%s)