View | Details | Raw Unified | Return to bug 195576 | Differences between
and this patch

Collapse All | Expand All

(-)pkg-plist/Makefile (-5 / +5 lines)
Lines 2-10 Link Here
2
# $FreeBSD: head/ports-mgmt/pkg-plist/Makefile 372182 2014-11-05 11:05:02Z mat $
2
# $FreeBSD: head/ports-mgmt/pkg-plist/Makefile 372182 2014-11-05 11:05:02Z mat $
3
3
4
PORTNAME=	pkg-plist
4
PORTNAME=	pkg-plist
5
PORTVERSION=	1.2
5
PORTVERSION=	1.3
6
CATEGORIES=	ports-mgmt python
6
CATEGORIES=	ports-mgmt python
7
MASTER_SITES=	http://code.arp242.net/pkg-plist/downloads/
7
MASTER_SITES=	http://code.arp242.net/pkg-plist/get/
8
DISTNAME=	version_${PORTVERSION}
9
DIST_SUBDIR=	${PORTNAME}
8
10
9
MAINTAINER=	martin@arp242.net
11
MAINTAINER=	martin@arp242.net
10
COMMENT=	Generate a pkg-plist for a port
12
COMMENT=	Generate a pkg-plist for a port
Lines 13-24 Link Here
13
15
14
USES=		python
16
USES=		python
15
NO_BUILD=	yes
17
NO_BUILD=	yes
18
WRKSRC=		${WRKDIR}/Carpetsmoker-pkg-plist-cbcdd05740ae
16
19
17
PLIST_FILES=	bin/pkg-plist man/man1/pkg-plist.1.gz
20
PLIST_FILES=	bin/pkg-plist man/man1/pkg-plist.1.gz
18
21
19
DEPRECATED=	Generate incorrect plists
20
EXPIRATION_DATE=	2014-11-30
21
22
do-install:
22
do-install:
23
	${INSTALL_SCRIPT} ${WRKSRC}/pkg-plist ${STAGEDIR}${PREFIX}/bin
23
	${INSTALL_SCRIPT} ${WRKSRC}/pkg-plist ${STAGEDIR}${PREFIX}/bin
24
	${INSTALL_MAN} ${WRKSRC}/pkg-plist.1 ${STAGEDIR}${MANPREFIX}/man/man1
24
	${INSTALL_MAN} ${WRKSRC}/pkg-plist.1 ${STAGEDIR}${MANPREFIX}/man/man1
(-)pkg-plist/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (pkg-plist-1.2.tar.gz) = 9cdb872627ad29c211923454faa111d5f85f5c1b5c6c9dba4621923d802a4831
1
SHA256 (pkg-plist/version_1.3.tar.gz) = b9f413a36a0f4aca454ad1ad3e1026cb3d84a103bb3faae43940f8916c2c1d6b
2
SIZE (pkg-plist-1.2.tar.gz) = 4064
2
SIZE (pkg-plist/version_1.3.tar.gz) = 4034
(-)pkg-plist/files/patch-pkg-plist (+77 lines)
Line 0 Link Here
1
--- pkg-plist.orig	2013-03-14 00:26:09.000000000 +0400
2
+++ pkg-plist	2014-12-02 04:10:57.000000000 +0400
3
@@ -27,7 +27,7 @@
4
 	print("Usage: %s [-hdn] [-p portdir] [-x prefix]" % sys.argv[0])
5
 	print("")
6
 	print("  -h, --help\t\tPrint this help message and exit")
7
-	print("  -x, --prefix\t\tTemporary prefix to use (Default: /var/tmp/ptest)")
8
+	print("  -x, --prefix\t\tTemporary prefix to use (Default: /var/tmp/ptest or ${STAGEDIR}${LOCALBASE})")
9
 	print("  -p, --portdir\t\tPort directory (Default: current directory)")
10
 	print("  -d, --noportdocs\tDo not prefix entries in %%DOCSDIR%% with %%PORTDOCS%%")
11
 	print("  -e, --noportexamples\tDo not prefix entries in %%EXAMPLESSDIR%%")
12
@@ -67,6 +67,8 @@
13
 		'localbase': '/usr/local',
14
 	}
15
 
16
+	prefixselected = False
17
+
18
 	for opt, arg in options:
19
 		if opt in ['-h', '--help']:
20
 			Usage()
21
@@ -75,6 +77,7 @@
22
 			defaults['portdir'] = arg
23
 		if opt in ['-x', '--prefix']:
24
 			defaults['prefix'] = arg
25
+			prefixselected = True
26
 		if opt in ['-d' '--noportdocs']:
27
 			defaults['noportdocs'] = True
28
 		if opt in ['-e', '--noportexamples']:
29
@@ -99,11 +102,14 @@
30
 				mkdir, e.message))
31
 			sys.exit(1)
32
 
33
-	proc = subprocess.Popen(['make', '-V', 'PORTSDIR', '-V', 'LOCALBASE'],
34
+	proc = subprocess.Popen(['make', '-V', 'PORTSDIR', '-V', 'LOCALBASE', '-V', 'STAGEDIR'],
35
 		stdout=subprocess.PIPE)
36
-	defaults['portsdir'], defaults['localbase'] = (
37
+	defaults['portsdir'], defaults['localbase'], stagedir = (
38
 		proc.communicate()[0][:-1].decode().split('\n'))
39
 
40
+	if not prefixselected and stagedir:
41
+		defaults['prefix'] = stagedir + defaults['localbase']
42
+
43
 	return defaults
44
 
45
 
46
@@ -150,23 +156,26 @@
47
 
48
 		path = os.path.join(prev, file)
49
 		if os.path.isdir(os.path.join(prefix, path)):
50
-			if CheckDir(mtree, path):
51
-				d.append('@dirrm ' + path)
52
+			if CheckEmtpyDir(mtree, prefix, path):
53
+				d.append('@dir ' + path)
54
 			GetTree(options, mtree, prefix, path, d, f)
55
 		else:
56
 			f.append(path)
57
 	return d, f
58
 
59
 
60
-def CheckDir(mtree, path):
61
-	""" Check if dir is in mtree """
62
+def CheckEmtpyDir(mtree, prefix, path):
63
+	""" Check if empty dir is not in mtree """
64
 
65
 	for m in mtree:
66
 		if path == m:
67
 			return False
68
 		else:
69
 			continue
70
-	return True
71
+	if os.listdir(os.path.join(prefix, path)):
72
+		return False
73
+	else:
74
+		return True
75
 
76
 
77
 def GetVars(options):
(-)pkg-plist/files/patch-pkg-plist.1 (+11 lines)
Line 0 Link Here
1
--- pkg-plist.1.orig	2013-03-14 00:26:09.000000000 +0400
2
+++ pkg-plist.1	2014-12-02 04:10:57.000000000 +0400
3
@@ -10,7 +10,7 @@
4
       Print help message and exit
5
 .P
6
   \-\fIx\fR, \fI\-\-prefix\fR
7
-      Temporary prefix to use (Default: /var/tmp/ptest)
8
+      Temporary prefix to use (Default: /var/tmp/ptest or ${STAGEDIR}${LOCALBASE})
9
 .P
10
   \fI\-p\fR, \fI\-\-portdir\fR
11
       Port directory (Default: current directory)

Return to bug 195576