Magellan Linux

Diff of /branches/mage-next/src/mage4.functions.sh.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2810 by niro, Thu Aug 14 14:29:11 2014 UTC revision 2811 by niro, Wed Sep 3 12:01:21 2014 UTC
# Line 1713  pname2pcat() Line 1713  pname2pcat()
1713   echo "${categorie}"   echo "${categorie}"
1714  }  }
1715    
 # check_stable_package /path/to/foo.mage  
 # returns 0=stable 1=unstable  
 check_stable_package()  
 {  
  # first check if this magefile is not blacklisted  
  blacklisted "$1" || return 1  
   
  local STATE  
  STATE="$(get_value_from_magefile STATE "$1")"  
   
  # state testing  
  if [[ ${USE_TESTING} = true ]] || [[ ${MAGE_DISTRIBUTION} = testing ]]  
  then  
  case ${STATE} in  
  testing|stable) return 0 ;;  
  *) return 1 ;;  
  esac  
  fi  
   
  # state unstable  
  if [[ ${USE_UNSTABLE} = true ]] || [[ ${MAGE_DISTRIBUTION} = unstable ]]  
  then  
  case ${STATE} in  
  unstable|testing|stable) return 0 ;;  
  *) return 1 ;;  
  esac  
  fi  
   
  # no use_state given = stable  
  case ${STATE} in  
  stable) return 0 ;;  
  *) return 1 ;;  
  esac  
 }  
   
   
1716  # get_highest_magefile ${PCAT} ${PNAME}  # get_highest_magefile ${PCAT} ${PNAME}
1717  # fake at moment returns only stable pkgs (must set to be one)  # returns $HIGHEST_MAGEFILE
 # return $HIGHEST_MAGEFILE  
1718  get_highest_magefile()  get_highest_magefile()
1719  {  {
1720   local HIGHEST_MAGEFILE   local pcat="$1"
1721   local PCAT="$1"   local pname="$2"
  local PNAME="$2"  
  local magefile  
1722    
1723   # do not list the content of a directory, only the name (-d)   ${MLIBDIR}/highest_magefile ${MAGEDIR}/${pcat}/${pname}
  for magefile in $(ls --format=single-column -v -d ${MAGEDIR}/${PCAT}/${PNAME}/* 2> /dev/null)  
  do  
  [[ -z ${magefile} ]] && continue  
  # we exclude subdirs (for stuff like a md5sum dir)  
  [[ -d ${magefile} ]] && continue  
  if check_stable_package ${magefile}  
  then  
  HIGHEST_MAGEFILE=${magefile}  
  #for debug only  
  mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" >&2  
  fi  
  done  
   
  echo "${HIGHEST_MAGEFILE}"  
1724   return 0   return 0
1725  }  }
1726    
   
1727  ###################################################  ###################################################
1728  # function is_config_protected                    #  # function is_config_protected                    #
1729  #       is_config_protected /path/to/file         #  #       is_config_protected /path/to/file         #

Legend:
Removed from v.2810  
changed lines
  Added in v.2811