From 0c5963d09d70bcf79aa40e1d3e7a69345444cca7 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 17 Jun 2008 07:15:36 +0300 Subject: [PATCH] dpkg-divert: Support diverting files from and to different file systems Based on a patch by Juergen Kreileder. Closes: #102144, #149961 --- ChangeLog | 6 ++++++ debian/changelog | 2 ++ scripts/dpkg-divert.pl | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cf90cee4..b4edc4a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-17 Juergen Kreileder , + Guillem Jover + + * scripts/dpkg-divert.pl (rename_mv): New function. + (dorename): Use rename_mv instead of rename. + 2008-06-10 Guillem Jover * lib/varbuf.c (varbufvprintf): Call va_end when done with the va_list diff --git a/debian/changelog b/debian/changelog index 41d47503..d071ec6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low inherited by the childs. Closes: #471488 * Add '.hgignore' to the default dpkg-source -i regex and -I pattern. Closes: #485365 + * Support diverting files when origin and destination are on different file + systems. Based on a patch by Juergen Kreileder. Closes: #102144, #149961 [ Raphael Hertzog ] * Enhance dpkg-shlibdeps's error message when a library can't be found to diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl index 56257ed3..d6500d80 100755 --- a/scripts/dpkg-divert.pl +++ b/scripts/dpkg-divert.pl @@ -264,6 +264,11 @@ sub checkrename { } } +sub rename_mv($$) +{ + return (rename($_[0], $_[1]) || (system(("mv", $_[0], $_[1])) == 0)); +} + sub dorename { return unless $dorename; return if $testmode; @@ -271,7 +276,8 @@ sub dorename { if (@sdest) { unlink($rsrc) || &quit(sprintf(_g("rename: remove duplicate old link \`%s': %s"), $rsrc, $!)); } else { - rename($rsrc,$rdest) || &quit(sprintf(_g("rename: rename \`%s' to \`%s': %s"), $rsrc, $rdest, $!)); + rename_mv($rsrc, $rdest) || + quit(sprintf(_g("rename: rename \`%s' to \`%s': %s"), $rsrc, $rdest, $!)); } } } -- 2.39.5