aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile26
-rw-r--r--debian/changelog2
-rw-r--r--debian/control4
-rw-r--r--debian/pkg.pyinstall1
-rwxr-xr-xdebian/rules6
-rw-r--r--gpgkeys/rh.template (renamed from gpgkeys/gpg.template)0
-rw-r--r--gpgkeys/ubuntu.template14
-rw-r--r--sos/Makefile2
-rw-r--r--sos/plugins/Makefile2
-rw-r--r--sos/policies/Makefile2
-rw-r--r--sos/policies/debian.py26
-rw-r--r--sos/policies/redhat.py5
12 files changed, 42 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index ee4859ca..a15fe653 100644
--- a/Makefile
+++ b/Makefile
@@ -13,9 +13,11 @@ PYFILES = $(wildcard *.py)
# MSGCAT = /usr/local/Cellar/gettext/0.18.1.1/bin/msgcat
MSGCAT = msgcat
+# Default to Red Hat GPG template
+GPG_TPL=rh
-RPM_BUILD_DIR = rpm-build
-RPM_DEFINES = --define "_topdir %(pwd)/$(RPM_BUILD_DIR)" \
+DIST_BUILD_DIR = dist-build
+RPM_DEFINES = --define "_topdir %(pwd)/$(DIST_BUILD_DIR)" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
@@ -23,10 +25,10 @@ RPM_DEFINES = --define "_topdir %(pwd)/$(RPM_BUILD_DIR)" \
--define "_sourcedir %{_topdir}"
RPM = rpmbuild
RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
-ARCHIVE_DIR = $(RPM_BUILD_DIR)/$(NAME)-$(VERSION)
+ARCHIVE_DIR = $(DIST_BUILD_DIR)/$(NAME)-$(VERSION)
ARCHIVE_NAME = sosreport.zip
-SRC_BUILD = $(RPM_BUILD_DIR)/sdist
+SRC_BUILD = $(DIST_BUILD_DIR)/sdist
PO_DIR = $(SRC_BUILD)/sos/po
ZIP_DEST = $(SRC_BUILD)/$(ARCHIVE_NAME)
@@ -44,7 +46,7 @@ install: updateversion
install -m755 sosreport $(DESTDIR)/usr/sbin/sosreport
install -m644 sosreport.1.gz $(DESTDIR)/usr/share/man/man1/.
install -m644 sos.conf.5.gz $(DESTDIR)/usr/share/man/man5/.
- install -m644 LICENSE README TODO $(DESTDIR)/usr/share/$(NAME)/.
+ install -m644 LICENSE README $(DESTDIR)/usr/share/$(NAME)/.
install -m644 $(NAME).conf $(DESTDIR)/etc/$(NAME).conf
install -m644 gpgkeys/rhsupport.pub $(DESTDIR)/usr/share/$(NAME)/.
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
@@ -54,10 +56,10 @@ updateversion:
$(NAME)-$(VERSION).tar.gz: clean gpgkey
@mkdir -p $(ARCHIVE_DIR)
- @tar -cv sosreport sos doc man po sos.conf TODO LICENSE README sos.spec Makefile | tar -x -C $(ARCHIVE_DIR)
+ @tar -cv sosreport sos doc man po sos.conf LICENSE README sos.spec Makefile | tar -x -C $(ARCHIVE_DIR)
@mkdir -p $(ARCHIVE_DIR)/gpgkeys
- @cp gpgkeys/rhsupport.pub $(ARCHIVE_DIR)/gpgkeys/.
- @tar Ccvzf $(RPM_BUILD_DIR) $(RPM_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)
+ @cp gpgkeys/$(GPG_TPL)support.pub $(ARCHIVE_DIR)/gpgkeys/.
+ @tar Ccvzf $(DIST_BUILD_DIR) $(DIST_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)
clean:
@rm -fv *~ .*~ changenew ChangeLog.old $(NAME)-$(VERSION).tar.gz sosreport.1.gz sos.conf.5.gz
@@ -68,15 +70,15 @@ clean:
for d in $(SUBDIRS); do make -C $$d clean ; done
srpm: clean $(NAME)-$(VERSION).tar.gz
- $(RPM_WITH_DIRS) -ts $(RPM_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) -ts $(DIST_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz
rpm: clean $(NAME)-$(VERSION).tar.gz
- $(RPM_WITH_DIRS) -tb $(RPM_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) -tb $(DIST_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz
gpgkey:
@echo "Building gpg key"
- @test -f gpgkeys/rhsupport.pub && echo "GPG key already exists." || \
- gpg --batch --gen-key gpgkeys/gpg.template
+ @test -f gpgkeys/$(GPG_TPL)support.pub && echo "GPG key already exists." || \
+ gpg --batch --gen-key gpgkeys/$(GPG_TPL).template
po: clean
mkdir -p $(PO_DIR)
diff --git a/debian/changelog b/debian/changelog
index a788b652..a70f2c54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-sosreport (2.3) unstable; urgency=low
+sos (2.3) unstable; urgency=low
* Initial release.
diff --git a/debian/control b/debian/control
index 1625c69e..1e0f4f42 100644
--- a/debian/control
+++ b/debian/control
@@ -1,11 +1,11 @@
-Source: sosreport
+Source: sos
Maintainer: Adam Stokes <adam.stokes@canonical.com>
Section: python
Priority: optional
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 8), python-support, python (>=2.7), gettext
-Package: sosreport
+Package: sos
Architecture: any
Depends: ${python:Depends}, ${misc:Depends}
Description: A set of tools to gather troubleshooting information from a system
diff --git a/debian/pkg.pyinstall b/debian/pkg.pyinstall
new file mode 100644
index 00000000..b7005d31
--- /dev/null
+++ b/debian/pkg.pyinstall
@@ -0,0 +1 @@
+sos/* /usr/share/pyshared/sos/
diff --git a/debian/rules b/debian/rules
index 3e0dfd04..d1b7c05f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,3 +5,9 @@ DH_ALWAYS_EXCLUDE=.git
%:
dh $@
+override_dh_pysupport:
+ dh_python2 -p sos
+override_dh_fixperms:
+ dh_fixperms -Xsos
+override_dh_auto_test:
+
diff --git a/gpgkeys/gpg.template b/gpgkeys/rh.template
index 261f5b31..261f5b31 100644
--- a/gpgkeys/gpg.template
+++ b/gpgkeys/rh.template
diff --git a/gpgkeys/ubuntu.template b/gpgkeys/ubuntu.template
new file mode 100644
index 00000000..ac0e8b5e
--- /dev/null
+++ b/gpgkeys/ubuntu.template
@@ -0,0 +1,14 @@
+%echo Generating key...
+Key-Type: DSA
+Key-Length: 1024
+Subkey-Type: ELG-E
+Subkey-Length: 1024
+Name-Real: Ubuntu Support
+Name-Comment: SoS Encryption Key
+Name-Email: support@canonical.com
+Expire-Date: 0
+Passphrase: ubuntutemplateexample
+%pubring gpgkeys/ubuntusupport.pub
+%secring gpgkeys/ubuntusupport.key
+%commit
+%echo done
diff --git a/sos/Makefile b/sos/Makefile
index 018840ef..de3f8498 100644
--- a/sos/Makefile
+++ b/sos/Makefile
@@ -14,6 +14,6 @@ clean:
install:
mkdir -p $(DESTDIR)/$(PKGDIR)
for p in $(wildcard *.py) ; do \
- install -m 755 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
+ install -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
done
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
diff --git a/sos/plugins/Makefile b/sos/plugins/Makefile
index 8fd6a1bf..06815cb2 100644
--- a/sos/plugins/Makefile
+++ b/sos/plugins/Makefile
@@ -15,6 +15,6 @@ clean:
install:
mkdir -p $(DESTDIR)/$(PKGDIR)
for p in $(PYFILES) ; do \
- install -m 755 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
+ install -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
done
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
diff --git a/sos/policies/Makefile b/sos/policies/Makefile
index 8fd6a1bf..06815cb2 100644
--- a/sos/policies/Makefile
+++ b/sos/policies/Makefile
@@ -15,6 +15,6 @@ clean:
install:
mkdir -p $(DESTDIR)/$(PKGDIR)
for p in $(PYFILES) ; do \
- install -m 755 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
+ install -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
done
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
diff --git a/sos/policies/debian.py b/sos/policies/debian.py
index 0d6bcec9..5b7f2af2 100644
--- a/sos/policies/debian.py
+++ b/sos/policies/debian.py
@@ -1,38 +1,14 @@
-from __future__ import with_statement
-
from sos.plugins import DebianPlugin
from sos.policies import PackageManager, LinuxPolicy
-from sos.utilities import shell_out
import os
-class DebianPackageManager(PackageManager):
-
- def _get_deb_list(self):
- pkg_list = shell_out(["dpkg-query",
- "-W",
- "-f=",
- "'${Package}|${Version}\\n' \*"]).splitlines()
- self._debs = {}
- for pkg in pkg_list:
- name, version = pkg.split("|")
- self._debs[name] = {
- 'name': name,
- 'version': version
- }
-
- def allPkgs(self):
- if not self._debs:
- self._debs = self._get_deb_list()
- return self._debs
-
-
class DebianPolicy(LinuxPolicy):
def __init__(self):
super(DebianPolicy, self).__init__()
self.reportName = ""
self.ticketNumber = ""
- self.package_manager = DebianPackageManager()
+ self.package_manager = PackageManager("dpkg-query -W -f='${Package}|${Version}\\n' \*")
self.valid_subclasses = [DebianPlugin]
self.distro = "Debian"
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index 89e6e9b2..c17e4420 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -1,5 +1,3 @@
-## Implement policies required for the sos system support tool
-
## Copyright (C) Steve Conklin <sconklin@redhat.com>
### This program is free software; you can redistribute it and/or modify
@@ -17,14 +15,11 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# This enables the use of with syntax in python 2.5 (e.g. jython)
-from __future__ import with_statement
-
import os
import sys
from sos.plugins import RedHatPlugin
from sos.policies import LinuxPolicy, PackageManager
-from sos.utilities import shell_out
sys.path.insert(0, "/usr/share/rhn/")
try: