[27251] users/mww
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 25 16:14:43 PDT 2007
Revision: 27251
http://trac.macosforge.org/projects/macports/changeset/27251
Author: mww at macports.org
Date: 2007-07-25 16:14:43 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
new tool "select" that will work like gcc_select(8) but for macports python, gcc, .. respectively
Added Paths:
-----------
users/mww/select/
users/mww/select/Makefile.in
users/mww/select/configure
users/mww/select/select.8
users/mww/select/select.sh
Added: users/mww/select/Makefile.in
===================================================================
--- users/mww/select/Makefile.in (rev 0)
+++ users/mww/select/Makefile.in 2007-07-25 23:14:43 UTC (rev 27251)
@@ -0,0 +1,13 @@
+prefix=@prefix@
+bindir=@prefix@/bin
+mandir=@mandir@
+name=@name@
+
+install:
+ install -m 755 -d $(DESTDIR)$(bindir)
+ install -m 755 -d $(DESTDIR)$(mandir)/man8
+ cat select.8 | sed "s|__PREFIX__|$(prefix)|g" | sed "s|__NAME__|$(name)|g" > $(DESTDIR)$(mandir)/man8/$(name)_select.8
+ chmod 444 $(DESTDIR)$(mandir)/man8/$(name)_select.8
+ cat select.sh | sed "s|__PREFIX__|$(prefix)|g" | sed "s|__NAME__|$(name)|g" > $(DESTDIR)$(prefix)/bin/$(name)_select
+ chmod 755 $(DESTDIR)$(bindir)/$(name)_select
+
Added: users/mww/select/configure
===================================================================
--- users/mww/select/configure (rev 0)
+++ users/mww/select/configure 2007-07-25 23:14:43 UTC (rev 27251)
@@ -0,0 +1,24 @@
+#!/bin/sh
+rm -f Makefile
+for i; do
+ echo "i: $i"
+ if [ "--prefix" = "$i" ]; then
+ shift;
+ prefix=${1}
+ shift;
+ elif [ "--mandir" = "$i" ]; then
+ shift;
+ mandir=${1}
+ shift;
+ elif [ "--name" = "$i" ]; then
+ shift;
+ name=${1}
+ shift;
+ fi
+done
+
+cat Makefile.in | \
+ sed "s|@prefix@|${prefix}|g" | \
+ sed "s|@mandir@|${mandir}|g" | \
+ sed "s|@name@|${name}|g" > Makefile
+
Property changes on: users/mww/select/configure
___________________________________________________________________
Name: svn:executable
+ *
Added: users/mww/select/select.8
===================================================================
--- users/mww/select/select.8 (rev 0)
+++ users/mww/select/select.8 2007-07-25 23:14:43 UTC (rev 27251)
@@ -0,0 +1,56 @@
+.\" select.8
+.\"
+.\" Copyright (c) 2007 The MacPorts Project
+.\" 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. Neither the name of Apple Computer, Inc. nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 July 26, 2007
+.Dt @name at _SELECT 8 "MacPorts"
+.Os
+.Sh NAME
+.Nm @name at _select
+.Nd choose between multiple versions of the same or similar tool
+.Sh SYNOPSIS
+.Nm
+.Op Fl nfrhv
+.Op Ar version
+.Sh DESCRIPTION
+.Nm
+lets you choose between multiple versions of the same or a similar software
+.Pp
+.Sh FILES
+.Bl -tag -width
+.It Va @prefix@/etc/@name at _select/base
+Base configuration for the software @name@
+.It Va @prefix@/etc/${name}_select/${version}
+Configuration for a specific version of the software ${name}
+.El
+.Sh DIAGNOSTICS
+.Ex -std
+.Sh SEE ALSO
+.Xr gcc_select 8
+.Sh AUTHOR
+.An "Markus W. Weissmann" Aq mww at macports.org
Added: users/mww/select/select.sh
===================================================================
--- users/mww/select/select.sh (rev 0)
+++ users/mww/select/select.sh 2007-07-25 23:14:43 UTC (rev 27251)
@@ -0,0 +1,161 @@
+#!/bin/bash
+#
+# $Id: portdestroot.tcl 27199 2007-07-24 09:09:43Z mww at macports.org $
+#
+# Copyright (c) 2007, MacPorts Project
+# 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. Neither the name of OpenDarwin nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
+#
+
+PREFIX=__PREFIX__
+NAME=__NAME___select
+CONFPATH=${PREFIX}/etc/${NAME}
+VERSION=0.1
+
+## GLOBALS
+# dont actually execute
+noexec=0
+# enforce action
+force=0
+# skip check for required rights
+isroot=0
+
+
+# print the usage of this tool
+usage() {
+ echo "usage: ${NAME} [-n] [-f] [-r] [-h] [-v] version"
+ echo ""
+ echo "-n Show commands to do selection but do not execute them."
+ echo "-f Ensure the links are correct for the specified version"
+ echo " even if it maches the current default version."
+ echo "-h Display this help info."
+ echo "-r Skip test for necessary rights."
+ echo "-v Display version of ${0}."
+ echo "-l List available options for version."
+ echo ""
+}
+
+# print the version of this tool
+version() {
+ echo "${NAME} v${VERSION}"
+}
+
+# list all (currently) available versions
+list_version() {
+ echo "Available versions:"
+ echo $(ls -1 ${CONFPATH} | grep -v base)
+}
+
+# test if a particular version is available
+version_is_valid() {
+ for version in $(ls -1 ${CONFPATH} | grep -v base); do
+ if [ ${1} == ${version} ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+# perform an action (command) or just display it
+action() {
+ if [ 1 == ${noexec} ]; then
+ echo "${1}"
+ else
+ ${1}
+ fi
+}
+
+# change symlinks
+select_version() {
+ # count the number of errors
+ local error=0
+ local i=1
+ local empty=0
+ for target in $(cat ${CONFPATH}/base); do
+ src=$(head -n ${i} ${CONFPATH}/${1} | tail -n 1)
+
+ empty=0
+ # test if line starts with '-' -> dont link, just rm original
+ if [ "-" == $(echo ${src} | colrm 2) ]; then
+ action "rm -f ${PREFIX}${target}"
+ else
+ action "ln -sf \"${PREFIX}${src}\" \"${PREFIX}${target}\""
+ fi
+ let "error = error + ${?}"
+ let "i = i + 1"
+ done
+ return ${error}
+}
+
+
+if [ ${#} == 0 ]; then
+ usage
+ exit 2
+fi
+
+# parse command line args
+args=$(/usr/bin/getopt fhnlrv $*)
+set -- ${args}
+for i; do
+ case "${i}" in
+ -h)
+ usage; exit 0;;
+ -n)
+ noexec=1; shift;;
+ -f)
+ force=1; shift;;
+ -l)
+ list; exit 0;;
+ -r)
+ isroot=1; shift;;
+ -v)
+ version; exit 0;;
+ --)
+ shift; break;;
+ esac
+done
+
+#echo "isroot: ${isroot}"
+#echo "noexec: ${noexec}"
+#echo "force: ${force}"
+#echo "arg: ${1}"
+
+# test if chosen version is available
+version_is_valid $1
+if [ 0 != ${?} ]; then
+ echo "version \"$1\" is invalid!"
+ exit 4
+fi
+
+# execute selection
+select_version ${1}
+if [ 0 != ${?} ]; then
+ echo "there were ${?} errors selecting version \"${version}\"!"
+ exit 5
+fi
+
+exit 0
+
Property changes on: users/mww/select/select.sh
___________________________________________________________________
Name: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070725/813ca0ef/attachment.html
More information about the macports-changes
mailing list