From 86d33a653327b046c864cb7def95ef057c9ea57b Mon Sep 17 00:00:00 2001 From: Anna Born Date: Wed, 18 May 2022 14:20:34 +0200 Subject: [PATCH 01/22] add output to see what package apaka is building --- lib/apaka/cli/build.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/apaka/cli/build.rb b/lib/apaka/cli/build.rb index 4936f518..2a07f8b4 100644 --- a/lib/apaka/cli/build.rb +++ b/lib/apaka/cli/build.rb @@ -30,6 +30,7 @@ def validate_options(args, options) def build(packager, debian_pkg_name, orig_options) + puts "\e[32m Building deb package: #{debian_pkg_name} \e[0m" options = orig_options.dup debian_package_dir = packager.packaging_dir(debian_pkg_name) From 3b769fa4ea8b03062a8ee93919bb1f5e98f3d4c3 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Thu, 19 May 2022 12:28:50 +0200 Subject: [PATCH 02/22] delete substvar ruby:Depends from debian control files --- lib/apaka/packaging/deb/gem2deb.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/apaka/packaging/deb/gem2deb.rb b/lib/apaka/packaging/deb/gem2deb.rb index e028d14a..8123c8fc 100644 --- a/lib/apaka/packaging/deb/gem2deb.rb +++ b/lib/apaka/packaging/deb/gem2deb.rb @@ -379,6 +379,14 @@ def convert_gem(gem_path, options = Hash.new) debcontrol.packages.each do |pkg| if pkg.has_key?("Depends") depends = pkg["Depends"].split(/,\s*/).map { |e| e.strip } + # delete ${ruby:Depends} var + # so debmake does not parse ruby dependencies + # especially if those ruby dependencies already represented as + # rock debian ruby package + ind = depends.index("${ruby:Depends}") + if !ind.nil? + depends.delete_at(ind) + end depends.each do |dep| if dep =~ /^ruby-(\S+)/ pkg_name = $1 From e648184759dc76279fed871cb8749ff9b4a07861 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Tue, 7 Jun 2022 13:36:57 +0200 Subject: [PATCH 03/22] set default distribution if none was set before --- lib/apaka/packaging/templates/etc-pbuilderrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index 8115e69f..438d2abb 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -16,7 +16,7 @@ if [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" != "x" ]; then elif [ "x${DIST}" != "x" ] && [ "x${DISTRIBUTION}" = "x" ]; then echo "warning: DISTRIBUTION is not set, using DIST=${DIST}" DISTRIBUTION=$DIST -else +elif [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" = "x" ]; then DIST=bionic echo "warning: no distribution set -- using default: ${DIST}" fi From d4f7b3a4ad213a5cfc343c847d309289541292f3 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Tue, 7 Jun 2022 13:38:12 +0200 Subject: [PATCH 04/22] print info at the end --- lib/apaka/packaging/templates/etc-pbuilderrc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index 438d2abb..322e6c09 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -2,9 +2,6 @@ set -e echo "Reading pbuilder /etc/pbuilderrc" -echo "DIST: ${DIST}" -echo "ARCH: ${ARCH}" -echo "COMPONENTS: ${COMPONENTS}" UBUNTU_DISTS="trusty vivid wily xenial yakkety zesty artful bionic cosmic disco eoan focal" DEBIAN_DISTS="sid wheezy jessie stretch buster" @@ -43,6 +40,7 @@ if [ "$DIST_TYPE" == "ubuntu" ]; then COMPONENTS="main restricted universe multiverse" MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" + if [ "$ARCH" == "armel" ] || [ "$ARCH" == "armhf" ] || [ "$ARCH" == "arm64" ]; then # The default mirror site only provides i386 and MIRRORSITE=http://ports.ubuntu.com/ubuntu-ports @@ -84,9 +82,14 @@ fi EXTRA_PACKAGES+="apt,cmake,dh-autoreconf,libgl1-mesa-dev,libboost-dev,yard,gem2deb,perl-openssl-defaults" DEBOOTSTRAPOPTS+=("--include=$EXTRA_PACKAGES") + +echo "DIST: ${DIST}" +echo "ARCH: ${ARCH}" +echo "COMPONENTS: ${COMPONENTS}" echo "DIST_TYPE: ${DIST_TYPE}" echo "DEBOOTSTRAPOPTS: ${DEBOOTSTRAPOPTS[@]}" -echo "COMPONENTS: $COMPONENTS" +echo "MIRRORSITE: ${MIRRORSITE}" +echo "OTHERMIRROR: ${OTHERMIRROR}" # Enable network in pbuilder, otherwise embedded bootstrap scripts will fail USENETWORK=yes From 783b85c62303dc7588fc617f6f7e204cb246c797 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Mon, 11 Jul 2022 12:09:30 +0200 Subject: [PATCH 05/22] add bullseye --- lib/apaka/packaging/deb_package-default.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/apaka/packaging/deb_package-default.yml b/lib/apaka/packaging/deb_package-default.yml index 4db57a26..d3c13047 100644 --- a/lib/apaka/packaging/deb_package-default.yml +++ b/lib/apaka/packaging/deb_package-default.yml @@ -54,16 +54,17 @@ distributions: type: debian labels: 10,buster,default ruby_version: ruby25 - sid: + bullseye: type: debian - labels: 11,sid,default + labels: 11,bullseye,default + uby_version: ruby27 # what distribution should be build with which architecture architectures: - amd64: trusty,xenial,jessie,stretch,buster,bionic,focal - i386: trusty,xenial,jessie,stretch,buster,bionic,focal + amd64: trusty,xenial,jessie,stretch,buster,bionic,focal,bullseye + i386: trusty,xenial,jessie,stretch,buster,bionic,focal,bullseye armel: jessie,stretch,buster armhf: jessie,stretch,buster - arm64: xenial,bionic + arm64: xenial,bionic,focal packages: optional: llvm,clang excluded: libqwt5-qt4-dev From d455be821c27bfdab0a6d59f41499bf99682fe03 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Mon, 11 Jul 2022 12:19:32 +0200 Subject: [PATCH 06/22] fix mirror for arm64 --- lib/apaka/packaging/templates/etc-pbuilderrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index 322e6c09..2cfb0a6c 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -38,13 +38,15 @@ if [ "$DIST_TYPE" == "ubuntu" ]; then echo "Identified Ubuntu Distribution" COMPONENTS="main restricted universe multiverse" + # The default mirror site only provides i386 and amd64 MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ - OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" if [ "$ARCH" == "armel" ] || [ "$ARCH" == "armhf" ] || [ "$ARCH" == "arm64" ]; then - # The default mirror site only provides i386 and + # The port mirror site provides arm64, armel, armhf MIRRORSITE=http://ports.ubuntu.com/ubuntu-ports fi + + OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" --components=main,restricted,universe,multiverse) EXTRA_PACKAGES+="ruby-all-dev," @@ -94,7 +96,6 @@ echo "OTHERMIRROR: ${OTHERMIRROR}" # Enable network in pbuilder, otherwise embedded bootstrap scripts will fail USENETWORK=yes - ### ORIGINAL VERSION ##### # this is your configuration file for pbuilder. @@ -103,5 +104,4 @@ USENETWORK=yes # the default template # # read pbuilderrc.5 document for notes on specific options. -#MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ - +#MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ \ No newline at end of file From e2e05aa67f979937f99c532ca39e729fc4d27d0d Mon Sep 17 00:00:00 2001 From: Anna Born Date: Tue, 26 Jul 2022 11:17:29 +0200 Subject: [PATCH 07/22] add bullseye into pbuilderrc --- lib/apaka/packaging/templates/etc-pbuilderrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index 2cfb0a6c..d1d1c573 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -4,7 +4,7 @@ set -e echo "Reading pbuilder /etc/pbuilderrc" UBUNTU_DISTS="trusty vivid wily xenial yakkety zesty artful bionic cosmic disco eoan focal" -DEBIAN_DISTS="sid wheezy jessie stretch buster" +DEBIAN_DISTS="sid wheezy jessie stretch buster bullseye" if [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" != "x" ]; then From fd91537cfe8126c46223fae2fd34598c73ae510d Mon Sep 17 00:00:00 2001 From: Anna Born Date: Tue, 26 Jul 2022 12:11:34 +0200 Subject: [PATCH 08/22] add missing package for bullseye --- lib/apaka/packaging/templates/etc-pbuilderrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index d1d1c573..c10064fb 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -56,9 +56,15 @@ elif [ "$DIST_TYPE" == "debian" ]; then if [ "$DIST" != "wheezy" ]; then # Not available on wheezy - EXTRA_PACKAGES="ruby-all-dev," + EXTRA_PACKAGES+="ruby-all-dev," fi + if [ "$DIST" == "bullseye" ]; then + # gem2deb requires debhelper-compat + # that comes with debhelper package + EXTRA_PACKAGES+="debhelper," + fi + MIRRORSITE=http://ftp.no.debian.org/debian/ OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" if [ "$DIST" != "sid" ]; then From 17bc1e7abf536c07ae088828be29f8eb967c1c19 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Mon, 22 Aug 2022 11:29:24 +0200 Subject: [PATCH 09/22] remove leading and trailing white space from gem name --- lib/apaka/packaging/gem_dependencies.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/apaka/packaging/gem_dependencies.rb b/lib/apaka/packaging/gem_dependencies.rb index 0311dda1..a329d691 100644 --- a/lib/apaka/packaging/gem_dependencies.rb +++ b/lib/apaka/packaging/gem_dependencies.rb @@ -104,6 +104,7 @@ def self.resolve_all_deps(gems = [], gemfile: "/tmp/apaka/Gemfile.all") name = gem end + name = name.strip if available_specs.has_key?(name) # skip already available definition next From 835c77b525987c4b84eb14af94c3fb704743e634 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Tue, 27 Sep 2022 10:45:13 +0200 Subject: [PATCH 10/22] fix the bug in ruby bundler remote resolver --- lib/apaka/packaging/gem_dependencies.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/apaka/packaging/gem_dependencies.rb b/lib/apaka/packaging/gem_dependencies.rb index a329d691..1b8d2136 100644 --- a/lib/apaka/packaging/gem_dependencies.rb +++ b/lib/apaka/packaging/gem_dependencies.rb @@ -45,7 +45,11 @@ def self.get_gem_specs(gemfile) end gems_definitions = Bundler::Definition.build(gemfile, nil,nil) + # in bundler 2.3.22 resolve_remotely will resolve all gems except bundler + # last working version was in bundler 2.3.18 + # https://github.com/rubygems/rubygems/issues/5945 gem_specs = gems_definitions.resolve_remotely! + gem_specs = gems_definitions.specs gems = {} gem_specs.each do |spec| From c90b3fb3e986396d59a1ac310bb1b38795b5e1ae Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Thu, 24 Aug 2023 22:19:56 +0200 Subject: [PATCH 11/22] Start adding support for recent Ubuntun and Debian versions --- Dockerfile.22-04 | 51 ++++++++++++++++++++ lib/apaka/cli/base.rb | 2 +- lib/apaka/packaging/autoproj2adaptor.rb | 2 +- lib/apaka/packaging/deb/gem2deb.rb | 4 +- lib/apaka/packaging/deb/package2deb.rb | 6 +-- lib/apaka/packaging/deb_package-default.yml | 14 +++++- lib/apaka/packaging/packager.rb | 10 ++-- lib/apaka/packaging/reprepro.rb | 2 +- lib/apaka/packaging/templates/etc-pbuilderrc | 33 +++++++------ test/test_gem_packager.rb | 2 +- test/workspace/.autoproj/Gemfile | 2 +- 11 files changed, 96 insertions(+), 32 deletions(-) create mode 100644 Dockerfile.22-04 diff --git a/Dockerfile.22-04 b/Dockerfile.22-04 new file mode 100644 index 00000000..06efbb54 --- /dev/null +++ b/Dockerfile.22-04 @@ -0,0 +1,51 @@ +FROM ubuntu:22.04 + +MAINTAINER 2maz "https://github.com/2maz" + +# Optional arguments +ARG PKG_BRANCH="master" +ENV PKG_BRANCH=${PKG_BRANCH} + +ARG PKG_PULL_REQUEST="false" +ENV PKG_PULL_REQUEST=${PKG_PULL_REQUEST} + +ARG PKG_PULL_REQUEST_BRANCH="" +ENV PKG_PULL_REQUEST_BRANCH=${PKG_PULL_REQUEST_BRANCH} +## END ARGUMENTS + +RUN apt update +RUN apt upgrade -y +ENV DEBIAN_FRONTEND=noninteractive +RUN apt install -y ruby ruby-dev git locales tzdata vim wget gem2deb reprepro apache2 cmake automake pbuilder cowdancer curl +RUN apt-file update +RUN service apache2 start +RUN echo "Europe/Berlin" > /etc/timezone; dpkg-reconfigure -f noninteractive tzdata +RUN export LANGUAGE=de_DE.UTF-8; export LANG=de_DE.UTF-8; export LC_ALL=de_DE.UTF-8; locale-gen de_DE.UTF-8; DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales + +RUN useradd -ms /bin/bash docker +RUN echo "docker ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +USER docker +WORKDIR /home/docker +ENV LANG de_DE.UTF-8 +ENV LANG de_DE:de +ENV LC_ALL de_DE.UTF-8 + +ENV GEM_HOME=/home/docker/.gems/ruby/3.0.0 +ENV PATH=$GEM_HOME/bin:$PATH + +RUN git clone https://github.com/rock-core/tools-apaka /home/docker/apaka +COPY --chown=docker .ci/prepare-package.sh prepare-package.sh +RUN /bin/bash prepare-package.sh /home/docker/apaka +RUN sed -i 's#gems_install_path.*#gems_install_path: /home/docker/.gems#' /home/docker/apaka/test/workspace/.autoproj/config.yml + +RUN git config --global user.name 'Apaka4docker' +RUN git config --global user.email 'apaka@docker' + +RUN gem install backports +RUN gem install autoproj +RUN gem install bundler:2.4.19 +RUN gem install yard +RUN gem install minitest:5.15.0 +RUN gem install flexmock +RUN gem install pry-byebug diff --git a/lib/apaka/cli/base.rb b/lib/apaka/cli/base.rb index 58a910a9..c38f0d6c 100644 --- a/lib/apaka/cli/base.rb +++ b/lib/apaka/cli/base.rb @@ -85,7 +85,7 @@ def self.validate_distributions(options) # Activate the configuration if a configuration file is provided def self.activate_configuration(options) if config = options[:config_file] - if File.exists?(config) + if File.exist?(config) Apaka::Packaging::Config.reload_config(config, options[:release_name]) end end diff --git a/lib/apaka/packaging/autoproj2adaptor.rb b/lib/apaka/packaging/autoproj2adaptor.rb index d5376649..60a2bb33 100644 --- a/lib/apaka/packaging/autoproj2adaptor.rb +++ b/lib/apaka/packaging/autoproj2adaptor.rb @@ -698,7 +698,7 @@ def import(pkg_target_importdir) @copyright = "" ['manifest.xml','package.xml'].each do |file| xml_file = File.join(@pkg.srcdir, file) - if File.exists?(xml_file) + if File.exist?(xml_file) data = File.read(xml_file) # check over multilines, then filter out newlines to # get a consistent/unformatted text block diff --git a/lib/apaka/packaging/deb/gem2deb.rb b/lib/apaka/packaging/deb/gem2deb.rb index 8123c8fc..53d7ecac 100644 --- a/lib/apaka/packaging/deb/gem2deb.rb +++ b/lib/apaka/packaging/deb/gem2deb.rb @@ -478,7 +478,7 @@ def convert_gem(gem_path, options = Hash.new) debian_name = debian_ruby_unversioned_name path = File.join(TEMPLATES,action) - template = ERB.new(File.read(path), nil, "%<>", path.gsub(/[^w]/, '_')) + template = ERB.new(File.read(path), trim_mode: "%<>", eoutvar: path.gsub(/[^w]/, '_')) rendered = template.result(binding) File.open("debian/#{action}", "w") do |io| io.write(rendered) @@ -500,7 +500,7 @@ def convert_gem(gem_path, options = Hash.new) # We cannot assume that an existing debian/copyright # file is correct, since gem2deb autogenerates one path = File.join(TEMPLATES,"copyright") - template = ERB.new(File.read(path), nil, "%<>", path.gsub(/[^w]/, '_')) + template = ERB.new(File.read(path), trim_mode: "%<>", eoutvar: path.gsub(/[^w]/, '_')) rendered = template.result(binding) File.open("debian/copyright", "w") do |io| io.write(rendered) diff --git a/lib/apaka/packaging/deb/package2deb.rb b/lib/apaka/packaging/deb/package2deb.rb index e469a27c..0ea2fc86 100644 --- a/lib/apaka/packaging/deb/package2deb.rb +++ b/lib/apaka/packaging/deb/package2deb.rb @@ -346,7 +346,7 @@ def generate_debian_dir(pkginfo, dir, options) Find.find(template_dir) do |path| next if File.directory?(path) - template = ERB.new(File.read(path), nil, "%<>", path.gsub(/[^w]/, '_')) + template = ERB.new(File.read(path), trim_mode: "%<>", eoutvar: path.gsub(/[^w]/, '_')) rendered = template.result(binding) target_path = File.join(dir, Pathname.new(path).relative_path_from(Pathname.new(template_dir)).to_s) @@ -403,7 +403,7 @@ def generate_debian_dir_meta(name, depends, base_dir: Dir.pwd, version: "0.1", d Find.find(template_dir) do |path| next if File.directory?(path) - template = ERB.new(File.read(path), nil, "%<>", path.gsub(/[^w]/, '_')) + template = ERB.new(File.read(path), trim_mode: "%<>", eoutvar: path.gsub(/[^w]/, '_')) begin rendered = template.result(binding) rescue @@ -636,7 +636,7 @@ def update_debian_dir(pkginfo, options) envyml = File.join(pkginfo.srcdir, "env.yml") Packager.warn("Preparing env.yml #{envyml}") patch_yml = {} - if File.exists?(envyml) + if File.exist?(envyml) patch_yml = YAML.load_file(envyml) end diff --git a/lib/apaka/packaging/deb_package-default.yml b/lib/apaka/packaging/deb_package-default.yml index d3c13047..aa45e95a 100644 --- a/lib/apaka/packaging/deb_package-default.yml +++ b/lib/apaka/packaging/deb_package-default.yml @@ -36,6 +36,12 @@ distributions: focal: type: ubuntu,debian labels: 20.04,focal,fossa,default + jammy: + type: ubuntu,debian + labels: 22.04,jammy,jellyfish,default + naughty: + type: ubuntu,debian + labels: 24.04,naughty,nightinggale,default squeeze: type: debian labels: 6,squeeze,default @@ -57,11 +63,15 @@ distributions: bullseye: type: debian labels: 11,bullseye,default + ruby_version: ruby27 + bookworm: + type: debian + labels: 12,bookworm,default uby_version: ruby27 # what distribution should be build with which architecture architectures: - amd64: trusty,xenial,jessie,stretch,buster,bionic,focal,bullseye - i386: trusty,xenial,jessie,stretch,buster,bionic,focal,bullseye + amd64: trusty,xenial,jessie,stretch,buster,bionic,focal,jammy,bullseye,bookworm + i386: trusty,xenial,jessie,stretch,buster,bionic,focal,jammy,bullseye,bookworm armel: jessie,stretch,buster armhf: jessie,stretch,buster arm64: xenial,bionic,focal diff --git a/lib/apaka/packaging/packager.rb b/lib/apaka/packaging/packager.rb index 6751253c..00fd76a5 100644 --- a/lib/apaka/packaging/packager.rb +++ b/lib/apaka/packaging/packager.rb @@ -154,7 +154,7 @@ def cleanup_existing_dir(dir, options) # Process apaka control file and apply to the current directory def process_apaka_control(apaka_control) Packager.info "apaka.control file available: #{apaka_control}" - if File.exists?(apaka_control) + if File.exist?(apaka_control) File.open(apaka_control,"r").each do |line| if line =~/^\s*#/ next @@ -171,10 +171,10 @@ def process_apaka_control(apaka_control) if line =~/RENAME (.*) (.*)/ orig_file = $1 renamed_file = $2 - if File.exists?(orig_file) + if File.exist?(orig_file) Packager.info "Renaming file: #{orig_file} to #{renamed_file}" target_dir = File.dirname(renamed_file) - FileUtils.mkdir_p target_dir unless File.exists?(target_dir) + FileUtils.mkdir_p target_dir unless File.exist?(target_dir) FileUtils.mv orig_file, renamed_file else raise RuntimeError, "Failed to rename file #{orig_file} for #{package_name} - file does not exist, so please check "\ @@ -191,7 +191,7 @@ def process_apaka_control(apaka_control) if File.directory?(path) Packager.info "Removing dir: #{path}" FileUtils.rm_rf path - elsif File.exists?(path) + elsif File.exist?(path) Packager.info "Removing file: #{path}" FileUtils.rm path else @@ -342,7 +342,7 @@ def patch_pkg_dir(package_name, global_patch_dir, whitelist: nil, pkg_dir: Dir.pwd, options: {}) - if global_patch_dir && File.exists?(global_patch_dir) + if global_patch_dir && File.exist?(global_patch_dir) if !package_name raise ArgumentError, "DebianPackager::patch_pkg_dir: package name is required, but was nil" end diff --git a/lib/apaka/packaging/reprepro.rb b/lib/apaka/packaging/reprepro.rb index 12da9631..479a0746 100644 --- a/lib/apaka/packaging/reprepro.rb +++ b/lib/apaka/packaging/reprepro.rb @@ -144,7 +144,7 @@ def register_debian_package(debian_pkg_file, release_name, codename, end @reprepro_lock.lock Dir.chdir(debian_package_dir) do - if !File.exists?(debfile) + if !File.exist?(debfile) raise ArgumentError, "Apaka::Packaging::register_debian_package: could not find '#{debfile}' in directory: '#{debian_package_dir}'" end diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index c10064fb..10aa73f7 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -1,11 +1,13 @@ #!/bin/sh -set -e +set -ex echo "Reading pbuilder /etc/pbuilderrc" -UBUNTU_DISTS="trusty vivid wily xenial yakkety zesty artful bionic cosmic disco eoan focal" -DEBIAN_DISTS="sid wheezy jessie stretch buster bullseye" +UBUNTU_DISTS="trusty vivid wily xenial yakkety zesty artful bionic cosmic disco eoan focal jammy naughty" +DEBIAN_DISTS="sid wheezy jessie stretch buster bullseye bookworm" +# debhelper-compat required with Starting with bulleye and focal +DIST_REQUIRES_NO_DEBHELPER="trusty vivid wily xenial yakkety zesty artful bionic wheezy jessie stretch buster" if [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" != "x" ]; then echo "warning: DIST is not set, using DISTRIBUTION=${DISTRIBUTION}" @@ -14,23 +16,23 @@ elif [ "x${DIST}" != "x" ] && [ "x${DISTRIBUTION}" = "x" ]; then echo "warning: DISTRIBUTION is not set, using DIST=${DIST}" DISTRIBUTION=$DIST elif [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" = "x" ]; then - DIST=bionic + DIST=$(lsb_release -sc) echo "warning: no distribution set -- using default: ${DIST}" fi for NAME in $UBUNTU_DISTS; do - if [ "$DIST" == "$NAME" ]; then + if [[ "$DIST" == "$NAME" ]]; then DIST_TYPE=ubuntu fi done for NAME in $DEBIAN_DISTS; do - if [ "$DIST" == "$NAME" ]; then + if [[ "$DIST" == "$NAME" ]]; then DIST_TYPE=debian fi done -if [ "$ARCH" == "armel" ] || [ "$ARCH" == "armhf" ] || [ "$ARCH" == "arm64" ]; then +if [[ "$ARCH" == "armel" ]] || [[ "$ARCH" == "armhf" ]] || [[ "$ARCH" == "arm64" ]]; then DEBOOTSTRAP="qemu-debootstrap" fi @@ -55,16 +57,10 @@ elif [ "$DIST_TYPE" == "debian" ]; then echo " -- you have to make sure that 'debian-archive-keyring' is installed" if [ "$DIST" != "wheezy" ]; then - # Not available on wheezy + # Not available on wheezy EXTRA_PACKAGES+="ruby-all-dev," fi - if [ "$DIST" == "bullseye" ]; then - # gem2deb requires debhelper-compat - # that comes with debhelper package - EXTRA_PACKAGES+="debhelper," - fi - MIRRORSITE=http://ftp.no.debian.org/debian/ OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" if [ "$DIST" != "sid" ]; then @@ -81,6 +77,13 @@ elif [ "$DIST_TYPE" == "debian" ]; then COMPONENTS="main contrib non-free" DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" --components=main,contrib,nonfree) fi + +if [[ !$(echo $DIST_REQUIRES_NO_DEBHELPER | grep -w -q $DIST) ]]; then + # gem2deb requires debhelper-compat + # that comes with debhelper package + EXTRA_PACKAGES+="debhelper," +fi + # Append additional packages here # cmake required by quite some package, including qtbindings # apt-utils, e.g., for running apt-ftparchive in the hook dir see https://wiki.debian.org/PbuilderTricks @@ -110,4 +113,4 @@ USENETWORK=yes # the default template # # read pbuilderrc.5 document for notes on specific options. -#MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ \ No newline at end of file +#MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ diff --git a/test/test_gem_packager.rb b/test/test_gem_packager.rb index 998715f5..5094dd44 100644 --- a/test/test_gem_packager.rb +++ b/test/test_gem_packager.rb @@ -22,7 +22,7 @@ def test_convert_package pkg = autoprojadaptor.package_by_name("tools/metaruby") pkginfo = autoprojadaptor.pkginfo_from_pkg(pkg) - @package2gem.convert_package(pkginfo, @testdir, { gem_name: "mynewgem" } ) + @package2gem.convert_package(pkginfo, @testdir, gem_name: "mynewgem") assert(!Dir.glob(File.join(@testdir,"mynewgem*.gem")).empty?, "Ruby package #{pkg.name} converted to mynewgem*.gem") end end diff --git a/test/workspace/.autoproj/Gemfile b/test/workspace/.autoproj/Gemfile index 17f10ec8..8f8af77f 100644 --- a/test/workspace/.autoproj/Gemfile +++ b/test/workspace/.autoproj/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'bundler' +gem 'bundler', ">2.4" gem 'autoproj' From 362bc98daf23622d86f65909aa94a4af4b4f1b8e Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Thu, 24 Aug 2023 22:24:33 +0200 Subject: [PATCH 12/22] tests: update and fix some tests --- lib/apaka/packaging/autoproj2adaptor.rb | 11 ++++++++- lib/apaka/packaging/deb/gem2deb.rb | 6 +++++ lib/apaka/packaging/gem_dependencies.rb | 25 ++++++++++++-------- lib/apaka/packaging/packager.rb | 3 +++ lib/apaka/packaging/target_platform.rb | 15 ++++++++---- test/test_gem_dependencies.rb | 26 ++++++++++++++++----- test/test_target_platform.rb | 31 ++++++++++++++++++------- 7 files changed, 88 insertions(+), 29 deletions(-) diff --git a/lib/apaka/packaging/autoproj2adaptor.rb b/lib/apaka/packaging/autoproj2adaptor.rb index 60a2bb33..56443eb6 100644 --- a/lib/apaka/packaging/autoproj2adaptor.rb +++ b/lib/apaka/packaging/autoproj2adaptor.rb @@ -44,6 +44,11 @@ def initialize(options) Autoproj::workspace.setup_all_package_directories Autoproj::workspace.finalize_package_setup + # Assume that ruby is already installed and avoid dependance on + # updating autoproj just for ignoring ruby + ruby_version = "ruby#{RbConfig::CONFIG['MAJOR']}#{RbConfig::CONFIG['MINOR']}" + Autoproj.osdeps.add_entries({ruby_version => [[{'default' => 'ignore'}]]}) + @cli = Autoproj::CLI::Base.new(Autoproj::workspace) end @@ -258,7 +263,11 @@ def pkgmanifest_by_name(package_name) public def package_by_name(package_name) - pkgmanifest_by_name(package_name).package + manifest = pkgmanifest_by_name(package_name) + if not manifest + raise RuntimeError, "No manifest found for #{package_name}" + end + manifest.package end def pkginfo_by_name(package_name) diff --git a/lib/apaka/packaging/deb/gem2deb.rb b/lib/apaka/packaging/deb/gem2deb.rb index 53d7ecac..5653f9b9 100644 --- a/lib/apaka/packaging/deb/gem2deb.rb +++ b/lib/apaka/packaging/deb/gem2deb.rb @@ -8,6 +8,12 @@ class Gem2Deb < Package2Deb def initialize(options = Hash.new) super(options) + + if not ENV.include?('DEBMAIL') + email = Apaka::Packaging::Config.maintainer_email + Packager.warn "DEBMAIL is not set, using placeholder #{email}" + ENV['DEBEMAIL'] = email + end end # Convert with package info diff --git a/lib/apaka/packaging/gem_dependencies.rb b/lib/apaka/packaging/gem_dependencies.rb index 1b8d2136..abc66e40 100644 --- a/lib/apaka/packaging/gem_dependencies.rb +++ b/lib/apaka/packaging/gem_dependencies.rb @@ -11,12 +11,16 @@ class GemDependencies @@known_gems = {} @@gemfile_to_specs = {} @@gemfile_md5 = {} - + @@gemfile = nil # Path to autoproj default gemfile - # def self.gemfile - File.join(Autoproj.root_dir,"install","gems","Gemfile") + return @@gemfile || File.join(Autoproj.root_dir,"install","gems","Gemfile") + end + + # Allow to set the gemfile used as base for the resolution + def self.gemfile=(gemfile) + @@gemfile = gemfile end # Collect all gem specification that are defined through a given @@ -110,16 +114,17 @@ def self.resolve_all_deps(gems = [], gemfile: "/tmp/apaka/Gemfile.all") name = name.strip if available_specs.has_key?(name) - # skip already available definition - next + if version + # skip already available definition for specific version) + next if available_specs[name].version == ::Gem::Version.new(version) + else + # skip already available definition (arbitrary version) + next + end end if version - if version =~ /^[0-9].*/ - f.puts " gem \"#{name}\", \"== #{version}\"" - else - f.puts " gem \"#{name}\", \"#{version}\"" - end + f.puts " gem \"#{name}\", \"#{version}\"" else f.puts " gem \"#{name}\", \">= 0\"" end diff --git a/lib/apaka/packaging/packager.rb b/lib/apaka/packaging/packager.rb index 00fd76a5..866ce271 100644 --- a/lib/apaka/packaging/packager.rb +++ b/lib/apaka/packaging/packager.rb @@ -107,6 +107,9 @@ def initialize(options = Hash.new) @reprepro = Reprepro::BaseRepo.new(DEB_REPOSITORY, @log_dir) + # Prevent: dch warning: neither DEBEMAIL nor EMAIL environment variable is set + ENV["DEBMAIL"] = options[:maintainer_email] + prepare end diff --git a/lib/apaka/packaging/target_platform.rb b/lib/apaka/packaging/target_platform.rb index ad47046d..6f8ca89a 100644 --- a/lib/apaka/packaging/target_platform.rb +++ b/lib/apaka/packaging/target_platform.rb @@ -46,7 +46,7 @@ def hash [ distribution_release_name, architecture ].hash end - def to_s(separator = "/") + def to_s(separator = "/") "#{distribution_release_name}#{separator}#{architecture}" end @@ -305,6 +305,7 @@ def contains?(package, cache_results = true) end end + outfile_content = File.read(outfile) if TargetPlatform::isUbuntu(release_name) # -A1 -> 1 line after the match # -m1 -> first match: we assume that the first date refers to the latest entry @@ -321,9 +322,16 @@ def contains?(package, cache_results = true) elsif TargetPlatform::isDebian(release_name) # If file contains a response, then check for # 'No such package' - if !system("grep", "-i", "No such package", :in => outfile, [:out, :err] => "/dev/null", :close_others => true) && system("grep", "-i", "[a-zA-z]", :in => outfile, [:out, :err] => "/dev/null", :close_others => true) + no_such_package = outfile_content.include?("No such package") + error_package = outfile_content.include?("Error") + found_package = outfile_content.include?("Download Page for") + + if found_package result = true + elsif error_package && !no_such_package + raise RuntimeError, "Web search for #{release_name} seems to be unsupported: check https://packages.debian.org/index" end + if Packaging::Config.packages_enforce_build.include?('gems') if TargetPlatform::isRuby(package) Apaka::Packaging.info "TargetPlatform::contains returns false -- since configuration is set to forced manual build for all ruby packages: #{package}" @@ -331,7 +339,7 @@ def contains?(package, cache_results = true) end end elsif TargetPlatform::isRock(release_name) - if !system("grep", "-i", " 404", :in => errorfile, [:out, :err] => "/dev/null", :close_others => true) + if outfile_content.include?("404") result = true end end @@ -367,4 +375,3 @@ def contains?(package, cache_results = true) end # TargetPlatform end # Packaging end # Apaka - diff --git a/test/test_gem_dependencies.rb b/test/test_gem_dependencies.rb index 6d758175..fb040c24 100644 --- a/test/test_gem_dependencies.rb +++ b/test/test_gem_dependencies.rb @@ -4,6 +4,10 @@ class TestGemDependencies < Minitest::Test + def setup + Apaka::Packaging::GemDependencies.gemfile = File.join(__dir__, "workspace", ".autoproj", "Gemfile") + end + def test_release_date date = Apaka::Packaging::GemDependencies.get_release_date("backports") assert(date) @@ -19,15 +23,25 @@ def test_is_gem end def test_resolve_all - deps = Apaka::Packaging::GemDependencies.resolve_all(["rgl"]) - ["stream","generator","lazy_priority_queue"].each do |dep| - assert(deps.has_key?(dep)) + deps = Apaka::Packaging::GemDependencies.resolve_all([["rgl","0.5.10"]]) + dep_names = deps.collect {|x| x[0]} + ["stream", "pairing_heap", "rexml"].each do |dep_name| + assert dep_names.include?(dep_name), "Require #{dep_name} in dependencies: #{dep_names.sort}" + end + + deps = Apaka::Packaging::GemDependencies.resolve_all([["rgl","0.5.7"]]) + dep_names = deps.collect {|x| x[0]} + ["stream", "lazy_priority_queue"].each do |dep_name| + assert dep_names.include?(dep_name), "Require #{dep_name} in dependencies: #{dep_names.sort}" end end + def test_resolve_by_name - deps = Apaka::Packaging::GemDependencies.resolve_by_name("rgl") - ["stream","generator","lazy_priority_queue"].each do |dep| - assert(deps.has_key?(dep)) + deps = Apaka::Packaging::GemDependencies.resolve_by_name("rgl", version: "0.5.10") + dep_names = deps.collect {|x| x[0]} + ["stream", "pairing_heap", "rexml"].each do |dep_name| + assert dep_names.include?(dep_name), "Require #{dep_name} in dependencies: #{dep_names.sort}" end end + end diff --git a/test/test_target_platform.rb b/test/test_target_platform.rb index 49871be5..f08479e5 100644 --- a/test/test_target_platform.rb +++ b/test/test_target_platform.rb @@ -4,12 +4,19 @@ class TestTargetPlatform < Minitest::Test attr_reader :platforms + attr_reader :outdated_platforms def setup @platforms = Array.new - @platforms << Apaka::Packaging::TargetPlatform.new("jessie","amd64") @platforms << Apaka::Packaging::TargetPlatform.new("trusty","amd64") @platforms << Apaka::Packaging::TargetPlatform.new("xenial","amd64") + @platforms << Apaka::Packaging::TargetPlatform.new("jammy","amd64") + + @platforms << Apaka::Packaging::TargetPlatform.new("buster","amd64") + @platforms << Apaka::Packaging::TargetPlatform.new("bookworm","amd64") + + @outdated_platforms = Array.new + @outdated_platforms << Apaka::Packaging::TargetPlatform.new("jessie","amd64") @rock_platforms = Array.new @rock_platforms << Apaka::Packaging::TargetPlatform.new("master","amd64") @@ -23,10 +30,10 @@ def setup end def test_distribution - ["jessie","sid"].each do |name| + ["jessie", "buster", "bookworm"].each do |name| assert(Apaka::Packaging::TargetPlatform::isDebian(name), "'#{name}' is debian distribution") end - ["trusty","vivid","wily","xenial","yakkety"].each do |name| + ["trusty","vivid","wily","xenial","yakkety", "jammy", "naughty",].each do |name| assert(Apaka::Packaging::TargetPlatform::isUbuntu(name), "'#{name}' is ubuntu distribution") end end @@ -34,7 +41,7 @@ def test_distribution def test_package_available enforce_build = Apaka::Packaging::Config.packages_enforce_build Apaka::Packaging::Config.packages_enforce_build = [] - ["cucumber","bundler","ruby-facets","cmake"].each do |pkg| + ["cucumber","bundler","ruby-thor","cmake"].each do |pkg| platforms.each do |platform| assert( platform.contains(pkg), "'#{pkg} is available for #{platform}" ) end @@ -88,6 +95,14 @@ def test_ruby_package_unavailable assert( !platform.contains(pkg), "'#{pkg}' is not available for #{platform}") end end + + ["nonsense","concurrent-ruby"].each do |pkg| + @outdated_platforms.each do |platform| + assert_raises RuntimeError do + platform.contains(pkg) + end + end + end end def test_rock_all_parents @@ -123,10 +138,10 @@ def test_rock_release_name invalid_names.each do |name| begin d.rock_release_name = name - assert(false, "Invalid release name #{name} is detected") - rescue ArgumentError => e - assert(true, "Invalid release name #{name} is detected - #{e}") - end + assert(false, "Invalid release name #{name} is detected") + rescue ArgumentError => e + assert(true, "Invalid release name #{name} is detected - #{e}") + end end end From 777c7d2694c6fec0638b3d6ed67e061a3e3b066f Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Thu, 24 Aug 2023 22:26:37 +0200 Subject: [PATCH 13/22] Enable ci for ubuntu 22.04 --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5213bec4..df644a50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,18 +2,18 @@ name: test on: [push] jobs: unittests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Branch name shell: bash run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" id: current_branch - - name: Build 18.04 - run: docker build -t 2maz/apaka -f Dockerfile . --build-arg PKG_BRANCH=${{ steps.current_branch.outputs.branch }} + - name: Build 22.04 + run: docker build -t 2maz/apaka -f Dockerfile.22-04 . --build-arg PKG_BRANCH=${{ steps.current_branch.outputs.branch }} - - name: Test-on-ubuntu:18.04 + - name: Test-on-ubuntu 22.04 run: docker run --privileged 2maz/apaka /bin/sh -c "cd /home/docker/apaka/; BUNDLE_GEMFILE=/home/docker/apaka/test/workspace/.autoproj/Gemfile rake test" From 1acbaa6937ee03c34585afa724502e9296d47bd2 Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Sat, 26 Aug 2023 09:54:48 +0200 Subject: [PATCH 14/22] test: fix dynamic importing of packages --- lib/apaka/packaging/autoproj2adaptor.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/apaka/packaging/autoproj2adaptor.rb b/lib/apaka/packaging/autoproj2adaptor.rb index 56443eb6..6a08faa2 100644 --- a/lib/apaka/packaging/autoproj2adaptor.rb +++ b/lib/apaka/packaging/autoproj2adaptor.rb @@ -243,7 +243,9 @@ def pkgmanifest_by_name(package_name) Packaging.warn "Apaka::Packaging::Autoproj2Adaptor: package '#{package_name}' is not present in workspace -- trying to load package" ps = Autoproj::PackageSelection.new ps.select(ps, package_name) - Autoproj.workspace.load_packages(ps) + + ops = Autoproj::Ops::Import.new(Autoproj.workspace) + ops.import_packages(ps) end rescue Exception => e Packaging.warn "Apaka::Packaging::Autoproj2Adaptor: failed to load package '#{package_name}' -- #{e}" From 553bd25f347a1f697bcd5518932bbb6c3269f15c Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Sat, 26 Aug 2023 09:56:04 +0200 Subject: [PATCH 15/22] Fix TargetPlatform.contains for rock packages --- lib/apaka/packaging/target_platform.rb | 13 ++++++++++--- test/test_target_platform.rb | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/apaka/packaging/target_platform.rb b/lib/apaka/packaging/target_platform.rb index 6f8ca89a..dd05bb04 100644 --- a/lib/apaka/packaging/target_platform.rb +++ b/lib/apaka/packaging/target_platform.rb @@ -267,7 +267,15 @@ def contains?(package, cache_results = true) urls << File.join(debian,release_name,architecture,package,"download") end elsif TargetPlatform::isRock(release_name) - urls << File.join(Packaging::Config.rock_releases[release_name][:url],"pool","main","r",package) + # Assuming that the (apache) webservice is hosting the /var/www/apaka-releases folder, so that + # it also becomes accessible locally + url = File.join(Packaging::Config.rock_releases[release_name][:url],"pool","main","r",package) + if ! url =~ /^http/ + # ensure that the deb package for the particular architecture is available + raise ArgumentError, "Release #{release_name} requires a proper url - current is invalid: #{url}" + end + url = "--level 1 --recursive --no-directories --accept \"#{package}*_#{architecture}.deb\" #{url}" + urls << url else raise ArgumentError, "Unknown distribution #{release_name}" end @@ -339,7 +347,7 @@ def contains?(package, cache_results = true) end end elsif TargetPlatform::isRock(release_name) - if outfile_content.include?("404") + if !outfile_content.include?("404") result = true end end @@ -348,7 +356,6 @@ def contains?(package, cache_results = true) end end - # Leave files as cache [outfile, errorfile].each do |file| if file && File.exist?(file) diff --git a/test/test_target_platform.rb b/test/test_target_platform.rb index f08479e5..9bf6e504 100644 --- a/test/test_target_platform.rb +++ b/test/test_target_platform.rb @@ -116,8 +116,10 @@ def test_rock_parent_contains msg, status = Open3.capture2(cmd) end Apaka::Packaging::Config.rock_releases["transterra"] = { :depends_on => ["master"], :url => "" } + master = Apaka::Packaging::TargetPlatform.new("master","amd64") transterra = Apaka::Packaging::TargetPlatform.new("transterra","amd64") ["rock-master-base-cmake"].each do |pkg| + assert( master.contains(pkg), "'#{master} contains #{pkg}" ) assert( transterra.ancestorContains(pkg), "'#{transterra} ancestor contains #{pkg}" ) end end From 348d154ef694a9e9ea7ecec28ece512a9c5e64c5 Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Sat, 26 Aug 2023 09:56:41 +0200 Subject: [PATCH 16/22] Silence warning to missing apt-utils package --- lib/apaka/packaging/templates/etc-pbuilderrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index 10aa73f7..f4c08828 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -91,7 +91,7 @@ fi # perl-openssl-defaults is needed due to the bug in the debootstrap: https://bugs.launchpad.net/ubuntu/+source/debootstrap/+bug/86536?comments=all # the issue arrised by building qtbindings -EXTRA_PACKAGES+="apt,cmake,dh-autoreconf,libgl1-mesa-dev,libboost-dev,yard,gem2deb,perl-openssl-defaults" +EXTRA_PACKAGES+="apt,apt-utils,cmake,dh-autoreconf,libgl1-mesa-dev,libboost-dev,yard,gem2deb,perl-openssl-defaults" DEBOOTSTRAPOPTS+=("--include=$EXTRA_PACKAGES") echo "DIST: ${DIST}" From e9b4c8467638619c0a055bdcbae2ff4f663eb2cc Mon Sep 17 00:00:00 2001 From: Anna Born Date: Sat, 26 Aug 2023 10:45:26 +0200 Subject: [PATCH 17/22] fix whitespace in deps definition --- lib/apaka/packaging/autoproj2adaptor.rb | 2 +- lib/apaka/packaging/gem_dependencies.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/apaka/packaging/autoproj2adaptor.rb b/lib/apaka/packaging/autoproj2adaptor.rb index d5376649..1ecf61f8 100644 --- a/lib/apaka/packaging/autoproj2adaptor.rb +++ b/lib/apaka/packaging/autoproj2adaptor.rb @@ -550,7 +550,7 @@ def dependencies(pkg, with_rock_release_prefix = true) version = $1 end - name = name.gsub(/[<>=]=?.*$/,"") + name = name.gsub(/[ <>=]=?.*$/,"") extra_gems << [name, version] non_native_dependencies << [name, version] diff --git a/lib/apaka/packaging/gem_dependencies.rb b/lib/apaka/packaging/gem_dependencies.rb index 1b8d2136..df683729 100644 --- a/lib/apaka/packaging/gem_dependencies.rb +++ b/lib/apaka/packaging/gem_dependencies.rb @@ -108,7 +108,6 @@ def self.resolve_all_deps(gems = [], gemfile: "/tmp/apaka/Gemfile.all") name = gem end - name = name.strip if available_specs.has_key?(name) # skip already available definition next From 6011db3532d7112b4c9e0a394ef6ff119fd00cee Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Sat, 26 Aug 2023 10:54:59 +0200 Subject: [PATCH 18/22] ci: update workflow to use os matrix --- .github/workflows/test.yml | 29 ++++++++++++--------- Dockerfile => Dockerfile.ubuntu-20.04 | 2 +- Dockerfile.22-04 => Dockerfile.ubuntu-22.04 | 13 ++++++--- 3 files changed, 27 insertions(+), 17 deletions(-) rename Dockerfile => Dockerfile.ubuntu-20.04 (98%) rename Dockerfile.22-04 => Dockerfile.ubuntu-22.04 (76%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df644a50..ac73a665 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,19 +1,22 @@ name: test on: [push] jobs: - unittests: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 + testing: + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04] + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 - - name: Branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: current_branch + - name: Branch name + shell: bash + run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT + id: current_branch - - name: Build 22.04 - run: docker build -t 2maz/apaka -f Dockerfile.22-04 . --build-arg PKG_BRANCH=${{ steps.current_branch.outputs.branch }} + - name: Build {{ matrix.os }} + run: docker build -t 2maz/apaka -f Dockerfile.{{ matrix.os }} . --build-arg PKG_BRANCH=${{ steps.current_branch.outputs.branch }} - - name: Test-on-ubuntu 22.04 - run: docker run --privileged 2maz/apaka /bin/sh -c "cd /home/docker/apaka/; BUNDLE_GEMFILE=/home/docker/apaka/test/workspace/.autoproj/Gemfile rake test" + - name: Test-on-ubuntu {{ matrix.os }} + run: docker run --privileged 2maz/apaka /bin/sh -c "cd /home/docker/apaka/; BUNDLE_GEMFILE=/home/docker/apaka/test/workspace/.autoproj/Gemfile rake test" diff --git a/Dockerfile b/Dockerfile.ubuntu-20.04 similarity index 98% rename from Dockerfile rename to Dockerfile.ubuntu-20.04 index 45f6b3ae..0d668c01 100644 --- a/Dockerfile +++ b/Dockerfile.ubuntu-20.04 @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 MAINTAINER 2maz "https://github.com/2maz" diff --git a/Dockerfile.22-04 b/Dockerfile.ubuntu-22.04 similarity index 76% rename from Dockerfile.22-04 rename to Dockerfile.ubuntu-22.04 index 06efbb54..54f44bb2 100644 --- a/Dockerfile.22-04 +++ b/Dockerfile.ubuntu-22.04 @@ -27,6 +27,7 @@ RUN echo "docker ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers USER docker WORKDIR /home/docker +COPY --chown=docker . apaka ENV LANG de_DE.UTF-8 ENV LANG de_DE:de ENV LC_ALL de_DE.UTF-8 @@ -34,14 +35,20 @@ ENV LC_ALL de_DE.UTF-8 ENV GEM_HOME=/home/docker/.gems/ruby/3.0.0 ENV PATH=$GEM_HOME/bin:$PATH -RUN git clone https://github.com/rock-core/tools-apaka /home/docker/apaka -COPY --chown=docker .ci/prepare-package.sh prepare-package.sh -RUN /bin/bash prepare-package.sh /home/docker/apaka +#RUN git clone https://github.com/rock-core/tools-apaka /home/docker/apaka +#COPY --chown=docker .ci/prepare-package.sh prepare-package.sh +#RUN /bin/bash prepare-package.sh /home/docker/apaka RUN sed -i 's#gems_install_path.*#gems_install_path: /home/docker/.gems#' /home/docker/apaka/test/workspace/.autoproj/config.yml RUN git config --global user.name 'Apaka4docker' RUN git config --global user.email 'apaka@docker' +#RUN git clone https://github.com/rock-core/autobuild +#RUN git clone https://github.com/rock-core/autoproj + +#RUN cd /home/docker/autobuild; gem build autobuild.gemspec +#RUN cd /home/docker/autoproj; gem build autoproj.gemspec + RUN gem install backports RUN gem install autoproj RUN gem install bundler:2.4.19 From 3e73b7241622dc0ca1e0affaf2cb25a43c57ba81 Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Sat, 26 Aug 2023 11:00:17 +0200 Subject: [PATCH 19/22] cii: fix workflow --- .github/workflows/test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac73a665..4dede0bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,18 +5,18 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04] - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 - - name: Branch name - shell: bash - run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT - id: current_branch + - name: Branch name + shell: bash + run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT + id: current_branch - - name: Build {{ matrix.os }} - run: docker build -t 2maz/apaka -f Dockerfile.{{ matrix.os }} . --build-arg PKG_BRANCH=${{ steps.current_branch.outputs.branch }} + - name: Build ${{ matrix.os }} + run: docker build -t 2maz/apaka -f Dockerfile.${{ matrix.os }} . --build-arg PKG_BRANCH=${{ steps.current_branch.outputs.branch }} - - name: Test-on-ubuntu {{ matrix.os }} - run: docker run --privileged 2maz/apaka /bin/sh -c "cd /home/docker/apaka/; BUNDLE_GEMFILE=/home/docker/apaka/test/workspace/.autoproj/Gemfile rake test" + - name: Test-on-ubuntu ${{ matrix.os }} + run: docker run --privileged 2maz/apaka /bin/sh -c "cd /home/docker/apaka/; BUNDLE_GEMFILE=/home/docker/apaka/test/workspace/.autoproj/Gemfile rake test" From b92f88cd50022615aef6b65406215031b7bea845 Mon Sep 17 00:00:00 2001 From: Anna Born Date: Sat, 26 Aug 2023 13:22:03 +0200 Subject: [PATCH 20/22] set correct version of distribution, remove default distributeion --- lib/apaka/packaging/templates/etc-pbuilderrc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index c10064fb..770ca550 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -6,16 +6,19 @@ echo "Reading pbuilder /etc/pbuilderrc" UBUNTU_DISTS="trusty vivid wily xenial yakkety zesty artful bionic cosmic disco eoan focal" DEBIAN_DISTS="sid wheezy jessie stretch buster bullseye" - if [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" != "x" ]; then echo "warning: DIST is not set, using DISTRIBUTION=${DISTRIBUTION}" DIST=$DISTRIBUTION elif [ "x${DIST}" != "x" ] && [ "x${DISTRIBUTION}" = "x" ]; then echo "warning: DISTRIBUTION is not set, using DIST=${DIST}" DISTRIBUTION=$DIST -elif [ "x${DIST}" = "x" ] && [ "x${DISTRIBUTION}" = "x" ]; then - DIST=bionic - echo "warning: no distribution set -- using default: ${DIST}" +elif [ "x${DIST}" != "x" ] && [ "x${DISTRIBUTION}" != "x" ]; then + echo "warning: DIST (${DIST}) and DISTRIBUTION (${DISTRIBUTION}) are both set. The value of DIST will be used." + DISTRIBUTION=$DIST +else + # no default distribution, let it fail + echo "ERROR: no DISTRIBUTION or DIST set" + exit 1 fi for NAME in $UBUNTU_DISTS; do @@ -45,8 +48,8 @@ if [ "$DIST_TYPE" == "ubuntu" ]; then # The port mirror site provides arm64, armel, armhf MIRRORSITE=http://ports.ubuntu.com/ubuntu-ports fi - - OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" + + OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" --components=main,restricted,universe,multiverse) EXTRA_PACKAGES+="ruby-all-dev," @@ -63,7 +66,7 @@ elif [ "$DIST_TYPE" == "debian" ]; then # gem2deb requires debhelper-compat # that comes with debhelper package EXTRA_PACKAGES+="debhelper," - fi + fi MIRRORSITE=http://ftp.no.debian.org/debian/ OTHERMIRROR="deb $MIRRORSITE $DIST-updates $COMPONENTS" @@ -91,7 +94,7 @@ fi EXTRA_PACKAGES+="apt,cmake,dh-autoreconf,libgl1-mesa-dev,libboost-dev,yard,gem2deb,perl-openssl-defaults" DEBOOTSTRAPOPTS+=("--include=$EXTRA_PACKAGES") -echo "DIST: ${DIST}" +echo "DISTRIBUTION: ${DISTRIBUTION} (DIST: ${DIST})" echo "ARCH: ${ARCH}" echo "COMPONENTS: ${COMPONENTS}" echo "DIST_TYPE: ${DIST_TYPE}" From 4bc442dba692b61278c34fbccc48bed28bdf2031 Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Sat, 26 Aug 2023 17:33:20 +0200 Subject: [PATCH 21/22] ci: fix 20.04 setup --- .github/workflows/test.yml | 3 +++ Dockerfile.ubuntu-20.04 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4dede0bf..f1a2834d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,9 @@ on: [push] jobs: testing: strategy: + # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs + # allow individual matrix job to complete + fail-fast: false matrix: os: [ubuntu-20.04, ubuntu-22.04] runs-on: ubuntu-22.04 diff --git a/Dockerfile.ubuntu-20.04 b/Dockerfile.ubuntu-20.04 index 0d668c01..b1f470be 100644 --- a/Dockerfile.ubuntu-20.04 +++ b/Dockerfile.ubuntu-20.04 @@ -30,7 +30,7 @@ WORKDIR /home/docker ENV LANG de_DE.UTF-8 ENV LANG de_DE:de ENV LC_ALL de_DE.UTF-8 -ENV GEM_HOME=/home/docker/.gems/ruby/2.5.0 +ENV GEM_HOME=/home/docker/.gems/ruby/2.7.0 ENV PATH=$GEM_HOME/bin:$PATH RUN git clone https://github.com/rock-core/tools-apaka /home/docker/apaka From 8433d515d62345aae942c455a0d956301158cab7 Mon Sep 17 00:00:00 2001 From: Thomas Roehr Date: Tue, 29 Aug 2023 23:31:01 +0200 Subject: [PATCH 22/22] pbuilderrc: set DISTRIBUTION along with DIST --- lib/apaka/packaging/templates/etc-pbuilderrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/apaka/packaging/templates/etc-pbuilderrc b/lib/apaka/packaging/templates/etc-pbuilderrc index ccfbec47..7102ba00 100644 --- a/lib/apaka/packaging/templates/etc-pbuilderrc +++ b/lib/apaka/packaging/templates/etc-pbuilderrc @@ -19,8 +19,9 @@ elif [ -n ${DIST} ] && [ -z ${DISTRIBUTION} ]; then echo "warning: DISTRIBUTION is not set, using DIST=${DIST}" DISTRIBUTION=$DIST else - # no default distribution, let it fail + # no distribution specified, use currently running distribution DIST=$(lsb_release -sc) + DISTRIBUTION=$DIST echo "warning: no distribution set -- using default: ${DIST}" fi