#76 Allow controlling packager identity through environment variables
Merged 3 years ago by ngompa. Opened 3 years ago by ngompa.

file modified
+11
@@ -72,10 +72,21 @@ 

      return editor

  

  def detect_packager():

+     # If we're forcing the fallback...

+     if os.getenv("RUST2RPM_NO_DETECT_PACKAGER") is not None:

+         return None

+ 

+     # If we're supplying packager identity through an environment variable...

+     packager_identity = os.getenv("RUST2RPM_PACKAGER")

+     if packager_identity is not None:

+         return packager_identity

+ 

+     # If we're detecting packager identity through rpmdev-packager...

      rpmdev_packager = shutil.which("rpmdev-packager")

      if rpmdev_packager is not None:

          return subprocess.check_output(rpmdev_packager, universal_newlines=True).strip()

  

+     # If we're detecting packager identity through git configuration...

      git = shutil.which("git")

      if git is not None:

          name = subprocess.check_output([git, "config", "user.name"], universal_newlines=True).strip()

In order to support more flexible automation mechanisms, allow
injecting the packager identity through environment variables as an
override from the regular detection mechanisms.

Moreover, there are cases where we want to force the fallback identity,
so we now have a way to force that through an environment variable.

These are intended to be used with multi-user automation systems so
that the correct identity is set regardless of what the host system
is actually configured with.

Fixes #73

Signed-off-by: Neal Gompa ngompa13@gmail.com

Metadata Update from @ngompa:
- Request assigned

3 years ago

Metadata Update from @ngompa:
- Request assigned

3 years ago

Pull-Request has been merged by ngompa

3 years ago
Metadata