quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] quilt refresh: Add ability to not break symlinks


From: Jason Wessel
Subject: [Quilt-dev] [PATCH] quilt refresh: Add ability to not break symlinks
Date: Wed, 7 Jan 2015 11:39:12 -0600

This is an 6 year old patch that is still actively used:

http://lists.nongnu.org/archive/html/quilt-dev/2008-01/msg00004.html

Revised again here:

http://comments.gmane.org/gmane.comp.handhelds.openembedded/34224

This patch was then updated to properly work with or without the
--backup option to the quilt refresh by using cat_to_new_file option
instead of mv for refresh. A reference to the QUILT_NO_RM_SYMLINKS was
also added to the usage information for quilt refresh.

Signed-off-by: Jason Wessel <address@hidden>
---
 quilt.quiltrc             |    5 +++++
 quilt/refresh.in          |    6 +++++-
 quilt/scripts/patchfns.in |    8 +++++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/quilt.quiltrc b/quilt.quiltrc
index 58f665e..4155000 100644
--- a/quilt.quiltrc
+++ b/quilt.quiltrc
@@ -35,3 +35,8 @@ QUILT_PATCHES_PREFIX=yes
 # Use a specific editor for quilt (defaults to the value of $EDITOR before
 # sourcing this configuration file, or vi if $EDITOR wasn't set).
 #EDITOR=nedit
+
+#If your patch files are actually symlinks, this option set to yes will allow
+#the symlink to be preserved (resulting in the file the link is pointing to
+#to be refreshed).
+#QUILT_NO_RM_SYMLINKS=yes
diff --git a/quilt/refresh.in b/quilt/refresh.in
index 41d43a7..7cb1505 100644
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -36,6 +36,10 @@ recent patches will be ignored, and only changes in files 
that have not
 been modified by any more recent patches will end up in the specified
 patch.
 
+If the patch file is a symlink to another location the symlink will be
+erased and replaced by a file with the same name unless
+QUILT_NO_RM_SYMLINKS=yes is set in the .quiltrc.
+
 -p n   Create a -p n style patch (-p0 or -p1 supported).
 
 -p ab  Create a -p1 style patch, but use a/file and b/file as the
@@ -324,7 +328,7 @@ if [ -e "$patch_file" ] && \
 then
        printf $"Patch %s is unchanged\n" "$(print_patch "$patch")"
 elif ( [ -z "$QUILT_BACKUP" -o ! -e "$patch_file" ] || \
-       mv "$patch_file" "$patch_file~" ) && \
+       cat_to_new_file "$patch_file~" < "$patch_file" ) && \
      cat_to_new_file "$patch_file" < $tmp_result
 then
        if [ -n "$opt_fork" ]
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 3fa26bb..e176117 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -785,7 +785,13 @@ cat_to_new_file()
 {
        local filename="$1"
 
-       [ -e "$filename" ] && rm -f "$filename"
+       if [ -e "$filename" ]
+       then
+               if [ -L "$filename" -a "$QUILT_NO_RM_SYMLINKS" != "yes" ]
+               then
+                       rm -f "$filename"
+               fi
+       fi
 
        case "$filename" in
        *.gz)
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]