blogng/blog/2017-08-02-linux-4.12.markdown
Dhananjay Balan 58b20109cf Convert from old categories to tags
import sys
import yaml

with open(sys.argv[1]) as fp:
    data = fp.read()

if not data.find("---") == 0:
    # no head
    print("NO YAML HEAD FOUND")
    sys.exit(-1)

data = data[3:]
head_end = data.find("---")

head = data[0:head_end]
data = data[head_end+3:]

metadata = yaml.safe_load(head)

cats = metadata.pop('categories', None)
if cats != None:
    if type(cats) == list:
        tags = cats
    elif type(cats) == str:
        tags = cats.split()

    tags = list(map(lambda t: t.lower(), tags))

    metadata["tags"] = ", ".join(tags)
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    # write it
    print(f"coverted: categories to tags: {tags} - {sys.argv[1]}")
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)

if not metadata.get("tags", None):
    metadata["tags"] = "untagged"
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    print(f"untagged: {sys.argv[1]}")
    # write it
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)

print("No changes needed")
2019-01-28 17:16:27 -05:00

1.2 KiB

comments date layout tags title
true 2017-08-02 post linux, kernel, systems, code Linux-4.12

Linux 4.12 was released few weeks ago. Its always nice to get a new version of kernel, but this time it was extra sweet, I managed to get some tiny commits merged to the release.

This was because of the Eudyptula Challenge, a program a quite kernel person has been running that helps people get started with Linux kernel development. I'm now at the 18 of 20 programming tasks. Every challenge is mailed to you (In plain email) after you finish the last one, and each step is a learning experience. You quickly realize that you can't solve things by plain google-stackoverflow duos, and eventually you discover the magical Documentation folder in linux tree.

Three out of my four commits have been style fixes, and the last one was a locking discrepancy in one of the staging drivers. The links are here.

There is a certain feel of happiness when I get to understand when things are implemented in kernel. I'm really looking forward to poking the code and do more than trivial commits.