Skip to contentSkip to conversation

fetchers: Use tar --exclude pattern to remove SCM files

PATCH Martin Jansa 4 participants 8 messages Oct 24, 2010 – Oct 25, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

This commit is usefull for sure, but breaks ie some EFL recipes.

ie python-elementary depends on elementary >= 0.7.0.52890 but elementary.pc says Version: 0.7.0.0

elementary.pc.in says Version: @VERSION@

and finally VERSION is defined in configure.ac:
m4_define([v_maj], [0])
m4_define([v_min], [7])
m4_define([v_mic], [0])
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])

and this works OK on checkout with .svn dirs included, but results to 0 after this patch.

Any hints how to resolve it?

Regards,

Quoted 87 lines · Khem Raj

This option will exclude the SCM metadata from tar files.

Tested with gcc where svn tar which used to be 156M for gcc 4.5 is now 77M

---

 lib/bb/fetch/bzr.py |    2 +-
 lib/bb/fetch/cvs.py |    2 +-
 lib/bb/fetch/git.py |    2 +-
 lib/bb/fetch/hg.py  |    2 +-
 lib/bb/fetch/svn.py |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
lib/bb/fetch/bzr.py +0 -0
index 8b0bd9f..3ca125f 100644
@@ -107,7 +107,7 @@ class Bzr(Fetch):
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename

        try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d)
+            runfetchcmd("tar --exclude '.bzr' --exclude '.bzrtags' -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d) except:
            t, v, tb = sys.exc_info()
            try:

lib/bb/fetch/cvs.py +0 -0
index 1064b09..42d71ba 100644
@@ -162,7 +162,7 @@ class Cvs(Fetch):
         # tar them up to a defined filename

        if 'fullpath' in ud.parm:
            os.chdir(pkgdir)
-            myret = os.system("tar -czf %s %s" % (ud.localpath, localdir))
+            myret = os.system("tar --exclude 'CVS' -czf %s %s" % (ud.localpath, localdir)) else:
            os.chdir(moddir)
            os.chdir('..')

lib/bb/fetch/git.py +1 -1
index 1b1bc95..4acaa87 100644
@@ -149,7 +149,7 @@ class Git(Fetch):
 
         os.chdir(codir)
         logger.info("Creating tarball of git checkout")
-        runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
+        runfetchcmd("tar --exclude '.git' -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
 
         os.chdir(ud.clonedir)
         bb.utils.prunedir(codir)
lib/bb/fetch/hg.py +0 -0
index ab00d43..9c11deb 100644
@@ -145,7 +145,7 @@ class Hg(Fetch):
 
         os.chdir(ud.pkgdir)

        try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar --exclude '.hg' --exclude '.hgrags' -czf %s %s" % (ud.localpath, ud.module), d) except:
            t, v, tb = sys.exc_info()
            try:

lib/bb/fetch/svn.py +0 -0
index 34f8132..c236e41 100644
@@ -159,7 +159,7 @@ class Svn(Fetch):
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename

        try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar --exclude '.svn' -czf %s %s" % (ud.localpath, ud.module), d) except:
            t, v, tb = sys.exc_info()
            try:
--
1.7.1

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

#2 lore raw
Quoted 7 lines · Martin Jansa

This commit is usefull for sure, but breaks ie some EFL recipes.

ie python-elementary depends on elementary >= 0.7.0.52890 but elementary.pc says Version: 0.7.0.0

elementary.pc.in says Version: @VERSION@

Quoted 11 lines

and finally VERSION is defined in configure.ac:
m4_define([v_maj], [0])
m4_define([v_min], [7])
m4_define([v_mic], [0])
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])

hmm strange that a configure scripts depends on SCM files. To me it seems wrong. Anyway I think you can patch configure.ac
to replace v_rev definition to be based on SRCREV may be some sort of sed operation as do_configure_prepend might be a good way

Quoted 96 lines

and this works OK on checkout with .svn dirs included, but results to 0 after this patch.

Any hints how to resolve it?

Regards,

Quoted 87 lines · Khem Raj

This option will exclude the SCM metadata from tar files.

Tested with gcc where svn tar which used to be 156M for gcc 4.5 is now 77M

---

 lib/bb/fetch/bzr.py |    2 +-
 lib/bb/fetch/cvs.py |    2 +-
 lib/bb/fetch/git.py |    2 +-
 lib/bb/fetch/hg.py  |    2 +-
 lib/bb/fetch/svn.py |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
lib/bb/fetch/bzr.py +0 -0
index 8b0bd9f..3ca125f 100644
@@ -107,7 +107,7 @@ class Bzr(Fetch):
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename

        try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d)
+            runfetchcmd("tar --exclude '.bzr' --exclude '.bzrtags' -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d) except:
            t, v, tb = sys.exc_info()
            try:

lib/bb/fetch/cvs.py +0 -0
index 1064b09..42d71ba 100644
@@ -162,7 +162,7 @@ class Cvs(Fetch):
         # tar them up to a defined filename

        if 'fullpath' in ud.parm:
            os.chdir(pkgdir)
-            myret = os.system("tar -czf %s %s" % (ud.localpath, localdir))
+            myret = os.system("tar --exclude 'CVS' -czf %s %s" % (ud.localpath, localdir)) else:
            os.chdir(moddir)
            os.chdir('..')

lib/bb/fetch/git.py +1 -1
index 1b1bc95..4acaa87 100644
@@ -149,7 +149,7 @@ class Git(Fetch):
 
         os.chdir(codir)
         logger.info("Creating tarball of git checkout")
-        runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
+        runfetchcmd("tar --exclude '.git' -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
 
         os.chdir(ud.clonedir)
         bb.utils.prunedir(codir)
lib/bb/fetch/hg.py +0 -0
index ab00d43..9c11deb 100644
@@ -145,7 +145,7 @@ class Hg(Fetch):
 
         os.chdir(ud.pkgdir)

        try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar --exclude '.hg' --exclude '.hgrags' -czf %s %s" % (ud.localpath, ud.module), d) except:
            t, v, tb = sys.exc_info()
            try:

lib/bb/fetch/svn.py +0 -0
index 34f8132..c236e41 100644
@@ -159,7 +159,7 @@ class Svn(Fetch):
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename

        try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar --exclude '.svn' -czf %s %s" % (ud.localpath, ud.module), d) except:
            t, v, tb = sys.exc_info()
            try:
--
1.7.1

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

#3 lore raw
Quoted 20 lines · Khem Raj
Quoted 7 lines · Martin Jansa

This commit is usefull for sure, but breaks ie some EFL recipes.

ie python-elementary depends on elementary >= 0.7.0.52890 but elementary.pc says Version: 0.7.0.0

elementary.pc.in says Version: @VERSION@

Quoted 11 lines

and finally VERSION is defined in configure.ac:
m4_define([v_maj], [0])
m4_define([v_min], [7])
m4_define([v_mic], [0])
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])

Quoted 4 lines

hmm strange that a configure scripts depends on SCM files. To me it seems wrong. Anyway I think you can patch configure.ac
to replace v_rev definition to be based on SRCREV may be some sort of sed operation as do_configure_prepend might be a good way

this is used in all efl recipes and I've noticed it in elementary only because python-elementary depends on such new version.

I've also found similar construct in other projects.. so maybe it's not so efl related (and then harder to found&fix in all recipes).

Regards,

#4 lore raw
Quoted 21 lines · Martin Jansa
Quoted 20 lines · Khem Raj
Quoted 18 lines · Martin Jansa

This commit is usefull for sure, but breaks ie some EFL recipes.

ie python-elementary depends on elementary >= 0.7.0.52890 but elementary.pc says Version: 0.7.0.0

elementary.pc.in says Version: @VERSION@

and finally VERSION is defined in configure.ac:
m4_define([v_maj], [0])
m4_define([v_min], [7])
m4_define([v_mic], [0])
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])

Quoted 7 lines
Quoted 4 lines

hmm strange that a configure scripts depends on SCM files. To me it seems wrong. Anyway I think you can patch configure.ac
to replace v_rev definition to be based on SRCREV may be some sort of sed operation as do_configure_prepend might be a good way

this is used in all efl recipes and I've noticed it in elementary only because python-elementary depends on such new version.

Do you have a list of recipes which use this ? I am sure with git it will be hard to use such a thing
as the git revs are random and simlarily many other SCMs

Quoted 4 lines

I've also found similar construct in other projects.. so maybe it's not so efl related (and then harder to found&fix in all recipes).

I still think packages should not depend upon SCM revisions and we should fix them

Quoted 2 lines

Regards,

#5 lore raw
Quoted 7 lines · Khem Raj
Quoted 3 lines

this is used in all efl recipes and I've noticed it in elementary only because python-elementary depends on such new version.

Do you have a list of recipes which use this ? I am sure with git it will be hard to use such a thing
as the git revs are random and simlarily many other SCMs

Speaking as upstream co-author of OpenBSC. We are using something like this to get the revision from the last tag of the repository. If someone is doing a make dist(check) we will copy a special version file into the tar.gz and use that instead.

From an upstream point of view I think it is acceptable to say that the ones that build stuff from a SCM (in contrast to a tarball) should have the files of the SCM around...

PS: I liked the --exclude patch a lot too...

#6 lore raw

On Sun, Oct 24, 2010 at 12:56 PM, Holger Freyther
<[email protected]<holger%[email protected]>

Quoted 20 lines

wrote:

Quoted 7 lines · Khem Raj
Quoted 3 lines

this is used in all efl recipes and I've noticed it in elementary only because python-elementary depends on such new version.

Do you have a list of recipes which use this ? I am sure with git it will be hard to use such a thing
as the git revs are random and simlarily many other SCMs

Speaking as upstream co-author of OpenBSC. We are using something like this to
get the revision from the last tag of the repository. If someone is doing a make dist(check) we will copy a special version file into the tar.gz and use
that instead.

Quoted 7 lines

From an upstream point of view I think it is acceptable to say that the ones
that build stuff from a SCM (in contrast to a tarball) should have the files
of the SCM around...

PS: I liked the --exclude patch a lot too...

I don't think its necessarily the fact that we're building from an SCM that's the differentiating factor here, it's the build from a branch as opposed to a tag. The tagged sources in an scm may be (though aren't always) exactly the same as the tarball contents, in which case the scm files shouldn't be necessary. Ideally, the buildsystems would work with or without them, but I agree, I guess we may have to revert the patch :(

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#7 lore raw
Quoted 33 lines · Chris Larson

On Sun, Oct 24, 2010 at 12:56 PM, Holger Freyther
<[email protected]<holger%[email protected]>

Quoted 22 lines

wrote:

Quoted 7 lines · Khem Raj
Quoted 3 lines

this is used in all efl recipes and I've noticed it in elementary only because python-elementary depends on such new version.

Do you have a list of recipes which use this ? I am sure with git it will be hard to use such a thing
as the git revs are random and simlarily many other SCMs

Speaking as upstream co-author of OpenBSC. We are using something like this
to
get the revision from the last tag of the repository. If someone is doing a
make dist(check) we will copy a special version file into the tar.gz and use
that instead.

Quoted 7 lines

From an upstream point of view I think it is acceptable to say that the ones
that build stuff from a SCM (in contrast to a tarball) should have the files
of the SCM around...

PS: I liked the --exclude patch a lot too...

Quoted 6 lines

I don't think its necessarily the fact that we're building from an SCM that's the differentiating factor here, it's the build from a branch as opposed to a tag. The tagged sources in an scm may be (though aren't always) exactly the same as the tarball contents, in which case the scm files shouldn't be necessary. Ideally, the buildsystems would work with or without them, but I agree, I guess we may have to revert the patch :(

another option is a to add a qualifier to bitbake fetcher to tell it that we want to keep SCM metadata for a given fetch and keep the default to exclude it but enable it for such cases.

Quoted 7 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

Signature · 1 line
-Khem
#8 lore raw
In reply to Holger Freyther
Quoted 11 lines · Holger Freyther
Quoted 7 lines · Khem Raj
Quoted 3 lines

this is used in all efl recipes and I've noticed it in elementary only because python-elementary depends on such new version.

Do you have a list of recipes which use this ? I am sure with git it will be hard to use such a thing
as the git revs are random and simlarily many other SCMs

Quoted 8 lines

Speaking as upstream co-author of OpenBSC. We are using something like this to get the revision from the last tag of the repository. If someone is doing a make dist(check) we will copy a special version file into the tar.gz and use that instead.

From an upstream point of view I think it is acceptable to say that the ones that build stuff from a SCM (in contrast to a tarball) should have the files of the SCM around...

well what if some used svn export <rev> to generate a tarball so it will break for him too.
so distributors should package the SCM metadata and the user needs to have SCM tools to
get the configure through. I would have added a script to update a constant var in src
which would denote this incremental version like what gcc does with dates.

Quoted 8 lines

PS: I liked the --exclude patch a lot too...

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel