Skip to content

Commit

Permalink
Added support for centos
Browse files Browse the repository at this point in the history
  • Loading branch information
ecbtln committed Nov 18, 2014
1 parent cb6e270 commit 5019a16
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 12 deletions.
3 changes: 2 additions & 1 deletion agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

# The sources we're building
HEADERS = $(wildcard *.h)
PRODUCT_SOURCES = $(filter-out agent.c, $(wildcard *.c))
EXCLUDE = agent.c ubuntu.c
PRODUCT_SOURCES = $(filter-out $(EXCLUDE), $(wildcard *.c))

# What we're building
PRODUCT_OBJECTS = $(PRODUCT_SOURCES:.c=.o)
Expand Down
15 changes: 15 additions & 0 deletions agent/centos.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include "constants.h"


// TODO: consider using a macro to be able to inline the get_installed_cmd
void get_installed_cmd(char **cmd) {
*cmd = CENTOS__GET_INSTALLED_CMD;
}

void get_dependencies_fmt(char **fmt) {
*fmt = "repoquery --requires --resolve %s --qf %{NAME}";
}
6 changes: 5 additions & 1 deletion agent/cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ void get_installed(int clientfd) {
}

void get_dependencies(char *pkg, int clientfd) {
char *cmd = get_dependencies_cmd(pkg);
char *fmt;
get_dependencies_fmt(&fmt);
const int len = strlen(fmt) + 1 - 2 + strlen(pkg);
char *cmd = malloc(len);
snprintf(cmd, len, fmt, pkg);
exec_and_send(clientfd, cmd);
free(cmd);
}
Expand Down
1 change: 1 addition & 0 deletions agent/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
// that are installed directly in the base image
// we'll establish the convention of <OS_NAME>__GET_INSTALLED_CMD as the name of the cmd
#define UBUNTU__GET_INSTALLED_CMD "dpkg --get-selections"
#define CENTOS__GET_INSTALLED_CMD "rpm -qa --queryformat '%{NAME}\n'"


4 changes: 2 additions & 2 deletions agent/os.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
char * get_installed_cmd();
char * get_dependencies_cmd(char *pkg);
void get_installed_cmd(char **cmd);
void get_dependencies_fmt(char **fmt);
8 changes: 2 additions & 6 deletions agent/ubuntu.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ void get_installed_cmd(char **cmd) {
*cmd = UBUNTU__GET_INSTALLED_CMD;
}

char * get_dependencies_cmd(char *pkg) {
char *c = "apt-cache depends %s | grep \"Depends:\"";
const int len = strlen(c) + 1 - 2 + strlen(pkg);
char *cmd = malloc(len);
snprintf(cmd, len, c, pkg);
return cmd;
void get_dependencies_fmt(char **fmt) {
*fmt = "apt-cache depends %s | grep \"Depends:\"";
}
3 changes: 1 addition & 2 deletions chief/packagemanager/packagemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class YumPackageManager(PackageManager):
CLEAN_CMD = 'yum clean all'
INSTALL_CMD_FMT = 'yum -y install %s'
UNINSTALL_CMD_FMT = 'yum erase %s'

OS_NAME = 'CENTOS'
PACKAGE_BLACKLIST = {'systemd.*', 'fakesystemd.*'}

# yum is protected, need to make sure to not remove anything that yum depends on
Expand All @@ -147,7 +147,6 @@ def _process_get_installed(self, res):
return res.splitlines()

def get_dependencies(self, pkg):
# subprocess.check_output('repoquery --requires --resolve %s --qf %s' % (pkg, '%{NAME}'), shell=True).splitlines()
output = self.vm_socket.get_dependencies(pkg)
if output == '':
return []
Expand Down
217 changes: 217 additions & 0 deletions journal.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,230 @@ rdiffdir
810.94 MB


#Ubuntu 12.04.5
Original filesystem
1062.71 MB

Base image:
99.13 MB

no package management:
rsync diff
915.26 MB

4081 modifications + additions (880.92 MB of additions)

112 deletions (0.2135 MB of deletions)

rest are modifications

rdiffdir
905.13 MB


204 ---> 66 packages culled
including package management:

packages installed total 184MB

new "base" including packages is 325.44 MB


rsync
769.58 MB

8292 modificaitons + additions (712.31 MB of additions)
215 deletions (29.58 MB of deletion)

rest are modifications

rdiffdir
736.46 MB


# Ubuntu 13.04
Original filesystem
876.36 MB

Base image:
160.41 MB

no package management:
rsync diff
710.87 MB

2356 modifications + additions (708.93 MB of additions)

123 deletions (67.739 MB of deletions)

rest are modifications

rdiffdir
718.24 MB


226 ---> 129 packages culled
including package management:

packages installed total 237MB

ERRRRORRR updating sources

# Ubuntu 13.10
Original filesystem
1157.45 MB

Base image:
114.76 MB

no package management:
rsync diff
982.38 MB

2340 modifications + additions (967.727 MB of additions)

122 deletions (70.78 MB of deletions)

rest are modifications

rdiffdir
987.28 MB


248 ---> 147 packages culled
including package management:

packages installed total 237MB

new "base" including packages is 447.697 MB


rsync
767.73

12021 modificaitons + additions (676.34 MB of additions)
2067 deletions (15.10 MB of deletion)

rest are modifications

rdiffdir
708.148 MB




# Ubuntu 14.04
Original filesystem
1212.22 MB

Base image:
192.02 MB

no package management:
rsync diff
1008.85 MB

5657 modifications + additions (943.55 MB of additions)

135 deletions (0.2572 MB of deletions)

rest are modifications

rdiffdir
971.215 MB


183 ---> 109 packages culled
including package management:

packages installed total 161MB

new "base" including packages is 386.95 MB


rsync
894.85 MB

10729 modificaitons + additions (796.51 MB of additions)
187 deletions (23.08 MB of deletion)

rest are modifications

rdiffdir
829.01 MB



# Ubuntu 14.10

Original filesystem
1132.17 MB

Base image:
196.89 MB

no package management:
rsync diff
876.35 MB

4163 modifications + additions (856.60 MB of additions)

144 deletions (0.2716 MB of deletions)

rest are modifications

rdiffdir
872.52 MB


245 ---> 144 packages culled
including package management:

packages installed total 229MB

new "base" including packages is 468.57 MB


rsync
687.56 MB

9958 modificaitons + additions (637.728 MB of additions)
160 deletions (19.52 MB of deletion)

rest are modifications

rdiffdir
655.02 MB



#CentOS 5


#CentOS 6


#CentOS 7

#Debian???

#Fedora 20


#Fedora 21

#Mageia 3

#Mageia 4



some conclusions: take a look at the reduction in diff size after installing packages. clearly the total size increases, but the diff decreases
indicating some value of the layering


### kernel files in /usr/src are 102.33 MB and can be removed

Another similar table for CentOS

Another table for one other OS, TBD
Expand Down

0 comments on commit 5019a16

Please sign in to comment.