feat: add target to generate deleted_files.txt for update process

This commit is contained in:
Divarion-D
2026-04-13 01:04:54 +03:00
parent 5acfab5686
commit b64a22ef5f
2 changed files with 248 additions and 21 deletions

View File

@@ -68,7 +68,38 @@ EXCLUDE_ARGS := $(addprefix --exclude=,$(EXCLUDES))
.PHONY: new lb main lb_copy_files main_copy_files set_permissions create_archive \
lb_archive_move main_archive_move main_install_archive clean \
delete_files_list lb_delete_files_list
delete_files_list lb_delete_files_list generate_deleted_files
# ─── Generate deleted_files.txt from git diff ───────────────────
# Usage: make generate_deleted_files [LAST_TAG=v1.2.3]
# Writes to src/migrations/deleted_files.txt for manual review.
generate_deleted_files:
@if [ -z "$(LAST_TAG)" ]; then \
echo "[ERROR] LAST_TAG is empty — cannot detect latest release."; \
echo " Pass it manually: make generate_deleted_files LAST_TAG=v1.2.3"; \
exit 1; \
fi
@if ! git rev-parse "$(LAST_TAG)" >/dev/null 2>&1; then \
echo "[ERROR] Tag '$(LAST_TAG)' not found locally. Run: git fetch --tags"; \
exit 1; \
fi
@echo "[INFO] Generating deleted_files.txt: $(LAST_TAG)..HEAD"
@{ \
echo '# Files to delete during update (relative to MAIN_HOME)'; \
echo '# Auto-generated from: git diff $(LAST_TAG)..HEAD'; \
echo '# One file per line. Lines starting with # are comments.'; \
echo '#'; \
git diff --name-status "$(LAST_TAG)"..HEAD -- src/ \
| awk '$$1 == "D" { sub(/^src\//, "", $$2); print $$2 }'; \
} > "$(MAIN_DIR)/migrations/deleted_files.txt"
@rCount=$$(grep -cv '^#\|^$$' "$(MAIN_DIR)/migrations/deleted_files.txt" 2>/dev/null || echo 0); \
echo "[INFO] Generated $(MAIN_DIR)/migrations/deleted_files.txt ($$rCount files)"; \
if [ "$$rCount" -gt 0 ]; then \
echo "[INFO] Files to delete:"; \
grep -v '^#' "$(MAIN_DIR)/migrations/deleted_files.txt" | grep -v '^$$'; \
else \
echo "[INFO] No deleted files detected since $(LAST_TAG)"; \
fi
# ─── MAIN targets ────────────────────────────────────────────────
# Single archive: used for both clean install and update.
@@ -147,31 +178,21 @@ main_copy_files:
@echo "All files gitkeep deleted"
delete_files_list:
@echo "[INFO] Generating deleted files list from $(LAST_TAG) to HEAD"
@if [ -z "$(LAST_TAG)" ]; then \
echo "[WARN] LAST_TAG is empty — skipping deleted files list"; \
else \
@echo "[INFO] Checking for manual deleted files list"
@if [ -f "$(MAIN_DIR)/migrations/deleted_files.txt" ]; then \
mkdir -p "$(TEMP_DIR)/migrations"; \
git diff --no-renames --name-status --diff-filter=D "$(LAST_TAG)..HEAD" \
| cut -f2 | grep '^src/' | sed 's|^src/||' | sort -u \
> "$(TEMP_DIR)/migrations/deleted_files.txt"; \
if [ -s "$(TEMP_DIR)/migrations/deleted_files.txt" ]; then \
echo "[INFO] Files to delete on update:"; \
cat "$(TEMP_DIR)/migrations/deleted_files.txt"; \
else \
echo "[INFO] No deleted files found"; \
rm -f "$(TEMP_DIR)/migrations/deleted_files.txt"; \
fi; \
cp "$(MAIN_DIR)/migrations/deleted_files.txt" "$(TEMP_DIR)/migrations/deleted_files.txt"; \
echo "[INFO] Files to delete on update:"; \
grep -v '^#' "$(TEMP_DIR)/migrations/deleted_files.txt" | grep -v '^$$' || true; \
else \
echo "[INFO] No deleted_files.txt found — skipping"; \
fi
lb_delete_files_list:
@echo "[INFO] Generating LB-scoped deleted files list from $(LAST_TAG) to HEAD"
@if [ -z "$(LAST_TAG)" ]; then \
echo "[WARN] LAST_TAG is empty — skipping deleted files list"; \
else \
@echo "[INFO] Checking for manual deleted files list (LB-scoped)"
@if [ -f "$(MAIN_DIR)/migrations/deleted_files.txt" ]; then \
mkdir -p "$(TEMP_DIR)/migrations"; \
git diff --no-renames --name-status --diff-filter=D "$(LAST_TAG)..HEAD" \
| cut -f2 | grep '^src/' | sed 's|^src/||' | sort -u \
grep -v '^#' "$(MAIN_DIR)/migrations/deleted_files.txt" | grep -v '^$$' \
| awk -v dirs="$(LB_DIRS)" -v files="$(LB_ROOT_FILES)" ' \
BEGIN { n=split(dirs,d," "); m=split(files,f," ") } \
{ ok=0; for(i=1;i<=n;i++) if(index($$0,d[i]"/")==1){ok=1;break} \
@@ -185,6 +206,8 @@ lb_delete_files_list:
echo "[INFO] No LB-scoped deleted files found"; \
rm -f "$(TEMP_DIR)/migrations/deleted_files.txt"; \
fi; \
else \
echo "[INFO] No deleted_files.txt found — skipping"; \
fi
set_permissions:

View File

@@ -0,0 +1,204 @@
# Files to delete during update (relative to MAIN_HOME)
# Auto-generated from: git diff 1.2.16..HEAD
# One file per line. Lines starting with # are comments.
#
admin/assets/libs/jwplayer/jwplayer.controls.js
admin/assets/libs/jwplayer/jwplayer.core.controls.html5.js
admin/assets/libs/jwplayer/jwplayer.core.controls.js
admin/assets/libs/jwplayer/jwplayer.core.controls.polyfills.html5.js
admin/assets/libs/jwplayer/jwplayer.core.controls.polyfills.js
admin/assets/libs/jwplayer/jwplayer.core.js
admin/assets/libs/jwplayer/jwplayer.js
admin/assets/libs/jwplayer/polyfills.intersection-observer.js
admin/assets/libs/jwplayer/polyfills.webvtt.js
admin/assets/libs/jwplayer/provider.airplay.js
admin/assets/libs/jwplayer/provider.cast.js
admin/assets/libs/jwplayer/provider.hlsjs.js
admin/assets/libs/jwplayer/provider.html5.js
admin/assets/libs/jwplayer/related.js
admin/assets/libs/jwplayer/vttparser.js
admin/bouquets.php
admin/client_logs.php
admin/created_channels.php
admin/credit_logs.php
admin/dashboard.php
admin/enigma.php
admin/enigmas.php
admin/epg_view.php
admin/epgs.php
admin/episodes.php
admin/fingerprint.php
admin/footer.php
admin/groups.php
admin/index.php
admin/ips.php
admin/line_activity.php
admin/live_connections.php
admin/mag_events.php
admin/mags.php
admin/movie_mass.php
admin/movies.php
admin/ondemand.php
admin/player.php
admin/profiles.php
admin/queue.php
admin/radios.php
admin/restream_logs.php
admin/series.php
admin/series_mass.php
admin/stream.php
admin/stream_category.php
admin/stream_mass.php
admin/stream_rank.php
admin/stream_review.php
admin/streams.php
admin/theft_detection.php
admin/user_logs.php
admin/user_mass.php
admin/users.php
admin/watch_add.php
admin/watch_output.php
bin/ffmpeg_bin/4.3/ffmpeg
bin/ffmpeg_bin/4.3/ffprobe
bin/ffmpeg_bin/4.4/ffmpeg
bin/ffmpeg_bin/4.4/ffprobe
bin/ffmpeg_bin/5.1/ffmpeg
bin/ffmpeg_bin/5.1/ffprobe
bin/redis/redis-server_6.2.2
crons/activity.php
crons/backups.php
crons/cache.php
crons/cache_engine.php
crons/certbot.php
crons/cleanup.php
crons/epg.php
crons/errors.php
crons/lines_logs.php
crons/plex.php
crons/providers.php
crons/root_mysql.php
crons/root_signals.php
crons/series.php
crons/streams.php
crons/streams_logs.php
crons/tmdb.php
crons/tmdb_popular.php
crons/tmp.php
crons/update.php
crons/users.php
crons/vod.php
crons/watch.php
domain/Bouquet/BouquetMapper.php
domain/Bouquet/BouquetRepository.php
domain/Stream/CategoryRepository.php
includes/CoreUtilities.php
includes/StreamingUtilities.php
includes/admin.php
includes/admin_api.php
includes/cli/archive.php
includes/cli/balancer.php
includes/cli/binaries.php
includes/cli/cache_handler.php
includes/cli/certbot.php
includes/cli/created.php
includes/cli/delay.php
includes/cli/llod.php
includes/cli/loopback.php
includes/cli/monitor.php
includes/cli/ondemand.php
includes/cli/plex_item.php
includes/cli/proxy.php
includes/cli/queue.php
includes/cli/record.php
includes/cli/scanner.php
includes/cli/signals.php
includes/cli/startup.php
includes/cli/thumbnail.php
includes/cli/tools.php
includes/cli/update.php
includes/cli/watch_item.php
includes/cli/watchdog.php
includes/data/permissions.php
includes/langs/de.ini
includes/langs/en.ini
includes/langs/es.ini
includes/langs/fr.ini
includes/langs/pt.ini
includes/libs/Translator.php
includes/libs/iptables.php
includes/python/PTN/__init__.pyc
includes/python/PTN/__pycache__/__init__.cpython-36.pyc
includes/python/PTN/__pycache__/__init__.cpython-38.pyc
includes/python/PTN/__pycache__/parse.cpython-36.pyc
includes/python/PTN/__pycache__/parse.cpython-38.pyc
includes/python/PTN/__pycache__/patterns.cpython-36.pyc
includes/python/PTN/__pycache__/patterns.cpython-38.pyc
includes/python/PTN/parse.pyc
includes/python/PTN/patterns.pyc
player/episodes.php
player/index.php
player/js/jwplayer.controls.js
player/js/jwplayer.core.controls.html5.js
player/js/jwplayer.core.controls.js
player/js/jwplayer.core.controls.polyfills.html5.js
player/js/jwplayer.core.controls.polyfills.js
player/js/jwplayer.core.js
player/js/jwplayer.js
player/js/polyfills.intersection-observer.js
player/js/polyfills.webvtt.js
player/js/provider.airplay.js
player/js/provider.cast.js
player/js/provider.hlsjs.js
player/js/provider.html5.js
player/js/related.js
player/js/vttparser.js
player/listings.php
player/live.php
player/login.php
player/logout.php
player/movie.php
player/movies.php
player/profile.php
player/proxy.php
player/resize.php
player/series.php
reseller/api.php
reseller/assets
reseller/created_channels.php
reseller/dashboard.php
reseller/edit_profile.php
reseller/enigma.php
reseller/enigmas.php
reseller/epg_view.php
reseller/episodes.php
reseller/functions.php
reseller/index.php
reseller/line.php
reseller/line_activity.php
reseller/lines.php
reseller/live_connections.php
reseller/login.php
reseller/logout.php
reseller/mag.php
reseller/mags.php
reseller/movies.php
reseller/post.php
reseller/radios.php
reseller/resize.php
reseller/session.php
reseller/streams.php
reseller/ticket.php
reseller/ticket_view.php
reseller/tickets.php
reseller/user.php
reseller/user_logs.php
reseller/users.php
resources/data/permissions.php
status
tools
www/api.php
www/enigma2.php
www/epg.php
www/player_api.php
www/playlist.php
www/xplugin.php