DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 26th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default setting $PKGDIR screws up port installations

I just switched my laptop from PC-BSD 1.5.1.x to FreeBSD 7.0-Release and I noticed something odd.


I setenv PKGDIR to a safe spot and went about installing packages and ports through a shell script but, when it tried to install some apps via ports with PKGDIR set, they would barf pkg-descr not found style messages.


Doing it by hand using makes -i/-k switches things worked (but probably not smart), things also worked perfectly *normal* when the PKGDIR environment variable was not set when I went to install individual ports.


I found this kinda odd because I don't recall the ports(7) manual saying it honoured PKGDIR. However, /usr/ports/*.mk has a concept of ${PKGDIR}/pkg-* when looking for files such as pkg-descr, pkg-plist, and such.


Grr !
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #2   (View Single Post)  
Old 26th June 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,052
Thanked 198 Times in 156 Posts
Default

First of all, why are you manually setting PKGDIR?

If I understand it correctly, PKGDIR is the directory containing all the ports files (pkg-descr, pkg-plist, files/ etc.) so I'm not surprised that ports fail o build if you set it to something odd.
I'm also not sure if setting PKGDIR actually has any effect when installing packages.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 26th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Thanked 25 Times in 24 Posts
Default

Help my failing eyes or my obsolete glasses,
but I don't see a PKGDIR environment you can set in the ports manpage for FreeBSD-7
__________________
da more I know I know I know nuttin'
Reply With Quote
  #4   (View Single Post)  
Old 26th June 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,052
Thanked 198 Times in 156 Posts
Default

% grep PKGDIR /ports/Mk/bsd.port.mk
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #5   (View Single Post)  
Old 26th June 2008
ohauer ohauer is offline
Port Guard
 
Join Date: May 2008
Location: germany
Posts: 32
Thanked 2 Times in 2 Posts
Default

I do this the following way since 5.1 with no hassle

file:/etc/fstab
Code:
/space2/ports   /usr/ports    nullfs  rw,noatime   0 0
file:/etc/portsnap.conf
Code:
PORTSDIR=/space2/ports
file:/etc/make.conf
Code:
PACKAGES?= /space1/packages
WRKDIR?=   /build_space/PORTBUILD/${PORTNAME}_${PORTVERSION}
DISTDIR?=  /big_space/distfiles

.if ${HOSTNAME} != "MachineWithAllTheDistfiles"
MASTER_SITE_BACKUP=ftp://MachineWithAllTheDistfiles/pub/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
.endif
With WRKDIR set in make.conf php ports cannot be builded if build-recursive contains more then one php port

So i have one central machine that updates every subscribed machine with rsync and portsnap gets all installed ports with the command
# pkg_info -qoa
and fetch new distfiles from all collected ports
Reply With Quote
  #6   (View Single Post)  
Old 26th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Thanked 25 Times in 24 Posts
Default

Snippet from my /etc/make.conf

PORTSDIR=/data/fbsd/ports/
WRKDIRPREFIX=/sandbox/obj/
DISTDIR=/data/distfiles/
PACKAGES=/data/fbsd/packages/


I prefer to set WRKDIRPREFIX to WRKDIR as some sourrces are sensitive.

/sandbox and /data are slices
/sandox is just that, I can newfs the whole slice fatster than a make clean

In fact, I share those slices.

My OpenBSD /etc/mk.conf snippet :
PORTSDIR=/data/obsd/ports
DISTDIR=/data/distfiles
PACKAGE_REPOSITORY=/data/obsd/packages44
PKG_CACHE=/data/obsd/packages44
WRKOBJDIR=/sandbox/pobj
MAKEOBJDIR=/sandbox/sobj
XSRCDIR=/data/obsd/xenocara
XOBJDIR=/sandbox/xobj
__________________
da more I know I know I know nuttin'
Reply With Quote
  #7   (View Single Post)  
Old 26th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

Quote:
Originally Posted by pkg_add(1)
The environment variable PKGDIR specifies an alternative location to save
downloaded packages to when -K option is used.
Which is specifically what I wanted to do and why PKGDIR was set ;-)


When I first planned out the operation, I checked the manual for two reasons:

0/ What environment variable controls where packages can be saved? -- found

1/ What environment variables effect port builds -- found but incomplete



When I have issues with ports, I just go to the Makefiles and trace my fingers along the code until I find my way.


In this case, I was adding packages in sequence via bourne shell script and stopping to install ports in a sub shell when necessary (no package available or out of date).


And found no logical reason to poke around the ports systems internal makefile, since I would naturally look in the end user documentation on orts and pkg_* for how to avoid shooting myself in the foot with environment variables ^_^


My systems almost fully operational and ready to rock & roll. Just a few more things to install via ports (with PKGDIR unset) and a kernel to compile and volia.


While the saved packages get off loaded to be placed in cold storage in, just in case I need a backup of 4 hours worth of fetching at a later date .
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #8   (View Single Post)  
Old 26th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Thanked 25 Times in 24 Posts
Default

OK!

With pkg_add you may define an alternative directory PKGDIR to save the packages to.

While PKG_PATH is where pkg_add expects to find the packages.

The value of the PKG_PATH is used if a given package cannot be found.
The environment variable should be a series of entries separated by
colons. Each entry consists of a directory name.

Hence, $PKGDIR has to be added (or prepended) to the directories list, default /usr/ports/packages.
Why use an alternative to PKG_PATH ? Errr ... Yup! PKGDIR can be a CDROM, files saved rw to PKG_PATH, PKGDIR a ro CDROM, or the other way, and vice versa.

While PACKAGESITE should be set to a "mirror_close_to_you" for remote install.
PACKAGESITE only understands URL and fetch, while PKG_PATH only reads directories.

Now I understand why there is a subdirectory /usr/ports/ports-mgmt in FreeBSD tree.

Yeesh! Glad my default OS is OpenBSD
__________________
da more I know I know I know nuttin'

Last edited by lvlamb; 26th June 2008 at 10:45 PM.
Reply With Quote
  #9   (View Single Post)  
Old 26th June 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,052
Thanked 198 Times in 156 Posts
Default

PKGDIR has different meanings for ports and packages.

From /usr/ports/Mk/bsd.port.mk

Code:
# PKGDIR        - A directory containing any package creation files.
#                 Default: ${MASTERDIR}
[...]
PATCHDIR?=      ${MASTERDIR}/files
FILESDIR?=      ${MASTERDIR}/files
SCRIPTDIR?=     ${MASTERDIR}/scripts
PKGDIR?=        ${MASTERDIR}
[...]
DESCR?=         ${PKGDIR}/pkg-descr
PLIST?=         ${PKGDIR}/pkg-plist
PKGINSTALL?=    ${PKGDIR}/pkg-install
PKGDEINSTALL?=  ${PKGDIR}/pkg-deinstall
PKGREQ?=        ${PKGDIR}/pkg-req
PKGMESSAGE?=    ${PKGDIR}/pkg-message
[...]
Those are ALL the appearances of PKGDIR in bsd.port.mk, so PKGDIR is the port directory (i.e. /usr/ports/www/opera).

If you want to use a different package directory for ports, use PACKAGES.
Code:
# PACKAGES      - A top level directory where all packages go (rather than
#                 going locally to each port).
#                 Default: ${PORTSDIR}/packages
So let's look at pkg_* source:
Code:
[/usr/src/usr.sbin/pkg_install]% find . -type f -exec grep -H PKGDIR {} \;
./add/pkg_add.1:.Ev PKGDIR
./add/pkg_add.1:.Ev PKGDIR
./info/pkg_info.1:.Ev PKGDIR
./info/pkg_info.1:.It Ev PKGDIR
./lib/url.c:    tmp = getenv("PKGDIR");
So, lets look at /usr/src/usr.sbin/pkg_install/lib/url.c (Other 4 files are manpages)
Code:
if (keep_package) {
  tmp = getenv("PKGDIR");
  strlcpy(pkg, tmp ? tmp : ".", sizeof(pkg));
  tmp = basename(fname);
  strlcat(pkg, "/", sizeof(pkg));
  strlcat(pkg, tmp, sizeof(pkg));
  if ((pkgfd = open(pkg, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
      printf("Error: Unable to open %s\n", pkg);
      perror("open");
      return NULL;
  }
    }
So for pkg_* it is indeed the directory/URL to find packages in ... Totally different meaning than for ports.

I know, this is not the best design choice ... And maybe renaming one of the variables might be a good idea...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 27th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

or adding it to the bloody manual page along with any friends it might have ;-)
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up nameservers paran0iaX OpenBSD General 11 13th March 2009 12:16 PM
getting and setting time from router michaelrmgreen General software and network 1 5th February 2009 01:58 PM
help for setting ezjail? bgobs FreeBSD General 13 15th June 2008 10:50 AM
Setting Up MPD benjgvps FreeBSD General 0 21st May 2008 12:20 PM
thanks for setting this up DraconianTimes Off-Topic 8 5th May 2008 08:14 AM


All times are GMT. The time now is 01:21 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick