1 | #!/usr/bin/perl
|
---|
2 |
|
---|
3 | # This perl script generates the samba.spec file based on the version
|
---|
4 | # information in the version.h file in the source tree
|
---|
5 |
|
---|
6 | open (VER,'../../source/include/version.h') || die "Unable to open version.h\n";
|
---|
7 | while ( <VER> ) {
|
---|
8 | chomp;
|
---|
9 | if ( /SAMBA_VERSION_OFFICIAL_STRING/ ) {
|
---|
10 | s/^.*SAMBA_VERSION_OFFICIAL_STRING "//;
|
---|
11 | s/".*$//;
|
---|
12 | $SambaVersion = $_;
|
---|
13 | }
|
---|
14 | }
|
---|
15 | close (VER);
|
---|
16 |
|
---|
17 | # create the package name
|
---|
18 | $vername = " id \"Samba Version ".$SambaVersion."\"\n";
|
---|
19 |
|
---|
20 | $_ = $SambaVersion;
|
---|
21 | s/^.* //;
|
---|
22 | $patch = 0;
|
---|
23 | #create the subsystem version numbers
|
---|
24 | if (/alpha/) {
|
---|
25 | $_ =~ s/alpha/.00./;
|
---|
26 | }
|
---|
27 | elsif (/-HEAD/) {
|
---|
28 | $_ =~ s/-HEAD/.01/;
|
---|
29 | $_ .= '.99';
|
---|
30 | }
|
---|
31 | elsif (/pre-/) {
|
---|
32 | $_ =~ s/pre-//;
|
---|
33 | $_ .= '.00';
|
---|
34 | }
|
---|
35 | elsif (/p/) {
|
---|
36 | $_ =~ s/p/./;
|
---|
37 | $_ .= '.00';
|
---|
38 | $patch = 1;
|
---|
39 | }
|
---|
40 | else {
|
---|
41 | $_ .='.01.00';
|
---|
42 | }
|
---|
43 |
|
---|
44 | ($v1,$v2,$v3,$v4,$v5) = split('\.');
|
---|
45 | $v4 = $v4 + $patch;
|
---|
46 | $vernum = sprintf(" version %02d%02d%02d%02d%02d\n",$v1,$v2,$v3,$v4,$v5);
|
---|
47 |
|
---|
48 | # generate the samba.spec file
|
---|
49 | open(SPEC,">samba.spec") || die "Unable to open samba.spec for output\n";
|
---|
50 | print SPEC "product samba\n";
|
---|
51 | print SPEC $vername;
|
---|
52 | print SPEC " image sw\n";
|
---|
53 | print SPEC " id \"Samba Execution Environment\"\n";
|
---|
54 | print SPEC $vernum;
|
---|
55 | print SPEC " order 0\n";
|
---|
56 | print SPEC " subsys base default\n";
|
---|
57 | print SPEC " id \"Samba Execution Environment\"\n";
|
---|
58 | print SPEC " replaces fw_samba.sw.base 0 9999999999\n";
|
---|
59 | print SPEC " replaces fw_samba.sw.samba 0 9999999999\n";
|
---|
60 | print SPEC " exp samba.sw.base\n";
|
---|
61 | print SPEC " endsubsys\n";
|
---|
62 | print SPEC " endimage\n";
|
---|
63 | print SPEC " image man\n";
|
---|
64 | print SPEC " id \"Samba Online Documentation\"\n";
|
---|
65 | print SPEC $vernum;
|
---|
66 | print SPEC " order 1\n";
|
---|
67 | print SPEC " subsys manpages default\n";
|
---|
68 | print SPEC " id \"Samba Man Page\"\n";
|
---|
69 | print SPEC " replaces fw_samba.man.manpages 0 9999999999\n";
|
---|
70 | print SPEC " replaces fw_samba.man.samba 0 9999999999\n";
|
---|
71 | print SPEC " exp samba.man.manpages\n";
|
---|
72 | print SPEC " endsubsys\n";
|
---|
73 | print SPEC " subsys doc default\n";
|
---|
74 | print SPEC " id \"Samba Documentation\"\n";
|
---|
75 | print SPEC " replaces fw_samba.man.doc 0 9999999999\n";
|
---|
76 | print SPEC " exp samba.man.doc\n";
|
---|
77 | print SPEC " endsubsys\n";
|
---|
78 | print SPEC " subsys relnotes default\n";
|
---|
79 | print SPEC " id \"Samba Release Notes\"\n";
|
---|
80 | print SPEC " replaces fw_samba.man.relnotes 0 9999999999\n";
|
---|
81 | print SPEC " exp samba.man.relnotes\n";
|
---|
82 | print SPEC " endsubsys\n";
|
---|
83 | print SPEC " endimage\n";
|
---|
84 | print SPEC " image src\n";
|
---|
85 | print SPEC " id \"Samba Source Code\"\n";
|
---|
86 | print SPEC $vernum;
|
---|
87 | print SPEC " order 2\n";
|
---|
88 | print SPEC " subsys samba\n";
|
---|
89 | print SPEC " id \"Samba Source Code\"\n";
|
---|
90 | print SPEC " replaces fw_samba.src.samba 0 9999999999\n";
|
---|
91 | print SPEC " exp samba.src.samba\n";
|
---|
92 | print SPEC " endsubsys\n";
|
---|
93 | print SPEC " endimage\n";
|
---|
94 | print SPEC "endproduct\n";
|
---|
95 | close SPEC || die "Error on close of samba.spec\n";
|
---|
96 |
|
---|
97 | print "\nsamba.spec file has been created\n\n";
|
---|