public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories
@ 2020-04-17  3:31 Ashley E Desimone
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos Ashley E Desimone
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

This patch set adds the initial support for consuming
multiple manifest repositories to the BaseConfig, GlobalConfig
and GlobalUserConfig classes defined in edkrepo/config/config_factory.py

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>

Ashley E Desimone (6):
  EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos
  EdkRepo: Add new sections to edkrepo.cfg
  EdkRepo: Add the manifest_repo_list property to BaseConfig
  EdkRepo: Add manifest_repo_props()
  EdkRepo: Move edkrepo_global_data directory to BaseConfig
  EdkRepo: Add 'get' functions for Manifest Repo data

 edkrepo/config/config_factory.py     | 72 +++++++++++++++++++++++++++++++++---
 edkrepo_installer/Vendor/edkrepo.cfg |  8 ++++
 2 files changed, 74 insertions(+), 6 deletions(-)

-- 
2.16.2.windows.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos
  2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
@ 2020-04-17  3:31 ` Ashley E Desimone
  2020-04-17 15:21   ` Bjorge, Erik C
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg Ashley E Desimone
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Add support for the following cfg format to the
BaseConfig class enabling it to be consumed by
both the Global and User configuration file
classes. CfgProps for each listed manifest repository
will be dynamically added to the classes prop_list.

Configuration Example:

[Manifest_A]
...

[Manifest_B]
...

[manifest-repos]
Manifest_A
Manifest_B

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index c342838..6c14f1b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -85,6 +85,12 @@ class BaseConfig():
         if os.path.isfile(self.filename):
             self.cfg.read(self.filename)
 
+        if self.cfg.has_section('manifest-repos'):
+            for option in self.cfg.options('manifest-repos'):
+                self.prop_list.append(CfgProp('{}'.format(option), 'URL', '{}-manifest_repo_url.'.format(option), None, False))
+                self.prop_list.append(CfgProp('{}'.format(option), 'Branch', '{}-manifest_repo_branch'.format(option), None, False))
+                self.prop_list.append(CfgProp('{}'.format(option), 'LocalPath', '{}-manifest_repo_local_path.'.format(option), None, False))
+
         # Create properties defined by the prop_list
         cfg_updated = False
         for prop in self.prop_list:
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg
  2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos Ashley E Desimone
@ 2020-04-17  3:31 ` Ashley E Desimone
  2020-04-17 15:04   ` Bjorge, Erik C
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig Ashley E Desimone
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Add manifest-repos and edk2-staging sections
to the edkrepo.cfg to enable support of multiple
manifest repositories.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo_installer/Vendor/edkrepo.cfg | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/edkrepo_installer/Vendor/edkrepo.cfg b/edkrepo_installer/Vendor/edkrepo.cfg
index 7dcaf20..97ebdd2 100644
--- a/edkrepo_installer/Vendor/edkrepo.cfg
+++ b/edkrepo_installer/Vendor/edkrepo.cfg
@@ -1,3 +1,11 @@
+[manifest-repos]
+edk2-staging = 
+
+[edk2-staging]
+URL = https://github.com/tianocore/edk2-staging.git
+Branch = EdkRepo-Manifest
+LocalPath = edk2-staging-manifest-master
+
 [manifest-repo]
 URL = https://github.com/tianocore/edk2-staging.git
 Branch = EdkRepo-Manifest
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig
  2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos Ashley E Desimone
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg Ashley E Desimone
@ 2020-04-17  3:31 ` Ashley E Desimone
  2020-04-17 15:22   ` Bjorge, Erik C
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props() Ashley E Desimone
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Add the manifest_repo_list property to the BaseConfig class
to return a list of manfiest repo sections in the config file.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6c14f1b..6f89589 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -113,6 +113,12 @@ class BaseConfig():
             with open(self.filename, 'w') as cfg_stream:
                 self.cfg.write(cfg_stream)
 
+    @property
+    def manifest_repo_list(self):
+        """Returns a list of available manifest repos"""
+        if self.cfg.has_section('manifest-repos'):
+            return self.cfg.options('manifest-repos')
+
 class GlobalConfig(BaseConfig):
     """
     Class access structure for the edkrepo.cfg file.  This file is read only and maintained by the
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()
  2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
                   ` (2 preceding siblings ...)
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig Ashley E Desimone
@ 2020-04-17  3:31 ` Ashley E Desimone
  2020-04-17 15:08   ` Bjorge, Erik C
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig Ashley E Desimone
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data Ashley E Desimone
  5 siblings, 1 reply; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Add the manifest_repo_props() function to the
BaseConfig class which returns a list of all
CfgProp objects for a given manifest repository.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6f89589..e053f8b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -118,6 +118,17 @@ class BaseConfig():
         """Returns a list of available manifest repos"""
         if self.cfg.has_section('manifest-repos'):
             return self.cfg.options('manifest-repos')
+    
+    def manifest_repo_props(self, manifest_repo):
+        """
+        Returns a list of cfg_prop objects that pertain to a given manifest
+        repo
+        """
+        repo_props = []
+        for prop in self.prop_list:
+            if manifest_repo in prop.name:
+                repo_props.append(prop)
+        return repo_props
 
 class GlobalConfig(BaseConfig):
     """
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig
  2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
                   ` (3 preceding siblings ...)
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props() Ashley E Desimone
@ 2020-04-17  3:31 ` Ashley E Desimone
  2020-04-17 15:19   ` Bjorge, Erik C
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data Ashley E Desimone
  5 siblings, 1 reply; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Move the edkrepo_global_data_directory from the
GlobalConfig class to the base config class.

Updated the assignments of self.filename in both
the GlobalConfig and the GlobalUserConfig classes
as well as the initializaion of the BaseConfig
class to use get_edkrepo_global_data_directory()

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index e053f8b..a4daba3 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -77,10 +77,11 @@ class BaseConfig():
     for the class.  Property generation and verification is based off of a list of CfgProp classes.
     """
     prop_list = []
-    def __init__(self, filename, read_only=True):
+    def __init__(self, filename, global_data_dir, read_only=True):
         # Do basic initialization of private variables
         self.read_only = read_only
         self.filename = filename
+        self.global_data_dir = global_data_dir
         self.cfg = configparser.ConfigParser(allow_no_value=True, delimiters='=')
         if os.path.isfile(self.filename):
             self.cfg.read(self.filename)
@@ -136,8 +137,7 @@ class GlobalConfig(BaseConfig):
     edkrepo installer.
     """
     def __init__(self):
-        self.edkrepo_global_data_directory = get_edkrepo_global_data_directory()
-        self.filename = os.path.join(self.edkrepo_global_data_directory, "edkrepo.cfg")
+        self.filename = os.path.join(get_edkrepo_global_data_directory(), "edkrepo.cfg")
         self.prop_list = [
                 CfgProp('manifest-repo', 'URL', 'manifest_repo_url', None, True),
                 CfgProp('manifest-repo', 'Branch', 'manifest_repo_branch', None, True),
@@ -152,7 +152,7 @@ class GlobalConfig(BaseConfig):
                 CfgProp('preferred-entry-point', 'entry-point', 'pref_entry_point', None, True)]
         if not os.path.isfile(self.filename):
             raise EdkrepoGlobalConfigNotFoundException(humble.GLOBAL_CFG_NOT_FOUND.format(self.filename))
-        super().__init__(self.filename, True)
+        super().__init__(self.filename, get_edkrepo_global_data_directory(), True)
 
     @property
     def preferred_entry(self):
@@ -169,7 +169,7 @@ class GlobalConfig(BaseConfig):
     @property
     def manifest_repo_abs_local_path(self):
         """Provides an absolute path to the manifest repo based on configuration file values."""
-        return os.path.join(self.edkrepo_global_data_directory, self.manifest_repo_local_path)
+        return os.path.join(self.global_data_dir, self.manifest_repo_local_path)
 
     @property
     def sparsecheckout_data(self):
@@ -196,7 +196,7 @@ class GlobalUserConfig(BaseConfig):
             CfgProp('scm', 'mirror_geo', 'geo', 'none', False),
             CfgProp('send-review', 'max-patch-set', 'max_patch_set', '10', False)
             ]
-        super().__init__(self.filename, False)
+        super().__init__(self.filename, get_edkrepo_global_data_directory(), False)
 
     @property
     def max_patch_set_int(self):
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data
  2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
                   ` (4 preceding siblings ...)
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig Ashley E Desimone
@ 2020-04-17  3:31 ` Ashley E Desimone
  2020-04-17 15:23   ` Bjorge, Erik C
  5 siblings, 1 reply; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17  3:31 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Added functions to get the URL, LocalPath, Branch
and the absolute path for individual manifest
repositories to the BaseConfig class.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index a4daba3..022e0bb 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -131,6 +131,43 @@ class BaseConfig():
                 repo_props.append(prop)
         return repo_props
 
+    def get_manifest_repo_url(self, manifest_repo):
+        """ 
+        Returns the URL value for a given manifest repo based on config
+        file contents.
+        """
+        for prop in self.manifest_repo_props(manifest_repo):
+            if 'URL' == prop.key:
+                return self.cfg[prop.section][prop.key]
+        return None
+
+    def get_manifest_repo_branch(self, manifest_repo):
+        """
+        Returns the Branch value for a given manifest repo based on config file
+        contents.
+        """
+        for prop in self.manifest_repo_props(manifest_repo):
+            if 'Branch' == prop.key:
+                return self.cfg[prop.section][prop.key]
+        return None
+
+    def get_manifest_repo_local_path(self, manifest_repo):
+        """
+        Returns the Local path value for a given manifest repo based on config
+        file contents.
+        """
+        for prop in self.manifest_repo_props(manifest_repo):
+            if 'LocalPath' == prop.key:
+                return self.cfg[prop.section][prop.key]
+        return None
+
+    def manifest_repo_abs_path(self, manifest_repo):
+        """
+        Returns the absolute path of a single manifest repo based on config
+        file contents and the global_data_dir location.
+        """
+        return os.path.join(self.global_data_dir, self.get_manifest_repo_local_path(manifest_repo))
+
 class GlobalConfig(BaseConfig):
     """
     Class access structure for the edkrepo.cfg file.  This file is read only and maintained by the
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg Ashley E Desimone
@ 2020-04-17 15:04   ` Bjorge, Erik C
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorge, Erik C @ 2020-04-17 15:04 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg

Add manifest-repos and edk2-staging sections to the edkrepo.cfg to enable support of multiple manifest repositories.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo_installer/Vendor/edkrepo.cfg | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/edkrepo_installer/Vendor/edkrepo.cfg b/edkrepo_installer/Vendor/edkrepo.cfg
index 7dcaf20..97ebdd2 100644
--- a/edkrepo_installer/Vendor/edkrepo.cfg
+++ b/edkrepo_installer/Vendor/edkrepo.cfg
@@ -1,3 +1,11 @@
+[manifest-repos]
+edk2-staging =
+
+[edk2-staging]
+URL = https://github.com/tianocore/edk2-staging.git
+Branch = EdkRepo-Manifest
+LocalPath = edk2-staging-manifest-master
+
 [manifest-repo]
 URL = https://github.com/tianocore/edk2-staging.git
 Branch = EdkRepo-Manifest
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props() Ashley E Desimone
@ 2020-04-17 15:08   ` Bjorge, Erik C
  2020-04-17 17:04     ` Ashley E Desimone
  0 siblings, 1 reply; 14+ messages in thread
From: Bjorge, Erik C @ 2020-04-17 15:08 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

Why is this not a list comprehension?

return [x for x in self.prop_list if manifest_repo in x.name]

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

Add the manifest_repo_props() function to the BaseConfig class which returns a list of all CfgProp objects for a given manifest repository.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6f89589..e053f8b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -118,6 +118,17 @@ class BaseConfig():
         """Returns a list of available manifest repos"""
         if self.cfg.has_section('manifest-repos'):
             return self.cfg.options('manifest-repos')
+    
+    def manifest_repo_props(self, manifest_repo):
+        """
+        Returns a list of cfg_prop objects that pertain to a given manifest
+        repo
+        """
+        repo_props = []
+        for prop in self.prop_list:
+            if manifest_repo in prop.name:
+                repo_props.append(prop)
+        return repo_props
 
 class GlobalConfig(BaseConfig):
     """
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig Ashley E Desimone
@ 2020-04-17 15:19   ` Bjorge, Erik C
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorge, Erik C @ 2020-04-17 15:19 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig

Move the edkrepo_global_data_directory from the GlobalConfig class to the base config class.

Updated the assignments of self.filename in both the GlobalConfig and the GlobalUserConfig classes as well as the initializaion of the BaseConfig class to use get_edkrepo_global_data_directory()

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index e053f8b..a4daba3 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -77,10 +77,11 @@ class BaseConfig():
     for the class.  Property generation and verification is based off of a list of CfgProp classes.
     """
     prop_list = []
-    def __init__(self, filename, read_only=True):
+    def __init__(self, filename, global_data_dir, read_only=True):
         # Do basic initialization of private variables
         self.read_only = read_only
         self.filename = filename
+        self.global_data_dir = global_data_dir
         self.cfg = configparser.ConfigParser(allow_no_value=True, delimiters='=')
         if os.path.isfile(self.filename):
             self.cfg.read(self.filename) @@ -136,8 +137,7 @@ class GlobalConfig(BaseConfig):
     edkrepo installer.
     """
     def __init__(self):
-        self.edkrepo_global_data_directory = get_edkrepo_global_data_directory()
-        self.filename = os.path.join(self.edkrepo_global_data_directory, "edkrepo.cfg")
+        self.filename = 
+ os.path.join(get_edkrepo_global_data_directory(), "edkrepo.cfg")
         self.prop_list = [
                 CfgProp('manifest-repo', 'URL', 'manifest_repo_url', None, True),
                 CfgProp('manifest-repo', 'Branch', 'manifest_repo_branch', None, True), @@ -152,7 +152,7 @@ class GlobalConfig(BaseConfig):
                 CfgProp('preferred-entry-point', 'entry-point', 'pref_entry_point', None, True)]
         if not os.path.isfile(self.filename):
             raise EdkrepoGlobalConfigNotFoundException(humble.GLOBAL_CFG_NOT_FOUND.format(self.filename))
-        super().__init__(self.filename, True)
+        super().__init__(self.filename, 
+ get_edkrepo_global_data_directory(), True)
 
     @property
     def preferred_entry(self):
@@ -169,7 +169,7 @@ class GlobalConfig(BaseConfig):
     @property
     def manifest_repo_abs_local_path(self):
         """Provides an absolute path to the manifest repo based on configuration file values."""
-        return os.path.join(self.edkrepo_global_data_directory, self.manifest_repo_local_path)
+        return os.path.join(self.global_data_dir, 
+ self.manifest_repo_local_path)
 
     @property
     def sparsecheckout_data(self):
@@ -196,7 +196,7 @@ class GlobalUserConfig(BaseConfig):
             CfgProp('scm', 'mirror_geo', 'geo', 'none', False),
             CfgProp('send-review', 'max-patch-set', 'max_patch_set', '10', False)
             ]
-        super().__init__(self.filename, False)
+        super().__init__(self.filename, 
+ get_edkrepo_global_data_directory(), False)
 
     @property
     def max_patch_set_int(self):
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos Ashley E Desimone
@ 2020-04-17 15:21   ` Bjorge, Erik C
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorge, Erik C @ 2020-04-17 15:21 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos

Add support for the following cfg format to the BaseConfig class enabling it to be consumed by both the Global and User configuration file classes. CfgProps for each listed manifest repository will be dynamically added to the classes prop_list.

Configuration Example:

[Manifest_A]
...

[Manifest_B]
...

[manifest-repos]
Manifest_A
Manifest_B

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index c342838..6c14f1b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -85,6 +85,12 @@ class BaseConfig():
         if os.path.isfile(self.filename):
             self.cfg.read(self.filename)
 
+        if self.cfg.has_section('manifest-repos'):
+            for option in self.cfg.options('manifest-repos'):
+                self.prop_list.append(CfgProp('{}'.format(option), 'URL', '{}-manifest_repo_url.'.format(option), None, False))
+                self.prop_list.append(CfgProp('{}'.format(option), 'Branch', '{}-manifest_repo_branch'.format(option), None, False))
+                self.prop_list.append(CfgProp('{}'.format(option), 
+ 'LocalPath', '{}-manifest_repo_local_path.'.format(option), None, 
+ False))
+
         # Create properties defined by the prop_list
         cfg_updated = False
         for prop in self.prop_list:
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig Ashley E Desimone
@ 2020-04-17 15:22   ` Bjorge, Erik C
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorge, Erik C @ 2020-04-17 15:22 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig

Add the manifest_repo_list property to the BaseConfig class to return a list of manfiest repo sections in the config file.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6c14f1b..6f89589 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -113,6 +113,12 @@ class BaseConfig():
             with open(self.filename, 'w') as cfg_stream:
                 self.cfg.write(cfg_stream)
 
+    @property
+    def manifest_repo_list(self):
+        """Returns a list of available manifest repos"""
+        if self.cfg.has_section('manifest-repos'):
+            return self.cfg.options('manifest-repos')
+
 class GlobalConfig(BaseConfig):
     """
     Class access structure for the edkrepo.cfg file.  This file is read only and maintained by the
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data
  2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data Ashley E Desimone
@ 2020-04-17 15:23   ` Bjorge, Erik C
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorge, Erik C @ 2020-04-17 15:23 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data

Added functions to get the URL, LocalPath, Branch and the absolute path for individual manifest repositories to the BaseConfig class.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index a4daba3..022e0bb 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -131,6 +131,43 @@ class BaseConfig():
                 repo_props.append(prop)
         return repo_props
 
+    def get_manifest_repo_url(self, manifest_repo):
+        """ 
+        Returns the URL value for a given manifest repo based on config
+        file contents.
+        """
+        for prop in self.manifest_repo_props(manifest_repo):
+            if 'URL' == prop.key:
+                return self.cfg[prop.section][prop.key]
+        return None
+
+    def get_manifest_repo_branch(self, manifest_repo):
+        """
+        Returns the Branch value for a given manifest repo based on config file
+        contents.
+        """
+        for prop in self.manifest_repo_props(manifest_repo):
+            if 'Branch' == prop.key:
+                return self.cfg[prop.section][prop.key]
+        return None
+
+    def get_manifest_repo_local_path(self, manifest_repo):
+        """
+        Returns the Local path value for a given manifest repo based on config
+        file contents.
+        """
+        for prop in self.manifest_repo_props(manifest_repo):
+            if 'LocalPath' == prop.key:
+                return self.cfg[prop.section][prop.key]
+        return None
+
+    def manifest_repo_abs_path(self, manifest_repo):
+        """
+        Returns the absolute path of a single manifest repo based on config
+        file contents and the global_data_dir location.
+        """
+        return os.path.join(self.global_data_dir, 
+ self.get_manifest_repo_local_path(manifest_repo))
+
 class GlobalConfig(BaseConfig):
     """
     Class access structure for the edkrepo.cfg file.  This file is read only and maintained by the
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()
  2020-04-17 15:08   ` Bjorge, Erik C
@ 2020-04-17 17:04     ` Ashley E Desimone
  0 siblings, 0 replies; 14+ messages in thread
From: Ashley E Desimone @ 2020-04-17 17:04 UTC (permalink / raw)
  To: Bjorge, Erik C, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Pandya, Puja, Bret Barkelew,
	Agyeman, Prince

I am going to go with it was a long day. I will send out an updated patch set for review taking your feedback into account.

Thanks,
Ashley

-----Original Message-----
From: Bjorge, Erik C <erik.c.bjorge@intel.com> 
Sent: Friday, April 17, 2020 8:09 AM
To: Desimone, Ashley E <ashley.e.desimone@intel.com>; devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: RE: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

Why is this not a list comprehension?

return [x for x in self.prop_list if manifest_repo in x.name]

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Thursday, April 16, 2020 8:31 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props()

Add the manifest_repo_props() function to the BaseConfig class which returns a list of all CfgProp objects for a given manifest repository.

Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
 edkrepo/config/config_factory.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py
index 6f89589..e053f8b 100644
--- a/edkrepo/config/config_factory.py
+++ b/edkrepo/config/config_factory.py
@@ -118,6 +118,17 @@ class BaseConfig():
         """Returns a list of available manifest repos"""
         if self.cfg.has_section('manifest-repos'):
             return self.cfg.options('manifest-repos')
+    
+    def manifest_repo_props(self, manifest_repo):
+        """
+        Returns a list of cfg_prop objects that pertain to a given manifest
+        repo
+        """
+        repo_props = []
+        for prop in self.prop_list:
+            if manifest_repo in prop.name:
+                repo_props.append(prop)
+        return repo_props
 
 class GlobalConfig(BaseConfig):
     """
--
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-04-17 17:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-17  3:31 [edk2-staging/EdkRepo] [PATCH 0/6] EdkRepo: Add Initial Config Factory Support for Multiple Manifest Repositories Ashley E Desimone
2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 1/6] EdkRepo: Support Updated CFG Format Defining Multiple Manifest Repos Ashley E Desimone
2020-04-17 15:21   ` Bjorge, Erik C
2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 2/6] EdkRepo: Add new sections to edkrepo.cfg Ashley E Desimone
2020-04-17 15:04   ` Bjorge, Erik C
2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 3/6] EdkRepo: Add the manifest_repo_list property to BaseConfig Ashley E Desimone
2020-04-17 15:22   ` Bjorge, Erik C
2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 4/6] EdkRepo: Add manifest_repo_props() Ashley E Desimone
2020-04-17 15:08   ` Bjorge, Erik C
2020-04-17 17:04     ` Ashley E Desimone
2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 5/6] EdkRepo: Move edkrepo_global_data directory to BaseConfig Ashley E Desimone
2020-04-17 15:19   ` Bjorge, Erik C
2020-04-17  3:31 ` [edk2-staging/EdkRepo] [PATCH 6/6] EdkRepo: Add 'get' functions for Manifest Repo data Ashley E Desimone
2020-04-17 15:23   ` Bjorge, Erik C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox