Magellan Linux

Diff of /branches/mage-next/src/smage2.sh

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

revision 192 by niro, Fri Aug 19 03:43:56 2005 UTC revision 193 by niro, Fri Aug 19 14:14:59 2005 UTC
# Line 4  Line 4 
4  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
5    
6  # SMAGE2  # SMAGE2
7  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.23 2005-08-19 03:43:56 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.24 2005-08-19 14:14:59 niro Exp $
8    
9  #01.10.2004  #01.10.2004
10  # added ccache support  # added ccache support
# Line 406  setup_ccache_environment(){ Line 406  setup_ccache_environment(){
406   fi   fi
407  }  }
408    
409    
410    # fixes given dependencies to match a MAGE_TARGET
411    # fix_mage_deps -target s/depend # <-- '-' is essential ! (build_mage_script needs this)
412    fix_mage_deps() {
413     local target="$1"
414     local depend="$2"
415     local NDEPEND
416     local sym dep cat pver pname
417    
418     # deps and provides are special
419     # they must be fixed to match the target
420    
421     # run this only if target and depend is not empty
422     if [ -n "${target}" ] && [ -n "${depend}" ]
423     then
424     # fix DEPEND
425     while read sym dep
426     do
427     cat="$(dirname ${dep})"
428     # abort on virtual
429     [[ ${cat} = virtual ]] && continue
430    
431     # fix pver to target-pver
432     # to get pname-target-pver
433    
434     # doing it backwards !
435     pver="${dep##*-}"
436     pname=$(basename ${dep/-${pver}/})
437    
438     # do not add empty lines
439     if [ -z "${NDEPEND}" ]
440     then
441     NDEPEND="${sym} ${cat}/${pname}${target}-${pver}"
442     else
443     NDEPEND="${NDEPEND}
444     ${sym} ${cat}/${pname}${target}-${pver}"
445     fi
446    
447     unset cat pname pver
448     done << EOF
449    ${depend}
450    EOF
451     # set NDEPEND to DEPEND
452     depend="${NDEPEND}"
453     fi
454    
455     echo "${depend}"
456    }
457    
458  # build_mage_script(): helper functions for regen_mage_tree()  # build_mage_script(): helper functions for regen_mage_tree()
459  # generates an mage file with given information in smage file  # generates an mage file with given information in smage file
460  # needs at least:  # needs at least:
# Line 428  setup_ccache_environment(){ Line 477  setup_ccache_environment(){
477  #  #
478  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
479  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
480    #
481    # gets called with build_mage_script target # <-- '-' is essential !
482  build_mage_script()  build_mage_script()
483  {  {
484   local magefile   local magefile
485   local dest   local dest
486   local suffix   local target
487   local sym   local sym
488   local depname   local depname
489    
# Line 440  build_mage_script() Line 491  build_mage_script()
491   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
492    
493   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
494   suffix="$1"   target="$1"
495    
496   # name of magefile   # name of magefile
497   magefile="${PNAME}${suffix}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
498    
499   # destination to magefile   # destination to magefile
500   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${suffix}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
501    
502   # show what we are doing   # show what we are doing
503   echo "Generating Mage file:"   echo "Generating Mage file:"
# Line 457  build_mage_script() Line 508  build_mage_script()
508   > ${dest}   > ${dest}
509    
510   # header   # header
511   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.23 2005-08-19 03:43:56 niro Exp $' >> ${dest}   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.24 2005-08-19 14:14:59 niro Exp $' >> ${dest}
512   echo  >> ${dest}   echo  >> ${dest}
513    
514   # pgkname and state   # pgkname and state
515   echo "PKGNAME=\"${PNAME}${suffix}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
516   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
517   echo >> ${dest}   echo >> ${dest}
518    
# Line 485  build_mage_script() Line 536  build_mage_script()
536   echo >> ${dest}   echo >> ${dest}
537    
538   # deps and provides   # deps and provides
539   echo "DEPEND=\"${DEPEND}\"" >> ${dest}   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
540   echo "SDEPEND=\"${SDEPEND}\"" >> ${dest}   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
541   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
542   echo >> ${dest}   echo >> ${dest}
543    
# Line 525  regen_mage_tree() Line 576  regen_mage_tree()
576   for i in ${MAGE_TARGETS}   for i in ${MAGE_TARGETS}
577   do   do
578   echo   echo
579   build_mage_script "${i}"   build_mage_script "-${i}"
580   echo   echo
581   done   done
582   fi   fi

Legend:
Removed from v.192  
changed lines
  Added in v.193