[Lunar-commits] r27004 - lunar/trunk/var/lib/lunar/plugins
Stefan Wold
ratler at lunar-linux.org
Tue Dec 11 08:39:46 CET 2007
Author: ratler
Date: 2007-12-11 08:39:45 +0100 (Tue, 11 Dec 2007)
New Revision: 27004
Modified:
lunar/trunk/var/lib/lunar/plugins/build-zpatches.plugin
Log:
Removed tabs, whitespaces and reindented my code
Modified: lunar/trunk/var/lib/lunar/plugins/build-zpatches.plugin
===================================================================
--- lunar/trunk/var/lib/lunar/plugins/build-zpatches.plugin 2007-12-10 19:41:12 UTC (rev 27003)
+++ lunar/trunk/var/lib/lunar/plugins/build-zpatches.plugin 2007-12-11 07:39:45 UTC (rev 27004)
@@ -15,66 +15,66 @@
plugin_zpatches_apply()
{
- local PATCHDIRS FPATCH PATCH TARCMD GZCMD TMPFILE1 TMPFILE2
- if [ -d $MOONBASE/zlocal/_patches/$MODULE ]; then
- cd $SOURCE_DIRECTORY
- PATCHDIRS+=" $MOONBASE/zlocal/_patches/$MODULE"
- # Check for version based patch dir
- if [ -d $MOONBASE/zlocal/_patches/$MODULE/$VERSION ]; then
- PATCHDIRS+=" $MOONBASE/zlocal/_patches/$MODULE/$VERSION"
- fi
- # Now find all patches and apply them
- # We also sort them so it possible to apply patch order
+ local PATCHDIRS FPATCH PATCH TARCMD GZCMD TMPFILE1 TMPFILE2
+ if [ -d $MOONBASE/zlocal/_patches/$MODULE ]; then
+ cd $SOURCE_DIRECTORY
+ PATCHDIRS+=" $MOONBASE/zlocal/_patches/$MODULE"
+ # Check for version based patch dir
+ if [ -d $MOONBASE/zlocal/_patches/$MODULE/$VERSION ]; then
+ PATCHDIRS+=" $MOONBASE/zlocal/_patches/$MODULE/$VERSION"
+ fi
+ # Now find all patches and apply them
+ # We also sort them so it possible to apply patch order
# by prefixing a patch with 01, 02, 03 etc
- find $PATCHDIRS -maxdepth 1 -type f | sed 's;[^/]*$;& &;' | sort -t ' ' -k 2 | while read FPATCH PATCH; do
- verbose_msg "Applying custom patch for $MODULE ($PATCH)"
+ find $PATCHDIRS -maxdepth 1 -type f | sed 's;[^/]*$;& &;' | sort -t ' ' -k 2 | while read FPATCH PATCH; do
+ verbose_msg "Applying custom patch for $MODULE ($PATCH)"
- if [[ -n `echo $PATCH | grep '\.tar'` ]] ; then
- TARCMD="tar x -O"
- else
- TARCMD="cat"
- fi
-
- if [[ -n `echo $PATCH | grep '\.bz2$'` ]] ; then
- GZCMD="bzcat"
- elif [[ -n `echo $PATCH | grep '\.gz$'` ]] ; then
- GZCMD="zcat"
- else
- GZCMD="cat"
- fi
-
- TMPFILE1=$(temp_create "zpatch_1")
- TMPFILE2=$(temp_create "zpatch_2")
-
- if $GZCMD $FPATCH > $TMPFILE1 ; then
- # uncompress OK
- if cat $TMPFILE1 | $TARCMD > $TMPFILE2 ; then
- # untar OK
- # Trying -p1 first or else we try -p0
- # An error will be visible if -p1 fail which is normal
- # Only return error if both -p1 and -p0 fail
- patch -p1 -t < $TMPFILE2 || patch -p0 -t < $TMPFILE2
- if [ $? -ne 0 ]; then
- message "${PROBLEM_COLOR}ERROR: Failed to apply ${PATCH} for ${MODULE}${DEFAULT_COLOR}"
- temp_destroy $TMPFILE1
- temp_destroy $TMPFILE2
- return 1
- else
- temp_destroy $TMPFILE1
- temp_destroy $TMPFILE2
- fi
- fi
- fi
- done
- if [ $? != 0 ]; then
- exit 1
- else
- return 2
- fi
+ if [[ -n `echo $PATCH | grep '\.tar'` ]] ; then
+ TARCMD="tar x -O"
+ else
+ TARCMD="cat"
+ fi
+
+ if [[ -n `echo $PATCH | grep '\.bz2$'` ]] ; then
+ GZCMD="bzcat"
+ elif [[ -n `echo $PATCH | grep '\.gz$'` ]] ; then
+ GZCMD="zcat"
+ else
+ GZCMD="cat"
+ fi
+
+ TMPFILE1=$(temp_create "zpatch_1")
+ TMPFILE2=$(temp_create "zpatch_2")
+
+ if $GZCMD $FPATCH > $TMPFILE1 ; then
+ # uncompress OK
+ if cat $TMPFILE1 | $TARCMD > $TMPFILE2 ; then
+ # untar OK
+ # Trying -p1 first or else we try -p0
+ # An error will be visible if -p1 fail which is normal
+ # Only return error if both -p1 and -p0 fail
+ patch -p1 -t < $TMPFILE2 || patch -p0 -t < $TMPFILE2
+ if [ $? -ne 0 ]; then
+ message "${PROBLEM_COLOR}ERROR: Failed to apply ${PATCH} for ${MODULE}${DEFAULT_COLOR}"
+ temp_destroy $TMPFILE1
+ temp_destroy $TMPFILE2
+ return 1
+ else
+ temp_destroy $TMPFILE1
+ temp_destroy $TMPFILE2
+ fi
+ fi
+ fi
+ done
+ if [ $? != 0 ]; then
+ exit 1
else
- # No patchdir for that module found just continue
- return 2
+ return 2
fi
+ else
+ # No patchdir for that module found just continue
+ return 2
+ fi
}
plugin_register BUILD_BUILD plugin_zpatches_apply
More information about the Lunar-commits
mailing list