aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ferrell <major@homeonderanged.org>2012-05-07 18:19:40 -0500
committerMark Ferrell <major@homeonderanged.org>2012-05-07 18:19:40 -0500
commit38de6c86e1b1db4dc04866b840b0e7032ec32d7c (patch)
tree133f53de895c13525dbeccfcb5ac8e05d319ce3f
parenta0869dbbcf9cdc14c1e97102430d9b02fae251d6 (diff)
Add support for a 'source' command
* The source command is useful for developers allowing them to checkout package sources into 'packages/<CATEGORY>/<NAME>/source. This is particularly useful for developing on sources maintained within an SCM.
-rwxr-xr-xscripts/builder/build-makedeps3
-rwxr-xr-xscripts/builder/build-source56
2 files changed, 59 insertions, 0 deletions
diff --git a/scripts/builder/build-makedeps b/scripts/builder/build-makedeps
index fc0f8eb..70a5111 100755
--- a/scripts/builder/build-makedeps
+++ b/scripts/builder/build-makedeps
@@ -9,6 +9,7 @@ all_distclean: sysroot_clean artifacts_clean
all_archive: packages_archive
all_install: packages_install
all_makedeps:
+all_source:
sysroot_clean: packages_distclean
@if [ -d "${SYSROOT}" ]; then \
@@ -98,6 +99,8 @@ cat <<EOF
${package_make}: ${package_archive}
${package_make}_makedeps:
${package_make}_fetch: ${package_sources}
+${package_make}_source: ${package_sources}
+ @build-source "${CATEGORY}/${NAME}"
${package_make}_clean:
@build-clean "${CATEGORY}/${NAME}"
${package_make}_distclean:
diff --git a/scripts/builder/build-source b/scripts/builder/build-source
new file mode 100755
index 0000000..8313dd2
--- /dev/null
+++ b/scripts/builder/build-source
@@ -0,0 +1,56 @@
+#!/usr/bin/env build
+set -e
+
+echo "building source: ${1}"
+
+pkg_prep()
+{
+ return
+}
+
+import "${1}"
+
+## Cleanup the build build environment
+for dir in "${S}" "${D}"; do
+ if [ ! -d "${dir}" ]; then
+ continue
+ fi
+ mv "${dir}" "${dir}.old"
+ find "${dir}.old" -delete &
+done
+unset dir
+
+mkenv "prep"
+PKG_LOGFILE="${L}/source.log"
+
+if [ -d "${BUILDER_PKGDIR}/${CATEGORY}/${NAME}/source" ]; then
+ die "source already exists for '${CATEGORY}/${NAME}'"
+fi
+
+# FIXME this stuff needs a lot of work
+for url in ${SOURCE_URI}; do
+ file="$(build-fetch --name "${url}")"
+ if [ ! -f "${BUILDER_SRCDIR}/${file}" ]; then
+ die "source does not exist '${file}'"
+ fi
+
+ tar xavf "${BUILDER_SRCDIR}/${file}" -C "${W}" >> "${PKG_LOGFILE}" 2>&1
+done
+
+cd "${W}" && pkg_prep >> "${PKG_LOGFILE}" 2>&1
+
+# FIXME wrap up the patch command with something more functional
+if [ ! -z "${PATCHES}" ]; then
+ for patch in ${PATCHES}; do
+ echo "${NAME}: applying patch '${patch}'" | tee -a "${PKG_LOGFILE}"
+ if ! patch -l -t -d "${S}" -p1 < "${F}/${NAME}-${VERSION}-${patch}.patch"; then
+ exit 1
+ fi >> "${PKG_LOGFILE}" 2>&1
+ done
+fi
+
+mv "${S}" "${BUILDER_PKGDIR}/${CATEGORY}/${NAME}/source" >> "${PKG_LOGFILE}" 2>&1
+
+wait
+
+# vim: filetype=sh