public inbox for gnap-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Philipp Riegger" <lists@anderedomain.de>
To: gnap-dev@lists.gentoo.org
Subject: [gnap-dev] 01-split-gnap_make.patch
Date: Thu, 5 Jul 2007 16:03:41 +0300 (EEST)	[thread overview]
Message-ID: <54140.130.230.11.107.1183640621.squirrel@my.bawue.net> (raw)
In-Reply-To: <59506.130.230.11.107.1183640031.squirrel@my.bawue.net>

Index: tools/gnap_shared.sh
===================================================================
--- tools/gnap_shared.sh	(revision 0)
+++ tools/gnap_shared.sh	(revision 0)
@@ -0,0 +1,79 @@
+GNAPNAME=$(basename "$0")
+
+case ${GNAPNAME} in
+	gnap_make ) GNAPPRODUCT="Build";;
+	* )         GNAPPRODUCT="Something";;
+esac
+
+GNAPLIBDIR='/usr/lib/gnap'
+STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
+SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
+SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
+
+G=$'\e[32;01m'
+B=$'\e[31;01m'
+N=$'\e[0m'
+W=$'\e[33;01m'
+K=$'\e[34;01m'
+C="$[$(set -- $(stty size 2>/dev/null); echo ${2}) - 7]"
+E=$'\e['${C}'G'
+
+gwarn() {
+	echo -e " ${W}*${N} ${*}"
+}
+
+gconfirm() {
+	if [[ "${FORCEYES}" -eq 1 ]]; then
+		gwarn "${*} forced to yes"
+	else
+		read -ep " ${W}*${N} ${*} [N]: " answer
+		if [[ "${answer}" != 'y' && "${answer}" != 'Y' ]]; then
+			if [[ -n "${TEMPDIR}" ]]; then
+				cleanup
+			fi
+			echo "${GNAPPRODUCT} aborted !"
+			exit 2
+		fi
+	fi
+}
+
+gbegin() {
+	echo -ne " ${G}*${N} ${*}..."
+}
+
+gtest() {
+	continued=0
+	if [[ "${#}" -gt 0 && "${1}" == 'continued' ]]; then
+		shift
+		continued=1
+	fi
+	if [[ "${#}" -eq 0 || "${1}" -eq 0 ]]; then
+		if [[ "${continued}" -eq 0 ]]; then
+			echo -e "${E}  ${K}[ ${G}ok${K} ]${N}"
+		fi
+	else
+		echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
+		if [[ "${#}" -ge 2 ]]; then
+			shift
+			echo -en " ${B}*${N} ${*}"
+			echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
+		fi
+		if [[ -n "${TEMPDIR}" ]]; then
+			cleanup
+		fi
+		echo "${GNAPPRODUCT} failed, try ${GNAPNAME} -h for more help"
+		exit 1
+	fi
+}
+
+cleanup() {
+	gbegin 'Cleaning temporary directories'
+	if [[ -d "${TEMPDIR}" ]]; then
+		DIRTOREMOVE="${TEMPDIR}"
+		TEMPDIR=''
+		rm -rf "${DIRTOREMOVE}"
+		gtest $? "Failed to remove ${DIRTOREMOVE}"
+	else
+		gtest 0
+	fi
+}
Index: src/gnap_make
===================================================================
--- src/gnap_make	(revision 52)
+++ src/gnap_make	(working copy)
@@ -1,70 +1,9 @@
 #!/bin/bash
 GNAPVERSION='2.0'

-GNAPNAME=$(basename "$0")
+source "gnap_shared.sh"
 echo "GNAP Core Building tool ${GNAPNAME} version ${GNAPVERSION}"
-GNAPLIBDIR='/usr/lib/gnap'
-STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
-SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
-SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
-TEMPDIR=''

-G=$'\e[32;01m'
-B=$'\e[31;01m'
-N=$'\e[0m'
-W=$'\e[33;01m'
-K=$'\e[34;01m'
-C="$[$(set -- $(stty size 2>/dev/null); echo ${2}) - 7]"
-E=$'\e['${C}'G'
-
-gwarn() {
-	echo -e " ${W}*${N} ${*}"
-}
-
-gconfirm() {
-	if [[ "${FORCEYES}" -eq 1 ]]; then
-		gwarn "${*} forced to yes"
-	else
-		read -ep " ${W}*${N} ${*} [N]: " answer
-		if [[ "${answer}" != 'y' && "${answer}" != 'Y' ]]; then
-			if [[ -n "${TEMPDIR}" ]]; then
-				cleanup
-			fi
-			echo Build aborted !
-			exit 2
-		fi
-	fi
-}
-
-gbegin() {
-	echo -ne " ${G}*${N} ${*}..."
-}
-
-gtest() {
-	continued=0
-	if [[ "$#" -gt 0 && "${1}" == 'continued' ]]; then
-		shift
-		continued=1
-	fi
-	if [[ "$#" -eq 0 || "${1}" -eq 0 ]]; then
-		if [[ "${continued}" -eq 0 ]]; then
-			echo -e "${E}  ${K}[ ${G}ok${K} ]${N}"
-		fi
-	else
-		echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
-		if [[ "$#" -ge 2 ]]; then
-			shift
-			echo -en " ${B}*${N} ${*}"
-			echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
-		fi
-		if [[ -n "${TEMPDIR}" ]]; then
-			cleanup
-		fi
-		echo "Build failed, try man ${GNAPNAME} for more help"
-		exit 1
-	fi
-}
-
 usage() {
 	echo 'Options:'
 	echo '    -t stage             Build stage to execute (or "all")'
@@ -80,18 +19,6 @@
 	echo "Please man ${GNAPNAME} for more details."
 }

-cleanup() {
-	gbegin 'Cleaning temporary directories'
-	if [[ -d "${TEMPDIR}" ]]; then
-		DIRTOREMOVE="${TEMPDIR}"
-		TEMPDIR=''
-		rm -rf "${DIRTOREMOVE}"
-		gtest $? "Failed to remove ${DIRTOREMOVE}"
-	else
-		gtest 0
-	fi
-}
-
 if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then
 	usage
 	exit 0
Index: src/gnap_shared.sh
===================================================================
--- src/gnap_shared.sh	(revision 0)
+++ src/gnap_shared.sh	(revision 0)
@@ -0,0 +1,79 @@
+GNAPNAME=$(basename "$0")
+
+case ${GNAPNAME} in
+	gnap_make ) GNAPPRODUCT="Build";;
+	* )         GNAPPRODUCT="Something";;
+esac
+
+GNAPLIBDIR='/usr/lib/gnap'
+STAGE3FILE="${GNAPLIBDIR}/gnap-stage3seed.tar.bz2"
+SNAPSHOTFILE="${GNAPLIBDIR}/gnap-portagesnapshot.tar.bz2"
+SPECS="${GNAPLIBDIR}/gnap-specs.tar.bz2"
+
+G=$'\e[32;01m'
+B=$'\e[31;01m'
+N=$'\e[0m'
+W=$'\e[33;01m'
+K=$'\e[34;01m'
+C="$[$(set -- $(stty size 2>/dev/null); echo ${2}) - 7]"
+E=$'\e['${C}'G'
+
+gwarn() {
+	echo -e " ${W}*${N} ${*}"
+}
+
+gconfirm() {
+	if [[ "${FORCEYES}" -eq 1 ]]; then
+		gwarn "${*} forced to yes"
+	else
+		read -ep " ${W}*${N} ${*} [N]: " answer
+		if [[ "${answer}" != 'y' && "${answer}" != 'Y' ]]; then
+			if [[ -n "${TEMPDIR}" ]]; then
+				cleanup
+			fi
+			echo "${GNAPPRODUCT} aborted !"
+			exit 2
+		fi
+	fi
+}
+
+gbegin() {
+	echo -ne " ${G}*${N} ${*}..."
+}
+
+gtest() {
+	continued=0
+	if [[ "${#}" -gt 0 && "${1}" == 'continued' ]]; then
+		shift
+		continued=1
+	fi
+	if [[ "${#}" -eq 0 || "${1}" -eq 0 ]]; then
+		if [[ "${continued}" -eq 0 ]]; then
+			echo -e "${E}  ${K}[ ${G}ok${K} ]${N}"
+		fi
+	else
+		echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
+		if [[ "${#}" -ge 2 ]]; then
+			shift
+			echo -en " ${B}*${N} ${*}"
+			echo -e "${E}  ${K}[ ${B}!!${K} ]${N}"
+		fi
+		if [[ -n "${TEMPDIR}" ]]; then
+			cleanup
+		fi
+		echo "${GNAPPRODUCT} failed, try ${GNAPNAME} -h for more help"
+		exit 1
+	fi
+}
+
+cleanup() {
+	gbegin 'Cleaning temporary directories'
+	if [[ -d "${TEMPDIR}" ]]; then
+		DIRTOREMOVE="${TEMPDIR}"
+		TEMPDIR=''
+		rm -rf "${DIRTOREMOVE}"
+		gtest $? "Failed to remove ${DIRTOREMOVE}"
+	else
+		gtest 0
+	fi
+}

-- 
gnap-dev@gentoo.org mailing list



  reply	other threads:[~2007-07-05 13:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-05 12:53 [gnap-dev] Some patches for gnap Philipp Riegger
2007-07-05 13:03 ` Philipp Riegger [this message]
2007-07-05 13:05 ` [gnap-dev] 03-split-gnap_remaster.patch Philipp Riegger
2007-07-05 13:06 ` [gnap-dev] 04-feature-gnap_make-T.patch Philipp Riegger
2007-07-05 13:07 ` [gnap-dev] 05-festure-gnap_overlay-T.patch Philipp Riegger
2007-07-05 13:08 ` [gnap-dev] 06-feature-gnap_remaster-T.patch Philipp Riegger
2007-07-05 13:09 ` [gnap-dev] 07-split-make_tempdir.patch Philipp Riegger
2007-07-05 13:10 ` [gnap-dev] 08-namespace-gnap_shared.patch Philipp Riegger
2007-07-05 13:11 ` [gnap-dev] 09-cleanup-gnap_make.patch Philipp Riegger
2007-07-06  7:40 ` [gnap-dev] Some patches for gnap josé Alberto Suárez López
2007-07-06 15:08   ` Philipp Riegger
2007-07-09  7:13     ` josé Alberto Suárez López
2007-07-12 23:49     ` Philipp Riegger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54140.130.230.11.107.1183640621.squirrel@my.bawue.net \
    --to=lists@anderedomain.de \
    --cc=gnap-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox