~afb/smart/ports

« back to all changes in this revision

Viewing changes to smart/channels/rpm_md_info.py

  • Committer: Anders F Bjorklund
  • Date: 2009-06-30 11:10:36 UTC
  • Revision ID: afb@users.sourceforge.net-20090630111036-5f1jpbvh4c1pn2n0
rebase against smart 1.2, unmerge all other branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
""")
31
31
 
32
32
fields = [("baseurl", _("Base URL"), str, None,
33
 
           _("URL where repodata/ subdirectory is found")),
34
 
          ("mirrorlist", _("Mirror list URL"), str, "",
35
 
           _("URL which provides list of mirrors for baseurl")),
36
 
          ("metalink", _("Meta link URL"), str, "",
37
 
           _("URL which provides metalink info for baseurl")),
38
 
          ("checksig", _("Check Signature"), bool, False,
39
 
           _("Check GPG signature of the repomd.xml metadata index")),
40
 
          ("reposig", _("Signature URL"), str, "",
41
 
           _("URL to signature (default: repodata/repomd.xml.asc)")),
42
 
          ("repokey", _("Public Key URL"), str, "",
43
 
           _("URL to public key (default: repodata/repomd.xml.key)"))]
44
 
 
45
 
def detectLocalChannels(path, media):
46
 
    import os
47
 
    channels = []
48
 
    if os.path.isfile(os.path.join(path, "repodata/repomd.xml")):
49
 
        if media:
50
 
            baseurl = "localmedia://"
51
 
            baseurl += path[len(media.getMountPoint()):]
52
 
        else:
53
 
            baseurl = "file://"
54
 
            baseurl += path
55
 
        channel = {"baseurl": str(baseurl)}
56
 
        if media:
57
 
            infofile = os.path.join(media.getMountPoint(), ".discinfo")
58
 
            if os.path.isfile(infofile):
59
 
                file = open(infofile)
60
 
                skip = file.readline().rstrip()
61
 
                name = file.readline().rstrip()
62
 
                arch = file.readline().rstrip()
63
 
                file.close()
64
 
                channel["name"] = "%s - %s - Media" % (name, arch)
65
 
        channels.append(channel)
66
 
    return channels
 
33
           _("URL where repodata/ subdirectory is found"))]
67
34