Skip to content

Instantly share code, notes, and snippets.

View ssato's full-sized avatar

Satoru SATOH ssato

View GitHub Profile
#
# minifyrpms.py - Minify given rpm list
#
# Copyright (C) 2012 - 2014 Red Hat, Inc.
# Red Hat Author(s): Satoru SATOH <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# repodata.py - Parse repodata/*.xml.gz in yum repositories.
#
# Copyright (C) 2012 Satoru SATOH <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#! /bin/bash
#
# Simple wrapper script for rpmbuild to build *rpm w/ minimum side effects,
# e.g. creating ~/rpmbuild/{RPMS,SOURCES,BUILD,...}.
#
# Author: Satoru SATOH <satoru.satoh at gmail.com>
# License: MIT
set -e
rpmspec=
概要
-----
ソースをビルドしてリリース、実際に適用 (アップデート) するまでの全体の流れ:
#. 一応テスト
#. ビルド・リリース用の Source RPM 作成
#. ビルド & リリース (社内 Yum リポジトリへ)
#. 適用 (社内 Yum リポジトリからとってきて普通に yum update -y するだけ)
In [3]: import collections
In [4]: import anyconfig
In [5]: ips = anyconfig.load("/tmp/fleure-tests-ouZIjr/packages.json")["data"]
In [6]: ips[0]
Out[6]:
{u'arch': u'x86_64',
u'buildhost': u'x86-007.build.bos.redhat.com',
@ssato
ssato / gist:eb72d5c1e6214ffea0e4
Created December 14, 2015 17:25
json_vs_bson_vs_msgpack_vs_...
In [1]: import anyconfig
...
In [3]: save = lambda obj, fname, **kwargs: anyconfig.dump(obj, os.path.join("/tmp", fname), **kwargs)
In [4]: ipdata = anyconfig.load("/tmp/fleure-tests-ouZIjr/packages.json")
...
In [6]: %lprun -T /tmp/ips.json.lprof -f save save(ipdata, "ips.json")
Timer unit: 1e-06 s
Total time: 0.151962 s
@ssato
ssato / yum-repo-size-info-list.sh
Last active May 2, 2017 02:23
yum のリポジトリメタデータに含まれる RPM パッケージファイルのサイズ情報などからリポジトリ容量を概算
#! /bin/bash
#
# Copyright(C) 2016 Red Hat, Inc.
# Author: Satoru SATOH <[email protected]>
# License: MIT
#
# Example:
# [root@rhel-7-client-1 ~]# ./yum-repo-size-info-list.sh \
# > -r rhel-7-server-rpms -r rhel-7-server-optional-rpms \
# > -r rhel-7-server-rh-common-rpms -r rhel-7-server-extras-rpms \
@ssato
ssato / compute-holidays-fy16-17.txt
Created May 12, 2016 10:34
国民の祝日を計算してみるテスト
ssato@x1carbon% ipython
Python 2.7.11 (default, Mar 31 2016, 20:46:51)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
@ssato
ssato / dnf-report-plugin.py
Created June 8, 2016 01:27
An experimental DNF plugin to report statistics and changes will be made instead of performing actual operations like install/update/erase/etc.
# report.py
# DNF Plugin to report summary of RPMs to install, update and remove.
#
# It implicitly assume the come back of --enableplugin option to dnf although
# it was removed as 'it's questionalbe use':
# http://dnf.readthedocs.io/en/latest/cli_vs_yum.html#enableplugin-not-recognized
#
# Copyright (C) 2016 Satoru SATOH <[email protected]>
#
# This copyrighted material is made available to anyone wishing to use,
@ssato
ssato / dnf-report-plugin-output-sample-log.txt
Created June 8, 2016 01:45
dnf-report-plugin.py の実行例 (dnf-report-plugin.py を /usr/lib/python3.4/site-packages/dnf-plugins に入れて dnf install ... 実行)
ssato@x1carbon% sudo dnf install nano
Last metadata expiration check: 0:13:55 ago on Tue Jun 7 19:51:00 2016.
Dependencies resolved.
{
"install": [
{
"arch": "x86_64",
"name": "nano",
"release": "3.fc23",
"naevr": "nano.x86_64 0:2.4.2-3.fc23",