Method: Autoproj::RepositoryManagers::APT#add_source

Defined in:
lib/autoproj/repository_managers/apt.rb

#add_source(source, file = nil) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/autoproj/repository_managers/apt.rb', line 75

def add_source(source, file = nil)
    file = if file
               File.join(sources_dir, "sources.list.d", file)
           else
               autoproj_sources
           end

    new_entry = parse_source_line(source)
    found = entry_exist?(new_entry)

    if found
        file = found.first
        entry = found.last
        return false if entry[:enabled]

        enable_entry_in_file(file, entry)
    else
        add_entry_to_file(file, new_entry)
    end
end