�&ǐk�@'bJ�h�ۊL'}T� :��'2�Z#$��n�a��� �>a��`��_3d�Qpt�/�P -��#5�,�M��� �pA:©�q�����NW��ډ�A���� �9nʺج���� �TSM��{J6?7��r�@�\����D��� �׶���s�f�TJj?"��D��`?��̒� b�#�%�C*v�$�{�$����5Ծ�F�s��y�e/8��h-�f�̰&(����Gj�L:U� 2�� ����v�_k����Y��gp,�k�WF�R������_C�R��N@���R�@�ߔ?A�w9���F("iNa-S���Q�o�3tDMLh*�#4k�T/iQ��Y*�G��m����)��8�hBm/�I�,g�ﯖ���Z��}�Cz�q@´��d.����L�ŕ�,��1�Z�܌�: ̪���F+J-'��c�tvJ8��]Q-��b��y �6;*J`r_�d ��'�G ~p��)'�C,�%F��E(��2�k�����lР�z�!�=t ��_�0��f7��� ;�p�|�U �% %s]" % (SRC, DEST)) parser.add_argument("--silent-on-noop", action="store_true", help="do nothing if %s does not exist" % SRC) parser.add_argument("--optimize", action="store_true", default=False, help="skip v1 compilation if v2 is available") args = parser.parse_args() skip_v1 = args.optimize must_have_items_check(args.silent_on_noop) tempdir = tempfile.mktemp(prefix='%s_tmpdir_' % path.basename(DEST), dir=path.dirname(DEST)) shutil.copytree(SRC, tempdir) try: # Add (overwrite) rules.yaml from /usr/share/i360-php-opts shutil.copy2(RULES_FILE, tempdir) except Exception as e: sentry_sdk.capture_exception(e) flush_sentry() sys.exit("ERROR: %s" % e) os.chdir(tempdir) os.umask(0o022) result = [] try: output = subprocess.check_output([TOOL, tempdir + '/.rules.v2', tempdir], stderr=subprocess.STDOUT, universal_newlines=True) except subprocess.CalledProcessError as e: # full backtrace is not needed for tool call error logging.critical('%s\n==================================' % e.output) if e.returncode == 2: skip_v1 = False print("ERROR: %s" % e) else: sys.exit("ERROR: %s" % e) else: result.append(RESULT_V2) if skip_v1 == False: try: output = subprocess.check_output( [TOOL_OLD, 'mkbin'], stderr=subprocess.STDOUT, universal_newlines=True ) output = subprocess.check_output( [TOOL_OLD, 'mkdump', '.rules', '.rulesdump'], stderr=subprocess.STDOUT, universal_newlines=True ) except subprocess.CalledProcessError as e: # full backtrace is not needed for tool call error logging.critical( '%s\n==================================' % e.output ) sys.exit("ERROR: %s" % e) result.extend(RESULT_V1) os.makedirs(DEST, mode=0o755, exist_ok=True) for item in result: # get ready for atomic rewrite (copy + rename) tmpfn = tempfile.mktemp(suffix='_i360tmp', prefix=item, dir=DEST) # copy data and mode bits if os.path.exists(path.join(tempdir, item)): shutil.copy(path.join(tempdir, item), tmpfn) # that is Ok for .rulesdump + .rules to be handled not as a single step, # as far so far .rules is a fallback when we fail to mmap() .rulesdump os.rename(tmpfn, path.join(DEST, item)) os.chdir(tempfile.gettempdir()) # chdir away from tempdir shutil.rmtree(tempdir) ts_end = time.time() logging.info("Success. Execution time %d s" % (ts_end - ts_begin)) print("Success.")