[bitbake-devel] [PATCH] bitbake: fetch2/svn: Add tarsnapshots parameter

Niko Mauno niko.mauno at iki.fi
Fri Mar 23 09:28:21 UTC 2018

By adding 'tarsnapshots=currentonly' option to svn-specific component in
SRC_URI, associated subversion repository module's existing tarball
snapshots are removed from DL_DIR, before creating a new one.

This provides a means to avoid downloads directory becoming congested
with a subversion repository module's tarball snapshots, which may occur
for example during circumstances where source code residing in a
subversion repository is subject to long-term development work, and
recipe used in continuous integration builds has SRCREV set to AUTOREV.

Signed-off-by: Niko Mauno <niko.mauno at iki.fi>
 bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml | 6 ++++++
 bitbake/lib/bb/fetch2/svn.py                                     | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml
index 29ae486a7c..b4f1f673ec 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml
@@ -484,6 +484,12 @@
                         You can use this parameter to specify the ssh
                         program used by svn.
+                    <listitem><para><emphasis>"tarsnapshots":</emphasis>
+                        If this optional parameter is set to "currentonly" then
+                        any previously created tarball snapshots of associated
+                        repository module are removed from DL_DIR, before
+                        creating a new one.
+                        </para></listitem>
                         When required, sets the username for the transport.
                         By default, this parameter is empty.
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
index 3f172eec9b..3b58492f8f 100644
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -148,6 +148,12 @@ class Svn(FetchMethod):
             tar_flags = "--exclude='.svn'"
+        tarsnapshots = ud.parm.get("tarsnapshots", "")
+        if tarsnapshots == "currentonly":
+            rm_path = ud.localpath.replace('_%s_.tar.' % ud.revision, '_[0-9]*_.tar.')
+            bb.utils.remove(rm_path)
+            bb.utils.remove(rm_path + '.done')
         # tar them up to a defined filename
         runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.path_spec), d,
                     cleanup=[ud.localpath], workdir=ud.pkgdir)

More information about the bitbake-devel mailing list