Magellan Linux

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

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

revision 1640 by niro, Fri Jan 13 18:29:52 2012 UTC revision 3081 by niro, Tue May 22 14:09:28 2018 UTC
# Line 7  Line 7 
7  smagesource()  smagesource()
8  {  {
9   local file="$1"   local file="$1"
10   local mystate   local localstate
11   local mycodename   local distfilestate
12     local mytag
13    
14   source ${file}   source ${file}
15    
16   [[ -n ${STATE} ]] && mystate="${STATE}"   # if PCAT was not set and PCATEGORIE was found
17     # inform the user and use PCATEGORIE as PCAT
18     if [[ -z ${PCAT} ]]
19     then
20     if [[ -n ${PCATEGORIE} ]]
21     then
22     PCAT="${PCATEGORIE}"
23     unset PCATEGORIE
24     # print a warning
25     echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}"
26     echo -e "${COLYELLOW}         Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}"
27     echo
28     else
29     die "Neither PCAT nor PCATEGORIE are defined!"
30     fi
31     fi
32    
33   # do not overide if local state was broken or disabled!   [[ -n ${STATE} ]] && localstate="${STATE}"
34   case ${STATE} in   [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}"
  broken) return ;;  
  disabled) return ;;  
  esac  
35    
36   if [ -f ${SMAGESCRIPTSDIR}/distribution ]   if [ -f ${SMAGESCRIPTSDIR}/distribution ]
37   then   then
38   source ${SMAGESCRIPTSDIR}/distribution   source ${SMAGESCRIPTSDIR}/distribution
39   [[ -n ${STATE} ]] && mystate="${STATE}"   [[ -n ${STATE} ]] && distfilestate="${STATE}"
40     [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}"
41     fi
42     # now switch state and export it but do not overide any local states
43     if [[ ! -z ${localstate} ]]
44     then
45     STATE="${localstate}"
46     else
47     STATE="${distfilestate}"
48     fi
49    
50     if mqueryfeature "pkgdistrotag"
51     then
52     # if DISTROTAG was not defined globally
53     # or in distribution file then deactivate this feature!
54     # at this point $mytag must have the distrotag
55     if [[ -z ${mytag} ]]
56     then
57     FVERBOSE=off msetfeature "!pkgdistrotag"
58     unset DISTROTAG
59     echo -e "${COLRED}Requested 'pkgdistrotag' but no \$DISTROTAG found!${COLDEFAULT}"
60     echo -e "${COLRED}Disabled the feature for pkgbuild sanity!${COLDEFAULT}"
61     else
62     # now switch state and export it but do not overide any local states
63     export DISTROTAG="${mytag}"
64     fi
65     else
66     unset DISTROTAG
67     fi
68    }
69    
70    print_distrotag()
71    {
72     if FVERBOSE=off mqueryfeature "pkgdistrotag"
73     then
74     if [[ ! -z ${DISTROTAG} ]]
75     then
76     # add a point as prefix
77     echo ".${DISTROTAG}"
78     fi
79   fi   fi
  # now switch state and export it  
  STATE="${mystate}"  
80  }  }
81    
82  showversion()  showversion()
# Line 175  download_sources() Line 225  download_sources()
225  }  }
226    
227  # dummy function, used if that does not exist in smage file  # dummy function, used if that does not exist in smage file
228    pkg_setup()
229    {
230     echo "no pkg_setup defined; doing nothing ..."
231     return 0
232    }
233    
234    # dummy function, used if that does not exist in smage file
235  src_prepare()  src_prepare()
236  {  {
237   echo "no src_prepare defined; doing nothing ..."   echo "no src_prepare defined; doing nothing ..."
# Line 231  mconfigure() Line 288  mconfigure()
288   fi   fi
289   fi   fi
290    
291   # always enable shared by default   # always enable shared by default but not for waf configure
292   if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]]   if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] &&
293     [[ -z $(./configure --version | grep waf) ]]
294   then   then
295   myopts+=" --enable-shared"   myopts+=" --enable-shared"
296   fi   fi
# Line 267  minstall() Line 325  minstall()
325   sysconfdir=${BINDIR}/etc \   sysconfdir=${BINDIR}/etc \
326   libdir=${BINDIR}/usr/$(mlibdir) \   libdir=${BINDIR}/usr/$(mlibdir) \
327   "$@" install || die "minstall failed"   "$@" install || die "minstall failed"
328          else   else
329                  die "no Makefile found"   die "no Makefile found"
330          fi   fi
331  }  }
332    
333  mmake()  mmake()
# Line 292  munpack() Line 350  munpack()
350   DEST=$2   DEST=$2
351   fi   fi
352    
353     echo -e "${COLBLUE}>>>${COLGREEN} Unpacking ${SOURCEDIR}/${PNAME}/${SRCFILE}${COLDEFAULT}"
354    
355   [[ ! -d ${DEST} ]] && install -d ${DEST}   [[ ! -d ${DEST} ]] && install -d ${DEST}
356    
357   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
# Line 341  munpack() Line 401  munpack()
401   tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."   tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
402   ;;   ;;
403   rar)   rar)
404   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed."
405   ;;   ;;
406   zip|xpi|jar)   zip|xpi|jar)
407   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
# Line 438  mstriplibs() Line 498  mstriplibs()
498    
499   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
500   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"
501   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "[shared object|pie executable]" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null
502  }  }
503    
504  mstripbins()  mstripbins()
# Line 447  mstripbins() Line 507  mstripbins()
507    
508   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
509   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"
510   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep -v "pie executable" | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null
511  }  }
512    
513  mstripstatic()  mstripstatic()
# Line 513  sminclude() Line 573  sminclude()
573   then   then
574   for i in $@   for i in $@
575   do   do
576   echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc"   [[ ${SILENT} = 1 ]] || echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc"
577   source ${SMAGESCRIPTSDIR}/include/${i}.sminc   source ${SMAGESCRIPTSDIR}/include/${i}.sminc
578   done   done
579   echo   [[ ${SILENT} = 1 ]] || echo
580     fi
581    }
582    
583    march()
584    {
585     local retval
586    
587     if [[ ! -z ${ARCH} ]]
588     then
589     echo "${ARCH}"
590     retval=0
591     else
592     retval=1
593     fi
594    
595     return "${retval}"
596    }
597    
598    marchvariable()
599    {
600     local retval
601     local var="$1"
602    
603     [[ -n ${var} ]] || die "marchvariable(): missing variable"
604    
605     if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
606     then
607     eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'
608     retval=0
609     else
610     retval=1
611     fi
612    
613     return "${retval}"
614    }
615    
616    marchsrcfile()
617    {
618     local retval
619     local var="$1"
620    
621     [[ -z ${var} ]] && var="SRCFILE"
622    
623     marchvariable "${var}" || die
624    }
625    
626    marchsrcdir()
627    {
628     local retval
629     local var="$1"
630    
631     [[ -z ${var} ]] && var="SRCDIR"
632    
633     marchvariable "${var}" || die
634    }
635    
636    marchdepend()
637    {
638     local retval
639     local var="$1"
640    
641     [[ -z ${var} ]] && var="DEPEND"
642    
643     if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
644     then
645     # evaluate with escape strings for the magefile if called by smage
646     # but do not escape if the smagefile was called by depwalker directly
647     if [[ ${SMAGE_DEPEND} = 1 ]]
648     then
649     eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'
650     else
651     echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"
652     fi
653     retval=0
654     else
655     retval=1
656   fi   fi
657    
658     return "${retval}"
659    }
660    
661    marchsdepend()
662    {
663     local retval
664     local var="$1"
665    
666     [[ -z ${var} ]] && var="SDEPEND"
667    
668     if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
669     then
670     # evaluate with escape strings for the magefile if called by smage
671     # but do not escape if the smagefile was called by depwalker directly
672     if [[ ${SMAGE_DEPEND} = 1 ]]
673     then
674     eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'
675     else
676     echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"
677     fi
678     retval=0
679     else
680     retval=1
681     fi
682    
683     return "${retval}"
684  }  }
685    
686  setup_distcc_environment()  setup_distcc_environment()
# Line 535  setup_distcc_environment() Line 698  setup_distcc_environment()
698   fi   fi
699  }  }
700    
701  setup_ccache_environment()  setup_icecc_environment()
702  {  {
703   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/icecc ]
704   then   then
705   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"   echo -e "${COLBLUE}---${COLGREEN} Using IceCC for compilation ...${COLDEFAULT}"
706   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"   export PATH=/usr/$(mlibdir)/icecc/bin:${PATH} || die "icecc: could not export new $PATH"
707   fi   fi
708  }  }
709    
710  # fixes given dependencies to match a MAGE_TARGET  setup_ccache_environment()
711  # fix_mage_deps -target s/depend # <-- note -target !  {
712  fix_mage_deps()   if [ -x /usr/bin/ccache ]
 {  
  local target="$1"  
  local depend="$2"  
  local NDEPEND  
  local sym dep cat pver pname  
   
  # deps and provides are special  
  # they must be fixed to match the target  
   
  # run this only if target and depend is not empty  
  if [ -n "${target}" ] && [ -n "${depend}" ]  
713   then   then
714   # fix DEPEND   mqueryfeature "icecc" && export CCACHE_PREFIX=icecc
  while read sym dep  
  do  
  # ignore empty lines  
  [[ -z ${dep} ]] && continue  
715    
716   cat="$(dirname ${dep})"   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
717   # change if not virtual   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"
  if [[ ${cat} = virtual ]]  
  then  
  pname="$(basename ${dep})"  
  else  
  # fix pver to target-pver  
  # to get pname-target-pver  
   
  # doing it backwards !  
  pver="${dep##*-}"  
  # full pver  
  pname="$(basename ${dep/-${pver}/})${target}-${pver}"  
  fi  
   
  # do not add empty lines  
  if [ -z "${NDEPEND}" ]  
  then  
  NDEPEND="${sym} ${cat}/${pname}"  
  else  
  NDEPEND="${NDEPEND}  
  ${sym} ${cat}/${pname}"  
  fi  
   
  unset cat pname pver  
  done << EOF  
 ${depend}  
 EOF  
  # set NDEPEND to DEPEND  
  depend="${NDEPEND}"  
718   fi   fi
   
  echo "${depend}"  
719  }  }
720    
721  # build_mage_script(): helper functions for regen_mage_tree()  # build_mage_script(): helper functions for regen_mage_tree()
# Line 606  EOF Line 724  EOF
724  #   PNAME                 name of pkg  #   PNAME                 name of pkg
725  #   PVER                  version  #   PVER                  version
726  #   PBUILD                revision  #   PBUILD                revision
727  #   PCATEGORIE            category of the pkg  #   PCAT                  category of the pkg
728    #   PCATEGORIE            category of the pkg (deprecated, use PCAT!)
729  #   STATE                 state of pkg stable|unstable|old  #   STATE                 state of pkg stable|unstable|old
730  #   DESCRIPTION           a short description (opt)  #   DESCRIPTION           a short description (opt)
731  #   HOMEPAGE              homepage (opt)  #   HOMEPAGE              homepage (opt)
732    #   LICENSE               license information of the pkg (opt)
733  #   DEPEND                runtime dependencies (opt)  #   DEPEND                runtime dependencies (opt)
734  #   SDEPEND               adds needed deps to build the pkg (opt)  #   SDEPEND               adds needed deps to build the pkg (opt)
735  #   PROVIDE               provides a virtual (opt)  #   PROVIDE               provides a virtual (opt)
# Line 631  build_mage_script() Line 751  build_mage_script()
751  {  {
752   local magefile   local magefile
753   local dest   local dest
  local target  
754   local split_pkg_base   local split_pkg_base
755   local sym   local sym
756   local depname   local depname
# Line 639  build_mage_script() Line 758  build_mage_script()
758   # if MAGE_TREE_DEST not set use BUILDDIR   # if MAGE_TREE_DEST not set use BUILDDIR
759   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
760    
  # determinate which suffix this mage file should get, if any  
  [[ $1 = --target ]] && shift && target="-$1"  
   
761   # mark package as splitpackage   # mark package as splitpackage
762   [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"   [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
763    
764   # name of magefile   # name of magefile
765   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}-${PVER}-${PBUILD}.mage"
766    
767   # destination to magefile   # destination to magefile
768   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}/${magefile}"
769    
770   # show what we are doing   # show what we are doing
771   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
# Line 660  build_mage_script() Line 776  build_mage_script()
776   > ${dest}   > ${dest}
777    
778   # pgkname and state   # pgkname and state
779   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest}
780   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
781    
782   # description and homepage   # description and homepage
783   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
784   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
785    
786     # license information
787     echo "LICENSE=\"${LICENSE}\"" >> ${dest}
788    
789   # special tags and vars   # special tags and vars
790   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
791    
  # echo MAGE_TARGETS ## note -target is needed !  
  echo "MAGE_TARGETS=\"${target}\"" >> ${dest}  
   
792   # split package base   # split package base
793   echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}   echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
794    
# Line 701  build_mage_script() Line 817  build_mage_script()
817   fi   fi
818    
819   # deps and provides   # deps and provides
820   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}   echo "DEPEND=\"${DEPEND}\"" >> ${dest}
821   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}   echo "SDEPEND=\"${SDEPEND}\"" >> ${dest}
822   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
823    
824   # add special functions   # add special functions
# Line 713  build_mage_script() Line 829  build_mage_script()
829   do   do
830   # add to mage (quotes needed !)   # add to mage (quotes needed !)
831   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
  # unset to be safe (quotes needed !)  
  #unset "${i}" <-- later to get every target built  
832   done   done
833   fi   fi
834    
# Line 732  regen_mage_tree() Line 846  regen_mage_tree()
846   # build them only if requested   # build them only if requested
847   if mqueryfeature regentree   if mqueryfeature regentree
848   then   then
  # run it without targets  
  if [[ -n ${MAGE_TARGETS} ]]  
  then  
  # build for each target a mage file  
  # run it with several targets  
  echo  
  for subpackage in ${MAGE_TARGETS}  
  do  
  build_mage_script --target "${subpackage}"  
  done  
  echo  
   
849   # run it for splitpackages   # run it for splitpackages
850   elif [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
851   then   then
852   local split_pkg_base="${PNAME}"   local split_pkg_base="${PNAME}"
853   # save smage environment   # save smage environment
# Line 758  regen_mage_tree() Line 860  regen_mage_tree()
860   # get the right variables for the split   # get the right variables for the split
861   export PNAME="${subpackage}"   export PNAME="${subpackage}"
862   split_info_${subpackage}   split_info_${subpackage}
863     # fix PCATEGORIE -> PCAT
864     if [[ ! -z ${PCATEGORIE} ]]
865     then
866     PCAT="${PCATEGORIE}"
867     unset PCATEGORIE
868     fi
869   # get the preinstall etc   # get the preinstall etc
870   split_export_inherits ${subpackage}   split_export_inherits ${subpackage}
871   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
# Line 779  regen_mage_tree() Line 887  regen_mage_tree()
887    
888   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
889   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
  # unset to be safe (quotes needed !)  
 # for i in ${SPECIAL_FUNCTIONS}  
 # do  
 # unset "${i}"  
 # done  
890   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
 # for i in ${SPECIAL_VARS}  
 # do  
 # unset "${i}"  
 # done  
891   unset SPECIAL_VARS   unset SPECIAL_VARS
892   unset STATE   unset STATE
893   unset DESCRIPTION   unset DESCRIPTION
# Line 809  split_save_variables() Line 908  split_save_variables()
908   export SAVED_PNAME="${PNAME}"   export SAVED_PNAME="${PNAME}"
909   export SAVED_PVER="${PVER}"   export SAVED_PVER="${PVER}"
910   export SAVED_PBUILD="${PBUILD}"   export SAVED_PBUILD="${PBUILD}"
911   export SAVED_PCATEGORIE="${PCATEGORIE}"   export SAVED_PCAT="${PCAT}"
912   export SAVED_DESCRIPTION="${DESCRIPTION}"   export SAVED_DESCRIPTION="${DESCRIPTION}"
913   export SAVED_HOMEPAGE="${HOMEPAGE}"   export SAVED_HOMEPAGE="${HOMEPAGE}"
914   export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"   export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
915     export SAVED_SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS}"
916   export SAVED_STATE="${STATE}"   export SAVED_STATE="${STATE}"
  export SAVED_PKGTYPE="${PKGTYPE}"  
917   export SAVED_INHERITS="${INHERITS}"   export SAVED_INHERITS="${INHERITS}"
918   export SAVED_DEPEND="${DEPEND}"   export SAVED_DEPEND="${DEPEND}"
919   export SAVED_SDEPEND="${SDEPEND}"   export SAVED_SDEPEND="${SDEPEND}"
# Line 884  split_restore_variables() Line 983  split_restore_variables()
983   export PNAME="${SAVED_PNAME}"   export PNAME="${SAVED_PNAME}"
984   export PVER="${SAVED_PVER}"   export PVER="${SAVED_PVER}"
985   export PBUILD="${SAVED_PBUILD}"   export PBUILD="${SAVED_PBUILD}"
986   export PCATEGORIE="${SAVED_PCATEGORIE}"   export PCAT="${SAVED_PCAT}"
987   export DESCRIPTION="${SAVED_DESCRIPTION}"   export DESCRIPTION="${SAVED_DESCRIPTION}"
988   export HOMEPAGE="${SAVED_HOMEPAGE}"   export HOMEPAGE="${SAVED_HOMEPAGE}"
989   export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"   export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
990     export SPECIAL_FUNCTIONS="${SAVED_SPECIAL_FUNCTIONS}"
991   export STATE="${SAVED_STATE}"   export STATE="${SAVED_STATE}"
  export PKGTYPE="${SAVED_PKGTYPE}"  
992   export INHERITS="${SAVED_INHERITS}"   export INHERITS="${SAVED_INHERITS}"
993   export DEPEND="${SAVED_DEPEND}"   export DEPEND="${SAVED_DEPEND}"
994   export SDEPEND="${SAVED_SDEPEND}"   export SDEPEND="${SAVED_SDEPEND}"
# Line 953  split_unset_variables() Line 1052  split_unset_variables()
1052   unset SAVED_PNAME   unset SAVED_PNAME
1053   unset SAVED_PVER   unset SAVED_PVER
1054   unset SAVED_PBUILD   unset SAVED_PBUILD
1055   unset SAVED_PCATEGORIE   unset SAVED_PCAT
1056   unset SAVED_DESCRIPTION   unset SAVED_DESCRIPTION
1057   unset SAVED_HOMEPAGE   unset SAVED_HOMEPAGE
1058   unset SAVED_SPECIAL_VARS   unset SAVED_SPECIAL_VARS
1059     unset SAVED_SPECIAL_FUNCTIONS
1060   unset SAVED_STATE   unset SAVED_STATE
1061   unset SAVED_PKGTYPE   unset SAVED_PKGTYPE
1062   unset SAVED_INHERITS   unset SAVED_INHERITS
# Line 1037  generate_package_md5sum() Line 1137  generate_package_md5sum()
1137   local pver   local pver
1138   local pbuild   local pbuild
1139   local parch   local parch
  local target  
1140   local pkgname   local pkgname
1141    
1142   # very basic getops   # very basic getops
# Line 1049  generate_package_md5sum() Line 1148  generate_package_md5sum()
1148   --pver|-v) shift; pver="$1" ;;   --pver|-v) shift; pver="$1" ;;
1149   --pbuild|-b) shift; pbuild="$1" ;;   --pbuild|-b) shift; pbuild="$1" ;;
1150   --parch|a) shift; parch="$1" ;;   --parch|a) shift; parch="$1" ;;
  --target|t) shift; target="$1" ;;  
1151   esac   esac
1152   shift   shift
1153   done   done
# Line 1065  generate_package_md5sum() Line 1163  generate_package_md5sum()
1163   [ -z "${PKGDIR}" ] && die "generate_package_md5sum() \$PKGDIR not set."   [ -z "${PKGDIR}" ] && die "generate_package_md5sum() \$PKGDIR not set."
1164   [ -z "${PKGSUFFIX}" ] && die "generate_package_md5sum() \$PKGSUFFIX not set."   [ -z "${PKGSUFFIX}" ] && die "generate_package_md5sum() \$PKGSUFFIX not set."
1165    
  # fix target as it may be empty !  
  [ -n "${target}" ] && target="-${target}"  
   
1166   # build pkgname   # build pkgname
1167   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}-${pver}-${parch}$(print_distrotag)-${pbuild}"
1168    
1169   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1170   if mqueryfeature regentree   if mqueryfeature regentree
# Line 1087  generate_package_md5sum() Line 1182  generate_package_md5sum()
1182   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1183    
1184   # setup md5 dir   # setup md5 dir
1185   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"
1186   install -d ${dest}   install -d ${dest}
1187    
1188   # gen md5sum   # gen md5sum
# Line 1099  generate_package_md5sum() Line 1194  generate_package_md5sum()
1194    
1195  source_pkg_build()  source_pkg_build()
1196  {  {
  if [[ ${PKGTYPE} = virtual ]]  
  then  
  echo "Virtual package detected; src-pkg-tarball not necessary ..."  
  return 0  
  fi  
   
1197   if [[ ! -d ${SOURCEDIR}/${PNAME} ]]   if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
1198   then   then
1199   echo "No SRC_URI defined; src-pkg-tarball not necessary ..."   install -d ${SOURCEDIR}/${PNAME}
  return 0  
1200   fi   fi
1201    
1202   [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."   [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
# Line 1122  source_pkg_build() Line 1210  source_pkg_build()
1210   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1211   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1212    
1213   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}\n"
1214  }  }
1215    
1216  step_by_step()  step_by_step()
# Line 1154  run_resume() Line 1242  run_resume()
1242   return 1   return 1
1243   fi   fi
1244  }  }
1245    
1246    mqalint()
1247    {
1248     return 0
1249    }

Legend:
Removed from v.1640  
changed lines
  Added in v.3081