Announcer: put the state of the last version into /var/lib

This commit is contained in:
Dominique Leuenberger 2017-01-27 12:49:12 +01:00
parent e1d2862c4b
commit d05a0c80c0
Signed by untrusted user: dimstar
GPG Key ID: E69F22089B497C99

View File

@ -29,6 +29,7 @@ import os
import sys
import email.utils
from optparse import OptionParser
from xdg.BaseDirectory import save_data_path
parser = OptionParser()
parser.add_option("--dry", action="store_true", help="dry run")
@ -48,6 +49,7 @@ if not options.sender or not options.to or not options.relay:
url = "http://download.opensuse.org/tumbleweed/iso/"
iso = "openSUSE-Tumbleweed-DVD-x86_64-Current.iso"
changes = "Changes.%s.txt"
DATADIR = save_data_path('opensuse.org', 'factory-announcer')
intro = """
Please note that this mail was generated by a script.
The described changes are computed based on the x86_64 DVD.
@ -62,7 +64,7 @@ while discussing a specific problem.
"""
current_fn = os.path.join(os.path.dirname(__file__), "announcer-current-version")
current_fn = os.path.join(DATADIR, "announcer-current-version")
if not options.version:
u = urlparse(urljoin(url, iso))
@ -132,7 +134,7 @@ else:
s.sendmail(options.sender, [msg['To']], msg.as_string())
s.quit()
tmpfn = os.path.join(os.path.dirname(__file__), ".announcer-current-version")
tmpfn = os.path.join(DATADIR, ".announcer-current-version")
os.symlink(version, tmpfn)
os.rename(tmpfn, current_fn)