Skip to content

Commit

Permalink
Fixed file path in patch files
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaven committed May 11, 2023
1 parent e68981b commit 8ce3073
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
19 changes: 18 additions & 1 deletion libs/GenPatchFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import json
import os
import requests
import subprocess


LIBS_DIR_PATH = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -30,6 +31,7 @@ def _GenPatchForSingleFile(destFile: str, srcFile: str, verTag: str):
destBaseFile, ext = os.path.splitext(destFile)
tmpFile = destBaseFile + '.' + verTag + ext
patchFile = destBaseFile + '.patch'
destDir = os.path.dirname(destFile)
# print(tmpFile, '^', destFile, '->', patchFile)

if os.path.exists(patchFile):
Expand All @@ -55,7 +57,22 @@ def _GenPatchForSingleFile(destFile: str, srcFile: str, verTag: str):
hashlib.sha256(resp.content).digest()
):
# generate patch file if content is different
os.system('diff -u {} {} > {}'.format(tmpFile, destFile, patchFile))
proc = subprocess.Popen(
[
'diff',
'-u',
os.path.basename(tmpFile),
os.path.basename(destFile)
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=destDir,
)
stdout, stderr = proc.communicate()
# if proc.returncode != 0:
# raise RuntimeError('Failed to generate patch file: {}'.format(stderr))
with open(patchFile, 'wb') as f:
f.write(stdout)

# remove tmp file
os.remove(tmpFile)
Expand Down
4 changes: 2 additions & 2 deletions libs/asn1-decode/Asn1Decode.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- /home/ubuntu/codelab/decent-ra-onchain/libs/asn1-decode/Asn1Decode.5c2d1469fc678513753786acb441e597969192ec.sol 2023-05-10 18:15:17.534744080 -0700
+++ /home/ubuntu/codelab/decent-ra-onchain/libs/asn1-decode/Asn1Decode.sol 2023-05-10 18:14:14.998486467 -0700
--- Asn1Decode.5c2d1469fc678513753786acb441e597969192ec.sol 2023-05-10 18:54:03.224133752 -0700
+++ Asn1Decode.sol 2023-05-10 18:14:14.998486467 -0700
@@ -1,6 +1,7 @@
-pragma solidity ^0.5.2;
+// SPDX-License-Identifier: MIT
Expand Down
4 changes: 2 additions & 2 deletions libs/ens-contracts/BytesUtils.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- /home/ubuntu/codelab/decent-ra-onchain/libs/ens-contracts/BytesUtils.883a0a2d64d07df54f3ebbb0e81cf2e9d012c14d.sol 2023-05-10 17:58:27.981281430 -0700
+++ /home/ubuntu/codelab/decent-ra-onchain/libs/ens-contracts/BytesUtils.sol 2023-05-08 02:38:06.477673524 -0700
--- BytesUtils.883a0a2d64d07df54f3ebbb0e81cf2e9d012c14d.sol 2023-05-10 18:54:02.896132917 -0700
+++ BytesUtils.sol 2023-05-08 02:38:06.477673524 -0700
@@ -1,4 +1,5 @@
-pragma solidity ^0.8.4;
+// SPDX-License-Identifier: MIT
Expand Down

0 comments on commit 8ce3073

Please sign in to comment.