Skip to content

Commit

Permalink
Merge pull request #91 from garlick/debbuild
Browse files Browse the repository at this point in the history
add test deb packaging and fix misc build problems
  • Loading branch information
mergify[bot] authored Jan 25, 2024
2 parents adf94a9 + f0df009 commit c7cb796
Show file tree
Hide file tree
Showing 23 changed files with 167 additions and 123 deletions.
8 changes: 7 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ install-data-local:
EXTRA_DIST = \
DISCLAIMER \
examples/powerman_el72.spec \
config/tap-driver.sh
config/tap-driver.sh \
scripts/debbuild.sh \
scripts/install-deps-deb.sh

export DEB_BUILD_OPTIONS ?= nocheck terse
deb: debian scripts/debbuild.sh
+@$(top_srcdir)/scripts/debbuild.sh $(abs_top_srcdir)
23 changes: 9 additions & 14 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#!/bin/sh
echo "Running aclocal ... "
aclocal -I config
echo "Running libtoolize ... "
libtoolize --force --automake --copy
echo "Running autoheader ... "
autoheader
echo "Running automake ... "
automake --copy --add-missing
echo "Running autoconf ... "
autoconf
echo "Cleaning up ..."
mv aclocal.m4 config/
rm -rf autom4te.cache

#
# Run an extra libtoolize before autoreconf to ensure that
# libtool macros can be found if libtool is in PATH, but its
# macros are not in default aclocal search path.
#
echo "Running libtoolize --automake --copy ... "
libtoolize --automake --copy || exit
echo "Running autoreconf --force --verbose --install"
autoreconf --force --verbose --install || exit
echo "Now run ./configure."
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Prologue.
##
AC_INIT([powerman],
m4_esyscmd([git describe --always | awk '/.*/ {printf "%s",$1; exit}']))
m4_esyscmd([git describe --always | awk '/.*/ {sub(/^v/, ""); printf "%s",$1; exit}']))
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([NEWS])
Expand Down Expand Up @@ -141,7 +141,6 @@ AC_CONFIG_FILES( \
man/redfishpower.8 \
man/plmpower.8 \
man/powermand.8 \
man/vpcd.8 \
test/Makefile \
test/mcr.conf
test/sierra.conf \
Expand Down
Empty file added debian/README.Debian
Empty file.
Empty file added debian/README.source
Empty file.
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
18 changes: 18 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Source: powerman
Section: devel
Priority: optional
Maintainer: Jim Garlick <garlick.jim@gmail.com>
Standards-Version: 4.1.2
Build-Depends:
debhelper (>= 10),
bison,
flex,
libsnmp-dev,
libcurl4-gnutls-dev,
libgenders-dev

Homepage: https://github.com/chaos/powerman
Package: powerman
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Power Control Utility
28 changes: 28 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Files: *
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: powerman
Source: <https://github.com/chaos/powerman>

Files: *
Copyright: 2001 The Regents of the University of California
Copyright: 2007 Lawrence Livermore National Security, LLC
License: GPL-2+

Files: debian/*
Copyright: 2024 Jim Garlick <garlick.jim@gmail.com>
License: GPL-3+
This package 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 3 of the License, or
(at your option) any later version.
.
This package 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, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
1 change: 1 addition & 0 deletions debian/powerman-docs.docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.Debian
26 changes: 26 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
dh $@

override_dh_auto_configure:
dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system --with-tcp-wrappers --with-genders --with-httppower --with-redfishpower --with-snmppower

override_dh_autoreconf:
@echo not running autogen.sh on dist product

override_dh_auto_install:
dh_auto_install
find . -name '*.la' -delete
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
2 changes: 1 addition & 1 deletion man/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
man1_MANS = powerman.1 pm.1
man3_MANS = libpowerman.3
man5_MANS = powerman.conf.5 powerman.dev.5
man8_MANS = powermand.8 httppower.8 redfishpower.8 plmpower.8 vpcd.8
man8_MANS = powermand.8 httppower.8 redfishpower.8 plmpower.8

pm.1: powerman.1
cp powerman.1 $@
Expand Down
85 changes: 0 additions & 85 deletions man/vpcd.8.in

This file was deleted.

41 changes: 41 additions & 0 deletions scripts/debbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
PACKAGE=powerman
USER=$(git config --get user.name)
DEBFULLNAME=$USER
EMAIL=$(git config --get user.email)
DEBEMAIL=$EMAIL

SRCDIR=${1:-$(pwd)}

die() { echo "debbuild: $@" >&2; exit 1; }
log() { echo "debbuild: $@"; }

test -z "$USER" && die "User name not set in git-config"
test -z "$EMAIL" && die "User email not set in git-config"

log "Running make dist"
make dist >/dev/null || exit 1

log "Building package from latest dist tarball"
tarball=$(ls -tr *.tar.gz | tail -1)
version=$(echo $tarball | sed "s/${PACKAGE}-\(.*\)\.tar\.gz/\1/")

rm -rf debbuild
mkdir -p debbuild && cd debbuild

mv ../$tarball .

log "Unpacking $tarball"
tar xvfz $tarball >/dev/null

log "Creating debian directory and files"
cd ${PACKAGE}-${version}
cp -a ${SRCDIR}/debian . || die "failed to copy debian dir"

export DEBEMAIL DEBFULLNAME
log "Creating debian/changelog"
dch --create --package=$PACKAGE --newversion $version build tree release

log "Running debian-buildpackage -b"
dpkg-buildpackage -b
log "Check debbuild directory for results"
12 changes: 12 additions & 0 deletions scripts/install-deps-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

apt install \
autoconf \
automake \
libtool \
make \
bison \
flex \
libsnmp-dev \
libcurl4-gnutls-dev \
libgenders-dev
2 changes: 1 addition & 1 deletion src/httppower/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ sbin_PROGRAMS = httppower

httppower_SOURCES = httppower.c
httppower_LDADD = \
$(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/libcommon/libcommon.la \
$(LIBCURL) \
$(LIBFORKPTY)
8 changes: 4 additions & 4 deletions src/libcommon/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ AM_CFLAGS = @WARNING_CFLAGS@
AM_CPPFLAGS = \
-I$(top_srcdir)/src/liblsd

noinst_LIBRARIES = libcommon.a
noinst_LTLIBRARIES = libcommon.la

libcommon_a_SOURCES = \
libcommon_la_SOURCES = \
argv.c \
argv.h \
debug.c \
Expand Down Expand Up @@ -45,12 +45,12 @@ test_argv_t_CPPFLAGS = \
-I$(top_srcdir)/src/libtap
test_argv_t_SOURCES = test/argv.c
test_argv_t_LDADD = \
$(builddir)/libcommon.a \
$(builddir)/libcommon.la \
$(top_builddir)/src/libtap/libtap.la

test_xregex_t_CPPFLAGS = \
-I$(top_srcdir)/src/libtap
test_xregex_t_SOURCES = test/xregex.c
test_xregex_t_LDADD = \
$(builddir)/libcommon.a \
$(builddir)/libcommon.la \
$(top_builddir)/src/libtap/libtap.la
4 changes: 2 additions & 2 deletions src/liblsd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ AM_CFLAGS = \

AM_CPPFLAGS =

noinst_LIBRARIES = liblsd.a
noinst_LTLIBRARIES = liblsd.la

liblsd_a_SOURCES = \
liblsd_la_SOURCES = \
hostlist.c \
hostlist.h \
list.c \
Expand Down
2 changes: 1 addition & 1 deletion src/plmpower/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ sbin_PROGRAMS = plmpower
plmpower_SOURCES = plmpower.c

plmpower_LDADD = \
$(top_builddir)/src/libcommon/libcommon.a
$(top_builddir)/src/libcommon/libcommon.la

15 changes: 8 additions & 7 deletions src/powerman/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ powerman_SOURCES = \
powerman.c

powerman_LDADD = \
$(top_builddir)/src/liblsd/liblsd.a \
$(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/liblsd/liblsd.la \
$(top_builddir)/src/libcommon/libcommon.la \
$(LIBGENDERS) \
$(LIBFORKPTY)

Expand Down Expand Up @@ -57,9 +57,10 @@ powermand_SOURCES = \
powermand.c

powermand_LDADD = \
$(top_builddir)/src/liblsd/liblsd.a \
$(top_builddir)/src/libcommon/libcommon.a \
$(LIBWRAP) $(LIBFORKPTY)
$(top_builddir)/src/liblsd/liblsd.la \
$(top_builddir)/src/libcommon/libcommon.la \
$(LIBWRAP) \
$(LIBFORKPTY)

AM_YFLAGS = -d

Expand All @@ -80,8 +81,8 @@ check_PROGRAMS = \
test_pluglist_SOURCES = test/pluglist.c
test_pluglist_LDADD = \
$(builddir)/pluglist.o \
$(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/liblsd/liblsd.a
$(top_builddir)/src/libcommon/libcommon.la \
$(top_builddir)/src/liblsd/liblsd.la

test_apiclient_SOURCES = test/apiclient.c
test_apiclient_LDADD = \
Expand Down
4 changes: 2 additions & 2 deletions src/redfishpower/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sbin_PROGRAMS = redfishpower

redfishpower_SOURCES = redfishpower.c
redfishpower_LDADD = \
$(top_builddir)/src/liblsd/liblsd.a \
$(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/liblsd/liblsd.la \
$(top_builddir)/src/libcommon/libcommon.la \
$(LIBCURL) \
$(LIBJANSSON)
2 changes: 1 addition & 1 deletion src/snmppower/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ sbin_PROGRAMS = snmppower

snmppower_SOURCES = snmppower.c
snmppower_LDADD = \
$(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/libcommon/libcommon.la \
$(LIBNETSNMP) \
$(LIBFORKPTY)
Loading

0 comments on commit c7cb796

Please sign in to comment.