1 |
Author: ulm |
2 |
Date: 2009-10-08 06:54:12 +0000 (Thu, 08 Oct 2009) |
3 |
New Revision: 683 |
4 |
|
5 |
Modified: |
6 |
trunk/ChangeLog |
7 |
trunk/NEWS |
8 |
trunk/doc/developer-guide.txt |
9 |
trunk/libs/path-manipulation.bash.in |
10 |
trunk/modules/profile.eselect |
11 |
Log: |
12 |
New relative_name() function. |
13 |
|
14 |
Modified: trunk/ChangeLog |
15 |
=================================================================== |
16 |
--- trunk/ChangeLog 2009-10-07 12:59:07 UTC (rev 682) |
17 |
+++ trunk/ChangeLog 2009-10-08 06:54:12 UTC (rev 683) |
18 |
@@ -1,7 +1,9 @@ |
19 |
2009-10-05 Ulrich Mueller <ulm@g.o> |
20 |
|
21 |
- * modules/profile.eselect (do_show): Use EROOT instead of ROOT, |
22 |
- bug 287730. |
23 |
+ * libs/path-manipulation.bash.in (relative_name): New function. |
24 |
+ * doc/developer-guide.txt: Document it. |
25 |
+ * modules/profile.eselect (do_show): Use EROOT instead of ROOT. |
26 |
+ (set_symlink): Use relative_name(). Fixes bug 287730. |
27 |
|
28 |
2009-09-20 Ulrich Mueller <ulm@g.o> |
29 |
|
30 |
|
31 |
Modified: trunk/NEWS |
32 |
=================================================================== |
33 |
--- trunk/NEWS 2009-10-07 12:59:07 UTC (rev 682) |
34 |
+++ trunk/NEWS 2009-10-08 06:54:12 UTC (rev 683) |
35 |
@@ -1,6 +1,10 @@ |
36 |
This file contains a summary of changes in released versions. Please read the |
37 |
ChangeLog file for a more detailed listing of changes/bug fixes. |
38 |
|
39 |
+1.2.4: |
40 |
+ Bug fixes: |
41 |
+ - Fixed bug #287730: Relative filename for symlink in profile module. |
42 |
+ |
43 |
1.2.3: |
44 |
Bug fixes: |
45 |
- Fixed bug #285762: Add several architectures to arch() function. |
46 |
|
47 |
Modified: trunk/doc/developer-guide.txt |
48 |
=================================================================== |
49 |
--- trunk/doc/developer-guide.txt 2009-10-07 12:59:07 UTC (rev 682) |
50 |
+++ trunk/doc/developer-guide.txt 2009-10-08 06:54:12 UTC (rev 683) |
51 |
@@ -362,6 +362,13 @@ |
52 |
The ``canonicalise`` function is a wrapper to either GNU ``readlink -f`` |
53 |
or ``realpath``. |
54 |
|
55 |
+The ``relative_name`` Function |
56 |
+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, |
57 |
+ |
58 |
+The ``relative_name`` function converts a path name (passed as its first |
59 |
+argument) to be relative to a directory (second argument). This can be |
60 |
+used to generate a relative symlink from absolute paths. |
61 |
+ |
62 |
Manipulation Functions |
63 |
---------------------- |
64 |
|
65 |
|
66 |
Modified: trunk/libs/path-manipulation.bash.in |
67 |
=================================================================== |
68 |
--- trunk/libs/path-manipulation.bash.in 2009-10-07 12:59:07 UTC (rev 682) |
69 |
+++ trunk/libs/path-manipulation.bash.in 2009-10-08 06:54:12 UTC (rev 683) |
70 |
@@ -64,3 +64,19 @@ |
71 |
canonicalise() { |
72 |
@CANONICALISE@ "$@" |
73 |
} |
74 |
+ |
75 |
+# relative_name |
76 |
+# Convert filename $1 to be relative to directory $2 (both must exist). |
77 |
+relative_name() { |
78 |
+ local path=$(canonicalise "$1") dir=$(canonicalise "$2") c |
79 |
+ while [[ -n ${dir} ]]; do |
80 |
+ c=${dir%%/*} |
81 |
+ dir=${dir##"${c}"*(/)} |
82 |
+ if [[ ${path%%/*} = ${c} ]]; then |
83 |
+ path=${path##"${c}"*(/)} |
84 |
+ else |
85 |
+ path=..${path:+/}${path} |
86 |
+ fi |
87 |
+ done |
88 |
+ echo "${path:-.}" |
89 |
+} |
90 |
|
91 |
Modified: trunk/modules/profile.eselect |
92 |
=================================================================== |
93 |
--- trunk/modules/profile.eselect 2009-10-07 12:59:07 UTC (rev 682) |
94 |
+++ trunk/modules/profile.eselect 2009-10-08 06:54:12 UTC (rev 683) |
95 |
@@ -66,7 +66,8 @@ |
96 |
remove_symlink \ |
97 |
|| die -q "Couldn't remove current make.profile symlink" |
98 |
fi |
99 |
- ln -s "..${portdir#"${EPREFIX}"}/profiles/${target}" \ |
100 |
+ ln -s "$(relative_name \ |
101 |
+ "${ROOT}${portdir}" "${EROOT}/etc")/profiles/${target}" \ |
102 |
"${EROOT}/etc/make.profile" |
103 |
else |
104 |
die -q "Target \"${1}\" doesn't appear to be valid!" |