* When a git repository is unpacked the repository located in the WORKDIR is
  cloned from the git repository located in the downloads directory.
* Various references and settings are set within the repo which makes it
  impossible for the git repository packaged by sourceipk to be useable on any
  computer other than the original computer that the sourceipk was created in.
* This patche allows the git repository to be preserved and fixed up to become
  a fully functional portable git repository.

Signed-off-by: Franklin S. Cooper Jr <[email protected]>
---
 meta-arago-distro/classes/sourceipk.bbclass |   34 +++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/meta-arago-distro/classes/sourceipk.bbclass 
b/meta-arago-distro/classes/sourceipk.bbclass
index 1844ff3..0f0c633 100644
--- a/meta-arago-distro/classes/sourceipk.bbclass
+++ b/meta-arago-distro/classes/sourceipk.bbclass
@@ -59,17 +59,43 @@ SRCIPK_SECTION ?= "${SECTION}"
 # Default SRCIPK_INCLUDE_EXTRAFILES is to include the extra files
 SRCIPK_INCLUDE_EXTRAFILES ?= "1"
 
+SRCIPK_PRESERVE_GIT ?= "false"
+
 # Remove git repositories before packaging up the sources
-clear_git() {
+adjust_git() {
+
+    orig_dir="$PWD"
 
     cd ${S}
 
     if [ -d ".git" ]
     then
-        rm -rf .git
+
+        # 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" ]
+        then
+            cd $old
+
+            # Grab actual url used to create the repository
+            orig=`git remote -v | grep "(fetch)" | cut -d ' ' -f 1   | cut -c 
7- | tr -d ' '`
+
+            cd -
+
+            git remote set-url origin $orig $old
+
+            # Repackage the repository so its a proper clone of the original 
(remote) git repository
+            git repack -a -d
+            rm .git/objects/info/alternates
+
+        else
+            rm -rf .git
+        fi
+
     fi
 
-    cd -
+    cd $orig_dir
 
 }
 
@@ -97,7 +123,7 @@ sourceipk_do_create_srcipk() {
     if [ ${CREATE_SRCIPK} != "0" ]
     then
 
-        clear_git
+        adjust_git
 
         tmp_dir="${WORKDIR}/sourceipk-tmp"
         srcipk_dir="${WORKDIR}/sourceipk-data"
-- 
1.7.0.4

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to