summaryrefslogtreecommitdiffstats
path: root/import_bouncycastle.sh
diff options
context:
space:
mode:
Diffstat (limited to 'import_bouncycastle.sh')
-rwxr-xr-ximport_bouncycastle.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/import_bouncycastle.sh b/import_bouncycastle.sh
index 6d76099..ed278d8 100755
--- a/import_bouncycastle.sh
+++ b/import_bouncycastle.sh
@@ -155,6 +155,26 @@ function regenerate() {
generatepatch $patch $bouncycastle_dir $bouncycastle_dir_orig
}
+function update_timestamps() {
+ declare -r git_dir="$1"
+ declare -r target_dir="$2"
+
+ echo -n "Restoring timestamps for ${target_dir}... "
+
+ find "$git_dir" -type f -print0 | while IFS= read -r -d $'\0' file; do
+ file_rev="$(git rev-list -n 1 HEAD "$file")"
+ if [ "$file_rev" == "" ]; then
+ echo
+ echo -n "WARNING: No file revision for file $file..."
+ continue
+ fi
+ file_time="$(git show --pretty=format:%ai --abbrev-commit "$file_rev" | head -n 1)"
+ touch -d "$file_time" "${target_dir}${file#$git_dir}"
+ done
+
+ echo "done."
+}
+
function generate() {
declare -r patch=$1
declare -r bouncycastle_source=$2
@@ -172,6 +192,7 @@ function generate() {
echo "Restoring $i"
rm -r $bouncycastle_dir/$i
cp -rf $bouncycastle_out_dir/src/main/java/$i $bouncycastle_dir/$i
+ update_timestamps $bouncycastle_out_dir/src/main/java/$i $bouncycastle_dir/$i
done
generatepatch $patch $bouncycastle_dir $bouncycastle_dir_orig
@@ -219,7 +240,7 @@ function applypatches () {
# Apply appropriate patches
for i in $bouncycastle_patches; do
echo "Applying patch $i"
- patch -p1 < ../$i || die "Could not apply patches/$i. Fix source and run: $0 regenerate patches/$i"
+ patch -p1 --merge < ../$i || die "Could not apply patches/$i. Fix source and run: $0 regenerate $i"
# make sure no unneeded sources got into the patch
problem=0