diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2019-06-11 13:39:45 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2019-06-11 19:59:13 +0300 |
commit | 0c3affa71ccf8965269f2c4eaab54f7aa189ddb1 (patch) | |
tree | cd28034f9908e7bd04ed1676ba1d239d5245be79 | |
parent | dd2acec3d8d881e9560f3f07455f138a140248b8 (diff) |
Touch packages_list.html when packages.inc is updated
Touch packages_list.html when packages.inc is updated, for the benefit
of 'XBitHack full'
Factor out touch utility function
-rw-r--r-- | calm/maintainers.py | 11 | ||||
-rwxr-xr-x | calm/pkg2html.py | 6 | ||||
-rw-r--r-- | calm/utils.py | 36 |
3 files changed, 44 insertions, 9 deletions
diff --git a/calm/maintainers.py b/calm/maintainers.py index b9c51fd..7ffc12b 100644 --- a/calm/maintainers.py +++ b/calm/maintainers.py @@ -46,14 +46,7 @@ import logging import os import re -# -# -# - - -def touch(fn, times=None): - with open(fn, 'a'): - os.utime(fn, times) +from . import utils # # @@ -94,7 +87,7 @@ class Maintainer(object): if self.reminders_issued: # if reminders were issued, update the timestamp logging.debug("updating reminder time for %s" % self.name) - touch(reminder_file) + utils.touch(reminder_file) elif (not self.reminders_timestamp_checked) and (self.reminder_time != 0): # if we didn't need to check the reminder timestamp, it can be # reset diff --git a/calm/pkg2html.py b/calm/pkg2html.py index 54edca4..a74f913 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -55,6 +55,7 @@ from .version import SetupVersion from . import common_constants from . import maintainers from . import package +from . import utils # @@ -273,6 +274,11 @@ def update_package_listings(args, packages): print('</table>', file=index) + # touch the including file for the benefit of 'XBitHack full' + package_list = os.path.join(args.htdocs, 'package_list.html') + if os.path.exists(package_list): + utils.touch(package_list) + def write_arch_listing(args, packages, arch): update_summary = set() diff --git a/calm/utils.py b/calm/utils.py new file mode 100644 index 0000000..07e45a0 --- /dev/null +++ b/calm/utils.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2019 Jon Turney +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +# +# utility functions +# + +import os + + +# +# touch a file +# +def touch(fn, times=None): + with open(fn, 'a'): + os.utime(fn, times) |