use new PVE::Tools::encrypt_pw, bump version to 5.0-3
[pve-access-control.git] / Makefile
index 04bc297..b0045bd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,6 @@
-RELEASE=2.1
-
-VERSION=1.0
+VERSION=5.0
 PACKAGE=libpve-access-control
-PKGREL=22
+PKGREL=3
 
 DESTDIR=
 PREFIX=/usr
@@ -10,68 +8,71 @@ BINDIR=${PREFIX}/bin
 SBINDIR=${PREFIX}/sbin
 MANDIR=${PREFIX}/share/man
 DOCDIR=${PREFIX}/share/doc/${PACKAGE}
-PODDIR=${DOCDIR}/pod
 MAN1DIR=${MANDIR}/man1/
+BASHCOMPLDIR=${PREFIX}/share/bash-completion/completions/
+
 export PERLDIR=${PREFIX}/share/perl5
 
 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+GITVERSION:=$(shell cat .git/refs/heads/master)
+
 DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
 
+# this requires package pve-doc-generator
+export NOVIEW=1
+include /usr/share/pve-doc-generator/pve-doc-generator.mk
+
 all: ${DEB}
 
 .PHONY: dinstall
 dinstall: deb
        dpkg -i ${DEB}
 
-%.1.gz: %.1.pod
-       rm -f $@
-       cat $<|pod2man -n $* -s 1 -r ${VERSION} -c "Proxmox Documentation"|gzip -c9 >$@.tmp
-       mv $@.tmp $@
-
-pveum.1.pod: pveum
-       perl -I. ./pveum printmanpod >$@.tmp
+pveum.bash-completion: PVE/CLI/pveum.pm
+       perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->generate_bash_completions();" >$@.tmp
        mv $@.tmp $@
 
 .PHONY: install
-install: pveum.1.pod pveum.1.gz
+install: pveum.1 oathkeygen pveum.bash-completion
        install -d ${DESTDIR}${BINDIR}
        install -d ${DESTDIR}${SBINDIR}
        install -m 0755 pveum ${DESTDIR}${SBINDIR}
+       install -m 0755 oathkeygen ${DESTDIR}${BINDIR}
        make -C PVE install
-       perl -I. ./pveum verifyapi 
-       install -d ${DESTDIR}/usr/share/man/man1
-       install -d ${DESTDIR}${PODDIR}
-       install -m 0644 pveum.1.gz ${DESTDIR}/usr/share/man/man1/
-       install -m 0644 pveum.1.pod ${DESTDIR}/${PODDIR}
+       perl -I. ./pveum verifyapi
+       perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->verify_api();"
+       install -d ${DESTDIR}/${MAN1DIR}
+       install -d ${DESTDIR}/${DOCDIR}
+       install -m 0644 pveum.1 ${DESTDIR}/${MAN1DIR}
+       gzip -9 -n ${DESTDIR}/${MAN1DIR}/pveum.1
+       install -m 0644 -D pveum.bash-completion ${DESTDIR}${BASHCOMPLDIR}/pveum
 
-.PHONY: deb ${DEB}
-deb ${DEB}:
+.PHONY: deb
+deb: ${DEB}
+${DEB}:
        rm -rf build
        mkdir build
        make DESTDIR=`pwd`/build install
        install -d -m 0755 build/DEBIAN
        sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ <control.in >build/DEBIAN/control
+       echo "git clone git://git.proxmox.com/git/pve-access-control.git\\ngit checkout ${GITVERSION}" >  build/${DOCDIR}/SOURCE
+       install -m 0644 triggers build/DEBIAN
        install -D -m 0644 copyright build/${DOCDIR}/copyright
        install -m 0644 changelog.Debian build/${DOCDIR}/
-       gzip -9 build/${DOCDIR}/changelog.Debian
-       dpkg-deb --build build  
+       gzip -9 -n build/${DOCDIR}/changelog.Debian
+       fakeroot dpkg-deb --build build
        mv build.deb ${DEB}
        #rm -rf build
        lintian ${DEB}
 
 .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
+       tar cf - ${DEB} | ssh repoman@repo.proxmox.com -- upload --product pve --dist stretch --arch ${ARCH}
 
 .PHONY: clean
-clean:         
-       rm -rf build *~ *.deb ${PACKAGE}-*.tar.gz pveum.1.pod pveum.1.gz
+clean:
+       make cleanup-docgen
+       rm -rf build *~ *.deb ${PACKAGE}-*.tar.gz pveum.1
        find . -name '*~' -exec rm {} ';'
 
 .PHONY: distclean