mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 22:59:37 +08:00
freebsd-to-rtems.py - Revert mode now confirmed to work for source
This commit is contained in:
parent
84c044d3c8
commit
4d771c5ea6
@ -255,8 +255,11 @@ def installSourceFile(org):
|
|||||||
|
|
||||||
# Revert a header file from the RTEMS BSD tree to the FreeBSD tree
|
# Revert a header file from the RTEMS BSD tree to the FreeBSD tree
|
||||||
def revertHeaderFile(org, target):
|
def revertHeaderFile(org, target):
|
||||||
|
global tempFile
|
||||||
src = RTEMS_DIR + '/' + PREFIX + '/' + org.replace('rtems/', '')
|
src = RTEMS_DIR + '/' + PREFIX + '/' + org.replace('rtems/', '')
|
||||||
src = mapContribPath(src)
|
src = mapContribPath(src)
|
||||||
|
if target != "generic":
|
||||||
|
src = mapCPUDependentPath(src)
|
||||||
dst = FreeBSD_DIR + '/' + org
|
dst = FreeBSD_DIR + '/' + org
|
||||||
if isVerbose == True:
|
if isVerbose == True:
|
||||||
print "Revert Header - " + src + " => " + dst
|
print "Revert Header - " + src + " => " + dst
|
||||||
@ -266,21 +269,23 @@ def revertHeaderFile(org, target):
|
|||||||
os.makedirs(os.path.dirname(dst))
|
os.makedirs(os.path.dirname(dst))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
if target != "generic":
|
|
||||||
print "Do not yet know how to revert target dependent files"
|
|
||||||
sys.exit(1)
|
|
||||||
data = open(src).read()
|
data = open(src).read()
|
||||||
out = open(dst, 'w')
|
out = open(tempFile, 'w')
|
||||||
if org.find('rtems') == -1:
|
if org.find('rtems') == -1:
|
||||||
data = revertFixIncludes(data)
|
data = revertFixIncludes(data)
|
||||||
out.write(data)
|
out.write(data)
|
||||||
out.close()
|
out.close()
|
||||||
|
if copyIfDifferent(tempFile, dst) == True:
|
||||||
|
if isVerbose == True:
|
||||||
|
print "Revert Header - " + src + " => " + dst
|
||||||
|
|
||||||
# Revert a source file from the RTEMS BSD tree to the FreeBSD tree
|
# Revert a source file from the RTEMS BSD tree to the FreeBSD tree
|
||||||
def revertSourceFile(org):
|
def revertSourceFile(org, target):
|
||||||
src = RTEMS_DIR + '/' + PREFIX + '/' + org
|
src = RTEMS_DIR + '/' + PREFIX + '/' + org
|
||||||
src = mapContribPath(src)
|
src = mapContribPath(src)
|
||||||
dst = FreeBSD_DIR + '/' + org
|
dst = FreeBSD_DIR + '/' + org
|
||||||
|
if target != "generic":
|
||||||
|
src = mapCPUDependentPath(src)
|
||||||
if isVerbose == True:
|
if isVerbose == True:
|
||||||
print "Revert Source - " + src + " => " + dst
|
print "Revert Source - " + src + " => " + dst
|
||||||
if isDryRun == True:
|
if isDryRun == True:
|
||||||
@ -290,12 +295,15 @@ def revertSourceFile(org):
|
|||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
data = open(src).read()
|
data = open(src).read()
|
||||||
out = open(dst, 'w')
|
out = open(tempFile, 'w')
|
||||||
if org.find('rtems') == -1:
|
if org.find('rtems') == -1:
|
||||||
data = re.sub('#include <' + PREFIX + '/machine/rtems-bsd-config.h>\n\n', '', data)
|
data = re.sub('#include <' + PREFIX + '/machine/rtems-bsd-config.h>\n\n', '', data)
|
||||||
data = revertFixIncludes(data)
|
data = revertFixIncludes(data)
|
||||||
out.write(data)
|
out.write(data)
|
||||||
out.close()
|
out.close()
|
||||||
|
if copyIfDifferent(tempFile, dst) == True:
|
||||||
|
if isVerbose == True:
|
||||||
|
print "Revert Source - " + src + " => " + dst
|
||||||
|
|
||||||
# Remove the output directory
|
# Remove the output directory
|
||||||
def deleteOutputDirectory():
|
def deleteOutputDirectory():
|
||||||
@ -335,7 +343,7 @@ class ModuleManager:
|
|||||||
for f in m.headerFiles:
|
for f in m.headerFiles:
|
||||||
revertHeaderFile(f, m.target)
|
revertHeaderFile(f, m.target)
|
||||||
for f in m.sourceFiles:
|
for f in m.sourceFiles:
|
||||||
revertSourceFile(f)
|
revertSourceFile(f, m.target)
|
||||||
|
|
||||||
def createMakefile(self):
|
def createMakefile(self):
|
||||||
global tempFile
|
global tempFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user