Closed jasonabele closed 11 years ago
forgot to change that ${4} to ${BRANCH}
force pushed fixed version ad3da3b to pull-reqest
Merged with #12
this sucks.
On Thu, Aug 01, 2013 at 01:00:35PM -0700, jasonabele wrote:
From 56056b828a27ab3ab3502e6ae1231f598e3bd3c4 Mon Sep 17 00:00:00 2001 From: Jason Abele <jason@cozybit.com> Date: Thu, 1 Aug 2013 12:43:30 -0700 Subject: [PATCH] distro11s: make fetch/update readable parse_pkg already exports globals with useful names, use them to make code in update and fetch functions more readable Signed-off-by: Jason Abele <jason@cozybit.com> --- scripts/common.sh | 40 +++++++++++++++++++--------------------- scripts/fetch.sh | 4 ++-- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index dc6e7155..c982e3f 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -20,54 +20,52 @@ function set_top { return 1 } -# fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} -function fetch { +function fetch_pkg { DEST=${DISTRO11S_SRC}/${NAME} - if [ ${1} = "git" ]; then + if [ ${VCS} = "git" ]; then GIT="git clone" - if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${2} ]; then - GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${2}" + if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${NAME} ]; then + GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${NAME}" fi echo "${GIT}" - if [ "${4}" = "" ]; then - ${GIT} ${3} ${DEST} + if [ "${BRANCH}" = "" ]; then + ${GIT} ${URL} ${DEST} else - ${GIT} ${3} -b ${4} ${DEST} + ${GIT} ${URL} -b ${4} ${DEST} fi - if [ "${5}" != "" ] ; then + if [ "${TAG}" != "" ] ; then pushd . cd ${DEST} - git reset --hard ${5} + git reset --hard ${TAG} popd fi else - echo "Unsupported version control system ${1}" + echo "Unsupported version control system ${VCS}" return 1 fi } -# update ${VCS} ${DIR} ${NAME} ${TAG} -function update { - if [ ${1} = "git" ]; then - Q pushd ${2} +function update_pkg { + if [ ${VCS} = "git" ]; then + Q pushd ${DIR} CURR_HEAD=`git log --oneline -n1 | awk '{print $1}'` - [ "${4}" == "" ] && git pull --rebase + [ "${TAG}" == "" ] && git pull --rebase NEW_HEAD=`git log --oneline -n1 | awk '{print $1}'` else - echo "Unsupported version control system ${1}" + echo "Unsupported version control system ${VCS}" return 1 fi if [ "${CURR_HEAD}" != "${NEW_HEAD}" ]; then # we had updates, clear the stamps, ignore missing - Q "rm ${TOP}/out/${DISTRO11S_BOARD}/stamps/${3}*" || continue + Q "rm ${TOP}/out/${DISTRO11S_BOARD}/stamps/${NAME}*" || continue fi - if [ "${4}" != "" ]; then + if [ "${TAG}" != "" ]; then Q pushd . - cd ${2} + cd ${DIR} git fetch - git checkout -q ${4} + git checkout -q ${TAG} Q popd fi } diff --git a/scripts/fetch.sh b/scripts/fetch.sh index 834c30e..05cd1d7 100755 --- a/scripts/fetch.sh +++ b/scripts/fetch.sh @@ -40,10 +40,10 @@ for p in `cat ${PKGLIST}`; do if [ -e ${SRCDIR} ]; then echo "UPDATING: ${SRCDIR}" - update ${VCS} ${SRCDIR} ${NAME} ${TAG} || exit 1 + update_pkg || exit 1 else echo "FETCHING: ${NAME}" - fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} || exit 1 + fetch_pkg || exit 1 if [ -d ${TOP}/patches/${NAME} ]; then Q pushd ${SRCDIR} git am ${TOP}/patches/${NAME}/* || exit 1 -- 1.7.9.5
You can merge this Pull Request by running:
git pull https://github.com/cozybit/distro11s ft-use-parsed-pkg-vars
Or you can view, comment on it, or merge it online at:
https://github.com/cozybit/distro11s/pull/10
-- Commit Summary --
- distro11s: make fetch/update readable
-- File Changes --
M scripts/common.sh (40) M scripts/fetch.sh (4)
-- Patch Links --
https://github.com/cozybit/distro11s/pull/10.patch https://github.com/cozybit/distro11s/pull/10.diff
On Thu, Aug 01, 2013 at 01:00:35PM -0700, jasonabele wrote:
From 56056b828a27ab3ab3502e6ae1231f598e3bd3c4 Mon Sep 17 00:00:00 2001 From: Jason Abele <jason@cozybit.com> Date: Thu, 1 Aug 2013 12:43:30 -0700 Subject: [PATCH] distro11s: make fetch/update readable parse_pkg already exports globals with useful names, use them to make code in update and fetch functions more readable Signed-off-by: Jason Abele <jason@cozybit.com> --- scripts/common.sh | 40 +++++++++++++++++++--------------------- scripts/fetch.sh | 4 ++-- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index dc6e7155..c982e3f 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -20,54 +20,52 @@ function set_top { return 1 } -# fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} -function fetch { +function fetch_pkg { DEST=${DISTRO11S_SRC}/${NAME} - if [ ${1} = "git" ]; then + if [ ${VCS} = "git" ]; then GIT="git clone" - if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${2} ]; then - GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${2}" + if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${NAME} ]; then + GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${NAME}" fi echo "${GIT}" - if [ "${4}" = "" ]; then - ${GIT} ${3} ${DEST} + if [ "${BRANCH}" = "" ]; then + ${GIT} ${URL} ${DEST}
Inline comment.
sorry, just a test.
On Fri, Aug 2, 2013 at 11:49 AM, Thomas Pedersen thomas@cozybit.com wrote:
this sucks.
On Thu, Aug 01, 2013 at 01:00:35PM -0700, jasonabele wrote:
From 56056b828a27ab3ab3502e6ae1231f598e3bd3c4 Mon Sep 17 00:00:00 2001 From: Jason Abele <jason@cozybit.com> Date: Thu, 1 Aug 2013 12:43:30 -0700 Subject: [PATCH] distro11s: make fetch/update readable parse_pkg already exports globals with useful names, use them to make code in update and fetch functions more readable Signed-off-by: Jason Abele <jason@cozybit.com> --- scripts/common.sh | 40 +++++++++++++++++++--------------------- scripts/fetch.sh | 4 ++-- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index dc6e7155..c982e3f 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -20,54 +20,52 @@ function set_top { return 1 } -# fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} -function fetch { +function fetch_pkg { DEST=${DISTRO11S_SRC}/${NAME} - if [ ${1} = "git" ]; then + if [ ${VCS} = "git" ]; then GIT="git clone" - if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${2} ]; then - GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${2}" + if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${NAME} ]; then + GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${NAME}" fi echo "${GIT}" - if [ "${4}" = "" ]; then - ${GIT} ${3} ${DEST} + if [ "${BRANCH}" = "" ]; then + ${GIT} ${URL} ${DEST} else - ${GIT} ${3} -b ${4} ${DEST} + ${GIT} ${URL} -b ${4} ${DEST} fi - if [ "${5}" != "" ] ; then + if [ "${TAG}" != "" ] ; then pushd . cd ${DEST} - git reset --hard ${5} + git reset --hard ${TAG} popd fi else - echo "Unsupported version control system ${1}" + echo "Unsupported version control system ${VCS}" return 1 fi } -# update ${VCS} ${DIR} ${NAME} ${TAG} -function update { - if [ ${1} = "git" ]; then - Q pushd ${2} +function update_pkg { + if [ ${VCS} = "git" ]; then + Q pushd ${DIR} CURR_HEAD=`git log --oneline -n1 | awk '{print $1}'` - [ "${4}" == "" ] && git pull --rebase + [ "${TAG}" == "" ] && git pull --rebase NEW_HEAD=`git log --oneline -n1 | awk '{print $1}'` else - echo "Unsupported version control system ${1}" + echo "Unsupported version control system ${VCS}" return 1 fi if [ "${CURR_HEAD}" != "${NEW_HEAD}" ]; then # we had updates, clear the stamps, ignore missing - Q "rm ${TOP}/out/${DISTRO11S_BOARD}/stamps/${3}*" || continue + Q "rm ${TOP}/out/${DISTRO11S_BOARD}/stamps/${NAME}*" || continue fi - if [ "${4}" != "" ]; then + if [ "${TAG}" != "" ]; then Q pushd . - cd ${2} + cd ${DIR} git fetch - git checkout -q ${4} + git checkout -q ${TAG} Q popd fi } diff --git a/scripts/fetch.sh b/scripts/fetch.sh index 834c30e..05cd1d7 100755 --- a/scripts/fetch.sh +++ b/scripts/fetch.sh @@ -40,10 +40,10 @@ for p in `cat ${PKGLIST}`; do if [ -e ${SRCDIR} ]; then echo "UPDATING: ${SRCDIR}" - update ${VCS} ${SRCDIR} ${NAME} ${TAG} || exit 1 + update_pkg || exit 1 else echo "FETCHING: ${NAME}" - fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} || exit 1 + fetch_pkg || exit 1 if [ -d ${TOP}/patches/${NAME} ]; then Q pushd ${SRCDIR} git am ${TOP}/patches/${NAME}/* || exit 1 -- 1.7.9.5
You can merge this Pull Request by running:
git pull https://github.com/cozybit/distro11s ft-use-parsed-pkg-vars
Or you can view, comment on it, or merge it online at:
https://github.com/cozybit/distro11s/pull/10
-- Commit Summary --
- distro11s: make fetch/update readable
-- File Changes --
M scripts/common.sh (40) M scripts/fetch.sh (4)
-- Patch Links --
https://github.com/cozybit/distro11s/pull/10.patch https://github.com/cozybit/distro11s/pull/10.diff
Thomas
If you click on "show original" in gmail (or open this email in mutt), you'll see that the multipart plaintext version is actually being mangled by github -- replacing " with ".
On Thu, Aug 1, 2013 at 1:00 PM, jasonabele notifications@github.com wrote:
From 56056b828a27ab3ab3502e6ae1231f598e3bd3c4 Mon Sep 17 00:00:00 2001 From: Jason Abele jason@cozybit.com Date: Thu, 1 Aug 2013 12:43:30 -0700 Subject: [PATCH] distro11s: make fetch/update readable
parse_pkg already exports globals with useful names, use them to make code in update and fetch functions more readable
Signed-off-by: Jason Abele jason@cozybit.com
scripts/common.sh | 40 +++++++++++++++++++--------------------- scripts/fetch.sh | 4 ++-- 2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/scripts/common.sh b/scripts/common.sh index dc6e7155..c982e3f 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -20,54 +20,52 @@ function set_top { return 1 }
-# fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} -function fetch { +function fetch_pkg { DEST=${DISTRO11S_SRC}/${NAME}
- if [ ${1} = "git" ]; then
- if [ ${VCS} = "git" ]; then GIT="git clone"
- if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${2} ]; then
- GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${2}"
- if [ "${DISTRO11S_GIT_REFERENCE}" != "" -a -e ${DISTRO11S_GIT_REFERENCE}/${NAME} ]; then
- GIT="${GIT} --reference ${DISTRO11S_GIT_REFERENCE}/${NAME}" fi echo "${GIT}"
- if [ "${4}" = "" ]; then
- ${GIT} ${3} ${DEST}
- if [ "${BRANCH}" = "" ]; then
- ${GIT} ${URL} ${DEST} else
- ${GIT} ${3} -b ${4} ${DEST}
- ${GIT} ${URL} -b ${4} ${DEST} fi
- if [ "${5}" != "" ] ; then
- if [ "${TAG}" != "" ] ; then pushd . cd ${DEST}
- git reset --hard ${5}
- git reset --hard ${TAG} popd fi else
- echo "Unsupported version control system ${1}"
- echo "Unsupported version control system ${VCS}" return 1 fi }
-# update ${VCS} ${DIR} ${NAME} ${TAG} -function update {
- if [ ${1} = "git" ]; then
- Q pushd ${2} +function update_pkg {
- if [ ${VCS} = "git" ]; then
- Q pushd ${DIR} CURR_HEAD=
git log --oneline -n1 | awk '{print $1}'
- [ "${4}" == "" ] && git pull --rebase
- [ "${TAG}" == "" ] && git pull --rebase NEW_HEAD=
git log --oneline -n1 | awk '{print $1}'
else- echo "Unsupported version control system ${1}"
echo "Unsupported version control system ${VCS}" return 1
fi
if [ "${CURR_HEAD}" != "${NEW_HEAD}" ]; then
we had updates, clear the stamps, ignore missing
- Q "rm ${TOP}/out/${DISTRO11S_BOARD}/stamps/${3}*" || continue
Q "rm ${TOP}/out/${DISTRO11S_BOARD}/stamps/${NAME}*" || continue
fi
- if [ "${4}" != "" ]; then
- if [ "${TAG}" != "" ]; then Q pushd .
- cd ${2}
- cd ${DIR} git fetch
- git checkout -q ${4}
git checkout -q ${TAG} Q popd
fi } diff --git a/scripts/fetch.sh b/scripts/fetch.sh index 834c30e..05cd1d7 100755 --- a/scripts/fetch.sh +++ b/scripts/fetch.sh @@ -40,10 +40,10 @@ for p in
cat ${PKGLIST}
; doif [ -e ${SRCDIR} ]; then echo "UPDATING: ${SRCDIR}"
- update ${VCS} ${SRCDIR} ${NAME} ${TAG} || exit 1
- update_pkg || exit 1 else echo "FETCHING: ${NAME}"
- fetch ${VCS} ${NAME} ${URL} ${BRANCH} ${TAG} || exit 1
fetch_pkg || exit 1 if [ -d ${TOP}/patches/${NAME} ]; then Q pushd ${SRCDIR} git am ${TOP}/patches/${NAME}/* || exit 1
1.7.9.5
You can merge this Pull Request by running
git pull https://github.com/cozybit/distro11s ft-use-parsed-pkg-vars
Or view, comment on, or merge it at:
https://github.com/cozybit/distro11s/pull/10
Commit Summary
distro11s: make fetch/update readable
File Changes
M scripts/common.sh (40) M scripts/fetch.sh (4)
Patch Links:
https://github.com/cozybit/distro11s/pull/10.patch https://github.com/cozybit/distro11s/pull/10.diff
Thomas