Changeset 34875


Ignore:
Timestamp:
Mar 10, 2008, 4:50:45 AM (12 years ago)
Author:
eridius@…
Message:

Add support for fetch.type git (Fixes #14232)

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/configure

    r34314 r34875  
    687687CVS
    688688SVN
     689GIT
    689690RSYNC
    690691SED
     
    35953596
    35963597
     3598# Extract the first word of "git", so it can be a program name with args.
     3599set dummy git; ac_word=$2
     3600{ echo "$as_me:$LINENO: checking for $ac_word" >&5
     3601echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
     3602if test "${ac_cv_path_GIT+set}" = set; then
     3603  echo $ECHO_N "(cached) $ECHO_C" >&6
     3604else
     3605  case $GIT in
     3606  [\\/]* | ?:[\\/]*)
     3607  ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
     3608  ;;
     3609  *)
     3610  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
     3611for as_dir in $PATH
     3612do
     3613  IFS=$as_save_IFS
     3614  test -z "$as_dir" && as_dir=.
     3615  for ac_exec_ext in '' $ac_executable_extensions; do
     3616  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     3617    ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
     3618    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     3619    break 2
     3620  fi
     3621done
     3622done
     3623IFS=$as_save_IFS
     3624
     3625  ;;
     3626esac
     3627fi
     3628GIT=$ac_cv_path_GIT
     3629if test -n "$GIT"; then
     3630  { echo "$as_me:$LINENO: result: $GIT" >&5
     3631echo "${ECHO_T}$GIT" >&6; }
     3632else
     3633  { echo "$as_me:$LINENO: result: no" >&5
     3634echo "${ECHO_T}no" >&6; }
     3635fi
     3636
     3637
    35973638# Extract the first word of "rsync", so it can be a program name with args.
    35983639set dummy rsync; ac_word=$2
     
    1304613087CVS!$CVS$ac_delim
    1304713088SVN!$SVN$ac_delim
     13089GIT!$GIT$ac_delim
    1304813090RSYNC!$RSYNC$ac_delim
    1304913091SED!$SED$ac_delim
     
    1307213114OBJC_LIBS!$OBJC_LIBS$ac_delim
    1307313115OBJC_PTHREAD_LIBS!$OBJC_PTHREAD_LIBS$ac_delim
    13074 OBJC_PTHREAD_CFLAGS!$OBJC_PTHREAD_CFLAGS$ac_delim
    1307513116_ACEOF
    1307613117
     
    1311413155for ac_last_try in false false false false false :; do
    1311513156  cat >conf$$subs.sed <<_ACEOF
     13157OBJC_PTHREAD_CFLAGS!$OBJC_PTHREAD_CFLAGS$ac_delim
    1311613158OBJC_FOUNDATION!$OBJC_FOUNDATION$ac_delim
    1311713159OBJC_FOUNDATION_LDFLAGS!$OBJC_FOUNDATION_LDFLAGS$ac_delim
     
    1318113223_ACEOF
    1318213224
    13183   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then
     13225  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then
    1318413226    break
    1318513227  elif $ac_last_try; then
  • trunk/base/configure.ac

    r34314 r34875  
    7575AC_PATH_PROG(CVS, [cvs], [])
    7676AC_PATH_PROG(SVN, [svn], [])
     77AC_PATH_PROG(GIT, [git], [])
    7778AC_PATH_PROG(RSYNC, [rsync], [])
    7879AC_PATH_PROG(SED, [sed])
  • trunk/base/doc/portfile.7

    r28677 r34875  
    737737      svn.url svn://www.domain.com/svn-repo/mydirectory
    738738.It Ic svn.tag
    739 Specify the a tag from which svn should fetch files. This
     739Specify a tag from which svn should fetch files. This
    740740corresponds to the -r option to the svn cli.  Note that you
    741741will need to use backslashes to escape characters that have
     
    752752.Dl svn.tag 37192
    753753      svn.tag \\{\\"2006-02-17 15:30 +0230\\"\\}
     754.El
     755.Ss FETCHING FROM GIT
     756As an alternative to fetching distribution files, pulling the sources
     757from a git repository is supported. Use of git can give rise to
     758non-reproducible builds, so it is strongly discouraged.
     759.Bl -tag -width lc
     760.It Ic git.url
     761Specify the url from which to fetch files
     762.br
     763.Sy Type:
     764.Em required
     765.br
     766.Sy Default:
     767.Em none
     768.br
     769.Sy Example:
     770.Dl git.url git://git.kernel.org/pub/scm/git/git.git
     771      git.url http://www.kernel.org/pub/scm/git/git.git
     772.It Ic git.branch
     773Specify a branch (or other commit-ish) that git should checkout.
     774Note that any branch besides HEAD should be prefixed by origin/.
     775.br
     776.Sy Type:
     777.Em optional
     778.br
     779.Sy Default:
     780.Em none
     781.br
     782.Sy Example:
     783.Dl git.branch 72bf1c8
     784      git.branch origin/next
    754785.El
    755786.Sh EXTRACT OPTIONS
  • trunk/base/src/port1.0/port_autoconf.tcl.in

    r33620 r34875  
    3434        variable cvs_path "@CVS@"
    3535        variable svn_path "@SVN@"
     36        variable git_path "@GIT@"
    3637        variable rsync_path "@RSYNC@"
    3738        variable mtree_path "@MTREE@"
  • trunk/base/src/port1.0/portfetch.tcl

    r32801 r34875  
    4646        master_sites.mirror_subdir patch_sites.mirror_subdir portname \
    4747        cvs.module cvs.root cvs.password cvs.date cvs.tag \
    48         svn.url svn.tag
     48        svn.url svn.tag \
     49        git.url git.branch
    4950       
    5051# XXX we use the command framework to buy us some useful features,
     
    7576default svn.args ""
    7677default svn.post_args {"${svn.url}"}
     78
     79default git.dir {${workpath}}
     80default git.branch {}
    7781
    7882# Set distfiles
     
    121125    switch -- "${fetch.type}" {
    122126        cvs                     -
    123         svn                     { return "" }
     127        svn                     -
     128        git                     { return "" }
    124129        standard        -
    125130        default         { return "${distname}${extract.suffix}" }
     
    388393}
    389394
     395# Perform a git fetch
     396proc gitfetch {args} {
     397    global worksrcpath prefix_frozen
     398    global git.url git.branch git.sha1
     399   
     400    # Look for the git command
     401    set git.cmd {}
     402    foreach gitcmd "$portutil::autoconf::git_path $prefix_frozen/bin/git git" {
     403        if {[file executable $gitcmd]} {
     404            set git.cmd $gitcmd
     405            break
     406        }
     407    }
     408    if {${git.cmd} == {}} {
     409        ui_error "git is required to fetch ${git.url}"
     410        ui_error "Please install the git-core port before proceeding."
     411        return -code error [msgcat::mc "Git command not found"]
     412    }
     413   
     414    set options "-q"
     415    if {[string length ${git.branch}] == 0} {
     416        # if we're just using HEAD, we can make a shallow repo
     417        set options "$options --depth=1"
     418    }
     419    set cmdstring "${git.cmd} clone $options ${git.url} ${worksrcpath} 2>&1"
     420    ui_debug "Executing: $cmdstring"
     421    if {[catch {system $cmdstring} result]} {
     422        return -code error [msgcat::mc "Git clone failed"]
     423    }
     424   
     425    if {[string length ${git.branch}] > 0} {
     426        set env "GIT_DIR=${worksrcpath}/.git GIT_WORK_TREE=${worksrcpath}"
     427        set cmdstring "$env ${git.cmd} checkout -q ${git.branch} 2>&1"
     428        ui_debug "Executing $cmdstring"
     429        if {[catch {system $cmdstring} result]} {
     430            return -code error [msgcat::mc "Git checkout failed"]
     431        }
     432    }
     433   
     434    if {[info exists patchfiles]} {
     435        return [fetchfiles]
     436    }
     437   
     438    return 0
     439}
     440
    390441# Perform a standard fetch, assembling fetch urls from
    391442# the listed url varable and associated distfile
     
    521572        cvs             { return [cvsfetch] }
    522573        svn             { return [svnfetch] }
     574        git             { return [gitfetch] }
    523575        standard -
    524576        default { return [fetchfiles] }
  • trunk/doc-new/guide/xml/portfile-phase.xml

    r33778 r34875  
    497497          <listitem>
    498498            <para>Change the fetch type. This is only necessary if a <link
    499             linkend="reference.phases.fetch.cvs">CVS</link> or <link
    500             linkend="reference.phases.fetch.svn">SVN</link> checkout is be
     499            linkend="reference.phases.fetch.cvs">CVS</link>, <link
     500            linkend="reference.phases.fetch.svn">svn</link>, or
     501            <link linkend="reference.phases.fetch.git">git</link> checkout is be
    501502            used. <option>standard</option> is used for a normal http or ftp
    502503            fetch using <varname>${distfiles}</varname> and is used as
     
    510511              <listitem>
    511512                <para>Values: <option>standard</option> <option>cvs</option>
    512                 <option>svn</option></para>
     513                <option>svn</option> <option>git</option></para>
    513514              </listitem>
    514515
     
    733734      <para>You have to set <link
    734735      linkend="reference.phases.fetch.advanced.fetch-type"><varname>fetch.type</varname></link>
    735       to <option>svn</option> to fetch from SVN.</para>
     736      to <option>svn</option> to fetch from svn.</para>
    736737
    737738      <variablelist>
     
    775776
    776777                <programlisting>svn.tag             37192</programlisting>
     778              </listitem>
     779            </itemizedlist>
     780          </listitem>
     781        </varlistentry>
     782      </variablelist>
     783    </section>
     784   
     785    <section id="reference.phases.fetch.git">
     786      <title>Fetch from Git</title>
     787
     788      <para><ulink url="http://git.or.cz/">Git</ulink> may
     789      be used as an alternative method of fetching distribution files using
     790      the keywords in this section. However, fetching via Git may cause
     791      non-reproducible builds, so it is strongly discouraged.</para>
     792
     793      <para>You have to set <link
     794      linkend="reference.phases.fetch.advanced.fetch-type"><varname>fetch.type</varname></link>
     795      to <option>git</option> to fetch from git.</para>
     796
     797      <variablelist>
     798        <varlistentry>
     799          <term>git.url</term>
     800
     801          <listitem>
     802            <para>This specifies the url from which to fetch files.</para>
     803
     804            <itemizedlist>
     805              <listitem>
     806                <para>Default: none</para>
     807              </listitem>
     808
     809              <listitem>
     810                <para>Examples:</para>
     811
     812                <programlisting>git.url             git://git.kernel.org/pub/scm/git/git.git</programlisting>
     813
     814                <programlisting>git.url             http://www.kernel.org/pub/scm/git/git.git</programlisting>
     815              </listitem>
     816            </itemizedlist>
     817          </listitem>
     818        </varlistentry>
     819
     820        <varlistentry>
     821          <term>git.branch</term>
     822
     823          <listitem>
     824            <para>Optional tag for fetching with git, this specifies a branch
     825              (or other commit-ish) that git should checkout.
     826              Note that any branch besides HEAD should be prefixed by origin/.</para>
     827
     828            <itemizedlist>
     829              <listitem>
     830                <para>Default: none</para>
     831              </listitem>
     832
     833              <listitem>
     834                <para>Example:</para>
     835
     836                <programlisting>git.branch             72bf1c8</programlisting>
     837                <programlisting>git.branch             origin/next</programlisting>
    777838              </listitem>
    778839            </itemizedlist>
Note: See TracChangeset for help on using the changeset viewer.