From 91f3748d86e5df5b3960a191163dce65d5114852 Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Tue, 14 Jul 2026 11:38:08 -0400 Subject: [PATCH] Enhance build script with detailed logging for package creation and restore processes --- build-linux-packages.sh | 48 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/build-linux-packages.sh b/build-linux-packages.sh index 70e390b0..cc593db4 100755 --- a/build-linux-packages.sh +++ b/build-linux-packages.sh @@ -70,6 +70,12 @@ fi PUBLISH_DIR="/tmp/jellyfin-publish-$$" BUILD_OUTPUT_DIR="${PROJECT_ROOT}/build/packages" TEMP_DIR="/tmp/jellyfin-build-$$" +mkdir -p "$TEMP_DIR" + +# Log files +RESTORE_LOG="$TEMP_DIR/restore.log" +BUILD_LOG="$TEMP_DIR/build.log" +PUBLISH_LOG="$TEMP_DIR/publish.log" # Color output RED='\033[0;31m' @@ -147,14 +153,22 @@ print_step "Publishing application for linux-x64..." cd "$PROJECT_ROOT" -if ! dotnet restore Jellyfin.sln -r linux-x64 > /dev/null 2>&1; then +if ! dotnet restore Jellyfin.sln -r linux-x64 > "$RESTORE_LOG" 2>&1; then print_error "dotnet restore failed" + if [ -s "$RESTORE_LOG" ]; then + print_error "Error output:" + tail -30 "$RESTORE_LOG" + fi exit 1 fi print_success "Dependencies restored" -if ! dotnet build Jellyfin.sln --configuration Release > /dev/null 2>&1; then +if ! dotnet build Jellyfin.sln --configuration Release > "$BUILD_LOG" 2>&1; then print_error "dotnet build failed" + if [ -s "$BUILD_LOG" ]; then + print_error "Error output (last 50 lines):" + tail -50 "$BUILD_LOG" + fi exit 1 fi print_success "Solution built in Release configuration" @@ -163,8 +177,12 @@ if ! dotnet publish Jellyfin.Server/Jellyfin.Server.csproj \ --configuration Release \ --self-contained true \ --runtime linux-x64 \ - --output "$PUBLISH_DIR" > /dev/null 2>&1; then + --output "$PUBLISH_DIR" > "$PUBLISH_LOG" 2>&1; then print_error "dotnet publish failed" + if [ -s "$PUBLISH_LOG" ]; then + print_error "Error output (last 50 lines):" + tail -50 "$PUBLISH_LOG" + fi exit 1 fi print_success "Published to $PUBLISH_DIR" @@ -178,6 +196,7 @@ if [ "$BUILD_DEB" = true ]; then print_step "Building Debian package..." DEB_OUTPUT="$BUILD_OUTPUT_DIR/jellyfin-${VERSION}-amd64.deb" + DEB_LOG="$TEMP_DIR/deb.log" if fpm \ -s dir \ @@ -197,12 +216,16 @@ if [ "$BUILD_DEB" = true ]; then --after-remove "${PROJECT_ROOT}/scripts/debian/postrm.sh" \ -C "$PUBLISH_DIR" \ -p "$DEB_OUTPUT" \ - opt/=opt/jellyfin > /dev/null 2>&1; then + opt/=opt/jellyfin > "$DEB_LOG" 2>&1; then print_success "Created: jellyfin-${VERSION}-amd64.deb" DEB_SIZE=$(du -h "$DEB_OUTPUT" | cut -f1) print_info "Size: $DEB_SIZE" else print_error "Failed to create Debian package" + if [ -s "$DEB_LOG" ]; then + print_error "Error output:" + tail -20 "$DEB_LOG" + fi exit 1 fi fi @@ -212,6 +235,7 @@ if [ "$BUILD_RPM" = true ]; then print_step "Building Red Hat package..." RPM_OUTPUT="$BUILD_OUTPUT_DIR/jellyfin-${VERSION}-1.x86_64.rpm" + RPM_LOG="$TEMP_DIR/rpm.log" if fpm \ -s dir \ @@ -231,12 +255,16 @@ if [ "$BUILD_RPM" = true ]; then --after-remove "${PROJECT_ROOT}/scripts/redhat/postun.sh" \ -C "$PUBLISH_DIR" \ -p "$RPM_OUTPUT" \ - opt/=opt/jellyfin > /dev/null 2>&1; then + opt/=opt/jellyfin > "$RPM_LOG" 2>&1; then print_success "Created: jellyfin-${VERSION}-1.x86_64.rpm" RPM_SIZE=$(du -h "$RPM_OUTPUT" | cut -f1) print_info "Size: $RPM_SIZE" else print_error "Failed to create Red Hat package" + if [ -s "$RPM_LOG" ]; then + print_error "Error output:" + tail -20 "$RPM_LOG" + fi exit 1 fi fi @@ -259,4 +287,14 @@ echo -e "${BLUE}╠════════════════════ echo -e "${BLUE}║${NC} Next steps:" echo -e "${BLUE}║${NC} Debian: sudo dpkg -i jellyfin-${VERSION}-amd64.deb" echo -e "${BLUE}║${NC} Red Hat: sudo dnf install jellyfin-${VERSION}-1.x86_64.rpm" +echo -e "${BLUE}╠═══════════════════════════════════════════════════════════════╣${NC}" +echo -e "${BLUE}║${NC} Build logs (if errors occurred):" +echo -e "${BLUE}║${NC} $TEMP_DIR" +echo -e "${BLUE}║${NC}" +echo -e "${BLUE}║${NC} Log files:" +echo -e "${BLUE}║${NC} restore.log - dotnet restore output" +echo -e "${BLUE}║${NC} build.log - dotnet build output" +echo -e "${BLUE}║${NC} publish.log - dotnet publish output" +echo -e "${BLUE}║${NC} deb.log - Debian package creation output" +echo -e "${BLUE}║${NC} rpm.log - Red Hat package creation output" echo -e "${BLUE}╚═══════════════════════════════════════════════════════════════╝${NC}"