|
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): |