diff options
| -rwxr-xr-x | contrib/oe-stylize.py | 35 | ||||
| -rw-r--r-- | meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py index 9d95911ae6..cfabb90b10 100755 --- a/contrib/oe-stylize.py +++ b/contrib/oe-stylize.py | |||
| @@ -221,41 +221,59 @@ for v in OE_vars: | |||
| 221 | # _Format guideline #0_: | 221 | # _Format guideline #0_: |
| 222 | # No spaces are allowed at the beginning of lines that define a variable or | 222 | # No spaces are allowed at the beginning of lines that define a variable or |
| 223 | # a do_ routine | 223 | # a do_ routine |
| 224 | |||
| 225 | |||
| 224 | def respect_rule0(line): | 226 | def respect_rule0(line): |
| 225 | return line.lstrip() == line | 227 | return line.lstrip() == line |
| 228 | |||
| 229 | |||
| 226 | def conformTo_rule0(line): | 230 | def conformTo_rule0(line): |
| 227 | return line.lstrip() | 231 | return line.lstrip() |
| 228 | 232 | ||
| 229 | # _Format guideline #1_: | 233 | # _Format guideline #1_: |
| 230 | # No spaces are allowed behind the line continuation symbol '\' | 234 | # No spaces are allowed behind the line continuation symbol '\' |
| 235 | |||
| 236 | |||
| 231 | def respect_rule1(line): | 237 | def respect_rule1(line): |
| 232 | if line.rstrip().endswith('\\'): | 238 | if line.rstrip().endswith('\\'): |
| 233 | return line.endswith('\\') | 239 | return line.endswith('\\') |
| 234 | else: | 240 | else: |
| 235 | return True | 241 | return True |
| 242 | |||
| 243 | |||
| 236 | def conformTo_rule1(line): | 244 | def conformTo_rule1(line): |
| 237 | return line.rstrip() | 245 | return line.rstrip() |
| 238 | 246 | ||
| 239 | # _Format guideline #2_: | 247 | # _Format guideline #2_: |
| 240 | # Tabs should not be used (use spaces instead). | 248 | # Tabs should not be used (use spaces instead). |
| 249 | |||
| 250 | |||
| 241 | def respect_rule2(line): | 251 | def respect_rule2(line): |
| 242 | return line.count('\t') == 0 | 252 | return line.count('\t') == 0 |
| 253 | |||
| 254 | |||
| 243 | def conformTo_rule2(line): | 255 | def conformTo_rule2(line): |
| 244 | return line.expandtabs() | 256 | return line.expandtabs() |
| 245 | 257 | ||
| 246 | # _Format guideline #3_: | 258 | # _Format guideline #3_: |
| 247 | # Comments inside bb files are allowed using the '#' character at the | 259 | # Comments inside bb files are allowed using the '#' character at the |
| 248 | # beginning of a line. | 260 | # beginning of a line. |
| 261 | |||
| 262 | |||
| 249 | def respect_rule3(line): | 263 | def respect_rule3(line): |
| 250 | if line.lstrip().startswith('#'): | 264 | if line.lstrip().startswith('#'): |
| 251 | return line.startswith('#') | 265 | return line.startswith('#') |
| 252 | else: | 266 | else: |
| 253 | return True | 267 | return True |
| 268 | |||
| 269 | |||
| 254 | def conformTo_rule3(line): | 270 | def conformTo_rule3(line): |
| 255 | return line.lstrip() | 271 | return line.lstrip() |
| 256 | 272 | ||
| 257 | # _Format guideline #4_: | 273 | # _Format guideline #4_: |
| 258 | # Use quotes on the right hand side of assignments FOO = "BAR" | 274 | # Use quotes on the right hand side of assignments FOO = "BAR" |
| 275 | |||
| 276 | |||
| 259 | def respect_rule4(line): | 277 | def respect_rule4(line): |
| 260 | r = re.search(varRegexp, line) | 278 | r = re.search(varRegexp, line) |
| 261 | if r is not None: | 279 | if r is not None: |
| @@ -263,33 +281,48 @@ def respect_rule4(line): | |||
| 263 | # do not test for None it because always match | 281 | # do not test for None it because always match |
| 264 | return r2.group(1) == '"' and r2.group(3) != '' | 282 | return r2.group(1) == '"' and r2.group(3) != '' |
| 265 | return False | 283 | return False |
| 284 | |||
| 285 | |||
| 266 | def conformTo_rule4(line): | 286 | def conformTo_rule4(line): |
| 267 | r = re.search(varRegexp, line) | 287 | r = re.search(varRegexp, line) |
| 268 | return ''.join([r.group(1), ' ', r.group(3), ' "', r.group(5), r.group(5).endswith('"') and '' or '"']) | 288 | return ''.join([r.group(1), ' ', r.group(3), ' "', r.group(5), r.group(5).endswith('"') and '' or '"']) |
| 269 | 289 | ||
| 270 | # _Format guideline #5_: | 290 | # _Format guideline #5_: |
| 271 | # The correct spacing for a variable is FOO = "BAR". | 291 | # The correct spacing for a variable is FOO = "BAR". |
| 292 | |||
| 293 | |||
| 272 | def respect_rule5(line): | 294 | def respect_rule5(line): |
| 273 | r = re.search(varRegexp, line) | 295 | r = re.search(varRegexp, line) |
| 274 | return r is not None and r.group(2) == " " and r.group(4) == " " | 296 | return r is not None and r.group(2) == " " and r.group(4) == " " |
| 297 | |||
| 298 | |||
| 275 | def conformTo_rule5(line): | 299 | def conformTo_rule5(line): |
| 276 | r = re.search(varRegexp, line) | 300 | r = re.search(varRegexp, line) |
| 277 | return ''.join([r.group(1), ' ', r.group(3), ' ', r.group(5)]) | 301 | return ''.join([r.group(1), ' ', r.group(3), ' ', r.group(5)]) |
| 278 | 302 | ||
| 279 | # _Format guideline #6_: | 303 | # _Format guideline #6_: |
| 280 | # Don't use spaces or tabs on empty lines | 304 | # Don't use spaces or tabs on empty lines |
| 305 | |||
| 306 | |||
| 281 | def respect_rule6(line): | 307 | def respect_rule6(line): |
| 282 | return not line.isspace() or line == "\n" | 308 | return not line.isspace() or line == "\n" |
| 309 | |||
| 310 | |||
| 283 | def conformTo_rule6(line): | 311 | def conformTo_rule6(line): |
| 284 | return "" | 312 | return "" |
| 285 | 313 | ||
| 286 | # _Format guideline #7_: | 314 | # _Format guideline #7_: |
| 287 | # Indentation of multiline variables such as SRC_URI is desireable. | 315 | # Indentation of multiline variables such as SRC_URI is desireable. |
| 316 | |||
| 317 | |||
| 288 | def respect_rule7(line): | 318 | def respect_rule7(line): |
| 289 | return True | 319 | return True |
| 320 | |||
| 321 | |||
| 290 | def conformTo_rule7(line): | 322 | def conformTo_rule7(line): |
| 291 | return line | 323 | return line |
| 292 | 324 | ||
| 325 | |||
| 293 | rules = ( | 326 | rules = ( |
| 294 | (respect_rule0, conformTo_rule0, "No spaces are allowed at the beginning of lines that define a variable or a do_ routine"), | 327 | (respect_rule0, conformTo_rule0, "No spaces are allowed at the beginning of lines that define a variable or a do_ routine"), |
| 295 | (respect_rule1, conformTo_rule1, "No spaces are allowed behind the line continuation symbol '\\'"), | 328 | (respect_rule1, conformTo_rule1, "No spaces are allowed behind the line continuation symbol '\\'"), |
| @@ -303,6 +336,8 @@ rules = ( | |||
| 303 | 336 | ||
| 304 | # Function to check that a line respects a rule. If not, it tries to conform | 337 | # Function to check that a line respects a rule. If not, it tries to conform |
| 305 | # the line to the rule. Reminder or Disgression message are dump accordingly. | 338 | # the line to the rule. Reminder or Disgression message are dump accordingly. |
| 339 | |||
| 340 | |||
| 306 | def follow_rule(i, line): | 341 | def follow_rule(i, line): |
| 307 | oldline = line | 342 | oldline = line |
| 308 | # if the line does not respect the rule | 343 | # if the line does not respect the rule |
diff --git a/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py b/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py index b17c7950c7..c5a9a27946 100644 --- a/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py +++ b/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py | |||
| @@ -6,6 +6,7 @@ import tempfile | |||
| 6 | from oeqa.selftest.case import OESelftestTestCase | 6 | from oeqa.selftest.case import OESelftestTestCase |
| 7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | 7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars |
| 8 | 8 | ||
| 9 | |||
| 9 | class MetaOESourceMirroring(OESelftestTestCase): | 10 | class MetaOESourceMirroring(OESelftestTestCase): |
| 10 | # Can we download everything from the OpenEmbedded Sources Mirror over http only | 11 | # Can we download everything from the OpenEmbedded Sources Mirror over http only |
| 11 | def test_oe_source_mirror(self): | 12 | def test_oe_source_mirror(self): |
