libc: Update auto-gen scripts
Make the scripts use external/kernel-headers/original by default.
clean_header.py: Document -k<path>, add -d<path>
find_headers.py: Make kernel config files optional
update_all.py: Allow setting the path to kernel headers on the command-line
update_all.py: Better formatting of output on ttys
update_all.py: Automatically perform "git add/rm" on affected files.
SYSCALLS.TXT: Fix typo in __socketcall definition.
checksyscalls.py: Add support for superH architecture in the checks.
gensyscalls.py: Automatically perform "git add/rm" on affected files.
cpp.py: Fixed a bug that prevented certain type definitions to
be kept in the generated clean header (e.g.
struct ethtool_drvinfo in <linux/ethtool.h>)
All scripts will use the content of external/kernel-headers/original by default now.
The generated code removes all empty lines and trailing whitespace. This is useful
to ensure a unified output even if we change the parser again in the future.
The top-level disclaimer has been edited with update instructions to regenerate
the headers when needed.
Also, a warning is now inserted every 8th line in the final output:
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Changes under kernel/arch-arm and kernel/arch-x86 should correspond to whitespace
differences and additionnal struct definitions that were missed by the previous
parser implementation.
Change-Id: Icd1c056bacd766759f3e9b7bb5d63a246f3d656a
WARNING: If you run these script, do not submit the result to gerrit for now.
It seems there are discrepancies between the content of original headers
and those currently commited under bionic/libc/kernel/.
(This problem is the main motivation to insert the warning repeatedly).
Current list of issues:
- Missing SuperH headers (i.e. external/kernel-headers/original/asm-sh)
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 0535e56..b58754b 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -557,7 +557,7 @@
for sc in self.syscalls:
if sc.has_key("asm-arm") and 'arm' in all_archs:
fname = "arch-arm/syscalls/%s.S" % sc["func"]
- D( ">>> generating "+fname )
+ D2( ">>> generating "+fname )
fp = create_file( fname )
fp.write(sc["asm-arm"])
fp.close()
@@ -565,7 +565,7 @@
if sc.has_key("asm-thumb") and 'arm' in all_archs:
fname = "arch-arm/syscalls/%s.S" % sc["func"]
- D( ">>> generating "+fname )
+ D2( ">>> generating "+fname )
fp = create_file( fname )
fp.write(sc["asm-thumb"])
fp.close()
@@ -573,7 +573,7 @@
if sc.has_key("asm-x86") and 'x86' in all_archs:
fname = "arch-x86/syscalls/%s.S" % sc["func"]
- D( ">>> generating "+fname )
+ D2( ">>> generating "+fname )
fp = create_file( fname )
fp.write(sc["asm-x86"])
fp.close()
@@ -581,7 +581,7 @@
if sc.has_key("asm-sh"):
fname = "arch-sh/syscalls/%s.S" % sc["func"]
- D( ">>> generating "+fname )
+ D2( ">>> generating "+fname )
fp = create_file( fname )
fp.write(sc["asm-sh"])
fp.close()
@@ -626,7 +626,7 @@
for stub in self.new_stubs + self.other_files:
if not os.path.exists( bionic_root + stub ):
- # new file, P4 add it
+ # new file, git add it
D( "new file: " + stub)
adds.append( bionic_root + stub )
shutil.copyfile( bionic_temp + stub, bionic_root + stub )
@@ -643,16 +643,21 @@
if adds:
- commands.getoutput("p4 add " + " ".join(adds))
+ commands.getoutput("git add " + " ".join(adds))
if deletes:
- commands.getoutput("p4 delete " + " ".join(deletes))
+ commands.getoutput("git rm " + " ".join(deletes))
if edits:
- commands.getoutput("p4 edit " +
- " ".join((bionic_root + file) for file in edits))
for file in edits:
shutil.copyfile( bionic_temp + file, bionic_root + file )
+ commands.getoutput("git add " +
+ " ".join((bionic_root + file) for file in edits))
- D("ready to go !!")
+ commands.getoutput("git add %s%s" % (bionic_root,"SYSCALLS.TXT"))
+
+ if (not adds) and (not deletes) and (not edits):
+ D("no changes detected!")
+ else:
+ D("ready to go!!")
D_setlevel(1)