Sublime Forum

Trying to create a Debian Package sublime-build

#1

I’ve got a few projects I maintain in Sublime Text where I’m building Debian native packages (we have a private reprepro repository where we maintain packages for local use). I’m trying to create a .sublime-build for the typical things I do in building a new version of a debian package (‘dch new’ to create a new changelog entry, ‘dpkg-buildpackage’ to build the new package, running Lintian, ‘dh_clean’ to clean up debian build files, etc. What I’m having troube with is getting Sublime Text to recognize this build system when I hit Ctrl-B. I just get ‘No Build System’ in teh status line. My ‘Debian.sublime-build’ file is obviousy being seen, as "Debian’ shows up under the Tools/Build System menu. I still get ‘No Build System’ if Tools/Build System is set to ‘Debian’.
This is my first time trying to create a .sublime-build file, so it’s likely I’m misunderstanding something.

The current contents of my Debian.sublime-build file is:

{
    "keyfiles": ["debian"],
    "variants": 
    [
        {
            "name": "Build Package",
            "working_dir": "$project",
            "shell_cmd": "dpkg-buildpackage"
        },
        {
            "name": "Run Lintian",
            "working_dir": "$project_path/..",
            "shell_cmd": "lintian $project_name*.change",
        },
        {
            "name": "Upload Package",
            "working_dir": "$project_path/..",
            "shell_cmd": "dupload"
        },
        {
            "name": "New changelog entry",
            "working_dir": "$project_path",
            "shell_cmd": "dch new"
        }
        {
            "name": "Clean package files",
            "working_dir": "$project_path",
            "shell_cmd": "dh_clean"
        }
    ]
}

The file in the current view is irrelevant, so I’m not using a “selector”. I’ve tried using a “keyfiles” entry of [“debian”], or {“debian/changelog”], as the obvious sign of a debian package project is the debian directory in the project root (and the changelog file in that directory, if “keyfiles” won’t accept a directory name). What am I missing? Any suggestions?

0 Likes

#2

The last two variants (New changelog entry and Clean package files) are not separated by a comma, so the file isn’t valid JSON and doesn’t load properly. Unfortunately there’s no outward sign that this is the problem in the general case; Sublime doesn’t display any problems in the console and the build still appears because the file exists.

The PackageDev package has among its features an enhanced syntax for sublime build systems that makes them easier to work with and also highlights errors, so you may want to give it a try.

0 Likes

#3

Thanks, both for pointing out the syntax problem, and pointing to PackageDev. Once I got the syntax out of the way, turns out that “keyfiles”: [“debian/changelog”] does a good job of selecting debian package projects.

0 Likes