Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
packages
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
infra
packages
Commits
4db7ebf8
Commit
4db7ebf8
authored
Apr 03, 2019
by
Lars Beckers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add painintheapt package with custom patches
parent
4ed24ebe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
231 additions
and
3 deletions
+231
-3
.gitlab-ci.yml
.gitlab-ci.yml
+32
-3
patches/painintheapt/01-httpjson.patch
patches/painintheapt/01-httpjson.patch
+63
-0
patches/painintheapt/02-remove-xmpp.patch
patches/painintheapt/02-remove-xmpp.patch
+109
-0
scripts/painintheapt.sh
scripts/painintheapt.sh
+27
-0
No files found.
.gitlab-ci.yml
View file @
4db7ebf8
image
:
stretch_packages
stages
:
-
build
-
test
before_script
:
-
export LANG=
en_US.UTF-8
-
export LANG=
"en_US.UTF-8"
-
export DEBIAN_FRONTEND="noninteractive"
-
export DEBIAN_PRIORITY="critical"
-
export DEBFULLNAME="FSMPI Admin-Team"
-
export DEBEMAIL="admin@fsmpi.rwth-aachen.de"
-
export QUILT_PATCHES="debian/patches"
sssd
:
stage
:
build
...
...
@@ -13,6 +18,8 @@ sssd:
artifacts
:
paths
:
-
packages/*
only
:
-
master
adcli
:
stage
:
build
...
...
@@ -20,6 +27,8 @@ adcli:
artifacts
:
paths
:
-
packages/*
only
:
-
master
nginx
:
stage
:
build
...
...
@@ -27,6 +36,8 @@ nginx:
artifacts
:
paths
:
-
packages/*
only
:
-
master
ganeti
:
stage
:
build
...
...
@@ -34,6 +45,8 @@ ganeti:
artifacts
:
paths
:
-
packages/*
only
:
-
master
grml-zsh-config
:
stage
:
build
...
...
@@ -41,6 +54,22 @@ grml-zsh-config:
artifacts
:
paths
:
-
packages/*
only
:
-
master
stages
:
-
build
painintheapt
:
stage
:
build
script
:
scripts/painintheapt.sh
artifacts
:
paths
:
-
packages/*
install-grml-zsh-config
:
stage
:
test
script
:
dpkg -i packages/grml-zsh-config*.deb
only
:
-
master
install-painintheapt
:
stage
:
test
script
:
dpkg -i packages/painintheapt*.deb
patches/painintheapt/01-httpjson.patch
0 → 100644
View file @
4db7ebf8
diff --git a/painintheapt b/painintheapt
index 9c2a27e..5fd816d 100755
--- a/painintheapt
+++ b/painintheapt
@@ -11,12 +11,14 @@
import email.mime.text
import email.utils
import hashlib
import html
+import json
import os
import smtplib
import socket
import subprocess
import sys
import textwrap
+import urllib.request
# additional modules
import apt
@@ -255,6 +257,29 @@
def sendmailx(config, config_dir, table, count, host, debug, changes):
mailx.wait()
+def sendhttpjson(config, config_dir, table, count, host, debug, changes):
+ """Send JSON encoded data via HTTP request."""
+ url = config.get("url", "http://localhost")
+ username = config.get("username", "")
+ password = read_password(config, config_dir)
+ data = json.dumps({'host': host,
+ 'packages': table,
+ 'changes': changes}).encode("utf-8")
+ headers = {"Content-Type": "application/json; charset=utf-8",
+ "Content-Length": len(data),
+ "User-Agent": longname}
+ request = urllib.request.Request(url, data, headers)
+ if username and password:
+ password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
+ password_mgr.add_password(None, url, username, password)
+ handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
+ opener = urllib.request.build_opener(handler)
+ urllib.request.install_opener(opener)
+ elif password:
+ headers["Authorization"] = "Device " + password
+ urllib.request.urlopen(request)
+
+
def has_changed(configfile, table, stampfile):
change = False
hashsum = hashlib.sha1()
@@ -302,10 +327,13 @@
if __name__ == '__main__':
ret = 0
for section, function in [("XMPP", sendxmpp),
+ ("HTTP", sendhttpjson),
("SMTP", sendsmtp),
("MAILX", sendmailx)]:
try:
if section in config.sections() and (change or args.force):
+ if section == "HTTP":
+ table = updates
send_changes = config[section].getboolean("send_changes", True)
function(config[section], config_dir, table, count, fqdn,
args.debug, get_changelogs(cache, send_changes))
patches/painintheapt/02-remove-xmpp.patch
0 → 100644
View file @
4db7ebf8
diff --git a/painintheapt b/painintheapt
index 5fd816d..505b160 100755
--- a/painintheapt
+++ b/painintheapt
@@ -23,7 +23,6 @@
import urllib.request
# additional modules
import apt
import prettytable
-import sleekxmpp
longname = "Pain in the APT"
shortname = "painintheapt"
@@ -118,54 +117,6 @@
def maketable(lst):
return table.get_string()
-class JabberBot(sleekxmpp.ClientXMPP):
- def __init__(self, jid, password, to, room, pubsub_service, pubsub_node,
- nick, subject, message):
- sleekxmpp.ClientXMPP.__init__(self, jid, password)
- self.to = to
- self.room = room
- self.pubsub_service = pubsub_service
- self.pubsub_node = pubsub_node
- self.nick = nick
- self.add_event_handler("session_start", self.start)
- self.subject = subject
- self.message = message
-
- def start(self, event):
- self.getRoster()
- self.sendPresence()
- for to in self.to:
- self.send_message(
- mto=to,
- msubject=self.subject,
- # subject is not shown by all clients, better add it to body
- mbody="\n".join([self.subject, self.message]),
- mtype='chat')
- if self.room:
- self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
- self.send_message(
- mto=self.room,
- # no per message subject in groupchats, add it to message body
- mbody="\n".join([self.subject, self.message]),
- mtype='groupchat')
- if self.pubsub_service and self.pubsub_node:
- payload = '<entry xmlns="http://www.w3.org/2005/Atom"><title>' \
- + html.escape(self.subject) \
- + '</title><content type="xhtml">' \
- + '<pre xmlns="http://www.w3.org/1999/xhtml">' \
- + html.escape(self.message) \
- + '</pre></content></entry>'
- self['xep_0060'].publish(
- self.pubsub_service, self.pubsub_node,
- payload=sleekxmpp.xmlstream.ET.fromstring(payload))
- try:
- self.disconnect(wait=True)
- except TypeError: # older SleekXMPP doesn't have "wait"
- import time
- time.sleep(10)
- self.disconnect()
-
-
def read_password(config, config_dir):
password_file = config.get("password_file", "").strip()
if len(password_file):
@@ -177,31 +128,6 @@
def read_password(config, config_dir):
return config.get("password", "")
-def sendxmpp(config, config_dir, table, count, host, debug, changes):
- """Send message to a jabber conference room."""
- jid = config.get("jid", "")
- password = read_password(config, config_dir)
- to = config.get("to", "").split(",")
- room = config.get("room")
- pubsub_service = config.get("pubsub_service", "").strip()
- pubsub_node = config.get("pubsub_node", "").strip()
- subject = '%d package update(s) for %s' % (count, host)
- xmpp = JabberBot(
- jid, password, to, room, pubsub_service, pubsub_node,
- longname, subject, "\n\n".join([table, changes]).strip())
- xmpp.register_plugin('xep_0030') # service discovery
- if room:
- xmpp.register_plugin('xep_0045') # multi-user chat
- if pubsub_service and pubsub_node:
- xmpp.register_plugin('xep_0060') # pubsub
- xmpp.register_plugin('xep_0199') # XMPP ping
-
- if xmpp.connect():
- xmpp.process(threaded=False)
- else:
- raise("XMPP connect() failed")
-
-
def sendsmtp(config, config_dir, table, count, host, debug, changes):
"""Send email by SMTP to whomsoever it may concern."""
server = config.get("server", "localhost")
@@ -326,8 +252,7 @@
if __name__ == '__main__':
change, newhash = has_changed(args.configfile, table, args.stampfile)
ret = 0
- for section, function in [("XMPP", sendxmpp),
- ("HTTP", sendhttpjson),
+ for section, function in [("HTTP", sendhttpjson),
("SMTP", sendsmtp),
("MAILX", sendmailx)]:
try:
scripts/painintheapt.sh
0 → 100755
View file @
4db7ebf8
#!/bin/bash
echo
"deb-src http://ftp.halifax.rwth-aachen.de/debian/ buster main"
>
/etc/apt/sources.list.d/buster_src.list
apt-get update
apt-get
source
--only-source
-t
buster painintheapt
VERSION
=
$(
rmadison painintheapt
--architecture
=
all
-s
buster |
cut
-d
\|
-f2
|
sed
s
"/ //g"
|
sed
s
"/
\-
.*
$/
/g"
)
cd
painintheapt-
$VERSION
for
patch
in
../patches/painintheapt/
*
.patch
;
do
quilt import
$patch
quilt push
done
sed
-i
'/python3-sleekxmpp/d'
debian/control
sed
-i
's/Build-Depends: debhelper (>= 11),/Build-Depends: debhelper (>= 10),/g'
debian/control
echo
"10"
>
debian/compat
mk-build-deps
--install
--remove
--tool
"apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes"
dch
--local
~bpo9+
--distribution
stretch-backports
"Rebuild for stretch-backports."
dch
--preserve
--newversion
${
VERSION
}
-fsmpi
"Add HTTP-JSON support."
dch
--preserve
--newversion
${
VERSION
}
-fsmpi
"Remove XMPP support."
debuild
-us
-uc
-nc
debi
--with-depends
cd
..
mkdir
packages
mv
*
.deb packages
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment