Testing wanted: pkgmk with --ignore-new option

Juergen Daubert jue at jue.li
Mon Nov 9 16:50:07 UTC 2009


On Sat, Sep 12, 2009 at 12:45:36AM +0300, Mikhail Kolesnik wrote:
> Hello, Johannes.
> 
> On Wed, 4 Mar 2009 19:39:05 +0100
> Johannes Winkelmann <jw at smts.ch> wrote:
> 
> > On Wed, Mar 04, 2009 at 19:22:10 +0100, Johannes Winkelmann wrote:
> > [...]
> > > I've just discovered a problem, I'll upload a new version in a bit and
> > > send another mail... sorry for the noise.
> > Fixed; still available from the same place:
> >   http://jw.smts.ch/files/crux/ports/pkgutils/
> > 
> > Make sure you use 5.33.1-pre4.
> 
> I hope there is still some interest in this functionality. I am
> attaching the patch against pkgutils-5.34.2 (made from the Johannes'
> provided tarball).

Thanks. I've splitted the patch into two, one patch for the new error
codes and one with the --ignore-new stuff. 
The later is slightly modified, added the option as comment to 
pkgmk.conf, added the option to --help output.


regards
Juergen

-- 
Juergen Daubert  |  mailto:jue at jue.li  
Korb, Germany    |  http://jue.li/crux

-------------- next part --------------
diff --git a/pkgmk.in b/pkgmk.in
index c7f5432..509822a 100755
--- a/pkgmk.in
+++ b/pkgmk.in
@@ -21,6 +21,18 @@
 #  USA.
 #
 
+##
+# error codes
+E_GENERAL=1
+E_PKGFILE=2    # invalid Pkgfile
+E_DIR_PERM=3   # (source/build) directory missing or missing read/write permission
+E_DOWNLOAD=4   # error during download
+E_UNPACK=5     # error during unpacking of source file(s)
+E_MD5=6        # md5sum verification failed
+E_FOOTPRINT=7  # footprint check failure
+E_BUILD=8      # error while running 'build()'
+E_INSTALL=9    # error while installing the package via 'pkgadd'
+
 info() {
 	echo "=======> $1"
 }
@@ -49,29 +61,29 @@ get_basename() {
 check_pkgfile() {
 	if [ ! "$name" ]; then
 		error "Variable 'name' not specified in $PKGMK_PKGFILE."
-		exit 1
+		exit $E_PKGFILE
 	elif [ ! "$version" ]; then
 		error "Variable 'version' not specified in $PKGMK_PKGFILE."
-		exit 1
+		exit $E_PKGFILE
 	elif [ ! "$release" ]; then
 		error "Variable 'release' not specified in $PKGMK_PKGFILE."
-		exit 1
+		exit $E_PKGFILE
 	elif [ "`type -t build`" != "function" ]; then
 		error "Function 'build' not specified in $PKGMK_PKGFILE."
-		exit 1
+		exit $E_PKGFILE
 	fi
 }
 
 check_directory() {
 	if [ ! -d $1 ]; then
 		error "Directory '$1' does not exist."
-		exit 1
+		exit $E_DIR_PERM
 	elif [ ! -w $1 ]; then
 		error "Directory '$1' not writable."
-		exit 1
+		exit $E_DIR_PERM
 	elif [ ! -x $1 ] || [ ! -r $1 ]; then
 		error "Directory '$1' not readable."
-		exit 1
+		exit $E_DIR_PERM
 	fi
 }
 
@@ -87,7 +99,7 @@ download_file() {
 
 	if [ ! "`type -p wget`" ]; then
 		error "Command 'wget' not found."
-		exit 1
+		exit $E_GENERAL
 	fi
 
 	LOCAL_FILENAME=`get_filename $1`
@@ -129,7 +141,7 @@ download_file() {
 	
 	if [ $error != 0 ]; then
 		error "Downloading '$1' failed."
-		exit 1
+		exit $E_DOWNLOAD
 	fi
 	
 	mv -f "$LOCAL_FILENAME_PARTIAL" "$LOCAL_FILENAME"
@@ -143,13 +155,13 @@ download_source() {
 		if [ ! -e $LOCAL_FILENAME ]; then
 			if [ "$LOCAL_FILENAME" = "$FILE" ]; then
 				error "Source file '$LOCAL_FILENAME' not found (can not be downloaded, URL not specified)."
-				exit 1
+				exit $E_DOWNLOAD
 			else
 				if [ "$PKGMK_DOWNLOAD" = "yes" ]; then
 					download_file $FILE
 				else
 					error "Source file '$LOCAL_FILENAME' not found (use option -d to download)."
-					exit 1
+					exit $E_DOWNLOAD
 				fi
 			fi
 		fi
@@ -177,7 +189,7 @@ unpack_source() {
 				rm -rf $PKGMK_WORK_DIR
 			fi
 			error "Building '$TARGET' failed."
-			exit 1
+			exit $E_UNPACK
 		fi
 	done
 }
@@ -224,11 +236,11 @@ check_md5sum() {
 
 			if [ "$PKGMK_CHECK_MD5SUM" = "yes" ]; then
 				error "Md5sum not ok."
-				exit 1
+				exit $E_MD5
 			fi
 
 			error "Building '$TARGET' failed."
-			exit 1
+			exit $E_MD5
 		fi
 	else
 		if [ "$PKGMK_CHECK_MD5SUM" = "yes" ]; then
@@ -236,7 +248,7 @@ check_md5sum() {
 				rm -rf $PKGMK_WORK_DIR
 			fi
 			info "Md5sum not found."
-			exit 1
+			exit $E_MD5
 		fi
 		
 		warning "Md5sum not found, creating new."
-------------- next part --------------
diff --git a/pkgmk.8.in b/pkgmk.8.in
index b9fca26..1b60197 100644
--- a/pkgmk.8.in
+++ b/pkgmk.8.in
@@ -43,6 +43,9 @@ Update footprint and treat last build as successful.
 .B "\-if, \-\-ignore\-footprint"
 Build package without checking footprint.
 .TP
+.B "\-in, \-\-ignore\-new"
+Build package, ignore new files in a footprint missmatch.
+.TP
 .B "\-um, \-\-update\-md5sum"
 Update md5sum using the current source files.
 .TP
diff --git a/pkgmk.conf b/pkgmk.conf
index 07b1cbd..30bdd54 100644
--- a/pkgmk.conf
+++ b/pkgmk.conf
@@ -11,6 +11,7 @@ export CXXFLAGS="-O2 -march=i686 -pipe"
 # PKGMK_WORK_DIR="$PWD/work"
 # PKGMK_DOWNLOAD="no"
 # PKGMK_IGNORE_FOOTPRINT="no"
+# PKGMK_IGNORE_NEW="no"
 # PKGMK_NO_STRIP="no"
 # PKGMK_WGET_OPTS=""
 
diff --git a/pkgmk.in b/pkgmk.in
index c7f5432..2a1c027 100755
--- a/pkgmk.in
+++ b/pkgmk.in
@@ -318,9 +318,14 @@ check_footprint() {
 				sed 's/^+/NEW       /g' | \
 				sed 's/^-/MISSING   /g' > $FILE.footprint.diff
 			if [ -s $FILE.footprint.diff ]; then
-				error "Footprint mismatch found:"
+				if [ "$PKGMK_IGNORE_NEW" = "yes" ] && \
+				   [ -z "$(egrep -l ^MISSING $FILE.footprint.diff)" ] ; then
+					info "New files found:"
+				else
+				        error "Footprint mismatch found:"
+					BUILD_SUCCESSFUL="no"
+				fi
 				cat $FILE.footprint.diff >&2
-				BUILD_SUCCESSFUL="no"
 			fi
 		else
 			warning "Footprint not found, creating new."
@@ -514,6 +519,7 @@ print_help() {
 	echo "  -utd, --up-to-date          do not build, only check if package is up to date"
 	echo "  -uf,  --update-footprint    update footprint using result from last build"
 	echo "  -if,  --ignore-footprint    build package without checking footprint"
+	echo "  -in,  --ignore-new          build package, ignore new files in a footprint missmatch"
 	echo "  -um,  --update-md5sum       update md5sum"
 	echo "  -im,  --ignore-md5sum       build package without checking md5sum"
 	echo "  -cm,  --check-md5sum        do not build, only check md5sum"
@@ -548,6 +554,8 @@ parse_options() {
 				PKGMK_UPDATE_FOOTPRINT="yes" ;;
 			-if|--ignore-footprint)
 				PKGMK_IGNORE_FOOTPRINT="yes" ;;
+			-in|--ignore-new)
+				PKGMK_IGNORE_NEW="yes" ;;
 			-um|--update-md5sum)
 				PKGMK_UPDATE_MD5SUM="yes" ;;
 			-im|--ignore-md5sum)
@@ -690,6 +698,7 @@ PKGMK_EXTRACT_ONLY="no"
 PKGMK_UP_TO_DATE="no"
 PKGMK_UPDATE_FOOTPRINT="no"
 PKGMK_IGNORE_FOOTPRINT="no"
+PKGMK_IGNORE_NEW="no"
 PKGMK_FORCE="no"
 PKGMK_KEEP_WORK="no"
 PKGMK_UPDATE_MD5SUM="no"


More information about the CRUX mailing list