Cross package maker. DEB/RPM generation or conversion. Derived from jordansissel/fpm.

⌈⌋ ⎇ branch:  cross package maker


Check-in [9b84678e1c]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:- start hacking at rpm files with pure ruby.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9b84678e1cfe8616906bcf1cb3978269461febab
User & Date: jls@semicomplete.com 2011-05-13 04:57:57
Context
2011-05-13
05:08
- fix packing/unpacking - A vs a (a uses nulls, A spaces) check-in: 576898832f user: jls@semicomplete.com tags: trunk
04:57
- start hacking at rpm files with pure ruby. check-in: 9b84678e1c user: jls@semicomplete.com tags: trunk
04:20
- Refactor architecture selection. Unless specified, the arch is selected automatically. The default arch is "native" Also support "native" and "all" strings which are converted to the appropriate values for the target packages. "all" will become "noarch" for rpms (stays as 'all' for deb) "native" will become amd64 or i386 for deb (or other) "native" will become the output of 'uname -m' for rpm. If the source is a gem, and the gem has no extensions (ruby C code), default to "all". If it has C extensions (like eventmachine and sqlite3 gems), then the arch defaults to "native" This resolves: https://github.com/jordansissel/fpm/pull/29 https://github.com/jordansissel/fpm/issues/25 https://github.com/jordansissel/fpm/issues/14 check-in: 8d310b574d user: jls@semicomplete.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added experimental/rpmlib.rb.































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

class RPMFile 
  def initialize(file)
    if file.is_a?(String)
      file = File.new(file, "r")
    end
    @file = file

    # Make sure we're at the beginning of the file.
    @file.seek(0, IO::SEEK_SET)
  end # def initialize

  class Lead
    #struct rpmlead {
    attr_accessor :magic #unsigned char magic[4]; 
    attr_accessor :major #unsigned char major;
    attr_accessor :minor #unsigned char minor;
    attr_accessor :type  #short type;
    attr_accessor :archnum #short archnum;
    attr_accessor :name #char name[66];
    attr_accessor :osnum #short osnum;
    attr_accessor :signature_type #short signature_type;
    attr_accessor :reserved #char reserved[16];
    #}
    
    def read(file)
      data = file.read(96).unpack("A4CCssA66ssA16")
      @magic, @major, @minor, @type, @archnum, @name, \
        @osnum, @signature_type, @reserved = data
      return nil
    end # def read

    def write(file)
      data = [ @magic, @major, @minor, @type, @archnum, @name, \
               @osnum, @signature_type, @reserved ].pack("A4CCssA66ssA16")
      file.write(data)
    end # def write
  end # class ::RPMFile::Lead

  def lead
    if @lead.nil?
      @lead = ::RPMFile::Lead.new
      @lead.read(@file)
    end
    return @lead
  end # def lead
end # class RPMFile