-
Notifications
You must be signed in to change notification settings - Fork 0
/
pisi_pspec.tcl
113 lines (102 loc) · 4.25 KB
/
pisi_pspec.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
#Creating pspec.xml and action.py
namespace eval ::pisi_pspec {
#create pspec
proc Create {} {
global geName geVersion geSuffix geSuffixVer geRevision xDescription xHomepage xDependency xRDependency xLicense xSourcePath xPatch
set Suffix ""
if {$geSuffix != ""} {set Suffix "-$geSuffix"}
PutMessage [format "[uplevel #0 {set MSG_saving}]" "[pwd]/pspec.xml"]
set ZipType ""
set d1 "gz"
regexp "tar.(..?.?.?)$" $xSourcePath Dummy d1
set ZipType "tar$d1"
set fh [open "pspec.xml" "w"]
puts $fh "<?xml version=\"1.0\" ?>
<!DOCTYPE PISI
SYSTEM \"http://www.pardus.org.tr/projeler/pisi/pisi-spec.dtd\">
<PISI>
<Source>
<Name>$geName</Name>
<Homepage>$xHomepage</Homepage>
<Packager>
<Name>Pilonga</Name>
<Email>[email protected]</Email>
</Packager>
<License>$xLicense</License>
<IsA>[::pisi_pspec::PutIsA]</IsA>
<Summary>$xDescription</Summary>
<Description>$xDescription</Description>
<Archive sha1sum=\"\" type=\"$ZipType\">$xSourcePath</Archive>"
if {$xDependency != ""} {
puts $fh " <BuildDependencies>"
foreach {Name Version} $xDependency {
if { $Version == "-" } {
puts $fh " <Dependency>$Name</Dependency>"
} else {
puts $fh " <Dependency versionFrom=\"$Version\">$Name</Dependency>"
}
}
puts $fh " </BuildDependencies>"
}
if {$xPatch != ""} {
puts $fh " <Patches>"
foreach {Patch} $xPatch { puts $fh " <Patch level=\"1\">$Patch</Patch>" }
puts $fh " </Patches>"
}
puts $fh " </Source>
<Package>
<Name>$geName</Name>"
if {$xRDependency != ""} {
puts $fh " <RuntimeDependencies>"
foreach {Name Version} $xRDependency {
if { $Version == "-" } {
puts $fh " <Dependency>$Name</Dependency>"
} else {
puts $fh " <Dependency versionFrom=\"$Version\">$Name</Dependency>"
}
}
puts $fh " </RuntimeDependencies>"
}
puts $fh " <Files>
<Path fileType=\"executable\">/usr/bin</Path>
<Path fileType=\"library\">/usr/lib</Path>
<Path fileType=\"data\">/usr/share</Path>
</Files>
</Package>
<History>
<Update release=\"1\">
<Date>[clock format [clock seconds] -format %Y-%m-%d]</Date>
<Version>$geVersion$Suffix</Version>
<Comment>First release.</Comment>
<Name>Pilonga</Name>
<Email>[email protected]</Email>
</Update>
</History>
</PISI>"
close $fh
uplevel #0 {PutMessage "[format $MSG_saving pspec.xml]"}
}
proc PutIsA {} {
global xDescription
if {[regexp -nocase "library" $xDescription]} {return "library"}
if {[regexp -nocase "locale" $xDescription]} {return "locale"}
if {[regexp -nocase "deamon" $xDescription]} {return "deamon"}
if {[regexp -nocase "plugin" $xDescription]} {return "plugin"}
if {[regexp -nocase "console" $xDescription]} {return "console"}
if {[regexp -nocase "kernel" $xDescription]} {return "kernel"}
if {[regexp -nocase "service" $xDescription]} {return "service"}
if {[regexp -nocase "font" $xDescription]} {return "data:font"}
if {[regexp -nocase "doc" $xDescription]} {return "data:doc"}
if {[regexp -nocase "data" $xDescription]} {return "data"}
if {[regexp -nocase "devel" $xDescription]} {return "devel"}
if {[regexp -nocase "client" $xDescription]} {return "app:cli"}
if {[regexp -nocase "gui" $xDescription]} {return "app:gui"}
if {[regexp -nocase "game" $xDescription]} {return "applications:games"}
if {[regexp -nocase "util" $xDescription]} {return "console"}
return "app:gui"
}
}