[EMAIL PROTECTED] wrote:
On 12.12-16:25, [EMAIL PROTECTED] wrote:
I tried using pkgsrc-2007Q3 but it sucks. Updating userland in
production environment with pkgsrc on a non-NetBSD platform is a
nightmare.
i'm working on this. will post when significant progress has been
made. in my opinion having a working pkgsrc tree is better for
everyone, doesn't mean we can't have an openbsd branch (so to speak)
but unifying our efforts with others in this field will have benefits.
Agreed. I also think that pkgsrc (http://www.netbsd.org/docs/pkgsrc/)
would be a good thing to have in OpenBSD. It has over 7,300 ports, it is
being released several times per year, and *has* updates in -stable.
I installed and configured pkgsrc-2007Q3 release on OpenBSD 4.2 and then
updated to -stable. It bootstraped correctly, built some packages but I
didn't make it possible to build Perl and xxfb. It was the reason
I dropped it for now.
Here are the steps I performed configuring OpenBSD 4.2 to use
pkgsrc-2007Q3 (the majority of actions are taken from pkgsrc guide,
found in URL above, please read the guide before taking any action below)...
1) Create /root/.cvsrc with following lines:
checkout -P
update -dP
release -d
diff -upN
cvs -q -z3
rdiff -u
2) Add following lines to existing /root/.profile and export these
variables to running environment (there are also additional pkgsrc
mirrors found at http://www.netbsd.org/mirrors/#anoncvs):
CVSROOT="[EMAIL PROTECTED]:/cvsroot"
CVS_RSH="ssh"
export CVSROOT CVS_RSH
3) Checkout pkgsrc-2007Q3 release, this creates /usr/pkgsrc directory
('#' is a root prompt):
# cd /usr
# cvs -q checkout -rpkgsrc-2007Q3 -P pkgsrc
...
... (be patient here)
4) Then, update pkgsrc to -stable (YEAH! :-)
# cd /usr/pkgsrc
# cvs -q update -dP
...
... (be patient here also)
(CVS keeps track of the initial checkout branch, i.e. pkgsrc-2007Q3)
5) Read the latest docs, changes and READMEs from these dirs:
/usr/pkgsrc/doc/
/usr/pkgsrc/mk/defaults/
6) Relocate original OpenBSD pkgtools (since pkgsrc has pkgtools with
same names):
# cd /usr/sbin
# mv pkg_add pkg_add.orig
# mv pkg_create pkg_create.orig
# mv pkg_delete pkg_delete.orig
# mv pkg_info pkg_info.orig
7) Remove PKG_PATH from environment (if set to OpenBSD repository)
since both OpenBSD pkgtools and pkgsrc use this variable:
unset PKG_PATH
(and comment it out from /root/.profile if there)
8) Bootstrap pkgsrc (FYI: bootstrap uses /var/db/pkg as default package
db, and since it is the same as OpenBSD's just use other path to avoid
problems). Bootstrapping creates initial infrastructure needed to build
packages:
# cd /usr/pkgsrc/bootstrap
# ./bootstrap --pkgdbdir /usr/pkg/db
...
... (be patient here)
After bootstrap finishes successfully, /usr/pkg is created. This is a
root path for running pkgsrc environment. Every installed package goes
to either /usr/pkg/bin or /usr/pkg/sbin.
9) Add following lines to the environment and /root/.profile:
PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH
export PATH
Issue the following commands (beware with ldconfig not to mistype or
forget to enter any additional local library paths you may have, it may
render your system unusable until next reboot!):
# echo "shlib_dirs=\"/usr/pkg/lib\"" >> /etc/rc.conf/local
# ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib /usr/pkg/lib
Change /etc/man.conf line:
_default /usr/{share,X11R6,local}/man/
into:
_default /usr/{pkg,share,X11R6,local}/man/
11) Issue pkg_info command (this is pkgsrc version of pkg_info) to see
packages installed after the bootstrap. On my machine this is as following:
# pkg_info
bootstrap-mk-files-20070810 *.mk files for the bootstrap bmake utility
bmake-20051105nb4 Portable (autoconf) version of NetBSD 'make' utility
tnftp-20070806 The enhanced FTP client in NetBSD
pax-20060202nb1 POSIX standard archiver with many extensions
pkg_install-20070927 Package management and administration tools for pkg
It is possible to read man pages of newly installed pkgsrc packages:
# man audit-packages
...
12) Now, edit your own main pkgsrc makefile (vi /usr/pkg/etc/mk.conf),
'#' is a comment:
###############################################################
# Example /usr/pkg/etc/mk.conf file produced by bootstrap-pkgsrc
# Wed Dec 12 10:20:21 CET 2007
.ifdef BSD_PKG_MK # begin pkgsrc settings
PKG_DBDIR= /usr/pkg/db
LOCALBASE= /usr/pkg
VARBASE= /var
PKG_TOOLS_BIN= /usr/pkg/sbin
PKGMANDIR= man
TOOLS_PLATFORM.pax?= /usr/pkg/bin/pax
TOOLS_PLATFORM.tar?= /usr/pkg/bin/tar
###############
# Added by jere
###############
# All applications are inet6 enabled,
# this avoids problems in some misbehaving applications.
# If possible, I want to avoid using threads. Just don't like them. :-)
# List of all options is found at
# /usr/pkgsrc/mk/defaults/options.description
PKG_DEFAULT_OPTIONS+= inet6 -threads
# I'm not sure if this is sufficient to use
# OpenBSD's native OpenSSL instead of one
# found in pkgsrc.
TOOLS_PLATFORM.openssl?=/usr/sbin/openssl
# This is the path for storing compiled packages.
# It is OK to copy packages from there to any
# other machine (with the same architecture)
PACKAGES= /usr/pkgsrc/packages
# I prefer to use as much as possible from the OpenBSD itself.
# Currently, I don't know if this helps or harms when building packages.
PREFER_NATIVE= yes
# It is bad for production machine to use
# packages with known vulnerabilities.
ALLOW_VULNERABLE_PACKAGES=no
# Use native pthreads, if some port requires it. I don't know is it
# better to use native ot pkgsrc threads implementation.
PREFER_NATIVE_PTHREADS= native
# Try every available mirror for fetching port source code.
FAILOVER_FETCH= yes
# Accept every kind of software license.
_ACCEPTABLE= yes
# I want to use OpenBSD's native X11.
X11_TYPE= native
X11BASE= /usr/X11R6
# I don't want to use pkgsrc's OpenSSL but the native one instead
# PREFER.openssl=pkgsrc
####################################################
# This bulk-build part is used for building/updating
# many packages at once. I didn't play with it
# extensively but people from NetBSD use it for
# producing many binary package at once.
#
# This is definitely a spot worth further investigation.
#####################################################
#BULK_PREREQ= pkgtools/digest
#SPECIFIC_PKGS=yes
#HOST_SPECIFIC_PKGS+= net/nmap \
x11/gnome-session \
archivers/unzip
#PKG_OPTIONS.nmap= pcre -ssl
# When updating some package also build package of every dependency.
#UPDATE_TARGET= package
#DEPENDS_TARGET= package
#
# Compilers, if commented -> we use defaults from mk/defaults/
#
#PKGSRC_COMPILER= gcc
#F77= /usr/pkg/gcc3/bin/g77
#PKG_FC= /usr/pkg/gcc3/bin/g77
#CC= /usr/pkg/gcc3/bin/gcc
#CXX= /usr/pkg/gcc3/bin/g++
#CPP= /usr/pkg/gcc3/bin/cpp
#ABI= 32
#LDFLAGS+= -L/usr/pkg/gcc3/lib
#CFLAGS+=
.endif # end pkgsrc settings
###############################################################
13) Now, we can try to build some package (we must use pkgsrc provided
'bmake' and not the "usual" 'make' command):
# cd /usr/pkgsrc/net/sipcalc
# bmake package clean clean-depends
...
... (be patient here)
...
# pkg_info
bootstrap-mk-files-20070810 *.mk files for the bootstrap bmake utility
bmake-20051105nb4 Portable (autoconf) version of NetBSD 'make' utility
tnftp-20070806 The enhanced FTP client in NetBSD
pax-20060202nb1 POSIX standard archiver with many extensions
pkg_install-20070927 Package management and administration tools for pkg
digest-20070803 Message digest wrapper utility
sipcalc-1.1.3 IPv4/IPv6 subnet calculator
We see that building of sipcalc also built dependency "digest-20070803".
Now let's test this utility:
# sipcalc 192.168.1.0/10
-[ipv4 : 192.168.1.0/10] - 0
[CIDR]
Host address - 192.168.1.0
Host address (decimal) - 3232235776
Host address (hex) - C0A80100
Network address - 192.128.0.0
Network mask - 255.192.0.0
Network mask (bits) - 10
Network mask (hex) - FFC00000
Broadcast address - 192.191.255.255
Cisco wildcard - 0.63.255.255
Addresses in network - 4194304
Network range - 192.128.0.0 - 192.191.255.255
Usable range - 192.128.0.1 - 192.191.255.254
#
OK. it works. The rest is up to you. :-)
14) After updating pkgsrc with new patches (see "4)") we can search for
packages that need to be updated due to security or reliability reasons.
For security reasons issue the following command (it is installed during
the bootstrap):
# audit-packages -dv
And for reliability updates (i.e. version bumps) do the following:
# cd /usr/pkgsrc/pkgtools/pkglint/
# bmake package clean clean-depends
...
... (be very patient because this port has Perl among its dependencies)
...
... after some time, building of PERL BREAKS with the following error:
/usr/bin/ld: cannot find -ldb
collect2: ld returned 1 exit status
*** Error code 1
...
This is strange (e.g. it compiles cleanly on Solaris 9 and 10).
If anyone can help building Perl from pkgsrc on OpenBSD 4.2 it would be
great!
And finnaly issue the command showing outdated packages (either because
of security or reliability issue):
# lintpkgsrc -i
...
...
15) Other useful commands are:
# cd /usr/pkgsrc/<category>/<portname>
# bmake show-options
Above command show this port's available options which can be set in
/usr/pkg/etc/mk.conf or directly when issuing bmake.
# bmake show-depends-dirs
Above command shows packages required by given package.
16) This is the point I reached so far. Hope this little tutorial can
help somebody to try to successfully build Perl package since it is
dependency for many packages found in pkgsrc.
Other points of interest would be:
- making bulk build work,
- making update infrastructure for production environments (build +
production hosts)
- better control over native vs. pkgsrc parts in mk.conf
- ???
Have fun,
j.