summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/fetch.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r--bitbake/lib/bb/tests/fetch.py117
1 files changed, 90 insertions, 27 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 9453c90d2b..61dd5cccaf 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -371,6 +371,7 @@ class FetcherTest(unittest.TestCase):
371 if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": 371 if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes":
372 print("Not cleaning up %s. Please remove manually." % self.tempdir) 372 print("Not cleaning up %s. Please remove manually." % self.tempdir)
373 else: 373 else:
374 bb.process.run('chmod u+rw -R %s' % self.tempdir)
374 bb.utils.prunedir(self.tempdir) 375 bb.utils.prunedir(self.tempdir)
375 376
376class MirrorUriTest(FetcherTest): 377class MirrorUriTest(FetcherTest):
@@ -471,7 +472,7 @@ class GitDownloadDirectoryNamingTest(FetcherTest):
471 super(GitDownloadDirectoryNamingTest, self).setUp() 472 super(GitDownloadDirectoryNamingTest, self).setUp()
472 self.recipe_url = "git://git.openembedded.org/bitbake" 473 self.recipe_url = "git://git.openembedded.org/bitbake"
473 self.recipe_dir = "git.openembedded.org.bitbake" 474 self.recipe_dir = "git.openembedded.org.bitbake"
474 self.mirror_url = "git://github.com/openembedded/bitbake.git" 475 self.mirror_url = "git://github.com/openembedded/bitbake.git;protocol=https"
475 self.mirror_dir = "github.com.openembedded.bitbake.git" 476 self.mirror_dir = "github.com.openembedded.bitbake.git"
476 477
477 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40') 478 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
@@ -519,7 +520,7 @@ class TarballNamingTest(FetcherTest):
519 super(TarballNamingTest, self).setUp() 520 super(TarballNamingTest, self).setUp()
520 self.recipe_url = "git://git.openembedded.org/bitbake" 521 self.recipe_url = "git://git.openembedded.org/bitbake"
521 self.recipe_tarball = "git2_git.openembedded.org.bitbake.tar.gz" 522 self.recipe_tarball = "git2_git.openembedded.org.bitbake.tar.gz"
522 self.mirror_url = "git://github.com/openembedded/bitbake.git" 523 self.mirror_url = "git://github.com/openembedded/bitbake.git;protocol=https"
523 self.mirror_tarball = "git2_github.com.openembedded.bitbake.git.tar.gz" 524 self.mirror_tarball = "git2_github.com.openembedded.bitbake.git.tar.gz"
524 525
525 self.d.setVar('BB_GENERATE_MIRROR_TARBALLS', '1') 526 self.d.setVar('BB_GENERATE_MIRROR_TARBALLS', '1')
@@ -553,7 +554,7 @@ class GitShallowTarballNamingTest(FetcherTest):
553 super(GitShallowTarballNamingTest, self).setUp() 554 super(GitShallowTarballNamingTest, self).setUp()
554 self.recipe_url = "git://git.openembedded.org/bitbake" 555 self.recipe_url = "git://git.openembedded.org/bitbake"
555 self.recipe_tarball = "gitshallow_git.openembedded.org.bitbake_82ea737-1_master.tar.gz" 556 self.recipe_tarball = "gitshallow_git.openembedded.org.bitbake_82ea737-1_master.tar.gz"
556 self.mirror_url = "git://github.com/openembedded/bitbake.git" 557 self.mirror_url = "git://github.com/openembedded/bitbake.git;protocol=https"
557 self.mirror_tarball = "gitshallow_github.com.openembedded.bitbake.git_82ea737-1_master.tar.gz" 558 self.mirror_tarball = "gitshallow_github.com.openembedded.bitbake.git_82ea737-1_master.tar.gz"
558 559
559 self.d.setVar('BB_GIT_SHALLOW', '1') 560 self.d.setVar('BB_GIT_SHALLOW', '1')
@@ -649,6 +650,58 @@ class FetcherLocalTest(FetcherTest):
649 with self.assertRaises(bb.fetch2.UnpackError): 650 with self.assertRaises(bb.fetch2.UnpackError):
650 self.fetchUnpack(['file://a;subdir=/bin/sh']) 651 self.fetchUnpack(['file://a;subdir=/bin/sh'])
651 652
653 def test_local_gitfetch_usehead(self):
654 # Create dummy local Git repo
655 src_dir = tempfile.mkdtemp(dir=self.tempdir,
656 prefix='gitfetch_localusehead_')
657 src_dir = os.path.abspath(src_dir)
658 bb.process.run("git init", cwd=src_dir)
659 bb.process.run("git commit --allow-empty -m'Dummy commit'",
660 cwd=src_dir)
661 # Use other branch than master
662 bb.process.run("git checkout -b my-devel", cwd=src_dir)
663 bb.process.run("git commit --allow-empty -m'Dummy commit 2'",
664 cwd=src_dir)
665 stdout = bb.process.run("git rev-parse HEAD", cwd=src_dir)
666 orig_rev = stdout[0].strip()
667
668 # Fetch and check revision
669 self.d.setVar("SRCREV", "AUTOINC")
670 url = "git://" + src_dir + ";protocol=file;usehead=1"
671 fetcher = bb.fetch.Fetch([url], self.d)
672 fetcher.download()
673 fetcher.unpack(self.unpackdir)
674 stdout = bb.process.run("git rev-parse HEAD",
675 cwd=os.path.join(self.unpackdir, 'git'))
676 unpack_rev = stdout[0].strip()
677 self.assertEqual(orig_rev, unpack_rev)
678
679 def test_local_gitfetch_usehead_withname(self):
680 # Create dummy local Git repo
681 src_dir = tempfile.mkdtemp(dir=self.tempdir,
682 prefix='gitfetch_localusehead_')
683 src_dir = os.path.abspath(src_dir)
684 bb.process.run("git init", cwd=src_dir)
685 bb.process.run("git commit --allow-empty -m'Dummy commit'",
686 cwd=src_dir)
687 # Use other branch than master
688 bb.process.run("git checkout -b my-devel", cwd=src_dir)
689 bb.process.run("git commit --allow-empty -m'Dummy commit 2'",
690 cwd=src_dir)
691 stdout = bb.process.run("git rev-parse HEAD", cwd=src_dir)
692 orig_rev = stdout[0].strip()
693
694 # Fetch and check revision
695 self.d.setVar("SRCREV", "AUTOINC")
696 url = "git://" + src_dir + ";protocol=file;usehead=1;name=newName"
697 fetcher = bb.fetch.Fetch([url], self.d)
698 fetcher.download()
699 fetcher.unpack(self.unpackdir)
700 stdout = bb.process.run("git rev-parse HEAD",
701 cwd=os.path.join(self.unpackdir, 'git'))
702 unpack_rev = stdout[0].strip()
703 self.assertEqual(orig_rev, unpack_rev)
704
652class FetcherNoNetworkTest(FetcherTest): 705class FetcherNoNetworkTest(FetcherTest):
653 def setUp(self): 706 def setUp(self):
654 super().setUp() 707 super().setUp()
@@ -845,6 +898,8 @@ class FetcherNetworkTest(FetcherTest):
845 prefix='gitfetch_localusehead_') 898 prefix='gitfetch_localusehead_')
846 src_dir = os.path.abspath(src_dir) 899 src_dir = os.path.abspath(src_dir)
847 bb.process.run("git init", cwd=src_dir) 900 bb.process.run("git init", cwd=src_dir)
901 bb.process.run("git config user.email 'you@example.com'", cwd=src_dir)
902 bb.process.run("git config user.name 'Your Name'", cwd=src_dir)
848 bb.process.run("git commit --allow-empty -m'Dummy commit'", 903 bb.process.run("git commit --allow-empty -m'Dummy commit'",
849 cwd=src_dir) 904 cwd=src_dir)
850 # Use other branch than master 905 # Use other branch than master
@@ -918,7 +973,7 @@ class FetcherNetworkTest(FetcherTest):
918 def test_git_submodule_dbus_broker(self): 973 def test_git_submodule_dbus_broker(self):
919 # The following external repositories have show failures in fetch and unpack operations 974 # The following external repositories have show failures in fetch and unpack operations
920 # We want to avoid regressions! 975 # We want to avoid regressions!
921 url = "gitsm://github.com/bus1/dbus-broker;protocol=git;rev=fc874afa0992d0c75ec25acb43d344679f0ee7d2;branch=main" 976 url = "gitsm://github.com/bus1/dbus-broker;protocol=https;rev=fc874afa0992d0c75ec25acb43d344679f0ee7d2;branch=main"
922 fetcher = bb.fetch.Fetch([url], self.d) 977 fetcher = bb.fetch.Fetch([url], self.d)
923 fetcher.download() 978 fetcher.download()
924 # Previous cwd has been deleted 979 # Previous cwd has been deleted
@@ -934,7 +989,7 @@ class FetcherNetworkTest(FetcherTest):
934 989
935 @skipIfNoNetwork() 990 @skipIfNoNetwork()
936 def test_git_submodule_CLI11(self): 991 def test_git_submodule_CLI11(self):
937 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf" 992 url = "gitsm://github.com/CLIUtils/CLI11;protocol=https;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf;branch=main"
938 fetcher = bb.fetch.Fetch([url], self.d) 993 fetcher = bb.fetch.Fetch([url], self.d)
939 fetcher.download() 994 fetcher.download()
940 # Previous cwd has been deleted 995 # Previous cwd has been deleted
@@ -949,12 +1004,12 @@ class FetcherNetworkTest(FetcherTest):
949 @skipIfNoNetwork() 1004 @skipIfNoNetwork()
950 def test_git_submodule_update_CLI11(self): 1005 def test_git_submodule_update_CLI11(self):
951 """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """ 1006 """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """
952 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714" 1007 url = "gitsm://github.com/CLIUtils/CLI11;protocol=https;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714;branch=main"
953 fetcher = bb.fetch.Fetch([url], self.d) 1008 fetcher = bb.fetch.Fetch([url], self.d)
954 fetcher.download() 1009 fetcher.download()
955 1010
956 # CLI11 that pulls in a newer nlohmann-json 1011 # CLI11 that pulls in a newer nlohmann-json
957 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca" 1012 url = "gitsm://github.com/CLIUtils/CLI11;protocol=https;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca;branch=main"
958 fetcher = bb.fetch.Fetch([url], self.d) 1013 fetcher = bb.fetch.Fetch([url], self.d)
959 fetcher.download() 1014 fetcher.download()
960 # Previous cwd has been deleted 1015 # Previous cwd has been deleted
@@ -968,7 +1023,7 @@ class FetcherNetworkTest(FetcherTest):
968 1023
969 @skipIfNoNetwork() 1024 @skipIfNoNetwork()
970 def test_git_submodule_aktualizr(self): 1025 def test_git_submodule_aktualizr(self):
971 url = "gitsm://github.com/advancedtelematic/aktualizr;branch=master;protocol=git;rev=d00d1a04cc2366d1a5f143b84b9f507f8bd32c44" 1026 url = "gitsm://github.com/advancedtelematic/aktualizr;branch=master;protocol=https;rev=d00d1a04cc2366d1a5f143b84b9f507f8bd32c44"
972 fetcher = bb.fetch.Fetch([url], self.d) 1027 fetcher = bb.fetch.Fetch([url], self.d)
973 fetcher.download() 1028 fetcher.download()
974 # Previous cwd has been deleted 1029 # Previous cwd has been deleted
@@ -988,7 +1043,7 @@ class FetcherNetworkTest(FetcherTest):
988 """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """ 1043 """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """
989 1044
990 # This repository also has submodules where the module (name), path and url do not align 1045 # This repository also has submodules where the module (name), path and url do not align
991 url = "gitsm://github.com/azure/iotedge.git;protocol=git;rev=d76e0316c6f324345d77c48a83ce836d09392699" 1046 url = "gitsm://github.com/azure/iotedge.git;protocol=https;rev=d76e0316c6f324345d77c48a83ce836d09392699;branch=main"
992 fetcher = bb.fetch.Fetch([url], self.d) 1047 fetcher = bb.fetch.Fetch([url], self.d)
993 fetcher.download() 1048 fetcher.download()
994 # Previous cwd has been deleted 1049 # Previous cwd has been deleted
@@ -1046,7 +1101,7 @@ class SVNTest(FetcherTest):
1046 1101
1047 bb.process.run("svn co %s svnfetch_co" % self.repo_url, cwd=self.tempdir) 1102 bb.process.run("svn co %s svnfetch_co" % self.repo_url, cwd=self.tempdir)
1048 # Github will emulate SVN. Use this to check if we're downloding... 1103 # Github will emulate SVN. Use this to check if we're downloding...
1049 bb.process.run("svn propset svn:externals 'bitbake svn://vcs.pcre.org/pcre2/code' .", 1104 bb.process.run("svn propset svn:externals 'bitbake https://github.com/PhilipHazel/pcre2.git' .",
1050 cwd=os.path.join(self.tempdir, 'svnfetch_co', 'trunk')) 1105 cwd=os.path.join(self.tempdir, 'svnfetch_co', 'trunk'))
1051 bb.process.run("svn commit --non-interactive -m 'Add external'", 1106 bb.process.run("svn commit --non-interactive -m 'Add external'",
1052 cwd=os.path.join(self.tempdir, 'svnfetch_co', 'trunk')) 1107 cwd=os.path.join(self.tempdir, 'svnfetch_co', 'trunk'))
@@ -1164,7 +1219,7 @@ class FetchLatestVersionTest(FetcherTest):
1164 1219
1165 test_git_uris = { 1220 test_git_uris = {
1166 # version pattern "X.Y.Z" 1221 # version pattern "X.Y.Z"
1167 ("mx-1.0", "git://github.com/clutter-project/mx.git;branch=mx-1.4", "9b1db6b8060bd00b121a692f942404a24ae2960f", "") 1222 ("mx-1.0", "git://github.com/clutter-project/mx.git;branch=mx-1.4;protocol=https", "9b1db6b8060bd00b121a692f942404a24ae2960f", "")
1168 : "1.99.4", 1223 : "1.99.4",
1169 # version pattern "vX.Y" 1224 # version pattern "vX.Y"
1170 # mirror of git.infradead.org since network issues interfered with testing 1225 # mirror of git.infradead.org since network issues interfered with testing
@@ -1175,7 +1230,7 @@ class FetchLatestVersionTest(FetcherTest):
1175 ("presentproto", "git://git.yoctoproject.org/bbfetchtests-presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "") 1230 ("presentproto", "git://git.yoctoproject.org/bbfetchtests-presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "")
1176 : "1.0", 1231 : "1.0",
1177 # version pattern "pkg_name-vX.Y.Z" 1232 # version pattern "pkg_name-vX.Y.Z"
1178 ("dtc", "git://git.qemu.org/dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "") 1233 ("dtc", "git://git.yoctoproject.org/bbfetchtests-dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "")
1179 : "1.4.0", 1234 : "1.4.0",
1180 # combination version pattern 1235 # combination version pattern
1181 ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https", "cd44ee6644c3641507fb53b8a2a69137f2971219", "") 1236 ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https", "cd44ee6644c3641507fb53b8a2a69137f2971219", "")
@@ -1187,13 +1242,13 @@ class FetchLatestVersionTest(FetcherTest):
1187 : "20120614", 1242 : "20120614",
1188 # packages with a valid UPSTREAM_CHECK_GITTAGREGEX 1243 # packages with a valid UPSTREAM_CHECK_GITTAGREGEX
1189 # mirror of git://anongit.freedesktop.org/xorg/driver/xf86-video-omap since network issues interfered with testing 1244 # mirror of git://anongit.freedesktop.org/xorg/driver/xf86-video-omap since network issues interfered with testing
1190 ("xf86-video-omap", "git://git.yoctoproject.org/bbfetchtests-xf86-video-omap", "ae0394e687f1a77e966cf72f895da91840dffb8f", "(?P<pver>(\d+\.(\d\.?)*))") 1245 ("xf86-video-omap", "git://git.yoctoproject.org/bbfetchtests-xf86-video-omap", "ae0394e687f1a77e966cf72f895da91840dffb8f", r"(?P<pver>(\d+\.(\d\.?)*))")
1191 : "0.4.3", 1246 : "0.4.3",
1192 ("build-appliance-image", "git://git.yoctoproject.org/poky", "b37dd451a52622d5b570183a81583cc34c2ff555", "(?P<pver>(([0-9][\.|_]?)+[0-9]))") 1247 ("build-appliance-image", "git://git.yoctoproject.org/poky", "b37dd451a52622d5b570183a81583cc34c2ff555", r"(?P<pver>(([0-9][\.|_]?)+[0-9]))")
1193 : "11.0.0", 1248 : "11.0.0",
1194 ("chkconfig-alternatives-native", "git://github.com/kergoth/chkconfig;branch=sysroot", "cd437ecbd8986c894442f8fce1e0061e20f04dee", "chkconfig\-(?P<pver>((\d+[\.\-_]*)+))") 1249 ("chkconfig-alternatives-native", "git://github.com/kergoth/chkconfig;branch=sysroot;protocol=https", "cd437ecbd8986c894442f8fce1e0061e20f04dee", r"chkconfig\-(?P<pver>((\d+[\.\-_]*)+))")
1195 : "1.3.59", 1250 : "1.3.59",
1196 ("remake", "git://github.com/rocky/remake.git", "f05508e521987c8494c92d9c2871aec46307d51d", "(?P<pver>(\d+\.(\d+\.)*\d*(\+dbg\d+(\.\d+)*)*))") 1251 ("remake", "git://github.com/rocky/remake.git;protocol=https", "f05508e521987c8494c92d9c2871aec46307d51d", r"(?P<pver>(\d+\.(\d+\.)*\d*(\+dbg\d+(\.\d+)*)*))")
1197 : "3.82+dbg0.9", 1252 : "3.82+dbg0.9",
1198 } 1253 }
1199 1254
@@ -1233,11 +1288,11 @@ class FetchLatestVersionTest(FetcherTest):
1233 # 1288 #
1234 # http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2 1289 # http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2
1235 # https://github.com/apple/cups/releases 1290 # https://github.com/apple/cups/releases
1236 ("cups", "/software/1.7.2/cups-1.7.2-source.tar.bz2", "/apple/cups/releases", "(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz") 1291 ("cups", "/software/1.7.2/cups-1.7.2-source.tar.bz2", "/apple/cups/releases", r"(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz")
1237 : "2.0.0", 1292 : "2.0.0",
1238 # http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz 1293 # http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz
1239 # http://ftp.debian.org/debian/pool/main/d/db5.3/ 1294 # http://ftp.debian.org/debian/pool/main/d/db5.3/
1240 ("db", "/berkeley-db/db-5.3.21.tar.gz", "/debian/pool/main/d/db5.3/", "(?P<name>db5\.3_)(?P<pver>\d+(\.\d+)+).+\.orig\.tar\.xz") 1295 ("db", "/berkeley-db/db-5.3.21.tar.gz", "/debian/pool/main/d/db5.3/", r"(?P<name>db5\.3_)(?P<pver>\d+(\.\d+)+).+\.orig\.tar\.xz")
1241 : "5.3.10", 1296 : "5.3.10",
1242 } 1297 }
1243 1298
@@ -1283,13 +1338,10 @@ class FetchCheckStatusTest(FetcherTest):
1283 "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.2.tar.gz", 1338 "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.2.tar.gz",
1284 "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.3.tar.gz", 1339 "http://downloads.yoctoproject.org/releases/sato/sato-engine-0.3.tar.gz",
1285 "https://yoctoproject.org/", 1340 "https://yoctoproject.org/",
1286 "https://yoctoproject.org/documentation", 1341 "https://docs.yoctoproject.org/",
1287 "http://downloads.yoctoproject.org/releases/opkg/opkg-0.1.7.tar.gz", 1342 "http://downloads.yoctoproject.org/releases/opkg/opkg-0.1.7.tar.gz",
1288 "http://downloads.yoctoproject.org/releases/opkg/opkg-0.3.0.tar.gz", 1343 "http://downloads.yoctoproject.org/releases/opkg/opkg-0.3.0.tar.gz",
1289 "ftp://sourceware.org/pub/libffi/libffi-1.20.tar.gz", 1344 "ftp://sourceware.org/pub/libffi/libffi-1.20.tar.gz",
1290 "http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz",
1291 "https://ftp.gnu.org/gnu/chess/gnuchess-5.08.tar.gz",
1292 "https://ftp.gnu.org/gnu/gmp/gmp-4.0.tar.gz",
1293 # GitHub releases are hosted on Amazon S3, which doesn't support HEAD 1345 # GitHub releases are hosted on Amazon S3, which doesn't support HEAD
1294 "https://github.com/kergoth/tslib/releases/download/1.1/tslib-1.1.tar.xz" 1346 "https://github.com/kergoth/tslib/releases/download/1.1/tslib-1.1.tar.xz"
1295 ] 1347 ]
@@ -1328,6 +1380,8 @@ class GitMakeShallowTest(FetcherTest):
1328 self.gitdir = os.path.join(self.tempdir, 'gitshallow') 1380 self.gitdir = os.path.join(self.tempdir, 'gitshallow')
1329 bb.utils.mkdirhier(self.gitdir) 1381 bb.utils.mkdirhier(self.gitdir)
1330 bb.process.run('git init', cwd=self.gitdir) 1382 bb.process.run('git init', cwd=self.gitdir)
1383 bb.process.run('git config user.email "you@example.com"', cwd=self.gitdir)
1384 bb.process.run('git config user.name "Your Name"', cwd=self.gitdir)
1331 1385
1332 def assertRefs(self, expected_refs): 1386 def assertRefs(self, expected_refs):
1333 actual_refs = self.git(['for-each-ref', '--format=%(refname)']).splitlines() 1387 actual_refs = self.git(['for-each-ref', '--format=%(refname)']).splitlines()
@@ -1451,6 +1505,8 @@ class GitShallowTest(FetcherTest):
1451 1505
1452 bb.utils.mkdirhier(self.srcdir) 1506 bb.utils.mkdirhier(self.srcdir)
1453 self.git('init', cwd=self.srcdir) 1507 self.git('init', cwd=self.srcdir)
1508 self.git('config user.email "you@example.com"', cwd=self.srcdir)
1509 self.git('config user.name "Your Name"', cwd=self.srcdir)
1454 self.d.setVar('WORKDIR', self.tempdir) 1510 self.d.setVar('WORKDIR', self.tempdir)
1455 self.d.setVar('S', self.gitdir) 1511 self.d.setVar('S', self.gitdir)
1456 self.d.delVar('PREMIRRORS') 1512 self.d.delVar('PREMIRRORS')
@@ -1532,6 +1588,7 @@ class GitShallowTest(FetcherTest):
1532 1588
1533 # fetch and unpack, from the shallow tarball 1589 # fetch and unpack, from the shallow tarball
1534 bb.utils.remove(self.gitdir, recurse=True) 1590 bb.utils.remove(self.gitdir, recurse=True)
1591 bb.process.run('chmod u+w -R "%s"' % ud.clonedir)
1535 bb.utils.remove(ud.clonedir, recurse=True) 1592 bb.utils.remove(ud.clonedir, recurse=True)
1536 bb.utils.remove(ud.clonedir.replace('gitsource', 'gitsubmodule'), recurse=True) 1593 bb.utils.remove(ud.clonedir.replace('gitsource', 'gitsubmodule'), recurse=True)
1537 1594
@@ -1684,6 +1741,8 @@ class GitShallowTest(FetcherTest):
1684 smdir = os.path.join(self.tempdir, 'gitsubmodule') 1741 smdir = os.path.join(self.tempdir, 'gitsubmodule')
1685 bb.utils.mkdirhier(smdir) 1742 bb.utils.mkdirhier(smdir)
1686 self.git('init', cwd=smdir) 1743 self.git('init', cwd=smdir)
1744 self.git('config user.email "you@example.com"', cwd=smdir)
1745 self.git('config user.name "Your Name"', cwd=smdir)
1687 # Make this look like it was cloned from a remote... 1746 # Make this look like it was cloned from a remote...
1688 self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) 1747 self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir)
1689 self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) 1748 self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir)
@@ -1691,7 +1750,7 @@ class GitShallowTest(FetcherTest):
1691 self.add_empty_file('bsub', cwd=smdir) 1750 self.add_empty_file('bsub', cwd=smdir)
1692 1751
1693 self.git('submodule init', cwd=self.srcdir) 1752 self.git('submodule init', cwd=self.srcdir)
1694 self.git('submodule add file://%s' % smdir, cwd=self.srcdir) 1753 self.git('-c protocol.file.allow=always submodule add file://%s' % smdir, cwd=self.srcdir)
1695 self.git('submodule update', cwd=self.srcdir) 1754 self.git('submodule update', cwd=self.srcdir)
1696 self.git('commit -m submodule -a', cwd=self.srcdir) 1755 self.git('commit -m submodule -a', cwd=self.srcdir)
1697 1756
@@ -1714,6 +1773,8 @@ class GitShallowTest(FetcherTest):
1714 smdir = os.path.join(self.tempdir, 'gitsubmodule') 1773 smdir = os.path.join(self.tempdir, 'gitsubmodule')
1715 bb.utils.mkdirhier(smdir) 1774 bb.utils.mkdirhier(smdir)
1716 self.git('init', cwd=smdir) 1775 self.git('init', cwd=smdir)
1776 self.git('config user.email "you@example.com"', cwd=smdir)
1777 self.git('config user.name "Your Name"', cwd=smdir)
1717 # Make this look like it was cloned from a remote... 1778 # Make this look like it was cloned from a remote...
1718 self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) 1779 self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir)
1719 self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) 1780 self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir)
@@ -1721,7 +1782,7 @@ class GitShallowTest(FetcherTest):
1721 self.add_empty_file('bsub', cwd=smdir) 1782 self.add_empty_file('bsub', cwd=smdir)
1722 1783
1723 self.git('submodule init', cwd=self.srcdir) 1784 self.git('submodule init', cwd=self.srcdir)
1724 self.git('submodule add file://%s' % smdir, cwd=self.srcdir) 1785 self.git('-c protocol.file.allow=always submodule add file://%s' % smdir, cwd=self.srcdir)
1725 self.git('submodule update', cwd=self.srcdir) 1786 self.git('submodule update', cwd=self.srcdir)
1726 self.git('commit -m submodule -a', cwd=self.srcdir) 1787 self.git('commit -m submodule -a', cwd=self.srcdir)
1727 1788
@@ -1756,8 +1817,8 @@ class GitShallowTest(FetcherTest):
1756 self.git('annex init', cwd=self.srcdir) 1817 self.git('annex init', cwd=self.srcdir)
1757 open(os.path.join(self.srcdir, 'c'), 'w').close() 1818 open(os.path.join(self.srcdir, 'c'), 'w').close()
1758 self.git('annex add c', cwd=self.srcdir) 1819 self.git('annex add c', cwd=self.srcdir)
1759 self.git('commit -m annex-c -a', cwd=self.srcdir) 1820 self.git('commit --author "Foo Bar <foo@bar>" -m annex-c -a', cwd=self.srcdir)
1760 bb.process.run('chmod u+w -R %s' % os.path.join(self.srcdir, '.git', 'annex')) 1821 bb.process.run('chmod u+w -R %s' % self.srcdir)
1761 1822
1762 uri = 'gitannex://%s;protocol=file;subdir=${S}' % self.srcdir 1823 uri = 'gitannex://%s;protocol=file;subdir=${S}' % self.srcdir
1763 fetcher, ud = self.fetch_shallow(uri) 1824 fetcher, ud = self.fetch_shallow(uri)
@@ -1971,7 +2032,7 @@ class GitShallowTest(FetcherTest):
1971 2032
1972 @skipIfNoNetwork() 2033 @skipIfNoNetwork()
1973 def test_bitbake(self): 2034 def test_bitbake(self):
1974 self.git('remote add --mirror=fetch origin git://github.com/openembedded/bitbake', cwd=self.srcdir) 2035 self.git('remote add --mirror=fetch origin https://github.com/openembedded/bitbake', cwd=self.srcdir)
1975 self.git('config core.bare true', cwd=self.srcdir) 2036 self.git('config core.bare true', cwd=self.srcdir)
1976 self.git('fetch', cwd=self.srcdir) 2037 self.git('fetch', cwd=self.srcdir)
1977 2038
@@ -2032,6 +2093,8 @@ class GitLfsTest(FetcherTest):
2032 2093
2033 bb.utils.mkdirhier(self.srcdir) 2094 bb.utils.mkdirhier(self.srcdir)
2034 self.git('init', cwd=self.srcdir) 2095 self.git('init', cwd=self.srcdir)
2096 self.git('config user.email "you@example.com"', cwd=self.srcdir)
2097 self.git('config user.name "Your Name"', cwd=self.srcdir)
2035 with open(os.path.join(self.srcdir, '.gitattributes'), 'wt') as attrs: 2098 with open(os.path.join(self.srcdir, '.gitattributes'), 'wt') as attrs:
2036 attrs.write('*.mp3 filter=lfs -text') 2099 attrs.write('*.mp3 filter=lfs -text')
2037 self.git(['add', '.gitattributes'], cwd=self.srcdir) 2100 self.git(['add', '.gitattributes'], cwd=self.srcdir)