Files
chromebrew/packages/pkgsrc.rb
Cassandra Watergate d6e779ccd3 Crew profile base (#5503)
* Make basic crew-profile-base package

* Use crew consts

* Upgrade to 0.0.2-pre2

* Convert aa* to cf*

* Docbook

* aa* to dz*

* docbook-xsl

* through fz* and fix environment variables

* through mz*

* through pz*

* through zz*

* fix crew-profile-base

* upgrade crew-profile-base

* major crew-profile-base changes

* Upgrade crew-profile-base and fix xdg-base

* fix sha256sum

* Remove stale files

* pkgsrc and sommelier

* Add crew-profile-base to core packages and ready for merging

* Bump versions

* prevent conflicts with #5494

* fix sha256sum

* fix fop

* profile.d is not ours

* fix bash

* Upgrade crew-profile-base to 0.0.1-pre6 and fix bash

* Remove self-referencing comment

* Add binaries, fix rust, fix #{@ver}

* move compatibility line

* add core mandb deps back

* File.exists? => File.exist?

* deduplicate @env

* update packages

* Fix gdk_pixbug source url

* Add binaries, use rubocop style fixes

* Update cf from 6.36.1-1 to 6.53.0

* fix sl

* fix depot tools

* remove apulse since it conflicts with pulseaudio.

* refactor crew_profile_base

* first tranche of builds

* go

* add cf

* hunspell

* transmission

* clean up dependency & env situation for gdk_pixbuf

* fix gettext

* fix nano

* fix intel-media-driver

* add zziplib for texlive

* fix texlive

* split fuse for flatpak

* fix flatpak

* delete rack (broken and unmaintained)

* fix packer completion

* modify and fix sl

* fix s

* fix stressng

* fix stack

* Add TMPDIR

* Remove TMPDIR from build files

* Fix aws2 version

* Go: remove extraneous dependency

* hunspell_fr_fr: use french in description

* intel media driver: remove case x86_64

* aws2: quickfix

* everything but texlive

* texlive

* fix stressng

* Delete pkgsrc.rb

* add back pkgsrc

Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Ed Reel <edreel@gmail.com>
Co-authored-by: satmandu <satadru@umich.edu>
2021-04-08 21:49:18 -05:00

129 lines
5.4 KiB
Ruby

require 'package'
class Pkgsrc < Package
description 'pkgsrc is a framework for building third-party software on NetBSD and other UNIX-like systems'
homepage 'https://github.com/NetBSD/pkgsrc'
version '2021Q1'
license '' # Can't find license
compatibility 'all'
source_url 'https://github.com/NetBSD/pkgsrc/archive/ccaf3cb68a965f1b055b3e04485d725fc7043813.tar.gz'
source_sha256 '16039f24bb84d5046832e462cfd7a21c5f53dd15792a9e6b71fa4faec3a7ab4e'
def self.build
@pkglocate = <<~EOF
#!/bin/bash
cd #{CREW_PREFIX}/pkgsrc
./pkglocate "$@"
EOF
IO.write("pkglocate", @pkglocate)
end
def self.install
case ARCH
when 'aarch64', 'armv7l'
abi = ''
when 'i686'
abi = '32'
when 'x86_64'
abi = '64'
end
ENV['SH'] = '/bin/bash'
ENV['OS_VARIANT'] = 'chromeos'
FileUtils.chdir 'bootstrap' do
system "./bootstrap --abi=#{abi} --preserve-path --unprivileged --prefix=#{CREW_PREFIX}/pkg \
--pkgdbdir=#{CREW_PREFIX}/pkg/pkgdb --sysconfdir=#{CREW_PREFIX}/pkg/etc --varbase=#{CREW_PREFIX}/pkg/var \
--workdir=#{CREW_DEST_PREFIX} --cwrappers=no --prefer-pkgsrc=yes --make-jobs=#{CREW_NPROC}"
end
FileUtils.mv "#{CREW_PREFIX}/pkg", "#{CREW_DEST_PREFIX}"
FileUtils.chdir "#{CREW_DEST_PREFIX}/bin" do
system 'rm -f bmake nawk sed'
end
FileUtils.chdir "#{CREW_DEST_PREFIX}/sbin" do
system 'rm -f *'
end
FileUtils.chdir "#{CREW_DEST_PREFIX}" do
system "curl -#LO ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-#{version}/pkgsrc-#{version}.tar.xz"
abort 'Checksum mismatch. :/ Try again.'.lightred unless Digest::SHA256.hexdigest( File.read("pkgsrc-#{version}.tar.xz") ) == '133d2f79115c87ad7dbf6f7ab604ddc0d09afe3b1d3c4cda5670c1fb758eb283'
system "tar xvf pkgsrc-#{version}.tar.xz"
FileUtils.rm_f "pkgsrc-#{version}.tar.xz"
FileUtils.rm_rf 'wrk'
end
system "install -Dm755 pkglocate #{CREW_DEST_PREFIX}/pkg/sbin/pkglocate"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/env.d/"
@env = <<~EOF
# NetBSD pkgsrc configuration
source #{CREW_PREFIX}/share/s/s-completion.bash
export PATH="$PATH:#{CREW_PREFIX}/pkg/bin:#{CREW_PREFIX}/pkg/gnu/bin:#{CREW_PREFIX}/pkg/sbin"
export MANPATH="$MANPATH:#{CREW_PREFIX}/pkg/man"
EOF
IO.write("#{CREW_DEST_PREFIX}/etc/env.d/pkgsrc", @env)
end
def self.postinstall
# This needs more help than saltedcoffii can do right now
puts
puts "You may wish to have the vulnerabilities file downloaded daily so that it"
puts "remains current. This may be done by adding an appropriate entry to the root"
puts "users crontab(5) entry. For example, the entry"
puts
puts "# Download vulnerabilities file"
puts "0 3 * * * #{CREW_PREFIX}/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1"
puts "# Audit the installed packages and email results to root"
puts "9 3 * * * #{CREW_PREFIX}/pkg/sbin/pkg_admin audit |mail -s 'Installed package audit result' \\"
puts " root >/dev/null 2>&1"
puts
puts "will update the vulnerability list every day at 3AM, followed by an audit at"
puts "3:09AM. The result of the audit are then emailed to root. On NetBSD this may be"
puts "accomplished instead by adding the following line to #{CREW_PREFIX}/pkg/etc/daily.conf:"
puts
puts "fetch_pkg_vulnerabilities=YES"
puts
puts "to fetch the vulnerability list from the daily security script. The system is"
puts "set to audit the packages by default but can be set explicitly, if desired (not"
puts "required), by adding the following line to #{CREW_PREFIX}/pkg/etc/security.conf:"
puts
puts "check_pkg_vulnerabilities=YES"
puts
puts "Both pkg_admin subcommands can be run as as an unprivileged user,"
puts "as long as the user chosen has permission to read the pkgdb and to write"
puts "the pkg-vulnerabilities to #{CREW_PREFIX}/pkg/pkgdb."
puts
puts "The behavior of pkg_admin and pkg_add can be customised with"
puts "pkg_install.conf. Please see pkg_install.conf(5) for details."
puts
puts "If you want to use GPG signature verification you will need to install"
puts "GnuPG and set the path for GPG appropriately in your pkg_install.conf."
puts "==========================================================================="
puts "===> running: #{CREW_PREFIX}/bin/install-sh -d -o chronos -g lp #{CREW_PREFIX}/pkg/etc"
puts
puts "==========================================================================="
puts
puts "An example mk.conf file with the settings you provided to 'bootstrap'"
puts "has been created for you. It can be found in:"
puts
puts " #{CREW_PREFIX}/pkg/etc/mk.conf"
puts
puts "You can find extensive documentation of the NetBSD Packages Collection"
puts "in #{CREW_PREFIX}/doc/pkgsrc.txt."
puts
puts "Thank you for using pkgsrc!".lightgreen
puts
puts "To install packages, execute the following:".lightblue
puts "cd #{CREW_PREFIX}/pkgsrc/<category>/<package>".lightblue
puts "bmake package-install".lightblue
puts "Example:".lightblue
puts "cd #{CREW_PREFIX}/pkgsrc/net/libfetch && bmake package-install".lightblue
puts
puts "To search packages, execute 'pkglocate <string>'.".lightblue
puts
end
def self.remove
puts
puts "To completely remove pkgsrc and all packages, execute the following:".lightblue
puts "rm -rf #{CREW_PREFIX}/pkg #{CREW_PREFIX}/pkgsrc".lightblue
puts
end
end