Magellan Linux

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

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

revision 945 by niro, Sat Nov 21 01:31:33 2009 UTC revision 1273 by niro, Wed Apr 27 09:45:07 2011 UTC
# Line 50  export LC_ALL=C Line 50  export LC_ALL=C
50    
51  source /etc/mage.rc.global  source /etc/mage.rc.global
52  source ${MAGERC}  source ${MAGERC}
53    source ${MLIBDIR}/mage4.functions.sh
54    
55  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
56  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
# Line 153  download_sources() Line 154  download_sources()
154   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
155   local FETCHING   local FETCHING
156   local i mirror   local i mirror
157     local wget_opts
158    
159     # filter wget command if busybox was found
160     wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
161    
162   # install SRCDIR/PNAME if not exist   # install SRCDIR/PNAME if not exist
163   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
164    
165   # check if FETCHING is needed   # check if FETCHING is needed
166   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null )
167   if [[ $? = 0 ]]   if [[ $? = 0 ]]
168   then   then
169   # md5's ok, no fetching needed   # md5's ok, no fetching needed
# Line 198  download_sources() Line 202  download_sources()
202   then   then
203   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
204   wget \   wget \
205   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
206   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
207   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
208   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 222  download_sources() Line 223  download_sources()
223   then   then
224   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
225   wget \   wget \
226   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
227   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
228   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
229   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 246  download_sources() Line 244  download_sources()
244   then   then
245   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
246   wget \   wget \
247   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
248   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
249   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
250   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 270  download_sources() Line 265  download_sources()
265   then   then
266   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
267   wget \   wget \
268   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
269   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
270   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
271   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 294  download_sources() Line 286  download_sources()
286   then   then
287   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
288   wget \   wget \
289   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
290   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
291   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
292   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 313  download_sources() Line 302  download_sources()
302   then   then
303   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
304   wget \   wget \
305   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
306   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
307   "${my_SRC_URI}"   "${my_SRC_URI}"
308   fi   fi
# Line 332  download_sources() Line 318  download_sources()
318   # recheck md5 sums   # recheck md5 sums
319   echo   echo
320   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
321   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed"
322   echo   echo
323    
324   # not needed anymore   # not needed anymore
# Line 530  minstalldocs() Line 516  minstalldocs()
516   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
517   fi   fi
518    
519     local i
520   for i in ${docfiles}   for i in ${docfiles}
521   do   do
522   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
523   install -m 0644 ${SRCDIR}/${i}.gz \   then
524   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
525     install -m 0644 ${SRCDIR}/${i}.gz \
526     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
527     fi
528   done   done
529  }  }
530    
# Line 844  regen_mage_tree() Line 834  regen_mage_tree()
834   export PNAME="${i}"   export PNAME="${i}"
835   split_info_${i}   split_info_${i}
836   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
837     # restore smage environment
838     split_restore_variables
839   done   done
840   echo   echo
841   # restore smage environment   # unset all saved smage variables
842   split_restore_variables   split_unset_variables
843    
844   else   else
845   echo   echo
# Line 1000  split_restore_variables() Line 992  split_restore_variables()
992   eval "${saved_postremove/SAVED_/}"   eval "${saved_postremove/SAVED_/}"
993   export -f postremove   export -f postremove
994   fi   fi
995    }
996    
997    split_unset_variables()
998    {
999   # unset saved vars; not needed anymore   # unset saved vars; not needed anymore
1000   unset SAVED_PNAME   unset SAVED_PNAME
1001   unset SAVED_PVER   unset SAVED_PVER
# Line 1179  fi Line 1174  fi
1174  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1175  if [[ $1 = calcmd5 ]]  if [[ $1 = calcmd5 ]]
1176  then  then
1177   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1178   then   then
1179   SMAGENAME="$2"   SMAGENAME="$2"
1180   MD5DIR="$3"   MD5DIR="$3"
1181     [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1182    
1183   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
1184    
1185   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
# Line 1235  then Line 1232  then
1232   echo   echo
1233   else   else
1234   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1235   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1236   echo   echo
1237   echo   echo
1238   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
# Line 1292  then Line 1289  then
1289   elif [[ -n ${SPLIT_PACKAGES} ]]   elif [[ -n ${SPLIT_PACKAGES} ]]
1290   then   then
1291   split_save_variables   split_save_variables
1292   for subpackage in ${SPLIT_PACKAGE}   for subpackage in ${SPLIT_PACKAGES}
1293   do   do
1294   # get the right variables for the split   # get the right variables for the split
1295   export PNAME="${subpackage}"   export PNAME="${subpackage}"
# Line 1304  then Line 1301  then
1301   --pver "${PVER}" \   --pver "${PVER}" \
1302   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1303   --parch "${ARCH}"   --parch "${ARCH}"
1304     # restore smage environment
1305     split_restore_variables
1306   done   done
1307   split_restore_variables   # unset all saved smage variables
1308     split_unset_variables
1309    
1310   else   else
1311   # build md5sum for existing packages   # build md5sum for existing packages
# Line 1496  then Line 1496  then
1496   done   done
1497   # restore bindir & pname   # restore bindir & pname
1498   split_restore_variables   split_restore_variables
1499     # unset all saved smage variables
1500     split_unset_variables
1501  else  else
1502   src_install | ${SMAGE_LOG_CMD}   src_install | ${SMAGE_LOG_CMD}
1503   die_pipestatus 0 "src_install failed"   die_pipestatus 0 "src_install failed"
# Line 1505  fi Line 1507  fi
1507  # compressing doc, info & man files  # compressing doc, info & man files
1508  if [[ -n ${SPLIT_PACKAGES} ]]  if [[ -n ${SPLIT_PACKAGES} ]]
1509  then  then
1510   for subpackage in ${SPLIT_PACKAGE}   for subpackage in ${SPLIT_PACKAGES}
1511   do   do
1512   mcompressdocs ${BINDIR}_${subpackage}   mcompressdocs ${BINDIR}_${subpackage}
1513   done   done
# Line 1522  case ${NOSTRIP} in Line 1524  case ${NOSTRIP} in
1524   *)   *)
1525   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1526   then   then
1527   for subpackage in ${SPLIT_PACKAGE}   for subpackage in ${SPLIT_PACKAGES}
1528   do   do
1529   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1530   mstripbins ${BINDIR}_${subpackage}   mstripbins ${BINDIR}_${subpackage}
1531   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"
1532   mstriplibs ${BINDIR}_${subpackage}   mstriplibs ${BINDIR}_${subpackage}
1533   done   done
1534   else   else
# Line 1582  case ${NOPKGBUILD} in Line 1584  case ${NOPKGBUILD} in
1584   export PNAME="${subpackage}"   export PNAME="${subpackage}"
1585   split_info_${PNAME}   split_info_${PNAME}
1586    
1587     # jump to next one if NOPKGBUILD is set in split_info
1588     case ${NOPKGBUILD} in
1589     true|TRUE|yes|y) continue ;;
1590     esac
1591    
1592   # check if an special subpackage_pkgbuild exists   # check if an special subpackage_pkgbuild exists
1593   if typeset -f ${PNAME}_pkgbuild > /dev/null   if typeset -f ${PNAME}_pkgbuild > /dev/null
1594   then   then
# Line 1602  case ${NOPKGBUILD} in Line 1609  case ${NOPKGBUILD} in
1609   --parch "${ARCH}"   --parch "${ARCH}"
1610    
1611   echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1612    
1613     # restore smage environment
1614     split_restore_variables
1615   done   done
1616   split_restore_variables   # unset all saved smage variables
1617     split_unset_variables
1618    
1619   else   else
1620   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"

Legend:
Removed from v.945  
changed lines
  Added in v.1273