apt-get –print-uris update dengan web2py

Di Debian/Ubuntu linux, ada opsi –print-uris dari apt-get, yang outputnya akan menampilkan alamat URI dari file index yang akan didownload apt-get. Misalnya outputnya gini

$ apt-get --print-uris update
'http://ftp.hk.debian.org/debian/dists/stable/main/source/Sources.bz2' http://ftp.hk.debian.org_debian_dists_stable_main_source_Sources 0 :
'http://ftp.hk.debian.org/debian/dists/stable/contrib/source/Sources.bz2' http://ftp.hk.debian.org_debian_dists_stable_contrib_source_Sources 0 :
'http://ftp.hk.debian.org/debian/dists/stable/non-free/source/Sources.bz2' http://ftp.hk.debian.org_debian_dists_stable_non-free_source_Sources 0 :
'http://ftp.hk.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' http://ftp.hk.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
'http://ftp.hk.debian.org/debian/dists/stable/contrib/binary-amd64/Packages.bz2' http://ftp.hk.debian.org_debian_dists_stable_contrib_binary-amd64_Packages 0 :
'http://ftp.hk.debian.org/debian/dists/stable/non-free/binary-amd64/Packages.bz2' http://ftp.hk.debian.org_debian_dists_stable_non-free_binary-amd64_Packages 0 :
'http://ftp.hk.debian.org/debian/dists/stable/Release' http://ftp.hk.debian.org_debian_dists_stable_Release 0
'http://ftp.hk.debian.org/debian/dists/stable/Release.gpg' http://ftp.hk.debian.org_debian_dists_stable_Release.gpg 0
'http://ftp.hk.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' http://ftp.hk.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
'http://ftp.hk.debian.org/debian/dists/stable/contrib/i18n/Translation-en_US.bz2' http://ftp.hk.debian.org_debian_dists_stable_contrib_i18n_Translation-en%5fUS 0 :
'http://ftp.hk.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' http://ftp.hk.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
'http://ftp.hk.debian.org/debian/dists/stable/main/i18n/Translation-en_US.bz2' http://ftp.hk.debian.org_debian_dists_stable_main_i18n_Translation-en%5fUS 0 :
'http://ftp.hk.debian.org/debian/dists/stable/non-free/i18n/Translation-en.bz2' http://ftp.hk.debian.org_debian_dists_stable_non-free_i18n_Translation-en 0 :
'http://ftp.hk.debian.org/debian/dists/stable/non-free/i18n/Translation-en_US.bz2' http://ftp.hk.debian.org_debian_dists_stable_non-free_i18n_Translation-en%5fUS 0 :
'http://security.debian.org/dists/stable/updates/main/binary-amd64/Packages.bz2' security.debian.org_dists_stable_updates_main_binary-amd64_Packages 0 :
'http://security.debian.org/dists/stable/updates/contrib/binary-amd64/Packages.bz2' security.debian.org_dists_stable_updates_contrib_binary-amd64_Packages 0 :
'http://security.debian.org/dists/stable/updates/non-free/binary-amd64/Packages.bz2' security.debian.org_dists_stable_updates_non-free_binary-amd64_Packages 0 :
'http://security.debian.org/dists/stable/updates/Release' security.debian.org_dists_stable_updates_Release 0
'http://security.debian.org/dists/stable/updates/Release.gpg' security.debian.org_dists_stable_updates_Release.gpg 0
'http://security.debian.org/dists/stable/updates/contrib/i18n/Translation-en.bz2' security.debian.org_dists_stable_updates_contrib_i18n_Translation-en 0 :
'http://security.debian.org/dists/stable/updates/contrib/i18n/Translation-en_US.bz2' security.debian.org_dists_stable_updates_contrib_i18n_Translation-en%5fUS 0 :
'http://security.debian.org/dists/stable/updates/main/i18n/Translation-en.bz2' security.debian.org_dists_stable_updates_main_i18n_Translation-en 0 :
'http://security.debian.org/dists/stable/updates/main/i18n/Translation-en_US.bz2' security.debian.org_dists_stable_updates_main_i18n_Translation-en%5fUS 0 :
'http://security.debian.org/dists/stable/updates/non-free/i18n/Translation-en.bz2' security.debian.org_dists_stable_updates_non-free_i18n_Translation-en 0 :
'http://security.debian.org/dists/stable/updates/non-free/i18n/Translation-en_US.bz2' security.debian.org_dists_stable_updates_non-free_i18n_Translation-en%5fUS 0 :

Dengan web2py framework dan bantuan python-apt, bisa dibuat di web-based.

Di bagian controllernya tambahkan

def uri(): 
    apt_pkg.init_config()
    apt_pkg.init_system()
    acquire = apt_pkg.Acquire()
    slist = apt_pkg.SourceList()
    slist.read_main_list()
    slist.get_indexes(acquire, True)
    return dict(item=acquire.items) 

Sementara di viewnya,

{{extend 'layout.html'}}
<ul>
{{for items in item:}}<li>{{=items.desc_uri}}</li>{{pass}}
</ul>

Semoga bermanfaat 🙂

Sumber:
1. Dokumentasi python-apt
2. Dokumentasi Web2py framework

Advertisements
Comments
2 Responses to “apt-get –print-uris update dengan web2py”
  1. Christal says:

    An impressive share! I have just forwarded this onto a colleague
    who had been conducting a little research on this.
    And he actually bought me lunch simply because I discovered
    it for him… lol. So let me reword this…. Thank YOU for the
    meal!! But yeah, thanx for spending time to talk about this topic here on your web page.

  2. Coba posting-posting yang ada di sini dijadikan kuliah. Berguna banget saya kira, Kang.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: