diff --git a/package-checker/jenkins-cli.jar b/package-checker/jenkins-cli.jar new file mode 100644 index 0000000000000000000000000000000000000000..ba1dadc36c846fd42b7b134b0208cb4721e29980 Binary files /dev/null and b/package-checker/jenkins-cli.jar differ diff --git a/package-checker/package_list b/package-checker/package_list new file mode 100644 index 0000000000000000000000000000000000000000..9842c4771a9ea2cb17ddfac98dea7a0ffdfee997 --- /dev/null +++ b/package-checker/package_list @@ -0,0 +1,10 @@ +base-files +choose-mirror +debian-installer-launcher +debootstrap +desktop-base +localechooser +mate-desktop-environment +mate-menu +mate-panel +rootskel-gtk diff --git a/package-checker/parikshan b/package-checker/parikshan new file mode 100755 index 0000000000000000000000000000000000000000..ba890ce100a4ff6449f54d99cb7052c5d486ba8c --- /dev/null +++ b/package-checker/parikshan @@ -0,0 +1,89 @@ +#!/bin/bash + +SET_IT() +{ + + PKG_NAME=$PKG + UP_PKG="http://packages.debian.org/stretch/$PKG_NAME" + #UP_MIR="http://pack" + #UP_PKG_LINK="$UP_MIR/"$(echo $PKG_NAME | head -c 1)"$PKG_NAME" + #DOWN_MIR="http://devel.hamaralinux.org/hamara-sugam/pool/main" + DOWN_PKG="http://devel.hamaralinux.org/hamara-sugam/pool/main/""$(echo $PKG_NAME | head -c 1)"/$PKG_NAME/ + + echo -e "Package link in hamara repo : \n" $DOWN_PKG + + #using w3m for fetching page content from upstream and getting version + UP_VER="$(w3m $UP_PKG | grep "Package: $PKG_NAME" | tr -dc '0-9' )" + echo "Upstream version : " $UP_VER + + COUNT="$(echo "${#UP_VER}")" + #echo $COUNT + + DOWN_VER="$(w3m -dump $DOWN_PKG | grep -oh "$PKG_NAME.*hamara.*\.dsc")" + if [ $? -eq 1 ] + then + echo "Package is not available at hamara repo" +# exit 0 + else + DOWN_VER="$(echo $DOWN_VER | tr -dc '0-9' | head -c $COUNT)" + echo "Downstram version : "$DOWN_VER + fi +} + +CHECK_IT(){ + + ARCH="$(w3m -dump https://tracker.debian.org/pkg/$PKG_NAME | grep "arch:")" + + echo "Arch variable contains -> "$ARCH + + if [ "$UP_VER" -eq "$DOWN_VER" ];then + echo -e "\n Package $PKG_NAME is sync with upstream " +# notify-send -u normal "Package $PKG_NAME is sync with upstream" + elif [ "$UP_VER" -gt "$DOWN_VER" ];then + echo " Package $PKG_NAME is old" + echo " Get the new version " + + #Run the build job for package + BUILD_IT + fi + +} + +BUILD_IT() +{ + + #check arch of package + echo $ARCH | grep -q "any" + if [ $? -eq 0 ] + then + ARCH="amd64-i386" + else + ARCH="all" + fi + + #Check if jar file is present + if ls jenkins-cli.jar > /dev/null 2>&1 + then + java -jar jenkins-cli.jar -s http://81.187.108.82:8080/ build $PKG_NAME-$ARCH + else + echo -e "\n Jenkins JAR file is not present" + echo -e "\t #### Fetching JAR fie ####" + wget http://devel.hamaralinux.org:8080/jnlpJars/jenkins-cli.jar + + #Start build again + BUILD_IT + fi +} + + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +cd $DIR + +while read PKG +#for i in base-files choose-mirror debootstrap desktop-base debian-installer-launcher localechooser mate-desktop-environment mate-menu mate-panel rootskel-gtk +do + echo -e "\n\t############## Checking pacakge $PKG ##############" + SET_IT + CHECK_IT +done < package_list