From 61de338d660493433c4b081937d60e9eaa5f22ba Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Sat, 22 Nov 2025 12:08:08 +0200 Subject: [PATCH] fix: explicitly save output directory and add build diagnostics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous build-deb function relied on $OLDPWD which may not work correctly in all environments. This fix: 1. Explicitly saves OUTPUT_DIR before changing directories 2. Adds diagnostic output showing build area and output paths 3. Shows what packages were built before moving them 4. Verifies files exist after moving them 5. Provides warnings instead of silently ignoring failures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- run | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/run b/run index 9c7884c..e36c867 100755 --- a/run +++ b/run @@ -109,11 +109,17 @@ function build-deb { #@ Category: Package Management echo "🏗️ Building Debian package..." + # Save output directory explicitly (don't rely on $OLDPWD) + OUTPUT_DIR="$PWD" + # Create a build area with the project as a subdirectory # This allows dpkg-buildpackage to write to the parent directory BUILD_AREA=$(mktemp -d) PROJECT_NAME=$(basename "$PWD") + echo "📁 Build area: $BUILD_AREA" + echo "📁 Output dir: $OUTPUT_DIR" + # Copy source to build area cp -a . "$BUILD_AREA/$PROJECT_NAME" cd "$BUILD_AREA/$PROJECT_NAME" @@ -122,8 +128,19 @@ function build-deb { uv sync dpkg-buildpackage -us -uc -b + # List what was built + echo "📦 Built packages:" + ls -la "$BUILD_AREA"/*.deb "$BUILD_AREA"/*.buildinfo "$BUILD_AREA"/*.changes 2>/dev/null || echo "Warning: No packages found in $BUILD_AREA" + # Move artifacts back to original directory - mv "$BUILD_AREA"/*.deb "$BUILD_AREA"/*.buildinfo "$BUILD_AREA"/*.changes "$OLDPWD/" 2>/dev/null || true + echo "📦 Moving packages to $OUTPUT_DIR..." + mv "$BUILD_AREA"/*.deb "$OUTPUT_DIR/" 2>/dev/null || echo "Warning: Failed to move .deb files" + mv "$BUILD_AREA"/*.buildinfo "$OUTPUT_DIR/" 2>/dev/null || echo "Warning: Failed to move .buildinfo files" + mv "$BUILD_AREA"/*.changes "$OUTPUT_DIR/" 2>/dev/null || echo "Warning: Failed to move .changes files" + + # Verify files exist in output directory + echo "📦 Verifying packages in $OUTPUT_DIR:" + ls -la "$OUTPUT_DIR"/*.deb 2>/dev/null || echo "Warning: No .deb files in $OUTPUT_DIR" # Cleanup rm -rf "$BUILD_AREA"