diff options
author | hubertf <hubertf> | 2001-01-17 23:16:44 +0000 |
---|---|---|
committer | hubertf <hubertf> | 2001-01-17 23:16:44 +0000 |
commit | eff127a98332f0dd6008b83c3013334f09664a4d (patch) | |
tree | 42368226ffe31e0c33948329c28bfdee63f847aa /pkgtools/pkgdiff | |
parent | 067180e09598c5d4d86336467aa5173a76f38ef2 (diff) | |
download | pkgsrc-eff127a98332f0dd6008b83c3013334f09664a4d.tar.gz |
Update to 0.96: Add pkgvi, a wrapper that cares to backup files before you
modify them (and that also handles unmodified files in a sane way by deleting
backup files that had no changes).
The pkgvi utility was contributed by Tomasz Luchowski <zuntum@eik.pl>
Diffstat (limited to 'pkgtools/pkgdiff')
-rw-r--r-- | pkgtools/pkgdiff/Makefile | 11 | ||||
-rwxr-xr-x | pkgtools/pkgdiff/files/pkgvi | 99 | ||||
-rw-r--r-- | pkgtools/pkgdiff/files/pkgvi.1 | 68 | ||||
-rw-r--r-- | pkgtools/pkgdiff/pkg/COMMENT | 2 | ||||
-rw-r--r-- | pkgtools/pkgdiff/pkg/DESCR | 3 | ||||
-rw-r--r-- | pkgtools/pkgdiff/pkg/PLIST | 4 |
6 files changed, 180 insertions, 7 deletions
diff --git a/pkgtools/pkgdiff/Makefile b/pkgtools/pkgdiff/Makefile index c107a6107b1..ee4b718b384 100644 --- a/pkgtools/pkgdiff/Makefile +++ b/pkgtools/pkgdiff/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.6 2000/08/26 04:40:28 hubertf Exp $ +# $NetBSD: Makefile,v 1.7 2001/01/17 23:16:44 hubertf Exp $ # -DISTNAME= pkgdiff-0.95 +DISTNAME= pkgdiff-0.96 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty @@ -29,13 +29,14 @@ NROFF= nroff .endif do-build: -.for FILE in mkpatches patchdiff +.for FILE in mkpatches patchdiff ${SED} -e 's|@PREFIX@|${PREFIX}|g' \ < ${FILESDIR}/${FILE}.pl \ > ${WRKSRC}/${FILE} .endfor ${CP} ${FILESDIR}/pkgdiff ${WRKSRC} -.for FILE in mkpatches patchdiff pkgdiff + ${CP} ${FILESDIR}/pkgvi ${WRKSRC} +.for FILE in mkpatches patchdiff pkgdiff pkgvi ${SED} -e 's|@PREFIX@|${PREFIX}|g' \ < ${FILESDIR}/${FILE}.1 \ > ${WRKSRC}/${FILE}.1 @@ -43,7 +44,7 @@ do-build: .endfor do-install: -.for FILE in mkpatches patchdiff pkgdiff +.for FILE in mkpatches patchdiff pkgdiff pkgvi ${INSTALL_SCRIPT} ${WRKSRC}/${FILE} ${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/${FILE}.0 ${PREFIX}/man/cat1 ${INSTALL_MAN} ${WRKSRC}/${FILE}.1 ${PREFIX}/man/man1 diff --git a/pkgtools/pkgdiff/files/pkgvi b/pkgtools/pkgdiff/files/pkgvi new file mode 100755 index 00000000000..6523078a2ea --- /dev/null +++ b/pkgtools/pkgdiff/files/pkgvi @@ -0,0 +1,99 @@ +#!/bin/sh +# $NetBSD: pkgvi,v 1.1 2001/01/17 23:16:46 hubertf Exp $ +# +# Copyright (c) 2001 Tomasz Luchowski. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Tomasz Luchowski for +# the NetBSD Project +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# +# Usage: pkgvi file +# +# The pkgvi utility runs user's favourite editor (it uses $PKG_EDITOR if +# defined, then it looks for $EDITOR, if none is defined, it uses vi) on +# copy of specified file. If no changes are made in the editor, nothing +# happens, else original file is stored as $filename.orig, and modified +# file is saved as $filename. If it founds $filename.orig, it behaves as +# normal editor. +# +# - Tomasz Luchowski <zuntum@eik.pl> +# + +if [ "$PKGEDITOR" != "" ]; then + editor="$PKGEDITOR" +elif [ "$EDITOR" != "" ]; then + editor="$EDITOR" +else + editor="vi" +fi + +progname=`basename $0` + +if [ $# -eq 0 ] +then + echo echo Usage: $progname file >&2 + exit 1 +fi + +file="$1" +tmp="$file.tmp" + +if [ ! -f "$file" ] +then + echo "$progname: $file: No such file" + exit 2 +fi + +if [ -f $file.orig ] +then + $EDITOR $file + echo "$progname: Backup already exists, for a diff type:" + echo "pkgdiff $file" + exit 0 +fi + +tmp="$file.$$" + +cp $file $tmp + +$EDITOR $tmp + +if cmp $file $tmp 2>&1 >/dev/null +then + echo File unchanged. +else + mv $file $file.orig + mv $tmp $file + echo $progname: File was modified. For a diff, type: + echo pkgdiff $file +fi + +if [ -f $tmp ] +then + rm $tmp +fi diff --git a/pkgtools/pkgdiff/files/pkgvi.1 b/pkgtools/pkgdiff/files/pkgvi.1 new file mode 100644 index 00000000000..299fa117f24 --- /dev/null +++ b/pkgtools/pkgdiff/files/pkgvi.1 @@ -0,0 +1,68 @@ +.\" $NetBSD: pkgvi.1,v 1.1 2001/01/17 23:16:46 hubertf Exp $ +.\" +.\" Copyright (c) 2001 Tomasz Luchowski. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Tomasz Luchowski +.\" for the NetBSD Project +.\" 4. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" + +.Dd Jan 17, 2001 +.Dt pkgvi 1 +.Os +.Sh NAME +.Nm pkgvi +.Nd run editor and make backup if file is modified +.Sh SYNOPSIS +.Nm +.Ar file +.Sh DESCRIPTION +The +.Nm +utility runs the user's favourite editor +on a copy of specified file. +If no changes are made in the editor, nothing happens. +Else the original file is kept as +.Pa filename.orig , +and the modified file +is saved as +.Pa filename. +If +.Nm +finds +.Pa filename.orig , +it behaves as normal editor and changes are only made to +.Pa filename . +.Sh ENVIRONMENT +.Nm +uses $PKG_EDITOR if defined, then it looks for $EDITOR, +and if none is defined, it uses +.Xr vi 1 . +.Pp +.Sh SEE ALSO +.Xr pkgdiff 1 , +.Sh AUTHOR +The pkgvi utility was written by Tomasz Luchowski <zuntum@eik.pl>. diff --git a/pkgtools/pkgdiff/pkg/COMMENT b/pkgtools/pkgdiff/pkg/COMMENT index 34ab28474ca..dbcabc066db 100644 --- a/pkgtools/pkgdiff/pkg/COMMENT +++ b/pkgtools/pkgdiff/pkg/COMMENT @@ -1 +1 @@ -tools to ease creating and maintaining patches for pkgsrc +Tools to ease creating and maintaining patches for pkgsrc diff --git a/pkgtools/pkgdiff/pkg/DESCR b/pkgtools/pkgdiff/pkg/DESCR index af98c238b37..e895ef6356d 100644 --- a/pkgtools/pkgdiff/pkg/DESCR +++ b/pkgtools/pkgdiff/pkg/DESCR @@ -9,3 +9,6 @@ versions of the files had been saved as filename.orig. patchdiff compares a previously existing set of patches with another one created by mkpatches, and outputs any changes. + +pkgvi makes backup copies if a file is changed, so pkgdiff can be run +on it later, generating a patch for the changes made. diff --git a/pkgtools/pkgdiff/pkg/PLIST b/pkgtools/pkgdiff/pkg/PLIST index bae5c2448bf..058f3b70782 100644 --- a/pkgtools/pkgdiff/pkg/PLIST +++ b/pkgtools/pkgdiff/pkg/PLIST @@ -1,10 +1,12 @@ -@comment $NetBSD: PLIST,v 1.1.1.1 2000/06/28 01:42:43 wiz Exp $ +@comment $NetBSD: PLIST,v 1.2 2001/01/17 23:16:48 hubertf Exp $ bin/mkpatches bin/patchdiff bin/pkgdiff +bin/pkgvi man/cat1/mkpatches.0 man/cat1/patchdiff.0 man/cat1/pkgdiff.0 man/man1/mkpatches.1 man/man1/patchdiff.1 man/man1/pkgdiff.1 +man/man1/pkgvi.1 |