Maupin, Chase : sourceipk: allow packaging shallow git clone
FYI I had to update my bitbake to the latest commits in the 1.22 branch for this to work for some reason....
So if you see the below error try upgrading bitbake.
/home/franklin/oe/mainline/build/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/ti-crypto-examples/git-r7/temp/run.do_create_srcipk.11714: line 202: get_remote: command not found
| WARNING: /home/franklin/oe/mainline/build/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/ti-crypto-examples/git-r7/temp/run.do_create_srcipk.11714:1 exit 127 from | local_repo=`get_remote $PWD` | ERROR: Function failed: do_create_srcipk (log file is located at /home/franklin/oe/mainline/build/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/ti-crypto-examples/git-r7/temp/log.do_create_srcipk.11714)
ERROR: Task 2026 (/home/franklin/oe/mainline/sources/meta-arago/meta-arago-extras/recipes-core/ti-crypto-examples/ti-crypto-examples_git.bb, do_create_srcipk) failed with exit code '1'
ERROR: Function failed: do_create_srcipk (log file is located at /home/franklin/oe/mainline/build/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/arm-benchmarks/1.3-r7-arago0/temp/log.do_create_srcipk.11790)
ERROR: Logfile of failure stored in: /home/franklin/oe/mainline/build/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/arm-benchmarks/1.3-r7-arago0/temp/log.do_create_srcipk.11790 Log data follows:
Quoted 176 lines
-----Original Message-----
From: [email protected] [mailto:arago-commits- [email protected]] On Behalf Of Arago Project git
Sent: Friday, July 18, 2014 2:27 PM
To: [email protected]
Subject: [arago-commits] Maupin, Chase : sourceipk: allow packaging shallow git cloneModule: meta-arago Branch: master Commit: 17a0985acfa6db950025be99ad65713e44f1b358 URL: http://arago-project.org/git/meta-arago.git?a=commit;h=17a0985acfa6db950025be99ad65713e44f1b358
Author: Maupin, Chase <[email protected]> Date: Sat Jul 19 00:17:54 2014 +0000sourceipk: allow packaging shallow git clone
* Add another flag
SRCIPK_SHALLOW_CLONEthat will do a shallow clone of depth 1 to reduce the size of the git history.
* The full history can be fetched again using either of the following commands based on the version of git being used
- git pull --unshallow (New git versions)
- git pull (older git versions)
* Clean up some of the variable names to make it more clear what they are storing.
* Create a generic function to determine the fetch reporitorySigned-off-by Chase Maupin <[email protected]>Signed-off-by Denys Dmytriyenko <[email protected]>---
meta-arago-distro/classes/sourceipk.bbclass | 97 ++++++++++++++++++++++++--- 1 files changed, 86 insertions(+), 11 deletions(-)meta-arago- renamed from meta-arago-distro/classes/sourceipk.bbclass +0
-0distro/classes/sourceipk.bbclass
index 20dda76..8fef2e9 100644meta-arago-distro/classes/sourceipk.bbclass +82
-9@@ -61,32 +61,108 @@ SRCIPK_INCLUDE_EXTRAFILES ?= "1" SRCIPK_PRESERVE_GIT ?= "false" -adjust_git() { +# Create a shallow clone of the git repository to reduce the size of # +the sourceipk SRCIPK_SHALLOW_CLONE ?= "false" + +# This function will return the fetch URL for a git repository passed +as # the first parameter. +get_remote() { + git_repo="$1" + + if [ "$git_repo" == "" ] + then + echo "git_repo not passed to get_remote" + exit 1 + fi + + cd $git_repo + + # Get the remote repository fetch URL + remote=`git remote -v | grep "(fetch)" | cut -d ' ' -f 1 | cut -c 7- | tr -d ' '` + + # Since the echo'ed value of this statment is the returned value redirect + # the output of this command to /dev/null + cd - > /dev/null + + # echo back the remote repository URL as the output of this function + echo $remote + + return 0 +} + +# Some git repositories are very large and we do not want to ship the # +full history. Instead we want to limit history to reduce the size +while # still keeping the git repository in place. The full history +can be # fetched using git pull --unshallow or just git pull # NOTE: +This function depends on a git version >= 1.7.10. It will work +# with older versions but the size will be larger because rather +# than just a single branch the limited history will be a depth of +# 1 for all branches and tags. +limit_git_history() { + # By default limit the history to 1 commit since the user can always + # use git pull --unshallow to fetch the rest of history. The depth + # level of 1 is set to keep from tracking through all merges and + # pulling excess history + commits="1" + + # Temporary directory to make shallow clones in + gitshallowclone="${WORKDIR}/temp-git-shallow-clone" + + # Change directory to the git repository to be safe + cd $tmp_dir/${SRCIPK_INSTALL_DIR} + # Create a temporary directory to hold the shallow git clone + mkdir -p $gitshallowclone + + remote=`get_remote $PWD` + + git clone --depth $commits --branch ${BRANCH} file://$remote + $gitshallowclone + + # remove original kernel clone since we will replace it with the shallow + # clone + rm -rf $tmp_dir/${SRCIPK_INSTALL_DIR}/.git + + # replace the original kernel git data with the shallow clone git data + mv $gitshallowclone/.git $tmp_dir/${SRCIPK_INSTALL_DIR}/ + rm -rf $gitshallowclone + + cd - +} + +adjust_git() { orig_dir="$PWD" cd $tmp_dir/${SRCIPK_INSTALL_DIR} if [ -d ".git" ] then + # Get the location of the local repository + local_repo=`get_remote $PWD` - # Grab path to cloned local repository - old=`git remote -v | grep "(fetch)" | cut -d ' ' -f 1 | cut -c 7- | tr -d ' '` - - if [ -d $old -a "${SRCIPK_PRESERVE_GIT}" = "true" ] + if [ -d $local_repo -a "${SRCIPK_PRESERVE_GIT}" = "true" ] then - cd $old + cd $local_repo + + # If SRCIPK_SHALLOW_CLONE is true then make a shallow copy of the + # git repository and then fix up the git URLs + if [ "${SRCIPK_SHALLOW_CLONE}" == "true" ] + then + limit_git_history + fi # Grab actual url used to create the repository - orig=`git remote -v | grep "(fetch)" | cut -d ' ' -f 1 | cut -c 7- | tr -d ' '` + remote_repo=`get_remote $PWD` cd - - git remote set-url origin $orig $old + git remote set-url origin $remote_repo $local_repo - # Repackage the repository so its a proper clone of the original(remote) git repository
meta-arago-distro/classes/sourceipk.bbclass +4
-2+ # Repackage the repository so its a proper clone of the original + # (remote) git repository git repack -a -d - rm .git/objects/info/alternates + + rm -f .git/objects/info/alternates else rm -rf .git@@ -95,7 +171,6 @@ adjust_git() { fi cd $orig_dir - } # Create a README file that describes the contents of the source ipk_______________________________________________
arago-commits mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/arago-commits