Magellan Linux

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

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

revision 947 by niro, Sat Nov 21 01:44:27 2009 UTC revision 1291 by niro, Fri May 27 12:54:34 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 520  mlibtoolize() Line 506  mlibtoolize()
506   libtoolize ${opts} || die "running: mlibtoolize ${opts}"   libtoolize ${opts} || die "running: mlibtoolize ${opts}"
507  }  }
508    
509    mautoreconf()
510    {
511     local opts="$@"
512     [[ -z ${opts} ]] && opts="--verbose --install --force"
513    
514     autoreconf ${opts} || die "running: mautoreconf ${opts}"
515    }
516    
517  minstalldocs()  minstalldocs()
518  {  {
519   local docfiles   local docfiles
# Line 530  minstalldocs() Line 524  minstalldocs()
524   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
525   fi   fi
526    
527     local i
528   for i in ${docfiles}   for i in ${docfiles}
529   do   do
530   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
531   install -m 0644 ${SRCDIR}/${i}.gz \   then
532   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
533     install -m 0644 ${SRCDIR}/${i}.gz \
534     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
535     fi
536   done   done
537  }  }
538    
# Line 844  regen_mage_tree() Line 842  regen_mage_tree()
842   export PNAME="${i}"   export PNAME="${i}"
843   split_info_${i}   split_info_${i}
844   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
845     # restore smage environment
846     split_restore_variables
847   done   done
848   echo   echo
849   # restore smage environment   # unset all saved smage variables
850   split_restore_variables   split_unset_variables
851    
852   else   else
853   echo   echo
# Line 1000  split_restore_variables() Line 1000  split_restore_variables()
1000   eval "${saved_postremove/SAVED_/}"   eval "${saved_postremove/SAVED_/}"
1001   export -f postremove   export -f postremove
1002   fi   fi
1003    }
1004    
1005    split_unset_variables()
1006    {
1007   # unset saved vars; not needed anymore   # unset saved vars; not needed anymore
1008   unset SAVED_PNAME   unset SAVED_PNAME
1009   unset SAVED_PVER   unset SAVED_PVER
# Line 1179  fi Line 1182  fi
1182  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1183  if [[ $1 = calcmd5 ]]  if [[ $1 = calcmd5 ]]
1184  then  then
1185   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1186   then   then
1187   SMAGENAME="$2"   SMAGENAME="$2"
1188   MD5DIR="$3"   MD5DIR="$3"
1189     [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1190    
1191   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
1192    
1193   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
# Line 1235  then Line 1240  then
1240   echo   echo
1241   else   else
1242   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1243   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1244   echo   echo
1245   echo   echo
1246   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
# Line 1292  then Line 1297  then
1297   elif [[ -n ${SPLIT_PACKAGES} ]]   elif [[ -n ${SPLIT_PACKAGES} ]]
1298   then   then
1299   split_save_variables   split_save_variables
1300   for subpackage in ${SPLIT_PACKAGE}   for subpackage in ${SPLIT_PACKAGES}
1301   do   do
1302   # get the right variables for the split   # get the right variables for the split
1303   export PNAME="${subpackage}"   export PNAME="${subpackage}"
# Line 1304  then Line 1309  then
1309   --pver "${PVER}" \   --pver "${PVER}" \
1310   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1311   --parch "${ARCH}"   --parch "${ARCH}"
1312     # restore smage environment
1313     split_restore_variables
1314   done   done
1315   split_restore_variables   # unset all saved smage variables
1316     split_unset_variables
1317    
1318   else   else
1319   # build md5sum for existing packages   # build md5sum for existing packages
# Line 1496  then Line 1504  then
1504   done   done
1505   # restore bindir & pname   # restore bindir & pname
1506   split_restore_variables   split_restore_variables
1507     # unset all saved smage variables
1508     split_unset_variables
1509  else  else
1510   src_install | ${SMAGE_LOG_CMD}   src_install | ${SMAGE_LOG_CMD}
1511   die_pipestatus 0 "src_install failed"   die_pipestatus 0 "src_install failed"
# Line 1505  fi Line 1515  fi
1515  # compressing doc, info & man files  # compressing doc, info & man files
1516  if [[ -n ${SPLIT_PACKAGES} ]]  if [[ -n ${SPLIT_PACKAGES} ]]
1517  then  then
1518   for subpackage in ${SPLIT_PACKAGE}   for subpackage in ${SPLIT_PACKAGES}
1519   do   do
1520   mcompressdocs ${BINDIR}_${subpackage}   mcompressdocs ${BINDIR}_${subpackage}
1521   done   done
# Line 1522  case ${NOSTRIP} in Line 1532  case ${NOSTRIP} in
1532   *)   *)
1533   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1534   then   then
1535   for subpackage in ${SPLIT_PACKAGE}   for subpackage in ${SPLIT_PACKAGES}
1536   do   do
1537   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1538   mstripbins ${BINDIR}_${subpackage}   mstripbins ${BINDIR}_${subpackage}
1539   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"
1540   mstriplibs ${BINDIR}_${subpackage}   mstriplibs ${BINDIR}_${subpackage}
1541   done   done
1542   else   else
# Line 1607  case ${NOPKGBUILD} in Line 1617  case ${NOPKGBUILD} in
1617   --parch "${ARCH}"   --parch "${ARCH}"
1618    
1619   echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1620    
1621     # restore smage environment
1622     split_restore_variables
1623   done   done
1624   split_restore_variables   # unset all saved smage variables
1625     split_unset_variables
1626    
1627   else   else
1628   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"

Legend:
Removed from v.947  
changed lines
  Added in v.1291