[69583] branches/gsoc10-configfiles

and.damore at macports.org and.damore at macports.org
Sat Jul 10 08:41:55 PDT 2010


Revision: 69583
          http://trac.macports.org/changeset/69583
Author:   and.damore at macports.org
Date:     2010-07-10 08:41:52 -0700 (Sat, 10 Jul 2010)
Log Message:
-----------
utilities for gsoc-configfiles branch

Modified Paths:
--------------
    branches/gsoc10-configfiles/base/src/macports1.0/macports.tcl

Added Paths:
-----------
    branches/gsoc10-configfiles/tools/
    branches/gsoc10-configfiles/tools/README
    branches/gsoc10-configfiles/tools/bash_macports
    branches/gsoc10-configfiles/tools/gsoc
    branches/gsoc10-configfiles/tools/gsocdummyupdate.c
    branches/gsoc10-configfiles/tools/gsocdummyupdate.sh
    branches/gsoc10-configfiles/tools/gsocmake

Modified: branches/gsoc10-configfiles/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc10-configfiles/base/src/macports1.0/macports.tcl	2010-07-10 14:18:19 UTC (rev 69582)
+++ branches/gsoc10-configfiles/base/src/macports1.0/macports.tcl	2010-07-10 15:41:52 UTC (rev 69583)
@@ -40,6 +40,7 @@
 namespace eval macports {
     namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases 
     variable bootstrap_options "\
+        config_paths config_files\
         portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
         portinstalltype portarchivemode portarchivepath portarchivetype portautoclean \
         porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
@@ -49,6 +50,7 @@
         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
+        config_paths config_files\
         portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
         registry.path registry.format registry.installtype portarchivemode portarchivepath \
         portarchivetype portautoclean porttrace keeplogs portverbose destroot_umask rsync_server \
@@ -425,6 +427,8 @@
     }
 
     global auto_path env tcl_platform
+    global macports::config_paths
+    global macports::config_files
     global macports::autoconf::macports_conf_path
     global macports::macports_user_dir
     global macports::bootstrap_options

Added: branches/gsoc10-configfiles/tools/README
===================================================================
--- branches/gsoc10-configfiles/tools/README	                        (rev 0)
+++ branches/gsoc10-configfiles/tools/README	2010-07-10 15:41:52 UTC (rev 69583)
@@ -0,0 +1,18 @@
+Utilities for gsoc-configfiles branch.
+
+gsoc
+  edits main base/src/[port|macports1.0|port1.0] comes handy with TextWrangler's edit
+
+gsocdummyupdate (gsocdummyupdate.c) 
+  wrapper built from gsocdummyupdate.c, runs gsocdummyupdate.sh shell script with setuid
+
+gsocdummyupdate.sh 
+  updates gsoc-dummy tarball, will update tarball for gsoc-dummy port, print the checksums that you can cop
+
+bash_macports
+  bash function wrapping port command, remember to edit PORT_HANDLE in order to use "user" target,
+  copy it to ~/.bash_macports and source it adding the following line to .bash_profile:
+    source "$HOME"/.bash_macports
+
+gsocmake
+  changes to branch, configures and makes

Added: branches/gsoc10-configfiles/tools/bash_macports
===================================================================
--- branches/gsoc10-configfiles/tools/bash_macports	                        (rev 0)
+++ branches/gsoc10-configfiles/tools/bash_macports	2010-07-10 15:41:52 UTC (rev 69583)
@@ -0,0 +1,122 @@
+## Andrea D'Amore - 20100710
+
+## MacPorts handle
+## edit and uncomment next line 
+#export PORT_HANDLE=<your handle here>
+
+## MacPorts' port wrapper
+port() {
+  PORT_BIN=$(which port)
+  
+  ## tries to set environment variables if they are not set
+  if [ -z "$PORT_PREFIX" ]; then export PORT_PREFIX="/opt/local"; fi
+  if [ -z "$PORT_HANDLE" ]; then export PORT_HANDLE=$(id -p | grep uid | cut -f 2); fi
+  
+  ## patch to well behave with mpswitch, this directory is not going to change from one mp installation to another
+#  PORT_BASE="/opt/local/var/macports/sources/svn.macports.org/trunk/base"
+  PORT_BASE="$PORT_PREFIX/var/macports/sources/svn.macports.org/trunk/base"
+  PORT_ETC="$PORT_PREFIX/etc"
+  ## patch to well behave with mpswitch, this directory is not going to change from one mp installation to another
+#  PORT_SVN_SOURCES="$PORT_PREFIX/var/macports/sources/svn.macports.org"
+  PORT_SVN_SOURCES="/opt/local/var/macports/sources/svn.macports.org"
+  PORT_SOURCES="$PORT_SVN_SOURCES"
+  
+  case "$1" in
+   "search")
+    shift
+    $PORT_BIN search --line "$@"
+    ;;
+  "base") 
+    echo "$PORT_BASE"
+    ;;
+  "prefix")
+    echo "$PORT_PREFIX"
+    ;;
+  "etc")
+    echo "$PORT_ETC"
+    ;;
+  "sources")
+    echo "$PORT_SOURCES"
+    ;;
+  "user")
+    echo "$PORT_SOURCES"/users/"$PORT_HANDLE"
+    ;;
+  "users")
+    echo "$PORT_SOURCES"/users
+    ;;
+  "local")
+    echo $PORT_PREFIX/var/macports/sources/local
+    ;;
+  "svn")
+    echo $PORT_PREFIX/var/macports/sources/svn.macports.org
+    ;;
+  "gsoc")
+    echo $PORT_SVN_SOURCES/branches/gsoc10-configfiles/base/
+    ;;
+  "dports")
+    echo $(grep default $(port prefix)/etc/macports/sources.conf | cut -d " " -f 1 | grep "^file" |grep "^file" | sed "s|file://||") 
+    ;;
+  "cd") 
+    case "$2" in
+    "base")
+      cd $(port base)
+      ;;
+    "prefix")
+      cd $(port prefix)
+      ;;
+    "etc")
+      cd $(port etc)
+      ;;
+    "conf")
+      cd $(port etc)/macports
+      ;;
+    "sources")
+      cd $(port sources)
+      ;;
+    "local")
+      cd $(port local)
+      ;;
+    "svn")
+      cd $(port svn)
+      ;;
+    "gsoc")
+      cd $(port gsoc)
+      ;;
+    "dports")
+      cd $(port dports)
+      ;;
+    "user")
+      cd $(port users)/"$PORT_HANDLE"
+      ;;
+    "users")
+      cd $(port users)
+      ;;
+	*)
+      shift 1
+      cd $("$PORT_BIN" dir "$@")
+      ;;  
+    esac
+    ;;
+  "real")
+    shift
+    "$PORT_BIN" $@
+    ;;
+  *)  
+    "$PORT_BIN" $@
+    ;;  
+  esac
+}
+
+## GSoC section
+
+## switch from regular installation to alternate prefix
+mpswitch () {
+  if [[ "$PATH" = */opt/local/* ]]; then
+    export PATH=$(echo "$PATH" | sed -e 's,/opt/local,/opt/mp-gsoc,g');
+    export PORT_PREFIX="/opt/mp-gsoc"
+  else
+    export PATH=$(echo "$PATH" | sed -e 's,/opt/mp-gsoc,/opt/local,g');
+    export PORT_PREFIX="/opt/local"
+  fi
+}
+

Added: branches/gsoc10-configfiles/tools/gsoc
===================================================================
--- branches/gsoc10-configfiles/tools/gsoc	                        (rev 0)
+++ branches/gsoc10-configfiles/tools/gsoc	2010-07-10 15:41:52 UTC (rev 69583)
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+source ~/.bash_macports
+DIR=$(port gsoc)
+if [ "$1" == port ]; then
+    DIR="$DIR"src/port/
+elif [ "$1" == macports ] || [ "$1" == macports1.0 ]; then
+    DIR="$DIR"src/macports1.0/
+elif [ "$1" == ports ] || [ "$1" == port1.0 ]; then
+    DIR="$DIR"src/port1.0/
+else
+  echo -e "Usage:\ngsoc port | [macports | macports] | [ports | port1.0]"
+  exit 1
+fi
+
+$EDITOR "$DIR"
+exit 0


Property changes on: branches/gsoc10-configfiles/tools/gsoc
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/gsoc10-configfiles/tools/gsocdummyupdate.c
===================================================================
--- branches/gsoc10-configfiles/tools/gsocdummyupdate.c	                        (rev 0)
+++ branches/gsoc10-configfiles/tools/gsocdummyupdate.c	2010-07-10 15:41:52 UTC (rev 69583)
@@ -0,0 +1,7 @@
+#include <unistd.h>
+
+int main(int argc, char *argv[]) {
+setuid(geteuid());
+system("/usr/local/bin/gsocdummyupdate.sh");
+return 0;
+}


Property changes on: branches/gsoc10-configfiles/tools/gsocdummyupdate.c
___________________________________________________________________
Added: svn:eol-style
   + native

Added: branches/gsoc10-configfiles/tools/gsocdummyupdate.sh
===================================================================
--- branches/gsoc10-configfiles/tools/gsocdummyupdate.sh	                        (rev 0)
+++ branches/gsoc10-configfiles/tools/gsocdummyupdate.sh	2010-07-10 15:41:52 UTC (rev 69583)
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+TARFILE=gsoc-dummy-0.1.tar.gz 
+PORTFILE=$(port dir gsoc-dummy)/Portfile
+USER=$(id -p | grep login | cut -f 2)
+#edit following line to point GSOCDUMMYDIR to the directory containing
+#"gsoc-dummy" tree
+GSOCDUMMYDIR=/Users/"$USER"/.macports/GSoC
+
+cd "$GSOCDUMMYDIR" && \
+tar zcf "$TARFILE" gsoc-dummy && \
+chown "$USER" "$TARFILE"
+
+TMPFILE=/tmp/TempPortfile$(date +"%Y%m%d%H%M")
+#just don't be nice, we need an empty file
+if [ -f "$TMPFILE" ]; then rm "$TMPFILE"; fi;
+touch /tmp/tempPortfile
+
+read _ md5Hash <<< $(openssl md5 "$TARFILE") 
+read _ shaHash <<< $(openssl sha1 "$TARFILE")
+read _ rmdHash <<< $(openssl rmd160 "$TARFILE")
+
+md5="checksums           md5     $md5Hash \\"
+sha="                    sha1    $shaHash \\"
+rmd="                    rmd160  $rmdHash"
+
+read num _ <<< $(wc -l "$PORTFILE")
+head -n $((num-3)) "$PORTFILE" > "$TMPFILE"
+printf "\n%s\n%s\n%s" "$md5" "$sha" "$rmd" >> "$TMPFILE"
+printf "Portfile updated with:\n%s\n%s\n%s\n\n" "$md5" "$sha" "$rmd"
+
+#update Portfile
+cp "$TMPFILE" "$PORTFILE"
+#update distfile
+cp "$TARFILE" /opt/mp-gsoc/var/macports/distfiles/gsoc-dummy
+#clean status
+port clean gsoc-dummy
+#clean /tmp too
+rm "$TMPFILE"
+


Property changes on: branches/gsoc10-configfiles/tools/gsocdummyupdate.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: branches/gsoc10-configfiles/tools/gsocmake
===================================================================
--- branches/gsoc10-configfiles/tools/gsocmake	                        (rev 0)
+++ branches/gsoc10-configfiles/tools/gsocmake	2010-07-10 15:41:52 UTC (rev 69583)
@@ -0,0 +1,9 @@
+#!/bin/bash -x
+
+source ~/.bash_macports
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+MP_PREFIX=/opt/mp-gsoc
+port cd gsoc
+make distclean
+./configure --prefix=$MP_PREFIX --with-tclpackage=$MP_PREFIX/Library/Tcl --with-applications-dir=$MP_PREFIX/Applications
+make


Property changes on: branches/gsoc10-configfiles/tools/gsocmake
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100710/3e1193da/attachment.html>


More information about the macports-changes mailing list