On Wed, Dec 8, 2010 at 5:38 AM, Andreas Oberritter <[email protected]> wrote: > * Allows generating version information from SCMs during build. > * Note that tar doesn't need to use --exclude '.git', because > git checkout-index doesn't clone the repository. > > Signed-off-by: Andreas Oberritter <[email protected]>
As you add a new option. Please provide a patch for documentation as well. Acked-by: Khem Raj <[email protected]> > --- > lib/bb/fetch/bzr.py | 9 ++++++++- > lib/bb/fetch/cvs.py | 10 ++++++++-- > lib/bb/fetch/git.py | 16 +++++++++++----- > lib/bb/fetch/hg.py | 8 +++++++- > lib/bb/fetch/repo.py | 8 +++++++- > lib/bb/fetch/svn.py | 8 +++++++- > 6 files changed, 48 insertions(+), 11 deletions(-) > > diff --git a/lib/bb/fetch/bzr.py b/lib/bb/fetch/bzr.py > index 7d377a1..0eb2dad 100644 > --- a/lib/bb/fetch/bzr.py > +++ b/lib/bb/fetch/bzr.py > @@ -100,9 +100,16 @@ class Bzr(Fetch): > runfetchcmd(bzrcmd, d) > > os.chdir(ud.pkgdir) > + > + scmdata = ud.parm.get("scmdata", "") > + if scmdata == "keep": > + tar_flags = "" > + else: > + tar_flags = "--exclude '.bzr' --exclude '.bzrtags'" > + > # tar them up to a defined filename > try: > - runfetchcmd("tar --exclude '.bzr' --exclude '.bzrtags' -czf %s > %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d) > + runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, > os.path.basename(ud.pkgdir)), d) > except: > t, v, tb = sys.exc_info() > try: > diff --git a/lib/bb/fetch/cvs.py b/lib/bb/fetch/cvs.py > index bd919e2..0edb794 100644 > --- a/lib/bb/fetch/cvs.py > +++ b/lib/bb/fetch/cvs.py > @@ -149,14 +149,20 @@ class Cvs(Fetch): > pass > raise FetchError(ud.module) > > + scmdata = ud.parm.get("scmdata", "") > + if scmdata == "keep": > + tar_flags = "" > + else: > + tar_flags = "--exclude 'CVS'" > + > # tar them up to a defined filename > if 'fullpath' in ud.parm: > os.chdir(pkgdir) > - myret = os.system("tar --exclude 'CVS' -czf %s %s" % > (ud.localpath, localdir)) > + myret = os.system("tar %s -czf %s %s" % (tar_flags, > ud.localpath, localdir)) > else: > os.chdir(moddir) > os.chdir('..') > - myret = os.system("tar -czf %s %s" % (ud.localpath, > os.path.basename(moddir))) > + myret = os.system("tar %s -czf %s %s" % (tar_flags, > ud.localpath, os.path.basename(moddir))) > > if myret != 0: > try: > diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py > index a2fbd78..de415ec 100644 > --- a/lib/bb/fetch/git.py > +++ b/lib/bb/fetch/git.py > @@ -180,14 +180,20 @@ class Git(Fetch): > readpathspec = "" > coprefix = os.path.join(codir, "git", "") > > - bb.mkdirhier(codir) > - os.chdir(ud.clonedir) > - runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, > readpathspec), d) > - runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, > coprefix), d) > + scmdata = ud.parm.get("scmdata", "") > + if scmdata == "keep": > + runfetchcmd("%s clone -n %s %s" % (ud.basecmd, ud.clonedir, > coprefix), d) > + os.chdir(coprefix) > + runfetchcmd("%s checkout -q -f %s%s" % (ud.basecmd, ud.tag, > readpathspec), d) > + else: > + bb.mkdirhier(codir) > + os.chdir(ud.clonedir) > + runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, > readpathspec), d) > + runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % > (ud.basecmd, coprefix), d) > > os.chdir(codir) > logger.info("Creating tarball of git checkout") > - runfetchcmd("tar --exclude '.git' -czf %s %s" % (ud.localpath, > os.path.join(".", "*") ), d) > + runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") > ), d) > > os.chdir(ud.clonedir) > bb.utils.prunedir(codir) > diff --git a/lib/bb/fetch/hg.py b/lib/bb/fetch/hg.py > index 6bc261a..3c649a6 100644 > --- a/lib/bb/fetch/hg.py > +++ b/lib/bb/fetch/hg.py > @@ -143,9 +143,15 @@ class Hg(Fetch): > logger.debug(1, "Running %s", updatecmd) > runfetchcmd(updatecmd, d) > > + scmdata = ud.parm.get("scmdata", "") > + if scmdata == "keep": > + tar_flags = "" > + else: > + tar_flags = "--exclude '.hg' --exclude '.hgrags'" > + > os.chdir(ud.pkgdir) > try: > - runfetchcmd("tar --exclude '.hg' --exclude '.hgrags' -czf %s %s" > % (ud.localpath, ud.module), d) > + runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, > ud.module), d) > except: > t, v, tb = sys.exc_info() > try: > diff --git a/lib/bb/fetch/repo.py b/lib/bb/fetch/repo.py > index e5132a1..03642e7 100644 > --- a/lib/bb/fetch/repo.py > +++ b/lib/bb/fetch/repo.py > @@ -79,8 +79,14 @@ class Repo(Fetch): > runfetchcmd("repo sync", d) > os.chdir(codir) > > + scmdata = ud.parm.get("scmdata", "") > + if scmdata == "keep": > + tar_flags = "" > + else: > + tar_flags = "--exclude '.repo' --exclude '.git'" > + > # Create a cache > - runfetchcmd("tar --exclude=.repo --exclude=.git -czf %s %s" % > (ud.localpath, os.path.join(".", "*") ), d) > + runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, > os.path.join(".", "*") ), d) > > def supports_srcrev(self): > return False > diff --git a/lib/bb/fetch/svn.py b/lib/bb/fetch/svn.py > index dc35c9d..8f053ab 100644 > --- a/lib/bb/fetch/svn.py > +++ b/lib/bb/fetch/svn.py > @@ -151,10 +151,16 @@ class Svn(Fetch): > logger.debug(1, "Running %s", svnfetchcmd) > runfetchcmd(svnfetchcmd, d) > > + scmdata = ud.parm.get("scmdata", "") > + if scmdata == "keep": > + tar_flags = "" > + else: > + tar_flags = "--exclude '.svn'" > + > os.chdir(ud.pkgdir) > # tar them up to a defined filename > try: > - runfetchcmd("tar --exclude '.svn' -czf %s %s" % (ud.localpath, > ud.module), d) > + runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, > ud.module), d) > except: > t, v, tb = sys.exc_info() > try: > -- > 1.7.2.3 > > _______________________________________________ > Bitbake-dev mailing list > [email protected] > https://lists.berlios.de/mailman/listinfo/bitbake-dev > _______________________________________________ Bitbake-dev mailing list [email protected] https://lists.berlios.de/mailman/listinfo/bitbake-dev
