Fix patching to prevent doubling up
This commit is contained in:
+7
-6
@@ -44,6 +44,7 @@ fi
|
|||||||
|
|
||||||
SYNCED=0
|
SYNCED=0
|
||||||
FAILED=0
|
FAILED=0
|
||||||
|
SYNCED_PACKAGES=()
|
||||||
|
|
||||||
# Function to sync a package from AUR
|
# Function to sync a package from AUR
|
||||||
sync_package() {
|
sync_package() {
|
||||||
@@ -65,6 +66,7 @@ sync_package() {
|
|||||||
# Remove .git from destination
|
# Remove .git from destination
|
||||||
rm -rf "$PKGBUILDS_DIR/$package/.git"
|
rm -rf "$PKGBUILDS_DIR/$package/.git"
|
||||||
|
|
||||||
|
SYNCED_PACKAGES+=("$package")
|
||||||
((SYNCED++))
|
((SYNCED++))
|
||||||
else
|
else
|
||||||
print_warning "Failed to clone $package (may not exist in AUR)"
|
print_warning "Failed to clone $package (may not exist in AUR)"
|
||||||
@@ -94,12 +96,11 @@ else
|
|||||||
done < <(grep -v "^#" "$PACKAGES_FILE" | grep -v "^$")
|
done < <(grep -v "^#" "$PACKAGES_FILE" | grep -v "^$")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Apply patches for packages that have them
|
# Apply patches only to packages that were actually synced
|
||||||
cd "$PKGBUILDS_DIR"
|
for package in "${SYNCED_PACKAGES[@]}"; do
|
||||||
for dir in */; do
|
if [[ -d "$PKGBUILDS_DIR/$package/patches" ]]; then
|
||||||
if [[ -d "$dir/patches" ]]; then
|
print_info "Applying patches for $package..."
|
||||||
print_info "Applying patches for $dir..."
|
(cd "$PKGBUILDS_DIR/$package" && shopt -s nullglob && for patch in patches/*.patch; do
|
||||||
(cd "$dir" && shopt -s nullglob && for patch in patches/*.patch; do
|
|
||||||
if ! patch -p1 --no-backup-if-mismatch < "$patch"; then
|
if ! patch -p1 --no-backup-if-mismatch < "$patch"; then
|
||||||
print_error "Failed to apply patch: $patch"
|
print_error "Failed to apply patch: $patch"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user