Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2011 20:59:43 +0200
From:      Ion-Mihai Tetcu <itetcu@FreeBSD.org>
To:        Paul Schmehl <pschmehl_lists@tx.rr.com>
Cc:        FreeBSD Ports List <freebsd-ports@freebsd.org>
Subject:   Re: Elegant way to update a port
Message-ID:  <20110126205943.7b02955f@it.buh.tecnik93.com>
In-Reply-To: <2803111BDBB788987004203B@utd71538.local>
References:  <14ABF90A75B2E8D595363A7F@utd71538.local> <20110126201818.5b5f1364@it.buh.tecnik93.com> <2803111BDBB788987004203B@utd71538.local>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/1=7eHFmXwNIhATv3U1/vufg
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Wed, 26 Jan 2011 12:31:37 -0600
Paul Schmehl <pschmehl_lists@tx.rr.com> wrote:

> --On January 26, 2011 8:18:18 PM +0200 Ion-Mihai Tetcu
> <itetcu@FreeBSD.org> wrote:
>=20
> > On Wed, 26 Jan 2011 10:32:51 -0600
> > Paul Schmehl <pschmehl_lists@tx.rr.com> wrote:
> >
> >> A while ago someone posted a url to a website that explained, step
> >> by step, how to update a port using cvs and a temporary directory
> >> for the updated port.  My google foo apparently isn't very good,
> >> because I can't seem to find it, and I forgot to bookmark it.
> >>
> >> Does anyone know what I'm referring to?  I really like that way of
> >> updating my ports.
> >
> > http://ionut.tetcu.info/FreeBSD//How-to-submit-a-diff.txt
> > Maybe this one?
>=20
> Yes!  That was it.  And thank for the wonderful resource.

Glad to be of service :) It also makes my job as a committer easier.

Back before I was a committer, I was keeping my ports in my CVS, and I
was importing the version in ports a vendor branch with something like
this this scripts are really old, and un-maintained, but may they give
you some ideas) :


#!/bin/sh
##############
# $Tecnik: people/itetcu/ports/scripts/imPORT.sh,v 1.11 2008/03/27 12:27:25=
 itetcu Exp $
#

# $1 should be a module (port)
#

PC=3D`dirname $0`
echo ${PC}
. ${PC}/PORT.common

echo "=3D=3D=3D=3D> Checking if you already have $1 in local CVS"

cvs -q ${L_CVS_ROOT} co modules || { MERR=3D"Can't co modules" && merror; }
grep "^$1" modules/modules && STATUS=3D"Import" || STATUS=3D"Initial import"
echo "=3D=3D> ${STATUS}"

echo "=3D=3D=3D=3D> Getting $1 from FPT repo"
cvs -q ${R_CVS_ROOT} co $1 || { MERR=3D"Can't co port from FPT" && merror; }
# check for included files
DEPD=3D$1 && expdep

# get category and PORT* and construct CVS-safe string from them
cd $1

CATEGORY=3D`make -V CATEGORIES | cut -d' ' -f1`
[ -z ${CATEGORY} ] && { MERR=3D"Can't get teh CATEGORY; problem in Makefile=
 ?" && merror; }
PORTVERSION=3D`make -V PORTVERSION`
PRT_V_T=3D`echo ${PORTVERSION} | sed 's/\./_/g`
grep -q '^PORTREVISION' Makefile && \
        PORTREVISION=3D`make -V PORTREVISION` && PRT_R=3D"__${PORTREVISION}"
grep -q '^PORTEPOCH' Makefile && \
        PORTEPOCH=3D`make -V PORTEPOCH` && PRT_E=3D",${PORTEPOCH}" && \
                                        PRT_E_T=3D"-${PORTEPOCH}"

CMT_MSG=3D"${STATUS} from FPT of ${CATEGORY}/$1: $1-${PORTVERSION}${PRT_R}$=
{PRT_E}"
REPO=3D"ports/${CATEGORY}/$1"
REL_TAG=3D"$1-${PRT_V_T}${PRT_R}${PRT_E_T}"
echo "=3D=3D=3D=3D> ${CMT_MSG}, with tag: ${REL_TAG}"
read -p "Go on [y/n] ?" GOON
if [ "x${GOON}" =3D "xy" ]; then
        cvs ${L_CVS_ROOT} import -m "${CMT_MSG}" ${REPO} FPT ${REL_TAG} || =
exit 1
else    exit 1
fi

cd ../

# If doing an initial import we have to add the module and the PRlog
if [ "x${STATUS}" !=3D "xImport" ]; then
        # add the module and invoke user's editor to sort and ci
        echo "$1 ${REPO}" >> modules/modules
        ${EDITOR} modules/modules
        cvs -q ${L_CVS_ROOT} ci -m "$1 --> ${REPO}" modules/modules
        cvs release -d modules
        # Add PRlog file; for this to work:
        #  the dir should be like: people/USER/ports/PRlogs/
        # and local user should match cvs user
        PRlog_DIR=3D"people/`id -un`/ports/PRlogs"
        cvs -q ${L_CVS_ROOT} co ${PRlog_DIR}
        cd ${PRlog_DIR}
        touch $1
        cvs -q ${L_CVS_ROOT} add $1
        cvs -q ${L_CVS_ROOT} ci  -m "Add PRlog file for $1" $1
        cd ../../../../
        cvs -q ${L_CVS_ROOT} release -d ${PRlog_DIR}
fi
cd /tmp
rm -r `dirname ${MTMP}`



 > m tmp/TCVS/people/itetcu/ports/scripts/PORT.common
merror () {
        echo "=3D=3D=3D=3D> ${MERR}"
        echo "=3D=3D=3D=3D> Tmp dir: ${MTMP}"
        exit 1
}

# checks and defaults
[ $# -eq 1 ] || exit 1

#if [ "x${HOST}" =3D "xit.buh.tecnik93.com" ]; then
#       L_CVS_ROOT=3D"-d /home/ncvs"
#else
        export CVS_RSH=3Dssh
        L_CVS_ROOT=3D"-z 9 -d `id -un`@cvs.tecnik93.com:/home/ncvs"
#fi
R_CVS_ROOT=3D"-z 9 -d itetcu@pcvs.FreeBSD.org:/home/pcvs/"

# our tmp dir
mkdir -p /tmp/CVS/$1/
MTMP=3D`mktemp -d /tmp/CVS/$1/$1.XXX` || exit 1
#[ -e "/tmp/CVS/$1" ] && MERR=3D"/tmp/CVS/$1 exists, exiting ..." && merror
#mkdir -p /tmp/CVS/$1
echo "tmp dir: ${MTMP}"
cd ${MTMP}

# check to see if this module's Makefile includes something from an other
#  if yes export that module also so the relative path is right
expdep () {
pwd
#echo ${DEPD}
DEP_MODS=3D`egrep '^\.include' ${DEPD}/Makefile | grep -v "bsd.port" | sed =
's,.include "${.CURDIR}/../../,,; s/"//'`
echo ${DEP_MODS}
if [ -n ${DEP_MODS} ]; then
        for dep_mod in ${DEP_MODS}; do
#               DEP_MOD_DIR=3D`echo ${dep_mod} | sed -E 's,/[a-zA-Z0-9_.-]+=
$,,'`
                DEP_MOD_DIR=3D`dirname ${dep_mod}`
                mkdir -p `dirname ${MTMP}`/`dirname ${DEP_MOD_DIR}`
#               cvs -q ${L_CVS_ROOT} ex -Dnow -d `dirname ${MTMP}`/`dirname=
 ${dep_mod}` ports/${dep_mod}
                _O_PWD=3D`pwd`
#               cd `dirname ${MTMP}`/`dirname ${DEP_MOD_DIR}` && \
                cd ${MTMP}/${DEP_MOD_DIR} .. && \
                        cvs -q ${L_CVS_ROOT} ex -Dnow -d `basename ${DEP_MO=
D_DIR}` ports/${dep_mod} || \
                        (MERR=3D"Could not export ${dep_mod}" && merror)
                cd ${_O_PWD}
        pwd
        done
fi
}


 > m tmp/TCVS/people/itetcu/ports/scripts/newPR.sh
#!/bin/sh
##############
# $Tecnik: people/itetcu/ports/scripts/newPR.sh,v 1.30 2006/04/25 14:13:27 =
itetcu Exp $
#

# $1 should be a module (port)
#

clean_up() {
        cd /tmp/CVS
        rm -r ${MTMP}
        exit 1
}

PC=3D`dirname $0`
if [ "x${PC}" =3D "x." ]; then
PC=3D`pwd`/
fi
echo ${PC}
. ${PC}/PORT.common

# compairing the tip of local vendor branch with FPT cvs
#
echo "=3D=3D> Checking $1 is up-to-date in local vendor branch"

echo "=3D=3D=3D=3D> Exporting local vendor branch of $1"
cvs -q ${L_CVS_ROOT} ex -d $1_local -rFPT $1 || exit 1
echo "=3D=3D=3D=3D> Exporting FPT $1"
cvs -q ${R_CVS_ROOT} ex -d $1_FPT -Dnow $1 || exit 1
cvs -q ${R_CVS_ROOT} co -d $1_FPT.co -Dnow $1 || exit 1

echo "=3D=3D=3D> Checking local vendor branch against FPT...."
if diff -urN -I '^...Tecnik: ports/.* itetcu Exp .'  $1_local $1_FPT; then
        echo "=3D=3D=3D> All OK, local vendor branch and FPT are the same"
else
        echo "=3D=3D=3D> Some changes exists, you need to import from FPT f=
irst"
        exit 1
fi

### get old pkg version
DEPD=3D$1_FPT && expdep
cd $1_FPT && \
        PKGNAME_O=3D`make -VPKGNAME` && \
        PKGVER_O=3D`make -VPKGNAME | sed "s/$1-//"` && \
cd ../
[ -z ${PKGVER_O} ] && MERR=3D"problem in old Makefile ?" && merror

echo '=3D=3D=3D=3D> Tagging "FOR_PR"'
cvs ${L_CVS_ROOT} rtag -rHEAD -F "FOR_PR" $1 || (MERR=3D"Can't rtag" && mer=
ror)

echo "=3D=3D=3D=3D> Exporting HEAD of $1"
cvs ${L_CVS_ROOT} ex -rHEAD $1 || (MERR=3D"Can't export" && merror)

### get current pkg version
DEPD=3D$1 && expdep
cd $1
PKGVER=3D`make -VPKGNAME | sed "s/$1-//"`
[ -z ${PKGVER} ] && MERR=3D"problem in Makefile ?" && merror
if [ "x${PKGVER_O}" =3D "x${PKGVER}" ]; then
        DIFF=3D"/home/itetcu/$1.diff"
else
        DIFF=3D"/home/itetcu/${PKGNAME_O}_to_${PKGVER}.diff"
fi
echo; echo "--------------------  PORTLINT -C  -----------------------"; ec=
ho;
portlint -C
echo; echo "--------------------  make describe ---------------------------=
"; echo;
make describe
echo; echo "---------------------------------------------------------------=
"; echo;
read -p "Go on [y/n] ?" GOON
if [ "x${GOON}" !=3D "xy" ]; then
        clean_up
fi
cd ../

echo "=3D=3D=3D=3D> Exporting diff in ${DIFF}"
#diff -urN $1_FPT $1 > ${DIFF}
cp -R $1/* $1_FPT.co/
cd $1_FPT.co/
cvs -q ${R_CVS_ROOT} diff -uN > ${DIFF}
cd ../

${PC}/updlogs.sh $1 ${PKGVER}
sh ${PC}/upddiff.sh $1 ${DIFF}
#sh ${PC}/upddiff.sh $1 ${DIFF}.cvs

echo "=3D=3D=3D=3D> Please enter PR description"
read -p "Go on [y/n] ?" GOON
if [ "x${GOON}" !=3D "xy" ]; then
        clean_up
fi

cvs ${L_CVS_ROOT} co -d $1_PRlog people/itetcu/ports/PRlogs/$1
ee $1_PRlog/$1
cvs ${L_CVS_ROOT} ci -m"`cat $1_PRlog/$1`" $1_PRlog/$1
cat $1_PRlog/$1
#rm -r $1

gtk-send-pr -m -a ${DIFF}




--=20
IOnut - Un^d^dregistered ;) FreeBSD "user"
  "Intellectual Property" is   nowhere near as valuable   as "Intellect"
FreeBSD committer -> itetcu@FreeBSD.org, PGP Key ID 057E9F8B493A297B

--Sig_/1=7eHFmXwNIhATv3U1/vufg
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iEYEARECAAYFAk1Abx8ACgkQJ7GIuiH/oeVC1QCdHlcMUiAYKDe+sOHNwwgWvv7X
kHcAnjMv2nz9+z2uzbyH06qV54JLOQ46
=0ait
-----END PGP SIGNATURE-----

--Sig_/1=7eHFmXwNIhATv3U1/vufg--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110126205943.7b02955f>