Skip to contentSkip to conversation

Remove unused variables and imports from package.bbclass

PATCH In review Ulf Magnusson 2 participants 3 messages Oct 26, 2016 – Oct 31, 2016

lore
Share & tools
lore
#0 lore raw

v2 cover Remove unused variables and imports from package.bbclass

Changes since v1:

Remove accidentally omitted 's' variable too.

Ulf Magnusson (1):
package.bbclass: Remove unused variables and imports

 meta/classes/package.bbclass | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 package.bbclass: Remove unused variables and imports

Probably leftovers. Verified with a full core-image-sato build. For imports, I tried to find helper functions that might use an import from the parent function as well.

---
 meta/classes/package.bbclass | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
meta/classes/package.bbclass +1 -12
index a6f0a7a..3d5b981 100644
@@ -335,7 +335,6 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
 
     import stat
 
-    dvar = d.getVar('PKGD', True)
     objcopy = d.getVar("OBJCOPY", True)
     debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit")
 
@@ -378,14 +377,9 @@ def copydebugsources(debugsrcdir, d):
     # The debug src information written out to sourcefile is further procecessed
     # and copied to the destination here.
 
-    import stat
-
     sourcefile = d.expand("${WORKDIR}/debugsources.list")
     if debugsrcdir and os.path.isfile(sourcefile):
         dvar = d.getVar('PKGD', True)
-        strip = d.getVar("STRIP", True)
-        objcopy = d.getVar("OBJCOPY", True)
-        debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit")
         workdir = d.getVar("WORKDIR", True)
         workparentdir = os.path.dirname(os.path.dirname(workdir))
         workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
@@ -489,7 +483,6 @@ def runtime_mapping_rename (varname, pkg, d):
 
 python package_get_auto_pr() {
     import oe.prservice
-    import re
 
     # Support per recipe PRSERV_HOST
     pn = d.getVar('PN', True)
@@ -1024,7 +1017,7 @@ python split_and_strip_files () {
             fpath = dvar + dest
             # Skip it if the target doesn't exist
             try:
-                s = os.stat(fpath)
+                os.stat(fpath)
             except OSError as e:
                 (err, strerror) = e.args
                 if err != errno.ENOENT:
@@ -1073,8 +1066,6 @@ python split_and_strip_files () {
 }
 
 python populate_packages () {
-    import glob, re
-
     workdir = d.getVar('WORKDIR', True)
     outdir = d.getVar('DEPLOY_DIR', True)
     dvar = d.getVar('PKGD', True)
@@ -1219,7 +1210,6 @@ python populate_packages () {
 populate_packages[dirs] = "${D}"
 
 python package_fixsymlinks () {
-    import errno
     pkgdest = d.getVar('PKGDEST', True)
     packages = d.getVar("PACKAGES", False).split()
 
@@ -1630,7 +1620,6 @@ python package_do_shlibs() {
         sonames = list()
         renames = list()
         for file in pkgfiles[pkg]:
-                soname = None
                 if cpath.islink(file):
                     continue
                 if targetos == "darwin" or targetos == "darwin8":
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v2 1/1] package.bbclass: Remove unused variables and imports

meta/classes/package.bbclass python split_and_strip_files () { · line 1023

Quoted 8 lines · Ulf Magnusson

# Skip it if the target doesn't exist try:

meta/classes/package.bbclass +1 -1
-                s = os.stat(fpath)
+                os.stat(fpath)
             except OSError as e:
                 (err, strerror) = e.args
                 if err != errno.ENOENT:

Urgh, why not just use os.path.lexists()... Can you change the code to do
that?

Ross