Commit c44eebb2 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

Merge branch 'develop' of https://github.com/UPC/ravada into develop

parents c3a2df89 137dc83b
......@@ -3,6 +3,7 @@
use warnings;
use strict;
use Carp qw(confess);
use Cwd qw(getcwd);
use File::Path qw(remove_tree make_path);
use IPC::Run3;
......@@ -11,7 +12,8 @@ use Ravada;
use File::Copy;
my $VERSION = Ravada::version();
my $DIR_DST = getcwd."/../ravada-$VERSION";
my $DIR_SRC = getcwd;
my $DIR_DST;
my $DEBIAN = "DEBIAN";
my %DIR = (
......@@ -80,8 +82,8 @@ sub copy_files {
sub remove_not_needed {
for my $file (@REMOVE) {
$file = "$DIR_DST/$file";
unlink $file or die "$! $file";
my $file2 = "$DIR_DST/$file";
unlink $file2 or die "$! $file2";
}
for my $dir ('usr/share/doc/ravada/sql/sqlite') {
my $path = "$DIR_DST/$dir";
......@@ -114,7 +116,10 @@ sub create_md5sums {
}
sub create_deb {
my $deb = "ravada_${VERSION}_all.deb";
my $dist = shift or confess "Missing dist";
mkdir "ravada_release" if !-e "ravada_release";
my $deb = "ravada_release/ravada_${VERSION}_${dist}_all.deb";
my @cmd = ('dpkg','-b',"$DIR_DST/",$deb);
my ($in, $out, $err);
run3(\@cmd, \$in, \$out, \$err);
......@@ -218,7 +223,7 @@ sub chown_pms {
sub chmod_control_files {
for (qw(control conffiles)) {
my $path = "$DIR_DST/$DEBIAN/$_";
warn "Missing $path" if ! -e $path;
confess "Missing $path" if ! -e $path;
chmod 0644 , $path or die "$! $path" if -e $path;
}
......@@ -242,6 +247,7 @@ sub tar {
}
sub make_pl {
chdir $DIR_SRC or die "$! $DIR_SRC";
my @cmd = ('perl','Makefile.PL');
my ($in, $out, $err);
run3(\@cmd, \$in, \$out, \$err);
......@@ -257,7 +263,7 @@ sub set_version {
my $file_in = "$DIR_DST/DEBIAN/control";
my $file_out = "$file_in.version";
open my $in ,'<',$file_in or die "$! $file_in";
open my $in ,'<',$file_in or confess "$! $file_in";
open my $out,'>',$file_out or die "$! $file_out";
my $version = $VERSION;
......@@ -281,12 +287,49 @@ sub set_version {
unlink $file_out;
}
sub list_dists {
opendir my $dir,'debian' or die "$! debian";
my @dists;
while ( my $file = readdir $dir ) {
my ($dist) = $file =~ /control-(.*)/;
push @dists,($dist) if $dist;
}
closedir $dir;
die "Error: no dists control files found in 'debian' dir"
if !@dists;
return @dists;
}
sub set_control_file {
my $dist = shift;
my $dst = "$DIR_DST/DEBIAN/control";
my $src = "$dst-$dist";
die "Error: no $src" if ! -e $src;
copy($src, $dst) or die "$! $src -> $dst";
opendir my $dir,"$DIR_DST/DEBIAN" or die $!;
while ( my $file = readdir $dir ) {
unlink "$DIR_DST/DEBIAN/$file" or die "$! $file"
if $file =~ /^control-/;
}
closedir $dir;
}
#########################################################################
for my $dist (list_dists) {
$DIR_DST = "$DIR_SRC/../ravada-$VERSION-$dist";
clean();
make_pl();
copy_dirs();
copy_files();
set_control_file($dist);
set_version();
remove_not_needed();
remove_use_lib();
......@@ -316,4 +359,5 @@ create_md5sums();
tar();
#chown_pms();
create_md5sums();
create_deb();
create_deb($dist);
}
Package: ravada
Version: 0.2.5
Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
......@@ -4,7 +4,7 @@ Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-bin,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libparallel-forkmanager-perl, libfile-rsync-perl, libnet-ssh2-perl
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-bin,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
control-ubuntu-19.04
\ No newline at end of file
Package: ravada
Version: 0.2.5
Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
......@@ -3087,6 +3087,9 @@ sub set_base_vm($self, %args) {
confess $err if $err;
}
}
}
if (!$vm->is_local) {
my $vm_local = $self->_vm->new( host => 'localhost' );
$self->_set_vm($vm_local, 1);
}
......
......@@ -125,6 +125,11 @@ our %COMMAND = (
,commands => ['download']
,priority => 5
}
,disk => {
limit => 1
,commands => ['prepare_base','remove_base','set_base_vm','rebase_volumes']
,priority => 6
}
,important=> {
limit => 20
,priority => 1
......
......@@ -239,6 +239,26 @@ sub _create_2_clones_same_port($vm, $node, $base, $ip_local, $ip_remote) {
}
}
sub test_set_vm($vm, $node) {
my $base = create_domain($vm);
my $req = Ravada::Request->set_base_vm(
id_domain => $base->id
, id_vm => $node->id
, value => 1
, uid => user_admin->id
);
rvd_back->_process_requests_dont_fork(1);
is($req->status, 'done');
is($req->error, '');
is($base->_vm->id, $vm->id);
my $base2 = Ravada::Domain->open($base->id);
is($base2->_vm->id, $vm->id);
$base->remove(user_admin);
}
sub test_volatile($vm, $node) {
my $base = create_domain($vm);
$base->prepare_base(user_admin);
......@@ -454,6 +474,8 @@ for my $vm_name ( 'Void', 'KVM') {
};
is($node->is_local,0,"Expecting ".$node->name." ".$node->ip." is remote" ) or BAIL_OUT();
test_set_vm($vm, $node);
test_volatile($vm, $node);
test_remove_req($vm, $node);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment