8.4. platformids.dist.archlinux

8.4.1. Module

Module Arch Linux [doc].

8.4.2. Description

8.4.2.1. Rolling Version Identifier

The current version of ArchLinux does not seem to support the current state of the installation, even not the build release of the install medium by the runtime system. Thus the platformids provide as the basic information of the installation state for now the last modification time of the package cache directory of pacman:

/var/cache/pacman/pkg

With the values by os.stat:

release-version := (<time.struct_time.tm_year>, <time.struct_time.tm_month>, <time.struct_time.tm_mday>)

or as a formatted string in accordance to the ISO naming convention:

release-version-str := "%d.%02d.%02d" (<time.struct_time.tm_year>, <time.struct_time.tm_month>, <time.struct_time.tm_mday>)

This information is due to several scenarios not reliable, but to say

  1. better than none

  2. probably not so bad, even though not each mod results from a full upgrade

Warning

Do not mixup this release state information with the release of the actual installation media. And once again, the provided release information by platformids is basically reliable after an upgrade only, e.g.:

pacman -Su

8.4.3. Source

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
# -*- coding: utf-8 -*-
"""ArchLinux releases.
"""
from __future__ import absolute_import

import os
import time


# from platformids import _debug, _verbose
from pythonids import PYV35Plus
from platformids import RTE, rte2num, num2rte, num2pretty, custom_rte_distrel2tuple, \
    RTE_LINUX, RTE_DISTEXT, RTE_ARCHLINUX, \
    RTE_DIST , PlatformIDsUnknownError, \
    DSKORG_ID, DSKORG_ID_LIKE, DSKORG_NAME_RELEASE, DSKORG_VERSION, PlatformIDsFileCheck



__author__ = 'Arno-Can Uestuensoez'
__license__ = "Artistic-License-2.0 + Forced-Fairplay-Constraints"
__copyright__ = "Copyright (C) 2010-2018 Arno-Can Uestuensoez" \
                " @Ingenieurbuero Arno-Can Uestuensoez"
__version__ = '0.1.35'
__uuid__ = "7add5ded-c39b-4b6e-8c87-1b3a1c150ee9"


RTE_ARCHLINUX20180601 = RTE_ARCHLINUX           + 0x000060c1 #: archlinux - 2018.06.01
RTE_ARCHLINUX20181001 = RTE_ARCHLINUX           + 0x00006141 #: archlinux - 2018.10.01
RTE_ARCHLINUX20181101 = RTE_ARCHLINUX           + 0x00006161 #: archlinux - 2018.11.01
RTE_ARCHLINUX20181201 = RTE_ARCHLINUX           + 0x00006181 #: archlinux - 2018.12.01
RTE_ARCHLINUX20190401 = RTE_ARCHLINUX           + 0x00006281 #: archlinux - 2019.04.01

    
#: mapping of the rte string and numeric representation to the numeric value
rte2num.update(
    {
        'archlinux20180601':          RTE_ARCHLINUX20180601,
        'archlinux20181001':          RTE_ARCHLINUX20181001,
        'archlinux20181101':          RTE_ARCHLINUX20181101,
        'archlinux20181201':          RTE_ARCHLINUX20181201,
        'archlinux20190401':          RTE_ARCHLINUX20190401,
    }
)


#: mapping of the rte numeric representation to the string value
num2rte.update(
    {
        RTE_ARCHLINUX20180601:        'archlinux20180601',
        RTE_ARCHLINUX20181001:        'archlinux20181001',
        RTE_ARCHLINUX20181101:        'archlinux20181101',
        RTE_ARCHLINUX20181201:        'archlinux20181201',
        RTE_ARCHLINUX20190401:        'archlinux20190401',
    }
)

#: mapping of the rte numeric representation to the string value
# num2pretty.update(
#     {
#     }
# )


dist = ['', '', '', 'ArchLinux', '', '']

try:

    if os.path.exists("/etc/os-release"):

        #
        # slightly different to others, thus do not want shared code
        #
        with open("/etc/os-release", 'r') as f:
            for l in f:
                if l.startswith('ID='):
                    dist[0] = dist[5] = DSKORG_ID.sub(r'\1', l)
    
                elif l.startswith('VERSION='):
                    # optional custom value, not defined by ArchLinux
                    dist[1] = _ver = DSKORG_VERSION.split(l)
    
                elif l.startswith('ID_LIKE='):
                    dist[2] = DSKORG_ID_LIKE.sub(r'\1', l)
    
                elif l.startswith('NAME='):
                    dist[3] = _nam = DSKORG_NAME_RELEASE.split(l)[-1]
    
        if dist[5] == 'arch':
            _s = os.stat('/va/cache/pacman/pkg')
            _t = time.gmtime(_s.st_mtime)
            dist[4] = (_t.tm_year, _t.tm_mon, _t.tm_mday)
            dist[1] = '%d.%02d.%02d' % (_t.tm_year, _t.tm_mon, _t.tm_mday)
            dist[0] = 'arch%d%d%d' % (_t.tm_year, _t.tm_mon, _t.tm_mday)
            dist[2] = 'ArchLinux-' + dist[1]  


except PlatformIDsFileCheck:
    # not on ArchLinux platform, so scan will fail
    pass    


if dist[5] != 'arch':
    # does not actually match ArchLinux
    dist = ['arch', '0.0.0', 'ArchLinux-0.0.0', 'ArchLinux', (0, 0, 0,), 'arch']



8.4.4. Download

armbian.py