Parsing the sources. list file in apt System

Source: Internet
Author: User


Why should we analyze the parsing of sources. list? I am not a developer of Apt. I just encountered a problem of hiding. I cannot update it without analysis. I will not elaborate on the detailed reasons. The person who found this article will find it anyway, it must have encountered a similar problem. What? You have no problem? Why is it a waste of time?

Why? Since I spent a lot of time figuring out the format of APT sources. List, the problem is fixed, but what is the significance of this knowledge? It's totally irrelevant to what I really want to do. It's just a waste of time. This is a helpless passive and useless task. You cannot do the right thing because you are not clear about it ..

So, after reading Wang Yin's recent spout: Talking about Linux, Windows and Mac (http://www.yinwang.org/blog-cn/2013/03/07/linux-windows-mac/), I really agree with some of his views: in terms of ease of use, linux and Windows are far behind each other.

However, once again, we can't blindly follow the old ox ~ Apple is the same as the Unix kernel. It is widely recognized that Apple is the best in terms of ease of use (not perfect, but better than others); Linux kernel for Android, ease of use is also quite good. Therefore, I believe that this ease of use is not necessarily related to * nix or windows. ease of use is a tough task, whether it is a convenient GUI or a unified interface style of the entire system, it is necessary to have a strong interest-driven approach before someone can do it. Otherwise, I only write and play on my own. After my passion, who is still in the mood to worry about how others use it? No matter what the problem is, what do you think is not easy to use? That just means you are stupid...


The Spam ends. The following content is specific:

-----------------------------------

/Etc/APT/sources. List

Generally, the source information is stored in this file. However, many software sources are implemented in a single file, so the new version of ubuntu also has a classification method:


Folder/etc/APT/sources. List. d/

In this folder, you can just name it by using the list extension. For example, Google Chrome's source is

/Etc/APT/sources. List. d/google-chrome.list file.


> CAT google-chrome.list

Deb http://dl.google.com/linux/chrome/deb/ stable main


A lot of other background information will not be mentioned. Google will give me a much more detailed introduction than me. I just said that I haven't found Google for a long time, this is a waste of time to analyze: sources. list File Parsing:


Deb http://cn.archive.ubuntu.com/ubuntu/ precise main restricted


How can I explain this sentence? What folders are there on the server? Corresponding:


Http://cn.archive.ubuntu.com/ubuntu/dists/precise/main

Http://cn.archive.ubuntu.com/ubuntu/dists/precise/restricted


That is to say, the parsing rule is like this:


Uri + "dists" + version number information + several categories


Http://cn.archive.ubuntu.com/ubuntu/dists there are several folders under this folder, there are all Ubuntu version number


Http://cn.archive.ubuntu.com/ubuntu/dists/precise/ there are several folders under this folder, there are


binary-amd64/                                      26-Apr-2012 06:49       -binary-i386/                                       26-Apr-2012 06:49       -debian-installer/                                  14-Oct-2011 08:29       -dist-upgrader-all/                                 21-Apr-2012 01:33       -i18n/                                              26-Apr-2012 06:49       -installer-amd64/                                   24-Apr-2012 03:35       -installer-i386/                                    24-Apr-2012 04:05       -source/


Deb-Src corresponds to the source, and Deb corresponds to binary-xxx, and XXX is arch, for example, i386 (32-bit) or amd64 (64-bit ). (Others are not further explored)


If this option is not set all ubuntures defined by the APT: ubuntures option will be downloaded by default.

What is option? For example, if you want to specify your own arch, write it as follows:

Deb [arch = amd64] http://cn.archive.ubuntu.com/ubuntu/ precise main restricted


Corresponding:

Http://cn.archive.ubuntu.com/ubuntu/dists/precise/main/binary-amd64/


"Binary-" is automatically added during parsing -". In addition, [] must be added, or an error will be reported. This is written in man:

Deb [Options] URI distribution [component1] [component2] [...]


Who knows how to write Nima! I directly ignored it at the beginning, and the result was a waste of a lot of time ..


Finally, let's say a few more words:

Or look at Deb http://cn.archive.ubuntu.com/ubuntu/ precise main restricted

There should be a release file in the http://cn.archive.ubuntu.com/ubuntu/dists/precise, where there will be specific information about the folder

That is to say, when you spell your own address, Uri + version should be spelled into a folder with release, or an error will be reported.

Also, if the release file is not in line with the actual folder structure (this is a strange issue), you should use the option mentioned above, Good lucky!


Parsing the sources. list file in apt System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.