Changeset 287453d in rtems-libbsd for freebsd-to-rtems.py
- Timestamp:
- Mar 8, 2012, 8:13:25 PM (8 years ago)
- Branches:
- 4.11, afaeccc05a556f6aa25ba044a7e49d6aa634a59e, freebsd-9.3, master
- Children:
- b55081a
- Parents:
- 24600f2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freebsd-to-rtems.py
r24600f2 r287453d 8 8 # Germany 9 9 # <info@embedded-brains.de> 10 # 11 # Copyright (c) 2012 OAR Corporation. All rights reserved. 10 12 # 11 13 # Redistribution and use in source and binary forms, with or without … … 37 39 import sys 38 40 import getopt 41 import filecmp 39 42 40 43 RTEMS_DIR = "not_set" … … 45 48 isEarlyExit = False 46 49 isOnlyMakefile = False 50 tempFile = "/tmp/tmp_FBRT" 47 51 48 52 def usage(): … … 178 182 return data 179 183 184 # compare and overwrite destination file only if different 185 def copyIfDifferent(new, old): 186 if filecmp.cmp(new, old, shallow=False) == False: 187 shutil.move(new, old) 188 # print "Move " + new + " to " + old 189 return True 190 return False 191 192 180 193 # Copy a header file from FreeBSD to the RTEMS BSD tree 181 194 def installHeaderFile(org): 195 global tempFile 182 196 src = FreeBSD_DIR + '/' + org 183 197 dst = RTEMS_DIR + '/' + PREFIX + '/' + org # + org.replace('rtems/', '') 184 198 dst = mapContribPath(dst) 185 if isVerbose == True:186 print "Install Header - " + src + " => " + dst187 199 if isDryRun == True: 200 if isVerbose == True: 201 print "Install Header - " + src + " => " + dst 188 202 return 189 203 try: … … 192 206 pass 193 207 data = open(src).read() 194 out = open( dst, 'w')208 out = open(tempFile, 'w') 195 209 if src.find('rtems') == -1: 196 210 data = fixIncludes(data) 197 211 out.write(data) 198 212 out.close() 213 if copyIfDifferent(tempFile, dst) == True: 214 if isVerbose == True: 215 print "Install Header - " + src + " => " + dst 216 199 217 200 218 # Copy a source file from FreeBSD to the RTEMS BSD tree 201 219 def installSourceFile(org): 220 global tempFile 202 221 src = FreeBSD_DIR + '/' + org 203 222 dst = RTEMS_DIR + '/' + PREFIX + '/' + org 204 223 dst = mapContribPath(dst) 205 if isVerbose == True:206 print "Install Source - " + src + " => " + dst207 224 if isDryRun == True: 225 if isVerbose == True: 226 print "Install Source - " + src + " => " + dst 208 227 return 209 228 try: … … 212 231 pass 213 232 data = open(src).read() 214 out = open( dst, 'w')233 out = open(tempFile, 'w') 215 234 if src.find('rtems') == -1: 216 235 data = fixIncludes(data) … … 218 237 out.write(data) 219 238 out.close() 239 if copyIfDifferent(tempFile, dst) == True: 240 if isVerbose == True: 241 print "Install Source - " + src + " => " + dst 220 242 221 243 # Revert a header file from the RTEMS BSD tree to the FreeBSD tree
Note: See TracChangeset
for help on using the changeset viewer.