NetBSD-Users archive

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

Re: Switching to another pkgsrc repository



    Date:        Mon, 6 May 2019 01:15:46 -0400
    From:        Bob Bernstein <poobah%ruptured-duck.com@localhost>
    Message-ID:  <20190506051546.GA20307@debian.localdomain>

  | Somehow I like the cp idea. If I understand, any needed 
  | new instances of the CVS/ROOT file will be provided by my 
  | new repository, and not require any tweaking, yes?

By cvs when it fetched the new directories, yes.   No tweaking needed
unl;ess you want to switch to some different repo (and note, only switching
between mirror repos will work properly this way).

  | I don't feel competent to author a shell script

Shell scripts are just the commands you would type into any shell, but put
in a file instead..

  | Can someone suggest what would work?

The first thing you need is to get pkgsrc/CVS/Root correct.   I don't
use anoncvs (I have made mirror copies of it and used them instead, but
by doing that the value I have in Root is different than you will want).
But I am sure someone can tell you.

Then you could use something like

	#! /bin/sh

	v=
	while getopts p opt
	do
		case "$opt" in
		v)	v=-print;;
		*)	printf "Usage: $0 [-v] directory\n" >&2
			exit 1
			;;
		esac
	done
	shift $((OPTIND - 1))

	test "$#" -eq 1 || {
		printf "Usage: $0 [-v] directory\n" >&2
		exit 1
	}
	cd "$1" || exit 1
	test -s CVS/Root || {
		printf "No CVS/Root in $1\n" >&2
		exit 1
	}
	printf "Will update tree at %s to use %s\nOK ? " \
			"$1" "$(cat CVS/Root)"
	read ans || exit 1
	case "$ans" in
	[yY]*)	;;
	*)	exit 1;
	esac

	find . \( -path ./CVS -prune \) -o \
		\( -path '*/CVS/Root' $v -exec cp CVS/Root {} \; \)

All but the final (wrapped) line is just error checking etc...

Put that (minue the leading tab) in a file (pick a name) and run
it as
	sh name /path/to/pkgsrc/tree/to/change

after having updated the CVS/Root file first.   Or add the -v flag
between name and the path and it will print each file name as it
is updated (which could also be done using cp's -v switch rather
than find's -print).   You can also turn on execute permission on
the file and put it somewhere in your $PATH and just run "name"
as a command if you like.   (I hope it is obvious that "name" in
all of this is the filename you picked - using "name" literally
would be a bizarrely weird choice).

kre



Home | Main Index | Thread Index | Old Index