From 470b3ab5f7557c7aabd3e9dc0cd7fa29e86b04e4 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sun, 1 Mar 2020 19:05:56 +0200 Subject: [PATCH] add the prog to build deb pkgs - WiP --- scripts/debian-packaging/docker-test.pl | 98 +++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 scripts/debian-packaging/docker-test.pl diff --git a/scripts/debian-packaging/docker-test.pl b/scripts/debian-packaging/docker-test.pl new file mode 100644 index 0000000..27116ed --- /dev/null +++ b/scripts/debian-packaging/docker-test.pl @@ -0,0 +1,98 @@ +#! /usr/bin/env perl +# +# Short description for docker-test.pl +# +# Author Shlomi Fish +# Version 0.0.1 +# Copyright (C) 2019 Shlomi Fish +# +use strict; +use warnings; +use 5.014; +use autodie; + +use Path::Tiny qw/ path tempdir tempfile cwd /; + +sub do_system +{ + my ($args) = @_; + + my $cmd = $args->{cmd}; + print "Running [@$cmd]\n"; + if ( system(@$cmd) ) + { + die "Running [@$cmd] failed!"; + } +} + +my @deps; #= map { /^BuildRequires:\s*(\S+)/ ? ("'$1'") : () } + +# path("freecell-solver.spec.in")->lines_utf8; +my $SYS = "debian:sid"; +my $CONTAINER = "fortune-mod--deb--test-build"; +do_system( { cmd => [ 'docker', 'pull', $SYS ] } ); +do_system( + { cmd => [ 'docker', 'run', "-t", "-d", "--name", $CONTAINER, $SYS, ] } ); +my $REPO = 'fortune-mod' my $URL = + "https://salsa.debian.org/shlomif-guest/$REPO"; +if ( !-e $REPO ) +{ + do_system( { cmd => [ "git", "clone", $URL, ] } ); +} +my $cwd = cwd; +chdir "./$REPO"; +do_system( { cmd => [ "git", "pull", ] } ); +do_system( { cmd => [ "git", "checkout", "upstream", ] } ); +chdir $cwd; +do_system( { cmd => [ 'docker', 'cp', "./$REPO", "$CONTAINER:$REPO", ] } ); + +# do_system( { cmd => [ 'docker', 'cp', "../scripts", "fcsfed:scripts", ] } ); +my $script = <<"EOSCRIPTTTTTTT"; +set -e -x +curl 'https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-31&arch=x86_64' +sudo dnf -y install cmake gcc gcc-c++ git glibc-devel libcmocka-devel make perl-autodie perl-Path-Tiny python3-pip @deps +sudo pip3 install --prefix=/usr freecell_solver +pip3 install --user freecell_solver +mkdir b +cd b +perl ../scripts/Tatzer +make +FCS_TEST_BUILD=1 perl ../source/run-tests.pl --glob='build*.t' +EOSCRIPTTTTTTT + +do_system( + { cmd => [ 'docker', 'exec', $CONTAINER, 'bash', '-c', $script, ] } ); +do_system( { cmd => [ 'docker', 'stop', $CONTAINER, ] } ); +do_system( { cmd => [ 'docker', 'rm', $CONTAINER, ] } ); + +__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 -- 2.40.0