diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/recipetool.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 280 |
1 files changed, 47 insertions, 233 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index aebea42502..0bd724c8ee 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
@@ -120,9 +120,15 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
120 | self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) | 120 | self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) |
121 | 121 | ||
122 | def test_recipetool_appendfile_alternatives(self): | 122 | def test_recipetool_appendfile_alternatives(self): |
123 | lspath = '/bin/ls' | ||
124 | dirname = "base_bindir" | ||
125 | if "usrmerge" in get_bb_var('DISTRO_FEATURES'): | ||
126 | lspath = '/usr/bin/ls' | ||
127 | dirname = "bindir" | ||
128 | |||
123 | # Now try with a file we know should be an alternative | 129 | # Now try with a file we know should be an alternative |
124 | # (this is very much a fake example, but one we know is reliably an alternative) | 130 | # (this is very much a fake example, but one we know is reliably an alternative) |
125 | self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox']) | 131 | self._try_recipetool_appendfile_fail(lspath, self.testfile, ['ERROR: File %s is an alternative possibly provided by the following recipes:' % lspath, 'coreutils', 'busybox']) |
126 | # Need a test file - should be executable | 132 | # Need a test file - should be executable |
127 | testfile2 = os.path.join(self.corebase, 'oe-init-build-env') | 133 | testfile2 = os.path.join(self.corebase, 'oe-init-build-env') |
128 | testfile2name = os.path.basename(testfile2) | 134 | testfile2name = os.path.basename(testfile2) |
@@ -131,12 +137,12 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
131 | 'SRC_URI += "file://%s"\n' % testfile2name, | 137 | 'SRC_URI += "file://%s"\n' % testfile2name, |
132 | '\n', | 138 | '\n', |
133 | 'do_install:append() {\n', | 139 | 'do_install:append() {\n', |
134 | ' install -d ${D}${base_bindir}\n', | 140 | ' install -d ${D}${%s}\n' % dirname, |
135 | ' install -m 0755 ${WORKDIR}/%s ${D}${base_bindir}/ls\n' % testfile2name, | 141 | ' install -m 0755 ${UNPACKDIR}/%s ${D}${%s}/ls\n' % (testfile2name, dirname), |
136 | '}\n'] | 142 | '}\n'] |
137 | self._try_recipetool_appendfile('coreutils', '/bin/ls', testfile2, '-r coreutils', expectedlines, [testfile2name]) | 143 | self._try_recipetool_appendfile('coreutils', lspath, testfile2, '-r coreutils', expectedlines, [testfile2name]) |
138 | # Now try bbappending the same file again, contents should not change | 144 | # Now try bbappending the same file again, contents should not change |
139 | bbappendfile, _ = self._try_recipetool_appendfile('coreutils', '/bin/ls', self.testfile, '-r coreutils', expectedlines, [testfile2name]) | 145 | bbappendfile, _ = self._try_recipetool_appendfile('coreutils', lspath, self.testfile, '-r coreutils', expectedlines, [testfile2name]) |
140 | # But file should have | 146 | # But file should have |
141 | copiedfile = os.path.join(os.path.dirname(bbappendfile), 'coreutils', testfile2name) | 147 | copiedfile = os.path.join(os.path.dirname(bbappendfile), 'coreutils', testfile2name) |
142 | result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) | 148 | result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) |
@@ -158,7 +164,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
158 | '\n', | 164 | '\n', |
159 | 'do_install:append() {\n', | 165 | 'do_install:append() {\n', |
160 | ' install -d ${D}${datadir}\n', | 166 | ' install -d ${D}${datadir}\n', |
161 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', | 167 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n', |
162 | '}\n'] | 168 | '}\n'] |
163 | 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']) |
164 | # 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 |
@@ -173,8 +179,8 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
173 | '\n', | 179 | '\n', |
174 | 'do_install:append() {\n', | 180 | 'do_install:append() {\n', |
175 | ' install -d ${D}${datadir}\n', | 181 | ' install -d ${D}${datadir}\n', |
176 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', | 182 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n', |
177 | ' install -m 0755 ${WORKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name, | 183 | ' install -m 0755 ${UNPACKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name, |
178 | '}\n'] | 184 | '}\n'] |
179 | 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]) |
180 | 186 | ||
@@ -186,7 +192,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
186 | '\n', | 192 | '\n', |
187 | 'do_install:append() {\n', | 193 | 'do_install:append() {\n', |
188 | ' install -d ${D}${bindir}\n', | 194 | ' install -d ${D}${bindir}\n', |
189 | ' install -m 0755 ${WORKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n', | 195 | ' install -m 0755 ${UNPACKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n', |
190 | '}\n'] | 196 | '}\n'] |
191 | _, 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']) |
192 | self.assertNotIn('WARNING: ', output) | 198 | self.assertNotIn('WARNING: ', output) |
@@ -201,7 +207,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
201 | '\n', | 207 | '\n', |
202 | 'do_install:append:mymachine() {\n', | 208 | 'do_install:append:mymachine() {\n', |
203 | ' install -d ${D}${datadir}\n', | 209 | ' install -d ${D}${datadir}\n', |
204 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', | 210 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n', |
205 | '}\n'] | 211 | '}\n'] |
206 | _, 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']) |
207 | self.assertNotIn('WARNING: ', output) | 213 | self.assertNotIn('WARNING: ', output) |
@@ -235,7 +241,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
235 | '\n', | 241 | '\n', |
236 | 'do_install:append() {\n', | 242 | 'do_install:append() {\n', |
237 | ' install -d ${D}${datadir}\n', | 243 | ' install -d ${D}${datadir}\n', |
238 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-subdir\n', | 244 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-subdir\n', |
239 | '}\n'] | 245 | '}\n'] |
240 | _, 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']) |
241 | self.assertNotIn('WARNING: ', output) | 247 | self.assertNotIn('WARNING: ', output) |
@@ -262,7 +268,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
262 | '\n', | 268 | '\n', |
263 | 'do_install:append() {\n', | 269 | 'do_install:append() {\n', |
264 | ' install -d ${D}${sysconfdir}\n', | 270 | ' install -d ${D}${sysconfdir}\n', |
265 | ' install -m 0644 ${WORKDIR}/testfile ${D}${sysconfdir}/selftest-replaceme-patched\n', | 271 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${sysconfdir}/selftest-replaceme-patched\n', |
266 | '}\n'] | 272 | '}\n'] |
267 | _, 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']) |
268 | for line in output.splitlines(): | 274 | for line in output.splitlines(): |
@@ -280,7 +286,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
280 | '\n', | 286 | '\n', |
281 | 'do_install:append() {\n', | 287 | 'do_install:append() {\n', |
282 | ' install -d ${D}${datadir}\n', | 288 | ' install -d ${D}${datadir}\n', |
283 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-scripted\n', | 289 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-scripted\n', |
284 | '}\n'] | 290 | '}\n'] |
285 | _, 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']) |
286 | self.assertNotIn('WARNING: ', output) | 292 | self.assertNotIn('WARNING: ', output) |
@@ -303,7 +309,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
303 | '\n', | 309 | '\n', |
304 | 'do_install:append() {\n', | 310 | 'do_install:append() {\n', |
305 | ' install -d ${D}${datadir}\n', | 311 | ' install -d ${D}${datadir}\n', |
306 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-postinst\n', | 312 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-postinst\n', |
307 | '}\n'] | 313 | '}\n'] |
308 | _, 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']) |
309 | 315 | ||
@@ -379,7 +385,7 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
379 | checkvars = {} | 385 | checkvars = {} |
380 | checkvars['LICENSE'] = 'LGPL-2.1-only' | 386 | checkvars['LICENSE'] = 'LGPL-2.1-only' |
381 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' | 387 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' |
382 | checkvars['S'] = '${WORKDIR}/git' | 388 | checkvars['S'] = None |
383 | checkvars['PV'] = '1.11+git' | 389 | checkvars['PV'] = '1.11+git' |
384 | checkvars['SRC_URI'] = srcuri + ';branch=master' | 390 | checkvars['SRC_URI'] = srcuri + ';branch=master' |
385 | checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango']) | 391 | checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango']) |
@@ -751,235 +757,42 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
751 | 757 | ||
752 | def test_recipetool_create_go(self): | 758 | def test_recipetool_create_go(self): |
753 | # Basic test to check go recipe generation | 759 | # Basic test to check go recipe generation |
760 | self.maxDiff = None | ||
761 | |||
754 | temprecipe = os.path.join(self.tempdir, 'recipe') | 762 | temprecipe = os.path.join(self.tempdir, 'recipe') |
755 | os.makedirs(temprecipe) | 763 | os.makedirs(temprecipe) |
756 | 764 | ||
757 | recipefile = os.path.join(temprecipe, 'edgex-go_git.bb') | 765 | recipefile = os.path.join(temprecipe, 'recipetool-go-test_git.bb') |
758 | deps_require_file = os.path.join(temprecipe, 'edgex-go', 'edgex-go-modules.inc') | ||
759 | lics_require_file = os.path.join(temprecipe, 'edgex-go', 'edgex-go-licenses.inc') | ||
760 | modules_txt_file = os.path.join(temprecipe, 'edgex-go', 'modules.txt') | ||
761 | 766 | ||
762 | srcuri = 'https://github.com/edgexfoundry/edgex-go.git' | 767 | srcuri = 'https://git.yoctoproject.org/recipetool-go-test.git' |
763 | srcrev = "v3.0.0" | 768 | srcrev = "c3e213c01b6c1406b430df03ef0d1ae77de5d2f7" |
764 | srcbranch = "main" | 769 | srcbranch = "main" |
765 | 770 | ||
766 | 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)) |
767 | 772 | ||
768 | self.maxDiff = None | 773 | inherits = ['go-mod', 'go-mod-update-modules'] |
769 | inherits = ['go-vendor'] | ||
770 | 774 | ||
771 | checkvars = {} | 775 | checkvars = {} |
772 | checkvars['GO_IMPORT'] = "github.com/edgexfoundry/edgex-go" | 776 | checkvars['GO_IMPORT'] = "git.yoctoproject.org/recipetool-go-test" |
773 | 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}'} |
774 | 'file://modules.txt'} | 778 | checkvars['LIC_FILES_CHKSUM'] = { |
775 | 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 | } | ||
776 | 782 | ||
777 | self.assertTrue(os.path.isfile(recipefile)) | ||
778 | self._test_recipe_contents(recipefile, checkvars, inherits) | 783 | self._test_recipe_contents(recipefile, checkvars, inherits) |
784 | self.assertNotIn('Traceback', result.output) | ||
779 | 785 | ||
786 | lics_require_file = os.path.join(temprecipe, 'recipetool-go-test-licenses.inc') | ||
787 | self.assertFileExists(lics_require_file) | ||
780 | checkvars = {} | 788 | checkvars = {} |
781 | 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'} |
782 | ['file://src/${GO_IMPORT}/vendor/github.com/Microsoft/go-winio/LICENSE;md5=69205ff73858f2c22b2ca135b557e8ef', | ||
783 | 'file://src/${GO_IMPORT}/vendor/github.com/armon/go-metrics/LICENSE;md5=d2d77030c0183e3d1e66d26dc1f243be', | ||
784 | 'file://src/${GO_IMPORT}/vendor/github.com/cenkalti/backoff/LICENSE;md5=1571d94433e3f3aa05267efd4dbea68b', | ||
785 | 'file://src/${GO_IMPORT}/vendor/github.com/davecgh/go-spew/LICENSE;md5=c06795ed54b2a35ebeeb543cd3a73e56', | ||
786 | 'file://src/${GO_IMPORT}/vendor/github.com/eclipse/paho.mqtt.golang/LICENSE;md5=dcdb33474b60c38efd27356d8f2edec7', | ||
787 | 'file://src/${GO_IMPORT}/vendor/github.com/eclipse/paho.mqtt.golang/edl-v10;md5=3adfcc70f5aeb7a44f3f9b495aa1fbf3', | ||
788 | 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-bootstrap/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff', | ||
789 | 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-configuration/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff', | ||
790 | 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-core-contracts/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff', | ||
791 | 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-messaging/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff', | ||
792 | 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-registry/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff', | ||
793 | 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-secrets/v3/LICENSE;md5=f9fa2f4f8e0ef8cc7b5dd150963eb457', | ||
794 | 'file://src/${GO_IMPORT}/vendor/github.com/fatih/color/LICENSE.md;md5=316e6d590bdcde7993fb175662c0dd5a', | ||
795 | 'file://src/${GO_IMPORT}/vendor/github.com/fxamacker/cbor/v2/LICENSE;md5=827f5a2fa861382d35a3943adf9ebb86', | ||
796 | 'file://src/${GO_IMPORT}/vendor/github.com/go-jose/go-jose/v3/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57', | ||
797 | 'file://src/${GO_IMPORT}/vendor/github.com/go-jose/go-jose/v3/json/LICENSE;md5=591778525c869cdde0ab5a1bf283cd81', | ||
798 | 'file://src/${GO_IMPORT}/vendor/github.com/go-kit/log/LICENSE;md5=5b7c15ad5fffe2ff6e9d58a6c161f082', | ||
799 | 'file://src/${GO_IMPORT}/vendor/github.com/go-logfmt/logfmt/LICENSE;md5=98e39517c38127f969de33057067091e', | ||
800 | 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/locales/LICENSE;md5=3ccbda375ee345400ad1da85ba522301', | ||
801 | 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/universal-translator/LICENSE;md5=2e2b21ef8f61057977d27c727c84bef1', | ||
802 | 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/validator/v10/LICENSE;md5=a718a0f318d76f7c5d510cbae84f0b60', | ||
803 | 'file://src/${GO_IMPORT}/vendor/github.com/go-redis/redis/v7/LICENSE;md5=58103aa5ea1ee9b7a369c9c4a95ef9b5', | ||
804 | 'file://src/${GO_IMPORT}/vendor/github.com/golang/protobuf/LICENSE;md5=939cce1ec101726fa754e698ac871622', | ||
805 | 'file://src/${GO_IMPORT}/vendor/github.com/gomodule/redigo/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93', | ||
806 | 'file://src/${GO_IMPORT}/vendor/github.com/google/uuid/LICENSE;md5=88073b6dd8ec00fe09da59e0b6dfded1', | ||
807 | 'file://src/${GO_IMPORT}/vendor/github.com/gorilla/mux/LICENSE;md5=33fa1116c45f9e8de714033f99edde13', | ||
808 | 'file://src/${GO_IMPORT}/vendor/github.com/gorilla/websocket/LICENSE;md5=c007b54a1743d596f46b2748d9f8c044', | ||
809 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/consul/api/LICENSE;md5=b8a277a612171b7526e9be072f405ef4', | ||
810 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/errwrap/LICENSE;md5=b278a92d2c1509760384428817710378', | ||
811 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-cleanhttp/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea', | ||
812 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-hclog/LICENSE;md5=ec7f605b74b9ad03347d0a93a5cc7eb8', | ||
813 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-immutable-radix/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea', | ||
814 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-multierror/LICENSE;md5=d44fdeb607e2d2614db9464dbedd4094', | ||
815 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-rootcerts/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea', | ||
816 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/golang-lru/LICENSE;md5=f27a50d2e878867827842f2c60e30bfc', | ||
817 | 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/serf/LICENSE;md5=b278a92d2c1509760384428817710378', | ||
818 | 'file://src/${GO_IMPORT}/vendor/github.com/leodido/go-urn/LICENSE;md5=8f50db5538ec1148a9b3d14ed96c3418', | ||
819 | 'file://src/${GO_IMPORT}/vendor/github.com/mattn/go-colorable/LICENSE;md5=24ce168f90aec2456a73de1839037245', | ||
820 | 'file://src/${GO_IMPORT}/vendor/github.com/mattn/go-isatty/LICENSE;md5=f509beadd5a11227c27b5d2ad6c9f2c6', | ||
821 | 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/consulstructure/LICENSE;md5=96ada10a9e51c98c4656f2cede08c673', | ||
822 | 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/copystructure/LICENSE;md5=56da355a12d4821cda57b8f23ec34bc4', | ||
823 | 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/go-homedir/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd', | ||
824 | 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/mapstructure/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd', | ||
825 | 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/reflectwalk/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd', | ||
826 | 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nats.go/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327', | ||
827 | 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nkeys/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327', | ||
828 | 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nuid/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327', | ||
829 | 'file://src/${GO_IMPORT}/vendor/github.com/pmezard/go-difflib/LICENSE;md5=e9a2ebb8de779a07500ddecca806145e', | ||
830 | 'file://src/${GO_IMPORT}/vendor/github.com/rcrowley/go-metrics/LICENSE;md5=1bdf5d819f50f141366dabce3be1460f', | ||
831 | 'file://src/${GO_IMPORT}/vendor/github.com/spiffe/go-spiffe/v2/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327', | ||
832 | 'file://src/${GO_IMPORT}/vendor/github.com/stretchr/objx/LICENSE;md5=d023fd31d3ca39ec61eec65a91732735', | ||
833 | 'file://src/${GO_IMPORT}/vendor/github.com/stretchr/testify/LICENSE;md5=188f01994659f3c0d310612333d2a26f', | ||
834 | 'file://src/${GO_IMPORT}/vendor/github.com/x448/float16/LICENSE;md5=de8f8e025d57fe7ee0b67f30d571323b', | ||
835 | 'file://src/${GO_IMPORT}/vendor/github.com/zeebo/errs/LICENSE;md5=84914ab36fc0eb48edbaa53e66e8d326', | ||
836 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/crypto/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
837 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/mod/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
838 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/net/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
839 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/sync/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
840 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/sys/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
841 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/text/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
842 | 'file://src/${GO_IMPORT}/vendor/golang.org/x/tools/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707', | ||
843 | 'file://src/${GO_IMPORT}/vendor/google.golang.org/genproto/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57', | ||
844 | 'file://src/${GO_IMPORT}/vendor/google.golang.org/grpc/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57', | ||
845 | 'file://src/${GO_IMPORT}/vendor/google.golang.org/protobuf/LICENSE;md5=02d4002e9171d41a8fad93aa7faf3956', | ||
846 | 'file://src/${GO_IMPORT}/vendor/gopkg.in/eapache/queue.v1/LICENSE;md5=1bfd4408d3de090ef6b908b0cc45a316', | ||
847 | 'file://src/${GO_IMPORT}/vendor/gopkg.in/yaml.v3/LICENSE;md5=3c91c17266710e16afdbb2b6d15c761c']) | ||
848 | |||
849 | self.assertTrue(os.path.isfile(lics_require_file)) | ||
850 | self._test_recipe_contents(lics_require_file, checkvars, []) | 790 | self._test_recipe_contents(lics_require_file, checkvars, []) |
851 | 791 | ||
852 | dependencies = \ | 792 | deps_require_file = os.path.join(temprecipe, 'recipetool-go-test-go-mods.inc') |
853 | [ ('github.com/eclipse/paho.mqtt.golang','v1.4.2', '', '', ''), | 793 | self.assertFileExists(deps_require_file) |
854 | ('github.com/edgexfoundry/go-mod-bootstrap','v3.0.1','github.com/edgexfoundry/go-mod-bootstrap/v3','/v3', ''), | ||
855 | ('github.com/edgexfoundry/go-mod-configuration','v3.0.0','github.com/edgexfoundry/go-mod-configuration/v3','/v3', ''), | ||
856 | ('github.com/edgexfoundry/go-mod-core-contracts','v3.0.0','github.com/edgexfoundry/go-mod-core-contracts/v3','/v3', ''), | ||
857 | ('github.com/edgexfoundry/go-mod-messaging','v3.0.0','github.com/edgexfoundry/go-mod-messaging/v3','/v3', ''), | ||
858 | ('github.com/edgexfoundry/go-mod-secrets','v3.0.1','github.com/edgexfoundry/go-mod-secrets/v3','/v3', ''), | ||
859 | ('github.com/fxamacker/cbor','v2.4.0','github.com/fxamacker/cbor/v2','/v2', ''), | ||
860 | ('github.com/gomodule/redigo','v1.8.9', '', '', ''), | ||
861 | ('github.com/google/uuid','v1.3.0', '', '', ''), | ||
862 | ('github.com/gorilla/mux','v1.8.0', '', '', ''), | ||
863 | ('github.com/rcrowley/go-metrics','v0.0.0-20201227073835-cf1acfcdf475', '', '', ''), | ||
864 | ('github.com/spiffe/go-spiffe','v2.1.4','github.com/spiffe/go-spiffe/v2','/v2', ''), | ||
865 | ('github.com/stretchr/testify','v1.8.2', '', '', ''), | ||
866 | ('go.googlesource.com/crypto','v0.8.0','golang.org/x/crypto', '', ''), | ||
867 | ('gopkg.in/eapache/queue.v1','v1.1.0', '', '', ''), | ||
868 | ('gopkg.in/yaml.v3','v3.0.1', '', '', ''), | ||
869 | ('github.com/microsoft/go-winio','v0.6.0','github.com/Microsoft/go-winio', '', ''), | ||
870 | ('github.com/hashicorp/go-metrics','v0.3.10','github.com/armon/go-metrics', '', ''), | ||
871 | ('github.com/cenkalti/backoff','v2.2.1+incompatible', '', '', ''), | ||
872 | ('github.com/davecgh/go-spew','v1.1.1', '', '', ''), | ||
873 | ('github.com/edgexfoundry/go-mod-registry','v3.0.0','github.com/edgexfoundry/go-mod-registry/v3','/v3', ''), | ||
874 | ('github.com/fatih/color','v1.9.0', '', '', ''), | ||
875 | ('github.com/go-jose/go-jose','v3.0.0','github.com/go-jose/go-jose/v3','/v3', ''), | ||
876 | ('github.com/go-kit/log','v0.2.1', '', '', ''), | ||
877 | ('github.com/go-logfmt/logfmt','v0.5.1', '', '', ''), | ||
878 | ('github.com/go-playground/locales','v0.14.1', '', '', ''), | ||
879 | ('github.com/go-playground/universal-translator','v0.18.1', '', '', ''), | ||
880 | ('github.com/go-playground/validator','v10.13.0','github.com/go-playground/validator/v10','/v10', ''), | ||
881 | ('github.com/go-redis/redis','v7.3.0','github.com/go-redis/redis/v7','/v7', ''), | ||
882 | ('github.com/golang/protobuf','v1.5.2', '', '', ''), | ||
883 | ('github.com/gorilla/websocket','v1.4.2', '', '', ''), | ||
884 | ('github.com/hashicorp/consul','v1.20.0','github.com/hashicorp/consul/api', '', 'api'), | ||
885 | ('github.com/hashicorp/errwrap','v1.0.0', '', '', ''), | ||
886 | ('github.com/hashicorp/go-cleanhttp','v0.5.1', '', '', ''), | ||
887 | ('github.com/hashicorp/go-hclog','v0.14.1', '', '', ''), | ||
888 | ('github.com/hashicorp/go-immutable-radix','v1.3.0', '', '', ''), | ||
889 | ('github.com/hashicorp/go-multierror','v1.1.1', '', '', ''), | ||
890 | ('github.com/hashicorp/go-rootcerts','v1.0.2', '', '', ''), | ||
891 | ('github.com/hashicorp/golang-lru','v0.5.4', '', '', ''), | ||
892 | ('github.com/hashicorp/serf','v0.10.1', '', '', ''), | ||
893 | ('github.com/leodido/go-urn','v1.2.3', '', '', ''), | ||
894 | ('github.com/mattn/go-colorable','v0.1.12', '', '', ''), | ||
895 | ('github.com/mattn/go-isatty','v0.0.14', '', '', ''), | ||
896 | ('github.com/mitchellh/consulstructure','v0.0.0-20190329231841-56fdc4d2da54', '', '', ''), | ||
897 | ('github.com/mitchellh/copystructure','v1.2.0', '', '', ''), | ||
898 | ('github.com/mitchellh/go-homedir','v1.1.0', '', '', ''), | ||
899 | ('github.com/mitchellh/mapstructure','v1.5.0', '', '', ''), | ||
900 | ('github.com/mitchellh/reflectwalk','v1.0.2', '', '', ''), | ||
901 | ('github.com/nats-io/nats.go','v1.25.0', '', '', ''), | ||
902 | ('github.com/nats-io/nkeys','v0.4.4', '', '', ''), | ||
903 | ('github.com/nats-io/nuid','v1.0.1', '', '', ''), | ||
904 | ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''), | ||
905 | ('github.com/stretchr/objx','v0.5.0', '', '', ''), | ||
906 | ('github.com/x448/float16','v0.8.4', '', '', ''), | ||
907 | ('github.com/zeebo/errs','v1.3.0', '', '', ''), | ||
908 | ('go.googlesource.com/mod','v0.8.0','golang.org/x/mod', '', ''), | ||
909 | ('go.googlesource.com/net','v0.9.0','golang.org/x/net', '', ''), | ||
910 | ('go.googlesource.com/sync','v0.1.0','golang.org/x/sync', '', ''), | ||
911 | ('go.googlesource.com/sys','v0.7.0','golang.org/x/sys', '', ''), | ||
912 | ('go.googlesource.com/text','v0.9.0','golang.org/x/text', '', ''), | ||
913 | ('go.googlesource.com/tools','v0.6.0','golang.org/x/tools', '', ''), | ||
914 | ('github.com/googleapis/go-genproto','v0.0.0-20230223222841-637eb2293923','google.golang.org/genproto', '', ''), | ||
915 | ('github.com/grpc/grpc-go','v1.53.0','google.golang.org/grpc', '', ''), | ||
916 | ('go.googlesource.com/protobuf','v1.28.1','google.golang.org/protobuf', '', ''), | ||
917 | ] | ||
918 | |||
919 | src_uri = set() | ||
920 | for d in dependencies: | ||
921 | src_uri.add(self._go_urifiy(*d)) | ||
922 | |||
923 | checkvars = {} | 794 | checkvars = {} |
924 | checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri | 795 | checkvars['SRC_URI'] = {'gomod://github.com/godbus/dbus/v5;version=v5.1.0;sha256sum=03dfa8e71089a6f477310d15c4d3a036d82d028532881b50fee254358e782ad9'} |
925 | |||
926 | self.assertTrue(os.path.isfile(deps_require_file)) | ||
927 | self._test_recipe_contents(deps_require_file, checkvars, []) | ||
928 | |||
929 | def test_recipetool_create_go_replace_modules(self): | ||
930 | # Check handling of replaced modules | ||
931 | temprecipe = os.path.join(self.tempdir, 'recipe') | ||
932 | os.makedirs(temprecipe) | ||
933 | |||
934 | recipefile = os.path.join(temprecipe, 'openapi-generator_git.bb') | ||
935 | deps_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-modules.inc') | ||
936 | lics_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-licenses.inc') | ||
937 | modules_txt_file = os.path.join(temprecipe, 'openapi-generator', 'modules.txt') | ||
938 | |||
939 | srcuri = 'https://github.com/OpenAPITools/openapi-generator.git' | ||
940 | srcrev = "v7.2.0" | ||
941 | srcbranch = "master" | ||
942 | srcsubdir = "samples/openapi3/client/petstore/go" | ||
943 | |||
944 | result = runCmd('recipetool create -o %s %s -S %s -B %s --src-subdir %s' % (temprecipe, srcuri, srcrev, srcbranch, srcsubdir)) | ||
945 | |||
946 | self.maxDiff = None | ||
947 | inherits = ['go-vendor'] | ||
948 | |||
949 | checkvars = {} | ||
950 | checkvars['GO_IMPORT'] = "github.com/OpenAPITools/openapi-generator/samples/openapi3/client/petstore/go" | ||
951 | checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https', | ||
952 | 'file://modules.txt'} | ||
953 | |||
954 | self.assertNotIn('Traceback', result.output) | ||
955 | self.assertIn('No license file was detected for the main module', result.output) | ||
956 | self.assertTrue(os.path.isfile(recipefile)) | ||
957 | self._test_recipe_contents(recipefile, checkvars, inherits) | ||
958 | |||
959 | # make sure that dependencies don't mention local directory ./go-petstore | ||
960 | dependencies = \ | ||
961 | [ ('github.com/stretchr/testify','v1.8.4', '', '', ''), | ||
962 | ('go.googlesource.com/oauth2','v0.10.0','golang.org/x/oauth2', '', ''), | ||
963 | ('github.com/davecgh/go-spew','v1.1.1', '', '', ''), | ||
964 | ('github.com/golang/protobuf','v1.5.3', '', '', ''), | ||
965 | ('github.com/kr/pretty','v0.3.0', '', '', ''), | ||
966 | ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''), | ||
967 | ('github.com/rogpeppe/go-internal','v1.9.0', '', '', ''), | ||
968 | ('go.googlesource.com/net','v0.12.0','golang.org/x/net', '', ''), | ||
969 | ('github.com/golang/appengine','v1.6.7','google.golang.org/appengine', '', ''), | ||
970 | ('go.googlesource.com/protobuf','v1.31.0','google.golang.org/protobuf', '', ''), | ||
971 | ('gopkg.in/check.v1','v1.0.0-20201130134442-10cb98267c6c', '', '', ''), | ||
972 | ('gopkg.in/yaml.v3','v3.0.1', '', '', ''), | ||
973 | ] | ||
974 | |||
975 | src_uri = set() | ||
976 | for d in dependencies: | ||
977 | src_uri.add(self._go_urifiy(*d)) | ||
978 | |||
979 | checkvars = {} | ||
980 | checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri | ||
981 | |||
982 | self.assertTrue(os.path.isfile(deps_require_file)) | ||
983 | self._test_recipe_contents(deps_require_file, checkvars, []) | 796 | self._test_recipe_contents(deps_require_file, checkvars, []) |
984 | 797 | ||
985 | class RecipetoolTests(RecipetoolBase): | 798 | class RecipetoolTests(RecipetoolBase): |
@@ -1062,6 +875,7 @@ class RecipetoolTests(RecipetoolBase): | |||
1062 | 875 | ||
1063 | d = DataConnectorCopy | 876 | d = DataConnectorCopy |
1064 | d.getVar = Mock(return_value=commonlicdir) | 877 | d.getVar = Mock(return_value=commonlicdir) |
878 | d.expand = Mock(side_effect=lambda x: x) | ||
1065 | 879 | ||
1066 | srctree = tempfile.mkdtemp(prefix='recipetoolqa') | 880 | srctree = tempfile.mkdtemp(prefix='recipetoolqa') |
1067 | self.track_for_cleanup(srctree) | 881 | self.track_for_cleanup(srctree) |
@@ -1317,10 +1131,10 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): | |||
1317 | 1131 | ||
1318 | def test_recipetool_appendsrcfile_srcdir_basic(self): | 1132 | def test_recipetool_appendsrcfile_srcdir_basic(self): |
1319 | testrecipe = 'bash' | 1133 | testrecipe = 'bash' |
1320 | bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) | 1134 | bb_vars = get_bb_vars(['S', 'UNPACKDIR'], testrecipe) |
1321 | srcdir = bb_vars['S'] | 1135 | srcdir = bb_vars['S'] |
1322 | workdir = bb_vars['WORKDIR'] | 1136 | unpackdir = bb_vars['UNPACKDIR'] |
1323 | subdir = os.path.relpath(srcdir, workdir) | 1137 | subdir = os.path.relpath(srcdir, unpackdir) |
1324 | self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir) | 1138 | self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir) |
1325 | 1139 | ||
1326 | def test_recipetool_appendsrcfile_existing_in_src_uri(self): | 1140 | def test_recipetool_appendsrcfile_existing_in_src_uri(self): |
@@ -1369,10 +1183,10 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): | |||
1369 | def test_recipetool_appendsrcfile_replace_file_srcdir(self): | 1183 | def test_recipetool_appendsrcfile_replace_file_srcdir(self): |
1370 | testrecipe = 'bash' | 1184 | testrecipe = 'bash' |
1371 | filepath = 'Makefile.in' | 1185 | filepath = 'Makefile.in' |
1372 | bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) | 1186 | bb_vars = get_bb_vars(['S', 'UNPACKDIR'], testrecipe) |
1373 | srcdir = bb_vars['S'] | 1187 | srcdir = bb_vars['S'] |
1374 | workdir = bb_vars['WORKDIR'] | 1188 | unpackdir = bb_vars['UNPACKDIR'] |
1375 | subdir = os.path.relpath(srcdir, workdir) | 1189 | subdir = os.path.relpath(srcdir, unpackdir) |
1376 | 1190 | ||
1377 | self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) | 1191 | self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) |
1378 | bitbake('%s:do_unpack' % testrecipe) | 1192 | bitbake('%s:do_unpack' % testrecipe) |