diff options
Diffstat (limited to 'tools/niminst/debcreation.nim')
-rw-r--r-- | tools/niminst/debcreation.nim | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/tools/niminst/debcreation.nim b/tools/niminst/debcreation.nim index bbd997981..36b2a29ec 100644 --- a/tools/niminst/debcreation.nim +++ b/tools/niminst/debcreation.nim @@ -38,33 +38,33 @@ proc createControl(pkgName, maintainer, shortDesc, desc: string, ## Multiple dependencies should be separated by commas. ## pkgDepends: Same as buildDepends except that this specifies the ## dependencies that the compiled application depends on. - - + + result = "" - + addN("Source: " & pkgName) addN("Maintainer: " & maintainer) addN("Section: misc") addN("Priority: optional") addN("Standards-Version: 3.9.2") - addN("Build-Depends: debhelper (>= 8)" & + addN("Build-Depends: debhelper (>= 8)" & (if buildDepends != "": ", " & buildDepends else: "")) addN("\n") addN("Package: " & pkgName) addN("Architecture: any") addN("Depends: ${shlibs:Depends}, ${misc:Depends}" & (if pkgDepends != "": ", " & pkgDepends else: "")) - + var formattedDesc = "" for line in splitLines(desc): if line == "": formattedDesc.add(" .\n") else: formattedDesc.add(" " & line & "\n") - + addN("Description: " & shortDesc & "\n" & formattedDesc) -proc createCopyright(pkgName, mtnName, mtnEmail, version: string, +proc createCopyright(pkgName, mtnName, mtnEmail, version: string, licenses: seq[tuple[files, license: string]]): string = ## pkgName: Package name ## mtnName: Maintainer name @@ -73,7 +73,7 @@ proc createCopyright(pkgName, mtnName, mtnEmail, version: string, ## licenses: files: This specifies the files that the `license` covers, ## for example, it might be ``lib/*`` to cover the whole ``lib`` dir ## license: This specifies the license, for example gpl2, or lgpl. - + result = "" addN("Maintainer name: " & mtnName) addN("Email-Address: " & mtnEmail) @@ -86,7 +86,7 @@ proc createCopyright(pkgName, mtnName, mtnEmail, version: string, proc formatDateTime(t: TimeInfo, timezone: string): string = var day = ($t.weekday)[0..2] & ", " - + return "$1$2 $3 $4 $5:$6:$7 $8" % [day, intToStr(t.monthday, 2), ($t.month)[0..2], $t.year, intToStr(t.hour, 2), intToStr(t.minute, 2), intToStr(t.second, 2), timezone] @@ -147,41 +147,41 @@ proc prepDeb*(packName, version, mtnName, mtnEmail, shortDesc, desc: string, buildDepends, pkgDepends = "") = ## binaries/config/docs/lib: files relative to nim's root, that need to ## be installed. - + let pkgName = packName.toLower() - + var workingDir = getTempDir() / "niminst" / "deb" var upstreamSource = (pkgName & "-" & version) - + echo("Making sure build.sh and install.sh are +x") - assertSuccess execCmd("chmod +x \"" & + assertSuccess execCmd("chmod +x \"" & (workingDir / upstreamSource / "build.sh") & "\"") - assertSuccess execCmd("chmod +x \"" & + assertSuccess execCmd("chmod +x \"" & (workingDir / upstreamSource / "install.sh") & "\"") - - var tarCmd = "tar pczf \"" & + + var tarCmd = "tar pczf \"" & (pkgName & "_" & version & ".orig.tar.gz") & - "\" \"" & upstreamSource & "\"" + "\" \"" & upstreamSource & "\"" echo(tarCmd) assertSuccess execCmd("cd \"" & workingDir & "\" && " & tarCmd) - + echo("Creating necessary files in debian/") createDir(workingDir / upstreamSource / "debian") - + template writeDebian(f, s: string): expr = writeFile(workingDir / upstreamSource / "debian" / f, s) - + var controlFile = createControl(pkgName, makeMtn(mtnName, mtnEmail), shortDesc, desc, buildDepends, pkgDepends) echo("debian/control") writeDebian("control", controlFile) - + var copyrightFile = createCopyright(pkgName, mtnName, mtnEmail, version, licenses) echo("debian/copyright") writeDebian("copyright", copyrightFile) - var changelogFile = createChangelog(pkgName, version, + var changelogFile = createChangelog(pkgName, version, makeMtn(mtnName, mtnEmail)) echo("debian/changelog") writeDebian("changelog", changelogFile) @@ -206,7 +206,7 @@ proc prepDeb*(packName, version, mtnName, mtnEmail, shortDesc, desc: string, createIncludeBinaries(binaries)) echo("All done, you can now build.") - echo("Before you do however, make sure the files in " & + echo("Before you do however, make sure the files in " & workingDir / upstreamSource / "debian" & " are correct.") echo("Change your directory to: " & workingDir / upstreamSource) echo("And execute `debuild -us -uc` to build the .deb") @@ -214,22 +214,22 @@ proc prepDeb*(packName, version, mtnName, mtnEmail, shortDesc, desc: string, when isMainModule: #var controlFile = createControl("nim", "Dominik Picheta <morfeusz8@gmail.com>", # "The Nim compiler", "Compiler for the Nim programming language", "gcc (>= 4:4.3.2)", "gcc (>= 4:4.3.2)") - + #echo(controlFile) - + #var copyrightFile = createCopyright("nim", "Dominik Picheta", "morfeusz8@a.b", "0.8.14", # @[("bin/nim", "gpl2"), ("lib/*", "lgpl")]) - + #echo copyrightFile - + #var changelogFile = createChangelog("nim", "0.8.14", "Dom P <m@b.c>") #echo(changelogFile) - + #echo(createRules()) - prepDeb("nim", "0.9.2", "Dominik Picheta", "morfeusz8@gmail.com", + prepDeb("nim", "0.9.2", "Dominik Picheta", "morfeusz8@gmail.com", "The Nim compiler", "Compiler for the Nim programming language", - @[("bin/nim", "MIT"), ("lib/*", "MIT")], + @[("bin/nim", "MIT"), ("lib/*", "MIT")], @["bin/nim"], @["config/*"], @["doc/*"], @["lib/*"], "gcc (>= 4:4.3.2)", "gcc (>= 4:4.3.2)") |