#apt #list #source #linux

oma-apt-sources-lists

用于从系统 apt 源列表中获取信息的库

6 个版本 (3 个重大变更)

0.4.0 2024年7月17日
0.3.2 2024年7月17日
0.3.1 2024年5月6日
0.2.0 2023年10月24日
0.1.0 2023年8月18日

#219 in Unix APIs

Download history 62/week @ 2024-04-22 297/week @ 2024-04-29 244/week @ 2024-05-06 180/week @ 2024-05-13 121/week @ 2024-05-20 117/week @ 2024-05-27 51/week @ 2024-06-03 40/week @ 2024-06-10 71/week @ 2024-06-17 84/week @ 2024-06-24 71/week @ 2024-07-01 12/week @ 2024-07-08 451/week @ 2024-07-15 318/week @ 2024-07-22 249/week @ 2024-07-29

1,036 monthly downloads
用于 oma-refresh

MIT 许可证

50KB
1K SLoC

apt-sources-lists

Rust 包用于从所有可用的 apt 源中获取详细信息。

示例

extern crate apt_sources_lists;

use apt_sources_lists::*;

pub fn main() {
    let list = SourcesList::scan().unwrap();
    for event in list.into_iter() {
        match event {
            SourceEvent::NewList(path) => {
                println!("{}:", path.display());
            }
            SourceEvent::Entry(entry) => {
                // Pretty
                println!("  {}", entry);
                if let SourceLine::Entry(ref entry) = *entry {
                    println!("    Dist paths:");
                    for dist in entry.dist_components() {
                        println!("      {}", dist);
                    }
                    println!("    Pool path: {}", entry.pool_path());
                }
            }
        }
    }
}

示例输出

/etc/apt/sources.list:
  # deb cdrom:[Pop_OS 18.04 _Bionic Beaver_ - Release amd64 (20180916)]/ bionic main restricted
  deb http://us.archive.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb-src http://us.archive.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb http://us.archive.ubuntu.com/ubuntu/ cosmic-updates main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb-src http://us.archive.ubuntu.com/ubuntu/ cosmic-updates main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb http://us.archive.ubuntu.com/ubuntu/ cosmic-security main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb-src http://us.archive.ubuntu.com/ubuntu/ cosmic-security main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-security/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb http://us.archive.ubuntu.com/ubuntu/ cosmic-backports main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb-src http://us.archive.ubuntu.com/ubuntu/ cosmic-backports main restricted universe multiverse
    Dist paths:
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/main
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/restricted
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/universe
      http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/multiverse
    Pool path: http://us.archive.ubuntu.com/ubuntu/pool/
  deb http://apt.pop-os.org/proprietary cosmic main
    Dist paths:
      http://apt.pop-os.org/proprietary/dists/cosmic/main
    Pool path: http://apt.pop-os.org/proprietary/pool/
  # deb-src http://apt.pop-os.org/proprietary cosmic main
/etc/apt/sources.list.d/mmstick76-ubuntu-ion-shell-cosmic.list:
  deb http://ppa.launchpad.net/mmstick76/ion-shell/ubuntu cosmic main
    Dist paths:
      http://ppa.launchpad.net/mmstick76/ion-shell/ubuntu/dists/cosmic/main
    Pool path: http://ppa.launchpad.net/mmstick76/ion-shell/ubuntu/pool/
  # deb-src http://ppa.launchpad.net/mmstick76/ion-shell/ubuntu cosmic main
  # deb-src http://ppa.launchpad.net/mmstick76/ion-shell/ubuntu cosmic main
/etc/apt/sources.list.d/dmj726-ubuntu-nvidia-367-bionic.list:
  # deb http://ppa.launchpad.net/dmj726/nvidia-367/ubuntu cosmic main # disabled on upgrade to cosmic
  # deb-src http://ppa.launchpad.net/dmj726/nvidia-367/ubuntu bionic main
/etc/apt/sources.list.d/system76-ubuntu-pop-bionic.list:
  deb http://ppa.launchpad.net/system76/pop/ubuntu cosmic main
    Dist paths:
      http://ppa.launchpad.net/system76/pop/ubuntu/dists/cosmic/main
    Pool path: http://ppa.launchpad.net/system76/pop/ubuntu/pool/
  deb-src http://ppa.launchpad.net/system76/pop/ubuntu cosmic main
    Dist paths:
      http://ppa.launchpad.net/system76/pop/ubuntu/dists/cosmic/main
    Pool path: http://ppa.launchpad.net/system76/pop/ubuntu/pool/

依赖项

~2.5MB
~58K SLoC