Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dradis: quick build fix #4105

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions packages/dradis-ce/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# See COPYING for license details.

pkgname=dradis-ce
pkgver=6292.2cdcfc13
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")
Expand All @@ -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

sed -i "s|ruby '2.4.1'||g" Gemfile
# make it work for ruby 3.2.x
sed -i "s|ruby '3.1.2'||g" Gemfile

# 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

#patch -p1 -i ../dradis-ce.patch
# 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() {
Expand All @@ -51,8 +69,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"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/dradis-ce/dradis-ce.install
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
Expand Down
92 changes: 0 additions & 92 deletions packages/dradis-ce/dradis-ce.patch

This file was deleted.