Magellan Linux

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

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

revision 1640 by niro, Fri Jan 13 18:29:52 2012 UTC revision 1679 by niro, Mon Feb 6 10:04:33 2012 UTC
# Line 8  smagesource() Line 8  smagesource()
8  {  {
9   local file="$1"   local file="$1"
10   local mystate   local mystate
11   local mycodename   local mytag
12    
13   source ${file}   source ${file}
14    
15     # if PCAT was not set and PCATEGORIE was found
16     # inform the user and use PCATEGORIE as PCAT
17     if [[ -z ${PCAT} ]]
18     then
19     if [[ -n ${PCATEGORIE} ]]
20     then
21     PCAT="${PCATEGORIE}"
22     unset PCATEGORIE
23     # print a warning
24     echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}"
25     echo -e "${COLYELLOW}         Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}"
26     echo
27     else
28     die "Neither PCAT nor PCATEGORIE are defined!"
29     fi
30     fi
31    
32   [[ -n ${STATE} ]] && mystate="${STATE}"   [[ -n ${STATE} ]] && mystate="${STATE}"
33     [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}"
34    
35   # do not overide if local state was broken or disabled!   # do not overide if local state was broken or disabled!
36   case ${STATE} in   case ${STATE} in
# Line 24  smagesource() Line 42  smagesource()
42   then   then
43   source ${SMAGESCRIPTSDIR}/distribution   source ${SMAGESCRIPTSDIR}/distribution
44   [[ -n ${STATE} ]] && mystate="${STATE}"   [[ -n ${STATE} ]] && mystate="${STATE}"
45     [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}"
46   fi   fi
47   # now switch state and export it   # now switch state and export it
48   STATE="${mystate}"   STATE="${mystate}"
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
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
80  }  }
81    
82  showversion()  showversion()
# Line 606  EOF Line 656  EOF
656  #   PNAME                 name of pkg  #   PNAME                 name of pkg
657  #   PVER                  version  #   PVER                  version
658  #   PBUILD                revision  #   PBUILD                revision
659  #   PCATEGORIE            category of the pkg  #   PCAT                  category of the pkg
660    #   PCATEGORIE            category of the pkg (deprecated, use PCAT!)
661  #   STATE                 state of pkg stable|unstable|old  #   STATE                 state of pkg stable|unstable|old
662  #   DESCRIPTION           a short description (opt)  #   DESCRIPTION           a short description (opt)
663  #   HOMEPAGE              homepage (opt)  #   HOMEPAGE              homepage (opt)
664    #   LICENSE               license information of the pkg (opt)
665  #   DEPEND                runtime dependencies (opt)  #   DEPEND                runtime dependencies (opt)
666  #   SDEPEND               adds needed deps to build the pkg (opt)  #   SDEPEND               adds needed deps to build the pkg (opt)
667  #   PROVIDE               provides a virtual (opt)  #   PROVIDE               provides a virtual (opt)
# Line 649  build_mage_script() Line 701  build_mage_script()
701   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
702    
703   # destination to magefile   # destination to magefile
704   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}${target}/${magefile}"
705    
706   # show what we are doing   # show what we are doing
707   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
# Line 660  build_mage_script() Line 712  build_mage_script()
712   > ${dest}   > ${dest}
713    
714   # pgkname and state   # pgkname and state
715   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest}
716   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
717    
718   # description and homepage   # description and homepage
719   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
720   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
721    
722     # license information
723     echo "LICENSE=\"${LICENSE}\"" >> ${dest}
724    
725   # special tags and vars   # special tags and vars
726   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
727    
# Line 758  regen_mage_tree() Line 813  regen_mage_tree()
813   # get the right variables for the split   # get the right variables for the split
814   export PNAME="${subpackage}"   export PNAME="${subpackage}"
815   split_info_${subpackage}   split_info_${subpackage}
816     # fix PCATEGORIE -> PCAT
817     if [[ ! -z ${PCATEGORIE} ]]
818     then
819     PCAT="${PCATEGORIE}"
820     unset PCATEGORIE
821     fi
822   # get the preinstall etc   # get the preinstall etc
823   split_export_inherits ${subpackage}   split_export_inherits ${subpackage}
824   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
# Line 809  split_save_variables() Line 870  split_save_variables()
870   export SAVED_PNAME="${PNAME}"   export SAVED_PNAME="${PNAME}"
871   export SAVED_PVER="${PVER}"   export SAVED_PVER="${PVER}"
872   export SAVED_PBUILD="${PBUILD}"   export SAVED_PBUILD="${PBUILD}"
873   export SAVED_PCATEGORIE="${PCATEGORIE}"   export SAVED_PCAT="${PCAT}"
874   export SAVED_DESCRIPTION="${DESCRIPTION}"   export SAVED_DESCRIPTION="${DESCRIPTION}"
875   export SAVED_HOMEPAGE="${HOMEPAGE}"   export SAVED_HOMEPAGE="${HOMEPAGE}"
876   export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"   export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
# Line 884  split_restore_variables() Line 945  split_restore_variables()
945   export PNAME="${SAVED_PNAME}"   export PNAME="${SAVED_PNAME}"
946   export PVER="${SAVED_PVER}"   export PVER="${SAVED_PVER}"
947   export PBUILD="${SAVED_PBUILD}"   export PBUILD="${SAVED_PBUILD}"
948   export PCATEGORIE="${SAVED_PCATEGORIE}"   export PCAT="${SAVED_PCAT}"
949   export DESCRIPTION="${SAVED_DESCRIPTION}"   export DESCRIPTION="${SAVED_DESCRIPTION}"
950   export HOMEPAGE="${SAVED_HOMEPAGE}"   export HOMEPAGE="${SAVED_HOMEPAGE}"
951   export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"   export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
# Line 953  split_unset_variables() Line 1014  split_unset_variables()
1014   unset SAVED_PNAME   unset SAVED_PNAME
1015   unset SAVED_PVER   unset SAVED_PVER
1016   unset SAVED_PBUILD   unset SAVED_PBUILD
1017   unset SAVED_PCATEGORIE   unset SAVED_PCAT
1018   unset SAVED_DESCRIPTION   unset SAVED_DESCRIPTION
1019   unset SAVED_HOMEPAGE   unset SAVED_HOMEPAGE
1020   unset SAVED_SPECIAL_VARS   unset SAVED_SPECIAL_VARS
# Line 1069  generate_package_md5sum() Line 1130  generate_package_md5sum()
1130   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
1131    
1132   # build pkgname   # build pkgname
1133   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}$(print_distrotag)-${pbuild}"
1134    
1135   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1136   if mqueryfeature regentree   if mqueryfeature regentree
# Line 1122  source_pkg_build() Line 1183  source_pkg_build()
1183   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1184   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1185    
1186   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"
1187  }  }
1188    
1189  step_by_step()  step_by_step()

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