-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-build.sh
More file actions
executable file
·91 lines (72 loc) · 2.06 KB
/
Copy pathtest-build.sh
File metadata and controls
executable file
·91 lines (72 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Test script for debbuilder
# This script demonstrates how to use the debbuilder Docker image
set -e
echo "=== DEB Builder Test Script ==="
# Configuration
IMAGE_NAME="debbuilder:ubuntu-noble"
SOURCE_DIR="$(pwd)/tests"
OUTPUT_DIR="$(pwd)/output"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if Docker is running
if ! docker info >/dev/null 2>&1; then
print_error "Docker is not running. Please start Docker and try again."
exit 1
fi
# Check if source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
print_error "Source directory $SOURCE_DIR does not exist."
exit 1
fi
# Check if debian directory exists in source
if [ ! -d "$SOURCE_DIR/hello/debian" ]; then
print_error "No debian directory found in $SOURCE_DIR/hello"
exit 1
fi
# Check if original tarball exists
if [ ! -f "$SOURCE_DIR/hello_1.0.orig.tar.gz" ]; then
print_warning "Original tarball $SOURCE_DIR/hello_1.0.orig.tar.gz not found"
else
print_status "Found original tarball: $SOURCE_DIR/hello_1.0.orig.tar.gz"
fi
print_status "Building Docker image..."
if ! docker build --tag "$IMAGE_NAME" ubuntu/noble; then
print_error "Failed to build Docker image"
exit 1
fi
print_status "Creating output directory..."
mkdir -p "$OUTPUT_DIR"
print_status "Building package..."
print_status "Source: $SOURCE_DIR"
print_status "Output: $OUTPUT_DIR"
if docker run --rm \
-v "$SOURCE_DIR:/sources" \
-v "$OUTPUT_DIR:/output" \
"$IMAGE_NAME"; then
print_status "Build completed successfully!"
# List output files
if [ -d "$OUTPUT_DIR" ] && [ "$(ls -A "$OUTPUT_DIR")" ]; then
print_status "Generated files:"
ls -la "$OUTPUT_DIR"
else
print_warning "No output files found"
fi
else
print_error "Build failed"
exit 1
fi
print_status "Test completed!"