Magellan Linux

Diff of /trunk/mage/usr/lib/mage/mage4.functions.sh

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

revision 1603 by niro, Tue Jan 3 16:17:48 2012 UTC revision 1653 by niro, Fri Jan 13 23:17:40 2012 UTC
# Line 66  mchecksum() Line 66  mchecksum()
66   case ${method} in   case ${method} in
67   md5) cmd="md5sum" ;;   md5) cmd="md5sum" ;;
68   sha256) cmd="sha256sum" ;;   sha256) cmd="sha256sum" ;;
69   *) die "mchecksum(): unkown method '${method}'" ;;   *) die "mchecksum(): unknown method '${method}'" ;;
70   esac   esac
71    
72   if [[ -d ${rundir} ]]   if [[ -d ${rundir} ]]
# Line 82  mchecksum() Line 82  mchecksum()
82   return "${retval}"   return "${retval}"
83  }  }
84    
85    mcheckemptydir()
86    {
87     local dir="$1"
88     local retval=1
89    
90     if [[ ! -d ${dir} ]]
91     then
92     echo "mcheckemptydir(): '${dir}' is not a directory!"
93     retval=3
94     else
95     shopt -s nullglob dotglob
96     files=( ${dir}/* )
97     (( ${#files[*]} )) || retval=0
98     shopt -u nullglob dotglob
99     fi
100    
101     return ${retval}
102    }
103    
104  unpack_packages()  unpack_packages()
105  {  {
106   local list="$@"   local list="$@"
# Line 1401  mdownload() Line 1420  mdownload()
1420   real_uris="$(convertmirrors ${uri})"   real_uris="$(convertmirrors ${uri})"
1421    
1422   # verbose or not   # verbose or not
1423   mqueryfeature "!verbose" && wget_opts="--quiet"   mqueryfeature "!verbose" && wget_opts+=" --quiet"
1424    
1425   # filter wget options if busybox was found   # filter wget options if busybox was found
1426   wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"   wget_opts+=" $(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
1427    
1428   # create outputdir   # create outputdir
1429   [[ ! -d ${outputdir} ]] && install -d "${outputdir}"   [[ ! -d ${outputdir} ]] && install -d "${outputdir}"
# Line 1579  syncmage_tarball() Line 1598  syncmage_tarball()
1598   else   else
1599   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1600   echo -n "checking md5sum... "   echo -n "checking md5sum... "
1601   ( cd ${temp}; md5sum -c ${latest_md5} ) || die "md5 for ${latest_tarball} failed"   mchecksum --rundir "${temp}" --file "${latest_md5}" --method md5 || die "md5 for ${latest_tarball} failed"
1602   fi   fi
1603    
1604   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
# Line 1645  xtitleclean() Line 1664  xtitleclean()
1664  }  }
1665    
1666    
1667  # cuts full pathnames or versionized names down to basename  # unused?
1668  choppkgname()  #
1669  {  # # cuts full pathnames or versionized names down to basename
1670   #we want this only if full name was used  # choppkgname()
1671   if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ]  # {
1672   then  # #we want this only if full name was used
1673   #cuts ARCH and PBUILD  # if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ]
1674   #ARCH comes from ${MAGERC}  # then
1675   MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g")  # #cuts ARCH and PBUILD
1676    # #ARCH comes from ${MAGERC}
1677    # MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}$(print_distrotag)-r*.::g")
1678    #
1679    # #cuts version number
1680    # MAGENAME=$(basename ${MAGENAME%-*} .mage)
1681    # fi
1682    # }
1683    
  #cuts version number  
  MAGENAME=$(basename ${MAGENAME%-*} .mage)  
  fi  
 }  
1684    
1685  # get_categorie $PNAME, returns CATEGORIE  # get_categorie $PNAME, returns CATEGORIE
1686  # $1=pname  # $1=pname
# Line 2759  md5sum_packages() Line 2781  md5sum_packages()
2781   then   then
2782   echo -ne "${COLBLUE} *** ${COLDEFAULT}"   echo -ne "${COLBLUE} *** ${COLDEFAULT}"
2783   echo -ne "checking md5sum (${count_current}/${count_total}): "   echo -ne "checking md5sum (${count_current}/${count_total}): "
2784   ( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed"   mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 || die "md5 for ${pkgfile} failed"
2785   else   else
2786   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2787   echo -e "!! no md5sum file found for ${pkgfile} :("   echo -e "!! no md5sum file found for ${pkgfile} :("
# Line 2999  pkgsearch() Line 3021  pkgsearch()
3021   local state   local state
3022   local descriptiom   local descriptiom
3023   local homepage   local homepage
3024     local license
3025   local i   local i
3026   local all_installed   local all_installed
3027   local ipver   local ipver
# Line 3035  pkgsearch() Line 3058  pkgsearch()
3058   state="$(get_value_from_magefile STATE ${magefile})"   state="$(get_value_from_magefile STATE ${magefile})"
3059   description="$(get_value_from_magefile DESCRIPTION ${magefile})"   description="$(get_value_from_magefile DESCRIPTION ${magefile})"
3060   homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"   homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"
3061     license="$(get_value_from_magefile LICENSE ${magefile})"
3062    
3063   # all installed   # all installed
3064   for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})   for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})
3065   do   do
3066   ipver="$(magename2pver ${i})"   ipver="$(magename2pver ${i})"
3067   ipbuild="$(magename2pbuild ${i})"   ipbuild="$(magename2pbuild ${i})"
3068    
3069   if [[ -z ${all_installed} ]]   if [[ -z ${all_installed} ]]
3070   then   then
3071   all_installed="${ipver}-${ipbuild}"   all_installed="${ipver}-${ipbuild}"
# Line 3050  pkgsearch() Line 3074  pkgsearch()
3074   fi   fi
3075   done   done
3076   [[ -z ${all_installed} ]] && all_installed="none"   [[ -z ${all_installed} ]] && all_installed="none"
3077    
3078   case ${state} in   case ${state} in
3079   stable) state=${COLGREEN}"[s] ";;   stable) state=${COLGREEN}"[s] ";;
3080   testing) state=${COLYELLOW}"[t] ";;   testing) state=${COLYELLOW}"[t] ";;
# Line 3095  EOF Line 3119  EOF
3119   echo "      Installed versions: ${all_installed}"   echo "      Installed versions: ${all_installed}"
3120   echo "      Description: ${description}"   echo "      Description: ${description}"
3121   echo "      Homepage: ${homepage}"   echo "      Homepage: ${homepage}"
3122     if [[ ! -z ${license} ]]
3123     then
3124     echo "      License:  ${license}"
3125     fi
3126   echo "      Depends: ${deps}"   echo "      Depends: ${deps}"
3127   echo "      SDepends: ${sdeps}"   echo "      SDepends: ${sdeps}"
3128   echo   echo
# Line 3285  known_mage_feature() Line 3313  known_mage_feature()
3313   ccache|!ccache) retval=0 ;;   ccache|!ccache) retval=0 ;;
3314   check|!check) retval=0 ;;   check|!check) retval=0 ;;
3315   compressdoc|!compressdoc) retval=0 ;;   compressdoc|!compressdoc) retval=0 ;;
3316     debug|!debug) retval=0 ;;
3317   distcc|!distcc) retval=0 ;;   distcc|!distcc) retval=0 ;;
3318   kernelsrcunpack|!kernelsrcunpack) retval=0 ;;   kernelsrcunpack|!kernelsrcunpack) retval=0 ;;
3319   libtool|!libtool) retval=0 ;;   libtool|!libtool) retval=0 ;;
3320   linuxsymlink|!linuxsymlink) retval=0 ;;   linuxsymlink|!linuxsymlink) retval=0 ;;
3321   pkgbuild|!pkgbuild) retval=0 ;;   pkgbuild|!pkgbuild) retval=0 ;;
3322     pkgdistrotag|!pkgdistrotag) retval=0 ;;
3323   purge|!purge) retval=0 ;;   purge|!purge) retval=0 ;;
3324   qalint|!qalint) retval=0 ;;   qalint|!qalint) retval=0 ;;
3325   regentree|!regentree) retval=0 ;;   regentree|!regentree) retval=0 ;;
3326   stepbystep|!stepbystep) retval=0 ;;   resume|!resume) retval=0 ;;
3327   srcpkgbuild|!srcpkgbuild) retval=0 ;;   srcpkgbuild|!srcpkgbuild) retval=0 ;;
3328   srcpkgtarball|!srcpkgtarball) retval=0 ;;   srcpkgtarball|!srcpkgtarball) retval=0 ;;
3329     static|!static) retval=0 ;;
3330     stepbystep|!stepbystep) retval=0 ;;
3331   strip|!strip) retval=0 ;;   strip|!strip) retval=0 ;;
3332     verbose|!verbose) retval=0 ;;
3333   *) retval=1 ;;   *) retval=1 ;;
3334   esac   esac
3335    
# Line 3325  msetfeature() Line 3358  msetfeature()
3358    
3359   if ! known_mage_feature "${feature}"   if ! known_mage_feature "${feature}"
3360   then   then
3361   [[ ${FVERBOSE} = off ]] || echo "unkown feature ${feature}, ignoring it"   [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}"
3362   return 3   return 3
3363   fi   fi
3364    
# Line 3378  mqueryfeature() Line 3411  mqueryfeature()
3411   fi   fi
3412   done   done
3413   else   else
3414     [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}"
3415   retval=3   retval=3
3416   fi   fi
3417    

Legend:
Removed from v.1603  
changed lines
  Added in v.1653