update
This commit is contained in:
parent
ebc2396ce2
commit
dd90f6bd9f
9
Makefile
9
Makefile
@ -64,7 +64,12 @@ clean:
|
|||||||
|
|
||||||
html: $(HTML_BUILD_DIR)/_static/style.css
|
html: $(HTML_BUILD_DIR)/_static/style.css
|
||||||
@echo "Starting build..."
|
@echo "Starting build..."
|
||||||
$(SPHINX_BUILD) -q -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR) >> $(LOGFILE)
|
$(SPHINX_BUILD) -q -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR)
|
||||||
|
@echo "Build finished."
|
||||||
|
html_log: SPHINXOPTS += -A collapse_menu=True
|
||||||
|
html_log: $(HTML_BUILD_DIR)/_static/style.css
|
||||||
|
@echo "Starting build..."
|
||||||
|
$(SPHINX_BUILD) -q -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR) > $(LOGFILE) 2>&1
|
||||||
@echo "Build finished."
|
@echo "Build finished."
|
||||||
|
|
||||||
live: SPHINXOPTS += -A collapse_menu=True
|
live: SPHINXOPTS += -A collapse_menu=True
|
||||||
@ -102,7 +107,7 @@ $(HTML_BUILD_DIR)/_static/style.css: extensions/odoo_theme/static/style.scss ext
|
|||||||
#=== Development and debugging rules ===#
|
#=== Development and debugging rules ===#
|
||||||
|
|
||||||
fast: SPHINXOPTS += -A collapse_menu=True
|
fast: SPHINXOPTS += -A collapse_menu=True
|
||||||
fast: html
|
fast: hmlt
|
||||||
|
|
||||||
static: $(HTML_BUILD_DIR)/_static/style.css
|
static: $(HTML_BUILD_DIR)/_static/style.css
|
||||||
cp -r extensions/odoo_theme/static/* $(HTML_BUILD_DIR)/_static/
|
cp -r extensions/odoo_theme/static/* $(HTML_BUILD_DIR)/_static/
|
||||||
|
81
fix-link.sh
81
fix-link.sh
@ -1,28 +1,89 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Setup logging
|
||||||
|
LOG_FILE="_build/script_log_$(date +%Y%m%d_%H%M%S).log"
|
||||||
|
log_message() {
|
||||||
|
local timestamp="$(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
echo "[$timestamp] $1" | tee -a "$LOG_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check input file
|
||||||
INPUT_FILE="$1"
|
INPUT_FILE="$1"
|
||||||
|
|
||||||
if [[ ! -f "$INPUT_FILE" ]]; then
|
if [[ -z "$INPUT_FILE" ]]; then
|
||||||
echo "Error: Input file does not exist."
|
log_message "ERROR: No input file provided. Usage: $0 <input_file>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$INPUT_FILE" ]]; then
|
||||||
|
log_message "ERROR: Input file '$INPUT_FILE' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_message "INFO: Starting script with input file: $INPUT_FILE"
|
||||||
|
|
||||||
|
# Counter for processed lines
|
||||||
|
processed_count=0
|
||||||
|
error_count=0
|
||||||
|
|
||||||
while IFS=':' read -r file_path line_err status desc data; do
|
while IFS=':' read -r file_path line_err status desc data; do
|
||||||
|
((processed_count++))
|
||||||
|
|
||||||
# Trim whitespace from variables
|
# Trim whitespace from variables
|
||||||
file_path="$(echo "$file_path" | xargs)"
|
file_path="$(echo "$file_path" | xargs)"
|
||||||
line_err="$(echo "$line_err" | xargs)"
|
line_err="$(echo "$line_err" | xargs)"
|
||||||
status="$(echo "$status" | xargs)"
|
status="$(echo "$status" | xargs)"
|
||||||
desc="$(echo "$desc" | xargs)"
|
desc="$(echo "$desc" | xargs)"
|
||||||
data="$(echo "$data" | xargs | tr -d "'")" # Remove quotes from data
|
data="$(echo "$data" | xargs | tr -d "'")" # Remove single quotes from data
|
||||||
|
|
||||||
if [[ -f "$file_path" ]]; then
|
# Log the current line being processed
|
||||||
if [[ "$desc" == "undefined label" ]]; then
|
log_message "DEBUG: Processing line $processed_count - File: $file_path, Desc: $desc, Data: $data"
|
||||||
fixed_data="$(echo "$data" | tr '\\/_' '-')"
|
|
||||||
sed -i "s@$data@$fixed_data@g" "$file_path"
|
if [[ -z "$file_path" ]]; then
|
||||||
elif [[ "$desc" == *"toctree contains reference to nonexisting document"* ]]; then
|
log_message "WARNING: Empty file path encountered at line $processed_count"
|
||||||
fixed_data="$(echo "$data" | tr '\\/_' '-')"
|
((error_count++))
|
||||||
sed -i "s@$data@$fixed_data@g" "$file_path"
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$file_path" ]]; then
|
||||||
|
log_message "ERROR: File not found: $file_path at line $processed_count"
|
||||||
|
((error_count++))
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -w "$file_path" ]]; then
|
||||||
|
log_message "ERROR: File not writable: $file_path at line $processed_count"
|
||||||
|
((error_count++))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$desc" in
|
||||||
|
"undefined label"|*"toctree contains reference to nonexisting document"*)
|
||||||
|
fixed_data="$(echo "$data" | tr '\\/_' '-')"
|
||||||
|
if sed -i "s@$data@$fixed_data@g" "$file_path" 2>>"$LOG_FILE"; then
|
||||||
|
log_message "INFO: Successfully fixed issue in $file_path: '$data' -> '$fixed_data'"
|
||||||
|
else
|
||||||
|
log_message "ERROR: Failed to modify $file_path"
|
||||||
|
((error_count++))
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_message "DEBUG: No matching condition for description: $desc"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
done < "$INPUT_FILE"
|
done < "$INPUT_FILE"
|
||||||
|
|
||||||
|
# Final summary
|
||||||
|
log_message "INFO: Script completed"
|
||||||
|
log_message "INFO: Total lines processed: $processed_count"
|
||||||
|
log_message "INFO: Total errors encountered: $error_count"
|
||||||
|
|
||||||
|
# Exit with appropriate status
|
||||||
|
if [[ $error_count -gt 0 ]]; then
|
||||||
|
log_message "WARNING: Script completed with $error_count errors"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
log_message "INFO: Script completed successfully"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user