jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.16k stars 1.07k forks source link

Creating a .deb-package on a windows machine #505

Open majo83 opened 11 years ago

majo83 commented 11 years ago

Hey folks,

could be I'm the first to try this out, but building a .deb-package in a windows machine is not possible currently. Is windows supported anyhow? To create .deb-packages, the only underlying tool neccessary would be tar (and maybe gzip), but both could be easily from Msys or UnixUtils I guess.

After looking at the source however and tracing the error messages I think building a .deb unter windows could be achieved pretty easily. Let's assume this command issued from a powershell command (pretty easy: create a .deb-file from a dirtree): PS> fpm -s dir -t deb -n "testpackage" -v 1.0 root/

I've identified two places in the source code where easy changes could be made. However, as I'm not a ruby developer (I develop in python), I'm somewhat unconfident to do it myself.

First change: --- deb.rb starting at line number 96 ---

Get the recommended 'tar' command for this platform.

def tar_cmd

Rely on gnu tar for solaris and OSX.

case %x{uname -s}.chomp
when "SunOS"
  return "gtar"
when "Darwin"
  return "gnutar"
else
  return "tar"
end

end # def tar_cmd

I have a uname installed by UnixUtils, however when fpm executes the above instruction, I get: PS some_path/ruby-2.0.0-p195-i386-mingw32/lib/ruby/gems/2.0.0/gems/fpm-0.4.37/lib/fpm/package/deb.rb:132:in ``': No such file or directory - uname -m (Errno::ENOENT)

Note: The missing .exe at the end of uname is not the issue, as my sh.exe (also from UnixUtils) should be smart enough to supply that.

Bypassing the above code (by suppling the -a flag, e.g. like this: fpm -s dir -t deb -a i386 -n "testpackage" -v 1.0 root/) I get an exception raised here

--- deb.rb starting at line number 29 ---

Scan path to find the executable

# Do this to help the user get a better error message.
if !program.include?("/") and !program_in_path?(program)
  raise ExecutableNotFound.new(program)

end

Commenting that sanity check out I get an error somewhere in the cildprocess gem of ruby (not your domain anymore, however I think it should be pretty easy to write code to excute independend of the underlying os). So it's just 2 or 3 basic changes to do.

What's your opinion about that?

Best regards, majo

r4um commented 11 years ago

@majo83 can you try fpm in cygwin.

jordansissel commented 10 years ago

fixing the mknod crap should be pretty easy. However, more testing is required to understand what exactly doesn't work under Windows and what we'd need to change in fpm to make it work.

r4um commented 10 years ago

Treatment of file/directory paths comes to mind, on the windows the path separator is \ on unix /. We should not be hard coding these.

jordansissel commented 10 years ago

Agreed. Further, commands like 'tar' and 'ar' don't exist on Windows. You might get them with cygwin, though.