diff options
Diffstat (limited to 'scripts/native-intercept')
-rwxr-xr-x | scripts/native-intercept/ar | 32 | ||||
-rwxr-xr-x | scripts/native-intercept/chgrp | 5 | ||||
-rwxr-xr-x | scripts/native-intercept/chown | 3 |
3 files changed, 40 insertions, 0 deletions
diff --git a/scripts/native-intercept/ar b/scripts/native-intercept/ar new file mode 100755 index 0000000000..dcc623e3ed --- /dev/null +++ b/scripts/native-intercept/ar @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# +# Wrapper around 'ar' that defaults to deterministic archives + +import os +import shutil +import sys + +# calculate path to the real 'ar' +path = os.environ['PATH'] +path = path.replace(os.path.dirname(sys.argv[0]), '') +real_ar = shutil.which('ar', path=path) + +if len(sys.argv) == 1: + os.execl(real_ar, 'ar') + +# modify args to mimic 'ar' configured with --default-deterministic-archives +argv = sys.argv +if argv[1].startswith('--'): + # No modifier given + None +else: + # remove the optional '-' + if argv[1][0] == '-': + argv[1] = argv[1][1:] + if 'U' in argv[1]: + sys.stderr.write("ar: non-deterministic mode requested\n") + else: + argv[1] = argv[1].replace('u', '') + argv[1] = 'D' + argv[1] + +os.execv(real_ar, argv) diff --git a/scripts/native-intercept/chgrp b/scripts/native-intercept/chgrp new file mode 100755 index 0000000000..399c979f9a --- /dev/null +++ b/scripts/native-intercept/chgrp @@ -0,0 +1,5 @@ +#! /bin/sh +# +# SPDX-License-Identifier: GPL-2.0-only +# +echo "Intercept $0: $@ -- do nothing" diff --git a/scripts/native-intercept/chown b/scripts/native-intercept/chown index 4f43271c2b..399c979f9a 100755 --- a/scripts/native-intercept/chown +++ b/scripts/native-intercept/chown @@ -1,2 +1,5 @@ #! /bin/sh +# +# SPDX-License-Identifier: GPL-2.0-only +# echo "Intercept $0: $@ -- do nothing" |