From: Michael Howe Date: Tue, 26 Dec 2023 09:53:11 +0000 (+0000) Subject: More build-package improvements: X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=HEAD;p=packages%2Fm%2Fmh-sysadmin-tools.git More build-package improvements: * build-package: add --no-sign option to avoid signing changes files * build-package: add --no-sign option to avoid signing changes files * build-package: only sign source changes files if no others available * build-package-multi: use --no-sign option --- diff --git a/bin/build-package b/bin/build-package index c8af901..d3bbb44 100755 --- a/bin/build-package +++ b/bin/build-package @@ -10,6 +10,7 @@ use Cwd; use Dpkg::Control; use Dpkg::Changelog; use File::Basename; +use Net::Domain qw(hostfqdn); use Data::Dumper; @@ -32,6 +33,7 @@ my $dsc; # optional; allows use of a dsc directly my $os = 'debian'; my $binary_only; my $local_outputdir; +my $no_sign; GetOptions( "arch=s" => \@archs, @@ -40,6 +42,7 @@ GetOptions( "dsc=s" => \$dsc, 'binary-only' => \$binary_only, "output-dir=s" => \$local_outputdir, + "no-sign" => \$no_sign, ); my $path = $ARGV[0]; @@ -173,16 +176,30 @@ system( @rsynccmd ) == 0 # Note that this currently won't work #my @sshcleanupcmd = ( $ssh, "rm", "-rf", $remote_outputdir ); -my @changefiles = glob( "$local_outputdir/*.changes" ); +my @changefiles; +my @all_changefiles = glob( "$local_outputdir/*.changes" ); +my @nonsrc_changefiles = grep( !/_source.changes/, @all_changefiles ); +if ( @nonsrc_changefiles ){ + @changefiles = @nonsrc_changefiles; +} else { + @changefiles = @all_changefiles; +} -foreach my $changefile ( @changefiles ){ - my @debsigncmd = ( $debsign, @debsign_opts, $changefile ); - print "Signing $changefile\n"; - system( @debsigncmd ) == 0 - or warn "Could not sign changes file $changefile: $!"; +if( $no_sign ){ + print "\nNot signing changes files - if needing to do so remotely, run:\n"; + foreach my $changefile( @changefiles ){ + print "\tdebsign -r " . hostfqdn() . " $changefile\n"; + } +} else { + foreach my $changefile ( @changefiles ){ + my @debsigncmd = ( $debsign, @debsign_opts, $changefile ); + print "Signing $changefile\n"; + system( @debsigncmd ) == 0 + or warn "Could not sign changes file $changefile: $!"; + } } -print "Build complete in $local_outputdir\n"; +print "\nBuild complete in $local_outputdir\n"; sub get_source_format { unless( -f "debian/source/format" ){ diff --git a/bin/build-package-multi b/bin/build-package-multi index 355fc7e..58be266 100755 --- a/bin/build-package-multi +++ b/bin/build-package-multi @@ -24,7 +24,7 @@ for BUILDSTRING in "${BUILD_ARRAY[@]}"; do ARCH=${BUILDSTRING%:*} ARCH=${ARCH##*:} OS=${BUILDSTRING##*:} - $BUILDPACKAGE --dist "$DIST" --arch "$ARCH" --os "$OS" --output-dir "$OUTPUTDIR" . + $BUILDPACKAGE --dist "$DIST" --arch "$ARCH" --os "$OS" --output-dir "$OUTPUTDIR" --no-sign . CHANGELIST="${CHANGELIST} ${OUTPUTDIR}/*_${ARCH}.changes" done diff --git a/debian/changelog b/debian/changelog index 7ad6c25..c4eb007 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +mh-sysadmin-tools (1.7~test.0) UNRELEASED; urgency=medium + + * build-package: add --no-sign option to avoid signing changes files + * build-package: only sign source changes files if no others available + * build-package-multi: use --no-sign option + + -- Michael Howe Tue, 26 Dec 2023 09:49:56 +0000 + mh-sysadmin-tools (1.6) unstable; urgency=low * build-package: new script for package building via cowbuilder/pbuilder