Ticket #77: safe.diff

File safe.diff, 2.1 kB (added by Jan-Nik, 4 months ago)
  • makepackage

    old new  
    195195        source "apkg-funclib" 
    196196        popd >/dev/null 
    197197 
    198         # check and install CVS directory apbuild 
     198        # check and install SVN directory apbuild 
    199199        _installApbuild -q 
    200200fi 
    201201 
     
    304304    green; out "done"; normal 
    305305} 
    306306 
    307 function cleanUp() 
     307function safeRemove() 
    308308{ 
    309         [ "$payload_dir" != "" ] && rm -rf "$payload_dir" 
    310         [ "$metadata_dir" != "" ] && rm -rf "$metadata_dir" 
    311  
    312         oPWD="$PWD" 
    313         cd -P "$build_root" 
    314         build_root=$PWD 
    315         cd -P $oPWD 
    316         if [[ "$build_root" != "$PWD" && "$build_root" != "" && "$APKG_BUILD_ROOT" == "" ]]; then 
    317                 rm -rf "$build_root" 
     309        if [[ "$1" == ${TMP}/* ]]; then # Only remove paths in ${TMP} 
     310                rm -rf "$1" 
    318311        fi 
    319         cd "$current_directory" 
     312
    320313 
    321         [ "$_virtual_build_root" != "." -a "$_virtual_build_root" != "" -a "$APKG_BUILD_ROOT" = "" ] && rm -rf "$_virtual_build_root" 
    322         [ "$__apkg_errors_file" != "." ] && rm -f "$__apkg_errors_file" 
     314function cleanUp() 
     315
     316        safeRemove "$payload_dir" 
     317        safeRemove "$metadata_dir" 
     318        safeRemove "$current_directory" 
     319        safeRemove "$_virtual_build_root" 
     320        safeRemove "$__apkg_errors_file" 
    323321        unset payload_dir 
    324322        unset metadata_dir 
    325323        unset build_root 
     
    979977                        if [[ "$res" != "0" ]]; then # and this accumulates the file refs: @gnome.org/libxml/skeleton.2 
    980978                                if [[ "$res" == "1" ]]; then 
    981979                                        red; outn "FAIL: "; normal;  out "Could not locate skeleton package for '%s'" "$requirement"; 
    982                                         normal; out "Try running cvs update in the skeletons directory to get the latest files" 
     980                                        normal; out "Try running svn update in the skeletons directory to get the latest files" 
    983981                                        return $ERROR_MISSING_SKELETON; 
    984982                                elif [[ "$res" == "2" ]]; then 
    985983                                        red; outn "FAIL: "; normal; out "Bad skeleton for %s, not in ASCII text format" "$requirement"; 
    986                                         normal; out "Try running cvs update in the skeletons directory to get the latest files" 
     984                                        normal; out "Try running svn update in the skeletons directory to get the latest files" 
    987985                                        return $ERROR_MISSING_SKELETON; 
    988986                                elif [[ "$res" == "3" ]]; then 
    989987                                        red