summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-19 18:43:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-20 11:56:37 +0000
commit9b312bca47e22cc3a93df356dcae73a8ee4a6787 (patch)
tree9cb1536a1769da68bbf1b3f8196aa463e302a6bf /bitbake/lib
parent8c9b223b1ce941aa408f0840fbd51c7ade303e9a (diff)
downloadpoky-9b312bca47e22cc3a93df356dcae73a8ee4a6787.tar.gz
bitbake: fetch2/svn: Avoid UnboundLocalError exception
The update codepath would trigger: Exception: UnboundLocalError: local variable 'svnfetchcmd' referenced before assignment Fix this so the code functions as intended in both fetch and update cases. [YOCTO #13798] (Bitbake rev: 16c4e930ff37ea6eac2ac0cb2197908ce3a1cc53) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/svn.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
index 385a6b2cf1..971a5add4a 100644
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -122,30 +122,30 @@ class Svn(FetchMethod):
122 122
123 try: 123 try:
124 if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK): 124 if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK):
125 svnupdatecmd = self._buildsvncommand(ud, d, "update") 125 svncmd = self._buildsvncommand(ud, d, "update")
126 logger.info("Update " + ud.url) 126 logger.info("Update " + ud.url)
127 # We need to attempt to run svn upgrade first in case its an older working format 127 # We need to attempt to run svn upgrade first in case its an older working format
128 try: 128 try:
129 runfetchcmd(ud.basecmd + " upgrade", d, workdir=ud.moddir) 129 runfetchcmd(ud.basecmd + " upgrade", d, workdir=ud.moddir)
130 except FetchError: 130 except FetchError:
131 pass 131 pass
132 logger.debug(1, "Running %s", svnupdatecmd) 132 logger.debug(1, "Running %s", svncmd)
133 bb.fetch2.check_network_access(d, svnupdatecmd, ud.url) 133 bb.fetch2.check_network_access(d, svncmd, ud.url)
134 runfetchcmd(svnupdatecmd, d, workdir=ud.moddir) 134 runfetchcmd(svncmd, d, workdir=ud.moddir)
135 else: 135 else:
136 svnfetchcmd = self._buildsvncommand(ud, d, "fetch") 136 svncmd = self._buildsvncommand(ud, d, "fetch")
137 logger.info("Fetch " + ud.url) 137 logger.info("Fetch " + ud.url)
138 # check out sources there 138 # check out sources there
139 bb.utils.mkdirhier(ud.pkgdir) 139 bb.utils.mkdirhier(ud.pkgdir)
140 logger.debug(1, "Running %s", svnfetchcmd) 140 logger.debug(1, "Running %s", svncmd)
141 bb.fetch2.check_network_access(d, svnfetchcmd, ud.url) 141 bb.fetch2.check_network_access(d, svncmd, ud.url)
142 runfetchcmd(svnfetchcmd, d, workdir=ud.pkgdir) 142 runfetchcmd(svncmd, d, workdir=ud.pkgdir)
143 143
144 if not ("externals" in ud.parm and ud.parm["externals"] == "nowarn"): 144 if not ("externals" in ud.parm and ud.parm["externals"] == "nowarn"):
145 # Warn the user if this had externals (won't catch them all) 145 # Warn the user if this had externals (won't catch them all)
146 output = runfetchcmd("svn propget svn:externals || true", d, workdir=ud.moddir) 146 output = runfetchcmd("svn propget svn:externals || true", d, workdir=ud.moddir)
147 if output: 147 if output:
148 if "--ignore-externals" in svnfetchcmd.split(): 148 if "--ignore-externals" in svncmd.split():
149 bb.warn("%s contains svn:externals." % ud.url) 149 bb.warn("%s contains svn:externals." % ud.url)
150 bb.warn("These should be added to the recipe SRC_URI as necessary.") 150 bb.warn("These should be added to the recipe SRC_URI as necessary.")
151 bb.warn("svn fetch has ignored externals:\n%s" % output) 151 bb.warn("svn fetch has ignored externals:\n%s" % output)