svn commit: r243119 - projects/portbuild/scripts
Mark Linimon
linimon at FreeBSD.org
Fri Nov 16 02:53:04 UTC 2012
Author: linimon (doc,ports committer)
Date: Fri Nov 16 02:53:03 2012
New Revision: 243119
URL: http://svnweb.freebsd.org/changeset/base/243119
Log:
Convert to svn. While here, make more robust.
Modified:
projects/portbuild/scripts/updatesnap
projects/portbuild/scripts/updatesnap.ports
Modified: projects/portbuild/scripts/updatesnap
==============================================================================
--- projects/portbuild/scripts/updatesnap Fri Nov 16 02:26:23 2012 (r243118)
+++ projects/portbuild/scripts/updatesnap Fri Nov 16 02:53:03 2012 (r243119)
@@ -7,15 +7,19 @@ pbc=${PORTBUILD_CHECKOUT:-/var/portbuild
. ${pbc}/conf/server.conf
-base=${ZFS_MOUNTPOINT}/${SNAP_SRC_DIRECTORY_PREFIX}
-zbase=${ZFS_VOLUME}/${SNAP_SRC_DIRECTORY_PREFIX}
+base=${ZFS_MOUNTPOINT}/${SNAP_DIRECTORY}
+zbase=${ZFS_VOLUME}/${SNAP_DIRECTORY}
+base_prefix=${ZFS_MOUNTPOINT}/${SNAP_DIRECTORY}/${SRC_DIRECTORY_PREFIX}
+zbase_prefix=${ZFS_VOLUME}/${SNAP_DIRECTORY}/${SRC_DIRECTORY_PREFIX}
VERBOSE=1
-supstamp() {
- fulldate=$1
- date -j -f %+ "${fulldate}" +%Y.%m.%d.%H.%M.%S
-}
+# XXX MCL 20121115 try to switch to SVN
+#supstamp() {
+# fulldate=$1
+# date -j -f %+ "${fulldate}" +%Y.%m.%d.%H.%M.%S
+#}
+# XXX MCL 20121115 try to switch to SVN
stamp() {
fulldate=$1
@@ -38,42 +42,81 @@ echo "Started at $(date)"
# We need to preserve group writability so portmgr group can write
umask 002
+# create /a/snap if not already there
+if [ ! -d ${base} ]; then
+ echo "creating new base directory using ${base}"
+ mkdir -p ${base} || finish 1
+ echo "zfs create -o mountpoint=${base} ${zbase}"
+ zfs create -o mountpoint=${base} ${zbase} || finish 1
+ chown -R portmgr:portmgr ${base}
+ chmod -R g+w ${base}
+fi
+
for branch in $SRC_BRANCHES; do
- mountpoint=${base}${branch}
- if [ ! -d ${mountpoint}/src ]; then
- echo "creating new source branch under ${mountpoint}"
- mkdir -p ${mountpoint}
- echo "zfs create -o mountpoint=${mountpoint} ${zbase}${branch}"
- zfs create -o mountpoint=${mountpoint} ${zbase}${branch}
- mkdir -p ${mountpoint}/src
- echo "zfs create -o mountpoint=${mountpoint}/src ${zbase}${branch}/src"
- zfs create -o mountpoint=${mountpoint}/src ${zbase}${branch}/src
+ mountpoint=${base_prefix}${branch}
+ # create /a/snap/src-<branch> if not already there
+ if [ ! -d ${mountpoint} ]; then
+ echo "creating new source branch using ${mountpoint}"
+ mkdir ${mountpoint} || finish 1
+ echo "zfs create -o mountpoint=${mountpoint} ${zbase_prefix}${branch}"
+ zfs create -o mountpoint=${mountpoint} ${zbase_prefix}${branch} || finish 1
chown -R portmgr:portmgr ${mountpoint}
chmod -R g+w ${mountpoint}
fi
+ # create /a/snap/src-<branch>/src if not already there
+ if [ ! -d ${mountpoint}/src ]; then
+ echo "creating new source branch subdirectory using ${mountpoint}/src"
+ mkdir ${mountpoint}/src || finish 1
+ echo "zfs create -o mountpoint=${mountpoint}/src ${zbase_prefix}${branch}/src"
+ zfs create -o mountpoint=${mountpoint}/src ${zbase_prefix}${branch}/src || finish 1
+ chown -R portmgr:portmgr ${mountpoint}/src
+ chmod -R g+w ${mountpoint}/src
+ fi
cd ${mountpoint}
fulldate=$(date)
- supdate=$(supstamp ${fulldate})
- eval tag=\$SRC_BRANCH_${branch}_TAG
- if [ ! -f ${SRC_MASTER_SUPFILE} ]; then
- echo "${SRC_MASTER_SUPFILE} does not exist!"
- else
- sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${mountpoint}|;s|%%TAG%%|${tag}|" \
- ${SRC_MASTER_SUPFILE} > ${SRC_SUPFILE}.${branch}.now
+# XXX MCL 20121115 try to switch to SVN
+# supdate=$(supstamp ${fulldate})
+# eval tag=\$SRC_BRANCH_${branch}_TAG
+# if [ ! -f ${SRC_MASTER_SUPFILE} ]; then
+# echo "${SRC_MASTER_SUPFILE} does not exist!"
+# else
+# sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${mountpoint}|;s|%%TAG%%|${tag}|" \
+# ${SRC_MASTER_SUPFILE} > ${SRC_SUPFILE}.${branch}.now
+# # example destination directory: /a/snap/src-7/src/ (tricky!)
+# if [ $VERBOSE ]; then
+# echo "csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log"
+# fi
+# csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log
+# XXX MCL 20121115 try to switch to SVN
# example destination directory: /a/snap/src-7/src/ (tricky!)
- if [ $VERBOSE ]; then
- echo "csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log"
+ echo "XXX now at `pwd -P`"
+ if [ ! -d ${mountpoint}/src ]; then
+ mkdir ${mountpoint}/src || finish 1
fi
- csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log
+ if [ ! -d .svn ]; then
+ if [ $VERBOSE ]; then
+ # XXX MCL 20121115 gotta do the substitution here!
+ echo "svn checkout svn+ssh://svn.freebsd.org/base/head ${mountpoint}/src"
+ fi
+ #svn checkout svn+ssh://svn.freebsd.org/base/head ${mountpoint}/src || finish 1
+ else
+ if [ $VERBOSE ]; then
+ echo "svn up"
+ fi
+ #svn up || finish 1
+ fi
+# XXX MCL 20121115 try to switch to SVN
echo ${fulldate} > src/.updated
# hack for zfs breakiness
find . -group wheel|xargs chgrp portmgr
snapdate=$(stamp ${fulldate})
if [ $VERBOSE ]; then
- echo "zfs snapshot ${zbase}${branch}/src@${snapdate}"
+ echo "#zfs snapshot ${zbase_prefix}${branch}/src@${snapdate}"
fi
- zfs snapshot ${zbase}${branch}/src@${snapdate}
- fi
+ #zfs snapshot ${zbase_prefix}${branch}/src@${snapdate} || finish 1
+# XXX MCL 20121115 try to switch to SVN
+# fi
+# XXX MCL 20121115 try to switch to SVN
done
finish 0
Modified: projects/portbuild/scripts/updatesnap.ports
==============================================================================
--- projects/portbuild/scripts/updatesnap.ports Fri Nov 16 02:26:23 2012 (r243118)
+++ projects/portbuild/scripts/updatesnap.ports Fri Nov 16 02:53:03 2012 (r243119)
@@ -7,13 +7,19 @@ pbc=${PORTBUILD_CHECKOUT:-/var/portbuild
. ${pbc}/conf/server.conf
-base=${ZFS_MOUNTPOINT}/${SNAP_PORTS_DIRECTORY}
-zbase=${ZFS_VOLUME}/${SNAP_PORTS_DIRECTORY}
-
-supstamp() {
- fulldate=$1
- date -j -f %+ "${fulldate}" +%Y.%m.%d.%H.%M.%S
-}
+base=${ZFS_MOUNTPOINT}/${SNAP_DIRECTORY}
+zbase=${ZFS_VOLUME}/${SNAP_DIRECTORY}
+head=${ZFS_MOUNTPOINT}/${SNAP_PORTS_DIRECTORY}
+zhead=${ZFS_VOLUME}/${SNAP_PORTS_DIRECTORY}
+
+VERBOSE=1
+
+# XXX MCL 20121115 try to switch to SVN
+#supstamp() {
+# fulldate=$1
+# date -j -f %+ "${fulldate}" +%Y.%m.%d.%H.%M.%S
+#}
+# XXX MCL 20121115 try to switch to SVN
stamp() {
fulldate=$1
@@ -36,18 +42,57 @@ echo "Started at $(date)"
# We need to preserve group writability so portmgr group can write
umask 002
-cd ${base}
+# create /a/snap/ if not already there
+if [ ! -d ${base} ]; then
+ echo "creating new base directory using ${base}"
+ mkdir -p ${base} || finish 1
+ echo "zfs create -o mountpoint=${base} ${zbase}"
+ zfs create -o mountpoint=${base} ${zbase} || finish 1
+ chown -R portmgr:portmgr ${base}
+ chmod -R g+w ${base}
+fi
+
+# create /a/snap/ports-head/ if not already there
+if [ ! -d ${head} ]; then
+ echo "creating new ports-head directory using ${head}"
+ mkdir ${head} || finish 1
+ echo "zfs create -o mountpoint=${head} ${zhead}"
+ zfs create -o mountpoint=${head} ${zhead} || finish 1
+ chown -R portmgr:portmgr ${head}
+ chmod -R g+w ${head}
+fi
+
+cd ${head}
fulldate=$(date)
-supdate=$(supstamp ${fulldate})
-cat ${PORTS_MASTER_SUPFILE} | \
- sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${base}|" \
- > ${PORTS_SUPFILE}.now
+# XXX MCL 20121115 try to switch to SVN
+#supdate=$(supstamp ${fulldate})
+#cat ${PORTS_MASTER_SUPFILE} | \
+# sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${head}|" \
+# > ${PORTS_SUPFILE}.now
# example destination directory: /a/snap/ports-head/ports/
-csup -L 2 ${PORTS_SUPFILE}.now > ports-csup.log
+#csup -L 2 ${PORTS_SUPFILE}.now > ports-csup.log
+# XXX MCL 20121115 try to switch to SVN
+if [ ! -d ${head}/ports ]; then
+ mkdir ${head}/ports || finish 1
+fi
+if [ ! -d .svn ]; then
+ if [ $VERBOSE ]; then
+ echo "svn checkout svn+ssh://svn.freebsd.org/ports/head ${head}/ports"
+ fi
+ svn checkout svn+ssh://svn.freebsd.org/ports/head ${head}/ports || finish 1
+else
+ if [ $VERBOSE ]; then
+ echo "#svn up"
+ fi
+ #svn up || finish 1
+fi
echo ${fulldate} > ports/.updated
# hack for zfs breakiness
find . -group wheel|xargs chgrp portmgr
snapdate=$(stamp ${fulldate})
-zfs snapshot ${zbase}/ports@${snapdate}
+if [ $VERBOSE ]; then
+ echo "#zfs snapshot ${zhead}/ports@${snapdate}"
+fi
+zfs snapshot ${zhead}/ports@${snapdate} || finish 1
finish 0
More information about the svn-src-projects
mailing list