Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: "Urs Fässler" <urs.fassler@bbv.ch>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 1/9] fetch2/git: add tests to verify naming of download directories
Date: Mon, 23 Jul 2018 17:42:51 +0200	[thread overview]
Message-ID: <20180723154259.9076-2-urs.fassler@bbv.ch> (raw)
In-Reply-To: <20180723154259.9076-1-urs.fassler@bbv.ch>

The mapping of the URLs to the local directory is not obvious. For easier
understanding, we add this tests to explicit showing the mapping.

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
---
 lib/bb/tests/fetch.py | 52 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 4af0ac55..5bce1bf8 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -463,6 +463,58 @@ class MirrorUriTest(FetcherTest):
                                 'https://BBBB/B/B/B/bitbake/bitbake-1.0.tar.gz',
                                 'http://AAAA/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz'])
 
+
+class GitDownloadDirectoryNamingTest(FetcherTest):
+    def setUp(self):
+        super(GitDownloadDirectoryNamingTest, self).setUp()
+        self.__recipe_url = "git://git.openembedded.org/bitbake"
+        self.__recipe_dir = "git.openembedded.org.bitbake"
+        self.__mirror_url = "git://github.com/openembedded/bitbake.git"
+        self.__mirror_dir = "github.com.openembedded.bitbake.git"
+
+        self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
+        self.d.setVar("PREMIRRORS", self.__recipe_url + " " + self.__mirror_url + " \n")
+
+    @skipIfNoNetwork()
+    def test_that_directory_is_named_after_recipe_url_when_no_mirroring_is_used(self):
+        fetcher = bb.fetch.Fetch([self.__mirror_url], self.d)
+
+        fetcher.download()
+
+        dir = os.listdir(self.dldir + "/git2")
+        self.assertIn(self.__mirror_dir, dir)
+
+    @skipIfNoNetwork()
+    def test_that_directory_exists_for_mirrored_url_and_recipe_url_when_mirroring_is_used(self):
+        fetcher = bb.fetch.Fetch([self.__recipe_url], self.d)
+
+        fetcher.download()
+
+        dir = os.listdir(self.dldir + "/git2")
+        self.assertIn(self.__mirror_dir, dir)
+        self.assertIn(self.__recipe_dir, dir)
+
+    @skipIfNoNetwork()
+    def test_that_recipe_directory_is_link_to_mirrored_directory_when_mirroring_is_used(self):
+        fetcher = bb.fetch.Fetch([self.__recipe_url], self.d)
+
+        fetcher.download()
+
+        path = os.readlink(self.dldir + "/git2/" + self.__recipe_dir)
+        self.assertTrue(path.endswith("/" + self.__mirror_dir))
+
+    @skipIfNoNetwork()
+    def test_that_recipe_directory_is_link_to_mirrored_directory_when_mirroring_is_used_and_the_mirrored_directory_already_exists(self):
+        fetcher = bb.fetch.Fetch([self.__mirror_url], self.d)
+        fetcher.download()
+        fetcher = bb.fetch.Fetch([self.__recipe_url], self.d)
+
+        fetcher.download()
+
+        path = os.readlink(self.dldir + "/git2/" + self.__recipe_dir)
+        self.assertTrue(path.endswith("/" + self.__mirror_dir))
+
+
 class FetcherLocalTest(FetcherTest):
     def setUp(self):
         def touch(fn):
-- 
2.18.0



  reply	other threads:[~2018-07-23 21:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 15:42 [PATCH 0/9] Always use the url specified in the recipe as a base for the git shallow tarball naming Urs Fässler
2018-07-23 15:42 ` Urs Fässler [this message]
2018-07-23 15:42 ` [PATCH 2/9] fetch2/git: add tests to capture existing behavior wrt. naming of git shallow tarball Urs Fässler
2018-07-23 15:42 ` [PATCH 3/9] fetch2/git: only use relevant checks for shallow tarball unpack Urs Fässler
2018-07-23 15:42 ` [PATCH 4/9] tests/data: extract LogRecord into own file Urs Fässler
2018-07-23 15:42 ` [PATCH 5/9] fetch2/git: throw error when no up to date sources were found during unpack Urs Fässler
2018-07-23 15:42 ` [PATCH 6/9] fetch2: declare urldata_init in base class Urs Fässler
2018-07-23 15:42 ` [PATCH 7/9] fetch2: provide original url in addition to the mirrored url to FetchData.__init__ and FetchMethod.urldata_init Urs Fässler
2018-07-23 15:42 ` [PATCH 8/9] fetch2/git: move generation of git source name into own method Urs Fässler
2018-07-23 15:42 ` [PATCH 9/9] fetch2/git: name the shallow tarball according to the url specified in the recipe rather than the mirrored url Urs Fässler
2018-07-23 22:00 ` [PATCH 0/9] Always use the url specified in the recipe as a base for the git shallow tarball naming Richard Purdie
2018-07-25  8:57   ` Urs Fässler
2018-08-03  6:48     ` Urs Fässler
2018-08-08 15:41       ` Urs Fässler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723154259.9076-2-urs.fassler@bbv.ch \
    --to=urs.fassler@bbv.ch \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox