[pve-devel] r4950 - pve-common/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Aug 9 15:01:33 CEST 2010


Author: dietmar
Date: 2010-08-09 13:01:33 +0000 (Mon, 09 Aug 2010)
New Revision: 4950

Added:
   pve-common/trunk/ChangeLog
   pve-common/trunk/Exception.pm
   pve-common/trunk/changelog.Debian
   pve-common/trunk/control.in
   pve-common/trunk/copyright
Modified:
   pve-common/trunk/Makefile
Log:
create debain package - first try


Added: pve-common/trunk/Exception.pm
===================================================================
--- pve-common/trunk/Exception.pm	                        (rev 0)
+++ pve-common/trunk/Exception.pm	2010-08-09 13:01:33 UTC (rev 4950)
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+
+# a way to add more information to exceptions (see man perlfunc (die))
+# use PVE::Exception qw(raise);
+# raise (400, "my error message", param1 => 1, param2 => 2);
+
+package PVE::Exception;
+
+use strict;
+use vars qw(@ISA @EXPORT_OK);
+require Exporter;
+
+ at ISA = qw(Exporter);
+
+use overload '""' => sub {local $@; shift->stringify};
+
+ at EXPORT_OK = qw(raise);
+
+sub new {
+    my ($class, $code, $msg, %params) = @_;
+
+    $class = ref($class) || $class;
+
+    my $self = {
+	code => $code,
+	msg => $msg,
+    };
+
+    foreach my $p (keys %params) {
+	next if defined($self->{$p}); 
+	$self->{$p} = $params{$p};
+    }
+
+    return bless $self;
+}
+
+sub raise {
+
+    my ($pkg, $filename, $line) = caller;
+
+    my $exc = PVE::Exception->new(@_);
+    
+    $exc->{filename} = $filename;
+    $exc->{line} = $line;
+
+    die $exc;
+}
+
+sub stringify {
+    my $self = shift;
+    
+    my $msg = $self->{msg};
+
+    if ($msg !~ m/\n$/) {
+
+	if ($self->{filename} && $self->{line}) {
+	    $msg .= " at $self->{filename} line $self->{line}";
+	}
+
+	$msg .= "\n";
+    }
+
+    if ($self->{propagate}) {
+	foreach my $pi (@{$self->{propagate}}) {
+	    $msg .= "\t...propagated at $pi->[0] line $pi->[1]\n";
+	}
+    }
+
+    return $msg;
+}
+
+sub PROPAGATE {
+    my ($self, $file, $line) = @_;
+
+    push @{$self->{propagate}}, [$file, $line]; 
+
+    return $self;
+}
+
+1;


Property changes on: pve-common/trunk/Exception.pm
___________________________________________________________________
Added: svn:executable
   + *

Modified: pve-common/trunk/Makefile
===================================================================
--- pve-common/trunk/Makefile	2010-08-09 12:02:04 UTC (rev 4949)
+++ pve-common/trunk/Makefile	2010-08-09 13:01:33 UTC (rev 4950)
@@ -1,2 +1,67 @@
 RELEASE=2.0
 
+# also edit changelog.Debian
+VERSION=1.0
+PKGREL=1
+
+PACKAGE=libpve-common-perl
+
+DESTDIR=t
+PREFIX=/usr
+BINDIR=${PREFIX}/bin
+MANDIR=${PREFIX}/share/man
+DOCDIR=${PREFIX}/share/doc
+MAN1DIR=${MANDIR}/man1/
+PERLDIR=${PREFIX}/share/perl5
+
+ARCH=all
+DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
+
+LIB_SOURCES=			\
+	Exception.pm
+
+all: ${DEB}
+
+.PHONY: dinstall
+dinstall: deb
+	dpkg -i ${DEB}
+
+install: ${LIB_SOURCES}
+	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE
+	for i in ${LIB_SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/$$i; done
+
+.PHONY: deb
+deb ${DEB}: ${LIB_SOURCES} control.in copyright changelog.Debian ChangeLog
+	rm -rf debian
+	mkdir debian
+	make DESTDIR=debian install
+	install -d -m 0755 debian/DEBIAN
+	sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ <control.in >debian/DEBIAN/control
+	install -D -m 0644 copyright debian/${DOCDIR}/${PACKAGE}/copyright
+	install -m 0644 changelog.Debian debian/${DOCDIR}/${PACKAGE}/
+	gzip -9 debian/${DOCDIR}/${PACKAGE}/changelog.Debian
+	install -m 0644 ChangeLog debian/${DOCDIR}/${PACKAGE}/changelog
+	gzip -9 debian/${DOCDIR}/${PACKAGE}/changelog
+	dpkg-deb --build debian	
+	mv debian.deb ${DEB}
+	rm -rf debian
+	lintian ${DEB}
+
+.PHONY: clean
+clean: 	
+	rm -rf debian *~ *.deb ${PACKAGE}-*.tar.gz
+
+.PHONY: distclean
+distclean: clean
+
+
+.PHONY: upload
+upload: ${DEB}
+	umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw 
+	mkdir -p /pve/${RELEASE}/extra
+	rm -f /pve/${RELEASE}/extra/${PACKAGE}_*.deb
+	rm -f /pve/${RELEASE}/extra/Packages*
+	cp ${DEB} /pve/${RELEASE}/extra
+	cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
+	umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
+

Added: pve-common/trunk/changelog.Debian
===================================================================
--- pve-common/trunk/changelog.Debian	                        (rev 0)
+++ pve-common/trunk/changelog.Debian	2010-08-09 13:01:33 UTC (rev 4950)
@@ -0,0 +1,6 @@
+libpve-common-perl (1.0-1) unstable; urgency=low
+
+  * initial package
+
+ -- Proxmox Support Team <support at proxmox.com>  Mon, 09 Aug 2010 14:54:24 +0200
+

Added: pve-common/trunk/control.in
===================================================================
--- pve-common/trunk/control.in	                        (rev 0)
+++ pve-common/trunk/control.in	2010-08-09 13:01:33 UTC (rev 4950)
@@ -0,0 +1,9 @@
+Package: libpve-common-perl
+Version: @@VERSION@@-@@PKGRELEASE@@
+Section: perl
+Priority: optional
+Architecture: @@ARCH@@
+Depends: perl (>= 5.6.0-16)
+Maintainer: Proxmox Support Team <support at proxmox.com>
+Description: Proxmox VE base library
+ This package contains the base library used by other Proxmox VE components.

Added: pve-common/trunk/copyright
===================================================================
--- pve-common/trunk/copyright	                        (rev 0)
+++ pve-common/trunk/copyright	2010-08-09 13:01:33 UTC (rev 4950)
@@ -0,0 +1,20 @@
+Copyright (C) 2010 Proxmox Server Solutions GmbH
+
+This software is written by Proxmox Server Solutions GmbH <support at proxmox.com>
+
+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; version 2 dated June, 1991.
+
+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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA.
+
+The complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.



More information about the pve-devel mailing list