Magellan Linux

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

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

revision 833 by niro, Wed Apr 29 20:20:46 2009 UTC revision 941 by niro, Fri Nov 20 19:41:27 2009 UTC
# Line 73  die() Line 73  die()
73   exit 1   exit 1
74  }  }
75    
76    die_pipestatus()
77    {
78     local pos="$1"
79     local comment="$2"
80    
81     [ ${PIPESTATUS[${pos}]} -gt 0 ] && die "${comment}"
82    }
83    
84  xtitle()  xtitle()
85  {  {
86   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 171  download_sources() Line 179  download_sources()
179   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
180   fi   fi
181    
182     # create the SOURCEDIR
183     install -d ${my_SOURCEDIR}
184    
185   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
186   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
187   then   then
# Line 186  download_sources() Line 197  download_sources()
197   --tries 3 \   --tries 3 \
198   --continue \   --continue \
199   --progress bar \   --progress bar \
200   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
201   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
202   if [[ $? = 0 ]]   if [[ $? = 0 ]]
203   then   then
# Line 210  download_sources() Line 221  download_sources()
221   --tries 3 \   --tries 3 \
222   --continue \   --continue \
223   --progress bar \   --progress bar \
224   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
225   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
226   if [[ $? = 0 ]]   if [[ $? = 0 ]]
227   then   then
# Line 234  download_sources() Line 245  download_sources()
245   --tries 3 \   --tries 3 \
246   --continue \   --continue \
247   --progress bar \   --progress bar \
248   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
249   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
250   if [[ $? = 0 ]]   if [[ $? = 0 ]]
251   then   then
# Line 258  download_sources() Line 269  download_sources()
269   --tries 3 \   --tries 3 \
270   --continue \   --continue \
271   --progress bar \   --progress bar \
272   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
273   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
274   if [[ $? = 0 ]]   if [[ $? = 0 ]]
275   then   then
# Line 282  download_sources() Line 293  download_sources()
293   --tries 3 \   --tries 3 \
294   --continue \   --continue \
295   --progress bar \   --progress bar \
296   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
297   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
298   if [[ $? = 0 ]]   if [[ $? = 0 ]]
299   then   then
# Line 301  download_sources() Line 312  download_sources()
312   --tries 3 \   --tries 3 \
313   --continue \   --continue \
314   --progress bar \   --progress bar \
315   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
316   "${my_SRC_URI}"   "${my_SRC_URI}"
317   fi   fi
318   fi   fi
# Line 880  generate_package_md5sum() Line 891  generate_package_md5sum()
891   # fix target as it may be empty !   # fix target as it may be empty !
892   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
893    
894    
895   # build pkgname   # build pkgname
896   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
897    
# Line 899  generate_package_md5sum() Line 911  generate_package_md5sum()
911   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
912    
913   # setup md5 dir   # setup md5 dir
914   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
915   install -d ${dest}   install -d ${dest}
916    
917   # gen md5sum   # gen md5sum
# Line 937  source_pkg_build() Line 949  source_pkg_build()
949   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}"
950  }  }
951    
952    step_by_step()
953    {
954     if [[ ${STEP_BY_STEP} = true ]]
955     then
956     echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
957     echo "Press [enter] to continue"
958     read
959     fi
960    }
961    
962    
963  # print out our version  # print out our version
964  showversion  showversion
# Line 1057  then Line 1079  then
1079    
1080   regen_mage_tree   regen_mage_tree
1081    
1082   # build md5sum for existing packages   # build several targets
1083   generate_package_md5sum \   if [ -n "${MAGE_TARGETS}" ]
1084   --pcat "${PCATEGORIE}" \   then
1085   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1086   --pver "${PVER}" \   do
1087   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1088   --parch "${ARCH}" \   generate_package_md5sum \
1089   --target "${target}"   --pcat "${PCATEGORIE}" \
1090     --pname "${PNAME}" \
1091     --pver "${PVER}" \
1092     --pbuild "${PBUILD}" \
1093     --parch "${ARCH}" \
1094     --target "${target}"
1095     done
1096     else
1097     # build md5sum for existing packages
1098     generate_package_md5sum \
1099     --pcat "${PCATEGORIE}" \
1100     --pname "${PNAME}" \
1101     --pver "${PVER}" \
1102     --pbuild "${PBUILD}" \
1103     --parch "${ARCH}" \
1104     --target "${target}"
1105     fi
1106    
1107   exit 0   exit 0
1108  fi  fi
# Line 1129  fi Line 1167  fi
1167  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1168  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1169  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1170    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1171    
1172  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1173  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1203  then Line 1242  then
1242   mage rmstamp   mage rmstamp
1243  fi  fi
1244    
1245  src_prepare || die "src_prepare failed"  # setup build loggins
1246  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1247  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1248    
1249    src_prepare | ${SMAGE_LOG_CMD}
1250    die_pipestatus 0 "src_prepare failed"
1251    step_by_step $_
1252    
1253    src_compile | ${SMAGE_LOG_CMD}
1254    die_pipestatus 0 "src_compile failed"
1255    step_by_step $_
1256    
1257    src_install | ${SMAGE_LOG_CMD}
1258    die_pipestatus 0 "src_install failed"
1259    step_by_step $_
1260    
1261    
1262  # compressing doc, info & man files  # compressing doc, info & man files
# Line 1286  case ${NOPKGBUILD} in Line 1337  case ${NOPKGBUILD} in
1337   ;;   ;;
1338  esac  esac
1339    
1340    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1341    then
1342     bzip2 -9f /var/log/smage/${PKGNAME}.log
1343    else
1344     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1345    fi
1346    
1347  # for sure  # for sure
1348  unset NOPKGBUILD  unset NOPKGBUILD
1349  unset NOSTRIP  unset NOSTRIP

Legend:
Removed from v.833  
changed lines
  Added in v.941