Loading generateBaseline/postprocessing.py +20 −7 Original line number Diff line number Diff line Loading @@ -137,15 +137,24 @@ def refresh_docx_fields(input_path: str, image: str = "docx-field-refresh") -> s print(f"📄 Input file: {input_path}") print(f"📁 Input parent directory: {input_path.parent}") print(f"📋 Files in input parent directory:") try: for item in sorted(input_path.parent.iterdir()): print(f" - {item.name} ({'dir' if item.is_dir() else 'file'})") except Exception as e: print(f" Error listing directory: {e}") # Create a temporary home directory for LibreOffice to prevent creating files in /root lo_home = Path(tempfile.mkdtemp(prefix="lo_home_")) # Ensure the directory has proper permissions (readable, writable, executable by owner) lo_home.chmod(0o755) # Create necessary subdirectories that LibreOffice needs lo_cache = lo_home / ".cache" lo_cache.mkdir(mode=0o755, exist_ok=True) dconf_dir = lo_cache / "dconf" dconf_dir.mkdir(mode=0o755, exist_ok=True) # Create .config directory and LibreOffice profile directory lo_config = lo_home / ".config" lo_config.mkdir(mode=0o755, exist_ok=True) lo_profile = lo_config / "libreoffice" lo_profile.mkdir(mode=0o755, exist_ok=True) print(f"🏠 LibreOffice home directory: {lo_home}") print(f"📋 Contents of lo_home (before):") try: Loading @@ -170,11 +179,15 @@ def refresh_docx_fields(input_path: str, image: str = "docx-field-refresh") -> s "-v", f"{lo_home}:/tmp/lo_home", # Mount temp home directory "-u", f"{os.getuid()}:{os.getgid()}", # <--- run as host user "-e", "HOME=/tmp/lo_home", # Tell LibreOffice to use temp directory for its profile "-e", "DCONF_PROFILE=", # Disable dconf to avoid permission issues "-e", "SAL_USE_VCLPLUGIN=gen", # Use generic VCL plugin (headless) "-e", "LIBREOFFICE_PROFILE=/tmp/lo_home/.config/libreoffice", # Explicit profile path image, "--headless", "--nodefault", "--norestore", # Don't restore previous session "--nolockcheck", # Don't check for file locks "--invisible", "--convert-to", "docx", "--infilter=writer8", "--outdir", "/data", Loading Loading
generateBaseline/postprocessing.py +20 −7 Original line number Diff line number Diff line Loading @@ -137,15 +137,24 @@ def refresh_docx_fields(input_path: str, image: str = "docx-field-refresh") -> s print(f"📄 Input file: {input_path}") print(f"📁 Input parent directory: {input_path.parent}") print(f"📋 Files in input parent directory:") try: for item in sorted(input_path.parent.iterdir()): print(f" - {item.name} ({'dir' if item.is_dir() else 'file'})") except Exception as e: print(f" Error listing directory: {e}") # Create a temporary home directory for LibreOffice to prevent creating files in /root lo_home = Path(tempfile.mkdtemp(prefix="lo_home_")) # Ensure the directory has proper permissions (readable, writable, executable by owner) lo_home.chmod(0o755) # Create necessary subdirectories that LibreOffice needs lo_cache = lo_home / ".cache" lo_cache.mkdir(mode=0o755, exist_ok=True) dconf_dir = lo_cache / "dconf" dconf_dir.mkdir(mode=0o755, exist_ok=True) # Create .config directory and LibreOffice profile directory lo_config = lo_home / ".config" lo_config.mkdir(mode=0o755, exist_ok=True) lo_profile = lo_config / "libreoffice" lo_profile.mkdir(mode=0o755, exist_ok=True) print(f"🏠 LibreOffice home directory: {lo_home}") print(f"📋 Contents of lo_home (before):") try: Loading @@ -170,11 +179,15 @@ def refresh_docx_fields(input_path: str, image: str = "docx-field-refresh") -> s "-v", f"{lo_home}:/tmp/lo_home", # Mount temp home directory "-u", f"{os.getuid()}:{os.getgid()}", # <--- run as host user "-e", "HOME=/tmp/lo_home", # Tell LibreOffice to use temp directory for its profile "-e", "DCONF_PROFILE=", # Disable dconf to avoid permission issues "-e", "SAL_USE_VCLPLUGIN=gen", # Use generic VCL plugin (headless) "-e", "LIBREOFFICE_PROFILE=/tmp/lo_home/.config/libreoffice", # Explicit profile path image, "--headless", "--nodefault", "--norestore", # Don't restore previous session "--nolockcheck", # Don't check for file locks "--invisible", "--convert-to", "docx", "--infilter=writer8", "--outdir", "/data", Loading