#688 Fix #661: mbs hard-codes x86_64 as the local architecture
Merged 6 years ago by ralph. Opened 6 years ago by fivaldi.
fivaldi/fm-orchestrator fivaldi_mock_builder_detect_arch  into  master

file modified
+3
@@ -173,3 +173,6 @@ 

  class LocalBuildConfiguration(BaseConfiguration):

      LOG_LEVEL = 'debug'

      MESSAGING = 'in_memory'

+ 

+     ARCH_AUTODETECT = True

+     ARCH_FALLBACK = 'x86_64'

@@ -28,6 +28,7 @@ 

  import kobo.rpmlib

  import modulemd

  import pipes

+ import platform

  import re

  import threading

  
@@ -91,9 +92,21 @@ 

          self.tag_name = tag_name

          self.config = config

          self.groups = []

-         self.arch = "x86_64"  # TODO: We may need to change that in the future

          self.yum_conf = MockModuleBuilder.yum_config_template

  

+         # Auto-detect arch (if possible) or fallback to the configured one

+         if conf.arch_autodetect:

+             arch_detected = platform.machine()

+             if arch_detected:

+                 self.arch = arch_detected

+             else:

+                 log.warning("Couldn't determine machine arch. Falling back "

+                             "to configured arch.")

+                 self.arch = conf.arch_fallback

+         else:

+             self.arch = conf.arch_fallback

+         log.info("Machine arch setting: {}".format(self.arch))

+ 

          # Create main directory for this tag

          self.tag_dir = os.path.join(self.config.mock_resultsdir, tag_name)

          if not os.path.exists(self.tag_dir):

@@ -326,6 +326,14 @@ 

              'type': bool,

              'default': True,

              'desc': 'Remove empty or otherwise useless log files.'},

+         'arch_autodetect': {

+             'type': bool,

+             'default': True,

+             'desc': 'Auto-detect machine arch when configuring builder.'},

+         'arch_fallback': {

+             'type': str,

+             'default': 'x86_64',

+             'desc': 'Fallback arch if auto-detection is off or unable to determine it.'},

          'scmurls': {

              'type': list,

              'default': [],

This PR fixes #661.

TBC: Maybe I should add some log.info/log.debug about the finally chosen arch???

rebased onto 8fd65c6bbffd2542a98c6dbf8f909013fde4d0e3

6 years ago

TBC: Maybe I should add some log.info/log.debug about the finally chosen arch???

Yes. Definitely. log.info please.

@sharkcz - how does this look to you?

rebased onto be7c8d7

6 years ago

@ralph, thanks, added to the commit... And I removed it from the log.warning. The information would be redundant there.

it looks good
...
(1/16288): binutils-devel-2.29-9.fc28.s390x.rpm
...

need to find a better module that won't download the world ;-)

Pull-Request has been merged by ralph

6 years ago