From dfd70a1d1d736131ff15efab83b570997a4ef09a Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 22 Mar 2016 11:23:55 +0000 Subject: [PATCH] include all source not just GPL Signed-off-by: Justin Cormack --- licensing/Dockerfile | 2 +- licensing/README.md | 9 +++------ licensing/license.sh | 31 ++++++++++++++++------------- licensing/{gpl.lua => packages.lua} | 4 +--- 4 files changed, 22 insertions(+), 24 deletions(-) rename licensing/{gpl.lua => packages.lua} (74%) diff --git a/licensing/Dockerfile b/licensing/Dockerfile index 6c3a6ff04..17a1c6326 100644 --- a/licensing/Dockerfile +++ b/licensing/Dockerfile @@ -4,6 +4,6 @@ RUN apk update && apk add lua git RUN git clone https://github.com/alpinelinux/aports.git -ADD license.sh gpl.lua /usr/bin/ +ADD license.sh packages.lua /usr/bin/ CMD license.sh diff --git a/licensing/README.md b/licensing/README.md index d99c94984..a422939ba 100644 --- a/licensing/README.md +++ b/licensing/README.md @@ -1,12 +1,9 @@ -Extract GPL source from Moby +Extract source from Moby -WORK IN PROGRESS SOME ISSUES STILL - -This container runs on a Pinata system and dumps out the GPL code it is running +This container runs on a Pinata system and dumps out the source code for the +kernel and packages ``` docker build -t license . docker run -it -v /etc:/hostetc -v /lib:/lib -v $PWD/output:/output license ``` - -TODO add kernel to this, there is now a patch to get the metadata in. diff --git a/licensing/license.sh b/licensing/license.sh index b868afa45..78a147f9c 100755 --- a/licensing/license.sh +++ b/licensing/license.sh @@ -1,5 +1,5 @@ #!/bin/sh - +set -x cat /hostetc/issue | grep -q Moby || ( printf "You must run this script with -v /etc:/hostetc -v /lib:/lib\n" && exit 1 ) apk info | grep -q fuse || ( printf "You must run this script with -v /etc:/etc -v /lib:/lib\n" && exit 1 ) @@ -29,7 +29,7 @@ rm -rf .git cd /aports git pull -gpl.lua | while read l +packages.lua | while read l do echo $l APORT_PACKAGE=$(echo $l | sed 's/ .*//') @@ -42,17 +42,20 @@ do export srcdir=/output cd main/${APORT_ORIGIN} . ./APKBUILD - mkdir -p "$srcdir"/$pkgname-$pkgver - for f in $source - do - if [ -f $f ] - then - cp -a $f "$srcdir"/$pkgname-$pkgver/ - else - ( cd "$srcdir"/$pkgname-$pkgver && \ - wget $f || ( printf "Cannot retrieve $f\n" && exit ) - ) - fi - done + if [ ! -d "$srcdir"/$pkgname-$pkgver ] + then + mkdir -p "$srcdir"/$pkgname-$pkgver + for f in $source + do + if [ -f $f ] + then + cp -a $f "$srcdir"/$pkgname-$pkgver/ + else + cd "$srcdir"/$pkgname-$pkgver && \ + wget $f || ( printf "Cannot retrieve $f\n" && exit ) && \ + cd - + fi + done + fi ) done diff --git a/licensing/gpl.lua b/licensing/packages.lua similarity index 74% rename from licensing/gpl.lua rename to licensing/packages.lua index b2a045964..5b8a6cf3d 100755 --- a/licensing/gpl.lua +++ b/licensing/packages.lua @@ -5,9 +5,7 @@ f = io.open("/lib/apk/db/installed") for line in f:lines() do if line == "" then - if p.L:match("[Gg][Pg][Ll]") then - print(p.P, p.L, p.c) - end + print(p.P, p.L, p.c) p = {} else k, v = line:match("(%a):(.*)")