Changeset 460 for trunk


Ignore:
Timestamp:
10/07/2009 23:38:04 (3 years ago)
Author:
ccowart
Message:

This is a real, tested fix for the linking business. I've also
incorporated the link command into the manual page (and corrected
a minor typo in the EXAMPLES section).

This, along with [419] will need to be merged into 1.9 before
this can be closed out.

See #51

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman.8.in

    r453 r460  
    244244.Ar destination .  
    245245Arguments must be working copies. 
     246.It Cm link [ Fl f ] Ar target link_name  
     247The link command creates a symbolic link (See  
     248.Xr ln 1) pointing to the  
     249.Ar target  
     250file or directory. If  
     251.Ar link_name  
     252is a  
     253directory, the link will be created with the same  
     254.Xr basename 1 as  
     255.Ar target .  
     256The most common use of repository symlinks is to reconcile path differences 
     257between operatings systems. You can create freebsd/usr/local/etc/sudoers as 
     258a normal file. You can then create the link linux/etc/sudoers to point 
     259to the former file (in the freebsd module). This allows you to have a 
     260single copy of the file in different locations for different modules. 
    246261.It Cm mkdir Ar directory 
    247262Create a new version-controlled directory in your working copy. Parent 
     
    362377.Pp 
    363378And our host-specific configurations in the marvin portion 
    364 (www/etc/rc.conf-marvin): 
     379(marvin/etc/rc.conf-marvin): 
    365380.Pp 
    366381.Dl apache22_enable="YES" 
  • trunk/confmanlib.sh.in

    r454 r460  
    544544    local link=$2 
    545545    local forced=$3 
    546     local opts isdir linkdir 
     546    local opts isdir linkdir rtarget rlink 
    547547 
    548548    if [ "$forced" == "true" ] ; then 
     
    553553    fi 
    554554 
    555     if [ -d "$link" ]; then 
    556         isdir="true" 
    557         if [[ "$link" =~ /$ ]]; then 
    558             link=${link%\/} 
    559         fi 
    560     fi 
    561  
    562     ABS_WORK=`${readlink_cmd} -m $WORK_PATH` 
     555    if [ -d "$link" ] ; then 
     556        link="${link}/$(basename "${target}")" 
     557    fi 
     558 
     559    # target needs to be transformed to be relative to the link. In order 
     560    # to do this, we need to cannonicalize filenames relative to the 
     561    # working copy root 
     562 
     563    ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 
    563564    target=`${readlink_cmd} -m $target` 
    564     target=${target/$ABS_WORK\//} 
     565    rtarget=${target#${ABS_WORK}/} 
     566 
     567    if [ "$target" = "$rtarget" ] ; then 
     568        echo "target $target does not appear to be in your working copy." >&4 
     569        return 1 
     570    fi 
     571 
    565572    link=`${readlink_cmd} -m $link` 
    566     linkdir="${link/$ABS_WORK\//}/" 
     573    rlink="${link#${ABS_WORK}/}" 
     574 
     575    if [ "$link" = "$rlink" ] ; then 
     576        echo "link $link does not appear to be in your working copy." >&4 
     577        return 1 
     578    fi 
     579 
     580    linkdir="${rlink%/*}/" 
    567581 
    568582    while [[ ${linkdir} =~ ^.+/ ]]; do 
    569         target="../$target" 
     583        rtarget="../$rtarget" 
    570584        linkdir=${linkdir#*/} 
    571585    done 
    572586 
    573     if [ -n "$isdir" ] ; then 
    574         link="${link}/${target/*\//}" 
    575     fi 
    576  
    577     ln -s $opts "$target" "$link" 
    578     @SVN@ add "$link" 
     587    ln -s $opts "$rtarget" "${WORK_PATH}/$rlink" 
     588    @SVN@ add "${WORK_PATH}/$rlink" 
    579589} 
    580590 
Note: See TracChangeset for help on using the changeset viewer.