~ubuntu-branches/ubuntu/natty/clamav/natty-security

« back to all changes in this revision

Viewing changes to win32/configure.js

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-02-19 09:51:33 UTC
  • mfrom: (0.35.19 sid)
  • Revision ID: james.westby@ubuntu.com-20110219095133-sde2dyj8a6bjbkdh
Tags: 0.97+dfsg-0ubuntu1
* Merge from debian unstable (0ubuntu1 because the Debian upload was
  inadvertently left marked UNRELEASED).  Remaining changes:
  - Drop initial signature definitions from clamav-base
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var W = WScript;
 
2
var F;
 
3
try {
 
4
        F = W.CreateObject('Scripting.FileSystemObject');
 
5
} catch(e) {
 
6
        W.Echo('FSO creation failed: ' + e.message);
 
7
        W.Quit(1);
 
8
}
 
9
var f;
 
10
try {
 
11
        f = F.GetFile(WScript.ScriptFullName);
 
12
} catch(e) {
 
13
        W.Echo('I don\'t exit: ' + e.message);
 
14
        W.Quit(1);
 
15
}
 
16
 
 
17
var dir_win32 = f.ParentFolder;
 
18
try {
 
19
        f = F.GetFolder(dir_win32);
 
20
} catch(e) {
 
21
        W.Echo('GetFolder failed: ' + e.message);
 
22
        W.Quit(1);
 
23
}
 
24
var dir_root = f.ParentFolder;
 
25
var file_versionsta = dir_root + '\\libclamav\\version.h.static';
 
26
var file_versionout = dir_root + '\\libclamav\\version.h';
 
27
 
 
28
W.Echo('Generating version.h');
 
29
if(F.FileExists(file_versionout))
 
30
        F.DeleteFile(file_versionout, true);
 
31
 
 
32
if(F.FileExists(file_versionsta)) {
 
33
        try {
 
34
                F.CopyFile(file_versionsta, file_versionout, true);
 
35
        } catch(e) {
 
36
                W.Echo('Cannot copy '+ file_versionsta +' to ' + file_versionout + ': ' + e.message);
 
37
                W.Quit(1);
 
38
        }
 
39
} else {
 
40
        var S;
 
41
        var version = '';
 
42
        try {
 
43
                S = W.CreateObject('WScript.Shell');
 
44
        } catch(e) {
 
45
                W.Echo('No Shell available: ' + e.message);
 
46
                W.Quit(1);
 
47
        }
 
48
        try {
 
49
                var git = S.Exec('git describe --always');
 
50
                version = git.StdOut.ReadAll();
 
51
                while(git.Status == 0) {
 
52
                        W.Sleep(100);
 
53
                }
 
54
                if(git.ExitCode != 0) {
 
55
                        W.Echo('WARNING: git describe returned ' + git.ExitCode);
 
56
                        version = '';
 
57
                } else {
 
58
                        version = '#define REPO_VERSION "devel-' + version.replace(/[\r\n]+$/, '') + '"';
 
59
                }
 
60
        } catch (e) { }
 
61
        of = F.CreateTextFile(file_versionout, true);
 
62
        if(!of) {
 
63
                W.Echo('Cannot open '+file_versionout+' for writing');
 
64
                W.Quit(1);
 
65
        }
 
66
        of.WriteLine('/* AUTOMATICALLY GENERATED BY configure.js */');
 
67
        if(version != '') 
 
68
                of.WriteLine(version);
 
69
 
 
70
        of.close();
 
71
}
 
72
 
 
73
W.Echo('Work complete');
 
74
W.Quit(0);
 
75