From 0a59dc5f1efc48a1673f1a431def5f2f9b796462 Mon Sep 17 00:00:00 2001 From: noraj Date: Fri, 22 Mar 2024 01:17:10 +0100 Subject: [PATCH 1/2] dradis: quick build fix --- packages/dradis-ce/PKGBUILD | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/dradis-ce/PKGBUILD b/packages/dradis-ce/PKGBUILD index fd482aca51a..304c2dccbc8 100644 --- a/packages/dradis-ce/PKGBUILD +++ b/packages/dradis-ce/PKGBUILD @@ -3,7 +3,7 @@ pkgname=dradis-ce pkgver=6292.2cdcfc13 -pkgrel=1 +pkgrel=2 pkgdesc='An open source framework to enable effective information sharing.' groups=('blackarch' 'blackarch-recon' 'blackarch-misc') url='https://dradis.com/ce/' @@ -26,7 +26,7 @@ pkgver() { prepare() { cd $pkgname - sed -i "s|ruby '2.4.1'||g" Gemfile + sed -i "s|ruby '3.1.2'||g" Gemfile #patch -p1 -i ../dradis-ce.patch } @@ -51,8 +51,8 @@ EOF cp "$pkgdir/usr/share/$pkgname/config/database.yml.template" \ "$pkgdir/usr/share/$pkgname/config/database.yml" - cp "$pkgdir/usr/share/$pkgname/config/secrets.yml.template" \ - "$pkgdir/usr/share/$pkgname/config/secrets.yml" + cp "$pkgdir/usr/share/$pkgname/config/smtp.yml.template" \ + "$pkgdir/usr/share/$pkgname/config/smtp.yml" rm -f "$pkgdir/usr/share/dradis-ce/Gemfile.plugins" } From 6b8c1ac6f916d383031c13e2d6a2327e00fc9e42 Mon Sep 17 00:00:00 2001 From: noraj Date: Wed, 14 Aug 2024 20:36:59 +0200 Subject: [PATCH 2/2] fix lot of issues --- packages/dradis-ce/PKGBUILD | 34 +++++++--- packages/dradis-ce/dradis-ce.install | 2 + packages/dradis-ce/dradis-ce.patch | 92 ---------------------------- 3 files changed, 28 insertions(+), 100 deletions(-) delete mode 100644 packages/dradis-ce/dradis-ce.patch diff --git a/packages/dradis-ce/PKGBUILD b/packages/dradis-ce/PKGBUILD index 304c2dccbc8..e611a19cbd3 100644 --- a/packages/dradis-ce/PKGBUILD +++ b/packages/dradis-ce/PKGBUILD @@ -2,14 +2,15 @@ # See COPYING for license details. pkgname=dradis-ce -pkgver=6292.2cdcfc13 -pkgrel=2 +pkgver=v4.9.0.r547.g5ed0b25 +pkgrel=1 pkgdesc='An open source framework to enable effective information sharing.' groups=('blackarch' 'blackarch-recon' 'blackarch-misc') url='https://dradis.com/ce/' license=('GPL') -depends=('ruby' 'ruby-bundler' 'git' 'libxslt' 'mariadb-libs') -makedepends=('git') +# Tmp fix, requires erb explicitely https://gitlab.archlinux.org/archlinux/packaging/packages/ruby-erb/-/issues/1 +depends=('ruby' 'ruby-erb' 'ruby-bundler' 'git' 'libxslt' 'postgresql-libs' 'sqlite' 'libsass') +makedepends=('git' 'pkgconf') arch=('any') source=("git+https://github.com/dradis/$pkgname.git" "$pkgname.sysusers.conf") @@ -18,17 +19,34 @@ sha512sums=('SKIP' '104c3f6d2dcdc5cd02092ad16783dcd1907ff8fba95c87db609fe5c7307ca4fd97730b5117d6db78d9fd9273c4fd5c963b7d404d08cb8615f3a9fe3864f16c95') pkgver() { - cd $pkgname - - echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD) + cd "$pkgname" + ( set -o pipefail + git describe --long --tags --abbrev=7 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" + ) } prepare() { cd $pkgname + # make it work for ruby 3.2.x sed -i "s|ruby '3.1.2'||g" Gemfile - #patch -p1 -i ../dradis-ce.patch + # tmp fix, https://github.com/dradis/dradis-ce/pull/1286 + sed -i "s|File.exists?|File.exist?|g" Gemfile + + # bundle tries to solve conflicts and compatibilities issue even for EXCLUDED gems (e.g. --without) + # so we have to remove the dev and test dependencies from the Gemfile else we won't be able to install without error + #sed -i '/group :development/,/end/d' Gemfile + #sed -i '/group :test/,/end/d' Gemfile + + # sqlite build error, because native gem support requires bundler 2.5.6+ and Gemfile.lock is built with 2.3.16 + # https://github.com/sparklemotion/sqlite3-ruby/blob/main/INSTALLATION.md + # patch BUNDLED_WITH + sed -i "s|2.3.16|2.5.11|g" Gemfile.lock + # also Gemfile.lock requires sqlite 1.4.0 but native gem requires 2.0+ + sed -i "s|sqlite3 (1.4.2)|sqlite3 (2.0.4)|g" Gemfile.lock + # rm Gemfile.lock } package() { diff --git a/packages/dradis-ce/dradis-ce.install b/packages/dradis-ce/dradis-ce.install index 55c1a4ebfb9..fa206f44b05 100644 --- a/packages/dradis-ce/dradis-ce.install +++ b/packages/dradis-ce/dradis-ce.install @@ -2,7 +2,9 @@ post_install() { set -e cd /usr/share/dradis-ce bundle config --local build.nokogiri --use-system-libraries + # bundle config --local build.sqlite3 --enable-system-libraries bundle config --local path vendor/bundle + bundle config set --local without development test ruby bin/setup systemd-sysusers dradis-ce.conf post_group "$@" diff --git a/packages/dradis-ce/dradis-ce.patch b/packages/dradis-ce/dradis-ce.patch deleted file mode 100644 index 442c5e44242..00000000000 --- a/packages/dradis-ce/dradis-ce.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff --git a/Gemfile.plugins.template b/Gemfile.plugins.template -index da2da4d..e070e10 100644 ---- a/Gemfile.plugins.template -+++ b/Gemfile.plugins.template -@@ -27,6 +27,8 @@ gem 'dradis-nessus', '~> 3.6', github: 'dradis/dradis-nessus' - gem 'dradis-nexpose', '~> 3.6', github: 'dradis/dradis-nexpose' - gem 'dradis-nikto', '~> 3.6', github: 'dradis/dradis-nikto' - gem 'dradis-nmap', '~> 3.6', github: 'dradis/dradis-nmap' -+# dradis-nmap also requires ruby-nmap -+gem 'ruby-nmap', '~> 0.7' - gem 'dradis-ntospider', '~> 3.6', github: 'dradis/dradis-ntospider' - gem 'dradis-openvas', '~> 3.6', github: 'dradis/dradis-openvas' - gem 'dradis-qualys', '~> 3.6', github: 'dradis/dradis-qualys' -diff --git a/bin/bundle b/bin/bundle -index 66e9889..56fbef1 100755 ---- a/bin/bundle -+++ b/bin/bundle -@@ -1,3 +1,3 @@ --#!/usr/bin/env ruby -+#!/usr/bin/env ruby-2.3 - ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - load Gem.bin_path('bundler', 'bundle') -diff --git a/bin/rails b/bin/rails -index 0739660..ffad6ab 100755 ---- a/bin/rails -+++ b/bin/rails -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/env ruby-2.3 - APP_PATH = File.expand_path('../config/application', __dir__) - require_relative '../config/boot' - require 'rails/commands' -diff --git a/bin/rake b/bin/rake -index 1724048..5719296 100755 ---- a/bin/rake -+++ b/bin/rake -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/env ruby-2.3 - require_relative '../config/boot' - require 'rake' - Rake.application.run -diff --git a/bin/rspec b/bin/rspec -index d738b23..b4e1253 100755 ---- a/bin/rspec -+++ b/bin/rspec -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/env ruby-2.3 - # frozen_string_literal: true - # - # This file was generated by Bundler. -diff --git a/bin/setup b/bin/setup -index 4f2c076..23ae179 100755 ---- a/bin/setup -+++ b/bin/setup -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/env ruby-2.3 - require 'fileutils' - require 'pathname' - include FileUtils -@@ -20,8 +20,7 @@ Dir.chdir APP_ROOT do - end - - puts '== Installing dependencies ==' -- system! 'gem install bundler --conservative' -- system('bundle check') || system!('bundle install') -+ system('bundle-2.3 check') || system!('bundle-2.3 install') - - puts "\n== Copying sample files ==" - unless File.exist?('config/database.yml') -diff --git a/bin/update b/bin/update -index a8e4462..d82f3de 100755 ---- a/bin/update -+++ b/bin/update -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/env ruby-2.3 - require 'pathname' - require 'fileutils' - include FileUtils -@@ -15,8 +15,7 @@ chdir APP_ROOT do - # Add necessary update steps to this file. - - puts '== Installing dependencies ==' -- system! 'gem install bundler --conservative' -- system('bundle check') || system!('bundle install') -+ system('bundle-2.3 check') || system!('bundle-2.3 install') - - puts "\n== Updating database ==" - system! 'bin/rails db:migrate'