check_publish.sh 1.94 KB
Newer Older
1 2 3 4 5
#!/bin/sh
# copy specs to separate tree, make rpmcs and printout diff

# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
6
load_mod git
7

8 9
get_wd()
{
10
	apt-cache whatdepends $1 | grep "^  [a-zA-Z]" | sed -e "s|^ *||g" | grep -v $1
11 12 13 14 15 16 17 18 19 20 21 22 23 24
}
list_wd()
{
	for i in $@ ; do
		#echo i=$i
		get_wd `echo $i | sed "s|-[0-9].*||g"`
	done
}

print_usedby()
{
	echo "Required by:"
	print_list $USEDBY
	echo "Second required by:"
25 26 27 28 29
	for i in `list_wd $USEDBY | sort -u` ; do
		# skip repeated
		echo $USEDBY | grep -q $i && continue
		echo "    $i"
	done
30 31
}

32 33 34 35 36 37 38 39 40 41 42 43 44 45
if_file_empty()
{
	NL=$(grep -v "^\$" "$1" | wc -l)
	test "$NL" -eq "0"
}

remove_if_empty()
{
	if if_file_empty "$1" ; then
		rm -f "$1"
	fi
}


46

47
[ -n "$SPECLIST" ] || SPECLIST=`find $RPMDIR/SPECS -type f -name "*.spec"`
48

49 50 51 52
for i in $SPECLIST ; do
	if echo $i | grep -q HELP ; then
		continue
	fi
53 54 55
	echo $i
	#LANG=C rpmgp -c $i 2>&1 | grep -v "^Note" | grep -v "^Checking" | grep -v "^Repository"

56 57
	PKGNAME=`basename $i .spec`
	USEDBY=$(get_wd $PKGNAME)
58 59 60 61
	if [ -n "$USEDBY" ] ; then 
		print_usedby $i $USEDBY >$i.usedby
		#[ -n "`cat $i.usedby`" ] || 
	else
62 63 64
#		if [ -r $i.usedby ] ; then
#			echo "$i do not required anymore"
#		else
65
			rm -f $i.usedby
66 67 68 69 70
#		fi
	fi
	rpmbugs -t $i | grep -v "CLO.*FIX" | grep "@altlinux" >$i.bugs
	test -s $i.bugs || rm -f $i.bugs

71
	# if missed on ftp
72 73
	rpmgp -c $i | grep -q MISSED >$i.missed
	remove_if_empty $i.missed
74
	
75
	list_git_package $PKGNAME > $i.GIT.PUBLISHED
76 77
	# if present in git
	if [ -n "$GIRAR_USER" ] ; then
78
		GITURL="http://git.altlinux.org/people/$GIRAR_USER/packages/$PKGNAME.git"
79
		if GET -d $GITURL ; then
80 81
			echo
			echog "Published at $GITURL by $GIRAR_USER" >> $i.GIT.PUBLISHED
82 83 84 85
			echog "Please check this spec and move work to git" >> $i.GIT.PUBLISHED
		fi
	fi

86 87 88
	remove_if_empty $i.GIT.PUBLISHED

	if [ -r "$i.GIT.PUBLISHED" ] ; then
89
		ssh $GEARHOST acl sisyphus $PKGNAME show 2>> $i.GIT.PUBLISHED
90
	fi
91
	
92
	#grep " $USER\$" $i.acl
93
done
94