From 9fd9f2355cbfc030d16c5ca24433a87c88889637 Mon Sep 17 00:00:00 2001 From: rhatto Date: Tue, 3 Apr 2007 22:19:09 +0000 Subject: - jail-commit warning for file not found - repos: cosmetic changes - templatepkg: now supports a tagfile or slack-required as a template git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@212 04377dda-e619-0410-9926-eae83683ac58 --- trunk/doc/CHANGELOG | 5 +++++ trunk/src/jail-commit | 6 ++++++ trunk/src/repos | 37 ++++++++++++++++++++++++++++++------- trunk/src/templatepkg | 6 +++--- 4 files changed, 44 insertions(+), 10 deletions(-) (limited to 'trunk') diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG index 3c9988e..270379d 100644 --- a/trunk/doc/CHANGELOG +++ b/trunk/doc/CHANGELOG @@ -4,6 +4,10 @@ simplepkg changelog 0.5pre1 ======= + - repos: cosmetic changes + + - jail-commit warning for file not found + - lspkg: - support for $ROOT env variable - some improvements @@ -34,6 +38,7 @@ simplepkg changelog - templatepkg: -a option changed to add files into a template -u option now updated a template + - now supports a tagfile or slack-required as a template 0.4.9pre18-23 ============= diff --git a/trunk/src/jail-commit b/trunk/src/jail-commit index 59fccad..45aea1e 100755 --- a/trunk/src/jail-commit +++ b/trunk/src/jail-commit @@ -56,6 +56,12 @@ function template_merge { owner="`get_owner $1/$file`" group="`get_group $1/$file`" echo "$file;$owner;$group;$perms" >> $TEMPLATE_BASE.perms + else + if [ ! -f "$file" ]; then + echo $BASENAME: warning: missing file $file + else + echo $BASENAME: warning: missing template file $1/$file + fi fi done diff --git a/trunk/src/repos b/trunk/src/repos index 465714b..95a3936 100755 --- a/trunk/src/repos +++ b/trunk/src/repos @@ -8,24 +8,39 @@ # the Free Software Foundation; either version 2 of the License, or # any later version. # -# changes by rhatto at riseup.net to fit http://slack.sarava.org needs -# +# Changes by rhatto at riseup.net to fit http://slack.sarava.org needs +# +# TODO: - simplepkg's config file support +# - integration with binary repository +# - package's and CHECKSUMS.md5 signature creation +# + +function usage { + + echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" + +} function svn_add_meta { + find *meta -exec svn add {} 2> /dev/null \; find . -name *meta -exec svn add {} 2> /dev/null \; + } function gen_filelist { + for file in `find | grep -e ".tgz$"`; do ls -l $file; done > FILELIST.TXT echo "Created new FILELIST.TXT" if [ -d "patches" ]; then for file in `find patches | grep -e ".tgz$"`; do ls -l $file; done > patches/FILE_LIST echo "Created new patches/FILE_LIST" fi + } function gen_packages_txt { + echo '' > PACKAGES.TXT find . -type f -name '*.meta' -exec cat {} \; >> PACKAGES.TXT cat PACKAGES.TXT | gzip -9 -c - > PACKAGES.TXT.gz @@ -35,9 +50,11 @@ function gen_packages_txt { cat patches/PACKAGES.TXT | gzip -9 -c - > patches/PACKAGES.TXT.gz echo "Created new patches/PACKAGES.TXT and patches/PACKAGES.TXT.gz" fi + } function gen_md5_checksums { + echo '' > CHECKSUMS.md5 find . -type f -name '*.tgz' -exec md5sum {} \; >> CHECKSUMS.md5 cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz @@ -47,9 +64,11 @@ function gen_md5_checksums { cat patches/CHECKSUMS.md5 | gzip -9 -c - > patches/CHECKSUMS.md5.gz echo "Created new patches/CHECKSUMS.md5 and patches/CHECKSUMS.md5.gz" fi + } function gen_meta { + if [ ! -f $1 ]; then echo "File not found: $1" exit 1; @@ -80,27 +99,30 @@ function gen_meta { echo "PACKAGE DESCRIPTION:" >> $LOCATION/$METAFILE tar xzfO $1 install/slack-desc | grep -E '\w+\:'|grep -v '^#' >> $LOCATION/$METAFILE echo "" >> $LOCATION/$METAFILE + } function do_all { + for pkg in `find . -type f -name '*.tgz' -print`; do gen_meta $pkg done $0 PACKAGESTXT $0 FILELIST $0 MD5 -} -function show_usage { - echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" } +# --------------------------------- +# main +# --------------------------------- + case "$1" in pkg) if [ -n "$2" ]; then gen_meta $2 else - show_usage + usage fi ;; all) @@ -126,10 +148,11 @@ case "$1" in gen_md5_checksums ;; usage) - show_usage + usage ;; *) do_all svn_add_meta ;; esac + diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index c9771b7..8faab89 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -147,7 +147,7 @@ function template_update { for package in `ls -1 $ROOT/var/log/packages/`; do pack=`package_name $package` if [ -f $TEMPLATE ]; then - if ! `grep -v -e "^#" $TEMPLATE | cut -d : -f 1 | grep -q -e "^$pack\$"`; then + if ! `grep -v -e "^#" $TEMPLATE | cut -d : -f 1 | awk '{ print $1 }' | grep -q -e "^$pack\$"`; then echo $pack >> $TEMPLATE echo Added $pack on $TEMPLATE fi @@ -158,7 +158,7 @@ function template_update { done # check if each package from the template is installed - grep -v -e "^#" $TEMPLATE | cut -d : -f 1 | while read pack; do + grep -v -e "^#" $TEMPLATE | cut -d : -f 1 | awk '{ print $1 }' | while read pack; do if [ ! -z "$pack" ]; then unset found @@ -171,7 +171,7 @@ function template_update { done if [ "$found" != "1" ]; then # remove a non-installed package from the template - sed "/^$pack$/d" $TEMPLATE | sed "/^$pack $/d" | sed "/^$pack:*/d" > $TEMPLATE.tmp + sed "/^$pack$/d" $TEMPLATE | sed "/^$pack $/d" | sed "/^$pack:*/d" | sed "/^$pack */d" > $TEMPLATE.tmp cat $TEMPLATE.tmp > $TEMPLATE rm -f $TEMPLATE.tmp echo Removed $pack from $TEMPLATE -- cgit v1.2.3