From c6bf42d6bbea51b37a1659ace5f0c12f5dcbbb72 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 10 Nov 2021 11:39:29 +0200 Subject: [PATCH] rename --- ...ortune-mod-debian-package--using-docker.pl | 104 +++++++++++++++++ scripts/debian-packaging/docker-test.pl | 105 +----------------- 2 files changed, 105 insertions(+), 104 deletions(-) create mode 100644 scripts/debian-packaging/build-fortune-mod-debian-package--using-docker.pl mode change 100644 => 120000 scripts/debian-packaging/docker-test.pl diff --git a/scripts/debian-packaging/build-fortune-mod-debian-package--using-docker.pl b/scripts/debian-packaging/build-fortune-mod-debian-package--using-docker.pl new file mode 100644 index 0000000..b2d22ce --- /dev/null +++ b/scripts/debian-packaging/build-fortune-mod-debian-package--using-docker.pl @@ -0,0 +1,104 @@ +#! /usr/bin/env perl + +use strict; +use warnings; +use 5.014; +use autodie; + +use Path::Tiny qw/ cwd /; +use Docker::CLI::Wrapper::Container v0.0.4 (); + +my $obj = Docker::CLI::Wrapper::Container->new( + { container => "fortune-mod--deb--test-build", sys => "debian:sid", } ); + +my $USER = "mygbp"; +my $HOMEDIR = "/home/$USER"; + +$obj->clean_up(); +$obj->run_docker(); +my $REPO = 'fortune-mod'; +my $URL = "https://salsa.debian.org/shlomif-guest/$REPO"; + +if ( !-e $REPO ) +{ + $obj->do_system( { cmd => [ "git", "clone", $URL, ] } ); +} +my $cwd = cwd; +chdir "./$REPO"; +$obj->do_system( { cmd => [ "git", "pull", "--ff-only", ] } ); +chdir $cwd; + +my $LOG_FN = "git-buildpackage-log.txt"; + +my $BASH_SAFETY = "set -e -x ; set -o pipefail ; "; + +# $obj->docker( { cmd => [ 'cp', "../scripts", "fcsfed:scripts", ] } ); +my $script = <<"EOSCRIPTTTTTTT"; +$BASH_SAFETY +apt-get -y update +apt-get -y install eatmydata sudo +sudo eatmydata apt -y install build-essential chrpath cmake git-buildpackage librecode-dev perl recode +sudo adduser --disabled-password --gecos '' "$USER" +sudo usermod -a -G sudo "$USER" +echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +EOSCRIPTTTTTTT + +$obj->exe_bash_code( { code => $script, } ); + +$obj->docker( + { cmd => [ 'cp', "./$REPO", $obj->container() . ":$HOMEDIR/$REPO", ] } ); +$obj->exe_bash_code( + { + code => "$BASH_SAFETY chown -R $USER:$USER $HOMEDIR", + } +); + +$script = <<"EOSCRIPTTTTTTT"; +$BASH_SAFETY +cd "$HOMEDIR/$REPO" +git clean -dxf . +(if ! gbp buildpackage 2>&1 ; then cat /tmp/fort*diff* ; exit 1 ; fi) | tee ~/"$LOG_FN" +EOSCRIPTTTTTTT + +$obj->exe_bash_code( + { + user => $USER, + code => $script, + } +); +$obj->docker( + { cmd => [ 'cp', $obj->container() . ":$HOMEDIR/$LOG_FN", $LOG_FN, ] } ); + +$obj->clean_up(); + +__END__ + +=head1 COPYRIGHT & LICENSE + +Copyright 2019 by Shlomi Fish + +This program is distributed under the MIT / Expat License: +L + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +=cut diff --git a/scripts/debian-packaging/docker-test.pl b/scripts/debian-packaging/docker-test.pl deleted file mode 100644 index b2d22ce..0000000 --- a/scripts/debian-packaging/docker-test.pl +++ /dev/null @@ -1,104 +0,0 @@ -#! /usr/bin/env perl - -use strict; -use warnings; -use 5.014; -use autodie; - -use Path::Tiny qw/ cwd /; -use Docker::CLI::Wrapper::Container v0.0.4 (); - -my $obj = Docker::CLI::Wrapper::Container->new( - { container => "fortune-mod--deb--test-build", sys => "debian:sid", } ); - -my $USER = "mygbp"; -my $HOMEDIR = "/home/$USER"; - -$obj->clean_up(); -$obj->run_docker(); -my $REPO = 'fortune-mod'; -my $URL = "https://salsa.debian.org/shlomif-guest/$REPO"; - -if ( !-e $REPO ) -{ - $obj->do_system( { cmd => [ "git", "clone", $URL, ] } ); -} -my $cwd = cwd; -chdir "./$REPO"; -$obj->do_system( { cmd => [ "git", "pull", "--ff-only", ] } ); -chdir $cwd; - -my $LOG_FN = "git-buildpackage-log.txt"; - -my $BASH_SAFETY = "set -e -x ; set -o pipefail ; "; - -# $obj->docker( { cmd => [ 'cp', "../scripts", "fcsfed:scripts", ] } ); -my $script = <<"EOSCRIPTTTTTTT"; -$BASH_SAFETY -apt-get -y update -apt-get -y install eatmydata sudo -sudo eatmydata apt -y install build-essential chrpath cmake git-buildpackage librecode-dev perl recode -sudo adduser --disabled-password --gecos '' "$USER" -sudo usermod -a -G sudo "$USER" -echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers -EOSCRIPTTTTTTT - -$obj->exe_bash_code( { code => $script, } ); - -$obj->docker( - { cmd => [ 'cp', "./$REPO", $obj->container() . ":$HOMEDIR/$REPO", ] } ); -$obj->exe_bash_code( - { - code => "$BASH_SAFETY chown -R $USER:$USER $HOMEDIR", - } -); - -$script = <<"EOSCRIPTTTTTTT"; -$BASH_SAFETY -cd "$HOMEDIR/$REPO" -git clean -dxf . -(if ! gbp buildpackage 2>&1 ; then cat /tmp/fort*diff* ; exit 1 ; fi) | tee ~/"$LOG_FN" -EOSCRIPTTTTTTT - -$obj->exe_bash_code( - { - user => $USER, - code => $script, - } -); -$obj->docker( - { cmd => [ 'cp', $obj->container() . ":$HOMEDIR/$LOG_FN", $LOG_FN, ] } ); - -$obj->clean_up(); - -__END__ - -=head1 COPYRIGHT & LICENSE - -Copyright 2019 by Shlomi Fish - -This program is distributed under the MIT / Expat License: -L - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -=cut diff --git a/scripts/debian-packaging/docker-test.pl b/scripts/debian-packaging/docker-test.pl new file mode 120000 index 0000000..b3afc8c --- /dev/null +++ b/scripts/debian-packaging/docker-test.pl @@ -0,0 +1 @@ +build-fortune-mod-debian-package--using-docker.pl \ No newline at end of file -- 2.40.0