From owner-svn-src-user@FreeBSD.ORG Sun Aug 1 01:32:32 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52EF21065670; Sun, 1 Aug 2010 01:32:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 281C98FC12; Sun, 1 Aug 2010 01:32:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o711WW9C053751; Sun, 1 Aug 2010 01:32:32 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o711WW8q053750; Sun, 1 Aug 2010 01:32:32 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008010132.o711WW8q053750@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Aug 2010 01:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210707 - user/nwhitehorn/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Aug 2010 01:32:32 -0000 Author: nwhitehorn Date: Sun Aug 1 01:32:31 2010 New Revision: 210707 URL: http://svn.freebsd.org/changeset/base/210707 Log: Step 1 in rebasing the PS3 port from HEAD: delete the old code. Deleted: user/nwhitehorn/ps3/ From owner-svn-src-user@FreeBSD.ORG Sun Aug 1 01:33:32 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04E87106564A; Sun, 1 Aug 2010 01:33:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE47A8FC13; Sun, 1 Aug 2010 01:33:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o711XVnA054003; Sun, 1 Aug 2010 01:33:31 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o711XVRY054002; Sun, 1 Aug 2010 01:33:31 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008010133.o711XVRY054002@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Aug 2010 01:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210708 - user/nwhitehorn/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Aug 2010 01:33:32 -0000 Author: nwhitehorn Date: Sun Aug 1 01:33:31 2010 New Revision: 210708 URL: http://svn.freebsd.org/changeset/base/210708 Log: Step 2 in rebasing the PS3 port from HEAD: branch HEAD Added: - copied from r210707, head/sys/ Directory Properties: user/nwhitehorn/ps3/ (props changed) From owner-svn-src-user@FreeBSD.ORG Sun Aug 1 01:35:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7355D1065672; Sun, 1 Aug 2010 01:35:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 483AE8FC1A; Sun, 1 Aug 2010 01:35:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o711ZJeK054567; Sun, 1 Aug 2010 01:35:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o711ZJ2v054566; Sun, 1 Aug 2010 01:35:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008010135.o711ZJ2v054566@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Aug 2010 01:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210709 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Aug 2010 01:35:19 -0000 Author: nwhitehorn Date: Sun Aug 1 01:35:19 2010 New Revision: 210709 URL: http://svn.freebsd.org/changeset/base/210709 Log: Step 3 in rebasing the PS3 port from HEAD: copy PS3 system code over to the new tree from the old tree. Added: - copied from r210706, user/nwhitehorn/ps3/powerpc/ps3/ Directory Properties: user/nwhitehorn/ps3/powerpc/ps3/ (props changed) From owner-svn-src-user@FreeBSD.ORG Sun Aug 1 01:39:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5CA3106564A; Sun, 1 Aug 2010 01:39:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A7EE8FC08; Sun, 1 Aug 2010 01:39:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o711d6ZV055413; Sun, 1 Aug 2010 01:39:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o711d6ZA055412; Sun, 1 Aug 2010 01:39:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008010139.o711d6ZA055412@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Aug 2010 01:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210710 - user/nwhitehorn/ps3/boot/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Aug 2010 01:39:06 -0000 Author: nwhitehorn Date: Sun Aug 1 01:39:06 2010 New Revision: 210710 URL: http://svn.freebsd.org/changeset/base/210710 Log: Forgot the PS3 loader. One more commit to go, with manual patches. Added: - copied from r210706, user/nwhitehorn/ps3/boot/powerpc/ps3/ Directory Properties: user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed) From owner-svn-src-user@FreeBSD.ORG Sun Aug 1 02:27:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9202106566C; Sun, 1 Aug 2010 02:27:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F2F8FC16; Sun, 1 Aug 2010 02:27:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o712RGQb065999; Sun, 1 Aug 2010 02:27:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o712RGjP065986; Sun, 1 Aug 2010 02:27:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008010227.o712RGjP065986@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Aug 2010 02:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210712 - in user/nwhitehorn/ps3: boot/fdt/dts boot/powerpc conf dev/ofw powerpc/aim powerpc/include powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Aug 2010 02:27:17 -0000 Author: nwhitehorn Date: Sun Aug 1 02:27:16 2010 New Revision: 210712 URL: http://svn.freebsd.org/changeset/base/210712 Log: Remaining bits to restore PS3 branch to a booting state: - Re-add hypervisor hooks to mmu_oea64 - Connect PS3 bits to the build - Do not assume that the presence of FDT implies the absence of real Open Firmware - Make ofw_fdt at least compile (though not work) on 64-bit systems Added: user/nwhitehorn/ps3/boot/fdt/dts/ps3.dts user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.h Modified: user/nwhitehorn/ps3/boot/powerpc/Makefile user/nwhitehorn/ps3/conf/files.powerpc user/nwhitehorn/ps3/conf/options.powerpc user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c user/nwhitehorn/ps3/dev/ofw/openfirm.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c user/nwhitehorn/ps3/powerpc/include/pmap.h user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Added: user/nwhitehorn/ps3/boot/fdt/dts/ps3.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/boot/fdt/dts/ps3.dts Sun Aug 1 02:27:16 2010 (r210712) @@ -0,0 +1,16 @@ +/* + * Sony PS3 flattened device tree + * + * $FreeBSD$ + */ + +/dts-v1/; + +/ { + model = "SonyPS3"; + compatible = "sony,ps3"; + #size-cells = <2>; + #address-cells = <2>; + + chosen {}; +}; Modified: user/nwhitehorn/ps3/boot/powerpc/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/powerpc/Makefile Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/boot/powerpc/Makefile Sun Aug 1 02:27:16 2010 (r210712) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= boot1.chrp ofw uboot +SUBDIR= boot1.chrp ofw ps3 uboot .include Modified: user/nwhitehorn/ps3/conf/files.powerpc ============================================================================== --- user/nwhitehorn/ps3/conf/files.powerpc Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/conf/files.powerpc Sun Aug 1 02:27:16 2010 (r210712) @@ -188,6 +188,10 @@ powerpc/powerpc/suswintr.c standard powerpc/powerpc/syncicache.c standard powerpc/powerpc/sys_machdep.c standard powerpc/powerpc/uio_machdep.c standard +powerpc/ps3/mmu_ps3.c optional ps3 +powerpc/ps3/platform_ps3.c optional ps3 +powerpc/ps3/ps3_syscons.c optional ps3 sc +powerpc/ps3/ps3-hvcall.S optional ps3 sc powerpc/psim/iobus.c optional psim powerpc/psim/ata_iobus.c optional ata psim powerpc/psim/openpic_iobus.c optional psim Modified: user/nwhitehorn/ps3/conf/options.powerpc ============================================================================== --- user/nwhitehorn/ps3/conf/options.powerpc Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/conf/options.powerpc Sun Aug 1 02:27:16 2010 (r210712) @@ -17,6 +17,7 @@ GFB_NO_MODE_CHANGE opt_gfb.h MPC85XX opt_platform.h POWERMAC opt_platform.h +PS3 opt_platform.h MAMBO PSIM Modified: user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/dev/ofw/ofw_bus_subr.c Sun Aug 1 02:27:16 2010 (r210712) @@ -193,7 +193,6 @@ ofw_bus_is_compatible_strict(device_t de return (0); } -#ifndef FDT void ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz) { @@ -313,4 +312,4 @@ ofw_bus_search_intrmap(void *intr, int i } return (0); } -#endif /* !FDT */ + Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Sun Aug 1 02:27:16 2010 (r210712) @@ -120,11 +120,11 @@ fdt_phandle_offset(phandle_t p) dt_struct = (const char *)fdtp + fdt_off_dt_struct(fdtp); - if (((const char *)p < dt_struct) || - (const char *)p > (dt_struct + fdt_size_dt_struct(fdtp))) + if (((const char *)(uintptr_t)p < dt_struct) || + (const char *)(uintptr_t)p > (dt_struct + fdt_size_dt_struct(fdtp))) return (-1); - offset = (const char *)p - dt_struct; + offset = (const char *)(uintptr_t)p - dt_struct; if (offset < 0) return (-1); @@ -141,7 +141,8 @@ ofw_fdt_peer(ofw_t ofw, phandle_t node) if (node == 0) { /* Find root node */ offset = fdt_path_offset(fdtp, "/"); - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, + sizeof(p)); return (p); } @@ -156,7 +157,8 @@ ofw_fdt_peer(ofw_t ofw, phandle_t node) if (depth < 0) return (0); if (depth == 1) { - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, + sizeof(p)); return (p); } } @@ -181,7 +183,8 @@ ofw_fdt_child(ofw_t ofw, phandle_t node) if (depth < 0) return (0); if (depth == 1) { - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, + sizeof(p)); return (p); } } @@ -201,7 +204,8 @@ ofw_fdt_parent(ofw_t ofw, phandle_t node return (0); paroffset = fdt_parent_offset(fdtp, offset); - p = (phandle_t)fdt_offset_ptr(fdtp, paroffset, sizeof(phandle_t)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, paroffset, + sizeof(phandle_t)); return (p); } @@ -223,7 +227,8 @@ ofw_fdt_instance_to_package(ofw_t ofw, i if (offset < 0) return (0); - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(phandle_t)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, + sizeof(phandle_t)); return (p); } @@ -343,7 +348,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t pa if (prop == NULL) return (0); - offset = fdt_phandle_offset((phandle_t)prop); + offset = fdt_phandle_offset((phandle_t)(uintptr_t)prop); rv = fdt_nextprop(offset, buf, size); return (rv); } @@ -379,7 +384,7 @@ ofw_fdt_finddevice(ofw_t ofw, const char offset = fdt_path_offset(fdtp, device); - p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); return (p); } Modified: user/nwhitehorn/ps3/dev/ofw/openfirm.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/openfirm.c Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/dev/ofw/openfirm.c Sun Aug 1 02:27:16 2010 (r210712) @@ -135,7 +135,6 @@ OF_init(void *cookie) return (rv); } -#ifndef FDT void OF_printf(const char *fmt, ...) { @@ -159,7 +158,6 @@ OF_test(const char *name) return (OFW_TEST(ofw_obj, name)); } -#endif int OF_interpret(const char *cmd, int nreturns, ...) @@ -321,7 +319,6 @@ OF_package_to_path(phandle_t package, ch return (OFW_PACKAGE_TO_PATH(ofw_obj, package, buf, len)); } -#ifndef FDT /* Call the method in the scope of a given instance. */ int OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns, @@ -435,4 +432,3 @@ OF_exit() for (;;) /* just in case */ ; } -#endif Modified: user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c Sun Aug 1 02:27:16 2010 (r210712) @@ -161,24 +161,6 @@ __FBSDID("$FreeBSD$"); #define VSID_TO_SR(vsid) ((vsid) & 0xf) #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) -#define PVO_PTEGIDX_MASK 0x007 /* which PTEG slot */ -#define PVO_PTEGIDX_VALID 0x008 /* slot is valid */ -#define PVO_WIRED 0x010 /* PVO entry is wired */ -#define PVO_MANAGED 0x020 /* PVO entry is managed */ -#define PVO_EXECUTABLE 0x040 /* PVO entry is executable */ -#define PVO_BOOTSTRAP 0x080 /* PVO entry allocated during - bootstrap */ -#define PVO_FAKE 0x100 /* fictitious phys page */ -#define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF) -#define PVO_ISEXECUTABLE(pvo) ((pvo)->pvo_vaddr & PVO_EXECUTABLE) -#define PVO_ISFAKE(pvo) ((pvo)->pvo_vaddr & PVO_FAKE) -#define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) -#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID) -#define PVO_PTEGIDX_CLR(pvo) \ - ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK))) -#define PVO_PTEGIDX_SET(pvo, i) \ - ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) - #define MOEA_PVO_CHECK(pvo) struct ofw_map { Modified: user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Sun Aug 1 02:27:16 2010 (r210712) @@ -155,6 +155,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "mmu_oea64.h" #include "mmu_if.h" #define MOEA_DEBUG @@ -235,24 +236,6 @@ TLBIE(uint64_t vpn) { #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) #define VSID_HASH_MASK 0x0000007fffffffffULL -#define PVO_PTEGIDX_MASK 0x007UL /* which PTEG slot */ -#define PVO_PTEGIDX_VALID 0x008UL /* slot is valid */ -#define PVO_WIRED 0x010UL /* PVO entry is wired */ -#define PVO_MANAGED 0x020UL /* PVO entry is managed */ -#define PVO_BOOTSTRAP 0x080UL /* PVO entry allocated during - bootstrap */ -#define PVO_FAKE 0x100UL /* fictitious phys page */ -#define PVO_LARGE 0x200UL /* large page */ -#define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF) -#define PVO_ISFAKE(pvo) ((pvo)->pvo_vaddr & PVO_FAKE) -#define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) -#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID) -#define PVO_PTEGIDX_CLR(pvo) \ - ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK))) -#define PVO_PTEGIDX_SET(pvo, i) \ - ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) -#define PVO_VSID(pvo) ((pvo)->pvo_vpn >> 16) - #define MOEA_PVO_CHECK(pvo) #define LOCK_TABLE() mtx_lock(&moea64_table_mutex) @@ -280,7 +263,6 @@ extern struct pmap ofw_pmap; extern void bs_remap_earlyboot(void); - /* * Lock for the pteg and pvo tables. */ @@ -351,14 +333,22 @@ int moea64_large_page_size = 0; int moea64_large_page_shift = 0; /* - * Allocate physical memory for use in moea64_bootstrap. + * Hypervisor Hooks */ -static vm_offset_t moea64_bootstrap_alloc(vm_size_t, u_int); +void (*moea64_pte_synch_hook)(struct lpte *pt, struct lpte *pvo_pt) = NULL; +void (*moea64_pte_clear_hook)(struct lpte *pt, struct lpte *pvo_pt, + uint64_t vpn, u_int64_t ptebit) = NULL; +void (*moea64_pte_unset_hook)(struct lpte *pt, struct lpte *pvo_pt, + uint64_t vpn) = NULL; +void (*moea64_pte_change_hook)(struct lpte *pt, struct lpte *pvo_pt, + uint64_t vpn) = NULL; +int (*moea64_pte_insert_hook)(u_int ptegidx, struct lpte *pvo_pt) = NULL; +struct lpte *(*moea64_pvo_to_pte_hook)(const struct pvo_entry *pvo) = NULL; /* * PTE calls. */ -static int moea64_pte_insert(u_int, struct lpte *); +static int moea64_pte_insert_native(u_int, struct lpte *); /* * PVO calls. @@ -367,12 +357,12 @@ static int moea64_pvo_enter(pmap_t, uma_ vm_offset_t, vm_offset_t, uint64_t, int); static void moea64_pvo_remove(struct pvo_entry *); static struct pvo_entry *moea64_pvo_find_va(pmap_t, vm_offset_t); -static struct lpte *moea64_pvo_to_pte(const struct pvo_entry *); +static struct lpte *moea64_pvo_to_pte_native(const struct pvo_entry *); /* * Utility routines. */ -static void moea64_bootstrap(mmu_t mmup, +static void moea64_bootstrap_native(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend); static void moea64_cpu_bootstrap(mmu_t, int ap); static void moea64_enter_locked(pmap_t, vm_offset_t, vm_page_t, @@ -390,43 +380,6 @@ static void slbia(void); /* * Kernel MMU interface */ -void moea64_change_wiring(mmu_t, pmap_t, vm_offset_t, boolean_t); -void moea64_clear_modify(mmu_t, vm_page_t); -void moea64_clear_reference(mmu_t, vm_page_t); -void moea64_copy_page(mmu_t, vm_page_t, vm_page_t); -void moea64_enter(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t, boolean_t); -void moea64_enter_object(mmu_t, pmap_t, vm_offset_t, vm_offset_t, vm_page_t, - vm_prot_t); -void moea64_enter_quick(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t); -vm_paddr_t moea64_extract(mmu_t, pmap_t, vm_offset_t); -vm_page_t moea64_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t); -void moea64_init(mmu_t); -boolean_t moea64_is_modified(mmu_t, vm_page_t); -boolean_t moea64_is_referenced(mmu_t, vm_page_t); -boolean_t moea64_ts_referenced(mmu_t, vm_page_t); -vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int); -boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t); -int moea64_page_wired_mappings(mmu_t, vm_page_t); -void moea64_pinit(mmu_t, pmap_t); -void moea64_pinit0(mmu_t, pmap_t); -void moea64_protect(mmu_t, pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); -void moea64_qenter(mmu_t, vm_offset_t, vm_page_t *, int); -void moea64_qremove(mmu_t, vm_offset_t, int); -void moea64_release(mmu_t, pmap_t); -void moea64_remove(mmu_t, pmap_t, vm_offset_t, vm_offset_t); -void moea64_remove_all(mmu_t, vm_page_t); -void moea64_remove_write(mmu_t, vm_page_t); -void moea64_zero_page(mmu_t, vm_page_t); -void moea64_zero_page_area(mmu_t, vm_page_t, int, int); -void moea64_zero_page_idle(mmu_t, vm_page_t); -void moea64_activate(mmu_t, struct thread *); -void moea64_deactivate(mmu_t, struct thread *); -void *moea64_mapdev(mmu_t, vm_offset_t, vm_size_t); -void moea64_unmapdev(mmu_t, vm_offset_t, vm_size_t); -vm_offset_t moea64_kextract(mmu_t, vm_offset_t); -void moea64_kenter(mmu_t, vm_offset_t, vm_offset_t); -boolean_t moea64_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t); -static void moea64_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t); static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_change_wiring, moea64_change_wiring), @@ -462,7 +415,7 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_deactivate, moea64_deactivate), /* Internal interfaces */ - MMUMETHOD(mmu_bootstrap, moea64_bootstrap), + MMUMETHOD(mmu_bootstrap, moea64_bootstrap_native), MMUMETHOD(mmu_cpu_bootstrap, moea64_cpu_bootstrap), MMUMETHOD(mmu_mapdev, moea64_mapdev), MMUMETHOD(mmu_unmapdev, moea64_unmapdev), @@ -561,7 +514,7 @@ moea64_pte_create(struct lpte *pt, uint6 } static __inline void -moea64_pte_synch(struct lpte *pt, struct lpte *pvo_pt) +moea64_pte_synch_native(struct lpte *pt, struct lpte *pvo_pt) { ASSERT_TABLE_LOCK(); @@ -570,7 +523,7 @@ moea64_pte_synch(struct lpte *pt, struct } static __inline void -moea64_pte_clear(struct lpte *pt, uint64_t vpn, u_int64_t ptebit) +moea64_pte_clear_native(struct lpte *pt, uint64_t vpn, u_int64_t ptebit) { ASSERT_TABLE_LOCK(); @@ -582,7 +535,7 @@ moea64_pte_clear(struct lpte *pt, uint64 } static __inline void -moea64_pte_set(struct lpte *pt, struct lpte *pvo_pt) +moea64_pte_set_native(struct lpte *pt, struct lpte *pvo_pt) { ASSERT_TABLE_LOCK(); @@ -601,7 +554,7 @@ moea64_pte_set(struct lpte *pt, struct l } static __inline void -moea64_pte_unset(struct lpte *pt, struct lpte *pvo_pt, uint64_t vpn) +moea64_pte_unset_native(struct lpte *pt, struct lpte *pvo_pt, uint64_t vpn) { ASSERT_TABLE_LOCK(); pvo_pt->pte_hi &= ~LPTE_VALID; @@ -620,19 +573,19 @@ moea64_pte_unset(struct lpte *pt, struct /* * Save the reg & chg bits. */ - moea64_pte_synch(pt, pvo_pt); + moea64_pte_synch_native(pt, pvo_pt); moea64_pte_valid--; } static __inline void -moea64_pte_change(struct lpte *pt, struct lpte *pvo_pt, uint64_t vpn) +moea64_pte_change_native(struct lpte *pt, struct lpte *pvo_pt, uint64_t vpn) { /* * Invalidate the PTE */ - moea64_pte_unset(pt, pvo_pt, vpn); - moea64_pte_set(pt, pvo_pt); + moea64_pte_unset_native(pt, pvo_pt, vpn); + moea64_pte_set_native(pt, pvo_pt); } static __inline uint64_t @@ -916,18 +869,11 @@ moea64_setup_direct_map(mmu_t mmup, vm_o ENABLE_TRANS(msr); } -static void -moea64_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) +void +moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) { - ihandle_t mmui; - phandle_t chosen; - phandle_t mmu; - size_t sz; int i, j; - vm_size_t size, physsz, hwphyssz; - vm_offset_t pa, va; - register_t msr; - void *dpcpu; + vm_size_t physsz, hwphyssz; #ifndef __powerpc64__ /* We don't have a direct map since there is no BAT */ @@ -1014,9 +960,6 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t physmem = btoc(physsz); - /* - * Allocate PTEG table. - */ #ifdef PTEGCOUNT moea64_pteg_count = PTEGCOUNT; #else @@ -1027,6 +970,21 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t moea64_pteg_count >>= 1; #endif /* PTEGCOUNT */ +} + +static void +moea64_bootstrap_native(mmu_t mmup, vm_offset_t kernelstart, + vm_offset_t kernelend) +{ + int i; + vm_size_t size; + register_t msr; + + moea64_early_bootstrap(mmup, kernelstart, kernelend); + + /* + * Allocate PTEG table. + */ size = moea64_pteg_count * sizeof(struct lpteg); CTR2(KTR_PMAP, "moea64_bootstrap: %d PTEGs, %d bytes", @@ -1044,11 +1002,76 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t bzero((void *)moea64_pteg_table, moea64_pteg_count * sizeof(struct lpteg)); ENABLE_TRANS(msr); - moea64_pteg_mask = moea64_pteg_count - 1; - CTR1(KTR_PMAP, "moea64_bootstrap: PTEG table at %p", moea64_pteg_table); /* + * Initialize the TLBIE lock. TLBIE can only be executed by one CPU. + */ + mtx_init(&tlbie_mutex, "tlbie mutex", NULL, MTX_SPIN); + + moea64_late_bootstrap(mmup, kernelstart, kernelend); + + /* + * Allocate some things for page zeroing. We put this directly + * in the page table, marked with LPTE_LOCKED, to avoid any + * of the PVO book-keeping or other parts of the VM system + * from even knowing that this hack exists. + */ + + if (!hw_direct_map) { + mtx_init(&moea64_scratchpage_mtx, "pvo zero page", NULL, + MTX_DEF); + for (i = 0; i < 2; i++) { + struct lpte pt; + uint64_t vsid; + int pteidx, ptegidx; + + moea64_scratchpage_va[i] = (virtual_end+1) - PAGE_SIZE; + virtual_end -= PAGE_SIZE; + + LOCK_TABLE(); + + vsid = va_to_vsid(kernel_pmap, + moea64_scratchpage_va[i]); + moea64_pte_create(&pt, vsid, moea64_scratchpage_va[i], + LPTE_NOEXEC, 0); + pt.pte_hi |= LPTE_LOCKED; + + moea64_scratchpage_vpn[i] = (vsid << 16) | + ((moea64_scratchpage_va[i] & ADDR_PIDX) >> + ADDR_PIDX_SHFT); + ptegidx = va_to_pteg(vsid, moea64_scratchpage_va[i], 0); + pteidx = moea64_pte_insert_native(ptegidx, &pt); + if (pt.pte_hi & LPTE_HID) + ptegidx ^= moea64_pteg_mask; + + moea64_scratchpage_pte[i] = + &moea64_pteg_table[ptegidx].pt[pteidx]; + + UNLOCK_TABLE(); + } + } +} + +void +moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) +{ + ihandle_t mmui; + phandle_t chosen; + phandle_t mmu; + size_t sz; + int i; + vm_size_t size; + vm_offset_t pa, va; + register_t msr; + void *dpcpu; + + /* + * Set PTEG mask + */ + moea64_pteg_mask = moea64_pteg_count - 1; + + /* * Allocate pv/overflow lists. */ size = sizeof(struct pvo_head) * moea64_pteg_count; @@ -1070,11 +1093,6 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t MTX_RECURSE); /* - * Initialize the TLBIE lock. TLBIE can only be executed by one CPU. - */ - mtx_init(&tlbie_mutex, "tlbie mutex", NULL, MTX_SPIN); - - /* * Initialise the unmanaged pvo pool. */ moea64_bpvo_pool = (struct pvo_entry *)moea64_bootstrap_alloc( @@ -1155,7 +1173,7 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t /* * Initialize MMU and remap early physical mappings */ - moea64_cpu_bootstrap(mmup,0); + MMU_CPU_BOOTSTRAP(mmup,0); mtmsr(mfmsr() | PSL_DR | PSL_IR); isync(); pmap_bootstrapped++; bs_remap_earlyboot(); @@ -1191,47 +1209,6 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t #endif /* - * Allocate some things for page zeroing. We put this directly - * in the page table, marked with LPTE_LOCKED, to avoid any - * of the PVO book-keeping or other parts of the VM system - * from even knowing that this hack exists. - */ - - if (!hw_direct_map) { - mtx_init(&moea64_scratchpage_mtx, "pvo zero page", NULL, - MTX_DEF); - for (i = 0; i < 2; i++) { - struct lpte pt; - uint64_t vsid; - int pteidx, ptegidx; - - moea64_scratchpage_va[i] = (virtual_end+1) - PAGE_SIZE; - virtual_end -= PAGE_SIZE; - - LOCK_TABLE(); - - vsid = va_to_vsid(kernel_pmap, - moea64_scratchpage_va[i]); - moea64_pte_create(&pt, vsid, moea64_scratchpage_va[i], - LPTE_NOEXEC, 0); - pt.pte_hi |= LPTE_LOCKED; - - moea64_scratchpage_vpn[i] = (vsid << 16) | - ((moea64_scratchpage_va[i] & ADDR_PIDX) >> - ADDR_PIDX_SHFT); - ptegidx = va_to_pteg(vsid, moea64_scratchpage_va[i], 0); - pteidx = moea64_pte_insert(ptegidx, &pt); - if (pt.pte_hi & LPTE_HID) - ptegidx ^= moea64_pteg_mask; - - moea64_scratchpage_pte[i] = - &moea64_pteg_table[ptegidx].pt[pteidx]; - - UNLOCK_TABLE(); - } - } - - /* * Allocate a kernel stack with a guard page for thread0 and map it * into the kernel page map. */ @@ -1321,7 +1298,10 @@ moea64_change_wiring(mmu_t mmu, pmap_t p if (pvo != NULL) { LOCK_TABLE(); - pt = moea64_pvo_to_pte(pvo); + if (moea64_pvo_to_pte_hook != NULL) + pt = moea64_pvo_to_pte_hook(pvo); + else + pt = moea64_pvo_to_pte_native(pvo); if (wired) { if ((pvo->pvo_vaddr & PVO_WIRED) == 0) @@ -1337,8 +1317,12 @@ moea64_change_wiring(mmu_t mmu, pmap_t p if (pt != NULL) { /* Update wiring flag in page table. */ - moea64_pte_change(pt, &pvo->pvo_pte.lpte, - pvo->pvo_vpn); + if (moea64_pte_change_hook != NULL) + moea64_pte_change_hook(pt, &pvo->pvo_pte.lpte, + pvo->pvo_vpn); + else + moea64_pte_change_native(pt, &pvo->pvo_pte.lpte, + pvo->pvo_vpn); } else if (wired) { /* * If we are wiring the page, and it wasn't in the @@ -1348,7 +1332,13 @@ moea64_change_wiring(mmu_t mmu, pmap_t p ptegidx = va_to_pteg(vsid, PVO_VADDR(pvo), pvo->pvo_vaddr & PVO_LARGE); - i = moea64_pte_insert(ptegidx, &pvo->pvo_pte.lpte); + if (moea64_pte_insert_hook != NULL) + i = moea64_pte_insert_hook(ptegidx, + &pvo->pvo_pte.lpte); + else + i = moea64_pte_insert_native(ptegidx, + &pvo->pvo_pte.lpte); + if (i >= 0) { PVO_PTEGIDX_CLR(pvo); PVO_PTEGIDX_SET(pvo, i); @@ -1849,15 +1839,25 @@ moea64_remove_write(mmu_t mmu, vm_page_t PMAP_LOCK(pmap); LOCK_TABLE(); if ((pvo->pvo_pte.lpte.pte_lo & LPTE_PP) != LPTE_BR) { - pt = moea64_pvo_to_pte(pvo); + if (moea64_pvo_to_pte_hook != NULL) + pt = moea64_pvo_to_pte_hook(pvo); + else + pt = moea64_pvo_to_pte_native(pvo); pvo->pvo_pte.lpte.pte_lo &= ~LPTE_PP; pvo->pvo_pte.lpte.pte_lo |= LPTE_BR; if (pt != NULL) { - moea64_pte_synch(pt, &pvo->pvo_pte.lpte); + if (moea64_pte_synch_hook != NULL) + moea64_pte_synch_hook(pt, &pvo->pvo_pte.lpte); + else + moea64_pte_synch_native(pt, &pvo->pvo_pte.lpte); lo |= pvo->pvo_pte.lpte.pte_lo; pvo->pvo_pte.lpte.pte_lo &= ~LPTE_CHG; - moea64_pte_change(pt, &pvo->pvo_pte.lpte, - pvo->pvo_vpn); + if (moea64_pte_change_hook != NULL) + moea64_pte_change_hook(pt, + &pvo->pvo_pte.lpte, pvo->pvo_vpn); + else + moea64_pte_change_native(pt, + &pvo->pvo_pte.lpte, pvo->pvo_vpn); if (pvo->pvo_pmap == kernel_pmap) isync(); } @@ -2167,7 +2167,10 @@ moea64_protect(mmu_t mmu, pmap_t pm, vm_ * copy. */ LOCK_TABLE(); - pt = moea64_pvo_to_pte(pvo); + if (moea64_pvo_to_pte_hook != NULL) + pt = moea64_pvo_to_pte_hook(pvo); + else + pt = moea64_pvo_to_pte_native(pvo); /* * Change the protection of the page. @@ -2182,7 +2185,12 @@ moea64_protect(mmu_t mmu, pmap_t pm, vm_ * If the PVO is in the page table, update that pte as well. */ if (pt != NULL) { - moea64_pte_change(pt, &pvo->pvo_pte.lpte, pvo->pvo_vpn); + if (moea64_pte_change_hook != NULL) + moea64_pte_change_hook(pt, &pvo->pvo_pte.lpte, + pvo->pvo_vpn); + else + moea64_pte_change_native(pt, &pvo->pvo_pte.lpte, + pvo->pvo_vpn); if ((pvo->pvo_pte.lpte.pte_lo & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { moea64_syncicache(pm, sva, @@ -2310,7 +2318,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m * Can only be called from moea64_bootstrap before avail start and end are * calculated. */ -static vm_offset_t +vm_offset_t moea64_bootstrap_alloc(vm_size_t size, u_int align) { vm_offset_t s, e; @@ -2439,8 +2447,12 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z (pte_lo & LPTE_PP)) { if (!(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID)) { /* Re-insert if spilled */ - i = moea64_pte_insert(ptegidx, - &pvo->pvo_pte.lpte); + if (moea64_pte_insert_hook != NULL) + i = moea64_pte_insert_hook(ptegidx, + &pvo->pvo_pte.lpte); + else + i = moea64_pte_insert_native(ptegidx, + &pvo->pvo_pte.lpte); if (i >= 0) PVO_PTEGIDX_SET(pvo, i); moea64_pte_overflow--; @@ -2523,7 +2535,10 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z /* * We hope this succeeds but it isn't required. */ - i = moea64_pte_insert(ptegidx, &pvo->pvo_pte.lpte); + if (moea64_pte_insert_hook != NULL) + i = moea64_pte_insert_hook(ptegidx, &pvo->pvo_pte.lpte); + else + i = moea64_pte_insert_native(ptegidx, &pvo->pvo_pte.lpte); if (i >= 0) { PVO_PTEGIDX_SET(pvo, i); } else { @@ -2558,9 +2573,15 @@ moea64_pvo_remove(struct pvo_entry *pvo) * save the ref & cfg bits). */ LOCK_TABLE(); - pt = moea64_pvo_to_pte(pvo); + if (moea64_pvo_to_pte_hook != NULL) + pt = moea64_pvo_to_pte_hook(pvo); + else + pt = moea64_pvo_to_pte_native(pvo); if (pt != NULL) { - moea64_pte_unset(pt, &pvo->pvo_pte.lpte, pvo->pvo_vpn); + if (moea64_pte_unset_hook != NULL) + moea64_pte_unset_hook(pt, &pvo->pvo_pte.lpte, pvo->pvo_vpn); + else + moea64_pte_unset_native(pt, &pvo->pvo_pte.lpte, pvo->pvo_vpn); PVO_PTEGIDX_CLR(pvo); } else { moea64_pte_overflow--; @@ -2642,7 +2663,7 @@ moea64_pvo_find_va(pmap_t pm, vm_offset_ } static struct lpte * -moea64_pvo_to_pte(const struct pvo_entry *pvo) +moea64_pvo_to_pte_native(const struct pvo_entry *pvo) { struct lpte *pt; int pteidx, ptegidx; @@ -2736,7 +2757,7 @@ moea64_pte_spillable_ident(u_int ptegidx } static int -moea64_pte_insert(u_int ptegidx, struct lpte *pvo_pt) +moea64_pte_insert_native(u_int ptegidx, struct lpte *pvo_pt) { struct lpte *pt; struct pvo_entry *pvo; @@ -2752,7 +2773,7 @@ moea64_pte_insert(u_int ptegidx, struct for (pt = moea64_pteg_table[pteg_bktidx].pt, i = 0; i < 8; i++, pt++) { if ((pt->pte_hi & (LPTE_VALID | LPTE_LOCKED)) == 0) { pvo_pt->pte_hi &= ~LPTE_HID; - moea64_pte_set(pt, pvo_pt); + moea64_pte_set_native(pt, pvo_pt); return (i); } } @@ -2764,7 +2785,7 @@ moea64_pte_insert(u_int ptegidx, struct for (pt = moea64_pteg_table[pteg_bktidx].pt, i = 0; i < 8; i++, pt++) { if ((pt->pte_hi & (LPTE_VALID | LPTE_LOCKED)) == 0) { pvo_pt->pte_hi |= LPTE_HID; - moea64_pte_set(pt, pvo_pt); + moea64_pte_set_native(pt, pvo_pt); return (i); } } @@ -2804,7 +2825,8 @@ moea64_pte_insert(u_int ptegidx, struct if (pvo->pvo_pte.lpte.pte_hi == pt->pte_hi) { KASSERT(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID, ("Invalid PVO for valid PTE!")); - moea64_pte_unset(pt, &pvo->pvo_pte.lpte, pvo->pvo_vpn); + moea64_pte_unset_native(pt, &pvo->pvo_pte.lpte, + pvo->pvo_vpn); PVO_PTEGIDX_CLR(pvo); moea64_pte_overflow++; break; @@ -2817,7 +2839,7 @@ moea64_pte_insert(u_int ptegidx, struct /* * Set the new PTE. */ - moea64_pte_set(pt, pvo_pt); + moea64_pte_set_native(pt, pvo_pt); return (i); } @@ -2863,9 +2885,12 @@ moea64_query_bit(vm_page_t m, u_int64_t * ptebit is set, cache it and return success. */ LOCK_TABLE(); - pt = moea64_pvo_to_pte(pvo); + pt = moea64_pvo_to_pte_native(pvo); if (pt != NULL) { - moea64_pte_synch(pt, &pvo->pvo_pte.lpte); + if (moea64_pte_synch_hook != NULL) + moea64_pte_synch_hook(pt, &pvo->pvo_pte.lpte); + else + moea64_pte_synch_native(pt, &pvo->pvo_pte.lpte); if (pvo->pvo_pte.lpte.pte_lo & ptebit) { UNLOCK_TABLE(); @@ -2914,12 +2939,24 @@ moea64_clear_bit(vm_page_t m, u_int64_t MOEA_PVO_CHECK(pvo); /* sanity check */ LOCK_TABLE(); - pt = moea64_pvo_to_pte(pvo); + if (moea64_pvo_to_pte_hook != NULL) + pt = moea64_pvo_to_pte_hook(pvo); + else + pt = moea64_pvo_to_pte_native(pvo); if (pt != NULL) { - moea64_pte_synch(pt, &pvo->pvo_pte.lpte); + if (moea64_pte_synch_hook != NULL) + moea64_pte_synch_hook(pt, &pvo->pvo_pte.lpte); + else + moea64_pte_synch_native(pt, &pvo->pvo_pte.lpte); if (pvo->pvo_pte.lpte.pte_lo & ptebit) { count++; - moea64_pte_clear(pt, pvo->pvo_vpn, ptebit); + if (moea64_pte_clear_hook != NULL) + moea64_pte_clear_hook(pt, + &pvo->pvo_pte.lpte, pvo->pvo_vpn, + ptebit); + else + moea64_pte_clear_native(pt, + pvo->pvo_vpn, ptebit); } } pvo->pvo_pte.lpte.pte_lo &= ~ptebit; @@ -2994,7 +3031,7 @@ moea64_unmapdev(mmu_t mmu, vm_offset_t v kmem_free(kernel_map, base, size); } -static void +void moea64_sync_icache(mmu_t mmu, pmap_t pm, vm_offset_t va, vm_size_t sz) { struct pvo_entry *pvo; Added: user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.h Sun Aug 1 02:27:16 2010 (r210712) @@ -0,0 +1,119 @@ +/*- + * Copyright (C) 2010 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _POWERPC_AIM_MMU_OEA64_H +#define _POWERPC_AIM_MMU_OEA64_H + +#include + +/* + * Helper routines + */ + +/* Allocate physical memory for use in moea64_bootstrap. */ +vm_offset_t moea64_bootstrap_alloc(vm_size_t, u_int); + +/* Bootstrap bits before the page table is allocated */ +void moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernelstart, + vm_offset_t kernelend); +/* Bootstrap bits after the page table is allocated */ +void moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, + vm_offset_t kernelend); + +/* + * Statistics + */ + +extern u_int moea64_pte_valid; +extern u_int moea64_pte_overflow; + +/* + * State variables + */ + +extern struct pvo_head *moea64_pvo_table; +extern int moea64_large_page_shift; +extern u_int moea64_pteg_count; +extern u_int moea64_pteg_mask; + +/* + * Page table manipulation hooks + */ + +extern void (*moea64_pte_synch_hook)(struct lpte *pt, struct lpte *pvo_pt); +extern void (*moea64_pte_clear_hook)(struct lpte *pt, struct lpte *pvo_pt, + uint64_t vpn, u_int64_t ptebit); +extern void (*moea64_pte_unset_hook)(struct lpte *pt, struct lpte *pvo_pt, + uint64_t vpn); +extern void (*moea64_pte_change_hook)(struct lpte *pt, struct lpte *pvo_pt, + uint64_t vpn); +extern int (*moea64_pte_insert_hook)(u_int ptegidx, struct lpte *pvo_pt); +extern struct lpte *(*moea64_pvo_to_pte_hook)(const struct pvo_entry *pvo); + +/* MMU Interface */ + +void moea64_change_wiring(mmu_t, pmap_t, vm_offset_t, boolean_t); +void moea64_clear_modify(mmu_t, vm_page_t); +void moea64_clear_reference(mmu_t, vm_page_t); +void moea64_copy_page(mmu_t, vm_page_t, vm_page_t); +void moea64_enter(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t, + boolean_t); +void moea64_enter_object(mmu_t, pmap_t, vm_offset_t, vm_offset_t, + vm_page_t, vm_prot_t); +void moea64_enter_quick(mmu_t, pmap_t, vm_offset_t, vm_page_t, + vm_prot_t); +vm_paddr_t moea64_extract(mmu_t, pmap_t, vm_offset_t); +vm_page_t moea64_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t); +void moea64_init(mmu_t); +boolean_t moea64_is_modified(mmu_t, vm_page_t); +boolean_t moea64_is_referenced(mmu_t, vm_page_t); +boolean_t moea64_ts_referenced(mmu_t, vm_page_t); +vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int); +boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t); +int moea64_page_wired_mappings(mmu_t, vm_page_t); +void moea64_pinit(mmu_t, pmap_t); +void moea64_pinit0(mmu_t, pmap_t); +void moea64_protect(mmu_t, pmap_t, vm_offset_t, vm_offset_t, + vm_prot_t); +void moea64_qenter(mmu_t, vm_offset_t, vm_page_t *, int); +void moea64_qremove(mmu_t, vm_offset_t, int); +void moea64_release(mmu_t, pmap_t); +void moea64_remove(mmu_t, pmap_t, vm_offset_t, vm_offset_t); +void moea64_remove_all(mmu_t, vm_page_t); +void moea64_remove_write(mmu_t, vm_page_t); +void moea64_zero_page(mmu_t, vm_page_t); +void moea64_zero_page_area(mmu_t, vm_page_t, int, int); +void moea64_zero_page_idle(mmu_t, vm_page_t); +void moea64_activate(mmu_t, struct thread *); +void moea64_deactivate(mmu_t, struct thread *); +void *moea64_mapdev(mmu_t, vm_offset_t, vm_size_t); +void moea64_unmapdev(mmu_t, vm_offset_t, vm_size_t); +vm_offset_t moea64_kextract(mmu_t, vm_offset_t); +void moea64_kenter(mmu_t, vm_offset_t, vm_offset_t); +boolean_t moea64_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t); +void moea64_sync_icache(mmu_t, pmap_t, vm_offset_t, vm_size_t); + +#endif /* _POWERPC_AIM_MMU_OEA64_H */ + Modified: user/nwhitehorn/ps3/powerpc/include/pmap.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/include/pmap.h Sun Aug 1 02:11:12 2010 (r210711) +++ user/nwhitehorn/ps3/powerpc/include/pmap.h Sun Aug 1 02:27:16 2010 (r210712) @@ -122,6 +122,24 @@ struct pvo_entry { }; LIST_HEAD(pvo_head, pvo_entry); +#define PVO_PTEGIDX_MASK 0x007UL /* which PTEG slot */ +#define PVO_PTEGIDX_VALID 0x008UL /* slot is valid */ +#define PVO_WIRED 0x010UL /* PVO entry is wired */ +#define PVO_MANAGED 0x020UL /* PVO entry is managed */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Aug 1 06:36:41 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FE981065678; Sun, 1 Aug 2010 06:36:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A4028FC13; Sun, 1 Aug 2010 06:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o716afxl020539; Sun, 1 Aug 2010 06:36:41 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o716af00020537; Sun, 1 Aug 2010 06:36:41 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008010636.o716af00020537@svn.freebsd.org> From: Doug Barton Date: Sun, 1 Aug 2010 06:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210713 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Aug 2010 06:36:41 -0000 Author: dougb Date: Sun Aug 1 06:36:41 2010 New Revision: 210713 URL: http://svn.freebsd.org/changeset/base/210713 Log: Add $pd to $origin in clean_distinfos(). We're duplicating the same new code that I added to clean_distinfos_all() to optimize finding the distinfo file, but in the former ORIGIN comes from $pkg/+CONTENTS, which does not include $pd. This meant that --clean-distfiles[-all] was deleting every file. (Oops) Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sun Aug 1 02:27:16 2010 (r210712) +++ user/dougb/portmaster/portmaster Sun Aug 1 06:36:41 2010 (r210713) @@ -881,6 +881,8 @@ read_distinfos () { origin=$moved_npd fi + origin="${pd}/${origin}" + if [ -s "${origin}/distinfo" ]; then distinfo="${origin}/distinfo" else From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 12:13:03 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09DF11065674; Mon, 2 Aug 2010 12:13:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC6228FC1C; Mon, 2 Aug 2010 12:13:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72CD27G018142; Mon, 2 Aug 2010 12:13:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72CD2lw018139; Mon, 2 Aug 2010 12:13:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021213.o72CD2lw018139@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 12:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210752 - in user/nwhitehorn/ps3/dev: fdt ofw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 12:13:03 -0000 Author: nwhitehorn Date: Mon Aug 2 12:13:02 2010 New Revision: 210752 URL: http://svn.freebsd.org/changeset/base/210752 Log: Two more tweaks to FDT: - fdtbus should simply fail to attach, not panic, if there is no device tree. Note that, because of fdtbus(4), kernels containing option FDT will not boot on machines with Open Firmware. What should eventually happen is that the OF-related code in PPC nexus(4) should be removed in favor of also using fdtbus on OF platforms. - ofw_fdt returns the wrong values as error codes. 0 is in principle a valid phandle, and -1 should be returned to indicate an error condition. I have patched OF_finddevice() to return -1 on errors for now, but the FDT code should eventually be systematically checked for this. Modified: user/nwhitehorn/ps3/dev/fdt/fdtbus.c user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Modified: user/nwhitehorn/ps3/dev/fdt/fdtbus.c ============================================================================== --- user/nwhitehorn/ps3/dev/fdt/fdtbus.c Mon Aug 2 11:48:05 2010 (r210751) +++ user/nwhitehorn/ps3/dev/fdt/fdtbus.c Mon Aug 2 12:13:02 2010 (r210752) @@ -174,7 +174,7 @@ fdtbus_attach(device_t dev) int error; if ((root = OF_peer(0)) == 0) - panic("fdtbus_attach: no root node."); + return (ENXIO); sc = device_get_softc(dev); Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Mon Aug 2 11:48:05 2010 (r210751) +++ user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Mon Aug 2 12:13:02 2010 (r210752) @@ -385,6 +385,8 @@ ofw_fdt_finddevice(ofw_t ofw, const char offset = fdt_path_offset(fdtp, device); p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); + if (p == 0) + p = -1; return (p); } From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 12:14:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88A871065695; Mon, 2 Aug 2010 12:14:17 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 774B78FC16; Mon, 2 Aug 2010 12:14:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72CEHpf018533; Mon, 2 Aug 2010 12:14:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72CEHOP018522; Mon, 2 Aug 2010 12:14:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021214.o72CEHOP018522@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 12:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210754 - user/nwhitehorn/ps3/powerpc/powerpc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 12:14:17 -0000 Author: nwhitehorn Date: Mon Aug 2 12:14:17 2010 New Revision: 210754 URL: http://svn.freebsd.org/changeset/base/210754 Log: Leftover change from the old branch to make multi-platform kernels actually work. The method table of the platform KOBJ needs to be reset in order to reuse it. Modified: user/nwhitehorn/ps3/powerpc/powerpc/platform.c Modified: user/nwhitehorn/ps3/powerpc/powerpc/platform.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/powerpc/platform.c Mon Aug 2 12:13:33 2010 (r210753) +++ user/nwhitehorn/ps3/powerpc/powerpc/platform.c Mon Aug 2 12:14:17 2010 (r210754) @@ -154,9 +154,10 @@ platform_probe_and_attach() } /* - * We can't free the KOBJ, since it is static. Luckily, - * this has no ill effects since it gets reset every time. + * We can't free the KOBJ, since it is static. Reset the ops + * member of this class so that we can come back later. */ + platp->ops = NULL; } if (plat_def_impl == NULL) From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 12:15:46 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 578DD1065781; Mon, 2 Aug 2010 12:15:46 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 462A38FC18; Mon, 2 Aug 2010 12:15:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72CFkRb018918; Mon, 2 Aug 2010 12:15:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72CFk1A018916; Mon, 2 Aug 2010 12:15:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021215.o72CFk1A018916@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 12:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210756 - user/nwhitehorn/ps3/powerpc/aim X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 12:15:46 -0000 Author: nwhitehorn Date: Mon Aug 2 12:15:46 2010 New Revision: 210756 URL: http://svn.freebsd.org/changeset/base/210756 Log: Add support for static FDT blobs, and declare FDT to be "real mode" for now, so that the system won't try to read its translations. This is a hack. Modified: user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c Modified: user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c Mon Aug 2 12:15:22 2010 (r210755) +++ user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c Mon Aug 2 12:15:46 2010 (r210756) @@ -333,6 +333,12 @@ OF_initial_setup(void *fdt_ptr, void *ju #endif fdt = fdt_ptr; + +#ifdef FDT_DTB_STATIC + /* Check for a statically included blob */ + if (fdt == NULL) + fdt = &fdt_static_dtb; +#endif } boolean_t @@ -362,6 +368,7 @@ OF_bootstrap() */ ofw_quiesce(); } else { + ofw_real_mode = 1; /* XXX: don't use special virt mode code */ status = OF_install(OFW_FDT, 0); if (status != TRUE) From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 12:17:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80D581065677; Mon, 2 Aug 2010 12:17:35 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FA428FC1D; Mon, 2 Aug 2010 12:17:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72CHZJk019381; Mon, 2 Aug 2010 12:17:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72CHZWk019379; Mon, 2 Aug 2010 12:17:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021217.o72CHZWk019379@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 12:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210758 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 12:17:35 -0000 Author: nwhitehorn Date: Mon Aug 2 12:17:35 2010 New Revision: 210758 URL: http://svn.freebsd.org/changeset/base/210758 Log: We don't necessarily want to reset the VAS ID to 0. It breaks future SMP support, for instance. Modified: user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Modified: user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Mon Aug 2 12:16:30 2010 (r210757) +++ user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Mon Aug 2 12:17:35 2010 (r210758) @@ -173,7 +173,6 @@ mps3_cpu_bootstrap(mmu_t mmup, int ap) lv1_destruct_virtual_address_space(0); lv1_select_virtual_address_space(mps3_vas_id); - mps3_vas_id = 0; /* Now this is the current mapping */ if (!ap) ps3fb_remap(); From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 12:21:38 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D09E106567A; Mon, 2 Aug 2010 12:21:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19B548FC1F; Mon, 2 Aug 2010 12:21:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72CLcc6020301; Mon, 2 Aug 2010 12:21:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72CLbxX020295; Mon, 2 Aug 2010 12:21:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021221.o72CLbxX020295@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 12:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210759 - in user/nwhitehorn/ps3: conf powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 12:21:38 -0000 Author: nwhitehorn Date: Mon Aug 2 12:21:37 2010 New Revision: 210759 URL: http://svn.freebsd.org/changeset/base/210759 Log: Checkpoint device discovery and the PIC and ethernet drivers for the PS3. The PIC driver is a stub, and the NIC driver does not work amazingly well without the ability to receive interrupts, but does manage to send packets. The PS3 virtualized network interface is an odd design. The same virtual controller handles both the wired and wireless controllers, which are distinguished by 802.1q VLAN tags in the packet headers. Added: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c user/nwhitehorn/ps3/powerpc/ps3/ps3bus.h user/nwhitehorn/ps3/powerpc/ps3/ps3pic.c Modified: user/nwhitehorn/ps3/conf/files.powerpc Modified: user/nwhitehorn/ps3/conf/files.powerpc ============================================================================== --- user/nwhitehorn/ps3/conf/files.powerpc Mon Aug 2 12:17:35 2010 (r210758) +++ user/nwhitehorn/ps3/conf/files.powerpc Mon Aug 2 12:21:37 2010 (r210759) @@ -188,8 +188,11 @@ powerpc/powerpc/suswintr.c standard powerpc/powerpc/syncicache.c standard powerpc/powerpc/sys_machdep.c standard powerpc/powerpc/uio_machdep.c standard +powerpc/ps3/if_glc.c optional ps3 glc powerpc/ps3/mmu_ps3.c optional ps3 powerpc/ps3/platform_ps3.c optional ps3 +powerpc/ps3/ps3bus.c optional ps3 +powerpc/ps3/ps3pic.c optional ps3 powerpc/ps3/ps3_syscons.c optional ps3 sc powerpc/ps3/ps3-hvcall.S optional ps3 sc powerpc/psim/iobus.c optional psim Added: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Aug 2 12:21:37 2010 (r210759) @@ -0,0 +1,742 @@ +/*- + * Copyright (C) 2010 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: user/nwhitehorn/ps3/powerpc/ofw/ofw_cpu.c 193156 2009-05-31 09:01:23Z nwhitehorn $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ps3bus.h" +#include "ps3-hvcall.h" +#include "if_glcreg.h" + +static int glc_probe(device_t); +static int glc_attach(device_t); +static void glc_init(void *xsc); +static void glc_start(struct ifnet *ifp); +static int glc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); +static int glc_add_rxbuf(struct glc_softc *sc, int idx); +static int glc_add_rxbuf_dma(struct glc_softc *sc, int idx); +static int glc_encap(struct glc_softc *sc, struct mbuf **m_head, + bus_addr_t *pktdesc); +static void glc_intr(void *xsc); + +static MALLOC_DEFINE(M_GLC, "gelic", "PS3 GELIC ethernet"); + +static device_method_t glc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, glc_probe), + DEVMETHOD(device_attach, glc_attach), + + { 0, 0 } +}; + +static driver_t glc_driver = { + "glc", + glc_methods, + sizeof(struct glc_softc) +}; + +static devclass_t glc_devclass; + +DRIVER_MODULE(glc, ps3bus, glc_driver, glc_devclass, 0, 0); + +static int +glc_probe(device_t dev) +{ + + if (ps3bus_get_bustype(dev) != PS3_BUSTYPE_SYSBUS || + ps3bus_get_devtype(dev) != PS3_DEVTYPE_GELIC) + return (ENXIO); + + device_set_desc(dev, "Playstation 3 GELIC Network Controller"); + return (BUS_PROBE_SPECIFIC); +} + +static void +glc_getphys(void *xaddr, bus_dma_segment_t *segs, int nsegs, int error) +{ + if (error != 0) + return; + + *(bus_addr_t *)xaddr = segs[0].ds_addr; +} + +static int +glc_attach(device_t dev) +{ + struct glc_softc *sc; + struct glc_txsoft *txs; + uint64_t mac64, val, junk; + int i, err; + + sc = device_get_softc(dev); + + sc->sc_bus = ps3bus_get_bus(dev); + sc->sc_dev = ps3bus_get_device(dev); + + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + sc->next_txdma_slot = sc->first_used_txdma_slot = 0; + + /* + * Open device, and shut down existing tasks. + */ + + err = lv1_open_device(sc->sc_bus, sc->sc_dev, 0); + if (err) { + device_printf(dev, "Error opening device: %d\n", err); + mtx_destroy(&sc->sc_mtx); + return (ENXIO); + } + + lv1_net_stop_tx_dma(sc->sc_bus, sc->sc_dev, 0); + lv1_net_stop_rx_dma(sc->sc_bus, sc->sc_dev, 0); + + sc->sc_ifp = if_alloc(IFT_ETHER); + sc->sc_ifp->if_softc = sc; + +/* Wait for link */ +for (i = 0; i < 1000; i++) { + lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_GET_LINK_STATUS, 2, 0, + 0, &val, &junk); + if (val & GELIC_LINK_UP) + break; + DELAY(500); +} + + + /* + * Get MAC address and VLAN id + */ + + lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_GET_MAC_ADDRESS, + 0, 0, 0, &mac64, &junk); + memcpy(sc->sc_enaddr, &((uint8_t *)&mac64)[2], sizeof(sc->sc_enaddr)); + sc->sc_tx_vlan = sc->sc_rx_vlan = -1; + err = lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_GET_VLAN_ID, + GELIC_VLAN_TX_ETHERNET, 0, 0, &val, &junk); + if (err == 0) + sc->sc_tx_vlan = val; + err = lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_GET_VLAN_ID, + GELIC_VLAN_RX_ETHERNET, 0, 0, &val, &junk); + if (err == 0) + sc->sc_rx_vlan = val; + + /* + * Set up interrupt handler + */ + sc->sc_irqid = 0; + sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irqid, + RF_ACTIVE); + if (sc->sc_irq == NULL) { + device_printf(dev, "Could not allocate IRQ!\n"); + mtx_destroy(&sc->sc_mtx); + return (ENXIO); + } + + bus_setup_intr(dev, sc->sc_irq, + INTR_TYPE_MISC | INTR_MPSAFE | INTR_ENTROPY, NULL, glc_intr, + sc, &sc->sc_irqctx); + sc->sc_interrupt_status = (uint64_t *)contigmalloc(8, M_GLC, M_ZERO, 0, + BUS_SPACE_MAXADDR_32BIT, 8, PAGE_SIZE); + lv1_net_set_interrupt_status_indicator(sc->sc_bus, sc->sc_dev, + vtophys(sc->sc_interrupt_status), 0); + lv1_net_set_interrupt_mask(sc->sc_bus, sc->sc_dev, + GELIC_INT_RXDONE | GELIC_INT_TXDONE | GELIC_INT_RXFRAME | + GELIC_INT_PHY, 0); + + /* + * Set up DMA. + */ + + /* XXX: following should be integrated to busdma */ + err = lv1_allocate_device_dma_region(sc->sc_bus, sc->sc_dev, + 0x8000000 /* 128 MB */, 24 /* log_2(16 MB) */, + 0 /* 32-bit transfers */, &sc->sc_dma_base); + if (err != 0) { + device_printf(dev, "could not allocate DMA region: %d\n", err); + goto fail; + } + + err = lv1_map_device_dma_region(sc->sc_bus, sc->sc_dev, 0 /* physmem */, + sc->sc_dma_base, 0x8000000 /* 128 MB */, + 0xf800000000000000UL /* see Cell IO/MMU docs */); + if (err != 0) { + device_printf(dev, "could not map DMA region: %d\n", err); + goto fail; + } + + err = bus_dma_tag_create(bus_get_dma_tag(dev), 32, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + 129*sizeof(struct glc_dmadesc), 1, 128*sizeof(struct glc_dmadesc), + 0, NULL,NULL, &sc->sc_dmadesc_tag); + + err = bus_dmamem_alloc(sc->sc_dmadesc_tag, (void **)&sc->sc_txdmadesc, + BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, + &sc->sc_txdmadesc_map); + err = bus_dmamap_load(sc->sc_dmadesc_tag, sc->sc_txdmadesc_map, + sc->sc_txdmadesc, 128*sizeof(struct glc_dmadesc), glc_getphys, + &sc->sc_txdmadesc_phys, 0); + err = bus_dmamem_alloc(sc->sc_dmadesc_tag, (void **)&sc->sc_rxdmadesc, + BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, + &sc->sc_rxdmadesc_map); + err = bus_dmamap_load(sc->sc_dmadesc_tag, sc->sc_rxdmadesc_map, + sc->sc_rxdmadesc, 128*sizeof(struct glc_dmadesc), glc_getphys, + &sc->sc_rxdmadesc_phys, 0); + + err = bus_dma_tag_create(bus_get_dma_tag(dev), 128, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL,NULL, + &sc->sc_rxdma_tag); + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 16, BUS_SPACE_MAXSIZE_32BIT, 0, NULL,NULL, + &sc->sc_txdma_tag); + + /* init transmit descriptors */ + STAILQ_INIT(&sc->sc_txfreeq); + STAILQ_INIT(&sc->sc_txdirtyq); + + /* create TX DMA maps */ + err = ENOMEM; + for (i = 0; i < GLC_MAX_TX_PACKETS; i++) { + txs = &sc->sc_txsoft[i]; + txs->txs_mbuf = NULL; + err = bus_dmamap_create(sc->sc_txdma_tag, 0, &txs->txs_dmamap); + if (err) { + device_printf(dev, + "unable to create TX DMA map %d, error = %d\n", + i, err); + } + STAILQ_INSERT_TAIL(&sc->sc_txfreeq, txs, txs_q); + } + + /* Create the receive buffer DMA maps. */ + for (i = 0; i < GLC_MAX_RX_PACKETS; i++) { + err = bus_dmamap_create(sc->sc_rxdma_tag, 0, + &sc->sc_rxsoft[i].rxs_dmamap); + if (err) { + device_printf(dev, + "unable to create RX DMA map %d, error = %d\n", + i, err); + } + sc->sc_rxsoft[i].rxs_mbuf = NULL; + } + + /* + * Attach to network stack + */ + + if_initname(sc->sc_ifp, device_get_name(dev), device_get_unit(dev)); + sc->sc_ifp->if_mtu = ETHERMTU; + sc->sc_ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + sc->sc_ifp->if_start = glc_start; + sc->sc_ifp->if_ioctl = glc_ioctl; + sc->sc_ifp->if_init = glc_init; + + IFQ_SET_MAXLEN(&sc->sc_ifp->if_snd, GLC_MAX_TX_PACKETS); + sc->sc_ifp->if_snd.ifq_drv_maxlen = GLC_MAX_TX_PACKETS; + IFQ_SET_READY(&sc->sc_ifp->if_snd); + + ether_ifattach(sc->sc_ifp, sc->sc_enaddr); + sc->sc_ifp->if_hwassist = 0; + + return (0); + +fail: + mtx_destroy(&sc->sc_mtx); + if_free(sc->sc_ifp); + return (ENXIO); +} + +static void +glc_init_locked(struct glc_softc *sc) +{ + int i; + struct glc_rxsoft *rxs; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + + lv1_net_stop_tx_dma(sc->sc_bus, sc->sc_dev, 0); + lv1_net_stop_rx_dma(sc->sc_bus, sc->sc_dev, 0); + + for (i = 0; i < GLC_MAX_RX_PACKETS; i++) { + rxs = &sc->sc_rxsoft[i]; + rxs->rxs_desc_slot = i; + + if (rxs->rxs_mbuf == NULL) { + glc_add_rxbuf(sc, i); + + if (rxs->rxs_mbuf == NULL) { + rxs->rxs_desc_slot = -1; + break; + } + } + + glc_add_rxbuf_dma(sc, i); + bus_dmamap_sync(sc->sc_dmadesc_tag, sc->sc_rxdmadesc_map, + BUS_DMASYNC_PREREAD); + } + + lv1_net_start_rx_dma(sc->sc_bus, sc->sc_dev, + sc->sc_rxsoft[0].rxs_desc, 0); + + sc->sc_ifp->if_drv_flags |= IFF_DRV_RUNNING; + sc->sc_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->sc_ifpflags = sc->sc_ifp->if_flags; +} + +static void +glc_init(void *xsc) +{ + struct glc_softc *sc = xsc; + + mtx_lock(&sc->sc_mtx); + glc_init_locked(sc); + mtx_unlock(&sc->sc_mtx); +} + +static void +glc_start_locked(struct ifnet *ifp) +{ + struct glc_softc *sc = ifp->if_softc; + struct glc_txsoft *txs; + bus_addr_t first, pktdesc; + int i, kickstart; + struct mbuf *mb_head; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + first = 0; + +printf("Transmitting packet!\n"); + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + IFQ_DRV_DEQUEUE(&ifp->if_snd, mb_head); + + if (mb_head == NULL) + break; + + BPF_MTAP(ifp, mb_head); + + if (sc->sc_tx_vlan >= 0) + mb_head = ether_vlanencap(mb_head, sc->sc_tx_vlan); + + if (glc_encap(sc, &mb_head, &pktdesc)) { + /* Put the packet back and stop */ + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + IFQ_DRV_PREPEND(&ifp->if_snd, mb_head); + break; + } + + if (first == 0) + first = pktdesc; + } + + bus_dmamap_sync(sc->sc_dmadesc_tag, sc->sc_txdmadesc_map, + BUS_DMASYNC_PREREAD); + + kickstart = 1; + STAILQ_FOREACH(txs, &sc->sc_txdirtyq, txs_q) { + for (i = txs->txs_firstdesc; + i != (txs->txs_lastdesc+1) % GLC_MAX_TX_PACKETS; + i = (i + 1) % GLC_MAX_TX_PACKETS) { + /* + * Check if any segments are currently being processed. + * If so, the DMA engine will pick up the bits we + * added eventually, otherwise restart DMA + */ + + if (sc->sc_txdmadesc[i].cmd_stat & GELIC_DESCR_OWNED) { + //kickstart = 0; + break; + } + } + } + + if (kickstart && first != 0) + lv1_net_start_tx_dma(sc->sc_bus, sc->sc_dev, first, 0); +} + +static void +glc_start(struct ifnet *ifp) +{ + struct glc_softc *sc = ifp->if_softc; + + mtx_lock(&sc->sc_mtx); + glc_start_locked(ifp); + mtx_unlock(&sc->sc_mtx); +} + +static int +glc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct glc_softc *sc = ifp->if_softc; +#if 0 + struct ifreq *ifr = (struct ifreq *)data; +#endif + int err = 0; + + switch (cmd) { + case SIOCSIFFLAGS: + mtx_lock(&sc->sc_mtx); + if ((ifp->if_flags & IFF_UP) != 0) { +#if 0 + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ((ifp->if_flags ^ sc->sc_ifpflags) & + (IFF_ALLMULTI | IFF_PROMISC)) != 0) + bm_setladrf(sc); + else +#endif + glc_init_locked(sc); + } +#if 0 + else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + bm_stop(sc); +#endif + sc->sc_ifpflags = ifp->if_flags; + mtx_unlock(&sc->sc_mtx); + break; + default: + err = ether_ioctl(ifp, cmd, data); + break; + } + + return (err); +} + +static int +glc_add_rxbuf(struct glc_softc *sc, int idx) +{ + struct glc_rxsoft *rxs = &sc->sc_rxsoft[idx]; + struct mbuf *m; + bus_dma_segment_t segs[1]; + int error, nsegs; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; + + if (rxs->rxs_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rxdma_tag, rxs->rxs_dmamap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rxdma_tag, rxs->rxs_dmamap); + } + + error = bus_dmamap_load_mbuf_sg(sc->sc_rxdma_tag, rxs->rxs_dmamap, m, + segs, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->sc_self, + "cannot load RS DMA map %d, error = %d\n", idx, error); + m_freem(m); + return (error); + } + /* If nsegs is wrong then the stack is corrupt. */ + KASSERT(nsegs == 1, + ("%s: too many DMA segments (%d)", __func__, nsegs)); + rxs->rxs_mbuf = m; + rxs->segment = segs[0]; + + bus_dmamap_sync(sc->sc_rxdma_tag, rxs->rxs_dmamap, BUS_DMASYNC_PREREAD); + + return (0); +} + +static int +glc_add_rxbuf_dma(struct glc_softc *sc, int idx) +{ + struct glc_rxsoft *rxs = &sc->sc_rxsoft[idx]; + + bzero(&sc->sc_rxdmadesc[idx], sizeof(sc->sc_rxdmadesc[idx])); + sc->sc_rxdmadesc[idx].paddr = sc->sc_dma_base + rxs->segment.ds_addr; + sc->sc_rxdmadesc[idx].len = rxs->segment.ds_len; + sc->sc_rxdmadesc[idx].next = sc->sc_dma_base + sc->sc_rxdmadesc_phys + + ((idx + 1) % GLC_MAX_RX_PACKETS)*sizeof(sc->sc_rxdmadesc[idx]); + sc->sc_rxdmadesc[idx].cmd_stat = GELIC_DESCR_OWNED; + + rxs->rxs_desc_slot = idx; + rxs->rxs_desc = sc->sc_dma_base + sc->sc_rxdmadesc_phys + + idx*sizeof(struct glc_dmadesc); + + return (0); +} + +static int +glc_encap(struct glc_softc *sc, struct mbuf **m_head, bus_addr_t *pktdesc) +{ + bus_dma_segment_t segs[16]; + struct glc_txsoft *txs; + struct mbuf *m; + bus_addr_t firstslotphys; + int i, idx; + int nsegs = 16; + int err = 0; + + /* Max number of segments is the number of free DMA slots */ + if (sc->next_txdma_slot >= sc->first_used_txdma_slot) + nsegs = 128 - sc->next_txdma_slot + sc->first_used_txdma_slot; + else + nsegs = sc->first_used_txdma_slot - sc->next_txdma_slot; + + if (nsegs > 16) + nsegs = 16; + + /* Get a work queue entry. */ + if ((txs = STAILQ_FIRST(&sc->sc_txfreeq)) == NULL) { + /* Ran out of descriptors. */ + return (ENOBUFS); + } + + err = bus_dmamap_load_mbuf_sg(sc->sc_txdma_tag, txs->txs_dmamap, + *m_head, segs, &nsegs, BUS_DMA_NOWAIT); + + if (err == EFBIG) { + m = m_collapse(*m_head, M_DONTWAIT, nsegs); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + + err = bus_dmamap_load_mbuf_sg(sc->sc_txdma_tag, + txs->txs_dmamap, *m_head, segs, &nsegs, BUS_DMA_NOWAIT); + if (err != 0) { + m_freem(*m_head); + *m_head = NULL; + return (err); + } + } else if (err != 0) + return (err); + + if (nsegs == 0) { + m_freem(*m_head); + *m_head = NULL; + return (EIO); + } + + txs->txs_ndescs = nsegs; + txs->txs_firstdesc = sc->next_txdma_slot; + + idx = txs->txs_firstdesc; + firstslotphys = sc->sc_dma_base + sc->sc_txdmadesc_phys + + txs->txs_firstdesc*sizeof(struct glc_dmadesc); + + for (i = 0; i < nsegs; i++) { + if (i+1 == nsegs) + txs->txs_lastdesc = sc->next_txdma_slot; + + bzero(&sc->sc_txdmadesc[idx], sizeof(sc->sc_txdmadesc[idx])); + sc->sc_txdmadesc[idx].paddr = sc->sc_dma_base + segs[i].ds_addr; + sc->sc_txdmadesc[idx].len = segs[i].ds_len; + sc->sc_txdmadesc[idx].next = sc->sc_dma_base + + sc->sc_txdmadesc_phys + + ((idx + 1) % GLC_MAX_TX_PACKETS)*sizeof(struct glc_dmadesc); + sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_NOIPSEC; + + if (i+1 == nsegs) { + txs->txs_lastdesc = sc->next_txdma_slot; + sc->sc_txdmadesc[idx].next = 0; + sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_LAST; + } + + sc->sc_txdmadesc[idx].cmd_stat |= GELIC_DESCR_OWNED; + + idx = (idx + 1) % GLC_MAX_TX_PACKETS; + } + sc->next_txdma_slot = idx; + + bus_dmamap_sync(sc->sc_txdma_tag, txs->txs_dmamap, + BUS_DMASYNC_PREWRITE); + + idx = (txs->txs_firstdesc - 1) % GLC_MAX_TX_PACKETS; + sc->sc_txdmadesc[idx].next = firstslotphys; + + bus_dmamap_sync(sc->sc_txdma_tag, txs->txs_dmamap, + BUS_DMASYNC_PREWRITE); + + if (pktdesc != NULL) + *pktdesc = firstslotphys; + + return (0); +} + +static void +glc_rxintr(struct glc_softc *sc) +{ + int i, restart_rxdma; + struct mbuf *m; + uint16_t tag; + struct ifnet *ifp = sc->sc_ifp; + + bus_dmamap_sync(sc->sc_dmadesc_tag, sc->sc_rxdmadesc_map, + BUS_DMASYNC_PREWRITE); + + restart_rxdma = 0; + while ((sc->sc_rxdmadesc[sc->sc_next_rxdma_slot].cmd_stat & + GELIC_DESCR_OWNED) == 0) { + i = sc->sc_next_rxdma_slot; + if (sc->sc_rxdmadesc[i].rxerror & GELIC_RXERRORS) { + ifp->if_ierrors++; + goto requeue; + } + + m = sc->sc_rxsoft[i].rxs_mbuf; + if (glc_add_rxbuf(sc, i)) { + ifp->if_ierrors++; + goto requeue; + } + + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_len = sc->sc_rxdmadesc[i].valid_size; + m->m_pkthdr.len = m->m_len; + sc->sc_next_rxdma_slot++; + + if (sc->sc_rx_vlan >= 0) { + struct ether_vlan_header *evl; + if (m->m_len < sizeof(*evl) && + (m = m_pullup(m, sizeof(*evl))) == NULL) { + if_printf(ifp, "cannot pullup VLAN header\n"); + return; + } + evl = mtod(m, struct ether_vlan_header *); + tag = EVL_VLANOFTAG(ntohs(evl->evl_tag)); + + /* + * Remove the 802.1q header by copying the Ethernet + * addresses over it and adjusting the beginning of + * the data in the mbuf. The encapsulated Ethernet + * type field is already in place. + */ + bcopy((char *)evl, (char *)evl + ETHER_VLAN_ENCAP_LEN, + ETHER_HDR_LEN - ETHER_TYPE_LEN); + m_adj(m, ETHER_VLAN_ENCAP_LEN); + } + + mtx_unlock(&sc->sc_mtx); + (*ifp->if_input)(ifp, m); + mtx_lock(&sc->sc_mtx); + + requeue: + if (sc->sc_rxdmadesc[i].cmd_stat & GELIC_CMDSTAT_RX_END) + restart_rxdma = 1; + glc_add_rxbuf_dma(sc, i); + if (restart_rxdma) + lv1_net_start_rx_dma(sc->sc_bus, sc->sc_dev, + sc->sc_rxsoft[i].rxs_desc, 0); + } +} + +static void +glc_txintr(struct glc_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct glc_txsoft *txs; + int progress = 0; + + while ((txs = STAILQ_FIRST(&sc->sc_txdirtyq)) != NULL) { + if (sc->sc_txdmadesc[txs->txs_lastdesc].cmd_stat + != GELIC_CMDSTAT_DMA_DONE) + break; + + STAILQ_REMOVE_HEAD(&sc->sc_txdirtyq, txs_q); + bus_dmamap_unload(sc->sc_txdma_tag, txs->txs_dmamap); + + if (txs->txs_mbuf != NULL) { + m_freem(txs->txs_mbuf); + txs->txs_mbuf = NULL; + } + + STAILQ_INSERT_TAIL(&sc->sc_txfreeq, txs, txs_q); + + ifp->if_opackets++; + progress = 1; + } + + if (progress) { + /* + * We freed some descriptors, so reset IFF_DRV_OACTIVE + * and restart. + */ + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; +#if 0 + sc->sc_wdog_timer = STAILQ_EMPTY(&sc->sc_txdirtyq) ? 0 : 5; +#endif + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && + !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + glc_start_locked(ifp); + } +} + +static void +glc_intr(void *xsc) +{ + struct glc_softc *sc = xsc; + + mtx_lock(&sc->sc_mtx); + + if (sc->sc_interrupt_status == 0) { + device_printf(sc->sc_self, "stray interrupt!\n"); + mtx_unlock(&sc->sc_mtx); + return; + } +printf("GLC Interrupt!\n"); + + if (*sc->sc_interrupt_status & (GELIC_INT_RXDONE | GELIC_INT_RXFRAME)) + glc_rxintr(sc); + + if (*sc->sc_interrupt_status & GELIC_INT_TXDONE) + glc_txintr(sc); + + mtx_unlock(&sc->sc_mtx); +} Added: user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Aug 2 12:21:37 2010 (r210759) @@ -0,0 +1,147 @@ +/*- + * Copyright (C) 2010 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: user/nwhitehorn/ps3/powerpc/ofw/ofw_cpu.c 193156 2009-05-31 09:01:23Z nwhitehorn $ + */ + +#ifndef _POWERPC_PS3_IF_GLCREG_H +#define _POWERPC_PS3_IF_GLCREG_H + +#define GLC_MAX_TX_PACKETS 128 +#define GLC_MAX_RX_PACKETS 128 + +struct glc_dmadesc; + +/* + * software state for transmit job mbufs (may be elements of mbuf chains) + */ + +struct glc_txsoft { + struct mbuf *txs_mbuf; /* head of our mbuf chain */ + bus_dmamap_t txs_dmamap; /* our DMA map */ + int txs_firstdesc; /* first descriptor in packet */ + int txs_lastdesc; /* last descriptor in packet */ + + int txs_ndescs; /* number of descriptors */ + STAILQ_ENTRY(glc_txsoft) txs_q; +}; + +STAILQ_HEAD(glc_txsq, glc_txsoft); + +/* + * software state for receive jobs + */ +struct glc_rxsoft { + struct mbuf *rxs_mbuf; /* head of our mbuf chain */ + bus_dmamap_t rxs_dmamap; /* our DMA map */ + + int rxs_desc_slot; /* DMA descriptor for this packet */ + bus_addr_t rxs_desc; + + bus_dma_segment_t segment; +}; + +struct glc_softc { + struct ifnet *sc_ifp; + device_t sc_self; + struct mtx sc_mtx; + u_char sc_enaddr[ETHER_ADDR_LEN]; + int sc_tx_vlan, sc_rx_vlan; + int sc_ifpflags; + + uint64_t sc_dma_base; + bus_dma_tag_t sc_dmadesc_tag; + + int sc_irqid; + struct resource *sc_irq; + void *sc_irqctx; + uint64_t *sc_interrupt_status; + + /* Transmission */ + + bus_dma_tag_t sc_txdma_tag; + struct glc_txsoft sc_txsoft[GLC_MAX_TX_PACKETS]; + struct glc_dmadesc *sc_txdmadesc; + int next_txdma_slot, first_used_txdma_slot; + bus_dmamap_t sc_txdmadesc_map; + bus_addr_t sc_txdmadesc_phys; + + struct glc_txsq sc_txfreeq; + struct glc_txsq sc_txdirtyq; + + /* Reception */ + + bus_dma_tag_t sc_rxdma_tag; + struct glc_rxsoft sc_rxsoft[GLC_MAX_RX_PACKETS]; + struct glc_dmadesc *sc_rxdmadesc; + int sc_next_rxdma_slot; + bus_dmamap_t sc_rxdmadesc_map; + bus_addr_t sc_rxdmadesc_phys; + + int sc_bus, sc_dev; +}; + +#define GELIC_GET_MAC_ADDRESS 0x0001 +#define GELIC_GET_LINK_STATUS 0x0002 +#define GELIC_LINK_UP 0x0001 +#define GELIC_FULL_DUPLEX 0x0002 +#define GELIC_AUTO_NEG 0x0004 +#define GELIC_SPEED_10 0x0010 +#define GELIC_SPEED_100 0x0020 +#define GELIC_SPEED_1000 0x0040 +#define GELIC_GET_VLAN_ID 0x0004 +#define GELIC_VLAN_TX_ETHERNET 0x0002 +#define GELIC_VLAN_RX_ETHERNET 0x0012 +#define GELIC_VLAN_TX_WIRELESS 0x0003 +#define GELIC_VLAN_RX_WIRELESS 0x0013 + +/* Command status code */ +#define GELIC_DESCR_OWNED 0xa0000000 +#define GELIC_CMDSTAT_DMA_DONE 0x00000000 +#define GELIC_CMDSTAT_RX_END 0x00000002 +#define GELIC_CMDSTAT_NOIPSEC 0x00080000 +#define GELIC_CMDSTAT_LAST 0x00040000 +#define GELIC_RXERRORS 0x7def8000 + +/* Interrupt options */ +#define GELIC_INT_RXDONE 0x0000000000004000UL +#define GELIC_INT_RXFRAME 0x1000000000000000UL +#define GELIC_INT_TXDONE 0x0080000000000000UL +#define GELIC_INT_PHY 0x0000000020000000UL + +/* Hardware DMA descriptor. Must be 32-byte aligned */ + +struct glc_dmadesc { + uint32_t paddr; /* Must be 128 byte aligned for receive */ + uint32_t len; + uint32_t next; + uint32_t cmd_stat; + uint32_t result_size; + uint32_t valid_size; + uint32_t data_stat; + uint32_t rxerror; +}; + +#endif /* _POWERPC_PS3_IF_GLCREG_H */ + Added: user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c Mon Aug 2 12:21:37 2010 (r210759) @@ -0,0 +1,302 @@ +/*- + * Copyright (C) 2010 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: user/nwhitehorn/ps3/powerpc/ofw/ofw_cpu.c 193156 2009-05-31 09:01:23Z nwhitehorn $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "ps3bus.h" +#include "ps3-hvcall.h" + +static void ps3bus_identify(driver_t *, device_t); +static int ps3bus_probe(device_t); +static int ps3bus_attach(device_t); +static int ps3bus_print_child(device_t dev, device_t child); +static int ps3bus_read_ivar(device_t bus, device_t child, int which, + uintptr_t *result); +static struct resource *ps3bus_alloc_resource(device_t bus, device_t child, + int type, int *rid, u_long start, u_long end, + u_long count, u_int flags); +static int ps3bus_activate_resource(device_t bus, device_t child, int type, + int rid, struct resource *res); + +struct ps3bus_devinfo { + int bus; + int dev; + uint64_t bustype; + uint64_t devtype; + + struct resource_list resources; +}; + +static MALLOC_DEFINE(M_PS3BUS, "ps3bus", "PS3 system bus device information"); + +static device_method_t ps3bus_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, ps3bus_identify), + DEVMETHOD(device_probe, ps3bus_probe), + DEVMETHOD(device_attach, ps3bus_attach), + + /* Bus interface */ + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, ps3bus_print_child), + DEVMETHOD(bus_read_ivar, ps3bus_read_ivar), + DEVMETHOD(bus_alloc_resource, ps3bus_alloc_resource), + DEVMETHOD(bus_activate_resource, ps3bus_activate_resource), + + { 0, 0 } +}; + +static driver_t ps3bus_driver = { + "ps3bus", + ps3bus_methods, + 0 +}; + +static devclass_t ps3bus_devclass; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 13:00:43 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 976F8106566B; Mon, 2 Aug 2010 13:00:43 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 855E48FC29; Mon, 2 Aug 2010 13:00:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72D0hxr028861; Mon, 2 Aug 2010 13:00:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72D0hnu028857; Mon, 2 Aug 2010 13:00:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021300.o72D0hnu028857@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 13:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210760 - in user/nwhitehorn/ps3/powerpc: aim powerpc ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 13:00:43 -0000 Author: nwhitehorn Date: Mon Aug 2 13:00:43 2010 New Revision: 210760 URL: http://svn.freebsd.org/changeset/base/210760 Log: Initial SMP support on PS3. The second thread is extraordinarily slow at the moment. Maybe some cache initialization or something is needed? Modified: user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c user/nwhitehorn/ps3/powerpc/powerpc/mp_machdep.c user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Modified: user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Mon Aug 2 12:21:37 2010 (r210759) +++ user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Mon Aug 2 13:00:43 2010 (r210760) @@ -1159,10 +1159,6 @@ moea64_late_bootstrap(mmu_t mmup, vm_off moea64_add_ofw_mappings(mmup, mmu, sz); } -#ifdef SMP - TLBSYNC(); -#endif - /* * Calculate the last available physical address. */ Modified: user/nwhitehorn/ps3/powerpc/powerpc/mp_machdep.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/powerpc/mp_machdep.c Mon Aug 2 12:21:37 2010 (r210759) +++ user/nwhitehorn/ps3/powerpc/powerpc/mp_machdep.c Mon Aug 2 13:00:43 2010 (r210760) @@ -77,7 +77,13 @@ machdep_ap_bootstrap(void) /* Initialize DEC and TB, sync with the BSP values */ decr_ap_init(); +#ifdef __powerpc64__ + /* Writing to the time base register is hypervisor-privileged */ + if (mfmsr() & PSL_HV) + mttb(ap_timebase); +#else mttb(ap_timebase); +#endif __asm __volatile("mtdec %0" :: "r"(ap_decr)); atomic_add_int(&ap_awake, 1); @@ -242,7 +248,13 @@ cpu_mp_unleash(void *dummy) /* Let APs continue */ atomic_store_rel_int(&ap_letgo, 1); +#ifdef __powerpc64__ + /* Writing to the time base register is hypervisor-privileged */ + if (mfmsr() & PSL_HV) + mttb(ap_timebase); +#else mttb(ap_timebase); +#endif while (ap_awake < smp_cpus) ; Modified: user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Aug 2 12:21:37 2010 (r210759) +++ user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Aug 2 13:00:43 2010 (r210760) @@ -54,6 +54,10 @@ __FBSDID("$FreeBSD: user/nwhitehorn/ps3/ #include "platform_if.h" #include "ps3-hvcall.h" +#ifdef SMP +extern void *ap_pcpu; +#endif + static int ps3_probe(platform_t); static int ps3_attach(platform_t); static void ps3_mem_regions(platform_t, struct mem_region **phys, int *physsz, @@ -141,14 +145,12 @@ static u_long ps3_timebase_freq(platform_t plat, struct cpuref *cpuref) { uint64_t ticks, node_id, junk; - uint64_t lpar_id; - lv1_get_logical_partition_id(&lpar_id); - lv1_get_repository_node_value(lpar_id, PS3_LPAR_ID_PME, - lv1_repository_string("be") >> 32, 0, 0, &node_id, &junk); - lv1_get_repository_node_value(lpar_id, PS3_LPAR_ID_PME, + lv1_get_repository_node_value(PS3_LPAR_ID_PME, + lv1_repository_string("be") >> 32, 0, 0, 0, &node_id, &junk); + lv1_get_repository_node_value(PS3_LPAR_ID_PME, lv1_repository_string("be") >> 32, node_id, - lv1_repository_string("clock"), &ticks, &junk); + lv1_repository_string("clock"), 0, &ticks, &junk); return (ticks); } @@ -167,7 +169,13 @@ static int ps3_smp_next_cpu(platform_t plat, struct cpuref *cpuref) { - return (ENOENT); + if (cpuref->cr_cpuid >= 1) + return (ENOENT); + + cpuref->cr_cpuid++; + cpuref->cr_hwref = cpuref->cr_cpuid; + + return (0); } static int @@ -183,7 +191,27 @@ ps3_smp_get_bsp(platform_t plat, struct static int ps3_smp_start_cpu(platform_t plat, struct pcpu *pc) { +#ifdef SMP + /* loader(8) is spinning on 0x40 == 1 right now */ + uint32_t *secondary_spin_sem = (uint32_t *)(0x40); + int timeout; + if (pc->pc_hwref != 1) + return (ENXIO); + + ap_pcpu = pc; + *secondary_spin_sem = 1; + powerpc_sync(); + DELAY(1); + + timeout = 10000; + while (!pc->pc_awake && timeout--) + DELAY(100); + + return ((pc->pc_awake) ? 0 : EBUSY); +#else /* No SMP support */ return (ENXIO); +#endif } + From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 13:10:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 482E81065677; Mon, 2 Aug 2010 13:10:28 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36ACD8FC28; Mon, 2 Aug 2010 13:10:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72DASNb031083; Mon, 2 Aug 2010 13:10:28 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72DASNf031078; Mon, 2 Aug 2010 13:10:28 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021310.o72DASNf031078@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 13:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210762 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 13:10:28 -0000 Author: nwhitehorn Date: Mon Aug 2 13:10:27 2010 New Revision: 210762 URL: http://svn.freebsd.org/changeset/base/210762 Log: Fix some schizophrenia in my licenses. Apparently copying and pasting from other files is fraught with peril. Submitted by: trasz Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c user/nwhitehorn/ps3/powerpc/ps3/ps3bus.h Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Aug 2 13:05:12 2010 (r210761) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Aug 2 13:10:27 2010 (r210762) @@ -11,7 +11,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Aug 2 13:05:12 2010 (r210761) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Aug 2 13:10:27 2010 (r210762) @@ -11,7 +11,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, Modified: user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c Mon Aug 2 13:05:12 2010 (r210761) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3bus.c Mon Aug 2 13:10:27 2010 (r210762) @@ -11,7 +11,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, Modified: user/nwhitehorn/ps3/powerpc/ps3/ps3bus.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/ps3bus.h Mon Aug 2 13:05:12 2010 (r210761) +++ user/nwhitehorn/ps3/powerpc/ps3/ps3bus.h Mon Aug 2 13:10:27 2010 (r210762) @@ -11,7 +11,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, From owner-svn-src-user@FreeBSD.ORG Mon Aug 2 14:29:20 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 397DE1065674; Mon, 2 Aug 2010 14:29:20 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 282A18FC18; Mon, 2 Aug 2010 14:29:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o72ETK5X048715; Mon, 2 Aug 2010 14:29:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o72ETKOe048713; Mon, 2 Aug 2010 14:29:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008021429.o72ETKOe048713@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Aug 2010 14:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210768 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2010 14:29:20 -0000 Author: nwhitehorn Date: Mon Aug 2 14:29:19 2010 New Revision: 210768 URL: http://svn.freebsd.org/changeset/base/210768 Log: The boot firmware appears to set to priority for thread 2 to low, and leave thread 1 at high priority, with the result that booting is fast but thread 2 is extraordinarily slow. Set thread 1's priority to low so that they match. Modified: user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Modified: user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Aug 2 13:40:53 2010 (r210767) +++ user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Aug 2 14:29:19 2010 (r210768) @@ -199,6 +199,12 @@ ps3_smp_start_cpu(platform_t plat, struc if (pc->pc_hwref != 1) return (ENXIO); + /* + * XXX: Set local thread priority to low, to match remote. + * XXX: Replace magic numbers with constants. + */ + mtspr(896, (mfspr(896) & 0xffffffff) | (0x1UL << 51)); + ap_pcpu = pc; *secondary_spin_sem = 1; powerpc_sync(); From owner-svn-src-user@FreeBSD.ORG Tue Aug 3 00:26:18 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50427106567D; Tue, 3 Aug 2010 00:26:18 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EB418FC0C; Tue, 3 Aug 2010 00:26:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o730QIeb081339; Tue, 3 Aug 2010 00:26:18 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o730QInV081334; Tue, 3 Aug 2010 00:26:18 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008030026.o730QInV081334@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 3 Aug 2010 00:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210785 - in user/nwhitehorn/ps3/powerpc: aim include powerpc ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 00:26:18 -0000 Author: nwhitehorn Date: Tue Aug 3 00:26:17 2010 New Revision: 210785 URL: http://svn.freebsd.org/changeset/base/210785 Log: Set up special registers on alternate Cell BE threads in a less hacky way, and tell the system about the features available on this CPU. SMP still works. Modified: user/nwhitehorn/ps3/powerpc/aim/mp_cpudep.c user/nwhitehorn/ps3/powerpc/include/spr.h user/nwhitehorn/ps3/powerpc/powerpc/cpu.c user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Modified: user/nwhitehorn/ps3/powerpc/aim/mp_cpudep.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/mp_cpudep.c Mon Aug 2 23:57:50 2010 (r210784) +++ user/nwhitehorn/ps3/powerpc/aim/mp_cpudep.c Tue Aug 3 00:26:17 2010 (r210785) @@ -228,6 +228,21 @@ cpudep_save_config(void *dummy) powerpc_sync(); break; +#ifdef __powerpc64__ + case IBMCELLBE: + if (mfmsr() & PSL_HV) { + bsp_state[0] = mfspr(SPR_HID0); + bsp_state[1] = mfspr(SPR_HID1); + bsp_state[2] = mfspr(SPR_HID4); + bsp_state[3] = mfspr(SPR_HID6); + + bsp_state[4] = mfspr(SPR_CELL_TSCR); + } + + bsp_state[5] = mfspr(SPR_CELL_TSRL); + + break; +#endif case MPC7450: case MPC7455: case MPC7457: @@ -288,6 +303,21 @@ cpudep_ap_setup() powerpc_sync(); break; +#ifdef __powerpc64__ + case IBMCELLBE: + if (mfmsr() & PSL_HV) { + mtspr(SPR_HID0, bsp_state[0]); + mtspr(SPR_HID1, bsp_state[1]); + mtspr(SPR_HID4, bsp_state[2]); + mtspr(SPR_HID6, bsp_state[3]); + + mtspr(SPR_CELL_TSCR, bsp_state[4]); + } + + mtspr(SPR_CELL_TSRL, bsp_state[5]); + + break; +#endif case MPC7450: case MPC7455: case MPC7457: Modified: user/nwhitehorn/ps3/powerpc/include/spr.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/include/spr.h Mon Aug 2 23:57:50 2010 (r210784) +++ user/nwhitehorn/ps3/powerpc/include/spr.h Tue Aug 3 00:26:17 2010 (r210785) @@ -420,6 +420,10 @@ #define SPR_HID1 0x3f1 /* ..8 Hardware Implementation Register 1 */ #define SPR_HID4 0x3f4 /* ..8 Hardware Implementation Register 4 */ #define SPR_HID5 0x3f6 /* ..8 Hardware Implementation Register 5 */ +#define SPR_HID6 0x3f9 /* ..8 Hardware Implementation Register 6 */ + +#define SPR_CELL_TSRL 0x380 /* ... Cell BE Thread Status Register */ +#define SPR_CELL_TSCR 0x399 /* ... Cell BE Thread Status Register */ #if defined(AIM) #define SPR_DBSR 0x3f0 /* 4.. Debug Status Register */ Modified: user/nwhitehorn/ps3/powerpc/powerpc/cpu.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/powerpc/cpu.c Mon Aug 2 23:57:50 2010 (r210784) +++ user/nwhitehorn/ps3/powerpc/powerpc/cpu.c Tue Aug 3 00:26:17 2010 (r210785) @@ -145,6 +145,9 @@ static const struct cputab models[] = { 0, cpu_e500_setup }, { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN, 0, cpu_e500_setup }, + { "IBM Cell Broadband Engine", IBMCELLBE, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + NULL}, { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, NULL }, }; Modified: user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Aug 2 23:57:50 2010 (r210784) +++ user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Tue Aug 3 00:26:17 2010 (r210785) @@ -199,12 +199,6 @@ ps3_smp_start_cpu(platform_t plat, struc if (pc->pc_hwref != 1) return (ENXIO); - /* - * XXX: Set local thread priority to low, to match remote. - * XXX: Replace magic numbers with constants. - */ - mtspr(896, (mfspr(896) & 0xffffffff) | (0x1UL << 51)); - ap_pcpu = pc; *secondary_spin_sem = 1; powerpc_sync(); From owner-svn-src-user@FreeBSD.ORG Tue Aug 3 22:41:16 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52F2E106567E; Tue, 3 Aug 2010 22:41:16 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4189B8FC13; Tue, 3 Aug 2010 22:41:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o73MfGpm082388; Tue, 3 Aug 2010 22:41:16 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o73MfGVr082386; Tue, 3 Aug 2010 22:41:16 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008032241.o73MfGVr082386@svn.freebsd.org> From: Doug Barton Date: Tue, 3 Aug 2010 22:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210830 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 22:41:16 -0000 Author: dougb Date: Tue Aug 3 22:41:15 2010 New Revision: 210830 URL: http://svn.freebsd.org/changeset/base/210830 Log: New Feature =========== Add the ability to skip the rebuild of the -r port by adding -R * In getopts() for -r assign the name of the parent port to a persistent variable (PM_RBP) so that we can use it later * In check_for_updates() use $PM_RBP to determine if the parent port is up to date * In post_first_pass() check for -R + -r, and test whether or not the parent port is up to date. If it, and all dependencies are up to date remove it from build_l and set a flag (PM_REQ_BY_SKIP_PARENT) for the main build routine. Either way, notify the user. * Move the routine (basically unchanged) for handling the dependent ports into a function, urb_final() so that it can be called both from the end of the script (where it used to be) and from the main build routine if the flag is set to skip the parent build * At the beginning of the main build routine call check_for_updates() to see if the parent is up to date * In the main build routine test for the skip-parent-build flag Other Fixes =========== 1. In parent_exit(): * Remove a now-redundant test for -r/-f * If INSTALLED_LIST has content but ilist does not, move it over so we can display the right information about work done * Add one line of whitespace between the last (potentially variable number) of PM_SU_VERBOSE messages and the summary of work 2. In post_first_pass() add PM_NO_CONFIRM to the unset list 3. In the main "after the first pass" code when processing the -r stuff add some more whitespace to the status messasges Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Aug 3 22:17:29 2010 (r210829) +++ user/dougb/portmaster/portmaster Tue Aug 3 22:41:15 2010 (r210830) @@ -139,8 +139,7 @@ parent_exit () { if [ -z "$TRAP" ]; then if [ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ]; then - [ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ] && - files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG` + files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG` if [ -n "$files" ]; then pm_sv Deleting \'install complete\' flags pm_find_s $pdb -type f -name PM_UPGRADE_DONE_FLAG -delete @@ -184,7 +183,11 @@ parent_exit () { elif [ -z "$show_list" ]; then case "$INSTALLED_LIST" in *\\n\\t*) show_list=all ;; - *\\n) show_list=one ;; + *\\n) show_list=one + if [ -z "$ilist" ]; then + ilist="${INSTALLED_LIST#\\t}" + ilist="${ilist%\\n}" + fi ;; esac fi if [ -n "$PM_LOG" ]; then @@ -202,6 +205,7 @@ parent_exit () { fi date >> $PM_LOG fi + [ -n "$PM_SU_VERBOSE" ] && echo '' case "$show_list" in all) echo "===>>> The following actions were performed:" echo -e $INSTALLED_LIST @@ -1300,7 +1304,8 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop 2) fail 'The argument to -r must match only one port' ;; esac fi - portdir=`origin_from_pdb ${glob_dirs##*/}` ; unset glob_dirs ;; + PM_RBP=${glob_dirs##*/} ; unset glob_dirs + portdir=`origin_from_pdb $PM_RBP` ;; s) CLEAN_STALE=sopt ;; t) RECURSE_THOROUGH=topt; ARGS="-t $ARGS" ;; u) fail 'The -u option has been deprecated' ;; @@ -1501,6 +1506,9 @@ check_for_updates () { unset moved_npd fi return 0 + elif [ "$PM_RBP" = "$iport" ]; then + PM_RBP_NEEDS_UPGRADE=pm_rbp_needs_upgrade + return 0 fi # No need for check_exclude here because it is already @@ -2414,6 +2422,17 @@ create_master_rb_list () { post_first_pass () { local action + if [ -n "$UPDATE_REQ_BYS" -a -n "$RESTART" ]; then + if [ -z "$NO_DEP_UPDATES" -o -n "$PM_RBP_NEEDS_UPGRADE" ]; then + echo "===>>> $PM_RBP and/or dependencies are out of date, forcing rebuild" + else + echo "===>>> $PM_RBP is up to date, skipping rebuild due to -R flag" + PM_REQ_BY_SKIP_PARENT=pm_req_by_skip_parent + build_l="${build_l#*\\n}" + fi + echo '' + fi + if [ $num_of_deps -gt 0 ]; then term_printf " (${num_of_deps})" @@ -2448,7 +2467,7 @@ echo " all of the above try adding echo "===>>> Starting $action for $* <<<===" echo '' - unset PM_FP_SEEN_LIST PM_FIRST_PASS + unset PM_FP_SEEN_LIST PM_FIRST_PASS PM_NO_CONFIRM dep_of_deps=0 @@ -2596,6 +2615,45 @@ make_config () { pm_make_s $config_type } +urb_final () { + # Global: URB_YES + + local req_by + + export URB_YES=urb_yes_final + echo "===>>> Updating ports that depend on $new_port" + echo '' + create_master_rb_list + for req_by in $MASTER_RB_LIST; do + # Probably not needed, but JIC + [ -d "$pdb/$req_by" ] || continue + + case "$URB_DONE_LIST" in + *:${req_by}:*) already_done $req_by ; continue ;; + esac + + # Check here since if "no" it will not prompt + check_interactive $req_by || continue + + [ -n "$PM_VERBOSE" ] && + echo "===>>> $new_port is required by $req_by" + check_exclude $req_by || continue + + # Shortcut, since check_for will force it + if [ -z "$RESTART" -a -z "$PM_FORCE" ]; then + update_port $req_by + else + check_for_updates $req_by || fail 'Update failed' + fi + echo "===>>> Returning to check of ports depending on $upg_port" + done + echo '' + echo "===>>> Done updating ports that depend on $new_port" + echo '' + + safe_exit +} + #=============== End functions for main =============== # INIT Parent @@ -2950,6 +3008,8 @@ fi if [ -n "$PM_FIRST_PASS" -a "$$" -eq "$PM_PARENT_PID" ]; then if [ -n "$upg_port" ]; then update_build_l $upg_port + [ -n "$UPDATE_REQ_BYS" -a -n "$RESTART" ] && + check_for_updates $upg_port else update_build_l $portdir fi @@ -3065,6 +3125,7 @@ if [ -n "$PM_FIRST_PASS" ]; then safe_exit elif [ -n "$UPDATE_REQ_BYS" ]; then export URB_YES=urb_yes + echo '' echo "===>>> Checking ports that depend on $upg_port" echo '' create_master_rb_list @@ -3093,7 +3154,7 @@ if [ -n "$PM_FIRST_PASS" ]; then fi echo "===>>> Returning to check of ports depending on $upg_port" done - + echo '' echo "===>>> Done checking ports that depend on $upg_port" echo '' unset URB_YES MASTER_RB_LIST ; URB_DONE_LIST=':' @@ -3128,7 +3189,6 @@ if [ -z "$NO_DEP_UPDATES" ]; then dependency_check all-depends-list fi [ -z "$PM_INDEX_ONLY" ] && pm_cd_pd $portdir -# elif [ "$$" -eq "$PM_PARENT_PID" ]; then echo "===>>> All dependencies are up to date" echo '' @@ -3148,6 +3208,8 @@ if [ -z "$new_port" ]; then fi fi +[ -n "$PM_REQ_BY_SKIP_PARENT" ] && urb_final + if [ -n "$PM_PACKAGES" -o "$PM_PACKAGES_BUILD" = doing_build_only_dep ]; then fetch_package () { local do_fetch @@ -3670,37 +3732,7 @@ if [ -z "$DONT_SCRUB_DISTFILES" ]; then fi fi -if [ -n "$UPDATE_REQ_BYS" -a -s "$pdb/$new_port/+REQUIRED_BY" ]; then - export URB_YES=urb_yes2 - echo "===>>> Updating ports that depend on $new_port" - echo '' - create_master_rb_list - for req_by in $MASTER_RB_LIST; do - # Probably not needed, but JIC - [ -d "$pdb/$req_by" ] || continue - - case "$URB_DONE_LIST" in - *:${req_by}:*) already_done $req_by ; continue ;; - esac - - # Check here since if "no" it will not prompt - check_interactive $req_by || continue - - [ -n "$PM_VERBOSE" ] && - echo "===>>> $new_port is required by $req_by" - check_exclude $req_by || continue - - # Shortcut, since check_for will force it - if [ -z "$RESTART" -a -z "$PM_FORCE" ]; then - update_port $req_by - else - check_for_updates $req_by || fail 'Update failed' - fi - echo "===>>> Returning to check of ports depending on $upg_port" - done - echo "===>>> Done updating ports that depend on $new_port" - echo '' -fi +[ -n "$UPDATE_REQ_BYS" -a -s "$pdb/$new_port/+REQUIRED_BY" ] && urb_final safe_exit From owner-svn-src-user@FreeBSD.ORG Tue Aug 3 22:59:02 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB6D8106567A; Tue, 3 Aug 2010 22:59:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F6FE8FC13; Tue, 3 Aug 2010 22:59:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o73Mx2H4086426; Tue, 3 Aug 2010 22:59:02 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o73Mx2Yo086424; Tue, 3 Aug 2010 22:59:02 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008032259.o73Mx2Yo086424@svn.freebsd.org> From: Doug Barton Date: Tue, 3 Aug 2010 22:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210831 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 22:59:02 -0000 Author: dougb Date: Tue Aug 3 22:59:02 2010 New Revision: 210831 URL: http://svn.freebsd.org/changeset/base/210831 Log: Step 1 of the code whitespace overhaul, realign the code related to the -G revamp, and remove the placeholders Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Aug 3 22:41:15 2010 (r210830) +++ user/dougb/portmaster/portmaster Tue Aug 3 22:59:02 2010 (r210831) @@ -2120,23 +2120,19 @@ update_build_l () { } update_port () { - local update_to + local update_to deps [ -n "$2" ] && update_to=" to $2" echo "===>>> Launching child to update ${1#$pd/}${update_to}" -# - local deps - - dep_of_deps=$(( $dep_of_deps + 1 )) + dep_of_deps=$(( $dep_of_deps + 1 )) - if [ -n "$PM_FIRST_PASS" ]; then - num_of_deps=$(( $num_of_deps + 1 )) - update_build_l $1 - fi + if [ -n "$PM_FIRST_PASS" ]; then + num_of_deps=$(( $num_of_deps + 1 )) + update_build_l $1 + fi - deps=" (${dep_of_deps}/${num_of_deps})" -# + deps=" (${dep_of_deps}/${num_of_deps})" if [ -n "$PM_DEPTH" ]; then echo " ${PM_DEPTH}>> ${1#$pd/}" @@ -2246,8 +2242,6 @@ dependency_check () { else if [ -n "$SHOW_WORK" ]; then echo '' -# -# elif [ -z "$PM_VERBOSE" ]; then echo "===>>> Starting dependency check" fi @@ -2394,10 +2388,8 @@ dependency_check () { case "$PM_DEPTH" in *\>\>*) echo " $PM_DEPTH" ;; *) if [ "$PM_PARENT_PORT" = All ]; then -# - local deps - deps=" (${dep_of_deps}/${num_of_deps})" -# + local deps + deps=" (${dep_of_deps}/${num_of_deps})" term_printf " >> ${upg_port:-$portdir}${deps}" else term_printf @@ -2709,19 +2701,17 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S fi fi -# - PM_FP_SEEN_LIST=':' ; PM_FIRST_PASS=pm_first_pass - NO_DEP_UPDATES=no_dep_updates ; build_l='' - export PM_FP_SEEN_LIST PM_FIRST_PASS NO_DEP_UPDATES build_l + PM_FP_SEEN_LIST=':' ; PM_FIRST_PASS=pm_first_pass + NO_DEP_UPDATES=no_dep_updates ; build_l='' + export PM_FP_SEEN_LIST PM_FIRST_PASS NO_DEP_UPDATES build_l - if [ -n "$PM_BUILD_ONLY_LIST" ]; then - run_dl_g='' ; build_only_dl_g='' ; rundep_list='' - export run_dl_g build_only_dl_g rundep_list - fi - if [ -n "$PM_DEL_BUILD_ONLY" ]; then - build_deps_il='' ; export build_deps_il - fi -# + if [ -n "$PM_BUILD_ONLY_LIST" ]; then + run_dl_g='' ; build_only_dl_g='' ; rundep_list='' + export run_dl_g build_only_dl_g rundep_list + fi + if [ -n "$PM_DEL_BUILD_ONLY" ]; then + build_deps_il='' ; export build_deps_il + fi [ -z "$NO_BACKUP" ] && init_packages [ -z "$NO_BACKUP" -a -z "$BACKUP" ] && export NB_DELETE @@ -2844,15 +2834,10 @@ all_first_pass () { continue fi -# - check_interactive $iport || continue - # We got here, so we know we have to build it - update_port $iport -# -# -# -# -# + check_interactive $iport || continue + + # We got here, so we know we have to build it + update_port $iport done echo "===>>> Update check of installed ports complete" ; echo '' @@ -2982,7 +2967,6 @@ if [ -e "$pdb/$upg_port/+IGNOREME" ]; th fi ;; esac -# elif [ -n "$URB_YES" ]; then echo '' echo "===>>> $upg_port has an +IGNOREME file, ignoring" From owner-svn-src-user@FreeBSD.ORG Tue Aug 3 23:11:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED72F1065670; Tue, 3 Aug 2010 23:11:23 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC6758FC21; Tue, 3 Aug 2010 23:11:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o73NBNOT089273; Tue, 3 Aug 2010 23:11:23 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o73NBN0X089271; Tue, 3 Aug 2010 23:11:23 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008032311.o73NBN0X089271@svn.freebsd.org> From: Doug Barton Date: Tue, 3 Aug 2010 23:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210832 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 23:11:24 -0000 Author: dougb Date: Tue Aug 3 23:11:23 2010 New Revision: 210832 URL: http://svn.freebsd.org/changeset/base/210832 Log: Step 2 of the internal whitespace updates. The gyrations necessary for keeping the code in an 80 column window are no longer worth the effort so move all of the "Outdent" code in line Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Aug 3 22:59:02 2010 (r210831) +++ user/dougb/portmaster/portmaster Tue Aug 3 23:11:23 2010 (r210832) @@ -703,12 +703,11 @@ check_dependency_files () { if [ -s "$pdb/$iport/+REQUIRED_BY" ]; then # No actual dependencies exist, so this file is stale # Zero it out so that -s mode can find it -# Outdent -if [ -n "$PM_VERBOSE" -o -n "$CHECK_DEPENDS" ]; then - echo " ===>>> No installed ports depend on $iport" - echo " ===>>> Emptying +REQUIRED_BY file. Try ${0##*/} -s" -fi -# Outdent + if [ -n "$PM_VERBOSE" -o -n "$CHECK_DEPENDS" ]; then + echo " ===>>> No installed ports depend on $iport" + echo " ===>>> Emptying +REQUIRED_BY file. Try ${0##*/} -s" + fi + check_regular_file $pdb/$iport/+REQUIRED_BY $PM_SU_CMD truncate -s0 $pdb/$iport/+REQUIRED_BY fi @@ -1467,15 +1466,13 @@ check_for_updates () { check_restart_and_udf $udf $iport || do_update=do_update_force elif [ -n "$URB_YES" ]; then - # Outdent - case "$MASTER_RB_LIST" in *" $iport "*) - if ! check_restart_and_udf $udf $iport; then - do_update=do_update_urb - else - URB_DONE_LIST="${URB_DONE_LIST}${upg_port}:" - fi ;; - esac - # Outdent + case "$MASTER_RB_LIST" in *" $iport "*) + if ! check_restart_and_udf $udf $iport; then + do_update=do_update_urb + else + URB_DONE_LIST="${URB_DONE_LIST}${upg_port}:" + fi ;; + esac elif [ -n "$PM_MULTI_PORTS" ]; then case "$PM_MULTI_PORTS" in *:${iport}:*) do_update=do_update_mi ;; @@ -1794,15 +1791,15 @@ delete_all_distfiles () { echo '' if [ -n "$dist_list_files" ]; then local answer f - # Outdent - if [ -z "$ALWAYS_SCRUB_DISTFILES" ]; then - echo "===>>> However, the list of files in $dist_list" - echo -n " should be current. Delete the files on this list? y/n [n] " - read answer - else - answer=y - fi - # Outdent + + if [ -z "$ALWAYS_SCRUB_DISTFILES" ]; then + echo "===>>> However, the list of files in $dist_list" + echo -n " should be current. Delete the files on this list? y/n [n] " + read answer + else + answer=y + fi + case "$answer" in [yY]) for f in $dist_list_files; do if [ -f "${DISTDIR}${f}" ]; then @@ -2681,23 +2678,21 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S [ -n "$UPDATE_REQ_BYS" ] && export URB_DONE_LIST=':' if [ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ]; then if [ -z "$RESTART" ]; then - # Outdent - files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG` - if [ -n "$files" ]; then - echo "===>>> There are 'install complete' flags from a previous" - echo -n " -[rf] run of ${0##*/}, delete them? y/n [n] " - read answer - case "$answer" in - [yY]) pm_sv Deleting \'install complete\' flags - pm_find_s $pdb -type f -name PM_UPGRADE_DONE_FLAG -delete ;; - *) echo -n "===>>> Enable the -R option? y/n [n] " - read answer - case "$answer" in - [yY]) RESTART=Ropt ; ARGS="-R $ARGS" ;; - esac ;; - esac - fi - # Outdent + files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG` + if [ -n "$files" ]; then + echo "===>>> There are 'install complete' flags from a previous" + echo -n " -[rf] run of ${0##*/}, delete them? y/n [n] " + read answer + case "$answer" in + [yY]) pm_sv Deleting \'install complete\' flags + pm_find_s $pdb -type f -name PM_UPGRADE_DONE_FLAG -delete ;; + *) echo -n "===>>> Enable the -R option? y/n [n] " + read answer + case "$answer" in + [yY]) RESTART=Ropt ; ARGS="-R $ARGS" ;; + esac ;; + esac + fi fi fi @@ -2947,15 +2942,13 @@ if [ -e "$pdb/$upg_port/+IGNOREME" ]; th case "$answer" in [yY]) ;; # Let it build *) CUR_DEPS="${CUR_DEPS}${upg_port}:${portdir}:" - # Outdent - if [ $dep_of_deps -gt 0 ]; then - dep_of_deps=$(( $dep_of_deps - 1 )) - if [ -n "$PM_FIRST_PASS" ]; then - num_of_deps=$(( $num_of_deps - 1 )) - build_l="${build_l%\\t*}" - fi - fi - # Outdent + if [ $dep_of_deps -gt 0 ]; then + dep_of_deps=$(( $dep_of_deps - 1 )) + if [ -n "$PM_FIRST_PASS" ]; then + num_of_deps=$(( $num_of_deps - 1 )) + build_l="${build_l%\\t*}" + fi + fi safe_exit ;; esac else From owner-svn-src-user@FreeBSD.ORG Thu Aug 5 22:25:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55CE61065672; Thu, 5 Aug 2010 22:25:10 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 441B68FC14; Thu, 5 Aug 2010 22:25:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o75MPAX1023714; Thu, 5 Aug 2010 22:25:10 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o75MPA2F023712; Thu, 5 Aug 2010 22:25:10 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008052225.o75MPA2F023712@svn.freebsd.org> From: Doug Barton Date: Thu, 5 Aug 2010 22:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210903 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2010 22:25:10 -0000 Author: dougb Date: Thu Aug 5 22:25:09 2010 New Revision: 210903 URL: http://svn.freebsd.org/changeset/base/210903 Log: Step 3 of the code whitespace cleanup: * Use a general rule of 100 columns to decide whether or not to unwrap some long lines (such as &&, ||, and | continued to the next line) but don't hesitate to line up really long messages to the users with their corresponding code * Begin applying a more consistent style to if/test/then blocks * Move the ;; for all case statements up to the line they terminate * Add comments to the fi at the end of some really long if's * Properly indent some older blocks that were wrapped in if [ $PACKAGES ]; then ... fi when package support was added Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Thu Aug 5 22:04:07 2010 (r210902) +++ user/dougb/portmaster/portmaster Thu Aug 5 22:25:09 2010 (r210903) @@ -57,8 +57,7 @@ version () { cvs="${cvs#*,v }" ; cvs="${cvs#*/portmaster }" ; cvs="${cvs%% *}" echo '' - [ "${cvs#$}" != 'FreeBSD$' ] && - { echo "===>>> Version $cvs" ; return 0; } + [ "${cvs#$}" != 'FreeBSD$' ] && { echo "===>>> Version $cvs" ; return 0; } echo "===>>> Version unknown!" } @@ -116,15 +115,13 @@ kill_bad_children () { *" $0 "*) pm_kill $pid ;; *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill -9 $pid ;; - esac - ;; + esac ;; *) [ $pgid -eq $mypgid ] || continue case "$command" in *" $0 "*) [ $pid -ne $PM_PARENT_PID ] && pm_kill $pid ;; *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill $pid ;; - esac - ;; + esac ;; esac done } @@ -173,8 +170,7 @@ parent_exit () { ( for f in $DISPLAY_LIST; do echo "===>>> pkg-message for $f" ; cat $pdb/$f/+DISPLAY ; echo '' done - echo "===>>> Done displaying pkg-message files" ; echo '' ) | $PAGER - ;; + echo "===>>> Done displaying pkg-message files" ; echo '' ) | $PAGER ;; esac if [ -n "$INSTALLED_LIST" ]; then @@ -240,7 +236,7 @@ safe_exit () { echo "INSTALLED_LIST='$INSTALLED_LIST'" >> $IPC_SAVE [ -n "$PM_DEL_BUILD_ONLY" ] && - echo "build_deps_il='$build_deps_il'" >> $IPC_SAVE + echo "build_deps_il='$build_deps_il'" >> $IPC_SAVE else # Do these here so +IGNOREME can modify them echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE @@ -257,8 +253,7 @@ safe_exit () { echo "INTERACTIVE_YES='$INTERACTIVE_YES'" >> $IPC_SAVE echo "INTERACTIVE_NO='$INTERACTIVE_NO'" >> $IPC_SAVE fi - [ -n "$URB_YES" ] && - echo "URB_DONE_LIST='$URB_DONE_LIST'" >> $IPC_SAVE + [ -n "$URB_YES" ] && echo "URB_DONE_LIST='$URB_DONE_LIST'" >> $IPC_SAVE fi exit ${1:-0} @@ -427,15 +422,14 @@ pm_sv () { [ -n "$PM_SU_VERB packages_init () { local e1 e2 e3 -e1="The -P/--packages and -PP/--packages-only options are mutually exclusive" -e2="The --packages-build option and the -P[P] options are mutually exclusive" -e3="The --packages-if-newer and -PP/--packages-only options are mutually exclusive" + e1="The -P/--packages and -PP/--packages-only options are mutually exclusive" + e2="The --packages-build option and the -P[P] options are mutually exclusive" + e3="The --packages-if-newer and -PP/--packages-only options are mutually exclusive" case "$1" in first) [ "$PM_PACKAGES" = only ] && fail $e1 [ -n "$PM_PACKAGES_BUILD" ] && fail $e2 - [ -z "$PM_PACKAGES" ] && { - PM_PACKAGES=first ; export PM_PACKAGES; } ;; + [ -z "$PM_PACKAGES" ] && { PM_PACKAGES=first ; export PM_PACKAGES; } ;; only) [ "$PM_PACKAGES" = first ] && fail $e1 [ "$PM_PACKAGES" = newer ] && fail $e3 [ -n "$PM_PACKAGES_BUILD" ] && fail $e2 ;; @@ -451,7 +445,7 @@ e3="The --packages-if-newer and -PP/--pa cross_idx () { local e1 -e1='The --index, --index-first, and --index-only options are mutually exclusive' + e1='The --index, --index-first, and --index-only options are mutually exclusive' case "$1" in index) [ -n "$PM_INDEX_FIRST" -o -n "$PM_INDEX_ONLY" ] && fail $e1 ;; @@ -528,7 +522,7 @@ unset var if [ "$$" -eq "$PM_PARENT_PID" ]; then if [ -n "$PM_PACKAGES" -o -n "$PM_PACKAGES_BUILD" ]; then [ `/sbin/sysctl -n kern.osreldate 2>/dev/null` -lt 600400 ] && - fail Package installation support requires FreeBSD 6.4 or newer + fail Package installation support requires FreeBSD 6.4 or newer fi if [ -z "$pd" ]; then @@ -697,7 +691,7 @@ check_dependency_files () { # Always rely on the grep'ed dependencies instead of +REQUIRED_BY grep_deps=`pm_mktemp grep-deps-${iport}` egrep -l "DEPORIGIN:($origin|$ro_opd)$" $pdb/*/+CONTENTS | - strip_to_iport | sort -u > $grep_deps + strip_to_iport | sort -u > $grep_deps if [ ! -s "$grep_deps" ]; then if [ -s "$pdb/$iport/+REQUIRED_BY" ]; then @@ -748,19 +742,19 @@ IFS=' if [ -n "$d_iport" ]; then [ -n "$PM_VERBOSE" -o -n "$CHECK_DEPENDS" ] && - echo " ===>>> Updating @pkgdep for $d_origin" + echo " ===>>> Updating @pkgdep for $d_origin" else - echo " ===>>> $d_origin is listed as a dependency" - echo " ===>>> but there is no installed version" - echo '' + echo " ===>>> $d_origin is listed as a dependency" + echo " ===>>> but there is no installed version" + echo '' if [ -n "$CHECK_DEPENDS" ]; then - echo -n " ===>>> Delete this dependency data? y/n [n] " + echo -n " ===>>> Delete this dependency data? y/n [n] " read answer case "$answer" in [yY]) unset prev_line line ; echo '' ; continue ;; esac else - echo " ===>>> Try ${0##*/} --check-depends" + echo " ===>>> Try ${0##*/} --check-depends" echo '' fi fi @@ -781,14 +775,12 @@ IFS=' o_seen="${o_seen}${d_origin}:" echo "@pkgdep $n_port" >> $new_cont - echo "@comment DEPORIGIN:$origin" >> $new_cont - ;; + echo "@comment DEPORIGIN:$origin" >> $new_cont ;; '@comment DEPORIGIN:'*) d_origin=${line#*DEPORIGIN:} case "$o_seen" in *:${d_origin}:*) unset prev_line line ; continue ;; esac - o_seen="${o_seen}${d_origin}:" - ;; + o_seen="${o_seen}${d_origin}:" ;; '@pkgdep '|@pkgdep) d_missing=d_missing ;; @pkgdep*) d_iport="${line#@pkgdep }" [ -d "$pdb/$d_iport" ] || d_missing=dm2 ;; @@ -832,17 +824,15 @@ find_moved_port () { else reason=${l##*|} [ "$3" != 'nonfatal' ] && - fail "The $sf port has been deleted: $reason" - fi - ;; + fail "The $sf port has been deleted: $reason" + fi ;; ${sf}\|*) moved_npd=${l#*\|} # New port directory moved_npd=${moved_npd%%\|*} echo '' echo " ===>>> The $sf port moved to $moved_npd" echo " ===>>> Reason: ${l##*|}" echo '' - find_moved_port $moved_npd - ;; + find_moved_port $moved_npd ;; esac done @@ -1244,8 +1234,7 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then case "$answer" in [yY]) pm_rm_s -rf $dir ;; esac - echo '' - ;; + echo '' ;; esac done exit 0 @@ -1288,8 +1277,7 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop i) INTERACTIVE_UPDATE=iopt; ARGS="-i $ARGS" ;; l) LIST=lopt ;; m) export PM_MAKE_ARGS=$OPTARG # For 'make checksum' - ARGS="-m $PM_MAKE_ARGS $ARGS" - ;; + ARGS="-m $PM_MAKE_ARGS $ARGS" ;; n) NO_ACTION=nopt; ARGS="-n $ARGS" ;; o) REPLACE_ORIGIN=oopt ;; p) fail 'The -p option has been deprecated' ;; @@ -1650,8 +1638,7 @@ find_and_delete_distfiles () { case "$file" in *\*) [ "$pattern" = "${pattern%[_-]*}" ] && return 0 # This will happen for files like foo-bar_baz-1.23 - find_and_delete_distfiles $pattern - ;; + find_and_delete_distfiles $pattern ;; esac case "$distfiles_checked" in *:${file}:*) continue ;; esac @@ -1661,15 +1648,13 @@ find_and_delete_distfiles () { *" ${file} "*) distfiles_checked="${distfiles_checked}${file}:" [ -n "$PM_VERBOSE" ] && - echo "===>>> Keeping current distfile: $file" - continue # Do not delete current version - ;; + echo "===>>> Keeping current distfile: $file" + continue ;; # Do not delete current version *) if [ -e "$DI_FILES" ]; then grep -ql ${ps}$file $DI_FILES && continue fi - if [ -n "$ALWAYS_SCRUB_DISTFILES" -o \ - -n "$delete_all" ]; then + if [ -n "$ALWAYS_SCRUB_DISTFILES" -o -n "$delete_all" ]; then echo "===>>> Deleting stale distfile: $file" pm_unlink $file continue @@ -1680,8 +1665,7 @@ find_and_delete_distfiles () { case "$answer" in [yY]) pm_unlink $file ;; *) distfiles_checked="${distfiles_checked}${file}:" ;; - esac - ;; + esac ;; esac done } @@ -1719,7 +1703,7 @@ set_distfiles_and_subdir () { echo "===>>> $port_subdir does not exist, therefore we" echo ' will assume that all relevant distfiles are gone.' echo '' - echo " Try ${0##*/} --clean-distfiles[-all] for a full cleanup" + echo " Try ${0##*/} --clean-distfiles[-all] for a full cleanup" echo '' return 3 fi @@ -1743,13 +1727,11 @@ delete_stale_distfiles () { *" ${file} "*) distfiles_checked="${distfiles_checked}${file}:" [ -n "$PM_VERBOSE" ] && - echo "===>>> Keeping current distfile: $file" - continue # Do not delete current version - ;; + echo "===>>> Keeping current distfile: $file" + continue ;; # Do not delete current version esac - if [ -n "$ALWAYS_SCRUB_DISTFILES" -o \ - -n "$delete_all" ]; then + if [ -n "$ALWAYS_SCRUB_DISTFILES" -o -n "$delete_all" ]; then echo "===>>> Deleting stale distfile: $file" pm_unlink $file continue @@ -1787,7 +1769,7 @@ delete_all_distfiles () { case "$rc" in 1) echo '' echo "===>>> No $pd/$origin exists to find the distfile list" - echo " Try ${0##*/} --clean-distfiles[-all] for a full cleanup" + echo " Try ${0##*/} --clean-distfiles[-all] for a full cleanup" echo '' if [ -n "$dist_list_files" ]; then local answer f @@ -1803,7 +1785,7 @@ delete_all_distfiles () { case "$answer" in [yY]) for f in $dist_list_files; do if [ -f "${DISTDIR}${f}" ]; then - echo " Deleting ${DISTDIR}${f}" + echo " Deleting ${DISTDIR}${f}" pm_unlink ${DISTDIR}${f} fi done ;; @@ -1968,15 +1950,13 @@ if [ -n "$CLEAN_STALE" ]; then echo "===>>> Running pkg_delete -f $iport" pm_pkg_delete_s -f $iport || fail 'pkg_delete failed' - exec $0 -s $ARGS - ;; + exec $0 -s $ARGS ;; *) echo -n " ===>>> Keep listing $iport as a dependency? y/n [n] " read answer case "$answer" in [yY]) no_del_list="${no_del_list}${iport}:" ;; *) pm_unlink_s $file ;; - esac - ;; + esac ;; esac done exit 0 @@ -2140,16 +2120,14 @@ update_port () { fi fi - [ -n "$doing_dep_check" -o \ - \( -n "$UPDATE_ALL" -a -n "$PM_FIRST_PASS" \) ] && + [ -n "$doing_dep_check" -o \( -n "$UPDATE_ALL" -a -n "$PM_FIRST_PASS" \) ] && unset NO_DEP_UPDATES if [ -z "$NO_ACTION" -o -n "$PM_FIRST_PASS" ]; then ($0 $ARGS $1) || fail "Update for $1 failed" . $IPC_SAVE else - [ -n "$PM_VERBOSE" ] && - echo "===>>> Build canceled due to -n flag" + [ -n "$PM_VERBOSE" ] && echo "===>>> Build canceled due to -n flag" fi if [ -n "$UPDATE_ALL" ]; then @@ -2297,12 +2275,11 @@ dependency_check () { fi [ -n "$PM_VERBOSE" ] && - echo "===>>> Checking dependency: $origin" + echo "===>>> Checking dependency: $origin" # Do this first to catch out of date dependencies - if [ -n "$PM_FIRST_PASS" ]; then - case "$PM_FP_SEEN_LIST" in *:${origin}:*) continue ;; esac - fi + [ -n "$PM_FIRST_PASS" ] && + case "$PM_FP_SEEN_LIST" in *:${origin}:*) continue ;; esac [ -z "$URB_YES" ] && case "$CUR_DEPS" in *:${origin}:*) continue ;; esac @@ -2357,8 +2334,8 @@ dependency_check () { if ! check_restart_and_udf $udf $iport; then update_port $iport else - CUR_DEPS="${CUR_DEPS}${iport}:${origin}:" - URB_DONE_LIST="${URB_DONE_LIST}${upg_port}:" + CUR_DEPS="${CUR_DEPS}${iport}:${origin}:" + URB_DONE_LIST="${URB_DONE_LIST}${upg_port}:" fi continue ;; esac @@ -2378,7 +2355,7 @@ dependency_check () { if [ -n "$SHOW_WORK" ]; then safe_exit elif [ -n "$PM_FIRST_PASS" -a -z "$PM_PACKAGES" ]; then - echo "===>>> Initial dependency check complete for $portdir" + echo "===>>> Initial dependency check complete for $portdir" case "$PM_DEPTH" in *\>\>*) echo " $PM_DEPTH" ;; esac else echo "===>>> Dependency check complete for $portdir" @@ -2429,14 +2406,14 @@ post_first_pass () { local answer echo '' -echo "===>>> The following actions will be taken if you choose to proceed:" + echo "===>>> The following actions will be taken if you choose to proceed:" echo -e "$build_l" echo -n "===>>> Proceed? y/n [y] " read answer case "$answer" in [nN]*) echo '' -echo "===>>> If you would like to upgrade or install some, but not" -echo " all of the above try adding '-i' to the command line." + echo "===>>> If you would like to upgrade or install some, but not" + echo " all of the above try adding '-i' to the command line." safe_exit ;; esac unset build_l @@ -2555,7 +2532,7 @@ multiport () { case "$port" in */*) run_dl_g="$run_dl_g ${pd}/${port} " ;; *) - run_dl_g="$run_dl_g ${pd}/`origin_from_pdb $port` " ;; + run_dl_g="$run_dl_g ${pd}/`origin_from_pdb $port` " ;; esac done fi @@ -2720,14 +2697,10 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S fi # Set the file name here so it's visible to the children - if [ -z "$DONT_SCRUB_DISTFILES" -a -z "$FETCH_ONLY" \ - -a -z "$PM_PACKAGES" ]; then + [ -z "$DONT_SCRUB_DISTFILES" -a -z "$FETCH_ONLY" -a -z "$PM_PACKAGES" ] && export DI_FILES=`pm_mktemp DI-FILES` - fi - if [ $# -gt 1 -a -z "$REPLACE_ORIGIN" ]; then - multiport $@ - fi + [ $# -gt 1 -a -z "$REPLACE_ORIGIN" ] && multiport $@ elif [ -z "$SHOW_WORK" ]; then # Zero out this file so that we can save our data to it safely > $IPC_SAVE @@ -2759,8 +2732,7 @@ all_first_pass () { case "$PM_FP_SEEN_LIST" in *:${origin}:*) continue ;; esac - [ -n "$PM_BUILD_ONLY_LIST" ] && - run_dl_g="$run_dl_g ${pd}/${origin} " + [ -n "$PM_BUILD_ONLY_LIST" ] && run_dl_g="$run_dl_g ${pd}/${origin} " check_exclude $iport || continue @@ -2777,23 +2749,21 @@ all_first_pass () { ports_by_category echo "===>>> Starting check of installed ports for available updates" - [ -n "$PM_BUILD_ONLY_LIST" ] && - PM_BUILD_ONLY_LIST=pmp_doing_build_deps + [ -n "$PM_BUILD_ONLY_LIST" ] && PM_BUILD_ONLY_LIST=pmp_doing_build_deps if [ -n "$PM_FIRST_PASS" ]; then [ -n "$FETCH_ONLY" ] && export ALL_FETCH=all_fetch - [ -n "$PM_VERBOSE" ] && - { echo '' ; echo "===>>> Root ports:"; } + [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Root ports:"; } all_first_pass $roots - [ -n "$PM_VERBOSE" ] && - { echo '' ; echo "===>>> Trunk ports:"; } + + [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Trunk ports:"; } all_first_pass $trunks - [ -n "$PM_VERBOSE" ] && - { echo '' ; echo "===>>> Branch ports:"; } + + [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Branch ports:"; } all_first_pass $branches - [ -n "$PM_VERBOSE" ] && - { echo '' ; echo "===>>> Leaf ports:"; } + + [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Leaf ports:"; } all_first_pass $leaves check_fetch_only @@ -2924,8 +2894,7 @@ if [ ! -d "$pd/$portdir" -a -z "$PM_INDE [ "$$" -eq "$PM_PARENT_PID" ] && parent_exit exec $0 $ARGS -o $moved_npd $upg_port fi -[ -z "$upg_port" -a -z "$REPLACE_ORIGIN" ] && - upg_port=`iport_from_origin ${portdir}` +[ -z "$upg_port" -a -z "$REPLACE_ORIGIN" ] && upg_port=`iport_from_origin ${portdir}` if [ -e "$pdb/$upg_port/+IGNOREME" ]; then # Adding to CUR_DEPS means we will not get here in the build unless -G @@ -2953,12 +2922,11 @@ if [ -e "$pdb/$upg_port/+IGNOREME" ]; th esac else echo '' - echo "===>>> $upg_port has an +IGNOREME file, ignoring" + echo "===>>> $upg_port has an +IGNOREME file, ignoring" echo '' CUR_DEPS="${CUR_DEPS}${upg_port}:${portdir}:" safe_exit - fi - ;; + fi ;; esac elif [ -n "$URB_YES" ]; then echo '' @@ -2997,76 +2965,74 @@ echo '' echo "===>>> Currently installed version: $upg_port" if [ -z "$PM_INDEX_ONLY" ]; then -echo "===>>> Port directory: $pd/$portdir" - -check_state || { - echo " ===>>> If you are sure you can build it, remove the"; - echo " $state line in the Makefile and try again."; - safe_exit 1; } - -# Do not start this in the background until we are sure we are going to build -[ "$$" -eq "$PM_PARENT_PID" -a -n "$DI_FILES" ] && { - echo ''; (read_distinfos)& } - -# Do these things first time through -if [ -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ]; then -dofetch () { - local fetchlog allfiles - - echo "===>>> Launching 'make checksum' for $portdir in background" - fetchlog=`pm_mktemp fetchlog-${portdir#*/}` - (pm_make -DBATCH checksum >> $fetchlog 2>&1 && { - rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.*; exit 0; } - allfiles=`pm_make -V ALLFILES` - pm_make delete-distfiles RESTRICTED_FILES="${allfiles}" \ - >> $fetchlog 2>&1 && - echo "===>>> RE-STARTING FETCH <<<===" >> $fetchlog - pm_make -DBATCH checksum >> $fetchlog 2>&1; \ - rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.* )& -} - - # Handle the problem of manual fetching - [ -z "$PM_PACKAGES" ] && master_sites=`pm_make_b -V MASTER_SITES` - - if [ -n "$master_sites" ]; then - # PATCHFILES may get added after the first pass, but we want to - # do as much of this as we can, as early as we can, and - # patch files are usually small anyway. - distfiles=`pm_make -V ALLFILES | sed -e 's# *$##g'` - [ -n "$distfiles" ] && distfiles=" ${distfiles} " + echo "===>>> Port directory: $pd/$portdir" - # Make sure that different ports using the same distfiles - # do not clobber each other's fetchs - for file in $distfiles; do - case "$file" in */*) file=`echo $file | sed s#/#_#g` ;; esac - if ! ls ${TMPDIR}/f-${PM_PARENT_PID}-${file}-* >/dev/null 2>&1; then - pm_mktemp ${file}-${portdir#*/} >/dev/null - else - DONT_FETCH=dont_fetch - break - fi - done + check_state || { + echo " ===>>> If you are sure you can build it, remove the"; + echo " $state line in the Makefile and try again."; + safe_exit 1; } + + # Do not start this in the background until we are sure we are going to build + [ "$$" -eq "$PM_PARENT_PID" -a -n "$DI_FILES" ] && { echo ''; (read_distinfos)& } + + # Do these things first time through + if [ -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ]; then + dofetch () { + local fetchlog allfiles + + echo "===>>> Launching 'make checksum' for $portdir in background" + fetchlog=`pm_mktemp fetchlog-${portdir#*/}` + (pm_make -DBATCH checksum >> $fetchlog 2>&1 && { + rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.*; exit 0; } + allfiles=`pm_make -V ALLFILES` + pm_make delete-distfiles RESTRICTED_FILES="${allfiles}" >> $fetchlog 2>&1 && + echo "===>>> RE-STARTING FETCH <<<===" >> $fetchlog + pm_make -DBATCH checksum >> $fetchlog 2>&1; \ + rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.* )& + } + + # Handle the problem of manual fetching + [ -z "$PM_PACKAGES" ] && master_sites=`pm_make_b -V MASTER_SITES` + + if [ -n "$master_sites" ]; then + # PATCHFILES may get added after the first pass, but we want to + # do as much of this as we can, as early as we can, and + # patch files are usually small anyway. + distfiles=`pm_make -V ALLFILES | sed -e 's# *$##g'` + [ -n "$distfiles" ] && distfiles=" ${distfiles} " + + # Make sure that different ports using the same distfiles + # do not clobber each other's fetchs + for file in $distfiles; do + case "$file" in */*) file=`echo $file | sed s#/#_#g` ;; esac + if ! ls ${TMPDIR}/f-${PM_PARENT_PID}-${file}-* >/dev/null 2>&1; then + pm_mktemp ${file}-${portdir#*/} >/dev/null + else + DONT_FETCH=dont_fetch + break + fi + done - [ -z "$DONT_FETCH" -a -n "$distfiles" ] && dofetch - fi - unset master_sites distfiles file DONT_FETCH + [ -z "$DONT_FETCH" -a -n "$distfiles" ] && dofetch + fi + unset master_sites distfiles file DONT_FETCH - if [ -z "$FETCH_ONLY" -a ! "$PM_PACKAGES" = only ]; then - TESTINT=`grep -l ^IS_INTERACTIVE Makefile` - else - [ -n "$ALL_FETCH" ] && safe_exit - fi - if [ -n "$TESTINT" ]; then - echo '' - echo "===>>> Warning: $portdir is interactive, and will likely" - echo " require attention during the build" - echo '' - echo -n "===>>> Press the [Enter] or [Return] key to continue " - read DISCARD - echo '' - unset TESTINT DISCARD + if [ -z "$FETCH_ONLY" -a ! "$PM_PACKAGES" = only ]; then + TESTINT=`grep -l ^IS_INTERACTIVE Makefile` + else + [ -n "$ALL_FETCH" ] && safe_exit + fi + if [ -n "$TESTINT" ]; then + echo '' + echo "===>>> Warning: $portdir is interactive, and will likely" + echo " require attention during the build" + echo '' + echo -n "===>>> Press the [Enter] or [Return] key to continue " + read DISCARD + echo '' + unset TESTINT DISCARD + fi fi -fi fi # [ -z "$PM_INDEX_ONLY" ] if [ -n "$PM_FIRST_PASS" ]; then @@ -3126,8 +3092,7 @@ if [ -n "$PM_FIRST_PASS" ]; then if [ -z "$RESTART" -a -z "$PM_FORCE" ]; then update_port $req_by else - check_for_updates $req_by || - fail 'Update failed' + check_for_updates $req_by || fail 'Update failed' fi echo "===>>> Returning to check of ports depending on $upg_port" done @@ -3139,7 +3104,7 @@ if [ -n "$PM_FIRST_PASS" ]; then check_fetch_only post_first_pass $portdir -fi +fi # [ -n "$PM_FIRST_PASS" ] [ -z "$PM_BUILDING" ] && export PM_BUILDING=pmbuildingmain @@ -3275,7 +3240,7 @@ fetch_package () { latest_pv=${latest_pv##*/} else [ -n "$PM_VERBOSE" ] && - echo "===>>> No local package for $new_port exists, attempting fetch" + echo "===>>> No local package for $new_port exists, attempting fetch" fi fi fi @@ -3286,8 +3251,7 @@ fetch_package () { pm_unlink $dirlist # JIC dirlist=`pm_mktemp dl-${portdir%/*}` fetch -q -o - ${sitepath} 2>/dev/null | - sed -e "s#%2[cC]#,#g" -e "s#%2[bB]#+#g" > \ - $dirlist + sed -e "s#%2[cC]#,#g" -e "s#%2[bB]#+#g" > $dirlist fi for s in ${new_port%\.*} ${new_port%%\.*} ${new_port%-*}; do @@ -3335,14 +3299,14 @@ notnewer () { if [ "$latest_pv" = "$new_port" ]; then use_package=up_equal [ -n "$PM_VERBOSE" ] && - echo "===>>> Available package ($latest_pv) matches the current version" + echo "===>>> Available package ($latest_pv) matches the current version" elif [ -n "$latest_pv" -a -n "$PM_PACKAGES_NEWER" ]; then if [ -n "$upg_port" ]; then case `pkg_version -t $upg_port $latest_pv` in \<) use_package=up_newer [ -n "$PM_VERBOSE" ] && { - echo "===>>> Available package ($latest_pv)"; - echo " is newer than installed ($upg_port)"; } ;; + echo "===>>> Available package ($latest_pv)"; + echo " is newer than installed ($upg_port)"; } ;; =) if [ -n "$PM_FORCE" ]; then use_package=up_force else @@ -3353,7 +3317,7 @@ notnewer () { else use_package=up_no_installed [ -n "$PM_VERBOSE" ] && - echo "===>>> There is a package available ($latest_pv)" + echo "===>>> There is a package available ($latest_pv)" fi elif [ -n "$latest_pv" ]; then case `pkg_version -t $new_port $latest_pv` in @@ -3370,12 +3334,12 @@ notnewer () { use_package=up_auto else echo '' - echo "===>>> The newest available package ($latest_pv)" - echo " is older than the version in ports ($new_port)" + echo "===>>> The newest available package ($latest_pv)" + echo " is older than the version in ports ($new_port)" if [ "$PM_PACKAGES" = only ]; then if [ -n "$PM_FORCE" ]; then use_package=up_force2 - echo "===>>> Installing anyway due to -f" + echo "===>>> Installing anyway due to -f" else fail $ponly_err fi @@ -3391,11 +3355,11 @@ notnewer () { fail "There is no valid package to install" else echo '' -echo "===>>> There is no valid package to install, building port instead" + echo "===>>> There is no valid package to install, building port instead" echo '' fi fi -fi +fi # [ -n "$PM_PACKAGES" -o "$PM_PACKAGES_BUILD" = doing_build_only_dep ] if [ -z "$use_package" ]; then if [ -n "$PM_PACKAGES" ]; then @@ -3439,8 +3403,7 @@ if [ -z "$use_package" ]; then eval pm_make $port_log_args || fail "make failed for $portdir" else [ -z "$local_package" ] && { - fetch_package $latest_pv || - fail "Fetch for ${latest_pv}.tbz failed"; } + fetch_package $latest_pv || fail "Fetch for ${latest_pv}.tbz failed"; } fi # Ignore if no old port exists @@ -3453,12 +3416,10 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" if [ -n "$SAVE_SHARED" ]; then ldconfig_out=`pm_mktemp ldconfig` - ldconfig -r | sed 's#.* ##' | - grep -v ^$LOCALBASE_COMPAT > $ldconfig_out + ldconfig -r | sed 's#.* ##' | grep -v ^$LOCALBASE_COMPAT > $ldconfig_out unset temp - for file in `pkg_info -q -L $UPGRADE_PORT | sort - $ldconfig_out | \ - uniq -d`; do + for file in `pkg_info -q -L $UPGRADE_PORT | sort - $ldconfig_out | uniq -d`; do temp="${temp}$file " done if [ -n "$temp" ]; then @@ -3518,21 +3479,20 @@ if [ -z "$use_package" ]; then if [ -n "$PM_SU_UNSET_PORT_LOG_ARGS" ]; then unset port_log_args else - [ -n "$HIDE_BUILD" ] && - echo "===>>> Logging install to $port_log" + [ -n "$HIDE_BUILD" ] && echo "===>>> Logging install to $port_log" fi # Defining NO_DEPENDS ensures that we will control the installation # of the depends, not bsd.port.mk. - eval pm_make_s -DNO_DEPENDS install $port_log_args || - install_failed $new_port + eval pm_make_s -DNO_DEPENDS install $port_log_args || install_failed $new_port else [ -n "$local_package" ] && ppd=${LOCAL_PACKAGEDIR}/All echo "===>>> Installing package" if $PM_SU_CMD pkg_add --no-deps --force ${ppd}/${latest_pv}.tbz; then [ -n "$PM_DELETE_PACKAGES" ] && { - [ -n "$PM_VERBOSE" ] && echo "===>>> Deleting ${latest_pv}.tbz"; + [ -n "$PM_VERBOSE" ] && + echo "===>>> Deleting ${latest_pv}.tbz"; pm_unlink_s ${ppd}/${latest_pv}.tbz; } else install_failed ${latest_pv}.tbz @@ -3612,7 +3572,7 @@ fi if [ -n "$use_package" ]; then if grep -q DEPORIGIN $pdb/$new_port/+CONTENTS; then -echo "===>>> Updating dependencies for $new_port to match installed versions" + echo "===>>> Updating dependencies for $new_port to match installed versions" update_contents $pdb/$new_port/+CONTENTS echo '' fi @@ -3637,7 +3597,7 @@ fi check_dependency_files $portdir $new_port if [ -s "$grep_deps" ]; then -echo "===>>> Updating dependency entry for $new_port in each dependent port" + echo "===>>> Updating dependency entry for $new_port in each dependent port" [ -n "$PM_VERBOSE" ] && echo '' while read d_port; do [ -n "$PM_VERBOSE" ] && echo "===>>> $d_port" @@ -3646,7 +3606,7 @@ echo "===>>> Updating dependency entry f if [ -n "$ro_opd" ]; then grep -ql "DEPORIGIN:$ro_opd$" $dp_cont && - update_contents $dp_cont $portdir $new_port $ro_opd + update_contents $dp_cont $portdir $new_port $ro_opd fi # Do this one last so it can get deleted as a duplicate # if ro_opd is present. @@ -3687,8 +3647,7 @@ if [ "$$" -ne "$PM_PARENT_PID" -o -n "$U echo "===>>> $ilist succeeded" ; echo '' fi -[ -n "$PM_MULTI_BUILT" ] && - PM_MULTI_BUILT="${PM_MULTI_BUILT}${new_port}:${portdir}:" +[ -n "$PM_MULTI_BUILT" ] && PM_MULTI_BUILT="${PM_MULTI_BUILT}${new_port}:${portdir}:" INSTALLED_LIST="${INSTALLED_LIST}\t${ilist}\n" [ -e "$pdb/$new_port/+DISPLAY" ] && DISPLAY_LIST="${DISPLAY_LIST}$new_port " From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 01:08:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DC221065675; Fri, 6 Aug 2010 01:08:12 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51A138FC12; Fri, 6 Aug 2010 01:08:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7618Cav060176; Fri, 6 Aug 2010 01:08:12 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7618CX6060174; Fri, 6 Aug 2010 01:08:12 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008060108.o7618CX6060174@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 01:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210906 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 01:08:12 -0000 Author: dougb Date: Fri Aug 6 01:08:12 2010 New Revision: 210906 URL: http://svn.freebsd.org/changeset/base/210906 Log: 1. Use a better, more generic method of signaling an abnormal exit 2. Call safe_exit with a status of 1 from more places. The specific problem the latter solves is when using -r/f but not -R, and PM_UPGRADE_DONE_FLAG files exist from a previous run. If an abnormal exit is not signaled when necessary in this situation the flags will get deleted even though we want to keep them. This is likely the cause of some of the vague problem reports I have received in the past that include complaints of, "I used -r/f and -R but portmaster still rebuilt certain ports a whole bunch of times." Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Fri Aug 6 00:52:23 2010 (r210905) +++ user/dougb/portmaster/portmaster Fri Aug 6 01:08:12 2010 (r210906) @@ -68,8 +68,6 @@ fail () { } trap_exit () { - TRAP=trap - echo '' # Helps if the previous message was 'echo -n' if [ -n "$portdir" -a -z "$1" ]; then echo "===>>> Build/Install for $portdir exiting due to signal" @@ -134,7 +132,7 @@ parent_exit () { fi [ -n "$FETCH_ONLY" -a -z "$FETCH_ONLY_DONE" ] && kill_bad_children - if [ -z "$TRAP" ]; then + if [ -z "$1" ]; then if [ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ]; then files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG` if [ -n "$files" ]; then @@ -158,7 +156,7 @@ parent_exit () { for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do pm_unlink $f ; done case "$DISPLAY_LIST" in - *' '*) if [ -n "$TRAP" ]; then + *' '*) if [ -n "$1" ]; then echo "===>>> There are messages from installed ports to display," echo " but first take a moment to review the error messages" echo -n " above. Then press Enter when ready to proceed. " @@ -224,7 +222,7 @@ parent_exit () { safe_exit () { if [ "$$" -eq "$PM_PARENT_PID" ]; then - parent_exit + parent_exit $1 else [ -n "$grep_deps" ] && pm_unlink $grep_deps @@ -2414,7 +2412,7 @@ post_first_pass () { [nN]*) echo '' echo "===>>> If you would like to upgrade or install some, but not" echo " all of the above try adding '-i' to the command line." - safe_exit ;; + safe_exit 1 ;; esac unset build_l fi @@ -2876,10 +2874,10 @@ if [ -n "$upg_port" -a -z "$portdir" ]; case "$?" in 3) echo '' echo "===>>> BSDPAN ports cannot be upgraded with portmaster" - echo " (${upg_port})"; echo ''; safe_exit ;; + echo " (${upg_port})"; echo ''; safe_exit 1 ;; 2) [ -z "$PM_VERBOSE" ] && { echo " ===>>> No ORIGIN for $upg_port, and +IGNOREME is present"; - echo ''; }; safe_exit ;; + echo ''; }; safe_exit 1 ;; *) fail 'Cannot continue' ;; esac ; } elif [ -z "$portdir" ]; then From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 23:37:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE69C1065670; Fri, 6 Aug 2010 23:37:29 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83FE38FC18; Fri, 6 Aug 2010 23:37:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76NbTRX065480; Fri, 6 Aug 2010 23:37:29 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76NbTLV065479; Fri, 6 Aug 2010 23:37:29 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008062337.o76NbTLV065479@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 23:37:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210978 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:37:29 -0000 Author: dougb Date: Fri Aug 6 23:37:29 2010 New Revision: 210978 URL: http://svn.freebsd.org/changeset/base/210978 Log: Add a directory to hold auxilliary files Added: user/dougb/portmaster/files/ From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 23:38:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01784106567B; Fri, 6 Aug 2010 23:38:13 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E38B88FC0C; Fri, 6 Aug 2010 23:38:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76NcCq2065700; Fri, 6 Aug 2010 23:38:12 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76NcCxQ065698; Fri, 6 Aug 2010 23:38:12 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008062338.o76NcCxQ065698@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 23:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210979 - in user/dougb/portmaster: . files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:38:13 -0000 Author: dougb Date: Fri Aug 6 23:38:12 2010 New Revision: 210979 URL: http://svn.freebsd.org/changeset/base/210979 Log: Move the man page into the new files/ subdirectory Added: user/dougb/portmaster/files/portmaster.8 - copied unchanged from r210978, user/dougb/portmaster/portmaster.8 Deleted: user/dougb/portmaster/portmaster.8 Copied: user/dougb/portmaster/files/portmaster.8 (from r210978, user/dougb/portmaster/portmaster.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/dougb/portmaster/files/portmaster.8 Fri Aug 6 23:38:12 2010 (r210979, copy of r210978, user/dougb/portmaster/portmaster.8) @@ -0,0 +1,892 @@ +.\" Copyright (c) 2006-2010 Doug Barton dougb@FreeBSD.org +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 9, 2010 +.Dt PORTMASTER 8 +.Os +.Sh NAME +.Nm portmaster +.Nd manage your ports without external databases or languages +.Sh SYNOPSIS +Common Flags: +.Op Fl -force-config CGHgntvw [B|b] [f|i] [D|d] +.Op [[--packages|-P]|[--packages-only|-PP]] | [--packages-build] +.Op Fl -packages-if-newer +.Op Fl -delete-build-only +.Op Fl -always-fetch +.Op Fl -local-packagedir= +.Op Fl -packages-local +.Op Fl -delete-packages +.Op Fl -no-confirm +.Op Fl -no-term-title +.Op Fl -no-index-fetch +.Op --index|--index-first|--index-only +.Op Fl m Ar arguments for make +.Op Fl x Ar glob pattern to exclude from building +.Nm +.Op Common Flags +.Ar full name of port directory in /var/db/pkg +.Nm +.Op Common Flags +.Ar full path to /usr/ports/foo/bar +.Nm +.Op Common Flags +.Ar glob pattern of directories from /var/db/pkg +.Pp +PLEASE NOTE: Glob patterns now update every port that matches. +This is a change from pre-version-2.3 behavior. +.Pp +.Nm +.Op Common Flags +.Ar Multiple full names or paths from /usr/ports or /var/db/pkg, +and/or multiple globs from /var/db/pkg +.Nm +.Op Common Flags + . (Use in /usr/ports/foo/bar to build that port) +.Nm +.Fl -show-work +.Op Fl Gv m Ar args + +.Nm +.Op Common Flags +.Fl o Ar +.Nm +.Op Common Flags +.Op Fl R +.Fl r Ar name/glob of port in /var/db/pkg +.Nm +.Op Common Flags +.Fl a +.Nm +.Fl -delete-build-only +.Nm +.Op Fl -packages-if-newer +.Op Fl -always-fetch +.Op Fl -local-packagedir= +.Op Fl -packages-local +.Op Fl -delete-packages +.Fl P|--packages +.Nm +.Op Fl -packages-if-newer +.Op Fl -always-fetch +.Op Fl -local-packagedir= +.Op Fl -packages-local +.Op Fl -delete-packages +.Fl PP|--packages-only +.Nm +.Op Fl -packages-if-newer +.Op Fl -always-fetch +.Op Fl -local-packagedir= +.Op Fl -packages-local +.Op Fl -delete-packages +.Fl -packages-build +.Nm +.Fl [l|L] +.Nm +.Op Fl b [D|d] +.Fl e Ar name/glob of port directory in /var/db/pkg +.Nm +.Op Fl b [D|d] +.Fl s +.Nm +.Fl -clean-distfiles +.Nm +.Fl -clean-distfiles-all +.Nm +.Fl -check-depends +.Nm +.Fl -check-port-dbdir +.Op Fl v +.Nm +.Fl -list-origins +.Nm +.Fl h|--help +.Nm +.Fl -version +.Pp +The +.Qq glob +patterns mentioned above are not regular expressions. +For example: +.Qq portmaster perl +would match every port dirctory name in +.Pa /var/db/pkg +that fits the pattern +.Qq /var/db/pkg/perl* . +.Sh QUICK START GUIDE +This manual contains a lot of valuable information about +.Nm , +and you should read the entire manual to give you a better +idea about how it works and what choices are available to you. +However in the interests of getting you started quickly +please see the EXAMPLES section at the end of the manual. +.Sh DESCRIPTION +The +.Nm +utility is a tool for updating your ports. +It does not use an external database to track what you +have installed. +Rather it uses the existing ports infrastructure, +including what is located in +.Pa /var/db/pkg . +The focus of this tool is to keep the dependency +tracking information for your ports up to date. +This allows you to safely update a specific port without +having to update all of the ports +.Qq above +it. +In the rare case where you do need to recompile +ports which depend on a port you are updating, +the +.Fl r +option exists to accomplish this. +.Pp +By default +.Nm +updates the port you specify on the command line. +This will occur +whether there is a new version for it or not. +It will first recurse through the port +and all of its dependencies (if any) to handle +any port OPTIONS via the 'make config' interface. +You will be presented with an OPTIONS dialog if +you have never built the port before, +or if the OPTIONS have changed. +You can force dialogs for all ports by using the +.Fl -force-config +option. +.Pp +While recursing through dependencies, +if you are not using any of the +.Fl -packages* +options, +a 'make checksum' process will be launched +in the background to either verify that the +correct distfiles are available +or start downloading the new ones. +If you stop +.Nm +with ^C, an attempt will be made to kill off +the child processes started for this purpose. +.Pp +While checking dependencies if a port has CONFLICTS +set they will be compared to your installed ports +and if you already have an alternate version of the dependency +that is required by the port you are building +it will be used in place of the default dependency. +.Pp +When the config and dependency checking phase is over the +user will be presented with a list of ports that will be +installed and/or upgraded, and asked to approve +before proceeding. +This behavior can be supressed with the +.Fl -no-confirm +option. +.Pp +If the dependency check +does not find a port that needs updating +that step will be skipped prior +to building the port(s) specified on the command line. +In addition to this optimization, +information about up-to-date dependencies, +choices made on which ports to build for +interactive mode, +and ports already visited for 'make config' are +all cached to enhance performance and prevent +duplicated efforts. +.Pp +While recursing through the dependencies, +if a port is marked IS_INTERACTIVE this will +be flagged. +In the absence of this notification, +under normal circumstances the only user interaction +required after the port starts building is to answer +questions about the deletion of stale distfiles. +This can be eliminated with the +.Fl d +or +.Fl D +options. +.Pp +There are a number of +.Fl -packages* +options available to save the time that would normally +be spent building the port(s). +Users interested in a reasonable balance between speed of +installation and maximum performance should consider the +.Fl -packages-build +option, perhaps combined with the +.Fl -delete-build-only +option. +.Pp +If there is no +.Fl B +option specified when updating an existing port, +a backup package will be created before +.Xr pkg_delete 1 +is called. +If you are using the +.Fl b +option, these packages can be found in a directory called +.Qq portmaster-backup +in the directory specified by the +.Ev PACKAGES +environment variable, usually +.Pa /usr/ports/packages . +If there is no +.Fl b +option specified, the backup package will be deleted +once the new version of the port is successfully installed. +If the installation fails for whatever reason, +a helpful message will be printed, along with instructions +on where to find the backup package. +.Pp +After the port is built, if the +.Fl w +option is being used, all shared libraries installed +by the old port (if any) will be saved to +.Pa /usr/local/lib/compat/pkg . +After installation if there are any new files with +the same names as those in +.Pa /usr/local/lib/compat/pkg +the old files will be deleted, +and +.Xr ldconfig 8 +will be run via +.Pa /etc/rc.d/ldconfig . +.Pp +After the new port is built, but before it is installed +the runtime dependencies will be checked to make sure +they are up to date. +If the +.Fl g +option is used a package will be created for the new +(or newly installed) version. +.Pp +When installing a port or using the +.Fl -check-depends +option, if there are other ports that depend on this port +the dependent ports +.Pa +CONTENTS +file(s), and the +.Pa +REQUIRED_BY +file for the new port will be updated. +.Pp +At the conclusion of a successful installation, +any +.Pa pkg-message +files that were installed, +and a summary of the work performed will be displayed. +If the +.Fl -delete-build-only +option is in use, those packages that were installed during +the current run of +.Nm +AND were only ever listed as build dependencies during this +run will be deleted. +.Pp +If something goes wrong during the process +(e.g., a port build fails, a port is marked BROKEN) +.Nm +will report any work done successfully as described above, +then exit. +.Pp +The question is often asked, +.Dq Why is it not possible to proceed with the ports that do not have errors? +The answer is that (unfortunately) +.Nm +is not omniscient, and cannot guess what resolution the +user would like to have for this problem. +Manual intervention is therefore required. +.Sh OPTIONS +The options are as follows: +.Bl -tag -width F1 +.It Fl -force-config +run 'make config' for all ports +.It Fl B +prevents creation of the backup package for the installed port +.It Fl C +prevents 'make clean' from being run before building +.It Fl G +prevents the recursive 'make config' (overrides +.Fl -force-config ) +.It Fl H +hide details of the port build and install in a log file +.It Fl K +prevents 'make clean' from being run after building +.It Fl b +create and keep a backup package of an installed port +.It Fl g +create a package of the new port +.It Fl n +run through configure, but do not make or install any ports +.It Fl t +recurse dependencies thoroughly, using all-depends-list +.It Fl v +verbose output +.It Fl w +save old shared libraries before deinstall +.It Fl u +This option has been deprecated. +It did very little previously, and not what most users expected. +Please check the +.Fl d +and +.Fl D +options to achieve most of the same effect. +.It [-R] Fl f +always rebuild ports (overrides +.Fl i ) +.It Fl i +interactive update mode -- ask whether to rebuild ports +.It Fl D +no cleaning of distfiles +.It Fl d +always clean distfiles +.It Fl m Ar arguments for make +any arguments to supply to +.Xr make 1 +.It Fl x +avoid building or updating ports that match this pattern. +Can be specified more than once. +If a port is not already installed the exclude pattern will +be run against the directory name from +.Pa /usr/ports . +.It Fl p Ar port directory in /usr/ports +This option has been deprecated. +.It Fl -show-work +show what dependent ports are, and are not installed (implies +.Fl t ) . +.It Fl o Ar +replace the installed port with a port from a different origin +.It [-R] Fl r Ar name/glob of port directory in /var/db/pkg +rebuild the specified port, and all ports that depend on it +.It Fl R +used with the +.Fl r +or +.Fl f +options to skip ports updated on a previous run. +.It Fl a +check all ports, update as necessary +.It Fl -delete-build-only +delete ports that are build-only dependencies after a successful run, +only if installed this run +.It Fl P|--packages +use packages, but build port if not available +.It Fl PP|--packages-only +fail if no package is available. +The +.Fl PP +option must stand alone on the command line. +In other words, you cannot do +.Fl PPav +(for example). +.It Fl -packages-build +use packages for all build dependencies +.It Fl -packages-if-newer +use package if newer than installed even if the package is not +the latest according to the ports tree +.It Fl -always-fetch +fetch package even if it already exists locally +.It Fl -local-packagedir= +where local packages can be found, +will fall back to fetching if no local version exists. +This option should point to the full path of a directory structure +created in the same way that 'make package' (or the +.Nm +.Fl g +option) creates it. +I.e., the package files are contained in +.Pa /All , +there are LATEST_LINK symlinks in the +.Pa /Latest +directory, and symlinks to the packages in +.Pa /All +in the category subdirectories, such as +.Pa /devel , +.Pa /ports-mgmt , +etc. +.It Fl -packages-local +use packages from +.Fl -local-packagedir +only +.It Fl -delete-packages +after installing from a package, delete it +.It Fl -no-confirm +do not ask the user to confirm the list of ports to +be installed and/or updated before proceeding +.It Fl -no-term-title +do not update the xterm title bar +.It Fl -no-index-fetch +skip fetching the INDEX file +.It Fl -index +use INDEX-[6-9] exclusively to check if a port is up to date +.It Fl -index-first +use the INDEX for status, but double-check with the port +.It Fl -index-only +do not try to use +.Pa /usr/ports . +For updating ports when no +.Pa /usr/ports +directory is present the +.Fl PP|--packages-only +option is required. +See the ENVIRONMENT section below for additional +requirements. +.It Fl l +list all installed ports by category +.It Fl L +list all installed ports by category, and search for updates +.It Fl e Ar name/glob of port directory in /var/db/pkg +expunge port using +.Xr pkg_delete 1 , +and optionally remove all distfiles. +Calls +.Fl s +after it is done expunging in case removing +the port causes a dependency to no longer be +necessary. +.It Fl s +clean out stale ports that used to be depended on +.It Fl F +fetch distfiles only. +Cannot be used with +.Fl G , +but may be used with +.Fl -force-config +and +.Fl [aftv] . +.It Fl -clean-distfiles +recurse through the installed ports to get a list +of distinfo files, +then recurse through all files in +.Pa /usr/ports/distfiles +to make sure that they are still associated with +an installed port. +If not, offer to delete the stale file. +.It Fl -clean-distfiles-all +does the same as above, but deletes all files without prompting. +.It Fl -check-depends +cross-check and update dependency information for all ports +.It [-v] Fl -check-port-dbdir +check for stale entries in +.Pa /var/db/ports +.It Fl -list-origins +list directories from /usr/ports for root and leaf ports. +This list is suitable for feeding to +.Nm +either on another machine or for reinstalling all ports. +See EXAMPLES below. +.It Fl h|--help +display help message +.It Fl -version +display the version only. +.El +.Sh ENVIRONMENT +The directory pointed to by the +.Ev PACKAGES +variable (by default +.Pa /usr/ports/packages ) +will be used to store new and backup packages. +When using 'make package' for the +.Fl g +option, the ports infrastructure will store packages in +.Pa /usr/ports/packages/All , +aka +.Ev PKGREPOSITORY . +When using the +.Fl b +option, +.Nm +stores its backup packages in +.Pa /usr/ports/packages/portmaster-backup +so that you can create both a backup package and +a package of the newly installed port even if they +have the same version. +.Pp +When using the +.Fl -packages* +options the package files will be downloaded to +.Pa ${PACKAGES}/portmaster-download . +.Nm +will respect the +.Ev PACKAGESITE +and +.Ev PACKAGEROOT +(by default http://ftp.freebsd.org) variables. +.Nm +attempts to use both of these variables in the same +way that +.Xr pkg_add 1 +does. +.Pp +The +.Ev UPGRADE_TOOL +variable is set to +.Qq Nm , +and the +.Ev UPGRADE_PORT +and +.Ev UPGRADE_PORT_VER +variables +are set to the full package name string and version +of the existing package being replaced, if any. +.Pp +When using the +.Fl -index-only +option the +.Ev PACKAGES +and +.Ev INDEXDIR +variables must each be set to a dirctory where the +superuser has write permissions. +Other useful variables include: +.Bd -literal +MASTER_SITE_INDEX (default http://www.FreeBSD.org/ports/) +FETCHINDEX (default fetch -am -o) +INDEXFILE (default auto per FreeBSD version) +.Ed +.Sh FILES +.Bl -tag -width "1234" -compact +.It Pa /usr/local/etc/portmaster.rc +.It Pa $HOME/.portmasterrc +Optional system and user configuration files. +The variables set in the script's getopts routine +can be specified in these files to enable those options. +These files will be read by the parent +.Nm +process, and all variables +in them will be exported. +.Pp +PLEASE NOTE: In versions before 2.3 +.Pa /etc/portmaster.rc +was recommended. +However placing this file in LOCALBASE is the correct +thing to do. +In future versions of +.Nm +support for +.Pa /etc/portmaster.rc +will be removed. +.Pp +Here are examples of variables that are likely to be useful, +along with their related options. +.Pp +.Bd -literal +# Sample portmaster rc file. +# Place in $HOME/.portmasterrc or /usr/local/etc/portmaster.rc +# +# Do not create temporary backup packages before pkg_delete (-B) +# NO_BACKUP=Bopt +# +# Always save the backup packages of the old port (-b) +# BACKUP=bopt +# +# Make and save a package of the new port (-g) +# MAKE_PACKAGE=gopt +# +# Do not preclean the port's build directory (-C) +# DONT_PRE_CLEAN=Copt +# +# Do not clean the port's build directory after installation (-K) +# DONT_POST_CLEAN=Kopt +# +# Never search for stale distfiles to delete (-D) +# DONT_SCRUB_DISTFILES=Dopt +# +# Always delete stale distfiles without prompting (-d) +# ALWAYS_SCRUB_DISTFILES=dopt +# +# Do not run 'make config' for ports that need updating (-G) +# (This unsets --force-config) +# NO_RECURSIVE_CONFIG=Gopt +# +# Hide the build and install processes in a log file (-H) +# HIDE_BUILD=Hopt +# +# Arguments to pass to make (-m) +# PM_MAKE_ARGS='-DFORCE_PKG_REGISTER' +# +# Recurse through every dependency, and child dependencies (-t) +# RECURSE_THOROUGH=topt +# +# Be verbose (-v) +# PM_VERBOSE=vopt +# +# Save copies of old shared libraries (recommended) (-w) +# SAVE_SHARED=wopt +# +# Install a package if available (-P or --packages) +# PM_PACKAGES=first +# +# Only install packages (-PP or --packages-only) +# PM_PACKAGES=only +# +# Install packages for build-only dependencies (--packages-build) +# PM_PACKAGES_BUILD=pmp_build +# +# Delete build-only dependencies when finished (--delete-build-only) +# PM_DEL_BUILD_ONLY=pm_dbo +# +# Use packages if they are newer than installed (--packages-newer) +# PM_PACKAGES=newer +# PM_PACKAGES_NEWER=pmp_newer +# +# Always fetch new package files (--always-fetch) +# PM_ALWAYS_FETCH=pm_always_fetch +# +# Specify a local package repository (--local-packagedir) +# LOCAL_PACKAGEDIR= +# +# Only use packages from --local-packagedir (--packages-local) +# PM_PACKAGES_LOCAL=pmp_local +# +# Delete packages after they are installed (--delete-packages) +# PM_DELETE_PACKAGES=pm_delete_packages +# +# Suppress the build confirmation message (--no-confirm) +# PM_NO_CONFIRM=pm_no_confirm +# +# Do not update the xterm title bar (--no-term-title) +# PM_NO_TERM_TITLE=pm_no_term_title +# +# Do not fetch the INDEX file (--no-index-fetch) +# PM_NO_INDEX_FETCH=pm_no_index_fetch +# +# Use only the INDEX file to check if a port is out of date (--index) +# PM_INDEX=pm_index +# +# Use the INDEX file first, then check /usr/ports (--index-first) +# PM_INDEX=pm_index +# PM_INDEX_FIRST=pm_index_first +# +# Use the INDEX file instead of /usr/ports (--index-only) +# PM_INDEX=pm_index +# PM_INDEX_ONLY=pm_index_only +.Ed +.Pp +.It Pa /var/db/pkg/*/+IGNOREME +If this file exists for a port that is already installed, +several things will happen: +.Bl -tag -width F1 +.It 1. The port will be ignored for all purposes. +This includes dependency updates even if there is no +directory for the port in +.Pa /usr/ports +and there is no entry for it in +.Pa /usr/ports/MOVED . +If the +.Fl v +option is used, the fact that the port is being ignored +will be mentioned. +.It 2. If using the +.Fl L +option, and a new version exists, the existence of the +.Pa +IGNOREME +file will be mentioned. +.It 3. If you do a regular update of the port, or if the +.Fl a +option is being used you will be asked if you want to +update the port anyway. +.El +.Pp +.It Pa /var/db/pkg/*/PM_UPGRADE_DONE_FLAG +Indicates to a subsequent +.Fl a , +.Fl f , +or +.Fl r +run which includes the +.Fl R +option that a port has already been rebuilt, +so it can be safely ignored if it is up to date. +.Pp +.It Pa /tmp/port_log-* +If the +.Fl H +option is used, and the installation or upgrade is not +successful, the results of the build and install will be +saved in this file. +Substitute the value of +.Ev TMPDIR +in your environment as appropriate. +.El +.Sh EXIT STATUS +.Ex -std +.Sh ADVANCED FEATURE: SU_CMD +The ports infrastructure has limited support for performing +various operations as an unpriviliged user. +It does this by defining SU_CMD, which is typically +.Xr su 1 . +In order to support complete management of your ports as an +unprivileged user, escalating to +.Qq root +privileges only when necessary, +.Nm +can use +.Xr sudo 1 +to handle the escalated privileges. +To accomplish this you must have the following directories +configured so that the unprivileged user can access them: +.Bl -tag -width F1 +.It 1. WRKDIRPREFIX - This is usually set to Pa /usr/ports/category/port/work , +however it is suggested that you configure another +directory outside your ports tree for access by the +unprivileged user, and assign this variable +to that value in your +.Pa /etc/make.conf . +.It 2. DISTDIR - This is usually set to Pa /usr/ports/distfiles . +This directory can be safely set up for access by the unprivileged +user, or a new directory can be specified as above. +.It 3. TMPDIR - Usually Pa /tmp , +but can also be set to another directory in your shell +environment if desired. +.El +.Pp +It is further assumed that the following directories will be +owned by root: +.Bl -tag -width F1 +.It Pa /var/db/pkg +.It Pa /var/db/ports +.It LOCALBASE - Usually Pa /usr/local +.It PACKAGES - Usually Pa /usr/ports/packages +.It PKGREPOSITORY - Usually Pa ${PACKAGES}/All +.El +.Pp +You will then need to install and configure +.Xr sudo 1 . +This can easily be done with +.Pa /usr/ports/security/sudo . +Then you will need to define PM_SU_CMD in your +.Pa /etc/portmaster.rc +file, or your +.Pa $HOME/.portmasterrc +file. +For example: +.Pp +.Dl "PM_SU_CMD=/usr/local/bin/sudo" +.Pp +You can optionally define the PM_SU_VERBOSE option as well +to notify you each time +.Nm +uses the PM_SU_CMD. +This is particularly useful if you are experimenting with +a tool other than +.Xr sudo 1 +to handle the privilege escalation, although at this time +.Xr sudo 1 +is the only supported option. +.Pp +PLEASE NOTE: You cannot upgrade the +.Xr sudo 1 +port itself using this method. +.Sh EXAMPLES +The following are examples of typical usage +of the +.Nm +command: +.Pp +Update one port: +.Dl "portmaster fooport-1.23" +.Dl "portmaster fooport" +.Dl "portmaster foo/fooport" +.Pp +Use a package if available: +.Dl "portmaster --packages fooport-1.23" +.Pp +Update multiple ports: +.Dl "portmaster fooport-1.23 barport baz/blahport" +.Pp +Build a port locally but use packages for build dependencies, +then delete the build dependencies when finished: +.Dl "portmaster --packages-build --delete-build-only fooport-1.23" +.Pp +Update a system using only packages that are available locally: +.Dl "portmaster -PP --local-packagedir= -a" +.Pp +Update all ports that need updating: +.Dl "portmaster -a" +.Pp +Update all ports that need updating, and delete stale +distfiles after the update is done: +.Dl "portmaster -aD" +.Dl "portmaster --clean-distfiles" +.Pp +More complex tasks (please see the details for these options above): +.Dl "portmaster -r fooport-1.23" +.Dl "portmaster -o emulators/linux_base-fc4 linux_base-8-8.0_15" +.Dl "portmaster -x cvsup -f -a" +.Dl "portmaster -a -x gstreamer -x linux" +.Pp +Print only the ports that have available updates. +This can be used as an alias in your shell. +Be sure to fix the line wrapping appropriately. +.Dl "portmaster -L |" +.Dl "egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|" +.Dl "IGNORE|marked|Reason:|MOVED|deleted' | grep -v '^--'" +.Pp +Using +.Nm +to do a complete reinstallation of all your ports: +.Dl "1. portmaster --list-origins > ~/installed-port-list" +.Dl "2. Update your ports tree" +.Dl "3. portmaster --clean-distfiles-all" +.Dl "4. portmaster --check-port-dbdir" +.Dl "5. portmaster -Faf" +.Dl "6. pkg_delete '*'" +.Dl "7. rm -rf /usr/local/lib/compat/pkg" +.Dl "8. Manually check /usr/local and /var/db/pkg" +.Dl " to make sure that they are really empty" +.Dl "9. Re-install portmaster" +.Dl "10. portmaster `cat ~/installed-port-list`" +.Pp +You probably want to use the -D option for the installation +and then run --clean-distfiles[-all] again when you are done. +You might also want to consider using the --force-config option +when installing the new ports. +.Pp +Alternatively you could use +.Nm Fl a Fl f Fl D +to do an +.Dq in place +update of your ports. +If that process is interrupted for any reason you can use +.Nm Fl a Fl f Fl D Fl R +to avoid rebuilding ports already rebuilt on previous runs. +However the first method (delete everything and reinstall) is preferred. +.Sh SEE ALSO +.Xr make 1 , +.Xr pkg_add 1 , +.Xr pkg_delete 1 , +.Xr su 1 , +.Xr ports 7 , +.Xr ldconfig 8 , +.Xr sudo 8 +.Sh AUTHORS +This +manual page was written by +.An Doug Barton . From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 23:41:39 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C638D106564A; Fri, 6 Aug 2010 23:41:39 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B62B88FC08; Fri, 6 Aug 2010 23:41:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76NfdeB066504; Fri, 6 Aug 2010 23:41:39 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76Nfdb6066503; Fri, 6 Aug 2010 23:41:39 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008062341.o76Nfdb6066503@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 23:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210980 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:41:39 -0000 Author: dougb Date: Fri Aug 6 23:41:39 2010 New Revision: 210980 URL: http://svn.freebsd.org/changeset/base/210980 Log: Add version 1.9 from ports/ports-mgmt/portmaster/files Added: user/dougb/portmaster/files/bash-completions Added: user/dougb/portmaster/files/bash-completions ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/dougb/portmaster/files/bash-completions Fri Aug 6 23:41:39 2010 (r210980) @@ -0,0 +1,27 @@ +_portmaster () { + local cur + cur=${COMP_WORDS[COMP_CWORD]} + + case "$cur" in + /usr/ports/*) + COMPREPLY=( $( compgen -d $cur ) ) ;; + */*) COMPREPLY=( $( compgen -d /usr/ports/$cur ) ) ;; + --*) COMPREPLY=( $( compgen -W '--force-config --show-work \ + --clean-distfiles --clean-distfiles-all --check-depends \ + --check-port-dbdir --list-origins --packages --packages-only \ + --packages-build --packages-if-newer --delete-build-only \ + --always-fetch --packages-delete \ + --local-packagedir= --packages-local \ + --no-confirm --no-term-title --no-index-fetch \ + --index --index-first --index-only \ + --help --version' -- $cur ) ) + ;; + *) COMPREPLY=( $( compgen -d /var/db/pkg/$cur ) ) + COMPREPLY=( ${COMPREPLY[@]#/var/db/pkg/} ) + COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d /usr/ports/$cur/ ) ) + ;; + esac + + return 0 +} +complete -F _portmaster portmaster From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 23:42:33 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0BFE106564A; Fri, 6 Aug 2010 23:42:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A05158FC12; Fri, 6 Aug 2010 23:42:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76NgXNj066740; Fri, 6 Aug 2010 23:42:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76NgXMV066738; Fri, 6 Aug 2010 23:42:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008062342.o76NgXMV066738@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 23:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210981 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:42:33 -0000 Author: dougb Date: Fri Aug 6 23:42:33 2010 New Revision: 210981 URL: http://svn.freebsd.org/changeset/base/210981 Log: Add version 1.7 from ports/ports-mgmt/portmaster/files/ Added: user/dougb/portmaster/files/zsh-completions Added: user/dougb/portmaster/files/zsh-completions ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/dougb/portmaster/files/zsh-completions Fri Aug 6 23:42:33 2010 (r210981) @@ -0,0 +1,81 @@ +#compdef portmaster +# for portmaster 2.18 + +local context state line array ret=1 +typeset -A opt_args + +_arguments -A "-*" : \ + "--force-config['make config' for all ports]" \ + "-C[prevents 'make clean' from being run before building]" \ + "(-F)-G[prevents recursive 'make config' (overrides --force-config)]" \ + "-H[hide details of the port build and install in a log file]" \ + "-K[prevents 'make clean' from being run after building]" \ + "(-b)-B[prevents creation of the backup package for the installed port]" \ + "(-B)-b[create and keep a backup package of an installed port]" \ + "-g[create a package of the new port]" \ + "-n[run through configure, but do not make or install any ports]" \ + "-t[recurse dependencies thoroughly, using all-depends-array]" \ + "-v[verbose output]" \ + "-w[save old shared libraries before deinstall]" \ + "(-i)-f[always rebuild ports (overrides -i)]" \ + "(-f)-i[interactive update -- ask whether to rebuild ports]" \ + "(-d)-D[no cleaning of distfiles]" \ + "(-D)-d[always clean distfiles]" \ + "-m[arguments for the 'make' command line]:arguments for make: " \ + "-x[avoid building or updating ports that match this pattern]:glob pattern to exclude from building:->pkgs" \ + "--no-confirm[do not ask user to confirm list of ports to be installed and/or updated before proceeding]" \ + "--no-term-title[do not update the xterm title bar]" \ + "--no-index-fetch[skip fetching the INDEX file]" \ + "--index[use INDEX exclusively to check if a port is up to date]" \ + "--index-first[use the INDEX for status, but double-check with the port]" \ + "--index-only[do not try to use /usr/ports]" \ + "--show-work[list what ports are and would be installed]" \ + "-o[replace the installed port with a port from a different origin]:new port dir in /usr/ports:->ports" \ + "-r[rebuild port, and all ports that depend on it]:name/glob of port in /var/db/pkg:->pkgs" \ + "-R[used with -\[rf\] to skip ports updated on a previous run]" \ + "-a[check all ports, update as necessary]" \ + "--delete-build-only[delete ports that are build-only dependencies after a successful run]" \ + {-P,--packages}"[use packages, but build port if not available]" \ + {-PP,--packages-only}"[fail if no package is available]" \ + "--packages-build[use packages for all build dependencies]" \ + "--packages-if-newer[use package if newer than installed even if the package is not the latest]" \ + "--always-fetch[fetch package even if it already exists locally]" \ + "--local-packagedir=-[where local packages can be found]:path:_files -/" \ + "--packages-local[use packages from --local-packagedir only]" \ + "--delete-packages[after installing from a package, delete it]" \ + "-l[list all installed ports by category]" \ + "-L[list all installed ports by category, and search for updates]" \ + "-e[expunge a port via pkg_delete, and remove its distfiles]:full name of port directory in /var/db/pkg:->pkgs" \ + "-s[clean out stale ports that used to be depended on]" \ + "(-G)-F[fetch distfiles only]" \ + "--clean-distfiles[offer to delete stale distfiles]" \ + "--clean-distfiles-all[delete stale distfiles without prompting]" \ + "--check-depends[cross-check and update dependency information for all ports]" \ + "--check-port-dbdir[check for stale entries in /var/db/ports]" \ + "--list-origins[list directories from /usr/ports for root and leaf ports]" \ + "(-h --help)"{-h,--help}"[display help message]" \ + "--version[display the version number]" \ + '*:Packages and Ports:->pkgs_ports' + +case "$state" in + pkgs) + array=("${PKG_DBDIR:-/var/db/pkg}"/*(/:t)) + _describe -t packages "installed ports" array + ;; + ports) + _files -X "%Bports%b" -W "${PORTSDIR:-/usr/ports}" -/ + ;; + pkgs_ports) + _tags packages ports + while _tags; do + if _requested packages; then + array=("${PKG_DBDIR:-/var/db/pkg}"/*(/:t)) + _describe -t packages "installed ports" array && ret=0 + fi + if _requested ports; then + _files -X "%Bports%b" -W "${PORTSDIR:-/usr/ports}" -/ && ret=0 + fi + (( ret )) || return ret + done + ;; +esac From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 23:50:53 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AD77106566B; Fri, 6 Aug 2010 23:50:53 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E96E8FC14; Fri, 6 Aug 2010 23:50:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76NorF0068589; Fri, 6 Aug 2010 23:50:53 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76Norol068587; Fri, 6 Aug 2010 23:50:53 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008062350.o76Norol068587@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 23:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210982 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:50:53 -0000 Author: dougb Date: Fri Aug 6 23:50:52 2010 New Revision: 210982 URL: http://svn.freebsd.org/changeset/base/210982 Log: Add the sample rc file as it exists in portmaster.8 r210979 (ports version 2.32) Added: user/dougb/portmaster/files/portmaster.rc.sample.in (contents, props changed) Added: user/dougb/portmaster/files/portmaster.rc.sample.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/dougb/portmaster/files/portmaster.rc.sample.in Fri Aug 6 23:50:52 2010 (r210982) @@ -0,0 +1,92 @@ +# $FreeBSD$ +# +# Sample portmaster rc file. +# Place in $HOME/.portmasterrc or %%PREFIX%%/etc/portmaster.rc +# +# Do not create temporary backup packages before pkg_delete (-B) +# NO_BACKUP=Bopt +# +# Always save the backup packages of the old port (-b) +# BACKUP=bopt +# +# Make and save a package of the new port (-g) +# MAKE_PACKAGE=gopt +# +# Do not preclean the port's build directory (-C) +# DONT_PRE_CLEAN=Copt +# +# Do not clean the port's build directory after installation (-K) +# DONT_POST_CLEAN=Kopt +# +# Never search for stale distfiles to delete (-D) +# DONT_SCRUB_DISTFILES=Dopt +# +# Always delete stale distfiles without prompting (-d) +# ALWAYS_SCRUB_DISTFILES=dopt +# +# Do not run 'make config' for ports that need updating (-G) +# (This unsets --force-config) +# NO_RECURSIVE_CONFIG=Gopt +# +# Hide the build and install processes in a log file (-H) +# HIDE_BUILD=Hopt +# +# Arguments to pass to make (-m) +# PM_MAKE_ARGS='-DFORCE_PKG_REGISTER' +# +# Recurse through every dependency, and child dependencies (-t) +# RECURSE_THOROUGH=topt +# +# Be verbose (-v) +# PM_VERBOSE=vopt +# +# Save copies of old shared libraries (recommended) (-w) +# SAVE_SHARED=wopt +# +# Install a package if available (-P or --packages) +# PM_PACKAGES=first +# +# Only install packages (-PP or --packages-only) +# PM_PACKAGES=only +# +# Install packages for build-only dependencies (--packages-build) +# PM_PACKAGES_BUILD=pmp_build +# +# Delete build-only dependencies when finished (--delete-build-only) +# PM_DEL_BUILD_ONLY=pm_dbo +# +# Use packages if they are newer than installed (--packages-newer) +# PM_PACKAGES=newer +# PM_PACKAGES_NEWER=pmp_newer +# +# Always fetch new package files (--always-fetch) +# PM_ALWAYS_FETCH=pm_always_fetch +# +# Specify a local package repository (--local-packagedir) +# LOCAL_PACKAGEDIR= +# +# Only use packages from --local-packagedir (--packages-local) +# PM_PACKAGES_LOCAL=pmp_local +# +# Delete packages after they are installed (--delete-packages) +# PM_DELETE_PACKAGES=pm_delete_packages +# +# Suppress the build confirmation message (--no-confirm) +# PM_NO_CONFIRM=pm_no_confirm +# +# Do not update the xterm title bar (--no-term-title) +# PM_NO_TERM_TITLE=pm_no_term_title +# +# Do not fetch the INDEX file (--no-index-fetch) +# PM_NO_INDEX_FETCH=pm_no_index_fetch +# +# Use only the INDEX file to check if a port is out of date (--index) +# PM_INDEX=pm_index +# +# Use the INDEX file first, then check /usr/ports (--index-first) +# PM_INDEX=pm_index +# PM_INDEX_FIRST=pm_index_first +# +# Use the INDEX file instead of /usr/ports (--index-only) +# PM_INDEX=pm_index +# PM_INDEX_ONLY=pm_index_only From owner-svn-src-user@FreeBSD.ORG Fri Aug 6 23:52:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E5B81065673; Fri, 6 Aug 2010 23:52:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1FDE8FC12; Fri, 6 Aug 2010 23:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o76NqGpC068956; Fri, 6 Aug 2010 23:52:16 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o76NqGbF068954; Fri, 6 Aug 2010 23:52:16 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008062352.o76NqGbF068954@svn.freebsd.org> From: Doug Barton Date: Fri, 6 Aug 2010 23:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210983 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:52:17 -0000 Author: dougb Date: Fri Aug 6 23:52:16 2010 New Revision: 210983 URL: http://svn.freebsd.org/changeset/base/210983 Log: Sample rc file information moved to portmaster.rc.sample.in, r210982 Modified: user/dougb/portmaster/files/portmaster.8 Modified: user/dougb/portmaster/files/portmaster.8 ============================================================================== --- user/dougb/portmaster/files/portmaster.8 Fri Aug 6 23:50:52 2010 (r210982) +++ user/dougb/portmaster/files/portmaster.8 Fri Aug 6 23:52:16 2010 (r210983) @@ -593,102 +593,6 @@ support for .Pa /etc/portmaster.rc will be removed. .Pp -Here are examples of variables that are likely to be useful, -along with their related options. -.Pp -.Bd -literal -# Sample portmaster rc file. -# Place in $HOME/.portmasterrc or /usr/local/etc/portmaster.rc -# -# Do not create temporary backup packages before pkg_delete (-B) -# NO_BACKUP=Bopt -# -# Always save the backup packages of the old port (-b) -# BACKUP=bopt -# -# Make and save a package of the new port (-g) -# MAKE_PACKAGE=gopt -# -# Do not preclean the port's build directory (-C) -# DONT_PRE_CLEAN=Copt -# -# Do not clean the port's build directory after installation (-K) -# DONT_POST_CLEAN=Kopt -# -# Never search for stale distfiles to delete (-D) -# DONT_SCRUB_DISTFILES=Dopt -# -# Always delete stale distfiles without prompting (-d) -# ALWAYS_SCRUB_DISTFILES=dopt -# -# Do not run 'make config' for ports that need updating (-G) -# (This unsets --force-config) -# NO_RECURSIVE_CONFIG=Gopt -# -# Hide the build and install processes in a log file (-H) -# HIDE_BUILD=Hopt -# -# Arguments to pass to make (-m) -# PM_MAKE_ARGS='-DFORCE_PKG_REGISTER' -# -# Recurse through every dependency, and child dependencies (-t) -# RECURSE_THOROUGH=topt -# -# Be verbose (-v) -# PM_VERBOSE=vopt -# -# Save copies of old shared libraries (recommended) (-w) -# SAVE_SHARED=wopt -# -# Install a package if available (-P or --packages) -# PM_PACKAGES=first -# -# Only install packages (-PP or --packages-only) -# PM_PACKAGES=only -# -# Install packages for build-only dependencies (--packages-build) -# PM_PACKAGES_BUILD=pmp_build -# -# Delete build-only dependencies when finished (--delete-build-only) -# PM_DEL_BUILD_ONLY=pm_dbo -# -# Use packages if they are newer than installed (--packages-newer) -# PM_PACKAGES=newer -# PM_PACKAGES_NEWER=pmp_newer -# -# Always fetch new package files (--always-fetch) -# PM_ALWAYS_FETCH=pm_always_fetch -# -# Specify a local package repository (--local-packagedir) -# LOCAL_PACKAGEDIR= -# -# Only use packages from --local-packagedir (--packages-local) -# PM_PACKAGES_LOCAL=pmp_local -# -# Delete packages after they are installed (--delete-packages) -# PM_DELETE_PACKAGES=pm_delete_packages -# -# Suppress the build confirmation message (--no-confirm) -# PM_NO_CONFIRM=pm_no_confirm -# -# Do not update the xterm title bar (--no-term-title) -# PM_NO_TERM_TITLE=pm_no_term_title -# -# Do not fetch the INDEX file (--no-index-fetch) -# PM_NO_INDEX_FETCH=pm_no_index_fetch -# -# Use only the INDEX file to check if a port is out of date (--index) -# PM_INDEX=pm_index -# -# Use the INDEX file first, then check /usr/ports (--index-first) -# PM_INDEX=pm_index -# PM_INDEX_FIRST=pm_index_first -# -# Use the INDEX file instead of /usr/ports (--index-only) -# PM_INDEX=pm_index -# PM_INDEX_ONLY=pm_index_only -.Ed -.Pp .It Pa /var/db/pkg/*/+IGNOREME If this file exists for a port that is already installed, several things will happen: From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 02:19:19 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94251106566B; Sat, 7 Aug 2010 02:19:19 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8365D8FC0A; Sat, 7 Aug 2010 02:19:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o772JJaW001921; Sat, 7 Aug 2010 02:19:19 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o772JJMX001919; Sat, 7 Aug 2010 02:19:19 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008070219.o772JJMX001919@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 02:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210991 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 02:19:19 -0000 Author: dougb Date: Sat Aug 7 02:19:19 2010 New Revision: 210991 URL: http://svn.freebsd.org/changeset/base/210991 Log: Handle some of the long lines by introducing pm_v(), a function to echo messages conditionally based on $PM_VERBOSE, similar to pm_sv() Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sat Aug 7 02:11:41 2010 (r210990) +++ user/dougb/portmaster/portmaster Sat Aug 7 02:19:19 2010 (r210991) @@ -213,7 +213,7 @@ parent_exit () { echo "===>>> Deleting installed build-only dependencies" cd for f in $build_deps_il; do - [ -n "$PM_VERBOSE" ] && echo " $f" + pm_v " $f" pm_pkg_delete_s -f $f done echo '' @@ -413,6 +413,7 @@ pm_rm_s () { $PM_SU_CMD /bin/r pm_rmdir_s () { $PM_SU_CMD /bin/rmdir $*; } pm_unlink_s () { /bin/test -e $1 && $PM_SU_CMD /bin/unlink $1; } +pm_v () { [ -n "$PM_VERBOSE" ] && echo "$*"; } pm_sv () { [ -n "$PM_SU_VERBOSE" ] && echo "===>>> SU $*"; } #=============== End functions we always want to have =============== @@ -941,7 +942,7 @@ globstrip () { ports_by_category () { local pkg - [ -n "$PM_VERBOSE" ] && echo "===>>> Sorting ports by category" + pm_v "===>>> Sorting ports by category" for pkg in $pdb/*; do if [ -s "$pkg/+REQUIRED_BY" ]; then @@ -1216,16 +1217,15 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then [ -n "$PM_VERBOSE" ] && { print='-print'; echo ''; echo "===>>> Deleting empty directories (if any)"; } pm_find_s $port_dbdir -type d -empty $print -delete - [ -n "$PM_VERBOSE" ] && echo '' + pm_v for dir in ${port_dbdir}/*; do dbdir=${dir#$port_dbdir/} [ -n "$PM_VERBOSE" ] && echo -n "===>>> Checking ${dbdir}: " case "$unique_list" in - *:${dbdir}:*) [ -n "$PM_VERBOSE" ] && echo "Ok" ;; - *) [ -n "$PM_VERBOSE" ] && echo '' - echo '' + *:${dbdir}:*) pm_v "Ok" ;; + *) pm_v echo " ===>>> $dbdir does not seem to be installed" echo -n " ===>>> Delete ${dir}? y/n [n] " read answer @@ -1645,8 +1645,7 @@ find_and_delete_distfiles () { case "$distfiles" in *" ${file} "*) distfiles_checked="${distfiles_checked}${file}:" - [ -n "$PM_VERBOSE" ] && - echo "===>>> Keeping current distfile: $file" + pm_v "===>>> Keeping current distfile: $file" continue ;; # Do not delete current version *) if [ -e "$DI_FILES" ]; then grep -ql ${ps}$file $DI_FILES && continue @@ -1724,8 +1723,7 @@ delete_stale_distfiles () { case "$distfiles" in *" ${file} "*) distfiles_checked="${distfiles_checked}${file}:" - [ -n "$PM_VERBOSE" ] && - echo "===>>> Keeping current distfile: $file" + pm_v "===>>> Keeping current distfile: $file" continue ;; # Do not delete current version esac @@ -1751,8 +1749,7 @@ delete_stale_distfiles () { find_and_delete_distfiles $file done - [ -n "$PM_VERBOSE" ] && { - echo "===>>> Distfile cleaning complete" ; echo ''; } + pm_v "===>>> Distfile cleaning complete" ; pm_v } delete_all_distfiles () { @@ -1824,10 +1821,9 @@ delete_all_distfiles () { if [ -n "$LIST" -o -n "$LIST_PLUS" ]; then ports_by_category - [ -n "$PM_VERBOSE" ] && echo '' num_roots=0; num_trunks=0; num_branches=0; num_leaves=0; num_updates=0 - echo "===>>> Root ports (No dependencies, not depended on)" + pm_v ; echo "===>>> Root ports (No dependencies, not depended on)" for iport in $roots; do echo "===>>> $iport" [ -n "$LIST_PLUS" ] && check_for_updates list $iport @@ -2125,7 +2121,7 @@ update_port () { ($0 $ARGS $1) || fail "Update for $1 failed" . $IPC_SAVE else - [ -n "$PM_VERBOSE" ] && echo "===>>> Build canceled due to -n flag" + pm_v "===>>> Build canceled due to -n flag" fi if [ -n "$UPDATE_ALL" ]; then @@ -2215,8 +2211,8 @@ dependency_check () { else if [ -n "$SHOW_WORK" ]; then echo '' - elif [ -z "$PM_VERBOSE" ]; then - echo "===>>> Starting dependency check" + else + pm_v "===>>> Starting dependency check" fi fi @@ -2272,8 +2268,7 @@ dependency_check () { continue fi - [ -n "$PM_VERBOSE" ] && - echo "===>>> Checking dependency: $origin" + pm_v "===>>> Checking dependency: $origin" # Do this first to catch out of date dependencies [ -n "$PM_FIRST_PASS" ] && @@ -2599,8 +2594,7 @@ urb_final () { # Check here since if "no" it will not prompt check_interactive $req_by || continue - [ -n "$PM_VERBOSE" ] && - echo "===>>> $new_port is required by $req_by" + pm_v "===>>> $new_port is required by $req_by" check_exclude $req_by || continue # Shortcut, since check_for will force it @@ -2710,15 +2704,14 @@ all_first_pass () { local iport origin for iport in $@; do - [ -n "$PM_VERBOSE" ] && echo "===>>> $iport" + pm_v "===>>> $iport" case "$CUR_DEPS" in *:${iport}:*) continue ;; esac origin=`origin_from_pdb $iport` || { case "$?" in 3) ;; - 2) [ -z "$PM_VERBOSE" ] && - echo " ===>>> No ORIGIN for $iport, and +IGNOREME is present" + 2) pm_v " ===>>> No ORIGIN for $iport, and +IGNOREME is present" echo " ===>>> Skipping" echo '' ;; *) fail 'Cannot continue' ;; @@ -2752,16 +2745,16 @@ all_first_pass () { if [ -n "$PM_FIRST_PASS" ]; then [ -n "$FETCH_ONLY" ] && export ALL_FETCH=all_fetch - [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Root ports:"; } + pm_v ; pm_v "===>>> Root ports:" all_first_pass $roots - [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Trunk ports:"; } + pm_v ; pm_v "===>>> Trunk ports:" all_first_pass $trunks - [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Branch ports:"; } + pm_v ; pm_v "===>>> Branch ports:" all_first_pass $branches - [ -n "$PM_VERBOSE" ] && { echo '' ; echo "===>>> Leaf ports:"; } + pm_v ; pm_v "===>>> Leaf ports:" all_first_pass $leaves check_fetch_only @@ -2875,9 +2868,8 @@ if [ -n "$upg_port" -a -z "$portdir" ]; 3) echo '' echo "===>>> BSDPAN ports cannot be upgraded with portmaster" echo " (${upg_port})"; echo ''; safe_exit 1 ;; - 2) [ -z "$PM_VERBOSE" ] && { - echo " ===>>> No ORIGIN for $upg_port, and +IGNOREME is present"; - echo ''; }; safe_exit 1 ;; + 2) pm_v " ===>>> No ORIGIN for $upg_port, and +IGNOREME is present"; pm_v + safe_exit 1 ;; *) fail 'Cannot continue' ;; esac ; } elif [ -z "$portdir" ]; then @@ -3080,8 +3072,7 @@ if [ -n "$PM_FIRST_PASS" ]; then *:${req_by}:*) already_done $req_by continue ;; esac - [ -n "$PM_VERBOSE" ] && - echo "===>>> $upg_port is required by $req_by" + pm_v "===>>> $upg_port is required by $req_by" check_exclude $req_by || continue check_interactive $req_by || continue @@ -3135,7 +3126,7 @@ elif [ "$$" -eq "$PM_PARENT_PID" ]; then fi if [ -n "$NO_ACTION" -a -z "$PM_FIRST_PASS" ]; then - [ -n "$PM_VERBOSE" ] && echo "===>>> Build canceled due to -n flag" + pm_v "===>>> Build canceled due to -n flag" safe_exit fi @@ -3173,8 +3164,7 @@ fetch_package () { if [ -z "$PM_ALWAYS_FETCH" ]; then if [ -r "${ppd}/${1}.tbz" ]; then - [ -n "$PM_VERBOSE" ] && - echo "===>>> Package exists, skipping fetch" + pm_v "===>>> Package exists, skipping fetch" return 0 else do_fetch=1 @@ -3237,8 +3227,7 @@ fetch_package () { latest_pv=`readlink ${LOCAL_PACKAGEDIR}/Latest/${s}.tbz` latest_pv=${latest_pv##*/} else - [ -n "$PM_VERBOSE" ] && - echo "===>>> No local package for $new_port exists, attempting fetch" + pm_v "===>>> No local package for $new_port exists, attempting fetch" fi fi fi @@ -3296,15 +3285,13 @@ notnewer () { if [ "$latest_pv" = "$new_port" ]; then use_package=up_equal - [ -n "$PM_VERBOSE" ] && - echo "===>>> Available package ($latest_pv) matches the current version" + pm_v "===>>> Available package ($latest_pv) matches the current version" elif [ -n "$latest_pv" -a -n "$PM_PACKAGES_NEWER" ]; then if [ -n "$upg_port" ]; then case `pkg_version -t $upg_port $latest_pv` in \<) use_package=up_newer - [ -n "$PM_VERBOSE" ] && { - echo "===>>> Available package ($latest_pv)"; - echo " is newer than installed ($upg_port)"; } ;; + pm_v "===>>> Available package ($latest_pv)" + pm_v " is newer than installed ($upg_port)" ;; =) if [ -n "$PM_FORCE" ]; then use_package=up_force else @@ -3314,16 +3301,14 @@ notnewer () { esac else use_package=up_no_installed - [ -n "$PM_VERBOSE" ] && - echo "===>>> There is a package available ($latest_pv)" + pm_v "===>>> There is a package available ($latest_pv)" fi elif [ -n "$latest_pv" ]; then case `pkg_version -t $new_port $latest_pv` in \<) # Could happen if ports tree is out of date use_package=up_old_tree - [ -n "$PM_VERBOSE" ] && { - echo "===>>> Available package ($latest_pv)"; - echo " is newer than ports tree ($new_port)"; } ;; + pm_v "===>>> Available package ($latest_pv)" + pm_v " is newer than ports tree ($new_port)" ;; =) ;; # Should not be reached *) # Packages like autoconf-2.1* vs. 2.6* can be false neg. fetch_package $new_port try @@ -3489,8 +3474,7 @@ else echo "===>>> Installing package" if $PM_SU_CMD pkg_add --no-deps --force ${ppd}/${latest_pv}.tbz; then [ -n "$PM_DELETE_PACKAGES" ] && { - [ -n "$PM_VERBOSE" ] && - echo "===>>> Deleting ${latest_pv}.tbz"; + pm_v "===>>> Deleting ${latest_pv}.tbz" pm_unlink_s ${ppd}/${latest_pv}.tbz; } else install_failed ${latest_pv}.tbz @@ -3596,9 +3580,9 @@ fi check_dependency_files $portdir $new_port if [ -s "$grep_deps" ]; then echo "===>>> Updating dependency entry for $new_port in each dependent port" - [ -n "$PM_VERBOSE" ] && echo '' + pm_v while read d_port; do - [ -n "$PM_VERBOSE" ] && echo "===>>> $d_port" + pm_v "===>>> $d_port" dp_cont=$pdb/$d_port/+CONTENTS [ -e "$dp_cont" ] || continue @@ -3622,8 +3606,7 @@ if [ -s "$grep_deps" ]; then do_update=do_update2 fi if [ -n "$do_update" ]; then - [ -n "$PM_VERBOSE" ] && { echo ''; - echo " ===>>> Updating $new_port/+REQUIRED_BY"; } + pm_v ; pm_v " ===>>> Updating $new_port/+REQUIRED_BY" pm_install_s $grep_deps $pdb/$new_port/+REQUIRED_BY fi From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 19:27:37 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4B0E1065676; Sat, 7 Aug 2010 19:27:36 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D373F8FC13; Sat, 7 Aug 2010 19:27:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77JRaGs033640; Sat, 7 Aug 2010 19:27:36 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77JRaRU033638; Sat, 7 Aug 2010 19:27:36 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008071927.o77JRaRU033638@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 19:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211034 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 19:27:37 -0000 Author: dougb Date: Sat Aug 7 19:27:36 2010 New Revision: 211034 URL: http://svn.freebsd.org/changeset/base/211034 Log: Step 4 of the internal whitespace cleanup: * if/then/fi clauses with only 1 action get the && treatement * With multiple actions, they get real if/then/fi blocks (generally) * Re-wrap some of the heinously long lines [1] * Properly (4-space) indent lines continued after pipes [1] * Un-wrap some more short clauses (for, case, etc.) * Move the code to fetch distfiles from do_fetch() in line Tweaks to --clean-packages ========================== 1. Check first if a package matches an installed version and if not offer to delete it. 2. Sort the output of find 3. If there are empty directories to delete, notify the user, otherwise tell the user there is nothing to delete New Feature =========== Add the ability to ignore failed backup package creation by setting PM_IGNORE_FAILED_BACKUP_PACKAGE in the environment (rc file, etc.) General cleanups ================ 1. local'ize a couple more variables 2. Add some more tags to fi lines in long blocks 3. When taking user input, use a safer style of accepting the default answer. If the user types the matching option, or nothing, we accept it. Anything else, we don't. 4. Only run check_state() to see if a port is FORBIDDEN, etc. the first time through 5. In the package do_fetch, use meaninful strings for the flag variables instead of just 1 to make debugging easier Bug Fixes ========= 1. For the new logging feature, if $PM_LOG is not writable it needs to be unset so we don't try writing to it later; and fix one more \n from $INSTALLED_LIST 2. Inspired by: brucification [1] (thanks!) Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sat Aug 7 19:08:39 2010 (r211033) +++ user/dougb/portmaster/portmaster Sat Aug 7 19:27:36 2010 (r211034) @@ -14,11 +14,7 @@ if [ -z "$PM_PARENT_PID" ]; then # /usr/local is needed in the path for make PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin [ -e /usr/X11R6 -a ! -L /usr/X11R6 ] && PATH=$PATH:/usr/X11R6/bin - if [ -n "$CCACHE_PATH" ]; then - if [ -z "$NOCCACHE" ]; then - PATH="/usr/local/libexec/ccache:$PATH" - fi - fi + [ -n "$CCACHE_PATH" -a -z "$NOCCACHE" ] && PATH="/usr/local/libexec/ccache:$PATH" export PM_PARENT_PID TMPDIR UPGRADE_TOOL PATH if [ -r /etc/portmaster.rc ]; then @@ -77,7 +73,8 @@ trap_exit () { if [ "$$" -eq "$PM_PARENT_PID" ]; then local n=0 - while ps -axo pid,ppid,command | grep -v egrep | egrep -q "(make -DBATCH checksum|/fetch |\[sh\])"; do + while ps -axo pid,ppid,command | grep -v egrep | + egrep -q "(make -DBATCH checksum|/fetch |\[sh\])"; do # Protect from infinite loop if there is another fetch [ $n -gt 9 ] && break n=$(( $n + 1 )) @@ -90,9 +87,7 @@ trap_exit () { if [ -n "$logs" ]; then echo '' echo "===>>> Build/Install logs available:" - for file in $logs; do - echo " $file" - done + for file in $logs; do echo " $file"; done fi [ -n "$logs" ] && echo '' fi @@ -105,31 +100,27 @@ kill_bad_children () { mypgid=`ps -o pgid -p $PM_PARENT_PID` ; mypgid=${mypgid##*PGID[^0-9]} - ps -axo pid,ppid,pgid,command | sed '1d' | - while read pid ppid pgid command; do + ps -axo pid,ppid,pgid,command | sed '1d' | while read pid ppid pgid command; do [ "$pid" -gt 25 ] || continue case "$ppid" in 1) case "$command" in *" $0 "*) pm_kill $pid ;; - *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) - pm_kill -9 $pid ;; + *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill -9 $pid ;; esac ;; *) [ $pgid -eq $mypgid ] || continue case "$command" in *" $0 "*) [ $pid -ne $PM_PARENT_PID ] && pm_kill $pid ;; - *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) - pm_kill $pid ;; + *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill $pid ;; esac ;; esac done } parent_exit () { - local files f show_list + local files f DISCARD show_list + + [ -s "$DI_FILES" ] && { grep -q '%%%%%%%%%%%%' $DI_FILES || kill_bad_children; } - if [ -s "$DI_FILES" ]; then - grep -q '%%%%%%%%%%%%' $DI_FILES || kill_bad_children - fi [ -n "$FETCH_ONLY" -a -z "$FETCH_ONLY_DONE" ] && kill_bad_children if [ -z "$1" ]; then @@ -174,7 +165,7 @@ parent_exit () { if [ -n "$INSTALLED_LIST" ]; then if [ -n "$UPDATE_ALL" -o -n "$PM_MULTI_PORTS" ]; then show_list=all - elif [ -z "$show_list" ]; then + else case "$INSTALLED_LIST" in *\\n\\t*) show_list=all ;; *\\n) show_list=one @@ -189,21 +180,22 @@ parent_exit () { echo '' >> $PM_LOG elif [ -e "$PM_LOG" -a ! -w "$PM_LOG" ]; then echo "===>>> Warning: $PM_LOG exists, but is not writable" + unset PM_LOG elif [ -e "$PM_LOG" -o -L "$PM_LOG" ]; then echo "===>>> Warning: $PM_LOG exists, but is not a regular file" + unset PM_LOG else local new_pm_log - new_pm_log=`pm_mktemp pm_log` && - mv $new_pm_log $PM_LOG + new_pm_log=`pm_mktemp pm_log` && mv $new_pm_log $PM_LOG fi - date >> $PM_LOG + [ -n "$PM_LOG" ] && date >> $PM_LOG fi [ -n "$PM_SU_VERBOSE" ] && echo '' case "$show_list" in all) echo "===>>> The following actions were performed:" echo -e $INSTALLED_LIST - [ -n "$PM_LOG" ] && echo -e ${INSTALLED_LIST%\n} >> $PM_LOG ;; + [ -n "$PM_LOG" ] && echo -e ${INSTALLED_LIST%\\n} >> $PM_LOG ;; one) echo "===>>> $ilist complete" ; echo '' [ -n "$PM_LOG" ] && echo " $ilist" >> $PM_LOG ;; esac @@ -239,14 +231,10 @@ safe_exit () { # Do these here so +IGNOREME can modify them echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE echo "build_l='$build_l'" >> $IPC_SAVE - if [ -z "$NO_DEP_UPDATES" ]; then - echo 'unset NO_DEP_UPDATES' >> $IPC_SAVE - fi + [ -z "$NO_DEP_UPDATES" ] && echo 'unset NO_DEP_UPDATES' >> $IPC_SAVE fi - [ -z "$NO_BACKUP" -a -z "$BACKUP" ] && - echo "NB_DELETE='$NB_DELETE'" >> $IPC_SAVE - [ -n "$PM_MULTI_BUILT" ] && - echo "PM_MULTI_BUILT='$PM_MULTI_BUILT'" >> $IPC_SAVE + [ -z "$NO_BACKUP" -a -z "$BACKUP" ] && echo "NB_DELETE='$NB_DELETE'" >> $IPC_SAVE + [ -n "$PM_MULTI_BUILT" ] && echo "PM_MULTI_BUILT='$PM_MULTI_BUILT'" >> $IPC_SAVE if [ -n "$INTERACTIVE_UPDATE" ]; then echo "INTERACTIVE_YES='$INTERACTIVE_YES'" >> $IPC_SAVE echo "INTERACTIVE_NO='$INTERACTIVE_NO'" >> $IPC_SAVE @@ -402,8 +390,7 @@ pm_unlink () { /bin/test -e $1 && /bin/u # truncate, pkg_create, cp, /etc/rc.d/ldconfig, touch pm_find_s () { $PM_SU_CMD /usr/bin/find $*; } -pm_install_s () { $PM_SU_CMD /usr/bin/install -o root \ - -g wheel -m 644 $1 $2; } +pm_install_s () { $PM_SU_CMD /usr/bin/install -o root -g wheel -m 644 $1 $2; } pm_make_s () { ( unset -v CUR_DEPS INSTALLED_LIST PM_DEPTH build_l; unset -v MASTER_RB_LIST PM_FP_SEEN_LIST; $PM_SU_CMD /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS $*; ); } @@ -604,10 +591,10 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then fi export pd pdb - if [ -z "$DISTDIR" -a "$PM_PACKAGES" != only -a -z "$CHECK_DEPENDS" -a \ - -z "$CHECK_PORT_DBDIR" -a -z "$LIST_ORIGINS" ]; then + [ -z "$DISTDIR" -a "$PM_PACKAGES" != only -a -z "$CHECK_DEPENDS" -a \ + -z "$CHECK_PORT_DBDIR" -a -z "$LIST_ORIGINS" ] && DISTDIR=`pm_make_b -f/usr/share/mk/bsd.port.mk -V DISTDIR 2>/dev/null` - fi + [ -n "$DISTDIR" ] && { DISTDIR="${DISTDIR%/}/"; export DISTDIR; } [ -z "$port_dbdir" -a -d /var/db/ports ] && port_dbdir=/var/db/ports @@ -641,6 +628,7 @@ iport_from_origin () { origin_from_pdb () { local o + o=`grep -m1 '@comment ORIGIN:' $pdb/$1/+CONTENTS 2>/dev/null` && { echo ${o#@comment ORIGIN:}; return 0; } @@ -681,8 +669,7 @@ check_dependency_files () { origin=$1 ; iport=$2 # egrep hates + in file names - case "$origin" in *+*) - origin=`echo $origin | sed 's#\+#\\\\+#g'` ;; esac + case "$origin" in *+*) origin=`echo $origin | sed 's#\+#\\\\+#g'` ;; esac case "$ro_opd" in '') ro_opd=a/a ;; *+*) ro_opd=`echo $ro_opd | sed 's#\+#\\\\+#g'` ;; esac @@ -690,7 +677,7 @@ check_dependency_files () { # Always rely on the grep'ed dependencies instead of +REQUIRED_BY grep_deps=`pm_mktemp grep-deps-${iport}` egrep -l "DEPORIGIN:($origin|$ro_opd)$" $pdb/*/+CONTENTS | - strip_to_iport | sort -u > $grep_deps + strip_to_iport | sort -u > $grep_deps if [ ! -s "$grep_deps" ]; then if [ -s "$pdb/$iport/+REQUIRED_BY" ]; then @@ -813,11 +800,11 @@ find_moved_port () { ${sf}\|\|*) [ -n "$iport" ] || iport=`iport_from_origin $sf` if [ -e "$pdb/$iport/+IGNOREME" ]; then if [ -n "$PM_VERBOSE" ]; then - echo '' - echo " ===>>> The $sf port has been deleted" - echo " ===>>> Reason: ${l##*|}" - echo " ===>>> Skipping it due to +IGNOREME file" - echo '' + echo '' + echo " ===>>> The $sf port has been deleted" + echo " ===>>> Reason: ${l##*|}" + echo " ===>>> Skipping it due to +IGNOREME file" + echo '' fi return 0 else @@ -846,11 +833,7 @@ find_moved_port () { echo '' [ -n "$iport" ] || iport=`iport_from_origin $sf` - if [ -e "$pdb/$iport/+IGNOREME" ]; then - return 0 - else - return 1 - fi + [ -e "$pdb/$iport/+IGNOREME" ] || return 1 fi return 0 } @@ -1057,8 +1040,8 @@ if [ -n "$CLEAN_DISTFILES" ]; then echo -n "===>>> Delete stale file: ${f}? y/n [y] " read answer case "$answer" in - [nN]*) continue ;; - *) pm_unlink $df ;; + [yY]|'') pm_unlink $df ;; + *) continue ;; esac fi fi @@ -1071,10 +1054,21 @@ fi if [ -n "$CLEAN_PACKAGES" ]; then init_packages_var - echo "===>>> Checking for stale packages" + echo "===>>> Checking for stale packages"; echo '' for package in `find $PACKAGES -type f | sort`; do - origin=`tar -O -zxvf $package '+CONTENTS' 2>/dev/null | grep '@comment ORIGIN:'` || { - fail Empty origin in $package; } + pkg_dir=${package##*/} ; pkg_dir=${pkg_dir%\.tbz} + if [ ! -d "${pdb}/${pkg_dir}" ]; then + echo "===>>> ${package##*/} is not currently installed" + echo -n " ===>>> Delete? y/n [y] " + read answer + case "$answer" in + [yY]|'') echo " ===>>> Deleting $package" + pm_unlink_s $package ; continue ;; + esac + fi + + origin=`tar -O -zxvf $package '+CONTENTS' 2>/dev/null | grep '@comment ORIGIN:'` || + fail Empty origin in $package origin=${origin#@comment ORIGIN:} if [ -z "$PM_INDEX" ]; then @@ -1100,7 +1094,7 @@ if [ -n "$CLEAN_PACKAGES" ]; then echo "===>>> Package version: ${package##*/} Latest version: $port_ver" - if [ -d "${pdb}/${package##*/}" ]; then + if [ -d "${pdb}/${pkg_dir}" ]; then echo " ===>>> ${package##*/} matches the installed version" else echo " ===>>> ${package##*/} is out of date" @@ -1113,28 +1107,36 @@ if [ -n "$CLEAN_PACKAGES" ]; then echo -n " ===>>> Delete stale package: ${package##*/}? y/n [y] " read answer case "$answer" in - [nN]*) continue ;; + [yY]|'') echo " ===>>> Deleting $package" + pm_unlink_s $package ;; esac fi - echo " ===>>> Deleting $package" - pm_unlink_s $package done echo '' ; echo "===>>> Deleting stale symlinks" pm_cd $PACKAGES || fail "Cannot cd to $PACKAGES" - for link in `find . -type l` ; do + for link in `find . -type l | sort` ; do if [ ! -e "$link" ]; then echo " ===>>> ${link#./}" $PM_SU_CMD /bin/unlink $link fi done - echo '' ; echo "===>>> Deleting empty directories (if any)" - pm_find_s . -type d -empty -delete + echo '' + empty_dirs=`find . -type d -empty -print | sort` + if [ -n "$empty_dirs" ]; then + echo "===>>> Deleting empty directories" + for dir in $empty_dirs; do + echo " ===>>> ${dir#\.\/}" + done + pm_find_s . -type d -empty -delete + else + echo "===>>> No empty directories in $PACKAGES" + fi safe_exit -fi +fi # [ -n "$CLEAN_PACKAGES" ] if [ -n "$CHECK_DEPENDS" ]; then d_orig_ok=':' @@ -1147,9 +1149,10 @@ IFS=' echo "===>>> Checking $iport" - [ -r "$pkg/+CONTENTS" ] || { - echo " ===>>> Warning: No +CONTENTS file!"; - continue; } + if [ ! -r "$pkg/+CONTENTS" ]; then + echo " ===>>> Warning: No +CONTENTS file!" + continue + fi origin=`origin_from_pdb $iport` || continue @@ -1174,8 +1177,7 @@ IFS=' pm_install_s $grep_deps $pkg/+REQUIRED_BY fi fi - [ -n "$grep_deps" ] && { - pm_unlink $grep_deps && unset grep_deps; } + [ -n "$grep_deps" ] && { pm_unlink $grep_deps && unset grep_deps; } update_contents $pkg/+CONTENTS done @@ -1205,9 +1207,10 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then origin=$moved_npd fi - pm_cd $pd/$origin || { - echo " ===>>> $pd/$origin does not exist for $pkg"; - continue; } + if ! pm_cd $pd/$origin; then + echo " ===>>> $pd/$origin does not exist for $pkg" + continue + fi unique_name=`make -V UNIQUENAME` unique_list="${unique_list}${unique_name}:" done @@ -1420,8 +1423,8 @@ check_for_updates () { if [ -d "$pd/$origin" -a -z "$do_update" -a -z "$skip" ]; then if ! pm_cd $pd/$origin; then if [ -e "$pdb/$iport/+IGNOREME" ]; then - echo " ===>>> Warning: Unable to cd to $pd/$origin" - echo " ===>>> Continuing due to $pdb/$iport/+IGNOREME" + echo " ===>>> Warning: Unable to cd to $pd/$origin" + echo " ===>>> Continuing due to $pdb/$iport/+IGNOREME" return 0 else fail "Cannot cd to port directory: $pd/$origin" @@ -1449,8 +1452,7 @@ check_for_updates () { udf="$pdb/$iport/PM_UPGRADE_DONE_FLAG" if [ "$iport" = "$port_ver" ]; then if [ -n "$PM_FORCE" ]; then - check_restart_and_udf $udf $iport || - do_update=do_update_force + check_restart_and_udf $udf $iport || do_update=do_update_force elif [ -n "$URB_YES" ]; then case "$MASTER_RB_LIST" in *" $iport "*) if ! check_restart_and_udf $udf $iport; then @@ -1475,8 +1477,7 @@ check_for_updates () { fi fi - [ -z "$do_update" ] && { - CUR_DEPS="${CUR_DEPS}${iport}:${origin}:" ; return 0; } + [ -z "$do_update" ] && { CUR_DEPS="${CUR_DEPS}${iport}:${origin}:" ; return 0; } if [ -n "$list_only" ]; then if [ -z "$moved_npd" ]; then @@ -1520,7 +1521,7 @@ init_packages () { } pm_pkg_create () { - local pkgdir + local pkgdir backup init_packages @@ -1534,6 +1535,7 @@ pm_pkg_create () { else pkgdir=$1 ; echo '' echo "===>>> Creating a backup package for old version $2" + backup=backup fi pm_cd $pkgdir || fail "Cannot cd into $pkgdir to create a package" @@ -1565,13 +1567,16 @@ pm_pkg_create () { echo '' echo "===>>> Package creation failed for ${2}!" echo '' + + [ -n "$backup" -a -n "$PM_IGNORE_FAILED_BACKUP_PACKAGE" ] && return + echo "===>>> Ignore this error [i]" echo "===>>> Abort [a]" echo '' echo -n "===>>> How would you like to proceed? [i] " local answer ; read answer case "$answer" in - a) fail "Package creation failed for $2" ;; + [aA]) fail "Package creation failed for $2" ;; esac fi } @@ -1921,7 +1926,7 @@ if [ -n "$CLEAN_STALE" ]; then deplist=`grep -l DEPORIGIN:$origin$ $pdb/*/+CONTENTS` if [ -n "$deplist" ]; then echo '' - echo "===>>> Warning: Unrecorded dependencies on ${iport}:" + echo "===>>> Warning: Unrecorded dependencies on ${iport}:" for dep in $deplist; do dep=${dep%/+CON*} ; echo " ${dep##*/}" done @@ -1937,8 +1942,7 @@ if [ -n "$CLEAN_STALE" ]; then read answer case "$answer" in [yY]) [ -n "$BACKUP" ] && { init_packages ; pm_pkg_create $pbu $iport; } - [ -z "$DONT_SCRUB_DISTFILES" ] && - delete_all_distfiles $origin + [ -z "$DONT_SCRUB_DISTFILES" ] && delete_all_distfiles $origin delete_dist_list echo "===>>> Running pkg_delete -f $iport" @@ -1999,8 +2003,8 @@ check_interactive () { echo '' ; echo -n "===>>> Update ${1}${update_to}? y/n [y] " local answer ; read answer case "$answer" in - [nN]*) INTERACTIVE_NO="${INTERACTIVE_NO}${1}:" ; return 1 ;; - *) INTERACTIVE_YES="${INTERACTIVE_YES}${1}:" ;; + [yY]|'') INTERACTIVE_YES="${INTERACTIVE_YES}${1}:" ;; + *) INTERACTIVE_NO="${INTERACTIVE_NO}${1}:" ; return 1 ;; esac return 0 } @@ -2013,12 +2017,12 @@ check_exclude () { for pat in $PM_EXCL; do case "$1" in *${pat}*) - if [ -n "$PM_VERBOSE" ]; then - echo "===>>> Skipping $1" - echo " because it matches the pattern: *${pat}*" - echo '' - fi - return 1 ;; + if [ -n "$PM_VERBOSE" ]; then + echo "===>>> Skipping $1" + echo " because it matches the pattern: *${pat}*" + echo '' + fi + return 1 ;; esac done @@ -2109,9 +2113,7 @@ update_port () { echo " ${PM_DEPTH}>> ${1#$pd/}" term_printf " ${PM_DEPTH#* }>> ${1#$pd/}${deps}" else - if [ -n "$UPDATE_ALL" ]; then - term_printf " >> ${1#$pd/}${deps}" - fi + [ -n "$UPDATE_ALL" ] && term_printf " >> ${1#$pd/}${deps}" fi [ -n "$doing_dep_check" -o \( -n "$UPDATE_ALL" -a -n "$PM_FIRST_PASS" \) ] && @@ -2131,7 +2133,7 @@ update_port () { elif [ -n "$UPDATE_REQ_BYS" ]; then return 0 elif [ -n "$PM_FIRST_PASS" -a -z "$PM_PACKAGES" ]; then - echo "===>>> Continuing initial dependency check for $portdir" + echo "===>>> Continuing initial dependency check for $portdir" else term_printf " ${PM_DEPTH#* }${deps}" echo "===>>> Returning to dependency check for $portdir" @@ -2176,7 +2178,7 @@ gen_dep_list () { case "$*" in 'build-depends-list run-depends-list'|all-depends-list) - temp_list="`parse_index $portdir b-deps` `parse_index $portdir r-deps`" ;; + temp_list="`parse_index $portdir b-deps` `parse_index $portdir r-deps`" ;; build-depends-list) temp_list=`parse_index $portdir b-deps` ;; run-depends-list) temp_list=`parse_index $portdir r-deps` ;; esac @@ -2303,11 +2305,7 @@ dependency_check () { # In case d_port changed above origin="${d_port#$pd/}" ; iport=`iport_from_origin ${origin}` - if [ -n "$iport" ]; then - check_exclude $iport || continue - else - check_exclude $origin || continue - fi + check_exclude ${iport:-$origin} || continue udf="$pdb/$iport/PM_UPGRADE_DONE_FLAG" if [ -n "$PM_FORCE" -a -n "$iport" ]; then @@ -2404,7 +2402,8 @@ post_first_pass () { echo -n "===>>> Proceed? y/n [y] " read answer case "$answer" in - [nN]*) echo '' + [yY]|'') ;; + *) echo '' echo "===>>> If you would like to upgrade or install some, but not" echo " all of the above try adding '-i' to the command line." safe_exit 1 ;; @@ -2422,9 +2421,7 @@ post_first_pass () { action='build and/or install' fi - echo '' - echo "===>>> Starting $action for $* <<<===" - echo '' + echo ''; echo "===>>> Starting $action for $* <<<==="; echo '' unset PM_FP_SEEN_LIST PM_FIRST_PASS PM_NO_CONFIRM @@ -2445,7 +2442,7 @@ post_first_pass () { done [ "$real_rundep" = 'no' ] && - eval build_only_dl_g=\"${build_only_dl_g}\$${var}_p \" + eval build_only_dl_g=\"${build_only_dl_g}\$${var}_p \" eval unset $var ${var}_p done @@ -2478,7 +2475,7 @@ multiport () { local port worklist_temp worklist portlist numports num # Expand globs and check that the directories exist - for port in $@; do + for port in "$@"; do port=${port#$pdb/} case "$port" in */*) port=${port#$pd/} @@ -2524,8 +2521,7 @@ multiport () { for port in $worklist; do case "$port" in */*) run_dl_g="$run_dl_g ${pd}/${port} " ;; - *) - run_dl_g="$run_dl_g ${pd}/`origin_from_pdb $port` " ;; + *) run_dl_g="$run_dl_g ${pd}/`origin_from_pdb $port` " ;; esac done fi @@ -2576,7 +2572,6 @@ make_config () { urb_final () { # Global: URB_YES - local req_by export URB_YES=urb_yes_final @@ -2692,7 +2687,7 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S [ -z "$DONT_SCRUB_DISTFILES" -a -z "$FETCH_ONLY" -a -z "$PM_PACKAGES" ] && export DI_FILES=`pm_mktemp DI-FILES` - [ $# -gt 1 -a -z "$REPLACE_ORIGIN" ] && multiport $@ + [ $# -gt 1 -a -z "$REPLACE_ORIGIN" ] && multiport "$@" elif [ -z "$SHOW_WORK" ]; then # Zero out this file so that we can save our data to it safely > $IPC_SAVE @@ -2703,7 +2698,7 @@ if [ -n "$UPDATE_ALL" ]; then all_first_pass () { local iport origin - for iport in $@; do + for iport in "$@"; do pm_v "===>>> $iport" case "$CUR_DEPS" in *:${iport}:*) continue ;; esac @@ -2798,10 +2793,10 @@ all_first_pass () { echo "===>>> Update check of installed ports complete" ; echo '' safe_exit -fi +fi # [ -n "$UPDATE_ALL" ] no_valid_port () { - echo "===>>> No valid installed port, or port directory given"; + echo "===>>> No valid installed port, or port directory given" echo "===>>> Try ${0##*/} --help" ; echo '' ; safe_exit 1 } @@ -2830,9 +2825,11 @@ if [ -z "$REPLACE_ORIGIN" ]; then fi else portdir="${1#$pd/}" ; portdir="${portdir%/}" - [ -d "$pd/$portdir" ] || { echo '' + if [ ! -d "$pd/$portdir" ]; then + echo '' echo "===>>> The first argument to -o must be a directory in $pd" - echo '' ; no_valid_port; } + echo '' ; no_valid_port + fi upg_port=`iport_from_origin $portdir` @@ -2865,8 +2862,7 @@ fi if [ -n "$upg_port" -a -z "$portdir" ]; then portdir=`origin_from_pdb $upg_port` || { case "$?" in - 3) echo '' - echo "===>>> BSDPAN ports cannot be upgraded with portmaster" + 3) echo ''; echo "===>>> BSDPAN ports cannot be upgraded with portmaster" echo " (${upg_port})"; echo ''; safe_exit 1 ;; 2) pm_v " ===>>> No ORIGIN for $upg_port, and +IGNOREME is present"; pm_v safe_exit 1 ;; @@ -2900,7 +2896,7 @@ if [ -e "$pdb/$upg_port/+IGNOREME" ]; th read answer case "$answer" in [yY]) ;; # Let it build - *) CUR_DEPS="${CUR_DEPS}${upg_port}:${portdir}:" + *) CUR_DEPS="${CUR_DEPS}${upg_port}:${portdir}:" if [ $dep_of_deps -gt 0 ]; then dep_of_deps=$(( $dep_of_deps - 1 )) if [ -n "$PM_FIRST_PASS" ]; then @@ -2943,8 +2939,7 @@ fi if [ -n "$PM_FIRST_PASS" -a "$$" -eq "$PM_PARENT_PID" ]; then if [ -n "$upg_port" ]; then update_build_l $upg_port - [ -n "$UPDATE_REQ_BYS" -a -n "$RESTART" ] && - check_for_updates $upg_port + [ -n "$UPDATE_REQ_BYS" -a -n "$RESTART" ] && check_for_updates $upg_port else update_build_l $portdir fi @@ -2957,29 +2952,16 @@ echo '' if [ -z "$PM_INDEX_ONLY" ]; then echo "===>>> Port directory: $pd/$portdir" - check_state || { - echo " ===>>> If you are sure you can build it, remove the"; - echo " $state line in the Makefile and try again."; - safe_exit 1; } - - # Do not start this in the background until we are sure we are going to build - [ "$$" -eq "$PM_PARENT_PID" -a -n "$DI_FILES" ] && { echo ''; (read_distinfos)& } - # Do these things first time through if [ -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ]; then - dofetch () { - local fetchlog allfiles + if ! check_state; then + echo " ===>>> If you are sure you can build it, remove the" + echo " $state line in the Makefile and try again." + safe_exit 1 + fi - echo "===>>> Launching 'make checksum' for $portdir in background" - fetchlog=`pm_mktemp fetchlog-${portdir#*/}` - (pm_make -DBATCH checksum >> $fetchlog 2>&1 && { - rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.*; exit 0; } - allfiles=`pm_make -V ALLFILES` - pm_make delete-distfiles RESTRICTED_FILES="${allfiles}" >> $fetchlog 2>&1 && - echo "===>>> RE-STARTING FETCH <<<===" >> $fetchlog - pm_make -DBATCH checksum >> $fetchlog 2>&1; \ - rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.* )& - } + # Do not start this in the background until we are sure we are going to build + [ "$$" -eq "$PM_PARENT_PID" -a -n "$DI_FILES" ] && { echo ''; (read_distinfos)& } # Handle the problem of manual fetching [ -z "$PM_PACKAGES" ] && master_sites=`pm_make_b -V MASTER_SITES` @@ -3003,9 +2985,20 @@ if [ -z "$PM_INDEX_ONLY" ]; then fi done - [ -z "$DONT_FETCH" -a -n "$distfiles" ] && dofetch + if [ -z "$DONT_FETCH" -a -n "$distfiles" ]; then + echo "===>>> Launching 'make checksum' for $portdir in background" + fetchlog=`pm_mktemp fetchlog-${portdir#*/}` + (pm_make -DBATCH checksum >> $fetchlog 2>&1 && { + rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.*; exit 0; } + allfiles=`pm_make -V ALLFILES` + pm_make delete-distfiles RESTRICTED_FILES="${allfiles}" \ + >> $fetchlog 2>&1 && + echo "===>>> RE-STARTING FETCH <<<===" >> $fetchlog + pm_make -DBATCH checksum >> $fetchlog 2>&1 + rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.* )& + fi + unset master_sites distfiles file DONT_FETCH fetchlog allfiles fi - unset master_sites distfiles file DONT_FETCH if [ -z "$FETCH_ONLY" -a ! "$PM_PACKAGES" = only ]; then TESTINT=`grep -l ^IS_INTERACTIVE Makefile` @@ -3022,7 +3015,7 @@ if [ -z "$PM_INDEX_ONLY" ]; then echo '' unset TESTINT DISCARD fi - fi + fi # [ -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ] fi # [ -z "$PM_INDEX_ONLY" ] if [ -n "$PM_FIRST_PASS" ]; then @@ -3083,7 +3076,7 @@ if [ -n "$PM_FIRST_PASS" ]; then else check_for_updates $req_by || fail 'Update failed' fi - echo "===>>> Returning to check of ports depending on $upg_port" + echo "===>>> Returning to check of ports depending on $upg_port" done echo '' echo "===>>> Done checking ports that depend on $upg_port" @@ -3102,8 +3095,8 @@ fi # [ -n "$PM_FIRST_PASS" ] if [ -n "$PM_BUILD_ONLY_LIST" ]; then case "$build_only_dl_g" in *" $pd/$portdir "*) - [ -n "$PM_PACKAGES_BUILD" ] && PM_PACKAGES_BUILD=doing_build_only_dep - [ -n "$PM_DEL_BUILD_ONLY" ] && PM_DEL_BUILD_ONLY=doing_build_only_dep ;; + [ -n "$PM_PACKAGES_BUILD" ] && PM_PACKAGES_BUILD=doing_build_only_dep + [ -n "$PM_DEL_BUILD_ONLY" ] && PM_DEL_BUILD_ONLY=doing_build_only_dep ;; *) [ -n "$PM_PACKAGES_BUILD" ] && PM_PACKAGES_BUILD=pmp_build [ -n "$PM_DEL_BUILD_ONLY" ] && PM_DEL_BUILD_ONLY=pm_dbo ;; esac @@ -3134,8 +3127,7 @@ if [ -z "$new_port" ]; then if [ -z "$PM_INDEX_ONLY" ]; then new_port=`pm_make -V PKGNAME` else - new_port=`parse_index $portdir name` || - fail "No INDEX entry for $origin" + new_port=`parse_index $portdir name` || fail "No INDEX entry for $origin" fi fi @@ -3151,10 +3143,7 @@ fetch_package () { export ppd fi - if [ ! -d "$ppd" ]; then - pm_sv Creating $ppd - pm_mkdir_s $ppd - fi + [ -d "$ppd" ] || { pm_sv Creating $ppd; pm_mkdir_s $ppd; } if [ -z "$FETCH_ARGS" ]; then FETCH_ARGS=`pm_make -f/usr/share/mk/bsd.port.mk -V FETCH_ARGS 2>/dev/null` @@ -3167,10 +3156,10 @@ fetch_package () { pm_v "===>>> Package exists, skipping fetch" return 0 else - do_fetch=1 + do_fetch=do_fetch_no_package fi else - do_fetch=1 + do_fetch=do_fetch_always_fetch fi if [ -n "$do_fetch" ]; then @@ -3183,9 +3172,10 @@ fetch_package () { fi pm_sv Fetching ${1}.tbz - $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.tbz 2>/dev/null || { - pm_unlink_s ${ppd}/${1}.tbz; - $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.tbz 2>/dev/null; } + if ! $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.tbz 2>/dev/null; then + pm_unlink_s ${ppd}/${1}.tbz + $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.tbz 2>/dev/null + fi fi } if [ -z "$PACKAGESITE" -a -z "$PM_PACKAGES_LOCAL" ]; then @@ -3220,14 +3210,14 @@ fetch_package () { local_package=${LOCAL_PACKAGEDIR}/All/${new_port}.tbz latest_pv=${local_package##*/} fi - if [ -z "$latest_pv" -a -z "$PM_INDEX_ONLY" ]; then + if [ -z "$latest_pv" -a -z "$PM_INDEX_ONLY" ]; then s=`pm_make -V LATEST_LINK` if [ -r "${LOCAL_PACKAGEDIR}/Latest/${s}.tbz" ]; then local_package=${LOCAL_PACKAGEDIR}/Latest/${s}.tbz latest_pv=`readlink ${LOCAL_PACKAGEDIR}/Latest/${s}.tbz` latest_pv=${latest_pv##*/} else - pm_v "===>>> No local package for $new_port exists, attempting fetch" + pm_v "===>>> No local package for ${new_port}, attempting fetch" fi fi fi @@ -3238,7 +3228,7 @@ fetch_package () { pm_unlink $dirlist # JIC dirlist=`pm_mktemp dl-${portdir%/*}` fetch -q -o - ${sitepath} 2>/dev/null | - sed -e "s#%2[cC]#,#g" -e "s#%2[bB]#+#g" > $dirlist + sed -e "s#%2[cC]#,#g" -e "s#%2[bB]#+#g" > $dirlist fi for s in ${new_port%\.*} ${new_port%%\.*} ${new_port%-*}; do @@ -3248,12 +3238,8 @@ fetch_package () { fi unset dirlist s - if [ -z "$latest_pv" -a -z "$PM_PACKAGES_LOCAL" ]; then - fetch_package $new_port try - if [ $? -eq 0 ]; then - latest_pv=$new_port - fi - fi + [ -z "$latest_pv" -a -z "$PM_PACKAGES_LOCAL" ] && { + fetch_package $new_port try && latest_pv=$new_port; } ponly_err="Try --packages-if-newer, or do not use -PP/--packages-only" @@ -3261,9 +3247,7 @@ fetch_package () { echo "===>>> Package and/or archive not found at:" if [ -n "$LOCAL_PACKAGEDIR" ]; then echo " $LOCAL_PACKAGEDIR" - if [ -z "$PM_PACKAGES_LOCAL" ]; then - echo ' or' - fi + [ -z "$PM_PACKAGES_LOCAL" ] && echo ' or' fi [ -z "$PM_PACKAGES_LOCAL" ] && echo " ${sitepath}" echo '' @@ -3282,7 +3266,6 @@ notnewer () { unset local_package } - if [ "$latest_pv" = "$new_port" ]; then use_package=up_equal pm_v "===>>> Available package ($latest_pv) matches the current version" @@ -3372,7 +3355,7 @@ if [ -z "$use_package" ]; then sleep=$(( $sleep + 1 )) fi done - unset sleep + unset sleep fl_read if [ -n "$HIDE_BUILD" ]; then port_log=`mktemp -t port_log-${PM_PARENT_PID}-${portdir#*/}` || @@ -3399,10 +3382,12 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" if [ -n "$SAVE_SHARED" ]; then ldconfig_out=`pm_mktemp ldconfig` - ldconfig -r | sed 's#.* ##' | grep -v ^$LOCALBASE_COMPAT > $ldconfig_out + ldconfig -r | sed 's#.* ##' | + grep -v ^$LOCALBASE_COMPAT > $ldconfig_out unset temp - for file in `pkg_info -q -L $UPGRADE_PORT | sort - $ldconfig_out | uniq -d`; do + for file in `pkg_info -q -L $UPGRADE_PORT | + sort - $ldconfig_out | uniq -d`; do temp="${temp}$file " done if [ -n "$temp" ]; then @@ -3459,10 +3444,10 @@ install_failed () { if [ -z "$use_package" ]; then pm_sv Running make install - if [ -n "$PM_SU_UNSET_PORT_LOG_ARGS" ]; then - unset port_log_args - else + if [ -z "$PM_SU_UNSET_PORT_LOG_ARGS" ]; then [ -n "$HIDE_BUILD" ] && echo "===>>> Logging install to $port_log" + else + unset port_log_args fi # Defining NO_DEPENDS ensures that we will control the installation @@ -3473,9 +3458,10 @@ else echo "===>>> Installing package" if $PM_SU_CMD pkg_add --no-deps --force ${ppd}/${latest_pv}.tbz; then - [ -n "$PM_DELETE_PACKAGES" ] && { + if [ -n "$PM_DELETE_PACKAGES" ]; then pm_v "===>>> Deleting ${latest_pv}.tbz" - pm_unlink_s ${ppd}/${latest_pv}.tbz; } + pm_unlink_s ${ppd}/${latest_pv}.tbz + fi else install_failed ${latest_pv}.tbz fi @@ -3491,8 +3477,8 @@ temp=`find $LOCALBASE_COMPAT -type d -em if [ -z "$temp" -a -d "$LOCALBASE_COMPAT" ]; then unset files for file in `pkg_info -q -L $new_port`; do - [ -f "${LOCALBASE_COMPAT}/${file##*/}" ] && { - files="${files}${LOCALBASE_COMPAT}/${file##*/} "; } + [ -f "${LOCALBASE_COMPAT}/${file##*/}" ] && + files="${files}${LOCALBASE_COMPAT}/${file##*/} " done if [ -n "$files" ]; then @@ -3541,7 +3527,8 @@ if [ -n "$distfiles" ]; then size=`grep "^SIZE (${ds}${file})" $distinfo` sha256=`grep "^SHA256 (${ds}${file})" $distinfo` md5=`grep "^MD5 (${ds}${file})" $distinfo` - echo "DISTFILE:${ds}${file}:SIZE=${size##* }:SHA256=${sha256##* }:MD5=${md5##* }" >> $dist_list_temp + echo "DISTFILE:${ds}${file}:SIZE=${size##* }:SHA256=${sha256##* }:MD5=${md5##* }" \ + >> $dist_list_temp # Make sure any new distfiles get added to the list [ -z "$DONT_SCRUB_DISTFILES" -a ! "$$" -eq "$PM_PARENT_PID" ] && echo "${ds}$file" >> $DI_FILES @@ -3563,24 +3550,22 @@ fi if [ -n "$MAKE_PACKAGE" ]; then if [ -z "$use_package" ]; then echo "===>>> Creating a package for new version $new_port" - pm_make_s package >/dev/null || - fail "Package creation of $new_port failed" + pm_make_s package >/dev/null || fail "Package creation of $new_port failed" echo " ===>>> Package saved to $PACKAGES/All" ; echo '' else pm_pkg_create $PACKAGES $new_port fi fi -if [ -z "$use_package" ]; then - [ -z "$DONT_POST_CLEAN" ] && { - pm_sv Running \'make clean\' - pm_make_s clean NOCLEANDEPENDS=ncd2 ; echo ''; } +if [ -z "$use_package" -a -z "$DONT_POST_CLEAN" ]; then + pm_sv Running \'make clean\' + pm_make_s clean NOCLEANDEPENDS=ncd2 + echo '' fi check_dependency_files $portdir $new_port if [ -s "$grep_deps" ]; then - echo "===>>> Updating dependency entry for $new_port in each dependent port" - pm_v + echo "===>>> Updating dependency entry for $new_port in each dependent port"; pm_v while read d_port; do pm_v "===>>> $d_port" dp_cont=$pdb/$d_port/+CONTENTS @@ -3599,8 +3584,7 @@ if [ -s "$grep_deps" ]; then unset d_port dp_cont do_update if [ -e "$pdb/$new_port/+REQUIRED_BY" ]; then - sort $pdb/$new_port/+REQUIRED_BY | cmp -s $grep_deps - || - do_update=do_update + sort $pdb/$new_port/+REQUIRED_BY | cmp -s $grep_deps - || do_update=do_update check_regular_file $pdb/$new_port/+REQUIRED_BY else do_update=do_update2 @@ -3636,8 +3620,7 @@ CUR_DEPS="${CUR_DEPS}${new_port}:${portd [ -n "$HIDE_BUILD" -a -n "$port_log" ] && pm_unlink $port_log -[ -n "$URB_YES" -o -n "$UPDATE_REQ_BYS" ] && - URB_DONE_LIST="${URB_DONE_LIST}${new_port}:" +[ -n "$URB_YES" -o -n "$UPDATE_REQ_BYS" ] && URB_DONE_LIST="${URB_DONE_LIST}${new_port}:" [ -n "$URB_YES" -o -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ] && $PM_SU_CMD touch $pdb/$new_port/PM_UPGRADE_DONE_FLAG From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 20:07:15 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBAFE106566C; Sat, 7 Aug 2010 20:07:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB33D8FC08; Sat, 7 Aug 2010 20:07:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77K7FUx042569; Sat, 7 Aug 2010 20:07:15 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77K7FBI042567; Sat, 7 Aug 2010 20:07:15 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072007.o77K7FBI042567@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 20:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211036 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 20:07:16 -0000 Author: dougb Date: Sat Aug 7 20:07:15 2010 New Revision: 211036 URL: http://svn.freebsd.org/changeset/base/211036 Log: Add a $FreeBSD line Re-sort the --options to make it easier to maintain Use a better method of generating completions for portmaster [a-z] Modified: user/dougb/portmaster/files/bash-completions Modified: user/dougb/portmaster/files/bash-completions ============================================================================== --- user/dougb/portmaster/files/bash-completions Sat Aug 7 19:27:49 2010 (r211035) +++ user/dougb/portmaster/files/bash-completions Sat Aug 7 20:07:15 2010 (r211036) @@ -1,3 +1,5 @@ +# $FreeBSD$ +# _portmaster () { local cur cur=${COMP_WORDS[COMP_CWORD]} @@ -7,18 +9,21 @@ _portmaster () { COMPREPLY=( $( compgen -d $cur ) ) ;; */*) COMPREPLY=( $( compgen -d /usr/ports/$cur ) ) ;; --*) COMPREPLY=( $( compgen -W '--force-config --show-work \ - --clean-distfiles --clean-distfiles-all --check-depends \ - --check-port-dbdir --list-origins --packages --packages-only \ + --packages --packages-only \ --packages-build --packages-if-newer --delete-build-only \ - --always-fetch --packages-delete \ + --always-fetch --delete-packages \ --local-packagedir= --packages-local \ --no-confirm --no-term-title --no-index-fetch \ --index --index-first --index-only \ + --clean-distfiles --clean-distfiles-all \ + --clean-packages --clean-packages-all \ + --check-depends --check-port-dbdir --list-origins \ --help --version' -- $cur ) ) ;; *) COMPREPLY=( $( compgen -d /var/db/pkg/$cur ) ) COMPREPLY=( ${COMPREPLY[@]#/var/db/pkg/} ) - COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d /usr/ports/$cur/ ) ) + COMPREPLY=( ${COMPREPLY[@]} $( compgen -d /usr/ports/$cur ) ) + COMPREPLY=( ${COMPREPLY[@]#/ports/} ) ;; esac From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 20:10:57 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BF8D106564A; Sat, 7 Aug 2010 20:10:57 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFF748FC08; Sat, 7 Aug 2010 20:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77KAuMo043422; Sat, 7 Aug 2010 20:10:56 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77KAuYY043420; Sat, 7 Aug 2010 20:10:56 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072010.o77KAuYY043420@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 20:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211037 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 20:10:57 -0000 Author: dougb Date: Sat Aug 7 20:10:56 2010 New Revision: 211037 URL: http://svn.freebsd.org/changeset/base/211037 Log: Switch to svn version Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sat Aug 7 20:07:15 2010 (r211036) +++ user/dougb/portmaster/portmaster Sat Aug 7 20:10:56 2010 (r211037) @@ -46,14 +46,14 @@ umask 022 #=============== Begin functions we always want to have =============== version () { - local cvs + local svn - cvs='$FreeBSD$' + svn='$FreeBSD$' - cvs="${cvs#*,v }" ; cvs="${cvs#*/portmaster }" ; cvs="${cvs%% *}" + svn="${svn#*,v }" ; svn="${svn#*/portmaster }" ; svn="${svn%% *}" echo '' - [ "${cvs#$}" != 'FreeBSD$' ] && { echo "===>>> Version $cvs" ; return 0; } + [ "${svn#$}" != 'FreeBSD$' ] && { echo "===>>> Version $svn" ; return 0; } echo "===>>> Version unknown!" } From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 20:22:03 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CD6F1065673; Sat, 7 Aug 2010 20:22:03 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 222648FC1F; Sat, 7 Aug 2010 20:22:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77KM3Wi045938; Sat, 7 Aug 2010 20:22:03 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77KM3uh045936; Sat, 7 Aug 2010 20:22:03 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072022.o77KM3uh045936@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 20:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211038 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 20:22:03 -0000 Author: dougb Date: Sat Aug 7 20:22:02 2010 New Revision: 211038 URL: http://svn.freebsd.org/changeset/base/211038 Log: Add $FreeBSD$ Add new features, and update -G/--force-config help Modified: user/dougb/portmaster/files/zsh-completions Modified: user/dougb/portmaster/files/zsh-completions ============================================================================== --- user/dougb/portmaster/files/zsh-completions Sat Aug 7 20:10:56 2010 (r211037) +++ user/dougb/portmaster/files/zsh-completions Sat Aug 7 20:22:02 2010 (r211038) @@ -1,20 +1,21 @@ #compdef portmaster -# for portmaster 2.18 + +# $FreeBSD$ local context state line array ret=1 typeset -A opt_args _arguments -A "-*" : \ - "--force-config['make config' for all ports]" \ + "--force-config['make config' for all ports (overrides -G)]" \ "-C[prevents 'make clean' from being run before building]" \ - "(-F)-G[prevents recursive 'make config' (overrides --force-config)]" \ + "-G[prevents 'make config']" \ "-H[hide details of the port build and install in a log file]" \ "-K[prevents 'make clean' from being run after building]" \ "(-b)-B[prevents creation of the backup package for the installed port]" \ "(-B)-b[create and keep a backup package of an installed port]" \ "-g[create a package of the new port]" \ - "-n[run through configure, but do not make or install any ports]" \ - "-t[recurse dependencies thoroughly, using all-depends-array]" \ + "-n[run through all steps, but do not make or install any ports]" \ + "-t[recurse dependencies thoroughly, using all-depends-list]" \ "-v[verbose output]" \ "-w[save old shared libraries before deinstall]" \ "(-i)-f[always rebuild ports (overrides -i)]" \ @@ -47,9 +48,11 @@ _arguments -A "-*" : \ "-L[list all installed ports by category, and search for updates]" \ "-e[expunge a port via pkg_delete, and remove its distfiles]:full name of port directory in /var/db/pkg:->pkgs" \ "-s[clean out stale ports that used to be depended on]" \ - "(-G)-F[fetch distfiles only]" \ + "-F[fetch distfiles only]" \ "--clean-distfiles[offer to delete stale distfiles]" \ "--clean-distfiles-all[delete stale distfiles without prompting]" \ + "----clean-packages[offer to delete stale packages]" \ + "----clean-packages-all[delete stale packages without prompting]" \ "--check-depends[cross-check and update dependency information for all ports]" \ "--check-port-dbdir[check for stale entries in /var/db/ports]" \ "--list-origins[list directories from /usr/ports for root and leaf ports]" \ From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 20:33:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F3A1065674; Sat, 7 Aug 2010 20:33:29 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8AB98FC0C; Sat, 7 Aug 2010 20:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77KXTEn048494; Sat, 7 Aug 2010 20:33:29 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77KXTZn048492; Sat, 7 Aug 2010 20:33:29 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072033.o77KXTZn048492@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 20:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211039 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 20:33:30 -0000 Author: dougb Date: Sat Aug 7 20:33:29 2010 New Revision: 211039 URL: http://svn.freebsd.org/changeset/base/211039 Log: Add a note about reading portmaster(8) Add a note that -t should not be used in the rc file Modified: user/dougb/portmaster/files/portmaster.rc.sample.in Modified: user/dougb/portmaster/files/portmaster.rc.sample.in ============================================================================== --- user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 20:22:02 2010 (r211038) +++ user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 20:33:29 2010 (r211039) @@ -3,6 +3,9 @@ # Sample portmaster rc file. # Place in $HOME/.portmasterrc or %%PREFIX%%/etc/portmaster.rc # +# Please read the portmaster man page for more information on +# these options. +# # Do not create temporary backup packages before pkg_delete (-B) # NO_BACKUP=Bopt # @@ -35,6 +38,11 @@ # PM_MAKE_ARGS='-DFORCE_PKG_REGISTER' # # Recurse through every dependency, and child dependencies (-t) +# +# NOTE: USE OF THIS OPTION IN YOUR CONFIG FILE IS NOT RECOMMENDED +# IT IS ONLY NEEDED IN SPECIAL CIRCUMSTANCES, AND SHOULD BE +# USED FROM THE COMMAND LINE. +# # RECURSE_THOROUGH=topt # # Be verbose (-v) From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 21:49:05 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF71F1065672; Sat, 7 Aug 2010 21:49:05 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE6EF8FC19; Sat, 7 Aug 2010 21:49:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77Ln5ng065349; Sat, 7 Aug 2010 21:49:05 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77Ln5gQ065347; Sat, 7 Aug 2010 21:49:05 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072149.o77Ln5gQ065347@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 21:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211041 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 21:49:06 -0000 Author: dougb Date: Sat Aug 7 21:49:05 2010 New Revision: 211041 URL: http://svn.freebsd.org/changeset/base/211041 Log: Update for new features, -t for --clean-distfiles, --clean-packages Update for new behavior of -G Add documentation of -F option which was somehow missing previously Add a warning to -t option Remove mention of deprecated items Add a warning that custom OPTIONS + --index-only == you must build your own INDEX file Add a mention of ports-mgmt/portconf Improve the markup by using .Sy to fake consistency for some of the optional flags that are hard to represent otherwise. Modified: user/dougb/portmaster/files/portmaster.8 Modified: user/dougb/portmaster/files/portmaster.8 ============================================================================== --- user/dougb/portmaster/files/portmaster.8 Sat Aug 7 20:46:30 2010 (r211040) +++ user/dougb/portmaster/files/portmaster.8 Sat Aug 7 21:49:05 2010 (r211041) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2010 +.Dd August 7, 2010 .Dt PORTMASTER 8 .Os .Sh NAME @@ -33,7 +33,7 @@ .Sh SYNOPSIS Common Flags: .Op Fl -force-config CGHgntvw [B|b] [f|i] [D|d] -.Op [[--packages|-P]|[--packages-only|-PP]] | [--packages-build] +.Op Sy [[--packages|-P]|[--packages-only|-PP]] | [--packages-build] .Op Fl -packages-if-newer .Op Fl -delete-build-only .Op Fl -always-fetch @@ -43,7 +43,7 @@ Common Flags: .Op Fl -no-confirm .Op Fl -no-term-title .Op Fl -no-index-fetch -.Op --index|--index-first|--index-only +.Op Sy --index|--index-first|--index-only .Op Fl m Ar arguments for make .Op Fl x Ar glob pattern to exclude from building .Nm @@ -112,10 +112,22 @@ and/or multiple globs from /var/db/pkg .Op Fl b [D|d] .Fl s .Nm +.Op Fl -force-config|-G +.Op Fl aftv +.Fl F +.Nm +.Op Fl t .Fl -clean-distfiles .Nm +.Op Fl t .Fl -clean-distfiles-all .Nm +.Op Fl -index +.Fl -clean-packages +.Nm +.Op Fl -index +.Fl -clean-packages-all +.Nm .Fl -check-depends .Nm .Fl -check-port-dbdir @@ -325,14 +337,13 @@ Manual intervention is therefore require The options are as follows: .Bl -tag -width F1 .It Fl -force-config -run 'make config' for all ports +run 'make config' for all ports (overrides -G) .It Fl B prevents creation of the backup package for the installed port .It Fl C prevents 'make clean' from being run before building .It Fl G -prevents the recursive 'make config' (overrides -.Fl -force-config ) +prevents 'make config' .It Fl H hide details of the port build and install in a log file .It Fl K @@ -342,21 +353,19 @@ create and keep a backup package of an i .It Fl g create a package of the new port .It Fl n -run through configure, but do not make or install any ports +run through all steps, but do not make or install any ports .It Fl t -recurse dependencies thoroughly, using all-depends-list +recurse dependencies thoroughly, using all-depends-list. +.Sy RECOMMENDED FOR USE ONLY WHEN NEEDED, NOT ROUTINELY. +When applied to the +.Fl -clean-distfiles[-all] +option it allows a distfile to be valid if it matches +any up to date port, +not just the ones that are installed. .It Fl v verbose output .It Fl w save old shared libraries before deinstall -.It Fl u -This option has been deprecated. -It did very little previously, and not what most users expected. -Please check the -.Fl d -and -.Fl D -options to achieve most of the same effect. .It [-R] Fl f always rebuild ports (overrides .Fl i ) @@ -375,8 +384,6 @@ Can be specified more than once. If a port is not already installed the exclude pattern will be run against the directory name from .Pa /usr/ports . -.It Fl p Ar port directory in /usr/ports -This option has been deprecated. .It Fl -show-work show what dependent ports are, and are not installed (implies .Fl t ) . @@ -480,7 +487,7 @@ but may be used with .Fl -force-config and .Fl [aftv] . -.It Fl -clean-distfiles +.It [-t] Fl -clean-distfiles recurse through the installed ports to get a list of distinfo files, then recurse through all files in @@ -488,8 +495,13 @@ then recurse through all files in to make sure that they are still associated with an installed port. If not, offer to delete the stale file. -.It Fl -clean-distfiles-all +.It [-t] Fl -clean-distfiles-all does the same as above, but deletes all files without prompting. +.It [--index] Fl -clean-packages +offer to delete stale packages +.It [--index] Fl -clean-packages-all +does the same as above, but deletes all out of date +files without prompting. .It Fl -check-depends cross-check and update dependency information for all ports .It [-v] Fl -check-port-dbdir @@ -570,6 +582,16 @@ MASTER_SITE_INDEX (default http://www.Fr FETCHINDEX (default fetch -am -o) INDEXFILE (default auto per FreeBSD version) .Ed +.Pp +If you use non-standard OPTIONS settings for package building +and wish to use the +.Fl -index-only +option without a ports tree you must generate your own INDEX +file so that the dependencies match. +.Pp +If you wish to customize your build environment on a per-port +basis you might want to take a look at +.Pa ports/ports-mgmt/portconf .Sh FILES .Bl -tag -width "1234" -compact .It Pa /usr/local/etc/portmaster.rc @@ -582,17 +604,6 @@ These files will be read by the parent process, and all variables in them will be exported. .Pp -PLEASE NOTE: In versions before 2.3 -.Pa /etc/portmaster.rc -was recommended. -However placing this file in LOCALBASE is the correct -thing to do. -In future versions of -.Nm -support for -.Pa /etc/portmaster.rc -will be removed. -.Pp .It Pa /var/db/pkg/*/+IGNOREME If this file exists for a port that is already installed, several things will happen: From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 22:08:59 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03CB01065678; Sat, 7 Aug 2010 22:08:59 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD54C8FC1E; Sat, 7 Aug 2010 22:08:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77M8wgJ069744; Sat, 7 Aug 2010 22:08:58 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77M8wSE069741; Sat, 7 Aug 2010 22:08:58 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072208.o77M8wSE069741@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 22:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211042 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 22:08:59 -0000 Author: dougb Date: Sat Aug 7 22:08:58 2010 New Revision: 211042 URL: http://svn.freebsd.org/changeset/base/211042 Log: Document the PM_LOG and PM_IGNORE_FAILED_BACKUP_PACKAGE options Modified: user/dougb/portmaster/files/portmaster.8 user/dougb/portmaster/files/portmaster.rc.sample.in Modified: user/dougb/portmaster/files/portmaster.8 ============================================================================== --- user/dougb/portmaster/files/portmaster.8 Sat Aug 7 21:49:05 2010 (r211041) +++ user/dougb/portmaster/files/portmaster.8 Sat Aug 7 22:08:58 2010 (r211042) @@ -592,6 +592,34 @@ file so that the dependencies match. If you wish to customize your build environment on a per-port basis you might want to take a look at .Pa ports/ports-mgmt/portconf +.Pp +To log actions taken by +.Nm +along with a date/time stamp you can define +.Ev PM_LOG +in your rc file with the full path of the file you would +like to log to. +If running +.Nm +with +.Xr sudo 8 +(see below) then you should make sure that the file is +writable by the unprivileged user. +.Pp +By default +.Nm +creates backup packages of installed ports before it runs +.Xr pkg_delete 1 +during an update. +If that package creation fails it is treated as a serious +error and the user is prompted. +However for scripted use of +.Nm +this can be a problem. +In situations where the user is ABSOLUTELY SURE +that lack of a backup package should not be a fatal error +.Ev PM_IGNORE_FAILED_BACKUP_PACKAGE +can be defined to any value in the rc file. .Sh FILES .Bl -tag -width "1234" -compact .It Pa /usr/local/etc/portmaster.rc Modified: user/dougb/portmaster/files/portmaster.rc.sample.in ============================================================================== --- user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 21:49:05 2010 (r211041) +++ user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 22:08:58 2010 (r211042) @@ -98,3 +98,12 @@ # Use the INDEX file instead of /usr/ports (--index-only) # PM_INDEX=pm_index # PM_INDEX_ONLY=pm_index_only +# +# +# The following options are available for the rc file only: +# +# Log actions taken by portmaster with a date/time stamp +# PM_LOG=/full/path/to/file +# +# Do not prompt the user for failed backup package creation +# PM_IGNORE_FAILED_BACKUP_PACKAGE=pm_ignore_failed_backup_package From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 22:11:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 294E3106566C; Sat, 7 Aug 2010 22:11:06 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 192428FC0C; Sat, 7 Aug 2010 22:11:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77MB518070258; Sat, 7 Aug 2010 22:11:05 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77MB52f070256; Sat, 7 Aug 2010 22:11:05 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072211.o77MB52f070256@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 22:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211043 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 22:11:06 -0000 Author: dougb Date: Sat Aug 7 22:11:05 2010 New Revision: 211043 URL: http://svn.freebsd.org/changeset/base/211043 Log: s/PREFIX/LOCALBASE/ to match the script Modified: user/dougb/portmaster/files/portmaster.rc.sample.in Modified: user/dougb/portmaster/files/portmaster.rc.sample.in ============================================================================== --- user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 22:08:58 2010 (r211042) +++ user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 22:11:05 2010 (r211043) @@ -1,7 +1,7 @@ # $FreeBSD$ # # Sample portmaster rc file. -# Place in $HOME/.portmasterrc or %%PREFIX%%/etc/portmaster.rc +# Place in $HOME/.portmasterrc or %%LOCALBASE%%/etc/portmaster.rc # # Please read the portmaster man page for more information on # these options. From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 22:16:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD380106567A; Sat, 7 Aug 2010 22:16:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B306E8FC08; Sat, 7 Aug 2010 22:16:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77MGsxi071647; Sat, 7 Aug 2010 22:16:54 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77MGsPg071646; Sat, 7 Aug 2010 22:16:54 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072216.o77MGsPg071646@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 22:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211044 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 22:16:54 -0000 Author: dougb Date: Sat Aug 7 22:16:54 2010 New Revision: 211044 URL: http://svn.freebsd.org/changeset/base/211044 Log: Set the svn:keywords property Modified: Directory Properties: user/dougb/portmaster/files/bash-completions (props changed) user/dougb/portmaster/files/zsh-completions (props changed) From owner-svn-src-user@FreeBSD.ORG Sat Aug 7 22:50:43 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 694A81065673; Sat, 7 Aug 2010 22:50:43 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 594A48FC12; Sat, 7 Aug 2010 22:50:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77MohLE079078; Sat, 7 Aug 2010 22:50:43 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77Mohex079076; Sat, 7 Aug 2010 22:50:43 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008072250.o77Mohex079076@svn.freebsd.org> From: Doug Barton Date: Sat, 7 Aug 2010 22:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211045 - user/dougb/portmaster/files X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 22:50:43 -0000 Author: dougb Date: Sat Aug 7 22:50:43 2010 New Revision: 211045 URL: http://svn.freebsd.org/changeset/base/211045 Log: Don't bother with %%LOCALBASE%% after all Modified: user/dougb/portmaster/files/portmaster.rc.sample.in Modified: user/dougb/portmaster/files/portmaster.rc.sample.in ============================================================================== --- user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 22:16:54 2010 (r211044) +++ user/dougb/portmaster/files/portmaster.rc.sample.in Sat Aug 7 22:50:43 2010 (r211045) @@ -1,7 +1,7 @@ # $FreeBSD$ # # Sample portmaster rc file. -# Place in $HOME/.portmasterrc or %%LOCALBASE%%/etc/portmaster.rc +# Place in $HOME/.portmasterrc or /usr/local/etc/portmaster.rc # # Please read the portmaster man page for more information on # these options.