From patchwork Sat Feb 12 15:48:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Wildenhues X-Patchwork-Id: 82931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id EF9C5B711F for ; Sun, 13 Feb 2011 02:48:58 +1100 (EST) Received: (qmail 29152 invoked by alias); 12 Feb 2011 15:48:52 -0000 Received: (qmail 29122 invoked by uid 22791); 12 Feb 2011 15:48:50 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_WW X-Spam-Check-By: sourceware.org Received: from mailout-de.gmx.net (HELO mailout-de.gmx.net) (213.165.64.23) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sat, 12 Feb 2011 15:48:45 +0000 Received: (qmail invoked by alias); 12 Feb 2011 15:48:42 -0000 Received: from xdsl-78-35-52-232.netcologne.de (EHLO localhost.localdomain) [78.35.52.232] by mail.gmx.net (mp005) with SMTP; 12 Feb 2011 16:48:42 +0100 Received: from ralf by localhost.localdomain with local (Exim 4.69) (envelope-from ) id 1PoHiC-0000rv-R9; Sat, 12 Feb 2011 16:48:40 +0100 Date: Sat, 12 Feb 2011 16:48:40 +0100 From: Ralf Wildenhues To: Steve Ellcey , gcc-patches@gcc.gnu.org, Gerald Pfeifer , binutils@sourceware.org, "H.J. Lu" Subject: Re: PATCH: import move-if-change from gnulib (was: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build) Message-ID: <20110212154840.GD6773@gmx.de> Mail-Followup-To: Ralf Wildenhues , Steve Ellcey , gcc-patches@gcc.gnu.org, Gerald Pfeifer , binutils@sourceware.org, "H.J. Lu" References: <201101272357.p0RNvPZ13996@lucas.cup.hp.com> <20110128201452.GM7234@gmx.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110128201452.GM7234@gmx.de> User-Agent: Mutt/1.5.20 (2010-08-04) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org * Ralf Wildenhues wrote on Fri, Jan 28, 2011 at 09:14:52PM CET: > I hereby propose to just import the gnulib copy into GCC and src, > http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/move-if-change > and document the change in status as below in patches to src/MAINTAINERS > and GCC www. (The Autoconf copy of move-if-change has been updated from > the gnulib one anyway.) > > Any reasons against doing so? Nobody complained, so I'm importing move-if-change from gnulib in GCC and src now, to fix this half of the problem in the PR. The wwwdocs change has been approved off-list. Thanks, Ralf Import move-if-change script from gnulib. /: PR binutils/12283 * move-if-change: Import version from gnulib. diff --git a/move-if-change b/move-if-change index ff74a55..e7ba25e 100755 --- a/move-if-change +++ b/move-if-change @@ -2,21 +2,82 @@ # Like mv $1 $2, but if the files are the same, just delete $1. # Status is zero if successful, nonzero otherwise. -usage="$0: usage: $0 SOURCE DEST" +VERSION='2011-01-28 20:09'; # UTC +# The definition above must lie within the first 8 lines in order +# for the Emacs time-stamp write hook (at end) to update it. +# If you change this file with Emacs, please let the write hook +# do its job. Otherwise, update this string manually. -case $# in -2) ;; -*) echo "$usage" >&2; exit 1;; -esac +# Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. -for arg in "$1" "$2"; do +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +usage="usage: $0 SOURCE DEST" + +help="$usage + or: $0 OPTION +If SOURCE is different than DEST, then move it to DEST; else remove SOURCE. + + --help display this help and exit + --version output version information and exit + +The variable CMPPROG can be used to specify an alternative to \`cmp'. + +Report bugs to ." + +version=`expr "$VERSION" : '\([^ ]*\)'` +version="move-if-change (gnulib) $version +Copyright (C) 2011 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + +cmpprog=${CMPPROG-cmp} + +for arg +do case $arg in - -*) echo "$usage" >&2; exit 1;; + --help | --hel | --he | --h) + exec echo "$help" ;; + --version | --versio | --versi | --vers | --ver | --ve | --v) + exec echo "$version" ;; + --) + shift + break ;; + -*) + echo "$0: invalid option: $arg" >&2 + exit 1 ;; + *) + break ;; esac done -if test -r "$2" && cmp -s "$1" "$2"; then - rm -f "$1" +test $# -eq 2 || { echo "$0: $usage" >&2; exit 1; } + +if test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null; then + rm -f -- "$1" else - mv -f "$1" "$2" + if mv -f -- "$1" "$2"; then :; else + # Ignore failure due to a concurrent move-if-change. + test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null && rm -f -- "$1" + fi fi + +## Local Variables: +## eval: (add-hook 'write-file-hooks 'time-stamp) +## time-stamp-start: "VERSION='" +## time-stamp-format: "%:y-%02m-%02d %02H:%02M" +## time-stamp-time-zone: "UTC" +## time-stamp-end: "'; # UTC" +## End: