diff options
author | Doug Goldstein <cardoe@gentoo.org> | 2013-08-02 13:25:34 +0000 |
---|---|---|
committer | Doug Goldstein <cardoe@gentoo.org> | 2013-08-02 13:25:34 +0000 |
commit | 8140d8acd6386e30dd432440a2440c9dde97ff44 (patch) | |
tree | 006b82817a9a8985c8ad18a741ddf44d96108355 /sys-devel | |
parent | Version bump. (diff) | |
download | gentoo-2-8140d8acd6386e30dd432440a2440c9dde97ff44.tar.gz gentoo-2-8140d8acd6386e30dd432440a2440c9dde97ff44.tar.bz2 gentoo-2-8140d8acd6386e30dd432440a2440c9dde97ff44.zip |
Fixes to prevent leaving empty directories around when the wrong patch level is used or if --dry-run is specified. bug #478548
(Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key D7DFA8D318FA9AEF!)
Diffstat (limited to 'sys-devel')
5 files changed, 171 insertions, 1 deletions
diff --git a/sys-devel/patch/ChangeLog b/sys-devel/patch/ChangeLog index 8707bf90b5bb..cba6bf676308 100644 --- a/sys-devel/patch/ChangeLog +++ b/sys-devel/patch/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for sys-devel/patch # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/patch/ChangeLog,v 1.63 2013/05/21 17:35:57 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/patch/ChangeLog,v 1.64 2013/08/02 13:25:34 cardoe Exp $ + +*patch-2.7.1-r2 (02 Aug 2013) + + 02 Aug 2013; Doug Goldstein <cardoe@gentoo.org> + +files/patch-2.7.1-Fix-removing-empty-directories-automake.patch, + +files/patch-2.7.1-Fix-removing-empty-directories.patch, + +files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch, + +patch-2.7.1-r2.ebuild: + Fixes to prevent leaving empty directories around when the wrong patch level + is used or if --dry-run is specified. bug #478548 21 May 2013; Mike Frysinger <vapier@gentoo.org> patch-2.7.1-r1.ebuild: Do not let $ED from the EAPI mess up the search for `ed` #470210 by Roman diff --git a/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories-automake.patch b/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories-automake.patch new file mode 100644 index 000000000000..8a6578e7f7cb --- /dev/null +++ b/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories-automake.patch @@ -0,0 +1,25 @@ +Simple patch to prevent sys-devel/patch needing to depend on autotools to +be built, which would likely make stage1 people unhappy. + +By: Doug Goldstein <cardoe@gentoo.org> +Ref: bug #478548 +--- +--- a/tests/Makefile.in 2012-09-28 11:41:32.000000000 -0500 ++++ b/tests/Makefile.in 2013-07-31 07:55:44.879904245 -0500 +@@ -1104,6 +1104,7 @@ + reject-format \ + remember-backup-files \ + remember-reject-files \ ++ remove-directories \ + symlinks \ + unmodified-files + +@@ -1352,6 +1353,8 @@ + @p='remember-backup-files'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) + remember-reject-files.log: remember-reject-files + @p='remember-reject-files'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) ++remove-directories.log: remove-directories ++ @p='remove-directories'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) + symlinks.log: symlinks + @p='symlinks'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) + unmodified-files.log: unmodified-files diff --git a/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories.patch b/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories.patch new file mode 100644 index 000000000000..00193b7ce531 --- /dev/null +++ b/sys-devel/patch/files/patch-2.7.1-Fix-removing-empty-directories.patch @@ -0,0 +1,75 @@ +From 2f40ef66bea54be23a24f616cde021d8d7fc25be Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher <agruen@linbit.com> +Date: Sun, 10 Mar 2013 18:02:54 +0000 +Subject: Fix removing empty directories + +Reported by Thomas Moschny <thomas.moschny@gmx.de>: +src/patch.c (main): Temporary output files are created in the same directory as +the output file. Make sure to remove them before removing empty files and +their empty ancestor directories; else the directories won't be empty. +tests/remove-directories: Add directory removal test case. +tests/Makefile.am (TESTS): Add new test case. +--- +diff --git a/src/patch.c b/src/patch.c +index 0255fbb..010c14a 100644 +--- a/src/patch.c ++++ b/src/patch.c +@@ -646,8 +646,8 @@ main (int argc, char **argv) + if (outstate.ofp && (ferror (outstate.ofp) || fclose (outstate.ofp) != 0)) + write_fatal (); + output_files (NULL); +- delete_files (); + cleanup (); ++ delete_files (); + if (somefailed) + exit (1); + return 0; +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 5cea52d..cfc4f37 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -50,6 +50,7 @@ TESTS = \ + reject-format \ + remember-backup-files \ + remember-reject-files \ ++ remove-directories \ + symlinks \ + unmodified-files + +diff --git a/tests/remove-directories b/tests/remove-directories +new file mode 100644 +index 0000000..6acdc49 +--- a/dev/null ++++ b/tests/remove-directories +@@ -0,0 +1,29 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++# ++# Copying and distribution of this file, with or without modification, ++# in any medium, are permitted without royalty provided the copyright ++# notice and this notice are preserved. ++ ++. $srcdir/test-lib.sh ++ ++require_cat ++use_local_patch ++use_tmpdir ++ ++# ============================================================== ++# Remove empty parent diectories when removing a file ++ ++mkdir dir ++echo foobar > dir/file ++cat > apatch <<EOF ++--- dir/file +++++ /dev/null ++@@ -1 +0,0 @@ ++-foobar ++EOF ++ ++check 'patch -p0 -E < apatch' <<EOF ++patching file dir/file ++EOF ++ ++ncheck '! test -e dir' +-- +cgit v0.9.0.2 diff --git a/sys-devel/patch/files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch b/sys-devel/patch/files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch new file mode 100644 index 000000000000..e0ce04bcacee --- /dev/null +++ b/sys-devel/patch/files/patch-2.7.1-dry-run-mode-create-temp-files-in-temp-dir.patch @@ -0,0 +1,24 @@ +From afdfa9ec8e5f9acea4afaa0db758a4ed752dbe65 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher <agruen@linbit.com> +Date: Tue, 30 Jul 2013 10:46:19 +0000 +Subject: In dry-run mode, create temporary files in a temporary directory + +* src/util.c (make_tempfile): Do not create temporary files in the final output +directory when in dry-run mode: the path may be read-only. In addition, we do +not want to leave intermediary empty output directories around. +--- +diff --git a/src/util.c b/src/util.c +index 1cc1a68..0af6013 100644 +--- a/src/util.c ++++ b/src/util.c +@@ -1599,7 +1599,7 @@ make_tempfile (char const **name, char letter, char const *real_name, + int try_makedirs_errno = ENOENT; + char *template; + +- if (real_name) ++ if (real_name && ! dry_run) + { + char *dirname, *basename; + +-- +cgit v0.9.0.2 diff --git a/sys-devel/patch/patch-2.7.1-r2.ebuild b/sys-devel/patch/patch-2.7.1-r2.ebuild new file mode 100644 index 000000000000..5268e9f048bd --- /dev/null +++ b/sys-devel/patch/patch-2.7.1-r2.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/patch/patch-2.7.1-r2.ebuild,v 1.1 2013/08/02 13:25:34 cardoe Exp $ + +EAPI=4 + +inherit flag-o-matic eutils autotools + +DESCRIPTION="Utility to apply diffs to files" +HOMEPAGE="http://www.gnu.org/software/patch/patch.html" +SRC_URI="mirror://gnu/patch/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="static test xattr" + +RDEPEND="xattr? ( sys-apps/attr )" +DEPEND="${RDEPEND} + test? ( sys-apps/ed )" + +src_prepare() { + epatch "${FILESDIR}/${P}-Fix-removing-empty-directories.patch" + epatch "${FILESDIR}/${P}-Fix-removing-empty-directories-automake.patch" + epatch "${FILESDIR}/${P}-dry-run-mode-create-temp-files-in-temp-dir.patch" +} + +src_configure() { + use static && append-ldflags -static + + # Do not let $ED mess up the search for `ed` 470210. + ac_cv_path_ED=$(type -P ed) \ + econf \ + $(use_enable xattr) \ + --program-prefix="$(use userland_BSD && echo g)" +} |