Mailinglist Archive: zypp-commit (545 mails)

< Previous Next >
[zypp-commit] r8792 - in /trunk/tools: ./ patch2mail/ patch2mail/README patch2mail/patch2mail patch2mail/patch2mail.spec patch2mail/patch2mail.xsl patch2mail/patch2mail.xsl_10.2
  • From: cboltz@xxxxxxxxxxxxxxxx
  • Date: Mon, 18 Feb 2008 22:02:26 -0000
  • Message-id: <20080218220226.B931D2D76D@xxxxxxxxxxxxxxxx>
Author: cboltz
Date: Mon Feb 18 23:02:26 2008
New Revision: 8792

URL: http://svn.opensuse.org/viewcvs/zypp?rev=8792&view=rev
Log:
Initial SVN commit of patch2mail

Short description:
patch2mail checks zypp-checkpatches-wrapper for available updates and
sends a mail to root if any patches are available.

This commit fixes https://bugzilla.novell.com/show_bug.cgi?id=283501 :-)


Added:
trunk/tools/
trunk/tools/patch2mail/
trunk/tools/patch2mail/README
trunk/tools/patch2mail/patch2mail (with props)
trunk/tools/patch2mail/patch2mail.spec
trunk/tools/patch2mail/patch2mail.xsl
trunk/tools/patch2mail/patch2mail.xsl_10.2

Added: trunk/tools/patch2mail/README
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/tools/patch2mail/README?rev=8792&view=auto
==============================================================================
--- trunk/tools/patch2mail/README (added)
+++ trunk/tools/patch2mail/README Mon Feb 18 23:02:26 2008
@@ -0,0 +1,38 @@
+patch2mail
+~~~~~~~~~~
+
+patch2mail checks zypp-checkpatches-wrapper for available updates and
+sends a mail to root if any patches are available.
+
+Usage is very simple: just install the RPM :-)
+It comes with the script in /etc/cron.daily and sends the mail to root.
+
+If you want to install this script manually, follow the %install section
+in patch2mail.spec ;-)
+
+
+Authors
+~~~~~~~
+
+Christian Boltz < p a c k a g e s AT c b o l t z DOT d e >
+
+Thanks to Thomas Schraitle for helping with some xslt details.
+
+
+License / Copyright
+~~~~~~~~~~~~~~~~~~~
+
+Copyright (c) 2007 Christian Boltz - www.cboltz.de
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License (http://www.gnu.org/copyleft/gpl.html)
+for more details.
+
+

Added: trunk/tools/patch2mail/patch2mail
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/tools/patch2mail/patch2mail?rev=8792&view=auto
==============================================================================
--- trunk/tools/patch2mail/patch2mail (added)
+++ trunk/tools/patch2mail/patch2mail Mon Feb 18 23:02:26 2008
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+tmp="$(mktemp /tmp/updates.XXXXXX)"
+
+/usr/sbin/zypp-checkpatches-wrapper | xsltproc
/usr/share/patch2mail/patch2mail.xsl - > "$tmp"
+grep "ERROR\|^===" "$tmp" >/dev/null || {
+ rm -f "$tmp"
+ exit 0 # no updates, no errors
+}
+
+grep -v "^__TOTAL__" "$tmp" | mail -s "$(hostname) updates" root
+# echo "*** $(hostname) updates ***"; grep -v "^__TOTAL__" "$tmp"
+rm -f "$tmp"

Added: trunk/tools/patch2mail/patch2mail.spec
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/tools/patch2mail/patch2mail.spec?rev=8792&view=auto
==============================================================================
--- trunk/tools/patch2mail/patch2mail.spec (added)
+++ trunk/tools/patch2mail/patch2mail.spec Mon Feb 18 23:02:26 2008
@@ -0,0 +1,62 @@
+# norootforbuild
+#
+Name: patch2mail
+Version: 0.9.1
+Release: 1
+#
+License: GPL
+Group: System/Packages
+#
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildRequires: bash
+#
+URL: http://www.cboltz.de
+Source: %{name}-%{version}.tar.bz2
+#
+Summary: patch2mail - patch notification via mail
+BuildArch: noarch
+
+Requires: bash mktemp mail grep zypper libxslt coreutils net-tools
+# detailed requirements:
+# zypper # zypp-checkpatches-wrapper
+# libxslt # xsltproc
+# coreutils # rm
+# net-tools # hostname
+
+%description
+patch2mail checks zypp-checkpatches-wrapper for available
+updates and sends a mail to root if any patches are available
+
+Authors:
+----------
+ Christian Boltz < p a c k a g e s AT c b o l t z DOT d e >
+
+%prep
+%setup
+
+%build
+
+%install
+%{__mkdir} -p %{buildroot}/usr/share/%{name}
+
+%if 0%{?suse_version} < 1030
+ %{__cp} patch2mail.xsl_10.2
%{buildroot}/usr/share/%{name}/patch2mail.xsl
+%else
+ %{__cp} patch2mail.xsl %{buildroot}/usr/share/%{name}/
+%endif
+
+%{__mkdir} -p %{buildroot}/etc/cron.daily
+%{__cp} patch2mail %{buildroot}/etc/cron.daily/
+
+echo === Buildroot: %{buildroot} ===
+find %{buildroot}
+echo ================================
+
+%clean
+
+%files
+%defattr(-,root,root)
+%attr(755, root, root) /etc/cron.daily/%{name}
+/usr/share/%{name}/
+/usr/share/%{name}/%{name}.xsl
+

Added: trunk/tools/patch2mail/patch2mail.xsl
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/tools/patch2mail/patch2mail.xsl?rev=8792&view=auto
==============================================================================
--- trunk/tools/patch2mail/patch2mail.xsl (added)
+++ trunk/tools/patch2mail/patch2mail.xsl Mon Feb 18 23:02:26 2008
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-15"?>
+<!--
+
+Copyright (c) 2007 Christian Boltz - www.cboltz.de
+
+Thanks to Thomas Schraitle for helping with some xslt details.
+
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License (http://www.gnu.org/copyleft/gpl.html)
+for more details.
+
+-->
+
+<xsl:stylesheet version="1.1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+
+<!-- <xsl:output method="text" encoding="ISO-8859-15" media-type="text/plain"
/> -->
+
+<xsl:strip-space elements="*"/>
+
+
+<xsl:template match="/"><xsl:apply-templates /></xsl:template>
+
+<xsl:template match="update-status">
+<xsl:document href="-" method="text" ><xsl:apply-templates />
+</xsl:document></xsl:template>
+
+
+<!-- errors -->
+
+<xsl:template match="errors"><xsl:apply-templates /></xsl:template>
+
+<xsl:template match="errors/error">
+ <xsl:text>*** ERROR ***&#10;</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>&#10;&#10;</xsl:text>
+</xsl:template>
+
+
+<!-- update sources -->
+
+<xsl:template match="update-sources">
+ <xsl:text>Update sources:&#10;</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="update-sources/source">
+ <xsl:text>- </xsl:text>
+ <xsl:value-of select="@alias" /> (<xsl:value-of select="@url" />)
+</xsl:template>
+
+
+<!-- updates -->
+
+<xsl:template match="update-list">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="update-list/update">
+<xsl:if test="@kind = 'patch'">
+ <xsl:text>&#10;=== </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text> - Patch </xsl:text>
+ <xsl:value-of select="@edition" />
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@category" />
+ <xsl:text>) ===&#10;&#10;</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>&#10;</xsl:text>
+</xsl:if>
+</xsl:template>
+
+<xsl:template match="update-list/update/summary">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="update-list/update/description">
+ <xsl:text>&#10;&#10;</xsl:text>
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- update source of this specific update isn't that interesting ;-) -->
+<!--
+<xsl:template match="update-list/update/source">Update source: <xsl:value-of
select="@alias" /> (<xsl:value-of select="@url" />)</xsl:template>
+-->
+
+
+<!-- summary -->
+
+<xsl:template match="update-summary">
+
<xsl:text>--------------------------------------------------------&#10;&#10;</xsl:text>
+ <xsl:text> Total: </xsl:text>
+ <xsl:value-of select="@total" />
+ <xsl:text> updates (</xsl:text>
+ <xsl:value-of select="@security" />
+ <xsl:text> security)&#10;__TOTAL__</xsl:text>
+ <xsl:value-of select="@total" /><xsl:value-of select="@security" />
+ <xsl:text>__&#10;</xsl:text>
+</xsl:template>
+
+
+<!-- end -->
+
+</xsl:stylesheet>

Added: trunk/tools/patch2mail/patch2mail.xsl_10.2
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/tools/patch2mail/patch2mail.xsl_10.2?rev=8792&view=auto
==============================================================================
--- trunk/tools/patch2mail/patch2mail.xsl_10.2 (added)
+++ trunk/tools/patch2mail/patch2mail.xsl_10.2 Mon Feb 18 23:02:26 2008
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="ISO-8859-15"?>
+<!--
+
+Copyright (c) 2007 Christian Boltz - www.cboltz.de
+
+Thanks to Thomas Schraitle for helping with some xslt details.
+
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License (http://www.gnu.org/copyleft/gpl.html)
+for more details.
+
+-->
+
+<xsl:stylesheet version="1.1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+
+<!-- <xsl:output method="text" encoding="ISO-8859-15" media-type="text/plain"
/> -->
+
+<xsl:strip-space elements="*"/>
+
+
+<xsl:template match="/"><xsl:apply-templates /></xsl:template>
+
+<xsl:template match="update-status">
+<xsl:document href="-" method="text" ><xsl:apply-templates />
+</xsl:document></xsl:template>
+
+
+<!-- errors -->
+
+<xsl:template match="errors"><xsl:apply-templates /></xsl:template>
+
+<xsl:template match="errors/error">
+ <xsl:text>*** ERROR ***&#10;</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>&#10;&#10;</xsl:text>
+</xsl:template>
+
+
+<!-- update sources -->
+
+<xsl:template match="update-sources">
+ <xsl:text>Update sources:&#10;</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="update-sources/source">
+ <xsl:text>- </xsl:text>
+ <xsl:value-of select="@alias" /> (<xsl:value-of select="@url" />)
+</xsl:template>
+
+
+<!-- updates -->
+
+<xsl:template match="update-list">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="update-list/update">
+ <xsl:text>&#10;=== </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text> - Patch </xsl:text>
+ <xsl:value-of select="@edition" />
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@category" />
+ <xsl:text>) ===&#10;&#10;</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="update-list/update/summary">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="update-list/update/description">
+ <xsl:text>&#10;&#10;</xsl:text>
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- update source of this specific update isn't that interesting ;-) -->
+<!--
+<xsl:template match="update-list/update/source">Update source: <xsl:value-of
select="@alias" /> (<xsl:value-of select="@url" />)</xsl:template>
+-->
+
+
+<!-- summary -->
+
+<xsl:template match="update-summary">
+
<xsl:text>--------------------------------------------------------&#10;&#10;</xsl:text>
+ <xsl:text> Total: </xsl:text>
+ <xsl:value-of select="@total" />
+ <xsl:text> updates (</xsl:text>
+ <xsl:value-of select="@security" />
+ <xsl:text> security)&#10;__TOTAL__</xsl:text>
+ <xsl:value-of select="@total" /><xsl:value-of select="@security" />
+ <xsl:text>__&#10;</xsl:text>
+</xsl:template>
+
+
+<!-- end -->
+
+</xsl:stylesheet>

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages