Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: de71be7723a5
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 83a57cfa311e
Choose a head ref
  • 3 commits
  • 3 files changed
  • 2 contributors

Commits on Apr 29, 2020

  1. pykms: replace logging patch

    The logging "sed-patch" that was introduced for version 20190611 worked poorly:
    it was too intrusive (breaking the --logfile option), and it didn't prevent
    using in-store file for logging by default. The new logging patch (an actual
    "diff-patch") is less intrusive: it just changes the default log file's
    location to be the current directory instead of the executable's directory.
    pvgoran committed Apr 29, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    462fa8b View commit details
  2. Copy the full SHA
    c678d68 View commit details
  3. Merge pull request #81366 from pvgoran/pykms-fix-logging

    pykms: fix/enhance logging
    peterhoeg authored Apr 29, 2020
    Copy the full SHA
    83a57cf View commit details
Showing with 24 additions and 5 deletions.
  1. +1 −0 nixos/modules/services/misc/pykms.nix
  2. +3 −5 pkgs/tools/networking/pykms/default.nix
  3. +20 −0 pkgs/tools/networking/pykms/log-to-current-directory-by-default.patch
1 change: 1 addition & 0 deletions nixos/modules/services/misc/pykms.nix
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ in {
]);
ProtectHome = "tmpfs";
WorkingDirectory = libDir;
SyslogIdentifier = "pykms";
Restart = "on-failure";
MemoryLimit = cfg.memoryLimit;
};
8 changes: 3 additions & 5 deletions pkgs/tools/networking/pykms/default.nix
Original file line number Diff line number Diff line change
@@ -44,16 +44,14 @@ in buildPythonApplication rec {

propagatedBuildInputs = [ systemd pytz tzlocal ];

# Fix https://github.com/SystemRage/py-kms/issues/64 :
patches = [ ./log-to-current-directory-by-default.patch ];

postPatch = ''
siteDir=$out/${python3.sitePackages}
substituteInPlace pykms_DB2Dict.py \
--replace "'KmsDataBase.xml'" "'$siteDir/KmsDataBase.xml'"
# we are logging to journal
sed -i pykms_Misc.py \
-e '6ifrom systemd import journal' \
-e 's/log_obj.addHandler(log_handler)/log_obj.addHandler(journal.JournalHandler())/'
'';

format = "other";
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# By default, create log files in current directory, instead of the script directory.
--- ../original/py-kms/pykms_Client.py
+++ py-kms/pykms_Client.py
@@ -48,5 +48,5 @@
'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]},
'lfile' : {'help' : 'Use this option to set an output log file. The default is \"pykms_logclient.log\" or type \"STDOUT\" to view log info on stdout.',
- 'def' : os.path.dirname(os.path.abspath( __file__ )) + "/pykms_logclient.log", 'des' : "logfile"},
+ 'def' : "pykms_logclient.log", 'des' : "logfile"},
'lsize' : {'help' : 'Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.', 'def' : 0, 'des': "logsize"},
}
--- ../original/py-kms/pykms_Server.py
+++ py-kms/pykms_Server.py
@@ -85,5 +85,5 @@
'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]},
'lfile' : {'help' : 'Use this option to set or not an output log file. The default is \"pykms_logserver.log\" or type \"STDOUT\" to view log info on stdout.',
- 'def' : os.path.dirname(os.path.abspath( __file__ )) + "/pykms_logserver.log", 'des' : "logfile"},
+ 'def' : "pykms_logserver.log", 'des' : "logfile"},
'lsize' : {'help' : 'Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.', 'def' : 0, 'des': "logsize"},
}
'');