Code Monkey home page Code Monkey logo

Comments (9)

praiskup avatar praiskup commented on June 26, 2024

What if add_local_repo() generated my_mock_config using include() statement too, instead of copy-paste-and-edit the config_opts['config_file']?

from mock.

belegdol avatar belegdol commented on June 26, 2024

Would you be kind enough to create a patch I could test?

from mock.

praiskup avatar praiskup commented on June 26, 2024

@belegdol I'd like to (once the time permits), but I bet someone with higher motivation will be faster..? :)

from mock.

hobbes1069 avatar hobbes1069 commented on June 26, 2024

I'm running into this issue as well trying to do test chain builds for RPM Fusion. Since the site-defaults.cfg file specifically states this should work I would hope it would be more of a priority...

# It's possible to use include statement in order to make one config included to another:
# include('/path/to/included/config.cfg')

from mock.

garybuhrmaster avatar garybuhrmaster commented on June 26, 2024

In the case this is useful for one of the core team, while it probably is not the right solution (it includes the included config, rather than generating my_mock_config file with the copied include statement(s)), this at least seems to sort of work as a temporary workaround (code adapted from existing mock support for include support) for my simple test cases.

--- /usr/bin/mockchain	2017-09-15 21:32:30.000000000 +0000
+++ /tmp/mockchain	2017-10-22 23:51:15.440611984 +0000
@@ -127,6 +127,20 @@
     REPOS_ID.append(repoid)
     return repoid
 
+def include(config_file):
+    global config_opts
+    if os.path.exists(config_file):
+        if config_file in config_opts['config_paths']:
+            """ Skip multiple inclusion of config_file """
+            return
+        config_opts['config_paths'].append(config_file)
+        with open(config_file) as f:
+            code = compile(f.read(), config_file, 'exec')
+        # pylint: disable=exec-used
+        exec(code)
+    else:
+        print("Could not find included config file: %s" % config_file)
+        sys.exit(1)
 
 def add_local_repo(infile, destfile, baseurl, repoid=None):
     """take a mock chroot config and add a repo to it's yum.conf

from mock.

sergiomb2 avatar sergiomb2 commented on June 26, 2024

And I arrive here from here: https://pagure.io/FedoraReview/issue/286#comment-488571, fedora-review also breaks with includes ...

from mock.

sergiomb2 avatar sergiomb2 commented on June 26, 2024

The code that includes "include" is here [1] and here [2] is the minimum code that I could do to support the include .

[1] 2f147d0

[2] filename.py.txt

from mock.

sergiomb2 avatar sergiomb2 commented on June 26, 2024

can you test sergiomb2@5b4f37a ? please .
In your machine , is just edit /usr/bin/mockchain and replace the code .

Thanks

from mock.

xsuchy avatar xsuchy commented on June 26, 2024

I marked mockchain as obsoleted. Starting from next version, you should use
mock --chain
where this issue will not happen.

from mock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.