[34875] trunk
eridius at macports.org
eridius at macports.org
Sun Mar 9 21:50:48 PDT 2008
Revision: 34875
http://trac.macosforge.org/projects/macports/changeset/34875
Author: eridius at macports.org
Date: 2008-03-09 21:50:45 -0700 (Sun, 09 Mar 2008)
Log Message:
-----------
Add support for fetch.type git (Fixes #14232)
Modified Paths:
--------------
trunk/base/configure
trunk/base/configure.ac
trunk/base/doc/portfile.7
trunk/base/src/port1.0/port_autoconf.tcl.in
trunk/base/src/port1.0/portfetch.tcl
trunk/doc-new/guide/xml/portfile-phase.xml
Modified: trunk/base/configure
===================================================================
--- trunk/base/configure 2008-03-10 00:04:09 UTC (rev 34874)
+++ trunk/base/configure 2008-03-10 04:50:45 UTC (rev 34875)
@@ -686,6 +686,7 @@
MTREE
CVS
SVN
+GIT
RSYNC
SED
TAR
@@ -3594,6 +3595,46 @@
fi
+# Extract the first word of "git", so it can be a program name with args.
+set dummy git; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_GIT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $GIT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+GIT=$ac_cv_path_GIT
+if test -n "$GIT"; then
+ { echo "$as_me:$LINENO: result: $GIT" >&5
+echo "${ECHO_T}$GIT" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -13045,6 +13086,7 @@
MTREE!$MTREE$ac_delim
CVS!$CVS$ac_delim
SVN!$SVN$ac_delim
+GIT!$GIT$ac_delim
RSYNC!$RSYNC$ac_delim
SED!$SED$ac_delim
TAR!$TAR$ac_delim
@@ -13071,7 +13113,6 @@
OBJC_RUNTIME_FLAGS!$OBJC_RUNTIME_FLAGS$ac_delim
OBJC_LIBS!$OBJC_LIBS$ac_delim
OBJC_PTHREAD_LIBS!$OBJC_PTHREAD_LIBS$ac_delim
-OBJC_PTHREAD_CFLAGS!$OBJC_PTHREAD_CFLAGS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -13113,6 +13154,7 @@
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+OBJC_PTHREAD_CFLAGS!$OBJC_PTHREAD_CFLAGS$ac_delim
OBJC_FOUNDATION!$OBJC_FOUNDATION$ac_delim
OBJC_FOUNDATION_LDFLAGS!$OBJC_FOUNDATION_LDFLAGS$ac_delim
OBJC_FOUNDATION_CPPFLAGS!$OBJC_FOUNDATION_CPPFLAGS$ac_delim
@@ -13180,7 +13222,7 @@
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Modified: trunk/base/configure.ac
===================================================================
--- trunk/base/configure.ac 2008-03-10 00:04:09 UTC (rev 34874)
+++ trunk/base/configure.ac 2008-03-10 04:50:45 UTC (rev 34875)
@@ -74,6 +74,7 @@
AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
AC_PATH_PROG(CVS, [cvs], [])
AC_PATH_PROG(SVN, [svn], [])
+AC_PATH_PROG(GIT, [git], [])
AC_PATH_PROG(RSYNC, [rsync], [])
AC_PATH_PROG(SED, [sed])
AC_PATH_PROG(TAR, [tar])
Modified: trunk/base/doc/portfile.7
===================================================================
--- trunk/base/doc/portfile.7 2008-03-10 00:04:09 UTC (rev 34874)
+++ trunk/base/doc/portfile.7 2008-03-10 04:50:45 UTC (rev 34875)
@@ -736,7 +736,7 @@
.Dl svn.url http://www.domain.com/svn-repo/mydirectory
svn.url svn://www.domain.com/svn-repo/mydirectory
.It Ic svn.tag
-Specify the a tag from which svn should fetch files. This
+Specify a tag from which svn should fetch files. This
corresponds to the -r option to the svn cli. Note that you
will need to use backslashes to escape characters that have
meaning to the Tcl interpreter, such as braces and double
@@ -752,6 +752,37 @@
.Dl svn.tag 37192
svn.tag \\{\\"2006-02-17 15:30 +0230\\"\\}
.El
+.Ss FETCHING FROM GIT
+As an alternative to fetching distribution files, pulling the sources
+from a git repository is supported. Use of git can give rise to
+non-reproducible builds, so it is strongly discouraged.
+.Bl -tag -width lc
+.It Ic git.url
+Specify the url from which to fetch files
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Default:
+.Em none
+.br
+.Sy Example:
+.Dl git.url git://git.kernel.org/pub/scm/git/git.git
+ git.url http://www.kernel.org/pub/scm/git/git.git
+.It Ic git.branch
+Specify a branch (or other commit-ish) that git should checkout.
+Note that any branch besides HEAD should be prefixed by origin/.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em none
+.br
+.Sy Example:
+.Dl git.branch 72bf1c8
+ git.branch origin/next
+.El
.Sh EXTRACT OPTIONS
Extract all compressed/archived files.
.Bl -tag -width lc
Modified: trunk/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- trunk/base/src/port1.0/port_autoconf.tcl.in 2008-03-10 00:04:09 UTC (rev 34874)
+++ trunk/base/src/port1.0/port_autoconf.tcl.in 2008-03-10 04:50:45 UTC (rev 34875)
@@ -33,6 +33,7 @@
namespace eval portutil::autoconf {
variable cvs_path "@CVS@"
variable svn_path "@SVN@"
+ variable git_path "@GIT@"
variable rsync_path "@RSYNC@"
variable mtree_path "@MTREE@"
variable xar_path "@XAR@"
Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl 2008-03-10 00:04:09 UTC (rev 34874)
+++ trunk/base/src/port1.0/portfetch.tcl 2008-03-10 04:50:45 UTC (rev 34875)
@@ -45,7 +45,8 @@
fetch.type fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert \
master_sites.mirror_subdir patch_sites.mirror_subdir portname \
cvs.module cvs.root cvs.password cvs.date cvs.tag \
- svn.url svn.tag
+ svn.url svn.tag \
+ git.url git.branch
# XXX we use the command framework to buy us some useful features,
# but this is not a user-modifiable command
@@ -75,6 +76,9 @@
default svn.args ""
default svn.post_args {"${svn.url}"}
+default git.dir {${workpath}}
+default git.branch {}
+
# Set distfiles
default distfiles {[suffix $distname]}
default dist_subdir {${portname}}
@@ -120,7 +124,8 @@
global extract.suffix fetch.type
switch -- "${fetch.type}" {
cvs -
- svn { return "" }
+ svn -
+ git { return "" }
standard -
default { return "${distname}${extract.suffix}" }
}
@@ -387,6 +392,52 @@
return 0
}
+# Perform a git fetch
+proc gitfetch {args} {
+ global worksrcpath prefix_frozen
+ global git.url git.branch git.sha1
+
+ # Look for the git command
+ set git.cmd {}
+ foreach gitcmd "$portutil::autoconf::git_path $prefix_frozen/bin/git git" {
+ if {[file executable $gitcmd]} {
+ set git.cmd $gitcmd
+ break
+ }
+ }
+ if {${git.cmd} == {}} {
+ ui_error "git is required to fetch ${git.url}"
+ ui_error "Please install the git-core port before proceeding."
+ return -code error [msgcat::mc "Git command not found"]
+ }
+
+ set options "-q"
+ if {[string length ${git.branch}] == 0} {
+ # if we're just using HEAD, we can make a shallow repo
+ set options "$options --depth=1"
+ }
+ set cmdstring "${git.cmd} clone $options ${git.url} ${worksrcpath} 2>&1"
+ ui_debug "Executing: $cmdstring"
+ if {[catch {system $cmdstring} result]} {
+ return -code error [msgcat::mc "Git clone failed"]
+ }
+
+ if {[string length ${git.branch}] > 0} {
+ set env "GIT_DIR=${worksrcpath}/.git GIT_WORK_TREE=${worksrcpath}"
+ set cmdstring "$env ${git.cmd} checkout -q ${git.branch} 2>&1"
+ ui_debug "Executing $cmdstring"
+ if {[catch {system $cmdstring} result]} {
+ return -code error [msgcat::mc "Git checkout failed"]
+ }
+ }
+
+ if {[info exists patchfiles]} {
+ return [fetchfiles]
+ }
+
+ return 0
+}
+
# Perform a standard fetch, assembling fetch urls from
# the listed url varable and associated distfile
proc fetchfiles {args} {
@@ -520,6 +571,7 @@
switch -- "${fetch.type}" {
cvs { return [cvsfetch] }
svn { return [svnfetch] }
+ git { return [gitfetch] }
standard -
default { return [fetchfiles] }
}
Modified: trunk/doc-new/guide/xml/portfile-phase.xml
===================================================================
--- trunk/doc-new/guide/xml/portfile-phase.xml 2008-03-10 00:04:09 UTC (rev 34874)
+++ trunk/doc-new/guide/xml/portfile-phase.xml 2008-03-10 04:50:45 UTC (rev 34875)
@@ -496,8 +496,9 @@
<listitem>
<para>Change the fetch type. This is only necessary if a <link
- linkend="reference.phases.fetch.cvs">CVS</link> or <link
- linkend="reference.phases.fetch.svn">SVN</link> checkout is be
+ linkend="reference.phases.fetch.cvs">CVS</link>, <link
+ linkend="reference.phases.fetch.svn">svn</link>, or
+ <link linkend="reference.phases.fetch.git">git</link> checkout is be
used. <option>standard</option> is used for a normal http or ftp
fetch using <varname>${distfiles}</varname> and is used as
default.</para>
@@ -509,7 +510,7 @@
<listitem>
<para>Values: <option>standard</option> <option>cvs</option>
- <option>svn</option></para>
+ <option>svn</option> <option>git</option></para>
</listitem>
<listitem>
@@ -732,7 +733,7 @@
<para>You have to set <link
linkend="reference.phases.fetch.advanced.fetch-type"><varname>fetch.type</varname></link>
- to <option>svn</option> to fetch from SVN.</para>
+ to <option>svn</option> to fetch from svn.</para>
<variablelist>
<varlistentry>
@@ -780,6 +781,66 @@
</varlistentry>
</variablelist>
</section>
+
+ <section id="reference.phases.fetch.git">
+ <title>Fetch from Git</title>
+
+ <para><ulink url="http://git.or.cz/">Git</ulink> may
+ be used as an alternative method of fetching distribution files using
+ the keywords in this section. However, fetching via Git may cause
+ non-reproducible builds, so it is strongly discouraged.</para>
+
+ <para>You have to set <link
+ linkend="reference.phases.fetch.advanced.fetch-type"><varname>fetch.type</varname></link>
+ to <option>git</option> to fetch from git.</para>
+
+ <variablelist>
+ <varlistentry>
+ <term>git.url</term>
+
+ <listitem>
+ <para>This specifies the url from which to fetch files.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Default: none</para>
+ </listitem>
+
+ <listitem>
+ <para>Examples:</para>
+
+ <programlisting>git.url git://git.kernel.org/pub/scm/git/git.git</programlisting>
+
+ <programlisting>git.url http://www.kernel.org/pub/scm/git/git.git</programlisting>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>git.branch</term>
+
+ <listitem>
+ <para>Optional tag for fetching with git, this specifies a branch
+ (or other commit-ish) that git should checkout.
+ Note that any branch besides HEAD should be prefixed by origin/.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Default: none</para>
+ </listitem>
+
+ <listitem>
+ <para>Example:</para>
+
+ <programlisting>git.branch 72bf1c8</programlisting>
+ <programlisting>git.branch origin/next</programlisting>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </section>
</section>
<section id="reference.phases.checksum">
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080309/37a307b8/attachment.html
More information about the macports-changes
mailing list