Diff for /wikisrc/pkgsrc/how_to_upgrade_packages.mdwn between versions 1.2 and 1.3

version 1.2, 2013/02/16 12:17:44 version 1.3, 2019/05/10 07:34:12
Line 12  pkg_add's -u option is used to update a  Line 12  pkg_add's -u option is used to update a 
   
 By using the -uu (option used twice), it will attempt to update prerequisite packages also.  By using the -uu (option used twice), it will attempt to update prerequisite packages also.
   
 See the manual page, [pkg_add(1)](http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current), for details.   See the manual page, [pkg_add(1)](http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current), for details.
   
   
 ## pkg_chk -b  ## pkg_chk -b
Line 29  Or to automatically add any missing pack Line 29  Or to automatically add any missing pack
   
 If both -b and -P are given, no pkgsrc tree is used. If packages are on the local machine, they are scanned directly, otherwise the pkg_summary database is fetched. (Using pkg_summary for local packages is on the TODO list.)  If both -b and -P are given, no pkgsrc tree is used. If packages are on the local machine, they are scanned directly, otherwise the pkg_summary database is fetched. (Using pkg_summary for local packages is on the TODO list.)
   
 (pkg_chk is also covered below.)   (pkg_chk is also covered below.)
   
   
 # Methods that build packages from source  # Methods that build packages from source
Line 44  It is possible, and in the case of updat Line 44  It is possible, and in the case of updat
   
 To use binary packages if available with "make update", use "UPDATE_TARGET=bin-install". If package tarball is not available in ${PACKAGES} locally or at URLs (defined with BINPKG_SITES), it will build a package from source.  To use binary packages if available with "make update", use "UPDATE_TARGET=bin-install". If package tarball is not available in ${PACKAGES} locally or at URLs (defined with BINPKG_SITES), it will build a package from source.
   
 To enable manual rollback one can keep binary packages. One method is to always use 'make package', and to have "DEPENDS_TARGET=package" in /etc/mk.conf. Another is to use pkg_tarup to save packages before starting.   To enable manual rollback one can keep binary packages. One method is to always use 'make package', and to have "DEPENDS_TARGET=package" in /etc/mk.conf. Another is to use pkg_tarup to save packages before starting.
   
   
 ## make replace  ## make replace
Line 61  If you are an expert (and don't plan to  Line 61  If you are an expert (and don't plan to 
   
     USE_ABI_DEPENDS?=no      USE_ABI_DEPENDS?=no
   
 This is for ignoring the ABI dependency recommendations and just use the required DEPENDS.   This is for ignoring the ABI dependency recommendations and just use the required DEPENDS.
   
   
 ### Problems with make replace  ### Problems with make replace
Line 72  Besides ABI changes (for which pkg_rolli Line 72  Besides ABI changes (for which pkg_rolli
   * pkg_delete -r foo, and make package on everything you still want. Or do make update. Note that this could delete a lot.    * pkg_delete -r foo, and make package on everything you still want. Or do make update. Note that this could delete a lot.
   * Automating the first option would be a useful contribution to pkgsrc.    * Automating the first option would be a useful contribution to pkgsrc.
   
 In addition, any problem that can occur with building a package can occur with make replace. Usually, the solution is not make replace specific   In addition, any problem that can occur with building a package can occur with make replace. Usually, the solution is not make replace specific
   
   
 ## pkg_chk  ## pkg_chk
Line 87  Update packages from sources: Line 87  Update packages from sources:
   
 You can set UPDATE_TARGET=package in /etc/mk.conf and specify the -b flag, so that the results of compilation work are saved for later use, and binary packages are used if they are not outdated or dependent on outdated packages.  You can set UPDATE_TARGET=package in /etc/mk.conf and specify the -b flag, so that the results of compilation work are saved for later use, and binary packages are used if they are not outdated or dependent on outdated packages.
   
 The main problem with pkg_chk, is that it deinstalls all to-be-upgraded candidates before reinstalling then. However a failure is not fatal, because the current state of packages is saved in a pkg_chk* file at the root of the pkgsrc directory.   The main problem with pkg_chk, is that it deinstalls all to-be-upgraded candidates before reinstalling then. However a failure is not fatal, because the current state of packages is saved in a pkg_chk* file at the root of the pkgsrc directory.
   
   
 ## pkg_rolling-replace  ## pkg_rolling-replace
Line 116  Update everything except the packages ab Line 116  Update everything except the packages ab
 Even if a lot of packages need to be updated, make replace usually works very well if the interval from the last 'pkg_rolling-replace -u' run is not that long (a month or so). With a longer interval, like a year or two, the odds of package renaming/splitting are higher. Still, for those who can resolve the issues, this is a fairly low-pain and reliable way to update.  Even if a lot of packages need to be updated, make replace usually works very well if the interval from the last 'pkg_rolling-replace -u' run is not that long (a month or so). With a longer interval, like a year or two, the odds of package renaming/splitting are higher. Still, for those who can resolve the issues, this is a fairly low-pain and reliable way to update.
   
   
 ## pkgmanager  
   
 Pkgmanager use user defined list of wanted packages for upgrading and installing packages.  
   
     %pkgmanager show-wants  
     [pkgmanager] Wanted packages:  
     [pkgmanager]    (audio/cdparanoia . 1.0)  
     [pkgmanager]    (audio/gtkpod . 1.0)  
     [pkgmanager]    (audio/lame . 1.0)  
     [pkgmanager]    (audio/xmms . 1.0)  
     [pkgmanager]    (chat/gaim . 1.0)  
     [pkgmanager]    (chat/gaim-encryption . 1.0)  
     [pkgmanager]    (chat/gaim-otr . 1.0)  
     [...]  
     [pkgmanager]    (wm/enlightenment . 1.0)  
     [pkgmanager]    (www/firefox . 1.0)  
     [pkgmanager]    (www/lighttpd . 1.0)  
     [pkgmanager]    (www/links . 1.0)  
     [pkgmanager]    (x11/eterm . 1.0)  
     [pkgmanager]    (x11/gdm . 1.0)  
   
 User can upgrade his packages with "pkgmanager sync". This command removes packages installed on system which are not listed on want list. Then upgrade all wanted packages and dependencies to new version.  
   
   
 ## Delete everything  ## Delete everything
   
 If you don't have a production environment or don't care if your packages will be missing for a while, you can just delete everything and reinstall.  If you don't have a production environment or don't care if your packages will be missing for a while, you can just delete everything and reinstall.
Line 148  This method is the easiest: Line 124  This method is the easiest:
   
     # pkg_delete -Rr '*-*'      # pkg_delete -Rr '*-*'
   
 -or-    -or-
   
     # pkg_delete -ff '*-*'      # pkg_delete -ff '*-*'
   
Line 170  Then edit your "pkgs_i_want_to_have" (cr Line 146  Then edit your "pkgs_i_want_to_have" (cr
   
     # cat pkgs_i_want_to_have | (while read pp ; do cd /usr/pkgsrc/$pp ; make && make install ; done)      # cat pkgs_i_want_to_have | (while read pp ; do cd /usr/pkgsrc/$pp ; make && make install ; done)
   
 An alternative way to choose the packages you want installed is to create your own custom meta-package. A meta-package doesn't install any files itself, but just depends on other packages (usually within a similar topic or need). Have a look at pkgsrc/meta-pkgs category for various examples. If your new meta-package is generic enough and useful for others, please be sure to share it.   An alternative way to choose the packages you want installed is to create your own custom meta-package. A meta-package doesn't install any files itself, but just depends on other packages (usually within a similar topic or need). Have a look at pkgsrc/meta-pkgs category for various examples. If your new meta-package is generic enough and useful for others, please be sure to share it.
   
   
 ## chroot environment  ## chroot environment
Line 183  Then build and remove packages as you wi Line 159  Then build and remove packages as you wi
   
 Then use other technique from this list to install from these packages (built in chroot).  Then use other technique from this list to install from these packages (built in chroot).
   
 Or instead of using this manual method, use pkg_comp's chroot.   Or instead of using this manual method, use pkg_comp's chroot.
   
 ## pkg_comp's chroot  ## pkg_comp's chroot
   
Line 198  After you've built new new packages, you Line 174  After you've built new new packages, you
   
 If you use PKGBASE instead of PKGNAME, you get the basename of the file.  If you use PKGBASE instead of PKGNAME, you get the basename of the file.
   
 See [this BSDFreak Article](http://bsdfreak.org/modules/news/article.php?storyid=1) for a nice tutorial on how to set up and use pkg_comp.   See [this BSDFreak Article](http://bsdfreak.org/modules/news/article.php?storyid=1) for a nice tutorial on how to set up and use pkg_comp.
   
 ## bulk build framework  ## bulk build framework
   
Line 231  You can choose the PKG_DBDIR via shell e Line 207  You can choose the PKG_DBDIR via shell e
 And set the LOCALBASE and your PKG_DBDIR in your mk.conf file.  And set the LOCALBASE and your PKG_DBDIR in your mk.conf file.
   
 You could also simply just have a symlink from /usr/pkg to your new LOCALBASE (and /var/db/pkg to your new PKG_DBDIR) and change this when ever you are ready.  You could also simply just have a symlink from /usr/pkg to your new LOCALBASE (and /var/db/pkg to your new PKG_DBDIR) and change this when ever you are ready.
   
 ## pkgviews  
   
 ## How to set a specific application version  
   
 PostgreSQL, MySQL and Apache has multiple versions : each of them has a buildlink3.mk in /usr/pkgsrc/mk, to set the version you want add to /etc/mk.conf.  
   
     # postgresql version :  
     # see /usr/pkgsrc/mk/pgsql.buildlink3.mk  
     # versions : 84 83 82  
     PGSQL_VERSION_DEFAULT= 83  
       
     # apache version :  
     # see /usr/pkgsrc/mk/apache.mk  
     # versions : apache13 apache2 apache22  
     PKG_APACHE_DEFAULT= apache22  
       
     # mysql version :  
     # see /usr/pkgsrc/mk/mysql.buildlink3.mk   
     # versions : 50 41  
     MYSQL_VERSION_DEFAULT= 50  
   

Removed from v.1.2  
changed lines
  Added in v.1.3


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb