From 0c31cc7706821ba2262eed36aa5a18a584584d20 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Sun, 29 May 2011 23:37:22 -0500 Subject: Fullpkg anounces action on _pkg_build function --- fullpkg-ng | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 277d570..30b90a8 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -193,14 +193,17 @@ function _pkg_build () { sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" fi # Check if pkg is being built, if it's not let everybody know we're building this. + msg2 "Checking build queue" check_queue || { echo "someone_is_building:$(basename $PWD)" >> $build_dir/log egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 continue } + msg2 "Updating build queue" update_queue || { warning "Couldn't update the queue, let your partners know about this." } + msg2 "Checking for non free deps" pkgbuild-check-nonfree || { if [ $? -eq 15 ]; then echo "nonfree:$(basename $PWD)" >> $build_dir/log @@ -208,6 +211,7 @@ function _pkg_build () { continue fi } + msg2 "Building $(basename $PWD)" $FULLBUILDCMD; r=$? case $r in 0) plain "The build was succesful." -- cgit v1.2.3-2-g168b From f0d14d7c815e5b7a17ca190c13f0abe386d41c08 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 11:28:28 -0500 Subject: Traps when needen on fullpkg-ng --- fullpkg-ng | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 877e21f..ee503ec 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -177,10 +177,6 @@ function find_deps { function _pkg_build () { pushd ${build_dir} > /dev/null - # Exit loop on Ctrl+C - trap "break" INT - # Remove from queue package being built on error - trap "remove_queue" EXIT INT QUIT TERM KILL build_packages=$(sort -gr $buildorder | cut -d: -f2) while [ ${#build_packages[@]} -ge 1 ]; do build_packages=$(sort -gr $buildorder | cut -d: -f2) @@ -301,6 +297,10 @@ done } # Build only [ $build_only == 'y' ] && { + # Exit loop on Ctrl+C + trap "break" INT + # Remove from queue package being built on error + trap "remove_queue" EXIT INT QUIT TERM KILL _pkg_build exit 0 } @@ -352,6 +352,10 @@ find_deps || { msg "Building packages:" [ ! -w $queue_file ] && error "can't write queue file" +# Exit loop on Ctrl+C +trap "break" INT +# Remove from queue package being built on error +trap "remove_queue" EXIT INT QUIT TERM KILL _pkg_build echo -- cgit v1.2.3-2-g168b From ba82e075a2eda08ccd75d85ef9718ec518c7b458 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 11:43:08 -0500 Subject: * egrep replaced for egrep in BUILDORDER update --- fullpkg-ng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index ee503ec..12cfff6 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -224,7 +224,7 @@ function _pkg_build () { 2) error "The build failed." echo "failed:$(basename $PWD)" >> $build_dir/log ;; esac - egrep -vwh ${build_packages[0]} $buildorder > $buildorder.2 + grep -vwh "${build_packages[0]}" $buildorder > $buildorder.2 mv $buildorder.2 $buildorder build_packages=$(sort -gr $buildorder | cut -d: -f2) popd > /dev/null -- cgit v1.2.3-2-g168b From 02bbeaecbd43e7d327700f895fb8625a1bc6ed5e Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 11:44:30 -0500 Subject: * egrep replaced on some other sites --- fullpkg-ng | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 12cfff6..c138676 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -192,7 +192,7 @@ function _pkg_build () { msg2 "Checking build queue" check_queue || { echo "someone_is_building:$(basename $PWD)" >> $build_dir/log - egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 + grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 continue } msg2 "Updating build queue" @@ -203,7 +203,7 @@ function _pkg_build () { pkgbuild-check-nonfree || { if [ $? -eq 15 ]; then echo "nonfree:$(basename $PWD)" >> $build_dir/log - egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 + grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 continue fi } -- cgit v1.2.3-2-g168b From 876db1b485e846f23c796b01f69ba2d61abafbdb Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 11:50:58 -0500 Subject: * grep on find_deps corrected --- fullpkg-ng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index c138676..e171ef7 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -158,7 +158,7 @@ function find_deps { # if search pkgname in repo doesn't work # this should find pkgsplits _dir=$(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ - "xargs" -0 -e grep -H -Ew grep $_dep >/dev/null 2>&1) && { + "xargs" -0 -e grep -H -Ew $_dep >/dev/null 2>&1) && { pushd $(dirname $(echo $_dir | cut -d: -f1)) > /dev/null $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail -- cgit v1.2.3-2-g168b From fe983eea4b3cedbdd3ca33b05162340b2a4a4e7a Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 12:42:02 -0500 Subject: * shortened check_queue test * tried to correct find_deps pkgsplit search * build_packages set at begining of cycle in _pkg_build and removed from $buildorder when failed. --- fullpkg-ng | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index e171ef7..485ba90 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -79,7 +79,7 @@ check_queue() { local packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2) - [ ! -z $packager ] && [ "$packager" != "$PACKAGER" ] && { + [ ! -z $packager -a "$packager" != "$PACKAGER" ] && { warning "$(basename $PWD) is being packaged by $packager. Please wait." return 1 } @@ -158,7 +158,8 @@ function find_deps { # if search pkgname in repo doesn't work # this should find pkgsplits _dir=$(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ - "xargs" -0 -e grep -H -Ew $_dep >/dev/null 2>&1) && { + "xargs" -0 -e grep -HEw "pkgname|pkgbase" | grep $_dep 2>&1) + [ -n "$_dir" ] && { pushd $(dirname $(echo $_dir | cut -d: -f1)) > /dev/null $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail @@ -181,7 +182,6 @@ function _pkg_build () { while [ ${#build_packages[@]} -ge 1 ]; do build_packages=$(sort -gr $buildorder | cut -d: -f2) pushd $build_dir/${build_packages[0]} > /dev/null - unset build_packages source PKGBUILD msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" if ! grep mips64el PKGBUILD >/dev/null; then @@ -193,6 +193,7 @@ function _pkg_build () { check_queue || { echo "someone_is_building:$(basename $PWD)" >> $build_dir/log grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 + mv $buildorder.2 $buildorder continue } msg2 "Updating build queue" @@ -204,6 +205,7 @@ function _pkg_build () { if [ $? -eq 15 ]; then echo "nonfree:$(basename $PWD)" >> $build_dir/log grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 + mv $buildorder $buildorder.2 continue fi } @@ -226,7 +228,6 @@ function _pkg_build () { esac grep -vwh "${build_packages[0]}" $buildorder > $buildorder.2 mv $buildorder.2 $buildorder - build_packages=$(sort -gr $buildorder | cut -d: -f2) popd > /dev/null done pkgs=$(cat $build_dir/log | grep "nonfree:") && { -- cgit v1.2.3-2-g168b From fd87ecf1e20dadc37e6ffd84e120f63711868fc2 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 12:44:41 -0500 Subject: * Exit build cycle when end --- fullpkg-ng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 485ba90..620c625 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -179,7 +179,7 @@ function find_deps { function _pkg_build () { pushd ${build_dir} > /dev/null build_packages=$(sort -gr $buildorder | cut -d: -f2) - while [ ${#build_packages[@]} -ge 1 ]; do + while [ ${#build_packages[@]} -gt 1 ]; do build_packages=$(sort -gr $buildorder | cut -d: -f2) pushd $build_dir/${build_packages[0]} > /dev/null source PKGBUILD -- cgit v1.2.3-2-g168b From b07a02f6b4b07562842e630fea959c3ebb6502c4 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 13:02:21 -0500 Subject: * corrected mv statement --- fullpkg-ng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 620c625..0c74b34 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -68,7 +68,7 @@ remove_queue() { get_queue grep -vw "^$(basename $PWD)" $queue_file > $queue_file.2 - mv $queue_file.2 > $queue_file + mv $queue_file.2 $queue_file put_queue && return 0 || return $? } -- cgit v1.2.3-2-g168b From 59b7668ec6e19b03d90972fd9ed6cfb538904972 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 13:08:40 -0500 Subject: * build_packages is an array --- fullpkg-ng | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 0c74b34..4ab4ab0 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -178,9 +178,9 @@ function find_deps { function _pkg_build () { pushd ${build_dir} > /dev/null - build_packages=$(sort -gr $buildorder | cut -d: -f2) - while [ ${#build_packages[@]} -gt 1 ]; do - build_packages=$(sort -gr $buildorder | cut -d: -f2) + build_packages=($(sort -gr $buildorder | cut -d: -f2)) + while [ ${#build_packages[@]} -ge 1 ]; do + build_packages=($(sort -gr $buildorder | cut -d: -f2)) pushd $build_dir/${build_packages[0]} > /dev/null source PKGBUILD msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" -- cgit v1.2.3-2-g168b From c2f7efb3e802f79928ef5a6bc529a153bd69c38c Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Mon, 30 May 2011 16:27:29 -0500 Subject: * fullpkg-ng commented --- fullpkg-ng | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 4ab4ab0..5311593 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -103,8 +103,7 @@ function cleanup { rm -rf $build_dir/$_dir/ done else - find $build_dir -type f -delete - find $build_dir -type d -delete + rm -rf $build_dir fi } @@ -178,17 +177,20 @@ function find_deps { function _pkg_build () { pushd ${build_dir} > /dev/null + # packages to build are on $buildorder + # greater levels must be built first build_packages=($(sort -gr $buildorder | cut -d: -f2)) while [ ${#build_packages[@]} -ge 1 ]; do build_packages=($(sort -gr $buildorder | cut -d: -f2)) pushd $build_dir/${build_packages[0]} > /dev/null source PKGBUILD msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" + # Add mips64el if ! grep mips64el PKGBUILD >/dev/null; then plain "Adding mips64el arch" sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" fi - # Check if pkg is being built, if it's not let everybody know we're building this. + # Check if pkg is being built msg2 "Checking build queue" check_queue || { echo "someone_is_building:$(basename $PWD)" >> $build_dir/log @@ -196,20 +198,27 @@ function _pkg_build () { mv $buildorder.2 $buildorder continue } + # Let everybody know we're building this. msg2 "Updating build queue" update_queue || { warning "Couldn't update the queue, let your partners know about this." } msg2 "Checking for non free deps" pkgbuild-check-nonfree || { + # pkgbuild-check-nonfree fails with 15 if there are nonfree deps, + # fails with something else if blacklist can't be retrieved if [ $? -eq 15 ]; then + # log they have nonfree deps and so didn't build echo "nonfree:$(basename $PWD)" >> $build_dir/log + # take out package from $buildorder grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 - mv $buildorder $buildorder.2 + mv $buildorder.2 $buildorder + # continue building next package continue fi } msg2 "Building $(basename $PWD)" + # this buildcmd is on libretools.conf $FULLBUILDCMD; r=$? case $r in 0) plain "The build was succesful." @@ -222,30 +231,33 @@ function _pkg_build () { cleanup "$(basename $PWD)" ;; 1) error "There were errors while trying to build the package." - echo "failed:$(basename $PWD)" >> $build_dir/log ;; + echo "failed:$(basename $PWD)" >> $build_dir/log + ;; 2) error "The build failed." - echo "failed:$(basename $PWD)" >> $build_dir/log ;; + echo "failed:$(basename $PWD)" >> $build_dir/log + ;; esac + # Package was built or failed: take it out of $buildorder grep -vwh "${build_packages[0]}" $buildorder > $buildorder.2 mv $buildorder.2 $buildorder popd > /dev/null done pkgs=$(cat $build_dir/log | grep "nonfree:") && { error "Those packages contain nonfree deps:" - plain "$(echo ${pkgs[@]} | cut -d: -f2)" + echo ${pkgs[@]} | cut -d: -f2 } pkgs=$(cat $build_dir/log | grep "built:") && { error "Those packages were built and installed:" - plain "$(echo ${pkgs[@]} | cut -d: -f2)" + echo ${pkgs[@]} | cut -d: -f2 msg "Uploading packages to the server" } pkgs=$(cat $build_dir/log | grep "failed:") && { error "Those packages failed to build:" - plain "$(echo ${pkgs[@]} | cut -d: -f2)" + echo ${pkgs[@]} | cut -d: -f2 } pkgs=$(cat $build_dir/log | grep "unstaged:") && { error "Those packages couldn't be staged because of missing reponame:" - plain "$(cat $build_dir/log | grep "unstaged:" | cut -d: -f2)" + echo ${pkgs[@]} | cut -d: -f2 } popd > /dev/null } @@ -280,22 +292,23 @@ done [ $level -eq 0 ] && { # if build_dir exist use it, else make a build_dir build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} - + # cleanup if the option was used. + [ $do_cleanup == 'y' ] && { + cleanup + [ $build_only == 'y' ] && exit 0 + } # set queue_file and ban_file mkdir -p $XDG_CONFIG_HOME/libretools queue_file=$XDG_CONFIG_HOME/libretools/queue ban_file=$XDG_CONFIG_HOME/libretools/ban - touch $build_dir/{log,BUILDORDER} $queue_file $ban_file + # make files for log and buildorder + touch $build_dir/{log,BUILDORDER} buildorder=$build_dir/BUILDORDER [ $noupdate = 'n' ] && { msg "Updating pacman db and packages" sudo pacman -Syu --noconfirm } - [ $do_cleanup == 'y' ] && { - cleanup - [ $build_only == 'y' ] && exit 0 - } # Build only [ $build_only == 'y' ] && { # Exit loop on Ctrl+C -- cgit v1.2.3-2-g168b From 2b3661e346d2ffcecba23c190080dc15a24780cb Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Wed, 1 Jun 2011 02:16:57 -0500 Subject: fullpkg-ng: * remove_queue used on build cycle * usage function updated * dep_not_found:$_dep:$repo --- fullpkg-ng | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 5311593..3f44258 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -26,7 +26,7 @@ function usage { echo " -d build_dir : use this dir to build. Defaults to mktemp." echo " -n : don't update pacman db." echo " -m max_level : check deps until this level" - echo " -r \"command\" : use this instead of $FULLBUILDCMD" + echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" # printf " -f pkgname : build even when a package has been built. " # printf " Use it as many times as needed\n" echo @@ -79,7 +79,7 @@ check_queue() { local packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2) - [ ! -z $packager -a "$packager" != "$PACKAGER" ] && { + [ -n $packager -a "$packager" != "$PACKAGER" ] && { warning "$(basename $PWD) is being packaged by $packager. Please wait." return 1 } @@ -146,27 +146,28 @@ function find_deps { for _dep in ${deps[@]}; do for _repo in ${REPOS[@]}; do # try to find $_dep on each repo from dirname - [ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ] && { + if [ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]; then pushd "$ABSROOT/${_repo}/$_dep" > /dev/null $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail [ $? -eq 20 ] && return 20 popd > /dev/null - } && break 1 # found, go to next dep - + break 1 # found, go to next dep # if search pkgname in repo doesn't work # this should find pkgsplits - _dir=$(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ - "xargs" -0 -e grep -HEw "pkgname|pkgbase" | grep $_dep 2>&1) - [ -n "$_dir" ] && { + elif _dir=$(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ + "xargs" -0 -e grep -HEw "pkgname|pkgbase" | grep $_dep 2>&1) \ + [ -n "$_dir" ]; then pushd $(dirname $(echo $_dir | cut -d: -f1)) > /dev/null $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail [ $? -eq 20 ] && return 20 popd > /dev/null - } && break 1 # found, go to next dep + break 1 # found, go to next dep + else + echo "dep_not_found:$_dep:$_repo" >> $build_dir/log + fi done - echo "dep_not_found:$_dep" >> $build_dir/log done unset next_level dir # unset PKGBUILD variables @@ -240,6 +241,8 @@ function _pkg_build () { # Package was built or failed: take it out of $buildorder grep -vwh "${build_packages[0]}" $buildorder > $buildorder.2 mv $buildorder.2 $buildorder + # Take package out from queue + remove_queue popd > /dev/null done pkgs=$(cat $build_dir/log | grep "nonfree:") && { -- cgit v1.2.3-2-g168b From aa2e26e54ba59741a36d9d802b9cd8ef156d7510 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Wed, 1 Jun 2011 14:47:30 -0500 Subject: fullpkg-ng declare build_packages on cycle end --- fullpkg-ng | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 3f44258..a6e9732 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -182,7 +182,6 @@ function _pkg_build () { # greater levels must be built first build_packages=($(sort -gr $buildorder | cut -d: -f2)) while [ ${#build_packages[@]} -ge 1 ]; do - build_packages=($(sort -gr $buildorder | cut -d: -f2)) pushd $build_dir/${build_packages[0]} > /dev/null source PKGBUILD msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" @@ -243,6 +242,8 @@ function _pkg_build () { mv $buildorder.2 $buildorder # Take package out from queue remove_queue + # Set build_packages before next cycle run + build_packages=($(sort -gr $buildorder | cut -d: -f2)) popd > /dev/null done pkgs=$(cat $build_dir/log | grep "nonfree:") && { -- cgit v1.2.3-2-g168b From b5101d5a422f84bdbad90ff5859410c831d4c6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 1 Jun 2011 16:27:54 -0500 Subject: _pkg_build final messages fixed --- fullpkg-ng | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index a6e9732..9db75a2 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -248,20 +248,20 @@ function _pkg_build () { done pkgs=$(cat $build_dir/log | grep "nonfree:") && { error "Those packages contain nonfree deps:" - echo ${pkgs[@]} | cut -d: -f2 + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 } - pkgs=$(cat $build_dir/log | grep "built:") && { + pkgs=$(cat $build_dir/log | tr " " "\n" | grep "built:") && { error "Those packages were built and installed:" - echo ${pkgs[@]} | cut -d: -f2 + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 msg "Uploading packages to the server" } - pkgs=$(cat $build_dir/log | grep "failed:") && { + pkgs=$(cat $build_dir/log | tr " " "\n" | grep "failed:") && { error "Those packages failed to build:" - echo ${pkgs[@]} | cut -d: -f2 + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 } - pkgs=$(cat $build_dir/log | grep "unstaged:") && { + pkgs=$(cat $build_dir/log | tr " " "\n" | grep "unstaged:") && { error "Those packages couldn't be staged because of missing reponame:" - echo ${pkgs[@]} | cut -d: -f2 + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 } popd > /dev/null } -- cgit v1.2.3-2-g168b From 316df77571259583d0810cb1f1c3bc3b0ccdd0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Thu, 2 Jun 2011 01:27:30 -0500 Subject: _dir in find_deps is an array --- fullpkg-ng | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 9db75a2..537a7ca 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -79,7 +79,7 @@ check_queue() { local packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2) - [ -n $packager -a "$packager" != "$PACKAGER" ] && { + [ -n "$packager" -a "$packager" != "$PACKAGER" ] && { warning "$(basename $PWD) is being packaged by $packager. Please wait." return 1 } @@ -103,7 +103,7 @@ function cleanup { rm -rf $build_dir/$_dir/ done else - rm -rf $build_dir + rm -rf $build_dir/* fi } @@ -155,8 +155,8 @@ function find_deps { break 1 # found, go to next dep # if search pkgname in repo doesn't work # this should find pkgsplits - elif _dir=$(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ - "xargs" -0 -e grep -HEw "pkgname|pkgbase" | grep $_dep 2>&1) \ + elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ + "xargs" -0 -e grep -HEw "pkgbase|pkgname|provides" | grep $_dep 2>&1)) [ -n "$_dir" ]; then pushd $(dirname $(echo $_dir | cut -d: -f1)) > /dev/null $0 -c -d ${build_dir} -l ${next_level} -- cgit v1.2.3-2-g168b From 937415f6f8988661d9fa577da1262712a7bfb4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Thu, 2 Jun 2011 01:58:59 -0500 Subject: fullpkg-ng corrected if statement on find_deps --- fullpkg-ng | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng index 537a7ca..a80f962 100755 --- a/fullpkg-ng +++ b/fullpkg-ng @@ -156,8 +156,8 @@ function find_deps { # if search pkgname in repo doesn't work # this should find pkgsplits elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ - "xargs" -0 -e grep -HEw "pkgbase|pkgname|provides" | grep $_dep 2>&1)) - [ -n "$_dir" ]; then + "xargs" -0 -e grep -HEw "pkgname|pkgbase|provides" | grep $_dep 2>&1)); + then pushd $(dirname $(echo $_dir | cut -d: -f1)) > /dev/null $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail -- cgit v1.2.3-2-g168b From a3c04037573d522a394f6e2715b82ca796f9bf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Thu, 2 Jun 2011 09:24:50 -0500 Subject: fullpkg-ng -> fullpkg --- fullpkg-ng | 382 ------------------------------------------------------------- 1 file changed, 382 deletions(-) delete mode 100755 fullpkg-ng (limited to 'fullpkg-ng') diff --git a/fullpkg-ng b/fullpkg-ng deleted file mode 100755 index a80f962..0000000 --- a/fullpkg-ng +++ /dev/null @@ -1,382 +0,0 @@ -#!/bin/bash -# TO TEST: (on find_deps) -# * Detect pkgnames by provides, replaces, etc. instead of dir tree - -source /etc/makepkg.conf -source /etc/abs.conf -source /etc/libretools.conf -source /usr/bin/libremessages - -[ -r $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ - source $XDG_CONFIG_HOME/libretools/libretools.conf - -## START FUNCTIONS ## - -function usage { - echo "cd to a dir containing a PKGBUILD and run:" - echo "$0 [options]" - printf "This script will check dependencies, build them if possible " - printf "and stage the packages on it's repo." - echo - echo "OPTIONS:" - echo " -h : this message." - echo " -a absdir : set absdir as ABSROOT." - echo " -b : do not check deps but build. Needs -d" - echo " -c : check deps only, do not build." - echo " -d build_dir : use this dir to build. Defaults to mktemp." - echo " -n : don't update pacman db." - echo " -m max_level : check deps until this level" - echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" - # printf " -f pkgname : build even when a package has been built. " - # printf " Use it as many times as needed\n" - echo -} - -# Queue Management -# * Always get the queue list from the server -# * Add/Remove from queue -# * Check if a package is listed - -# TODO -# * Check for concurrence # @ fauno: What do you mean? - -# Get the queue list from the server -get_queue() { - rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || { - error "Failed to retrieve queue list" - return 1 - } -} - -# Put the queue list on the server -put_queue() { - rsync -e ssh -aq $queue_file $PARABOLAHOST:mips64el/queue >/dev/null 2>&1 || { - error "Failed to put queue list" - return 1 - } -} - -# Add packages to the queue -update_queue() { - get_queue - echo "$(basename $PWD):$PACKAGER" >> $queue_file - put_queue || return $? -} - -# Remove a package from the queue -remove_queue() { - get_queue - - grep -vw "^$(basename $PWD)" $queue_file > $queue_file.2 - mv $queue_file.2 $queue_file - - put_queue && return 0 || return $? -} - -# Checks if a package is listed -check_queue() { - get_queue - - local packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2) - - [ -n "$packager" -a "$packager" != "$PACKAGER" ] && { - warning "$(basename $PWD) is being packaged by $packager. Please wait." - return 1 - } - - return 0 -} - -# END Queue Management # - -guess_repo() { - basename $(dirname $(pwd)) -} - -# Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir -# cleans the build_dir -function cleanup { - if [ ! -d $build_dir ]; then - return 1 - elif [ -d $build_dir -a ${#@} -gt 0 ]; then - for _dir in $@; do - rm -rf $build_dir/$_dir/ - done - else - rm -rf $build_dir/* - fi -} - -# Check PKGBUILD and find non built or outdated deps -# on ABSROOT which should be abslibre-misp64el -function find_deps { - ## Check this level. - source PKGBUILD - local repo=${repo:-$(guess_repo)} - - # If package is built exit - # TODO?: If this package is in force_build: skip this step - if is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}"; then - exit 0 - fi - - # Tell which packages are deeper in deps (even if they are on build_dir) - # so we can build them first. - echo "${level}:$(basename $PWD)" >> "${build_dir}/BUILDORDER" - - # if pkgbuild directory is on build_dir, do not copy and exit - if [ -d "${build_dir}/$(basename $PWD)" ]; then - exit 0 - else - cp -r ../$(basename $PWD) ${build_dir}/ - # Info to eval later - echo "repo=$repo" > "${build_dir}/$(basename $PWD)/.INFO" - fi - - msg2 "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" - - ## Check next levels - # Clean version checking - deps=$(echo "${depends[@]} ${makedepends[@]}" | \ - sed "s/[=<>]\+[^ ]\+//g" | \ - tr ' ' "\n" | \ - sort -u) - declare -i next_level=$level+1 - - for _dep in ${deps[@]}; do - for _repo in ${REPOS[@]}; do - # try to find $_dep on each repo from dirname - if [ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]; then - pushd "$ABSROOT/${_repo}/$_dep" > /dev/null - $0 -c -d ${build_dir} -l ${next_level} - # Circular deps must fail - [ $? -eq 20 ] && return 20 - popd > /dev/null - break 1 # found, go to next dep - # if search pkgname in repo doesn't work - # this should find pkgsplits - elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 | \ - "xargs" -0 -e grep -HEw "pkgname|pkgbase|provides" | grep $_dep 2>&1)); - then - pushd $(dirname $(echo $_dir | cut -d: -f1)) > /dev/null - $0 -c -d ${build_dir} -l ${next_level} - # Circular deps must fail - [ $? -eq 20 ] && return 20 - popd > /dev/null - break 1 # found, go to next dep - else - echo "dep_not_found:$_dep:$_repo" >> $build_dir/log - fi - done - done - unset next_level dir - # unset PKGBUILD variables - unset pkgname pkgver pkgrel epoch pkgdesc arch url license groups depends \ - makedepens checkdepends optdepends provides conflicts replaces backup \ - options install changelog source noextract md5sums build check package -} - -function _pkg_build () { - pushd ${build_dir} > /dev/null - # packages to build are on $buildorder - # greater levels must be built first - build_packages=($(sort -gr $buildorder | cut -d: -f2)) - while [ ${#build_packages[@]} -ge 1 ]; do - pushd $build_dir/${build_packages[0]} > /dev/null - source PKGBUILD - msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" - # Add mips64el - if ! grep mips64el PKGBUILD >/dev/null; then - plain "Adding mips64el arch" - sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" - fi - # Check if pkg is being built - msg2 "Checking build queue" - check_queue || { - echo "someone_is_building:$(basename $PWD)" >> $build_dir/log - grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 - mv $buildorder.2 $buildorder - continue - } - # Let everybody know we're building this. - msg2 "Updating build queue" - update_queue || { - warning "Couldn't update the queue, let your partners know about this." - } - msg2 "Checking for non free deps" - pkgbuild-check-nonfree || { - # pkgbuild-check-nonfree fails with 15 if there are nonfree deps, - # fails with something else if blacklist can't be retrieved - if [ $? -eq 15 ]; then - # log they have nonfree deps and so didn't build - echo "nonfree:$(basename $PWD)" >> $build_dir/log - # take out package from $buildorder - grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2 - mv $buildorder.2 $buildorder - # continue building next package - continue - fi - } - msg2 "Building $(basename $PWD)" - # this buildcmd is on libretools.conf - $FULLBUILDCMD; r=$? - case $r in - 0) plain "The build was succesful." - source .INFO && [ -n $repo ] && { - librestage $repo || { - echo "unstaged:$(basename $PWD)" >> $build_dir/log - } - } - echo "built:$(basename $PWD)" >> $build_dir/log - cleanup "$(basename $PWD)" - ;; - 1) error "There were errors while trying to build the package." - echo "failed:$(basename $PWD)" >> $build_dir/log - ;; - 2) error "The build failed." - echo "failed:$(basename $PWD)" >> $build_dir/log - ;; - esac - # Package was built or failed: take it out of $buildorder - grep -vwh "${build_packages[0]}" $buildorder > $buildorder.2 - mv $buildorder.2 $buildorder - # Take package out from queue - remove_queue - # Set build_packages before next cycle run - build_packages=($(sort -gr $buildorder | cut -d: -f2)) - popd > /dev/null - done - pkgs=$(cat $build_dir/log | grep "nonfree:") && { - error "Those packages contain nonfree deps:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - pkgs=$(cat $build_dir/log | tr " " "\n" | grep "built:") && { - error "Those packages were built and installed:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - msg "Uploading packages to the server" - } - pkgs=$(cat $build_dir/log | tr " " "\n" | grep "failed:") && { - error "Those packages failed to build:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - pkgs=$(cat $build_dir/log | tr " " "\n" | grep "unstaged:") && { - error "Those packages couldn't be staged because of missing reponame:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - popd > /dev/null -} -## END FUNCTIONS ## - -force_build="" -level=0 -noupdate='n' -build_only='n' -check_deps_only='n' -do_cleanup='n' -max_level=21 -while getopts 'ha:bcCd:l:nm:r:' arg; do - case $arg in - h) usage; exit 0 ;; - a) ABSROOT="$OPTARG" ;; - b) build_only='y' ;; - c) check_deps_only='y' ;; - C) do_cleanup='y';; - # f) force_build+="-f pkgname " ;; - d) build_dir="$OPTARG" ;; - # hidden option to know what to build first. - # if $level > 0 it will not build - l) level=$OPTARG ;; - n) noupdate='y';; - m) max_level=$OPTARG ;; - r) FULLBUILDCMD="$OPTARG" ;; - esac -done - -# Only on level 0 -[ $level -eq 0 ] && { - # if build_dir exist use it, else make a build_dir - build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} - # cleanup if the option was used. - [ $do_cleanup == 'y' ] && { - cleanup - [ $build_only == 'y' ] && exit 0 - } - # set queue_file and ban_file - mkdir -p $XDG_CONFIG_HOME/libretools - queue_file=$XDG_CONFIG_HOME/libretools/queue - ban_file=$XDG_CONFIG_HOME/libretools/ban - # make files for log and buildorder - touch $build_dir/{log,BUILDORDER} - buildorder=$build_dir/BUILDORDER - - [ $noupdate = 'n' ] && { - msg "Updating pacman db and packages" - sudo pacman -Syu --noconfirm - } - # Build only - [ $build_only == 'y' ] && { - # Exit loop on Ctrl+C - trap "break" INT - # Remove from queue package being built on error - trap "remove_queue" EXIT INT QUIT TERM KILL - _pkg_build - exit 0 - } - msg "Checking dependencies" -} - -[ ! -r PKGBUILD ] && { - error "This isn't a build directory" - usage && exit 1 -} - -## if $level = 20 there is highly likely there are circular deps -[ $level -eq $max_level -o $level -gt $max_level ] && exit 20 - - -find_deps || { - # if find_deps finds circular deps - # it should exit with status 20 - [ $? -eq 20 ] && { - # only show message on level 0 - [ $level -eq 0 ] && error "Check for circular deps on $build_dir/BUILDORDER"; - } - exit 20 -} - -# levels greater than 0 must only check deps -[ $check_deps_only = 'y' -o $level -gt 0 ] && exit 0 - -# check BUILDORDER to not include banned deps and -[ $level -eq 0 -a -d $build_dir ] && { - # Check for banned deps - if [ -w $ban_file -a -r $ban_file ]; then - chmod o+rw $ban_file || error "Ban file is not readable/writable ($ban_file)" - else - rsync -e ssh -aq $PARABOLAHOST:mips64el/ban >/dev/null 2>&1 || { - warning "Failed to get ban list" && [ -r $ban_file ] && { - # continue if download failed but local copy - search=$(cat $ban_file | tr "\n" "|") - echo ${@} | tr " " "\n" | egrep -w "$search" $buildorder >> $build_dir/banned - echo ${@} | tr " " "\n" | egrep -vw "$search" $buildorder > $buildorder.2 - mv $buildorder.2 $buildorder - unset search - } - } - fi -} - -## START Building -msg "Building packages:" - -[ ! -w $queue_file ] && error "can't write queue file" -# Exit loop on Ctrl+C -trap "break" INT -# Remove from queue package being built on error -trap "remove_queue" EXIT INT QUIT TERM KILL -_pkg_build - -echo -msg2 "Check if your system works fine and librerelease if it does" - -exit 0 -- cgit v1.2.3-2-g168b