From 3cc41c05fad5601c0dd1832f64a6e9efca017727 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 1 Apr 2019 11:36:04 -0400 Subject: [PATCH] robottime: Honor the SOURCE_DATE_EPOCH environment variable. Honoring the SOURCE_DATE_EPOCH environment variable allows building the documentation using libdoc reproducibly, by setting the generated timestamp to a fixed value. For more background on reproducible builds and the SOURCE_DATE_EPOCH environment variable, see: https://reproducible-builds.org/specs/source-date-epoch/. * src/robot/utils/robottime.py: import `os'. (TimestampCache._get_epoch): Retrieve date from SOURCE_DATE_EPOCH if it is defined, otherwise from time.time(). * utest/output/test_logger.py (TestLogger.test_write_to_one_logger): Check for the existance of a timestamp attribute instead of checking for its content as the later is easy to break when using the SOURCE_DATE_EPOCH environment variable. --- src/robot/utils/robottime.py | 3 +++ utest/output/test_logger.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/robot/utils/robottime.py b/src/robot/utils/robottime.py index 06432a4a6..91526f826 100644 --- a/src/robot/utils/robottime.py +++ b/src/robot/utils/robottime.py @@ -14,6 +14,7 @@ # limitations under the License. import datetime +import os import time import re @@ -395,6 +396,8 @@ class TimestampCache(object): # Seam for mocking def _get_epoch(self): + if os.getenv('SOURCE_DATE_EPOCH'): + return float(os.getenv('SOURCE_DATE_EPOCH')) return time.time() def _use_cache(self, secs, *separators): diff --git a/utest/output/test_logger.py b/utest/output/test_logger.py index 92fe6d77d..e980227aa 100644 --- a/utest/output/test_logger.py +++ b/utest/output/test_logger.py @@ -46,7 +46,7 @@ class TestLogger(unittest.TestCase): logger = LoggerMock(('Hello, world!', 'INFO')) self.logger.register_logger(logger) self.logger.write('Hello, world!', 'INFO') - assert_true(logger.msg.timestamp.startswith('20')) + assert_true(hasattr(logger.msg, 'timestamp')) def test_write_to_one_logger_with_trace_level(self): logger = LoggerMock(('expected message', 'TRACE')) -- 2.20.1 5e47989c1ae6cb48ef1eec1674985fd'>vnc.scm
AgeCommit message (Expand)Author
2023-11-27services: xvnc: Do not specify display number when using inetd....* gnu/services/vnc.scm (xvnc-configuration->command-line-arguments): Omit X display number when inetd? is #t. Change-Id: I0fc8e3068f3ae22421e60e96bd40e3b6e477ca99 David Thompson
2023-05-21services: Transient inetd services inherit requirements....That way, per-connection transient services such as 'sshd-123' inherit dependencies of their "parent" ('sshd' in this example), which is more consistent than not depending on anything. * gnu/services/dict.scm (dicod-shepherd-service): Pass #:requirements to 'make-inetd-constructor'. * gnu/services/messaging.scm (bitlbee-shepherd-service): Likewise. * gnu/services/ssh.scm (openssh-shepherd-service): Likewise. * gnu/services/vnc.scm (xvnc-shepherd-service): Likewise. Ludovic Courtès
2023-04-02services: xvnc: Do not create a regular HOME directory for xvnc user....* gnu/services/vnc.scm (%xvnc-accounts) [home-directory]: Define as /var/empty. [shell]: Set to nologin, for good measures. Maxim Cournoyer
2022-10-07Revert "Revert "services: Add xvnc-service-type.""...This reverts commit 0c4966160054bc50e6ab3a4ac9c9a6a1826ab5a0. The fix appears in the subsequent commit, for clarity. Maxim Cournoyer
2022-10-07Revert "services: Add xvnc-service-type."...This reverts commit 1c528a95cb92b7808e6603d7956185005583629f. This broke 'guix pull', for (yet) unknown reasons. Maxim Cournoyer
2022-10-07services: Add xvnc-service-type....* gnu/services/vnc.scm: New file. * gnu/tests/vnc.scm: Likewise. * gnu/local.mk: Register them. Maxim Cournoyer