Ignore:
Timestamp:
03/08/14 12:53:14 (9 months ago)
Author:
Kris Moore <kris@…>
Branches:
releng/10.0
Children:
5e3985e
Parents:
8acecf9
Message:

Backport the fixes for package updates to releng/10.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/libsh/functions.sh

    rbe75ddc r045b2de  
    454454{ 
    455455 
    456   if [ -z "$EVENT_PIPE" ] ; then unset EVENT_PIPE ; fi 
    457  
    458456  # Lets test if we have any conflicts 
    459   pkg-static ${1} | tee /tmp/.pkgConflicts.$$ 
    460  
    461   cat /tmp/.pkgConflicts.$$ | grep -q "WARNING: locally installed" 
     457  pkg-static ${1} 2>&1| tee /tmp/.pkgConflicts.$$ 
     458 
     459  cat /tmp/.pkgConflicts.$$ | grep -q -e "WARNING: locally installed" -e "Conflict found" 
    462460  if [ $? -ne 0 ] ; then rm /tmp/.pkgConflicts.$$ ; return ; fi 
    463461 
     
    468466  # Nice ugly sed line, sure this can be neater 
    469467  cat /tmp/.pkgConflicts.$$ | grep 'WARNING: locally installed' \ 
    470         | sed 's|.*installed ||g' | sed 's| conflicts.*||g' | sort | uniq \ 
    471         > /tmp/.pkgConflicts.$$.2 
     468        | sed 's|.*installed ||g' | sed 's| conflicts.*||g' > /tmp/.pkgConflicts.$$.2 
     469 
     470  # Grab other style conflicts 
     471  cat /tmp/.pkgConflicts.$$ | grep "Conflict found on path" | cut -d ')' -f 2 | cut -d '(' -f 1 | awk '{print $2}' >> /tmp/.pkgConflicts.$$.2 
     472 
     473  # OMFG this is super-lame, not only do we have to grab different style conflicts 
     474  # but we may even have the *wrong* package name reported if it changed in the  
     475  # repo... I.E. py27-requests1-1.2.3 != py27-requests-1.2.3 
     476  # As a VERY crude work-around, grab the other origin names, see which one matches 
     477  cat /tmp/.pkgConflicts.$$ | grep "Conflict found on path" | cut -d '(' -f 2 | cut -d ')' -f 1 >> /tmp/.pkgConflicts.$$.2 
     478  cat /tmp/.pkgConflicts.$$ | grep "Conflict found on path" | cut -d '(' -f 3 | cut -d ")" -f 1 >> /tmp/.pkgConflicts.$$.2 
     479 
     480  # Get a sorted unique list 
     481  cat /tmp/.pkgConflicts.$$.2 | sort | uniq > /tmp/.pkgConflicts.$$.3 
    472482 
    473483  # Check how many conflicts we found 
    474   found=`wc -l /tmp/.pkgConflicts.$$.2 | awk '{print $1}'` 
     484  found=`wc -l /tmp/.pkgConflicts.$$.3 | awk '{print $1}'` 
    475485  if [ "$found" = "0" ] ; then 
    476486     rm /tmp/.pkgConflicts.$$ 
    477487     rm /tmp/.pkgConflicts.$$.2 
     488     rm /tmp/.pkgConflicts.$$.3 
    478489     return 0 
    479490  fi 
     491 
     492  # Done with EVENT_PIPE at this point 
     493  if [ -n "$EVENT_PIPE" ] ; then unset EVENT_PIPE; fi 
     494 
    480495 
    481496  while read line 
    482497  do 
    483     cList="$line $cList" 
    484   done < /tmp/.pkgConflicts.$$.2 
    485   rm /tmp/.pkgConflicts.$$.2  
     498    # Because PKGNG sucks, we have to now double-check again if these conflicts *really* 
     499    # are installed <facepalm> 
     500    pkg-static info -e $line 
     501    if [ $? -eq 0 ] ; then 
     502      cList="$line $cList" 
     503    fi 
     504  done < /tmp/.pkgConflicts.$$.3 
     505  rm /tmp/.pkgConflicts.$$.3 
     506  rm /tmp/.pkgConflicts.$$.2 
    486507  rm /tmp/.pkgConflicts.$$ 
    487508 
     
    518539     echo "Removing conflicting package: $bPkg" 
    519540 
    520      # If EVENT_PIPE is set, unset it, seems to cause some weird crash in pkgng 1.2.3 
    521      if [ -n "$EVENT_PIPE" ] ; then 
    522         oEP="$EVENT_PIPE" 
    523         unset EVENT_PIPE 
    524      fi 
    525  
    526541     # Delete the package now 
    527542     pkg delete -q -y -f ${bPkg} 
    528543 
    529      # Reset EVENT_PIPE if we need to 
    530      if [ -n "$oEP" ] ; then 
    531         EVENT_PIPE="$oEP"; export EVENT_PIPE 
    532         unset oEP 
    533      fi 
    534544  done 
    535545 
Note: See TracChangeset for help on using the changeset viewer.