Merge pull request #230 from lnussel/master
some preparation to run as package
This commit is contained in:
commit
7f2f65b064
26
Makefile
Normal file
26
Makefile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
SUBDIRS = factory-package-news
|
||||||
|
|
||||||
|
prefix=/usr
|
||||||
|
datadir=$(prefix)/share
|
||||||
|
sysconfdir=/etc
|
||||||
|
unitdir=$(prefix)/lib/systemd/system
|
||||||
|
pkgdatadir=$(datadir)/osc-plugin-factory
|
||||||
|
oscplugindir=$(prefix)/lib/osc-plugins
|
||||||
|
pkgdata_SCRIPTS=$(wildcard *.py *.pl *.sh)
|
||||||
|
pkgdata_SCRIPTS+=bs_mirrorfull findfileconflicts
|
||||||
|
pkgdata_DATA+=bs_copy osclib $(wildcard *.pm *.testcase)
|
||||||
|
repocheckerhome = /var/lib/opensuse-repo-checker
|
||||||
|
|
||||||
|
all:
|
||||||
|
|
||||||
|
install:
|
||||||
|
install -d -m 755 $(DESTDIR)$(pkgdatadir) $(DESTDIR)$(unitdir) $(DESTDIR)$(oscplugindir)
|
||||||
|
install -d -m 755 $(DESTDIR)$(repocheckerhome)
|
||||||
|
for i in $(pkgdata_SCRIPTS); do install -m 755 $$i $(DESTDIR)$(pkgdatadir); done
|
||||||
|
chmod 644 $(DESTDIR)$(pkgdatadir)/osc-*.py
|
||||||
|
for i in $(pkgdata_DATA); do cp -a $$i $(DESTDIR)$(pkgdatadir); done
|
||||||
|
for i in osc-*.py osclib; do ln -s $(pkgdatadir)/$$i $(DESTDIR)$(oscplugindir)/$$i; done
|
||||||
|
for i in $(SUBDIRS); do $(MAKE) -C $$i install; done
|
||||||
|
install -m 644 systemd/* $(DESTDIR)$(unitdir)
|
||||||
|
|
||||||
|
.PHONY: all install
|
13
factory-package-news/Makefile
Normal file
13
factory-package-news/Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
prefix=/usr
|
||||||
|
sysconfdir=/etc
|
||||||
|
apachedir=$(sysconfdir)/apache2/conf.d
|
||||||
|
unitdir=$(prefix)/lib/systemd/system
|
||||||
|
|
||||||
|
install:
|
||||||
|
install -d -m 755 $(DESTDIR)$(apachedir) $(DESTDIR)$(unitdir) $(DESTDIR)$(sysconfdir)/rsyslog.d
|
||||||
|
install -m 644 systemd/* $(DESTDIR)$(unitdir)
|
||||||
|
install -m 644 rsyslog/* $(DESTDIR)$(sysconfdir)/rsyslog.d
|
||||||
|
install -m 644 apache/factory-package-news.conf $(DESTDIR)$(apachedir)/factory-package-news.conf.in
|
||||||
|
install -d -m 755 $(DESTDIR)/var/lib/factory-package-news
|
||||||
|
|
||||||
|
.PHONY: install
|
11
factory-package-news/apache/factory-package-news.conf
Normal file
11
factory-package-news/apache/factory-package-news.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
WSGIDaemonProcess factory-package-news user=_factory-news group=nogroup display-name=%{GROUP}
|
||||||
|
WSGIProcessGroup factory-package-news
|
||||||
|
|
||||||
|
WSGIScriptAlias /factory-package-news /usr/share/osc-plugin-factory/factory-package-news/factory-package-news-web.py
|
||||||
|
|
||||||
|
<Directory /usr/share/osc-plugin-factory/factory-package-news>
|
||||||
|
<Files factory-package-news-web.py>
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Files>
|
||||||
|
</Directory>
|
@ -1,4 +0,0 @@
|
|||||||
WSGIDaemonProcess factory-package-news user=FIXME group=FIXME display-name=%{GROUP}
|
|
||||||
WSGIProcessGroup factory-package-news
|
|
||||||
|
|
||||||
WSGIScriptAlias /factory-package-news FIXME/osc-plugin-factory/factory-package-news/factory-package-news-web.py
|
|
5
factory-package-news/rsyslog/factory-package-news.conf
Normal file
5
factory-package-news/rsyslog/factory-package-news.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
if ($programname == 'factory-package-news') then {
|
||||||
|
$template factorypackagenewsfile,"/var/log/factory-package-news/%$NOW%"
|
||||||
|
-?factorypackagenewsfile;RSYSLOG_TraditionalFileFormat
|
||||||
|
stop
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Announce new Factory snapshots
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/share/osc-plugin-factory/factory-package-news/announcer.py --from "Ludwig Nussel <ludwig.nussel@suse.de>" --to lnussel@suse.de --relay relay.suse.de
|
||||||
|
WorkingDirectory=/var/lib/factory-package-news
|
||||||
|
User=factoryauto
|
||||||
|
SyslogIdentifier=factory-package-news
|
9
factory-package-news/systemd/factory-package-news.timer
Normal file
9
factory-package-news/systemd/factory-package-news.timer
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Regular Factory snapshot announcer
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=hourly
|
||||||
|
AccuracySec=30m
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -31,8 +31,8 @@ from osc import cmdln
|
|||||||
|
|
||||||
|
|
||||||
# Expand sys.path to search modules inside the pluging directory
|
# Expand sys.path to search modules inside the pluging directory
|
||||||
_plugin_dir = os.path.expanduser('~/.osc-plugins')
|
PLUGINDIR = os.path.expanduser(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(_plugin_dir)
|
sys.path.append(PLUGINDIR)
|
||||||
from osclib.checkrepo import CheckRepo
|
from osclib.checkrepo import CheckRepo
|
||||||
from osclib.cycle import CycleDetector
|
from osclib.cycle import CycleDetector
|
||||||
from osclib.memoize import CACHEDIR
|
from osclib.memoize import CACHEDIR
|
||||||
@ -341,7 +341,7 @@ def _check_repo_group(self, id_, requests, debug=False):
|
|||||||
os.unlink(target)
|
os.unlink(target)
|
||||||
os.symlink(d, target)
|
os.symlink(d, target)
|
||||||
|
|
||||||
repochecker = os.path.join(self.plugin_dir, 'repo-checker.pl')
|
repochecker = os.path.join(PLUGINDIR, 'repo-checker.pl')
|
||||||
civs = "LC_ALL=C perl %s '%s' -r %s -f %s" % (repochecker, destdir, self.repo_dir, params_file.name)
|
civs = "LC_ALL=C perl %s '%s' -r %s -f %s" % (repochecker, destdir, self.repo_dir, params_file.name)
|
||||||
p = subprocess.Popen(civs, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
p = subprocess.Popen(civs, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
||||||
stdoutdata, stderrdata = p.communicate()
|
stdoutdata, stderrdata = p.communicate()
|
||||||
@ -512,10 +512,8 @@ def do_check_repo(self, subcmd, opts, *args):
|
|||||||
groups[request.group] = rqs
|
groups[request.group] = rqs
|
||||||
|
|
||||||
# Mirror the packages locally in the CACHEDIR
|
# Mirror the packages locally in the CACHEDIR
|
||||||
plugin = '~/.osc-plugins/osc-check_repo.py'
|
|
||||||
self.plugin_dir = os.path.dirname(os.path.realpath(os.path.expanduser(plugin)))
|
|
||||||
self.repo_dir = '%s/repo-%s-%s-x86_64' % (CACHEDIR, 'openSUSE:{}'.format(opts.project), 'standard')
|
self.repo_dir = '%s/repo-%s-%s-x86_64' % (CACHEDIR, 'openSUSE:{}'.format(opts.project), 'standard')
|
||||||
self._mirror_full(self.plugin_dir, self.repo_dir)
|
self._mirror_full(PLUGINDIR, self.repo_dir)
|
||||||
|
|
||||||
print
|
print
|
||||||
print 'Analysis results'
|
print 'Analysis results'
|
||||||
|
@ -17,8 +17,8 @@ from datetime import date
|
|||||||
from osc import cmdln, oscerr
|
from osc import cmdln, oscerr
|
||||||
|
|
||||||
# Expand sys.path to search modules inside the pluging directory
|
# Expand sys.path to search modules inside the pluging directory
|
||||||
_plugin_dir = os.path.expanduser('~/.osc-plugins')
|
PLUGINDIR = os.path.expanduser(os.path.dirname(os.path.realpath(__file__)))
|
||||||
sys.path.append(_plugin_dir)
|
sys.path.append(PLUGINDIR)
|
||||||
|
|
||||||
from osclib.stagingapi import StagingAPI
|
from osclib.stagingapi import StagingAPI
|
||||||
from osclib.comments import CommentAPI
|
from osclib.comments import CommentAPI
|
||||||
|
@ -25,8 +25,9 @@ except:
|
|||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
|
|
||||||
|
from xdg.BaseDirectory import save_cache_path
|
||||||
# Where the cache files are stored
|
# Where the cache files are stored
|
||||||
CACHEDIR = '/var/cache/repo-checker'
|
CACHEDIR = save_cache_path('opensuse-repo-checker')
|
||||||
|
|
||||||
|
|
||||||
def memoize(ttl=None):
|
def memoize(ttl=None):
|
||||||
|
@ -171,7 +171,7 @@ sub mirror_repo($$$) {
|
|||||||
my $repo = shift;
|
my $repo = shift;
|
||||||
my $arch = shift;
|
my $arch = shift;
|
||||||
|
|
||||||
my $repodir = "/var/cache/repo-checker/repo-$project-$repo-$arch";
|
my $repodir = ($ENV{XDG_CACHE_HOME}||<~>."/.cache")."/opensuse-repo-checker/repo-$project-$repo-$arch";
|
||||||
mkdir($repodir);
|
mkdir($repodir);
|
||||||
|
|
||||||
system(
|
system(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
PyYAML
|
PyYAML
|
||||||
pycurl
|
pycurl
|
||||||
urlgrabber
|
urlgrabber
|
||||||
|
pyxdg
|
||||||
git+https://github.com/openSUSE/osc
|
git+https://github.com/openSUSE/osc
|
||||||
|
|
||||||
# Dependencies for testing
|
# Dependencies for testing
|
||||||
|
2
systemd/opensuse-repo-checker.target
Normal file
2
systemd/opensuse-repo-checker.target
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=openSUSE repo checker
|
8
systemd/opensuse-repo-checker@.service
Normal file
8
systemd/opensuse-repo-checker@.service
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=openSUSE repo checker for %i
|
||||||
|
PartOf=opensuse-repo-checker.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/osc check_repo -p %i --dry
|
||||||
|
User=_opensuse-repo-checker
|
||||||
|
SyslogIdentifier=opensuse-repo-checker
|
9
systemd/opensuse-repo-checker@.timer
Normal file
9
systemd/opensuse-repo-checker@.timer
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=openSUSE repochecker for %i
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnUnitInactiveSec=15m
|
||||||
|
AccuracySec=5m
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
7
systemd/opensuse-totest-manager.service
Normal file
7
systemd/opensuse-totest-manager.service
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=openSUSE Factory ToTest Manager
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/osc totest
|
||||||
|
User=_opensuse-totest-manager
|
||||||
|
SyslogIdentifier=opensuse-totest-manager
|
9
systemd/opensuse-totest-manager.timer
Normal file
9
systemd/opensuse-totest-manager.timer
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=openSUSE Factory ToTest Manager Timer
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnUnitInactiveSec=15m
|
||||||
|
AccuracySec=5m
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
Loading…
x
Reference in New Issue
Block a user