summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/recipetool.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/recipetool.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py266
1 files changed, 37 insertions, 229 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index 126906df50..0bd724c8ee 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -138,7 +138,7 @@ class RecipetoolAppendTests(RecipetoolBase):
138 '\n', 138 '\n',
139 'do_install:append() {\n', 139 'do_install:append() {\n',
140 ' install -d ${D}${%s}\n' % dirname, 140 ' install -d ${D}${%s}\n' % dirname,
141 ' install -m 0755 ${WORKDIR}/%s ${D}${%s}/ls\n' % (testfile2name, dirname), 141 ' install -m 0755 ${UNPACKDIR}/%s ${D}${%s}/ls\n' % (testfile2name, dirname),
142 '}\n'] 142 '}\n']
143 self._try_recipetool_appendfile('coreutils', lspath, testfile2, '-r coreutils', expectedlines, [testfile2name]) 143 self._try_recipetool_appendfile('coreutils', lspath, testfile2, '-r coreutils', expectedlines, [testfile2name])
144 # Now try bbappending the same file again, contents should not change 144 # Now try bbappending the same file again, contents should not change
@@ -164,7 +164,7 @@ class RecipetoolAppendTests(RecipetoolBase):
164 '\n', 164 '\n',
165 'do_install:append() {\n', 165 'do_install:append() {\n',
166 ' install -d ${D}${datadir}\n', 166 ' install -d ${D}${datadir}\n',
167 ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', 167 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n',
168 '}\n'] 168 '}\n']
169 self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile']) 169 self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile'])
170 # Try adding another file, this time where the source file is executable 170 # Try adding another file, this time where the source file is executable
@@ -179,8 +179,8 @@ class RecipetoolAppendTests(RecipetoolBase):
179 '\n', 179 '\n',
180 'do_install:append() {\n', 180 'do_install:append() {\n',
181 ' install -d ${D}${datadir}\n', 181 ' install -d ${D}${datadir}\n',
182 ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', 182 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n',
183 ' install -m 0755 ${WORKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name, 183 ' install -m 0755 ${UNPACKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name,
184 '}\n'] 184 '}\n']
185 self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name]) 185 self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name])
186 186
@@ -192,7 +192,7 @@ class RecipetoolAppendTests(RecipetoolBase):
192 '\n', 192 '\n',
193 'do_install:append() {\n', 193 'do_install:append() {\n',
194 ' install -d ${D}${bindir}\n', 194 ' install -d ${D}${bindir}\n',
195 ' install -m 0755 ${WORKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n', 195 ' install -m 0755 ${UNPACKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n',
196 '}\n'] 196 '}\n']
197 _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile']) 197 _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile'])
198 self.assertNotIn('WARNING: ', output) 198 self.assertNotIn('WARNING: ', output)
@@ -207,7 +207,7 @@ class RecipetoolAppendTests(RecipetoolBase):
207 '\n', 207 '\n',
208 'do_install:append:mymachine() {\n', 208 'do_install:append:mymachine() {\n',
209 ' install -d ${D}${datadir}\n', 209 ' install -d ${D}${datadir}\n',
210 ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', 210 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n',
211 '}\n'] 211 '}\n']
212 _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile']) 212 _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile'])
213 self.assertNotIn('WARNING: ', output) 213 self.assertNotIn('WARNING: ', output)
@@ -241,7 +241,7 @@ class RecipetoolAppendTests(RecipetoolBase):
241 '\n', 241 '\n',
242 'do_install:append() {\n', 242 'do_install:append() {\n',
243 ' install -d ${D}${datadir}\n', 243 ' install -d ${D}${datadir}\n',
244 ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-subdir\n', 244 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-subdir\n',
245 '}\n'] 245 '}\n']
246 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) 246 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile'])
247 self.assertNotIn('WARNING: ', output) 247 self.assertNotIn('WARNING: ', output)
@@ -268,7 +268,7 @@ class RecipetoolAppendTests(RecipetoolBase):
268 '\n', 268 '\n',
269 'do_install:append() {\n', 269 'do_install:append() {\n',
270 ' install -d ${D}${sysconfdir}\n', 270 ' install -d ${D}${sysconfdir}\n',
271 ' install -m 0644 ${WORKDIR}/testfile ${D}${sysconfdir}/selftest-replaceme-patched\n', 271 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${sysconfdir}/selftest-replaceme-patched\n',
272 '}\n'] 272 '}\n']
273 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/etc/selftest-replaceme-patched', self.testfile, '', expectedlines, ['testfile']) 273 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/etc/selftest-replaceme-patched', self.testfile, '', expectedlines, ['testfile'])
274 for line in output.splitlines(): 274 for line in output.splitlines():
@@ -286,7 +286,7 @@ class RecipetoolAppendTests(RecipetoolBase):
286 '\n', 286 '\n',
287 'do_install:append() {\n', 287 'do_install:append() {\n',
288 ' install -d ${D}${datadir}\n', 288 ' install -d ${D}${datadir}\n',
289 ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-scripted\n', 289 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-scripted\n',
290 '}\n'] 290 '}\n']
291 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile']) 291 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile'])
292 self.assertNotIn('WARNING: ', output) 292 self.assertNotIn('WARNING: ', output)
@@ -309,7 +309,7 @@ class RecipetoolAppendTests(RecipetoolBase):
309 '\n', 309 '\n',
310 'do_install:append() {\n', 310 'do_install:append() {\n',
311 ' install -d ${D}${datadir}\n', 311 ' install -d ${D}${datadir}\n',
312 ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-postinst\n', 312 ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-postinst\n',
313 '}\n'] 313 '}\n']
314 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) 314 _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile'])
315 315
@@ -385,7 +385,7 @@ class RecipetoolCreateTests(RecipetoolBase):
385 checkvars = {} 385 checkvars = {}
386 checkvars['LICENSE'] = 'LGPL-2.1-only' 386 checkvars['LICENSE'] = 'LGPL-2.1-only'
387 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' 387 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
388 checkvars['S'] = '${WORKDIR}/git' 388 checkvars['S'] = None
389 checkvars['PV'] = '1.11+git' 389 checkvars['PV'] = '1.11+git'
390 checkvars['SRC_URI'] = srcuri + ';branch=master' 390 checkvars['SRC_URI'] = srcuri + ';branch=master'
391 checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango']) 391 checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango'])
@@ -757,235 +757,42 @@ class RecipetoolCreateTests(RecipetoolBase):
757 757
758 def test_recipetool_create_go(self): 758 def test_recipetool_create_go(self):
759 # Basic test to check go recipe generation 759 # Basic test to check go recipe generation
760 self.maxDiff = None
761
760 temprecipe = os.path.join(self.tempdir, 'recipe') 762 temprecipe = os.path.join(self.tempdir, 'recipe')
761 os.makedirs(temprecipe) 763 os.makedirs(temprecipe)
762 764
763 recipefile = os.path.join(temprecipe, 'edgex-go_git.bb') 765 recipefile = os.path.join(temprecipe, 'recipetool-go-test_git.bb')
764 deps_require_file = os.path.join(temprecipe, 'edgex-go', 'edgex-go-modules.inc')
765 lics_require_file = os.path.join(temprecipe, 'edgex-go', 'edgex-go-licenses.inc')
766 modules_txt_file = os.path.join(temprecipe, 'edgex-go', 'modules.txt')
767 766
768 srcuri = 'https://github.com/edgexfoundry/edgex-go.git' 767 srcuri = 'https://git.yoctoproject.org/recipetool-go-test.git'
769 srcrev = "v3.0.0" 768 srcrev = "c3e213c01b6c1406b430df03ef0d1ae77de5d2f7"
770 srcbranch = "main" 769 srcbranch = "main"
771 770
772 result = runCmd('recipetool create -o %s %s -S %s -B %s' % (temprecipe, srcuri, srcrev, srcbranch)) 771 result = runCmd('recipetool create -o %s %s -S %s -B %s' % (temprecipe, srcuri, srcrev, srcbranch))
773 772
774 self.maxDiff = None 773 inherits = ['go-mod', 'go-mod-update-modules']
775 inherits = ['go-vendor']
776 774
777 checkvars = {} 775 checkvars = {}
778 checkvars['GO_IMPORT'] = "github.com/edgexfoundry/edgex-go" 776 checkvars['GO_IMPORT'] = "git.yoctoproject.org/recipetool-go-test"
779 checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https', 777 checkvars['SRC_URI'] = {'git://${GO_IMPORT};protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}'}
780 'file://modules.txt'} 778 checkvars['LIC_FILES_CHKSUM'] = {
781 checkvars['LIC_FILES_CHKSUM'] = {'file://src/${GO_IMPORT}/LICENSE;md5=8f8bc924cf73f6a32381e5fd4c58d603'} 779 'file://src/${GO_IMPORT}/LICENSE;md5=4e3933dd47afbf115e484d11385fb3bd',
780 'file://src/${GO_IMPORT}/is/LICENSE;md5=62beaee5a116dd1e80161667b1df39ab'
781 }
782 782
783 self.assertTrue(os.path.isfile(recipefile))
784 self._test_recipe_contents(recipefile, checkvars, inherits) 783 self._test_recipe_contents(recipefile, checkvars, inherits)
784 self.assertNotIn('Traceback', result.output)
785 785
786 lics_require_file = os.path.join(temprecipe, 'recipetool-go-test-licenses.inc')
787 self.assertFileExists(lics_require_file)
786 checkvars = {} 788 checkvars = {}
787 checkvars['VENDORED_LIC_FILES_CHKSUM'] = set( 789 checkvars['LIC_FILES_CHKSUM'] = {'file://pkg/mod/github.com/godbus/dbus/v5@v5.1.0/LICENSE;md5=09042bd5c6c96a2b9e45ddf1bc517eed;spdx=BSD-2-Clause'}
788 ['file://src/${GO_IMPORT}/vendor/github.com/Microsoft/go-winio/LICENSE;md5=69205ff73858f2c22b2ca135b557e8ef',
789 'file://src/${GO_IMPORT}/vendor/github.com/armon/go-metrics/LICENSE;md5=d2d77030c0183e3d1e66d26dc1f243be',
790 'file://src/${GO_IMPORT}/vendor/github.com/cenkalti/backoff/LICENSE;md5=1571d94433e3f3aa05267efd4dbea68b',
791 'file://src/${GO_IMPORT}/vendor/github.com/davecgh/go-spew/LICENSE;md5=c06795ed54b2a35ebeeb543cd3a73e56',
792 'file://src/${GO_IMPORT}/vendor/github.com/eclipse/paho.mqtt.golang/LICENSE;md5=dcdb33474b60c38efd27356d8f2edec7',
793 'file://src/${GO_IMPORT}/vendor/github.com/eclipse/paho.mqtt.golang/edl-v10;md5=3adfcc70f5aeb7a44f3f9b495aa1fbf3',
794 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-bootstrap/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
795 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-configuration/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
796 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-core-contracts/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
797 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-messaging/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
798 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-registry/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
799 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-secrets/v3/LICENSE;md5=f9fa2f4f8e0ef8cc7b5dd150963eb457',
800 'file://src/${GO_IMPORT}/vendor/github.com/fatih/color/LICENSE.md;md5=316e6d590bdcde7993fb175662c0dd5a',
801 'file://src/${GO_IMPORT}/vendor/github.com/fxamacker/cbor/v2/LICENSE;md5=827f5a2fa861382d35a3943adf9ebb86',
802 'file://src/${GO_IMPORT}/vendor/github.com/go-jose/go-jose/v3/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57',
803 'file://src/${GO_IMPORT}/vendor/github.com/go-jose/go-jose/v3/json/LICENSE;md5=591778525c869cdde0ab5a1bf283cd81',
804 'file://src/${GO_IMPORT}/vendor/github.com/go-kit/log/LICENSE;md5=5b7c15ad5fffe2ff6e9d58a6c161f082',
805 'file://src/${GO_IMPORT}/vendor/github.com/go-logfmt/logfmt/LICENSE;md5=98e39517c38127f969de33057067091e',
806 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/locales/LICENSE;md5=3ccbda375ee345400ad1da85ba522301',
807 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/universal-translator/LICENSE;md5=2e2b21ef8f61057977d27c727c84bef1',
808 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/validator/v10/LICENSE;md5=a718a0f318d76f7c5d510cbae84f0b60',
809 'file://src/${GO_IMPORT}/vendor/github.com/go-redis/redis/v7/LICENSE;md5=58103aa5ea1ee9b7a369c9c4a95ef9b5',
810 'file://src/${GO_IMPORT}/vendor/github.com/golang/protobuf/LICENSE;md5=939cce1ec101726fa754e698ac871622',
811 'file://src/${GO_IMPORT}/vendor/github.com/gomodule/redigo/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93',
812 'file://src/${GO_IMPORT}/vendor/github.com/google/uuid/LICENSE;md5=88073b6dd8ec00fe09da59e0b6dfded1',
813 'file://src/${GO_IMPORT}/vendor/github.com/gorilla/mux/LICENSE;md5=33fa1116c45f9e8de714033f99edde13',
814 'file://src/${GO_IMPORT}/vendor/github.com/gorilla/websocket/LICENSE;md5=c007b54a1743d596f46b2748d9f8c044',
815 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/consul/api/LICENSE;md5=b8a277a612171b7526e9be072f405ef4',
816 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/errwrap/LICENSE;md5=b278a92d2c1509760384428817710378',
817 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-cleanhttp/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea',
818 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-hclog/LICENSE;md5=ec7f605b74b9ad03347d0a93a5cc7eb8',
819 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-immutable-radix/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea',
820 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-multierror/LICENSE;md5=d44fdeb607e2d2614db9464dbedd4094',
821 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-rootcerts/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea',
822 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/golang-lru/LICENSE;md5=f27a50d2e878867827842f2c60e30bfc',
823 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/serf/LICENSE;md5=b278a92d2c1509760384428817710378',
824 'file://src/${GO_IMPORT}/vendor/github.com/leodido/go-urn/LICENSE;md5=8f50db5538ec1148a9b3d14ed96c3418',
825 'file://src/${GO_IMPORT}/vendor/github.com/mattn/go-colorable/LICENSE;md5=24ce168f90aec2456a73de1839037245',
826 'file://src/${GO_IMPORT}/vendor/github.com/mattn/go-isatty/LICENSE;md5=f509beadd5a11227c27b5d2ad6c9f2c6',
827 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/consulstructure/LICENSE;md5=96ada10a9e51c98c4656f2cede08c673',
828 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/copystructure/LICENSE;md5=56da355a12d4821cda57b8f23ec34bc4',
829 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/go-homedir/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd',
830 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/mapstructure/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd',
831 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/reflectwalk/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd',
832 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nats.go/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
833 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nkeys/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
834 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nuid/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
835 'file://src/${GO_IMPORT}/vendor/github.com/pmezard/go-difflib/LICENSE;md5=e9a2ebb8de779a07500ddecca806145e',
836 'file://src/${GO_IMPORT}/vendor/github.com/rcrowley/go-metrics/LICENSE;md5=1bdf5d819f50f141366dabce3be1460f',
837 'file://src/${GO_IMPORT}/vendor/github.com/spiffe/go-spiffe/v2/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
838 'file://src/${GO_IMPORT}/vendor/github.com/stretchr/objx/LICENSE;md5=d023fd31d3ca39ec61eec65a91732735',
839 'file://src/${GO_IMPORT}/vendor/github.com/stretchr/testify/LICENSE;md5=188f01994659f3c0d310612333d2a26f',
840 'file://src/${GO_IMPORT}/vendor/github.com/x448/float16/LICENSE;md5=de8f8e025d57fe7ee0b67f30d571323b',
841 'file://src/${GO_IMPORT}/vendor/github.com/zeebo/errs/LICENSE;md5=84914ab36fc0eb48edbaa53e66e8d326',
842 'file://src/${GO_IMPORT}/vendor/golang.org/x/crypto/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
843 'file://src/${GO_IMPORT}/vendor/golang.org/x/mod/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
844 'file://src/${GO_IMPORT}/vendor/golang.org/x/net/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
845 'file://src/${GO_IMPORT}/vendor/golang.org/x/sync/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
846 'file://src/${GO_IMPORT}/vendor/golang.org/x/sys/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
847 'file://src/${GO_IMPORT}/vendor/golang.org/x/text/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
848 'file://src/${GO_IMPORT}/vendor/golang.org/x/tools/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
849 'file://src/${GO_IMPORT}/vendor/google.golang.org/genproto/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57',
850 'file://src/${GO_IMPORT}/vendor/google.golang.org/grpc/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57',
851 'file://src/${GO_IMPORT}/vendor/google.golang.org/protobuf/LICENSE;md5=02d4002e9171d41a8fad93aa7faf3956',
852 'file://src/${GO_IMPORT}/vendor/gopkg.in/eapache/queue.v1/LICENSE;md5=1bfd4408d3de090ef6b908b0cc45a316',
853 'file://src/${GO_IMPORT}/vendor/gopkg.in/yaml.v3/LICENSE;md5=3c91c17266710e16afdbb2b6d15c761c'])
854
855 self.assertTrue(os.path.isfile(lics_require_file))
856 self._test_recipe_contents(lics_require_file, checkvars, []) 790 self._test_recipe_contents(lics_require_file, checkvars, [])
857 791
858 dependencies = \ 792 deps_require_file = os.path.join(temprecipe, 'recipetool-go-test-go-mods.inc')
859 [ ('github.com/eclipse/paho.mqtt.golang','v1.4.2', '', '', ''), 793 self.assertFileExists(deps_require_file)
860 ('github.com/edgexfoundry/go-mod-bootstrap','v3.0.1','github.com/edgexfoundry/go-mod-bootstrap/v3','/v3', ''),
861 ('github.com/edgexfoundry/go-mod-configuration','v3.0.0','github.com/edgexfoundry/go-mod-configuration/v3','/v3', ''),
862 ('github.com/edgexfoundry/go-mod-core-contracts','v3.0.0','github.com/edgexfoundry/go-mod-core-contracts/v3','/v3', ''),
863 ('github.com/edgexfoundry/go-mod-messaging','v3.0.0','github.com/edgexfoundry/go-mod-messaging/v3','/v3', ''),
864 ('github.com/edgexfoundry/go-mod-secrets','v3.0.1','github.com/edgexfoundry/go-mod-secrets/v3','/v3', ''),
865 ('github.com/fxamacker/cbor','v2.4.0','github.com/fxamacker/cbor/v2','/v2', ''),
866 ('github.com/gomodule/redigo','v1.8.9', '', '', ''),
867 ('github.com/google/uuid','v1.3.0', '', '', ''),
868 ('github.com/gorilla/mux','v1.8.0', '', '', ''),
869 ('github.com/rcrowley/go-metrics','v0.0.0-20201227073835-cf1acfcdf475', '', '', ''),
870 ('github.com/spiffe/go-spiffe','v2.1.4','github.com/spiffe/go-spiffe/v2','/v2', ''),
871 ('github.com/stretchr/testify','v1.8.2', '', '', ''),
872 ('go.googlesource.com/crypto','v0.8.0','golang.org/x/crypto', '', ''),
873 ('gopkg.in/eapache/queue.v1','v1.1.0', '', '', ''),
874 ('gopkg.in/yaml.v3','v3.0.1', '', '', ''),
875 ('github.com/microsoft/go-winio','v0.6.0','github.com/Microsoft/go-winio', '', ''),
876 ('github.com/hashicorp/go-metrics','v0.3.10','github.com/armon/go-metrics', '', ''),
877 ('github.com/cenkalti/backoff','v2.2.1+incompatible', '', '', ''),
878 ('github.com/davecgh/go-spew','v1.1.1', '', '', ''),
879 ('github.com/edgexfoundry/go-mod-registry','v3.0.0','github.com/edgexfoundry/go-mod-registry/v3','/v3', ''),
880 ('github.com/fatih/color','v1.9.0', '', '', ''),
881 ('github.com/go-jose/go-jose','v3.0.0','github.com/go-jose/go-jose/v3','/v3', ''),
882 ('github.com/go-kit/log','v0.2.1', '', '', ''),
883 ('github.com/go-logfmt/logfmt','v0.5.1', '', '', ''),
884 ('github.com/go-playground/locales','v0.14.1', '', '', ''),
885 ('github.com/go-playground/universal-translator','v0.18.1', '', '', ''),
886 ('github.com/go-playground/validator','v10.13.0','github.com/go-playground/validator/v10','/v10', ''),
887 ('github.com/go-redis/redis','v7.3.0','github.com/go-redis/redis/v7','/v7', ''),
888 ('github.com/golang/protobuf','v1.5.2', '', '', ''),
889 ('github.com/gorilla/websocket','v1.4.2', '', '', ''),
890 ('github.com/hashicorp/consul','v1.20.0','github.com/hashicorp/consul/api', '', 'api'),
891 ('github.com/hashicorp/errwrap','v1.0.0', '', '', ''),
892 ('github.com/hashicorp/go-cleanhttp','v0.5.1', '', '', ''),
893 ('github.com/hashicorp/go-hclog','v0.14.1', '', '', ''),
894 ('github.com/hashicorp/go-immutable-radix','v1.3.0', '', '', ''),
895 ('github.com/hashicorp/go-multierror','v1.1.1', '', '', ''),
896 ('github.com/hashicorp/go-rootcerts','v1.0.2', '', '', ''),
897 ('github.com/hashicorp/golang-lru','v0.5.4', '', '', ''),
898 ('github.com/hashicorp/serf','v0.10.1', '', '', ''),
899 ('github.com/leodido/go-urn','v1.2.3', '', '', ''),
900 ('github.com/mattn/go-colorable','v0.1.12', '', '', ''),
901 ('github.com/mattn/go-isatty','v0.0.14', '', '', ''),
902 ('github.com/mitchellh/consulstructure','v0.0.0-20190329231841-56fdc4d2da54', '', '', ''),
903 ('github.com/mitchellh/copystructure','v1.2.0', '', '', ''),
904 ('github.com/mitchellh/go-homedir','v1.1.0', '', '', ''),
905 ('github.com/mitchellh/mapstructure','v1.5.0', '', '', ''),
906 ('github.com/mitchellh/reflectwalk','v1.0.2', '', '', ''),
907 ('github.com/nats-io/nats.go','v1.25.0', '', '', ''),
908 ('github.com/nats-io/nkeys','v0.4.4', '', '', ''),
909 ('github.com/nats-io/nuid','v1.0.1', '', '', ''),
910 ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''),
911 ('github.com/stretchr/objx','v0.5.0', '', '', ''),
912 ('github.com/x448/float16','v0.8.4', '', '', ''),
913 ('github.com/zeebo/errs','v1.3.0', '', '', ''),
914 ('go.googlesource.com/mod','v0.8.0','golang.org/x/mod', '', ''),
915 ('go.googlesource.com/net','v0.9.0','golang.org/x/net', '', ''),
916 ('go.googlesource.com/sync','v0.1.0','golang.org/x/sync', '', ''),
917 ('go.googlesource.com/sys','v0.7.0','golang.org/x/sys', '', ''),
918 ('go.googlesource.com/text','v0.9.0','golang.org/x/text', '', ''),
919 ('go.googlesource.com/tools','v0.6.0','golang.org/x/tools', '', ''),
920 ('github.com/googleapis/go-genproto','v0.0.0-20230223222841-637eb2293923','google.golang.org/genproto', '', ''),
921 ('github.com/grpc/grpc-go','v1.53.0','google.golang.org/grpc', '', ''),
922 ('go.googlesource.com/protobuf','v1.28.1','google.golang.org/protobuf', '', ''),
923 ]
924
925 src_uri = set()
926 for d in dependencies:
927 src_uri.add(self._go_urifiy(*d))
928
929 checkvars = {}
930 checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri
931
932 self.assertTrue(os.path.isfile(deps_require_file))
933 self._test_recipe_contents(deps_require_file, checkvars, [])
934
935 def test_recipetool_create_go_replace_modules(self):
936 # Check handling of replaced modules
937 temprecipe = os.path.join(self.tempdir, 'recipe')
938 os.makedirs(temprecipe)
939
940 recipefile = os.path.join(temprecipe, 'openapi-generator_git.bb')
941 deps_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-modules.inc')
942 lics_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-licenses.inc')
943 modules_txt_file = os.path.join(temprecipe, 'openapi-generator', 'modules.txt')
944
945 srcuri = 'https://github.com/OpenAPITools/openapi-generator.git'
946 srcrev = "v7.2.0"
947 srcbranch = "master"
948 srcsubdir = "samples/openapi3/client/petstore/go"
949
950 result = runCmd('recipetool create -o %s %s -S %s -B %s --src-subdir %s' % (temprecipe, srcuri, srcrev, srcbranch, srcsubdir))
951
952 self.maxDiff = None
953 inherits = ['go-vendor']
954
955 checkvars = {}
956 checkvars['GO_IMPORT'] = "github.com/OpenAPITools/openapi-generator/samples/openapi3/client/petstore/go"
957 checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https',
958 'file://modules.txt'}
959
960 self.assertNotIn('Traceback', result.output)
961 self.assertIn('No license file was detected for the main module', result.output)
962 self.assertTrue(os.path.isfile(recipefile))
963 self._test_recipe_contents(recipefile, checkvars, inherits)
964
965 # make sure that dependencies don't mention local directory ./go-petstore
966 dependencies = \
967 [ ('github.com/stretchr/testify','v1.8.4', '', '', ''),
968 ('go.googlesource.com/oauth2','v0.10.0','golang.org/x/oauth2', '', ''),
969 ('github.com/davecgh/go-spew','v1.1.1', '', '', ''),
970 ('github.com/golang/protobuf','v1.5.3', '', '', ''),
971 ('github.com/kr/pretty','v0.3.0', '', '', ''),
972 ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''),
973 ('github.com/rogpeppe/go-internal','v1.9.0', '', '', ''),
974 ('go.googlesource.com/net','v0.12.0','golang.org/x/net', '', ''),
975 ('github.com/golang/appengine','v1.6.7','google.golang.org/appengine', '', ''),
976 ('go.googlesource.com/protobuf','v1.31.0','google.golang.org/protobuf', '', ''),
977 ('gopkg.in/check.v1','v1.0.0-20201130134442-10cb98267c6c', '', '', ''),
978 ('gopkg.in/yaml.v3','v3.0.1', '', '', ''),
979 ]
980
981 src_uri = set()
982 for d in dependencies:
983 src_uri.add(self._go_urifiy(*d))
984
985 checkvars = {} 794 checkvars = {}
986 checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri 795 checkvars['SRC_URI'] = {'gomod://github.com/godbus/dbus/v5;version=v5.1.0;sha256sum=03dfa8e71089a6f477310d15c4d3a036d82d028532881b50fee254358e782ad9'}
987
988 self.assertTrue(os.path.isfile(deps_require_file))
989 self._test_recipe_contents(deps_require_file, checkvars, []) 796 self._test_recipe_contents(deps_require_file, checkvars, [])
990 797
991class RecipetoolTests(RecipetoolBase): 798class RecipetoolTests(RecipetoolBase):
@@ -1068,6 +875,7 @@ class RecipetoolTests(RecipetoolBase):
1068 875
1069 d = DataConnectorCopy 876 d = DataConnectorCopy
1070 d.getVar = Mock(return_value=commonlicdir) 877 d.getVar = Mock(return_value=commonlicdir)
878 d.expand = Mock(side_effect=lambda x: x)
1071 879
1072 srctree = tempfile.mkdtemp(prefix='recipetoolqa') 880 srctree = tempfile.mkdtemp(prefix='recipetoolqa')
1073 self.track_for_cleanup(srctree) 881 self.track_for_cleanup(srctree)
@@ -1323,10 +1131,10 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
1323 1131
1324 def test_recipetool_appendsrcfile_srcdir_basic(self): 1132 def test_recipetool_appendsrcfile_srcdir_basic(self):
1325 testrecipe = 'bash' 1133 testrecipe = 'bash'
1326 bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) 1134 bb_vars = get_bb_vars(['S', 'UNPACKDIR'], testrecipe)
1327 srcdir = bb_vars['S'] 1135 srcdir = bb_vars['S']
1328 workdir = bb_vars['WORKDIR'] 1136 unpackdir = bb_vars['UNPACKDIR']
1329 subdir = os.path.relpath(srcdir, workdir) 1137 subdir = os.path.relpath(srcdir, unpackdir)
1330 self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir) 1138 self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir)
1331 1139
1332 def test_recipetool_appendsrcfile_existing_in_src_uri(self): 1140 def test_recipetool_appendsrcfile_existing_in_src_uri(self):
@@ -1375,10 +1183,10 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
1375 def test_recipetool_appendsrcfile_replace_file_srcdir(self): 1183 def test_recipetool_appendsrcfile_replace_file_srcdir(self):
1376 testrecipe = 'bash' 1184 testrecipe = 'bash'
1377 filepath = 'Makefile.in' 1185 filepath = 'Makefile.in'
1378 bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) 1186 bb_vars = get_bb_vars(['S', 'UNPACKDIR'], testrecipe)
1379 srcdir = bb_vars['S'] 1187 srcdir = bb_vars['S']
1380 workdir = bb_vars['WORKDIR'] 1188 unpackdir = bb_vars['UNPACKDIR']
1381 subdir = os.path.relpath(srcdir, workdir) 1189 subdir = os.path.relpath(srcdir, unpackdir)
1382 1190
1383 self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) 1191 self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir)
1384 bitbake('%s:do_unpack' % testrecipe) 1192 bitbake('%s:do_unpack' % testrecipe)