#!/usr/bin/perl
use Mojo::Base -strict;
use Mojo::Template;
use open qw( :std :encoding(UTF-8) );

my $source_package;
if (defined $ARGV[0]) {
    $source_package = $ARGV[0];
} else {
    $source_package = `dpkg-parsechangelog -S Source`;
    chomp $source_package;
}
die "ERROR: invalid source package name ('$source_package')\nUsage: $0 [openqa-server|openqa]\n"
  unless ("$source_package" =~ /^openqa(-server)?$/);

my $mt = Mojo::Template->new;
undef $/; # enable slurp mode
say $mt->render(<DATA>, $source_package);

__DATA__
% my ($source_package) = @_;
# =-=-=-=-= DO NOT EDIT THIS FILE DIRECTLY =-=-=-=-=-=
# it is generated by debian/generate-control.pl so edit the content there.
# see debian/source/README.source for more details
# =-=-=-=-= DO NOT EDIT THIS FILE DIRECTLY =-=-=-=-=-=
Source: <%= $source_package %>
Section: devel
Priority: optional
Maintainer: Philip Hands <phil@hands.com>
Uploaders: Adam Majer <adamm@debian.org>,
           Andrew Lee (李健秋) <ajqlee@debian.org>,
           Hideki Yamane <henrich@debian.org>,
Build-Depends: debhelper-compat (= 13),
               debhelper (>= 13.11.6),
               dh-exec,
               dh-apparmor,
% if ("$source_package" eq 'openqa-server') {
               dh-sequence-nodejs,
               ruby-sass,
% }
               os-autoinst,
               systemd-dev,
               fdupes,
               libmojolicious-perl (>= 9.34),
%### Bug#839569
%#              libselenium-remote-driver-perl (>= 1.0),
%### for test&runtime
               libarchive-extract-perl,
               libbsd-resource-perl,
               libclone-perl,
               libconfig-inifiles-perl,
               libcrypt-dh-gmp-perl,
               libcss-minifier-xs-perl (>= 0.01),
               libdbd-sqlite3-perl,
               libdbix-class-perl,
               libdbix-class-deploymenthandler-perl,
               libdbix-class-dynamicdefault-perl,
               libdbix-class-optimisticlocking-perl,
               libdata-dump-perl,
               libdata-optlist-perl,
               libdatetime-perl,
               libdatetime-format-sqlite-perl,
               libdatetime-format-pg-perl,
               libcpanel-json-xs-perl,
               libtest-exception-perl,
               libpod-pom-perl,
               libmojo-sqlite-perl,
               libmojo-pg-perl,
               libmojo-ioloop-readwriteprocess-perl (>= 0.34),
               libdbix-class-schema-config-perl,
%#               libdbix-class-schema-loader-perl,
               libfile-copy-recursive-perl,
%#               libio-socket-inet6-perl,
               libio-socket-ssl-perl,
               libipc-run-perl,
               libjavascript-minifier-xs-perl (>= 0.11),
               libjson-perl,
               libjson-xs-perl,
               liblist-moreutils-perl,
               libmro-compat-perl,
               libmodule-implementation-perl,
               libmodule-load-conditional-perl,
               libmodule-runtime-perl,
               libmojo-rabbitmq-client-perl,
%#               libmojolicious-plugin-renderfile-perl,
               libmcp-perl,
               libnamespace-clean-perl,
               libnet-dbus-perl,
               libnet-openid-consumer-perl,
               libpackage-stash-perl,
               libparams-util-perl,
               libparams-validate-perl,
               libregexp-common-perl,
               libscalar-list-utils-perl,
               libsort-versions-perl,
               libsql-splitstatement-perl,
               libsql-translator-perl,
               libsub-install-perl,
               libsub-name-perl,
               libtest-compile-perl,
               libtest-simple-perl,
               libtext-markdown-perl,
               libtime-parsedate-perl,
               libtime-moment-perl,
               libtimedate-perl,
               liburi-perl,
               libwww-perl,
               perl,
               libfeature-compat-try-perl,
# % if ("$source_package" eq 'openqa-server') {
               libmojolicious-plugin-assetpack-perl (>= 1.36),
               libminion-perl (>= 10.25),
               node-d3,
               node-dagre-d3-renderer,
               node-anser,
               python3-requests,
               python3-argparse-manpage,
### for testcases
               libperl-critic-perl <!nocheck>,
               libperl-critic-community-perl <!nocheck>,
               libcommonmark-perl <!nocheck>,
               libgetopt-long-descriptive-perl <!nocheck>,
               libmojolicious-plugin-oauth2-perl <!nocheck>,
               libtest-fatal-perl <!nocheck>,
               libtest-mockmodule-perl <!nocheck>,
               libtest-mockobject-perl <!nocheck>,
               libtest-output-perl <!nocheck>,
               libtest-pod-perl <!nocheck>,
               libtest-strict-perl <!nocheck>,
               libtest-warnings-perl <!nocheck>,
               libtest-mock-time-perl <!nocheck>,
               libyaml-libyaml-perl <!nocheck>,
               libjson-validator-perl <!nocheck>,
               libminion-backend-sqlite-perl <!nocheck>,
               postgresql <!nocheck>,
               rsync <!nocheck>,
               curl <!nocheck>,
               shellcheck <!nocheck>,
               jsbeautifier <!nocheck>,
               libclass-c3-componentised-perl <!nocheck>,
               libtest-most-perl <!nocheck>,
               libyaml-pp-perl <!nocheck>,
               yamllint <!nocheck>,
               libfilesys-df-perl <!nocheck>,
               libfile-map-perl <!nocheck>,
               libtext-glob-perl <!nocheck>,
               libaliased-perl <!nocheck>,
               libarchive-tools <!nocheck>,
### for avoiding assetpack downloads
               node-fortawesome-fontawesome-free,
               fonts-roboto-fontface,
               libjs-chosen,
               libjs-jquery-datatables,
               node-bootstrap (>= 5.3.3+dfsg-1~),
               libjs-codemirror,
               libjs-jquery (>= 3.6.0),
               node-timeago.js,
               node-popper2,
               node-jquery-ujs,
               node-ace-builds,
%# The following is just for testing behaviour relative to new upstream versions.
%# Never define profiles 'x-with-npm' or 'x-npm-only' for real package builds.
               npm <x-with-npm>,
# % }
Standards-Version: 4.7.2
Rules-Requires-Root: no
Homepage: https://open.qa
Vcs-Git: https://salsa.debian.org/debian/openqa.git
Vcs-Browser: https://salsa.debian.org/debian/openqa

% if ("$source_package" eq 'openqa-server') {
Package: openqa-server
Replaces: openqa (<< 5.1777452029.e890e9cc5-1~)
Breaks: openqa (<< 5.1777452029.e890e9cc5-1~)
Architecture: all
Depends: ${misc:Depends}, ${perl:Depends},
         openqa-common (>= ${nearby:Version}),
         openqa-client (>= ${nearby:Version}),
         sqlite3, git, optipng, dbus,
         liburi-perl,
         liblwp-protocol-https-perl,
         libdbix-class-perl (>= 0.082801),
         libsql-splitstatement-perl,
         libdbix-class-deploymenthandler-perl,
         libmojo-sqlite-perl,
         libjson-validator-perl,
         libtext-diff-perl,
         libtext-glob-perl,
         libyaml-pp-perl,
         libdatetime-format-pg-perl,
         libminion-perl (>= 10.25),
         libmojo-pg-perl,
         libmcp-perl,
         libcommonmark-perl,
         postgresql,
         libclass-c3-componentised-perl,
         node-fortawesome-fontawesome-free,
         libjs-jquery-datatables,
         libjs-codemirror,
         libjs-jquery,
         node-timeago.js,
         node-popper2,
         node-jquery-ujs (>= 1.2.3-1),
         node-bootstrap (>= 5.3.3+dfsg-1~),
         node-ace-builds,
         node-d3,
         node-dagre-d3-renderer,
         node-anser,
Recommends: apparmor-profiles, apparmor-utils,
            apache2, logrotate,
            libdbd-pg-perl,
            libmojolicious-plugin-oauth2-perl,
Description: automatic Operating System testing framework (webUI & scheduler)
 openQA is a testing framework that allows you to run tests on pretty-much
 anything that you can get 'remote' control of (most often, anything you can run
 in a VM and point VNC at). This allows testing of things including GUI
 applications, system boot-up (BIOS, bootloaders, kernels), installers and whole
 operating systems.
 .
 Tests (using Perl syntax) generally consist mostly of sequences of code like:
   assert_and_click 'some_icon';
   assert_screen 'some_prompt';
   send_key 'ret';
 which are run using the os-autoinst test engine, by a worker. The tags named in
 scripts can then be associated with 'needles' (elements of screenshots) via the
 webUI (either from past tests, or while controlling a live test). Other testing
 possibilities include: serial-connected headless systems, multi-host networked
 tests, and non-VM 'real' systems.
 .
 This package includes the job scheduler, the elements providing the services to
 allow workers to run tests and upload results, and the Web-based user
 interface.

Package: openqa
Depends: openqa-server, ${misc:Depends}
Architecture: all
Priority: optional
Section: oldlibs
Description: transitional package
 This is a transitional package. It can safely be removed.

% }
% else {
Package: openqa-common
Architecture: all
Depends: ${misc:Depends},
         ${perl:Depends},
         libmojolicious-perl (>= 9.34),
         libjs-chosen,
### for test&runtime
         libdbd-sqlite3-perl,
         libdbix-class-perl (>= 0.082801),
         libconfig-inifiles-perl,
         libsql-translator-perl,
         libdatetime-format-sqlite-perl,
         libfile-copy-recursive-perl,
         libmojolicious-plugin-renderfile-perl,
         libmojolicious-plugin-assetpack-perl (>= 1.36),
         libaliased-perl,
         libconfig-tiny-perl,
         libdbix-class-dynamicdefault-perl,
         libdbix-class-schema-config-perl,
         libdbix-class-optimisticlocking-perl,
         libio-socket-ssl-perl,
         libdata-dump-perl,
         libtext-markdown-perl,
         libnet-dbus-perl,
         libipc-run-perl,
         libarchive-extract-perl,
         libcss-minifier-xs-perl (>= 0.01),
         libjavascript-minifier-xs-perl,
         libmojo-rabbitmq-client-perl,
         libtime-parsedate-perl,
         libsort-versions-perl,
         libbsd-resource-perl,
         libnet-openid-consumer-perl,
         libpod-pom-perl,
         libregexp-common-perl,
         libjson-validator-perl,
         libfilesys-df-perl,
         libtime-moment-perl,
         libcpanel-json-xs-perl,
         libmoose-perl,
         libfeature-compat-try-perl,
         ruby-sass,
Recommends:
         git-lfs,
Description: automatic Operating System testing framework (common files)
 This package contains shared resources for openQA web front-end and openQA
 workers.
 .
 openQA is a testing framework that allows you to run tests on pretty-much
 anything that you can 'remotely' control. For instance, a VM that can be
 accessed via VNC.

Package: openqa-client
Architecture: all
Depends: ${misc:Depends},
         ${perl:Depends},
         libjson-perl,
         libconfig-inifiles-perl,
         libdata-dump-perl,
         libgetopt-long-descriptive-perl,
         libmojolicious-perl (>= 9.34),
         openqa-common (= ${binary:Version}),
Suggests: python3,
Description: automatic Operating System testing framework (utilities)
 This package includes scripts such as 'openqa-cli' and 'openqa-clone-job' to
 provide easy control of openQA servers, via the REST API, as well as commands
 useful when administering an OpenQA server.
 .
 openQA is a testing framework that allows you to run tests on pretty-much
 anything that you can 'remotely' control. For instance, a VM that can be
 accessed via VNC.

Package: openqa-worker
Architecture: all
Pre-Depends: openqa-common (>= ${binary:Version}),
Depends: ${misc:Depends},
         ${perl:Depends},
         openqa-client (>= ${binary:Version}),
         os-autoinst (>= 4.6.1631608584),
         libsql-splitstatement-perl,
         libmojo-ioloop-readwriteprocess-perl,
         libnet-dns-native-perl,
         vde-switch,
         libfile-map-perl,
Recommends: qemu-system-native,
            libminion-backend-sqlite-perl,
Description: automatic Operating System testing framework (worker)
 openQA is a testing framework that allows you to run tests on pretty-much
 anything that you can get 'remote' control of (most often, anything you can run
 in a VM and point VNC at). This allows testing of things including GUI
 applications, system boot-up (BIOS, bootloaders, kernels), installers and whole
 operating systems.
 .
 Tests (using Perl syntax) generally consist of little more than sequences like:
 assert_and_click 'some_icon'; assert_screen 'some_prompt'; send_key 'ret';
 which are run using the os-autoinst test engine, by a worker. The tags named in
 scripts can then be associated with 'needles' (elements of screenshots) via the
 webUI (either from past tests, or while controlling a live test). Other testing
 possibilities include: serial-connected headless systems, multi-host networked
 tests, and non-VM 'real' systems.
 .
 This package is to be installed on a worker system (which may also be acting as
 a server). Workers register with a server (or perhaps multiple servers), and
 can then accept jobs, and run tests (using the os-autoinst test engine).

Package: openqa-doc
Architecture: all
Multi-Arch: foreign
Section: doc
Depends: ${misc:Depends},
Description: automatic Operating System testing framework - documentation
 Documentation for openQA (and the associated os-autoinst test engine), covering
 topics including: installation, configuration, and basic test writing.
 .
 openQA is a testing framework that allows you to run tests on pretty-much
 anything that you can 'remotely' control. For instance, a VM that can be
 accessed via VNC.
% }
