Loading .gitignore +4 −0 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,10 @@ generated* sysroots sysroots bitbake-logs bitbake-logs all_sources.lst excluding.lst including.lst doxygen.tag doxygen.tag /image /image /scripts /scripts Loading eclipse_project_setup/.cproject +37 −38 Original line number Original line Diff line number Diff line Loading @@ -61,8 +61,7 @@ </toolChain> </toolChain> </folderInfo> </folderInfo> <sourceEntries> <sourceEntries> <entry excluding="TSRM/readdir.h|TSRM/tsrm_config.w32.h|TSRM/tsrm_nw.c|TSRM/tsrm_nw.h|TSRM/tsrm_win32.c|TSRM/tsrm_win32.h|Zend/zend_config.nw.h|Zend/zend_config.w32.h|Zend/zend_dynamic_array.h|Zend/zend_istdiostream.h|Zend/zend_static_allocator.c|Zend/zend_static_allocator.h|Zend/zend_vm_def.h|ext/bcmath/|ext/calendar/|ext/com_dotnet/|ext/curl/|ext/dba/|ext/elphel/include/c313a.h|ext/enchant/|ext/ereg/regex/debug.c|ext/ereg/regex/main.c|ext/ereg/regex/split.c|ext/exif/|ext/fileinfo/libmagic/elfclass.h|ext/fileinfo/libmagic/names.h|ext/fileinfo/libmagic/strcasestr.c|ext/ftp/|ext/gd/|ext/gmp/|ext/interbase/|ext/intl/|ext/ldap/|ext/mbstring/libmbfl/tests/|ext/mbstring/oniguruma/enc/cp1251.c|ext/mbstring/oniguruma/enc/gb18030.c|ext/mbstring/oniguruma/enc/mktable.c|ext/mbstring/oniguruma/onigposix.h|ext/mbstring/oniguruma/regposerr.c|ext/mbstring/oniguruma/regposix.c|ext/mbstring/oniguruma/testc.c|ext/mbstring/oniguruma/testu.c|ext/mbstring/oniguruma/win32/|ext/mbstring/ucgendat/|ext/mssql/|ext/mysql/mysql_mysqlnd.h|ext/mysqli/mysqli_embedded.c|ext/mysqli/mysqli_mysqlnd.h|ext/mysqlnd/config-win.h|ext/mysqlnd/mysqlnd.c|ext/mysqlnd/mysqlnd.h|ext/mysqlnd/mysqlnd_alloc.c|ext/mysqlnd/mysqlnd_alloc.h|ext/mysqlnd/mysqlnd_auth.c|ext/mysqlnd/mysqlnd_block_alloc.c|ext/mysqlnd/mysqlnd_block_alloc.h|ext/mysqlnd/mysqlnd_bt.c|ext/mysqlnd/mysqlnd_charset.c|ext/mysqlnd/mysqlnd_charset.h|ext/mysqlnd/mysqlnd_debug.c|ext/mysqlnd/mysqlnd_debug.h|ext/mysqlnd/mysqlnd_driver.c|ext/mysqlnd/mysqlnd_enum_n_def.h|ext/mysqlnd/mysqlnd_ext_plugin.c|ext/mysqlnd/mysqlnd_ext_plugin.h|ext/mysqlnd/mysqlnd_libmysql_compat.h|ext/mysqlnd/mysqlnd_loaddata.c|ext/mysqlnd/mysqlnd_net.c|ext/mysqlnd/mysqlnd_net.h|ext/mysqlnd/mysqlnd_plugin.c|ext/mysqlnd/mysqlnd_portability.h|ext/mysqlnd/mysqlnd_priv.h|ext/mysqlnd/mysqlnd_ps.c|ext/mysqlnd/mysqlnd_ps_codec.c|ext/mysqlnd/mysqlnd_result.c|ext/mysqlnd/mysqlnd_result.h|ext/mysqlnd/mysqlnd_result_meta.c|ext/mysqlnd/mysqlnd_result_meta.h|ext/mysqlnd/mysqlnd_reverse_api.c|ext/mysqlnd/mysqlnd_reverse_api.h|ext/mysqlnd/mysqlnd_statistics.c|ext/mysqlnd/mysqlnd_statistics.h|ext/mysqlnd/mysqlnd_structs.h|ext/mysqlnd/mysqlnd_wireprotocol.c|ext/mysqlnd/mysqlnd_wireprotocol.h|ext/mysqlnd/php_mysqlnd.c|ext/mysqlnd/php_mysqlnd.h|ext/oci8/|ext/odbc/|ext/opcache/|ext/openssl/|ext/pcre/pcrelib/dftables.c|ext/pcre/pcrelib/pcredemo.c|ext/pcre/pcrelib/pcreposix.c|ext/pcre/pcrelib/pcreposix.h|ext/pcre/pcrelib/sljit/sljitNativeARM_64.c|ext/pcre/pcrelib/sljit/sljitNativeARM_T2_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_64.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_common.c|ext/pcre/pcrelib/sljit/sljitNativePPC_32.c|ext/pcre/pcrelib/sljit/sljitNativePPC_64.c|ext/pcre/pcrelib/sljit/sljitNativePPC_common.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_32.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_common.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX-encoder.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_32.c|ext/pcre/pcrelib/sljit/sljitNativeX86_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_common.c|ext/pdo_dblib/|ext/pdo_firebird/|ext/pdo_mysql/php_pdo_mysql_sqlstate.h|ext/pdo_oci/|ext/pdo_odbc/|ext/pdo_pgsql/|ext/pgsql/|ext/pspell/|ext/readline/|ext/recode/|ext/session/mod_mm.h|ext/shmop/|ext/skeleton/|ext/snmp/|ext/soap/|ext/sockets/win32_socket_constants.h|ext/sockets/windows_common.h|ext/sqlite3/libsqlite/|ext/standard/dns_win32.c|ext/standard/link_win32.c|ext/standard/winver.h|ext/sybase_ct/|ext/sysvmsg/|ext/sysvsem/|ext/sysvshm/|ext/tidy/|ext/xmlrpc/|ext/xsl/|ext/zip/lib/php_zip_config.w32.h|main/internal_functions_nw.c|main/internal_functions_win32.c|main/win32_internal_function_disabled.h|main/win95nt.h|netware/|sapi/aolserver/|sapi/apache/|sapi/apache2filter/|sapi/apache2handler/|sapi/apache_hooks/|sapi/caudium/|sapi/cli/cli_win32.c|sapi/continuity/|sapi/embed/|sapi/fpm/fpm/fpm_systemd.c|sapi/fpm/fpm/fpm_systemd.h|sapi/fpm/fpm/fpm_trace_mach.c|sapi/fpm/fpm/fpm_trace_pread.c|sapi/isapi/|sapi/litespeed/|sapi/milter/|sapi/nsapi/|sapi/phpdbg/|sapi/phttpd/|sapi/pi3web/|sapi/roxen/|sapi/thttpd/|sapi/tux/|sapi/webjames/|stub.c|win32/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="php"/> <entry excluding="TSRM/tsrm_nw.c|TSRM/tsrm_win32.c|Zend/zend_static_allocator.c|ext/bcmath/|ext/calendar/|ext/com_dotnet/|ext/dba/|ext/elphel/include/|ext/enchant/|ext/ereg/regex/debug.c|ext/ereg/regex/main.c|ext/ereg/regex/split.c|ext/fileinfo/libmagic/elfclass.h|ext/fileinfo/libmagic/names.h|ext/fileinfo/libmagic/strcasestr.c|ext/ftp/|ext/gd/|ext/gmp/|ext/interbase/|ext/intl/|ext/ldap/|ext/mbstring/libmbfl/tests/|ext/mbstring/oniguruma/enc/cp1251.c|ext/mbstring/oniguruma/enc/gb18030.c|ext/mbstring/oniguruma/enc/mktable.c|ext/mbstring/oniguruma/onigposix.h|ext/mbstring/oniguruma/regposerr.c|ext/mbstring/oniguruma/regposix.c|ext/mbstring/oniguruma/testc.c|ext/mbstring/oniguruma/testu.c|ext/mbstring/oniguruma/win32/|ext/mbstring/ucgendat/|ext/mssql/|ext/mysql/mysql_mysqlnd.h|ext/mysqli/mysqli_embedded.c|ext/mysqli/mysqli_mysqlnd.h|ext/mysqlnd/config-win.h|ext/mysqlnd/mysqlnd.c|ext/mysqlnd/mysqlnd.h|ext/mysqlnd/mysqlnd_alloc.c|ext/mysqlnd/mysqlnd_alloc.h|ext/mysqlnd/mysqlnd_auth.c|ext/mysqlnd/mysqlnd_block_alloc.c|ext/mysqlnd/mysqlnd_block_alloc.h|ext/mysqlnd/mysqlnd_bt.c|ext/mysqlnd/mysqlnd_charset.c|ext/mysqlnd/mysqlnd_charset.h|ext/mysqlnd/mysqlnd_debug.c|ext/mysqlnd/mysqlnd_debug.h|ext/mysqlnd/mysqlnd_driver.c|ext/mysqlnd/mysqlnd_enum_n_def.h|ext/mysqlnd/mysqlnd_ext_plugin.c|ext/mysqlnd/mysqlnd_ext_plugin.h|ext/mysqlnd/mysqlnd_libmysql_compat.h|ext/mysqlnd/mysqlnd_loaddata.c|ext/mysqlnd/mysqlnd_net.c|ext/mysqlnd/mysqlnd_net.h|ext/mysqlnd/mysqlnd_plugin.c|ext/mysqlnd/mysqlnd_portability.h|ext/mysqlnd/mysqlnd_priv.h|ext/mysqlnd/mysqlnd_ps.c|ext/mysqlnd/mysqlnd_ps_codec.c|ext/mysqlnd/mysqlnd_result.c|ext/mysqlnd/mysqlnd_result.h|ext/mysqlnd/mysqlnd_result_meta.c|ext/mysqlnd/mysqlnd_result_meta.h|ext/mysqlnd/mysqlnd_reverse_api.c|ext/mysqlnd/mysqlnd_reverse_api.h|ext/mysqlnd/mysqlnd_statistics.c|ext/mysqlnd/mysqlnd_statistics.h|ext/mysqlnd/mysqlnd_structs.h|ext/mysqlnd/mysqlnd_wireprotocol.c|ext/mysqlnd/mysqlnd_wireprotocol.h|ext/mysqlnd/php_mysqlnd.c|ext/mysqlnd/php_mysqlnd.h|ext/oci8/|ext/odbc/|ext/opcache/|ext/openssl/|ext/pcre/pcrelib/dftables.c|ext/pcre/pcrelib/pcredemo.c|ext/pcre/pcrelib/pcreposix.c|ext/pcre/pcrelib/sljit/sljitNativeARM_64.c|ext/pcre/pcrelib/sljit/sljitNativeARM_T2_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_64.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_common.c|ext/pcre/pcrelib/sljit/sljitNativePPC_32.c|ext/pcre/pcrelib/sljit/sljitNativePPC_64.c|ext/pcre/pcrelib/sljit/sljitNativePPC_common.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_32.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_common.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX-encoder.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_32.c|ext/pcre/pcrelib/sljit/sljitNativeX86_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_common.c|ext/pdo_dblib/|ext/pdo_firebird/|ext/pdo_mysql/php_pdo_mysql_sqlstate.h|ext/pdo_oci/|ext/pdo_odbc/|ext/pdo_pgsql/|ext/pgsql/|ext/pspell/|ext/recode/|ext/session/mod_mm.h|ext/shmop/|ext/skeleton/|ext/snmp/|ext/soap/|ext/sockets/win32_socket_constants.h|ext/sockets/windows_common.h|ext/sqlite3/libsqlite/|ext/standard/dns_win32.c|ext/standard/link_win32.c|ext/sybase_ct/|ext/sysvmsg/|ext/sysvsem/|ext/sysvshm/|ext/tidy/|ext/xmlrpc/|ext/xsl/|ext/zip/lib/php_zip_config.w32.h|main/internal_functions_nw.c|main/internal_functions_win32.c|netware/|sapi/aolserver/|sapi/apache/|sapi/apache2filter/|sapi/apache2handler/|sapi/apache_hooks/|sapi/caudium/|sapi/cli/cli_win32.c|sapi/continuity/|sapi/embed/|sapi/fpm/fpm/fpm_systemd.c|sapi/fpm/fpm/fpm_systemd.h|sapi/fpm/fpm/fpm_trace_mach.c|sapi/fpm/fpm/fpm_trace_pread.c|sapi/isapi/|sapi/litespeed/|sapi/milter/|sapi/nsapi/|sapi/phpdbg/|sapi/phttpd/|sapi/pi3web/|sapi/roxen/|sapi/thttpd/|sapi/tux/|sapi/webjames/|stub.c|win32/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="php" /></sourceEntries> </sourceEntries> </configuration> </configuration> </storageModule> </storageModule> <storageModule moduleId="org.eclipse.cdt.core.externalSettings" /> <storageModule moduleId="org.eclipse.cdt.core.externalSettings" /> Loading used_files.pydeleted 100755 → 0 +0 −243 Original line number Original line Diff line number Diff line #!/usr/bin/env python # encoding: utf-8 from __future__ import division from __future__ import print_function """ # @file used_files.py # @brief Extract file access data after build, modify CDT project configuration # (.cproject) accordingly # @copyright Copyright (C) 2016, Elphel.inc. # @param <b>License</b> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http:#www.gnu.org/licenses/>. @author: Andrey Filippov @license: GPLv3.0+ @contact: andrey@elphel.coml @deffield updated: Updated """ __author__ = "Andrey Filippov" __copyright__ = "Copyright 2016, Elphel, Inc." __license__ = "GPL" __version__ = "3.0+" __maintainer__ = "Andrey Filippov" __email__ = "andrey@elphel.com" __status__ = "Development" import sys import os import time import xml.etree.ElementTree as ET ''' TODO:Automate, find out why separate touch commands are needed Run this program twice: 1-st run ./used_files.py linux -1 and save shown timestamp Then run (some mystery here) touch src/drivers/ata/ahci_elphel.c touch src/drivers/elphel/sensor_common.c Wait 5 seconds and run (in a different console with appropriate sourcing) bitbake linux-xlnx -c compile -f Then again ./used_files.py linux <timestamp_from_the_first_run> If somethong went wrong you will need to resore .cproject from eclipse_project_setup directory For php: bitbake php -c cleansstate bitbake php -c unpack -f bitbake php -c configure -f ./used_files.py php -1 bitbake php -c compile -f ./used_files.py php 1471044836.8 Doing: bitbake php -c compile -f ./used_files.py php -1 bitbake php -c compile -f ./used_files.py php 1471044836.8 Corrupts make process ''' def file_tree(flist): # Each file in list is a file, no directories ftree={} for p in flist: node = ftree seg_list=p.split(os.sep) last_i=len(seg_list)-1 for i,segm in enumerate(seg_list): if not segm in node: if i == last_i: node[segm] = None else: node[segm] = {} node=node[segm] return ftree def exclude_list(ftree, flist): mark = "*" # no file/dir name can be "*" def list_tree_recursive(root): rslt = [] if not mark in root: return [[""]] # convert to trailing "/" for directories for n in root: if not n == mark: if root[n] is None: rslt.append([n]) else: for l in list_tree_recursive(root[n]): rslt.append([n]+l) return rslt ftree[mark]=None # mark top level dir for p in flist: node = ftree for segm in p.split(os.sep)[:-1]: node=node[segm] node[mark]=None # [mark] means used in flist del node[p.split(os.sep)[-1]] #print (ftree) # for k in ftree: # print(k) #Now prune unused directories #prune_recursive(ftree) # (assuming root is used) # now create list files_list_list = list_tree_recursive(ftree) # print (files_list_list) #converrt to file paths pl = [] for l in files_list_list: pl.append(os.path.join(*(l[1:]))) pl = sorted (pl) return pl def proc_tree(): DEBUG = True extensions = [".h",".c",".cpp"] exclude_start = ["linux"+os.sep+"scripts"+os.sep,"linux"+os.sep+"source"+os.sep+"scripts"+os.sep] delta_t = 3 # seconds try: root_path = sys.argv[1] except: print ("Calling %s <root directory path> [timestamp]"%(os.path.basename(sys.argv[0]))) try: start_time = float(sys.argv[2]) except: start_time = 0.0 touch_files= start_time < 0.0 print ("root_path = %s"%(root_path)) # root_path = "/home/eyesis/git/poky/linux-elphel/linux/" lstFiles = [] # Append files to a list for path, _, files in os.walk(root_path, followlinks = True): for f in files: for ext in extensions: if f.endswith(ext): lstFiles.append(os.path.join(path, f)) break all_tree= file_tree(sorted(lstFiles)) include_lst=[] lst_a = [] latest_at=0 for p in lstFiles: if touch_files: if os.path.islink(p): os.utime(os.path.realpath(p), None) else: os.utime(p, None) else: # at = time.ctime(os.stat(p).st_atime) at = os.stat(p).st_atime l = None if os.path.islink(p): l = os.path.realpath(p) at = os.stat(l).st_atime latest_at = max((latest_at,at)) if at > (start_time + delta_t): #Scripts/lexers result in problems exclude=False for exStr in exclude_start: if p.startswith(exStr): exclude=True break if exclude: break #exclude_start lst_a.append([p,at,l]) include_lst.append(p) if touch_files: print (len(lstFiles), "last time = ", time.time()) return excluding = exclude_list(all_tree, include_lst) # print (all_tree) # print (sorted(include_lst)) # print ("|".join(excluding)) if DEBUG: with open("all_sources.lst","w" ) as f: for p in sorted(lstFiles): at = os.stat(p).st_atime lnk="" if os.path.islink(p): at = os.stat(os.path.realpath(p)).st_atime lnk = os.path.realpath(p) print (p,at,lnk, file=f) with open("excluding.lst","w" ) as f: for p in excluding: print (p, file=f) # include_tree= file_tree(sorted(include_lst)) # print(include_tree) root_dir=include_lst[0].split(os.sep)[0] print ("root_dir=",root_dir) xml= ET.parse(".cproject") root=xml.getroot() # for child in root: # print(child.tag, child.attrib) for child in root.iter('sourceEntries'): for gchild in child: print(gchild.tag) for child in root.iter('sourceEntries'): for gchild in child: if gchild.tag == 'entry': attr = gchild.attrib try: if (attr['kind'] == 'sourcePath') and (attr['name'] == root_dir): child.remove (gchild) print ("Removed existing entry ",gchild.tag) break except: print ("error matching attributes for ",gchild.tag) pass break #after first 'sourceEntries' - should be just one? ET.SubElement(child, 'entry', {"flags":"VALUE_WORKSPACE_PATH", "kind":"sourcePath", "name":root_dir, "excluding":"|".join(excluding)}) for child in root.iter('sourceEntries'): for gchild in child: print(gchild.tag) oneliner= ET.tostring(root) #overwrites original .cproject, may change to somethong different with open(".cproject", "wr") as f: f.write("""<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?fileVersion 4.0.0?>""") f.write(oneliner) print (len(lstFiles), len(lst_a), "last access time = ",latest_at) if __name__ == '__main__': proc_tree() No newline at end of file Loading
.gitignore +4 −0 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,10 @@ generated* sysroots sysroots bitbake-logs bitbake-logs all_sources.lst excluding.lst including.lst doxygen.tag doxygen.tag /image /image /scripts /scripts Loading
eclipse_project_setup/.cproject +37 −38 Original line number Original line Diff line number Diff line Loading @@ -61,8 +61,7 @@ </toolChain> </toolChain> </folderInfo> </folderInfo> <sourceEntries> <sourceEntries> <entry excluding="TSRM/readdir.h|TSRM/tsrm_config.w32.h|TSRM/tsrm_nw.c|TSRM/tsrm_nw.h|TSRM/tsrm_win32.c|TSRM/tsrm_win32.h|Zend/zend_config.nw.h|Zend/zend_config.w32.h|Zend/zend_dynamic_array.h|Zend/zend_istdiostream.h|Zend/zend_static_allocator.c|Zend/zend_static_allocator.h|Zend/zend_vm_def.h|ext/bcmath/|ext/calendar/|ext/com_dotnet/|ext/curl/|ext/dba/|ext/elphel/include/c313a.h|ext/enchant/|ext/ereg/regex/debug.c|ext/ereg/regex/main.c|ext/ereg/regex/split.c|ext/exif/|ext/fileinfo/libmagic/elfclass.h|ext/fileinfo/libmagic/names.h|ext/fileinfo/libmagic/strcasestr.c|ext/ftp/|ext/gd/|ext/gmp/|ext/interbase/|ext/intl/|ext/ldap/|ext/mbstring/libmbfl/tests/|ext/mbstring/oniguruma/enc/cp1251.c|ext/mbstring/oniguruma/enc/gb18030.c|ext/mbstring/oniguruma/enc/mktable.c|ext/mbstring/oniguruma/onigposix.h|ext/mbstring/oniguruma/regposerr.c|ext/mbstring/oniguruma/regposix.c|ext/mbstring/oniguruma/testc.c|ext/mbstring/oniguruma/testu.c|ext/mbstring/oniguruma/win32/|ext/mbstring/ucgendat/|ext/mssql/|ext/mysql/mysql_mysqlnd.h|ext/mysqli/mysqli_embedded.c|ext/mysqli/mysqli_mysqlnd.h|ext/mysqlnd/config-win.h|ext/mysqlnd/mysqlnd.c|ext/mysqlnd/mysqlnd.h|ext/mysqlnd/mysqlnd_alloc.c|ext/mysqlnd/mysqlnd_alloc.h|ext/mysqlnd/mysqlnd_auth.c|ext/mysqlnd/mysqlnd_block_alloc.c|ext/mysqlnd/mysqlnd_block_alloc.h|ext/mysqlnd/mysqlnd_bt.c|ext/mysqlnd/mysqlnd_charset.c|ext/mysqlnd/mysqlnd_charset.h|ext/mysqlnd/mysqlnd_debug.c|ext/mysqlnd/mysqlnd_debug.h|ext/mysqlnd/mysqlnd_driver.c|ext/mysqlnd/mysqlnd_enum_n_def.h|ext/mysqlnd/mysqlnd_ext_plugin.c|ext/mysqlnd/mysqlnd_ext_plugin.h|ext/mysqlnd/mysqlnd_libmysql_compat.h|ext/mysqlnd/mysqlnd_loaddata.c|ext/mysqlnd/mysqlnd_net.c|ext/mysqlnd/mysqlnd_net.h|ext/mysqlnd/mysqlnd_plugin.c|ext/mysqlnd/mysqlnd_portability.h|ext/mysqlnd/mysqlnd_priv.h|ext/mysqlnd/mysqlnd_ps.c|ext/mysqlnd/mysqlnd_ps_codec.c|ext/mysqlnd/mysqlnd_result.c|ext/mysqlnd/mysqlnd_result.h|ext/mysqlnd/mysqlnd_result_meta.c|ext/mysqlnd/mysqlnd_result_meta.h|ext/mysqlnd/mysqlnd_reverse_api.c|ext/mysqlnd/mysqlnd_reverse_api.h|ext/mysqlnd/mysqlnd_statistics.c|ext/mysqlnd/mysqlnd_statistics.h|ext/mysqlnd/mysqlnd_structs.h|ext/mysqlnd/mysqlnd_wireprotocol.c|ext/mysqlnd/mysqlnd_wireprotocol.h|ext/mysqlnd/php_mysqlnd.c|ext/mysqlnd/php_mysqlnd.h|ext/oci8/|ext/odbc/|ext/opcache/|ext/openssl/|ext/pcre/pcrelib/dftables.c|ext/pcre/pcrelib/pcredemo.c|ext/pcre/pcrelib/pcreposix.c|ext/pcre/pcrelib/pcreposix.h|ext/pcre/pcrelib/sljit/sljitNativeARM_64.c|ext/pcre/pcrelib/sljit/sljitNativeARM_T2_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_64.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_common.c|ext/pcre/pcrelib/sljit/sljitNativePPC_32.c|ext/pcre/pcrelib/sljit/sljitNativePPC_64.c|ext/pcre/pcrelib/sljit/sljitNativePPC_common.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_32.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_common.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX-encoder.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_32.c|ext/pcre/pcrelib/sljit/sljitNativeX86_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_common.c|ext/pdo_dblib/|ext/pdo_firebird/|ext/pdo_mysql/php_pdo_mysql_sqlstate.h|ext/pdo_oci/|ext/pdo_odbc/|ext/pdo_pgsql/|ext/pgsql/|ext/pspell/|ext/readline/|ext/recode/|ext/session/mod_mm.h|ext/shmop/|ext/skeleton/|ext/snmp/|ext/soap/|ext/sockets/win32_socket_constants.h|ext/sockets/windows_common.h|ext/sqlite3/libsqlite/|ext/standard/dns_win32.c|ext/standard/link_win32.c|ext/standard/winver.h|ext/sybase_ct/|ext/sysvmsg/|ext/sysvsem/|ext/sysvshm/|ext/tidy/|ext/xmlrpc/|ext/xsl/|ext/zip/lib/php_zip_config.w32.h|main/internal_functions_nw.c|main/internal_functions_win32.c|main/win32_internal_function_disabled.h|main/win95nt.h|netware/|sapi/aolserver/|sapi/apache/|sapi/apache2filter/|sapi/apache2handler/|sapi/apache_hooks/|sapi/caudium/|sapi/cli/cli_win32.c|sapi/continuity/|sapi/embed/|sapi/fpm/fpm/fpm_systemd.c|sapi/fpm/fpm/fpm_systemd.h|sapi/fpm/fpm/fpm_trace_mach.c|sapi/fpm/fpm/fpm_trace_pread.c|sapi/isapi/|sapi/litespeed/|sapi/milter/|sapi/nsapi/|sapi/phpdbg/|sapi/phttpd/|sapi/pi3web/|sapi/roxen/|sapi/thttpd/|sapi/tux/|sapi/webjames/|stub.c|win32/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="php"/> <entry excluding="TSRM/tsrm_nw.c|TSRM/tsrm_win32.c|Zend/zend_static_allocator.c|ext/bcmath/|ext/calendar/|ext/com_dotnet/|ext/dba/|ext/elphel/include/|ext/enchant/|ext/ereg/regex/debug.c|ext/ereg/regex/main.c|ext/ereg/regex/split.c|ext/fileinfo/libmagic/elfclass.h|ext/fileinfo/libmagic/names.h|ext/fileinfo/libmagic/strcasestr.c|ext/ftp/|ext/gd/|ext/gmp/|ext/interbase/|ext/intl/|ext/ldap/|ext/mbstring/libmbfl/tests/|ext/mbstring/oniguruma/enc/cp1251.c|ext/mbstring/oniguruma/enc/gb18030.c|ext/mbstring/oniguruma/enc/mktable.c|ext/mbstring/oniguruma/onigposix.h|ext/mbstring/oniguruma/regposerr.c|ext/mbstring/oniguruma/regposix.c|ext/mbstring/oniguruma/testc.c|ext/mbstring/oniguruma/testu.c|ext/mbstring/oniguruma/win32/|ext/mbstring/ucgendat/|ext/mssql/|ext/mysql/mysql_mysqlnd.h|ext/mysqli/mysqli_embedded.c|ext/mysqli/mysqli_mysqlnd.h|ext/mysqlnd/config-win.h|ext/mysqlnd/mysqlnd.c|ext/mysqlnd/mysqlnd.h|ext/mysqlnd/mysqlnd_alloc.c|ext/mysqlnd/mysqlnd_alloc.h|ext/mysqlnd/mysqlnd_auth.c|ext/mysqlnd/mysqlnd_block_alloc.c|ext/mysqlnd/mysqlnd_block_alloc.h|ext/mysqlnd/mysqlnd_bt.c|ext/mysqlnd/mysqlnd_charset.c|ext/mysqlnd/mysqlnd_charset.h|ext/mysqlnd/mysqlnd_debug.c|ext/mysqlnd/mysqlnd_debug.h|ext/mysqlnd/mysqlnd_driver.c|ext/mysqlnd/mysqlnd_enum_n_def.h|ext/mysqlnd/mysqlnd_ext_plugin.c|ext/mysqlnd/mysqlnd_ext_plugin.h|ext/mysqlnd/mysqlnd_libmysql_compat.h|ext/mysqlnd/mysqlnd_loaddata.c|ext/mysqlnd/mysqlnd_net.c|ext/mysqlnd/mysqlnd_net.h|ext/mysqlnd/mysqlnd_plugin.c|ext/mysqlnd/mysqlnd_portability.h|ext/mysqlnd/mysqlnd_priv.h|ext/mysqlnd/mysqlnd_ps.c|ext/mysqlnd/mysqlnd_ps_codec.c|ext/mysqlnd/mysqlnd_result.c|ext/mysqlnd/mysqlnd_result.h|ext/mysqlnd/mysqlnd_result_meta.c|ext/mysqlnd/mysqlnd_result_meta.h|ext/mysqlnd/mysqlnd_reverse_api.c|ext/mysqlnd/mysqlnd_reverse_api.h|ext/mysqlnd/mysqlnd_statistics.c|ext/mysqlnd/mysqlnd_statistics.h|ext/mysqlnd/mysqlnd_structs.h|ext/mysqlnd/mysqlnd_wireprotocol.c|ext/mysqlnd/mysqlnd_wireprotocol.h|ext/mysqlnd/php_mysqlnd.c|ext/mysqlnd/php_mysqlnd.h|ext/oci8/|ext/odbc/|ext/opcache/|ext/openssl/|ext/pcre/pcrelib/dftables.c|ext/pcre/pcrelib/pcredemo.c|ext/pcre/pcrelib/pcreposix.c|ext/pcre/pcrelib/sljit/sljitNativeARM_64.c|ext/pcre/pcrelib/sljit/sljitNativeARM_T2_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_32.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_64.c|ext/pcre/pcrelib/sljit/sljitNativeMIPS_common.c|ext/pcre/pcrelib/sljit/sljitNativePPC_32.c|ext/pcre/pcrelib/sljit/sljitNativePPC_64.c|ext/pcre/pcrelib/sljit/sljitNativePPC_common.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_32.c|ext/pcre/pcrelib/sljit/sljitNativeSPARC_common.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX-encoder.c|ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_32.c|ext/pcre/pcrelib/sljit/sljitNativeX86_64.c|ext/pcre/pcrelib/sljit/sljitNativeX86_common.c|ext/pdo_dblib/|ext/pdo_firebird/|ext/pdo_mysql/php_pdo_mysql_sqlstate.h|ext/pdo_oci/|ext/pdo_odbc/|ext/pdo_pgsql/|ext/pgsql/|ext/pspell/|ext/recode/|ext/session/mod_mm.h|ext/shmop/|ext/skeleton/|ext/snmp/|ext/soap/|ext/sockets/win32_socket_constants.h|ext/sockets/windows_common.h|ext/sqlite3/libsqlite/|ext/standard/dns_win32.c|ext/standard/link_win32.c|ext/sybase_ct/|ext/sysvmsg/|ext/sysvsem/|ext/sysvshm/|ext/tidy/|ext/xmlrpc/|ext/xsl/|ext/zip/lib/php_zip_config.w32.h|main/internal_functions_nw.c|main/internal_functions_win32.c|netware/|sapi/aolserver/|sapi/apache/|sapi/apache2filter/|sapi/apache2handler/|sapi/apache_hooks/|sapi/caudium/|sapi/cli/cli_win32.c|sapi/continuity/|sapi/embed/|sapi/fpm/fpm/fpm_systemd.c|sapi/fpm/fpm/fpm_systemd.h|sapi/fpm/fpm/fpm_trace_mach.c|sapi/fpm/fpm/fpm_trace_pread.c|sapi/isapi/|sapi/litespeed/|sapi/milter/|sapi/nsapi/|sapi/phpdbg/|sapi/phttpd/|sapi/pi3web/|sapi/roxen/|sapi/thttpd/|sapi/tux/|sapi/webjames/|stub.c|win32/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="php" /></sourceEntries> </sourceEntries> </configuration> </configuration> </storageModule> </storageModule> <storageModule moduleId="org.eclipse.cdt.core.externalSettings" /> <storageModule moduleId="org.eclipse.cdt.core.externalSettings" /> Loading
used_files.pydeleted 100755 → 0 +0 −243 Original line number Original line Diff line number Diff line #!/usr/bin/env python # encoding: utf-8 from __future__ import division from __future__ import print_function """ # @file used_files.py # @brief Extract file access data after build, modify CDT project configuration # (.cproject) accordingly # @copyright Copyright (C) 2016, Elphel.inc. # @param <b>License</b> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http:#www.gnu.org/licenses/>. @author: Andrey Filippov @license: GPLv3.0+ @contact: andrey@elphel.coml @deffield updated: Updated """ __author__ = "Andrey Filippov" __copyright__ = "Copyright 2016, Elphel, Inc." __license__ = "GPL" __version__ = "3.0+" __maintainer__ = "Andrey Filippov" __email__ = "andrey@elphel.com" __status__ = "Development" import sys import os import time import xml.etree.ElementTree as ET ''' TODO:Automate, find out why separate touch commands are needed Run this program twice: 1-st run ./used_files.py linux -1 and save shown timestamp Then run (some mystery here) touch src/drivers/ata/ahci_elphel.c touch src/drivers/elphel/sensor_common.c Wait 5 seconds and run (in a different console with appropriate sourcing) bitbake linux-xlnx -c compile -f Then again ./used_files.py linux <timestamp_from_the_first_run> If somethong went wrong you will need to resore .cproject from eclipse_project_setup directory For php: bitbake php -c cleansstate bitbake php -c unpack -f bitbake php -c configure -f ./used_files.py php -1 bitbake php -c compile -f ./used_files.py php 1471044836.8 Doing: bitbake php -c compile -f ./used_files.py php -1 bitbake php -c compile -f ./used_files.py php 1471044836.8 Corrupts make process ''' def file_tree(flist): # Each file in list is a file, no directories ftree={} for p in flist: node = ftree seg_list=p.split(os.sep) last_i=len(seg_list)-1 for i,segm in enumerate(seg_list): if not segm in node: if i == last_i: node[segm] = None else: node[segm] = {} node=node[segm] return ftree def exclude_list(ftree, flist): mark = "*" # no file/dir name can be "*" def list_tree_recursive(root): rslt = [] if not mark in root: return [[""]] # convert to trailing "/" for directories for n in root: if not n == mark: if root[n] is None: rslt.append([n]) else: for l in list_tree_recursive(root[n]): rslt.append([n]+l) return rslt ftree[mark]=None # mark top level dir for p in flist: node = ftree for segm in p.split(os.sep)[:-1]: node=node[segm] node[mark]=None # [mark] means used in flist del node[p.split(os.sep)[-1]] #print (ftree) # for k in ftree: # print(k) #Now prune unused directories #prune_recursive(ftree) # (assuming root is used) # now create list files_list_list = list_tree_recursive(ftree) # print (files_list_list) #converrt to file paths pl = [] for l in files_list_list: pl.append(os.path.join(*(l[1:]))) pl = sorted (pl) return pl def proc_tree(): DEBUG = True extensions = [".h",".c",".cpp"] exclude_start = ["linux"+os.sep+"scripts"+os.sep,"linux"+os.sep+"source"+os.sep+"scripts"+os.sep] delta_t = 3 # seconds try: root_path = sys.argv[1] except: print ("Calling %s <root directory path> [timestamp]"%(os.path.basename(sys.argv[0]))) try: start_time = float(sys.argv[2]) except: start_time = 0.0 touch_files= start_time < 0.0 print ("root_path = %s"%(root_path)) # root_path = "/home/eyesis/git/poky/linux-elphel/linux/" lstFiles = [] # Append files to a list for path, _, files in os.walk(root_path, followlinks = True): for f in files: for ext in extensions: if f.endswith(ext): lstFiles.append(os.path.join(path, f)) break all_tree= file_tree(sorted(lstFiles)) include_lst=[] lst_a = [] latest_at=0 for p in lstFiles: if touch_files: if os.path.islink(p): os.utime(os.path.realpath(p), None) else: os.utime(p, None) else: # at = time.ctime(os.stat(p).st_atime) at = os.stat(p).st_atime l = None if os.path.islink(p): l = os.path.realpath(p) at = os.stat(l).st_atime latest_at = max((latest_at,at)) if at > (start_time + delta_t): #Scripts/lexers result in problems exclude=False for exStr in exclude_start: if p.startswith(exStr): exclude=True break if exclude: break #exclude_start lst_a.append([p,at,l]) include_lst.append(p) if touch_files: print (len(lstFiles), "last time = ", time.time()) return excluding = exclude_list(all_tree, include_lst) # print (all_tree) # print (sorted(include_lst)) # print ("|".join(excluding)) if DEBUG: with open("all_sources.lst","w" ) as f: for p in sorted(lstFiles): at = os.stat(p).st_atime lnk="" if os.path.islink(p): at = os.stat(os.path.realpath(p)).st_atime lnk = os.path.realpath(p) print (p,at,lnk, file=f) with open("excluding.lst","w" ) as f: for p in excluding: print (p, file=f) # include_tree= file_tree(sorted(include_lst)) # print(include_tree) root_dir=include_lst[0].split(os.sep)[0] print ("root_dir=",root_dir) xml= ET.parse(".cproject") root=xml.getroot() # for child in root: # print(child.tag, child.attrib) for child in root.iter('sourceEntries'): for gchild in child: print(gchild.tag) for child in root.iter('sourceEntries'): for gchild in child: if gchild.tag == 'entry': attr = gchild.attrib try: if (attr['kind'] == 'sourcePath') and (attr['name'] == root_dir): child.remove (gchild) print ("Removed existing entry ",gchild.tag) break except: print ("error matching attributes for ",gchild.tag) pass break #after first 'sourceEntries' - should be just one? ET.SubElement(child, 'entry', {"flags":"VALUE_WORKSPACE_PATH", "kind":"sourcePath", "name":root_dir, "excluding":"|".join(excluding)}) for child in root.iter('sourceEntries'): for gchild in child: print(gchild.tag) oneliner= ET.tostring(root) #overwrites original .cproject, may change to somethong different with open(".cproject", "wr") as f: f.write("""<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?fileVersion 4.0.0?>""") f.write(oneliner) print (len(lstFiles), len(lst_a), "last access time = ",latest_at) if __name__ == '__main__': proc_tree() No newline at end of file