From 0f527db6e225f7e8152d41b32dda434bb58f7e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sun, 19 Jun 2011 00:50:35 -0500 Subject: find_deps use ">=" instead "=" --- fullpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullpkg b/fullpkg index be9ed70..31bf835 100755 --- a/fullpkg +++ b/fullpkg @@ -157,7 +157,7 @@ function find_deps { # If package and correct ${fullver} is built exit # TODO?: If this package is in force_build: skip this step - if is_built "${pkgbase}=${fullver}"; then + if is_built "${pkgbase}>=${fullver}"; then exit 0 fi -- cgit v1.2.2 From 547bd24884bbf044947620330783fcf09d81256b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Fri, 24 Jun 2011 17:10:46 -0500 Subject: Libremakepkg uses new cleaning mode --- cleansystem | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fullpkg | 14 ++++--- libremakepkg | 114 +++++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 216 insertions(+), 36 deletions(-) create mode 100644 cleansystem diff --git a/cleansystem b/cleansystem new file mode 100644 index 0000000..1cf9224 --- /dev/null +++ b/cleansystem @@ -0,0 +1,124 @@ +acl +attr +autoconf +automake +bash +binutils +bison +bzip2 +cloog +coreutils +cracklib +cryptsetup +dash +db +dbus-core +dcron +device-mapper +dhcpcd +diffutils +distcc +e2fsprogs +eventlog +expat +fakeroot +file +filesystem +findutils +flex +gawk +gcc +gcc-fortran +gcc-libs +gcc-objc +gdbm +gen-init-cpio +gettext +glib2 +glibc +gmp +grep +gzip +heirloom-mailx +iana-etc +initscripts +iproute2 +iputils +isl +jfsutils +kbd +kernel26-libre +keyutils +krb5 +less +libarchive +libcap +libedit +libfetch +libgcrypt +libgpg-error +libldap +libmpc +libnl +libpcap +libpipeline +libretools +libretools +libsasl +libtool +libusb +libusb-compat +licenses-libre +linux-api-headers +logrotate +lvm2 +m4 +make +mdadm +mkinitcpio +mkinitcpio-busybox +module-init-tools +mpfr +nano +ncurses +net-tools +openssh +openssl +pacman +pacman-mirrorlist-libre +pam +patch +pciutils +pcmciautils +pcre +perl +pkg-config +popt +ppl +ppp +procps +psmisc +readline +reiserfsprogs +rp-pppoe +rsync +sed +shadow +sudo +sysfsutils +syslog-ng +sysvinit +tar +tcp_wrappers +texinfo +tzdata +udev +usbutils +util-linux +vi +wget +which +wpa_supplicant +xfsprogs +xz +zlib diff --git a/fullpkg b/fullpkg index 31bf835..f6640dc 100755 --- a/fullpkg +++ b/fullpkg @@ -407,6 +407,13 @@ if [ ${build_only} == 'n' ]; then fi fi +# If the queue file isn't writable go into offline mode +[ ! -w $queue_file ] && { + error "Can't write queue file" + OFFLINE=true +} + + # Only on level 0 if [ $level -eq 0 ]; then # if build_dir exist use it, else make a build_dir @@ -423,6 +430,7 @@ if [ $level -eq 0 ]; then # Build only [ ${build_only} == 'y' ] && { + msg "Build Packages" _pkg_build exit 0 } @@ -473,12 +481,6 @@ find_deps || { ## START Building msg "Building packages:" -# If the queue file isn't writable go into offline mode -[ ! -w $queue_file ] && { - error "Can't write queue file" - OFFLINE=true -} - # Build the package _pkg_build diff --git a/libremakepkg b/libremakepkg index 2226f81..dfcdbe0 100755 --- a/libremakepkg +++ b/libremakepkg @@ -20,30 +20,65 @@ # along with Parabola. If not, see . source /etc/libretools.conf +source /etc/makepkg.conf function usage { - echo "cd to a dir containing a PKGBUILD and run:" - echo "$0 [options] [makepkg args]" - echo "This script will build your package on a chroot." + echo 'cd to a dir containing a PKGBUILD and run:' + echo '$0 [options] [makepkg args]' + echo 'This script will build your package on a chroot.' echo - echo "OPTIONS:" + echo 'OPTIONS:' echo - echo " -h : show this message." - echo " -c : cleans CHCOPY before building." - echo " -u : updates CHROOT before building." - echo " -n : use this dir instead of CHCOPY." - echo " -M \"makepkg long arg\" : passes long args to makepkg, use it as many times as needed." - echo " -I pkgname : install this package, use it as many times needed." + echo ' -h show this message.' + echo ' -c cleans the chroot before building.' + echo ' -u updates the chroot before building.' + echo ' -n use this dir instead of "${CHCOPY}".' + echo ' -I install this package, use it as many times needed.' + echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo } -_CLEAN="" +function buildenv { + msg "Building env" + for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do + msg2 "binding /$mp" + mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" + mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 + done + + for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do + msg2 "copying config /$etc" + cp --remove-destination /$etc $CHROOTDIR/$CHCOPY/$etc || exit 1 + done +} + +# End inmediately but print a useful message +trap_exit() { + + for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do + umount "${CHROOTDIR}/${CHCOPY}${mp}" + done + + error "$@" + + exit 1 +} + +## Trap signals +# From makepkg +set -E +trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "Aborted by user! Exiting..."' INT +trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR + +CLEAN_FIRST="n" CLEAN_CACHE="" -update_first="n" -use_log='n' -chrootname=${CHCOPY} -_PKGINSTALL="" -_MAKEPKG_ARGS="" +UPDATE_FIRST="n" +USE_LOG='n' +CHROOTNAME=${CHCOPY} +PKGINSTALL="" +MAKEPKG_ARGS="" + #libremakepkg own args libremakepkgargs='hcun:I:M:' #now makepkg args @@ -52,44 +87,63 @@ libremakepkgargs+='ACdefiLmop:rRs' while getopts ${libremakepkgargs} arg ; do case "${arg}" in h) usage; exit 0 ;; - c) _CLEAN="-c" ;; + c) CLEAN_FIRST="y" ;; u) update_first="y" ;; n) chrootname="$OPTARG"; echo $chrootname ;; - I) _PKGINSTALL+="-I $OPTARG " ;; - M) _MAKEPKG_ARGS+=" $OPTARG" ;; - L) _MAKEPKG_ARGS+=" -$arg $OPTARG" + I) PKGINSTALL+="-I $OPTARG " ;; + M) MAKEPKG_ARGS+=" $OPTARG" ;; + L) MAKEPKG_ARGS+=" -$arg $OPTARG" use_log='y';; - *) _MAKEPKG_ARGS+=" -$arg $OPTARG" ;; + *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;; esac done -if [ ! -w / ]; then +if [ ${UID} -ne 0 ]; then error "This script must be run as root" exit 1 fi msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ -# pkgbuild-check-nonfree uses 15 for nonfree and -# other errors if something failed. - if [[ $? -eq 15 ]]; then + if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree error "PKGBUILD contains non-free issues" exit 15 fi } -if [ $update_first = y ]; then - msg "Updating the main chroot" +if [ "${UPDATE_FIRST}" = y ]; then + msg "Updating the chroot in use" # -c option in mkarchroot indicates cache - mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOT}" + mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" + +elif [ "${CLEAN_FIRST}" = y ]; then + msg "Cleaning ..." + cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root" + (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" + mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" + +elif [ -n ${PKGINSTALL} ]; then + msg "Installing packages" + makechrootpkg -r ${PKGINSTALL} fi +buildenv msg "Creating the package" -makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL -- $_MAKEPKG_ARGS +makechrootpkg -r ${CHROOTDIR} -l "${chrootname}" -- ${MAKEPKG_ARGS} ev=$? # exit value -[ "$use_log" == 'y' -a -e ${CHROOTDIR}/${chrootname}/build/*.log ] && { +[ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${chrootname}/build/*.log ] && { cp ${CHROOTDIR}/${chrootname}/build/*.log ./ } + exit $ev -- cgit v1.2.2 From f245468672503e4066b46307aff3c39c23983904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Fri, 24 Jun 2011 17:14:41 -0500 Subject: FULLBUILDCMD updated to clean and update db --- libretools.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libretools.conf b/libretools.conf index 524a289..d19e265 100644 --- a/libretools.conf +++ b/libretools.conf @@ -59,8 +59,7 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git ## Build cmd for fullpkg-ng ## Uncomment one of those or make one of your choice -#FULLBUILDCMD="sudo libremakepkg -simL -M --noconfirm -M --nocheck" -#FULLBUILDCMD="makepkg --noconfirm --nocheck -scimL" +FULLBUILDCMD="sudo libremakepkg -cumL -M --noconfirm -M --nocheck" #FULLBUILDCMD="here is a place for cross-compiling build cmd" # Checks if vars aren't empty -- cgit v1.2.2 From 7499b4f620b052e7ced69972a0ad368cb648f2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 22 Jun 2011 03:23:26 -0500 Subject: Fixed libremakepkg error --- fullpkg | 6 +----- libremakepkg | 9 ++++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fullpkg b/fullpkg index 264a910..22ef39a 100755 --- a/fullpkg +++ b/fullpkg @@ -36,8 +36,6 @@ function usage { echo " -m max_level : check deps until this level" echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" echo " -o : work offline (avoid queuing)" - # printf " -f pkgname : build even when a package has been built. " - # printf " Use it as many times as needed\n" echo } @@ -259,9 +257,7 @@ function _pkg_build () { 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 + if [ $? -eq 15 ]; then # this error means nonfree others means fail. # log they have nonfree deps and so didn't build echo "nonfree:$(basename $PWD)" >> $build_dir/log # take out package from $buildorder diff --git a/libremakepkg b/libremakepkg index dfcdbe0..d98d94a 100755 --- a/libremakepkg +++ b/libremakepkg @@ -115,8 +115,9 @@ if [ "${UPDATE_FIRST}" = y ]; then msg "Updating the chroot in use" # -c option in mkarchroot indicates cache mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" +fi -elif [ "${CLEAN_FIRST}" = y ]; then +if [ "${CLEAN_FIRST}" = y ]; then msg "Cleaning ..." cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root" (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" -elif [ -n ${PKGINSTALL} ]; then +fi + +if [ -n ${PKGINSTALL} ]; then msg "Installing packages" - makechrootpkg -r ${PKGINSTALL} + makechrootpkg -r ${PKGINSTALL} "${CHROOTDIR}/${CHROOTNAME}" fi buildenv -- cgit v1.2.2 From 6d9ddde00888d6edbfc9fd1fb56bb9b3709d1356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 22 Jun 2011 03:34:43 -0500 Subject: libremakepkg anounces error is from it. --- libremakepkg | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libremakepkg b/libremakepkg index d98d94a..1b0776b 100755 --- a/libremakepkg +++ b/libremakepkg @@ -67,9 +67,9 @@ trap_exit() { ## Trap signals # From makepkg set -E -trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT -trap 'trap_exit "Aborted by user! Exiting..."' INT -trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR +trap 'trap_exit "(libremakepkg): TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT +trap 'trap_exit "(libremakepkg): An unknown error has occurred. Exiting..."' ERR CLEAN_FIRST="n" CLEAN_CACHE="" @@ -108,6 +108,8 @@ pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree error "PKGBUILD contains non-free issues" exit 15 + else + true fi } @@ -119,7 +121,7 @@ fi if [ "${CLEAN_FIRST}" = y ]; then msg "Cleaning ..." - cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root" + cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/" (cat < Date: Wed, 22 Jun 2011 03:51:20 -0500 Subject: eliminated function "install" --- libremakepkg | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/libremakepkg b/libremakepkg index 1b0776b..98adb80 100755 --- a/libremakepkg +++ b/libremakepkg @@ -33,7 +33,6 @@ function usage { echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' echo ' -n use this dir instead of "${CHCOPY}".' - echo ' -I install this package, use it as many times needed.' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo } @@ -41,14 +40,14 @@ function usage { function buildenv { msg "Building env" for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do - msg2 "binding /$mp" + msg2 "binding ${mp} to ${CHROOTDIR}/${CHCOPY}${mp}" mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do - msg2 "copying config /$etc" - cp --remove-destination /$etc $CHROOTDIR/$CHCOPY/$etc || exit 1 + msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" + cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 done } @@ -76,7 +75,6 @@ CLEAN_CACHE="" UPDATE_FIRST="n" USE_LOG='n' CHROOTNAME=${CHCOPY} -PKGINSTALL="" MAKEPKG_ARGS="" #libremakepkg own args @@ -88,12 +86,11 @@ while getopts ${libremakepkgargs} arg ; do case "${arg}" in h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; - u) update_first="y" ;; + u) UPDATE_FIRST="y" ;; n) chrootname="$OPTARG"; echo $chrootname ;; - I) PKGINSTALL+="-I $OPTARG " ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; L) MAKEPKG_ARGS+=" -$arg $OPTARG" - use_log='y';; + USE_LOG='y';; *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;; esac done @@ -113,14 +110,17 @@ pkgbuild-check-nonfree ||{ fi } +buildenv + if [ "${UPDATE_FIRST}" = y ]; then - msg "Updating the chroot in use" + msg "Updating the chroot in use..." # -c option in mkarchroot indicates cache mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" fi if [ "${CLEAN_FIRST}" = y ]; then msg "Cleaning ..." + plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/" (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" - mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" - -fi + mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" -if [ -n ${PKGINSTALL} ]; then - msg "Installing packages" - makechrootpkg -r ${PKGINSTALL} "${CHROOTDIR}/${CHROOTNAME}" fi -buildenv - msg "Creating the package" makechrootpkg -r ${CHROOTDIR} -l "${chrootname}" -- ${MAKEPKG_ARGS} ev=$? # exit value -- cgit v1.2.2 From f54dd21db22dc09f72a67101f3d83d64c21fc404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 22 Jun 2011 04:00:06 -0500 Subject: *fixed error in making clean script --- libremakepkg | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libremakepkg b/libremakepkg index 98adb80..babed47 100755 --- a/libremakepkg +++ b/libremakepkg @@ -119,28 +119,29 @@ if [ "${UPDATE_FIRST}" = y ]; then fi if [ "${CLEAN_FIRST}" = y ]; then - msg "Cleaning ..." + msg "Cleaning" plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" - cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/" + cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" + echo -n "doing cleanup..." mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" fi msg "Creating the package" -makechrootpkg -r ${CHROOTDIR} -l "${chrootname}" -- ${MAKEPKG_ARGS} +makechrootpkg -r ${CHROOTDIR} -l "${CHROOTNAME}" -- ${MAKEPKG_ARGS} ev=$? # exit value -[ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${chrootname}/build/*.log ] && { +[ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && { cp ${CHROOTDIR}/${chrootname}/build/*.log ./ } -- cgit v1.2.2 From bfc22659aff2cc2a2832b34b7f044146e5b86184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 22 Jun 2011 04:30:18 -0500 Subject: fullpg make build_dir --- fullpkg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fullpkg b/fullpkg index 22ef39a..6e9ea19 100755 --- a/fullpkg +++ b/fullpkg @@ -377,7 +377,6 @@ while getopts 'ha:b:cCd:l:nm:r:o' arg; do };; 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 @@ -413,11 +412,11 @@ fi OFFLINE=true } - # Only on level 0 if [ $level -eq 0 ]; then # if build_dir exist use it, else make a build_dir build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} + mkdir -p ${build_dir} # in case of -d option # make files for log and buildorder touch ${build_dir}/{log,BUILDORDER} -- cgit v1.2.2 From d94747c063e65cb5bbe99246157d76079cc4c252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 25 Jun 2011 11:46:03 -0500 Subject: *fullpkg don't add mipsel on build_only *mipsrelease adds pkgs from pkgdest --- fullpkg | 10 +++++----- mipsrelease | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fullpkg b/fullpkg index 6e9ea19..ce31dd4 100755 --- a/fullpkg +++ b/fullpkg @@ -398,12 +398,12 @@ if [ ${build_only} == 'n' ]; then usage && exit 1 } -fi - # Add mips64el if missing from arch=() and it isn't an 'any' package -if ! grep mips64el PKGBUILD >/dev/null; then - warning "Adding mips64el arch" - sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + if ! grep mips64el PKGBUILD >/dev/null; then + warning "Adding mips64el arch" + sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + fi + fi # If the queue file isn't writable go into offline mode diff --git a/mipsrelease b/mipsrelease index 22d0866..0f8a8de 100755 --- a/mipsrelease +++ b/mipsrelease @@ -32,13 +32,16 @@ get_full_version() { repo=$1; shift -repo-add ${PKGDEST}/stage3.db.tar.gz $@ - # Get all needed sources source PKGBUILD fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) makepkg --source -f +for name in ${pkgname[@]}; do + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* +done + + mkdir -p ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null -- cgit v1.2.2 From dce76c66abe0ce630ef65b3b0da1242ff7fc36bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 25 Jun 2011 11:50:49 -0500 Subject: mipsrelease sends notice about what's doing --- mipsrelease | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mipsrelease b/mipsrelease index 0f8a8de..5228bd9 100755 --- a/mipsrelease +++ b/mipsrelease @@ -37,7 +37,9 @@ source PKGBUILD fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) makepkg --source -f +msg "Adding packages to [stage3]..." for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* done -- cgit v1.2.2 From cf578d1e31b6b8c04bf562013e3988b1d90deb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 25 Jun 2011 21:13:44 -0500 Subject: pkgbuild-check-nonfree shows message acording what it's doing --- pkgbuild-check-nonfree | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index e947a39..5ecb5f7 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -38,8 +38,11 @@ ev=0 # Download the blacklist. msg "Downloading the blacklist of proprietary software packages." wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || { - error "Download failed, exiting" - [ -e $XDG_CONFIG_HOME/libretools/blacklist.txt ] || exit 1 + [ -e $XDG_CONFIG_HOME/libretools/blacklist.txt ] || { + error "Download failed, exiting" + exit 1 + } + warning "Using local copy of blacklist" } # Get everything before the `:' in the blacklist (that's the names of the -- cgit v1.2.2 From e8544402d87c10c0f0b5186800960a99617458ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 25 Jun 2011 21:46:37 -0500 Subject: fullpkg doesn't use queue --- fullpkg | 95 +++-------------------------------------------------------------- 1 file changed, 3 insertions(+), 92 deletions(-) diff --git a/fullpkg b/fullpkg index ce31dd4..c25ed85 100755 --- a/fullpkg +++ b/fullpkg @@ -11,10 +11,9 @@ if [ -z $XDG_CONFIG_HOME ]; then error "There's no XDG_CONFIG_HOME var set" exit 1 fi -# set queue_file and ban_file +# set and ban_file [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ source $XDG_CONFIG_HOME/libretools/libretools.conf -queue_file=$XDG_CONFIG_HOME/libretools/queue ban_file=$XDG_CONFIG_HOME/libretools/ban @@ -35,72 +34,9 @@ function usage { 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 " -o : work offline (avoid queuing)" echo } -# Queue Management -# * Always get the queue list from the server -# * Add/Remove from queue -# * Check if a package is listed - -# Get the queue list from the server -get_queue() { - [[ "$OFFLINE" -eq true ]] && return 0 - - 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() { - [[ "$OFFLINE" = true ]] && return 0 - - 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() { - [[ "$OFFLINE" -eq true ]] && return 0 - - get_queue - - grep -Evw "^$(basename $PWD)" ${queue_file} > ${queue_file}2 - mv -f ${queue_file}2 ${queue_file} - - put_queue && return 0 || return $? -} - -# Checks if a package is listed -check_queue() { - [[ "$OFFLINE" = "true" ]] && return 0 - - 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 # - ## Build order management ## # Removes a package from the buildorder @@ -186,7 +122,7 @@ function find_deps { declare -i next_level=$level+1 # Pass the offline flag to children - [[ "$OFFLINE" -eq true ]] && extra+=" -o" + [[ "$OFFLINE" -eq true ]] for _dep in ${deps[@]}; do for _repo in ${REPOS[@]}; do @@ -194,7 +130,7 @@ function find_deps { if [ -e "${ABSROOT}/${_repo}/${_dep}/PKGBUILD" ]; then pushd "${ABSROOT}/${_repo}/${_dep}" > /dev/null - $0 -c -d ${build_dir} -l ${next_level} ${extra} + $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail [ $? -eq 20 ] && return 20 @@ -240,21 +176,6 @@ function _pkg_build () { msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" -# Check if pkg is being built - msg2 "Checking build queue" - check_queue || { - echo "someone_is_building:$(basename $PWD)" >> $build_dir/log - - remove_buildorder "$(basename $PWD)" $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 || { if [ $? -eq 15 ]; then # this error means nonfree others means fail. @@ -302,9 +223,6 @@ function _pkg_build () { # Package was built or failed: take it out of $buildorder remove_buildorder "${build_packages[0]}" $buildorder || true -# Take package out from queue - remove_queue || true - # Set build_packages before next cycle run build_packages=($(sort -gr $buildorder | cut -d: -f2)) popd > /dev/null @@ -335,7 +253,6 @@ function _pkg_build () { # End inmediately but print a useful message trap_exit() { - remove_queue error "$@" warning "Leftover files left on $build_dir" @@ -406,12 +323,6 @@ if [ ${build_only} == 'n' ]; then fi -# If the queue file isn't writable go into offline mode -[ ! -w $queue_file ] && { - error "Can't write queue file" - OFFLINE=true -} - # Only on level 0 if [ $level -eq 0 ]; then # if build_dir exist use it, else make a build_dir -- cgit v1.2.2 From 405c965328f24b7db87aa45f8cc2f513e57d20e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sun, 26 Jun 2011 13:10:29 -0500 Subject: rePKGBUILD proto deletes symlinks in ${srcdir} --- rePKGBUILD.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rePKGBUILD.proto b/rePKGBUILD.proto index 5ef53c1..0126ee0 100644 --- a/rePKGBUILD.proto +++ b/rePKGBUILD.proto @@ -14,14 +14,14 @@ source=(PKGBUILD build() { cd "${srcdir}/" - rm .{INSTALL,PKGINFO} ${pkgname%-libre}-$pkgver-$pkgrel-$CARCH$PKGEXT + rm .{INSTALL,PKGINFO} # put actions for package modifications below this line } package() { - cd ${srcdir} - cp -a ./* ${pkgdir} + find ${srcdir} -type l -maxdepth 1 -delete + cp -a ${srcdir}/* ${pkgdir} } -- cgit v1.2.2 From 69335b6ff0342a2d3201158b9a18010c57cbcf26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sun, 26 Jun 2011 18:07:53 -0500 Subject: libremakepkg cleans better rePKGBUILD.proto finds links and delete them --- libremakepkg | 42 +++++++++++++++++++++++++++--------------- rePKGBUILD.proto | 2 +- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/libremakepkg b/libremakepkg index babed47..e446833 100755 --- a/libremakepkg +++ b/libremakepkg @@ -51,6 +51,32 @@ function buildenv { done } +# Clean packages with pacman +function clean_chroot { + plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" + cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" + (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" + mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" +} + # End inmediately but print a useful message trap_exit() { @@ -120,21 +146,7 @@ fi if [ "${CLEAN_FIRST}" = y ]; then msg "Cleaning" - plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" - cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" - (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" - echo -n "doing cleanup..." - mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" - + clean_chroot fi msg "Creating the package" diff --git a/rePKGBUILD.proto b/rePKGBUILD.proto index 0126ee0..ef3f037 100644 --- a/rePKGBUILD.proto +++ b/rePKGBUILD.proto @@ -20,7 +20,7 @@ build() { } package() { - find ${srcdir} -type l -maxdepth 1 -delete + find ${srcdir} -maxdepth 1 -type l -delete cp -a ${srcdir}/* ${pkgdir} } -- cgit v1.2.2 From 8e4aa31eb303dc0086e9a4f535efda9a6d3939e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sun, 26 Jun 2011 19:19:14 -0500 Subject: Commit files working for git --- librecommit | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/librecommit b/librecommit index 9444bd9..d9a9164 100755 --- a/librecommit +++ b/librecommit @@ -27,36 +27,38 @@ usage () { echo echo "This script commits the package using name, pkgver an pkgver" echo + exit 1 } -msg='Commiting libre package $pkg-$pkgver-$pkgrel' -files="" +msg="Commiting libre package \"\$pkg-\$pkgver-\$pkgrel\"" for opt in $@ ; do case ${opt} in - h) usage ;; - m) msg=${OPTARG} ;; - *) files+="${opt} " ;; + -h) usage ;; + -m) shift; msg=${1}; shift ;; + *) files+="${1} " ; shift ;; esac done -if [ ! -e PKGBUILD ]; then exit 1; fi +if [ ! -e PKGBUILD -o -z "$files" ]; then usage; fi source PKGBUILD pkg=${pkgbase:-${pkgname}} -if [ ${COMMITCD} = 'git' ]; then +msg=$(eval echo $msg) - ${COMMITCD} add $@ && ${COMMITCD} -m "" +if [ "$COMMITCMD" = 'git' ]; then -elif [ ${COMMITCD} = 'hg' ]; then + ${COMMITCMD} add ${files} && ${COMMITCMD} commit -m "$(echo $msg)" - ${COMMITCMD} commit $@ -m -v || exit 1 +elif [ "$COMMITCMD" = 'hg' ]; then + + ${COMMITCMD} commit ${files} -m "$msg" -v || exit 1 else - error "COMMITCD is not correctly set on libretools.conf" + error "COMMITCMD is not correctly set on libretools.conf" fi -- cgit v1.2.2 From 0097ea36511596b3de1947a2069d708079887058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 00:16:33 -0500 Subject: "first working prtools + fixes" --- createworkdir | 4 +- fullpkg | 21 ++- prfullpkg | 403 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ prmipsrelease | 100 +++++++++++++++ prtools.conf | 4 + 5 files changed, 517 insertions(+), 15 deletions(-) create mode 100755 prfullpkg create mode 100755 prmipsrelease create mode 100644 prtools.conf diff --git a/createworkdir b/createworkdir index a28d198..53298f6 100755 --- a/createworkdir +++ b/createworkdir @@ -28,7 +28,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf # Create the WORKDIR [[ ! -d ${WORKDIR} ]] && { msg "Creating WORKDIR on ${WORKDIR}" - stdnull "mkdir -p ${WORKDIR}" ||{ + mkdir -p ${WORKDIR} ||{ error "Could not create ${WORKDIR}" exit 1 } @@ -50,7 +50,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf # Create the staging dirs for _repo in ${REPOS[@]}; do [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { - stdnull "mkdir -p ${WORKDIR}/staging/${_repo}" || { + mkdir -p ${WORKDIR}/staging/${_repo} || { error "Can't create ${WORKDIR}/staging/${_repo}" exit 1 } diff --git a/fullpkg b/fullpkg index c25ed85..7a08112 100755 --- a/fullpkg +++ b/fullpkg @@ -11,7 +11,7 @@ if [ -z $XDG_CONFIG_HOME ]; then error "There's no XDG_CONFIG_HOME var set" exit 1 fi -# set and ban_file +# set ban_file [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ source $XDG_CONFIG_HOME/libretools/libretools.conf ban_file=$XDG_CONFIG_HOME/libretools/ban @@ -35,6 +35,7 @@ function usage { echo " -m max_level : check deps until this level" echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" echo + exit 1 } ## Build order management ## @@ -89,7 +90,6 @@ function find_deps { local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) # If package and correct ${fullver} is built exit -# TODO?: If this package is in force_build: skip this step if is_built "${pkgbase}>=${fullver}"; then exit 0 fi @@ -121,9 +121,6 @@ function find_deps { # Increase build level declare -i next_level=$level+1 -# Pass the offline flag to children - [[ "$OFFLINE" -eq true ]] - for _dep in ${deps[@]}; do for _repo in ${REPOS[@]}; do # try to find $_dep on each repo from dirname @@ -136,10 +133,11 @@ function find_deps { [ $? -eq 20 ] && return 20 popd > /dev/null break 1 # found, go to next dep - + done # if search pkgname in repo doesn't work # this should find pkgsplits - elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ + for _repo in ${REPOS[@]}; do + if _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); then _dir=$(dirname $(echo $_dir | cut -d: -f1)) @@ -150,7 +148,6 @@ function find_deps { [ $? -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 @@ -278,15 +275,14 @@ check_deps_only='n' do_cleanup='n' max_level=21 OFFLINE=false -while getopts 'ha:b:cCd:l:nm:r:o' arg; do +while getopts 'ha:b:cCd:l:nm:r:' arg; do case $arg in - h) usage; exit 0 ;; + h) usage ;; a) ABSROOT="$OPTARG" ;; b) build_only='y' build_dir="$OPTARG" [ -z ${build_dir} ] && { usage - exit 1 } [ ! -r ${build_dir}/BUILDORDER ] && { error "${build_dir}/BUILDORDER doesn't exist." @@ -301,7 +297,6 @@ while getopts 'ha:b:cCd:l:nm:r:o' arg; do n) noupdate='y';; m) max_level=$OPTARG ;; r) FULLBUILDCMD="$OPTARG" ;; - o) OFFLINE=true ;; esac done @@ -312,7 +307,7 @@ if [ ${build_only} == 'n' ]; then [ ! -r PKGBUILD ] && { error "This isn't a build directory" - usage && exit 1 + usage } # Add mips64el if missing from arch=() and it isn't an 'any' package diff --git a/prfullpkg b/prfullpkg new file mode 100755 index 0000000..458eefa --- /dev/null +++ b/prfullpkg @@ -0,0 +1,403 @@ +#!/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 /etc/libretools.d/prtools.conf + +# Avoid /libretools dir doesn't exist errors +if [ -z $XDG_CONFIG_HOME ]; then + error "There's no XDG_CONFIG_HOME var set" + exit 1 +fi +# set ban_file +[ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ + source $XDG_CONFIG_HOME/libretools/libretools.conf +ban_file=$XDG_CONFIG_HOME/libretools/ban + + +##### 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 build_dir : use a fullpkg build_dir and only build." + 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\"" +# echo " -t : build from testing" + echo + exit 1 +} + + +## Build order management ## + +# Removes a package from the buildorder +# $1 package name +# $2 buildorder file +remove_buildorder() { + grep -Evw "${1}" ${2} > ${2}2 + mv -f ${2}2 ${2} +} + +# Guesses the repo name according to the parent dir of the current package +# assuming the form ${ABSROOT}/package/repo/PKGBUILD +guess_repo() { + basename $(pwd) +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +# Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir +# cleans the build_dir +function cleanup { +# Do nothing OR +# Already cleaned + [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 + +# Only do cleanup on level 0 + msg "Cleaning up..." + [ $level -eq 0 ] && rm -rf $build_dir/* +} + +# 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)} + local pkgbase=${pkgbase:-${pkgname[0]}} + local epoch=${epoch:-0} + local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + +# If package and correct ${fullver} is built exit + if is_built "${pkgbase}>=${fullver}"; 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}:${pkgbase}" >> "${build_dir}/BUILDORDER" + +# if pkgbuild directory is on build_dir, do not copy and exit + if [ -d "${build_dir}/${pkgbase}" ]; then + exit 0 + else +# Copy dir to build_dir + mkdir ${build_dir}/${pkgbase} + cp -r $(pwd)/* ${build_dir}/${pkgbase} +# Info to eval later + echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" + fi + +# Inform the current package plus a space for every level for indent + msg2 "%${level}s${pkgbase}-${fullver}" + +## Check next levels +# Clean version checking + deps=$(echo "${depends[@]} ${makedepends[@]}" | \ + sed "s/[=<>]\+[^ ]\+//g" | \ + tr ' ' "\n" | \ + sort -u) + + # Increase build level + declare -i next_level=$level+1 + + for _dep in ${deps[@]}; do + if [ -d "${ABSROOT}/${_dep}" ]; then + # search in REPOS array order + for _repo in ${REPOS[@]}; do + if [ -e "${ABSROOT}/${_dep}/${_repo}/PKGBUILD" ]; then + + pushd "${ABSROOT}/${_dep}/${_repo}" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} + [ $? -eq 20 ] && return 20 # probable circular deps + popd > /dev/null + break 1 # found, go to next dep + + fi + done + + else # pkgsplit, needs guess + + for _repo in ${REPOS[@]}; do + if _dir=($(find "$ABSROOT/" -type f \ + -wholename "*/${_repo}/PKGBUILD" -print0 2>/dev/null | \ + "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | \ + grep -w "$_dep" 2>&1)) ; + then + + _dir=$(dirname $(echo $_dir | cut -d: -f1)) + plain "guess for $_dep -> $_dir" + + pushd "$_dir" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} + [ $? -eq 20 ] && return 20 # probable circular dep + popd > /dev/null + break 1 # found, go to next dep + fi + done + fi + 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" + + msg2 "Checking for non free deps" + pkgbuild-check-nonfree || { + if [ $? -eq 15 ]; then # this error means nonfree others means fail. +# log they have nonfree deps and so didn't build + echo "nonfree:$(basename $PWD)" >> $build_dir/log +# take out package from $buildorder + remove_buildorder "$(basename $PWD)" $buildorder +# continue building next package + continue + fi + } + + msg2 "Building $(basename $PWD)" +# this buildcmd is on libretools.conf + $FULLBUILDCMD; r=$? + case $r in +###### Succesfull Build ###### + 0) + plain "The build was succesful." + source .INFO && [ -n $repo ] && { + +# Calls a local release script if it's used + [ -z $HOOKLOCALRELEASE ] || \ + find -name "*.pkg.tar.?z" -print0 | \ + xargs -0 $HOOKLOCALRELEASE $repo + +# Stage for releasing + librestage $repo || { + echo "unstaged:$(basename $PWD)" >> $build_dir/log + } + + msg "Updating pacman db and packages" + sudo pacman -Sy || true + } + + echo "built:$(basename $PWD)" >> $build_dir/log + ;; +###### Failed Build ###### + *) + error "There were errors while trying to build the package." + echo "failed:$(basename $PWD)" >> $build_dir/log + ;; + esac + +# Package was built or failed: take it out of $buildorder + remove_buildorder "${build_packages[0]}" $buildorder || true + +# Set build_packages before next cycle run + build_packages=($(sort -gr $buildorder | cut -d: -f2)) + popd > /dev/null + done + + pkgs=($(grep "nonfree:" $build_dir/log)) && { + error "Those packages contain nonfree deps:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "built:" $build_dir/log)) && { + msg "Those packages were built and staged:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "failed:" $build_dir/log)) && { + error "Those packages failed to build:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "unstaged:" $build_dir/log)) && { + error "Those packages couldn't be staged because of missing reponame:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + popd > /dev/null +} + +# End inmediately but print a useful message +trap_exit() { + + error "$@" + warning "Leftover files left on $build_dir" + + exit 1 +} + +## END FUNCTIONS ## + +## Trap signals +# From makepkg +set -E +trap 'cleanup' 0 +trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "Aborted by user! Exiting..."' INT +trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR + +force_build="" +level=0 +noupdate='n' +build_only='n' +check_deps_only='n' +do_cleanup='n' +max_level=21 +OFFLINE=false +while getopts 'ha:b:cCd:l:nm:r:' arg; do + case $arg in + h) usage ;; + a) ABSROOT="$OPTARG" ;; + b) build_only='y' + build_dir="$OPTARG" + [ -z ${build_dir} ] && { + usage + } + [ ! -r ${build_dir}/BUILDORDER ] && { + error "${build_dir}/BUILDORDER doesn't exist." + exit 1 + };; + c) check_deps_only='y' ;; + C) do_cleanup='y';; + 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 + +if [ ${build_only} == 'n' ]; then + +# Check if we are actually on a build directory +# Do this early + + [ ! -r PKGBUILD ] && { + error "This isn't a build directory" + usage + } + + # Add mips64el if missing from arch=() and it isn't an 'any' package + if ! grep mips64el PKGBUILD >/dev/null; then + warning "Adding mips64el arch" + sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + fi + +fi + +# Only on level 0 +if [ $level -eq 0 ]; then + # if build_dir exist use it, else make a build_dir + build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} + mkdir -p ${build_dir} # in case of -d option + + # 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 || true + } + +# Build only + [ ${build_only} == 'y' ] && { + msg "Build Packages" + _pkg_build + exit 0 + } + + msg "Checking dependencies" +fi + +## if $level = 20 it's highly likely there are circular deps +[ $level -ge $max_level ] && exit 20 + +# Tries to find deps and build order +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} ] && { + +# Use local copy of ban file if it is avaliable and continue. + search=$(cat ${ban_file} | tr "\n" "|") +# Keep track of banned files + egrep -w "$search" ${buildorder} >> ${build_dir}/banned +# Take banned packages out from buildorder + egrep -vw "$search" ${buildorder} > ${buildorder}2 + mv -f ${buildorder}2 ${buildorder} + unset search + } + } + fi +} + +## START Building +msg "Building packages:" + +# Build the package +_pkg_build + +echo +msg2 "Check if your system works fine and librerelease if it does" + +exit 0 diff --git a/prmipsrelease b/prmipsrelease new file mode 100755 index 0000000..cd4d4ba --- /dev/null +++ b/prmipsrelease @@ -0,0 +1,100 @@ +#!/bin/bash +# Lic: GPLv3+ +# Author: Nicolas Reynolds +# Local release of mips64el packages + clean ABS sync +# Called by HOOKLOCALRELEASE + +# $1 repo +# $2+ packages + +source /etc/makepkg.conf +source /etc/libretools.conf +source /etc/libretools.d/prtools.conf + +usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +repo=$1; shift +repo-add ${PKGDEST}/stage3.db.tar.gz $@ + +# Get all needed sources +source PKGBUILD +fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) +pkgbase=${pkgbase:-$pkgname[0]} + +msg "Adding packages to [stage3]..." +repo-add $@ +for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* +done + +# Copy PKGBUILD and sources + +msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" +dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" +mkdir -p ${dest_dir} >/dev/null +rm -rf ${dest_dir}/* #if package existed already there + +# Set target CARCH as it might be used within the PKGBUILD to select correct sources +eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") +export CARCH +source=($(. "PKGBUILD"; echo ${source[@]})) +cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" +for f in ${source[@]}; do + basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') + if [ -f "$basef" ]; then + cp --remove-destination "$basef" "${dest_dir}" + fi +done + +( . PKGBUILD + for i in 'changelog' 'install'; do + filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [ -f "$file" ]; then + cp --remove-destination "$file" "${dest_dir}" + fi + done + done +) +# END add clean abs + +# Commit the changes + + pushd "$dest_dir" >/dev/null + + source "${dest_dir}/PKGBUILD" + epoch=${epoch:-0} + fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-${pkgname[0]}} + + git add "${dest_dir}/." # add using .gitignore + + git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ + msg2 "${pkgbase} ${fullver} ${repo}" + + popd >/dev/null + +# END commit + +exit $? diff --git a/prtools.conf b/prtools.conf new file mode 100644 index 0000000..5b41216 --- /dev/null +++ b/prtools.conf @@ -0,0 +1,4 @@ + +# Absroot for libretools-pr +ABSROOT=$WORKDIR/prabs +HOOKLOCALRELEASE="prmipsrelease" \ No newline at end of file -- cgit v1.2.2 From 84d2cd5e26dc7f67eb0dfcc814642ed72bec968c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 14:15:45 -0500 Subject: fixes in libremakepkg --- libremakepkg | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libremakepkg b/libremakepkg index e446833..b8d8c9a 100755 --- a/libremakepkg +++ b/libremakepkg @@ -32,6 +32,7 @@ function usage { echo ' -h show this message.' echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' + echo ' -U copy pacman, makepkg, and mtag config files to the chroot' echo ' -n use this dir instead of "${CHCOPY}".' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo @@ -44,11 +45,13 @@ function buildenv { mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done - - for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do - msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" - cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 - done + + if [ "$update_config" = 'y']; then + for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do + msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" + cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 + done + fi } # Clean packages with pacman @@ -74,6 +77,7 @@ while [ "\$clean" = 'false' ]; do done EOF ) > "${CHROOTDIR}/${CHROOTNAME}/clean" + chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" } @@ -102,9 +106,10 @@ UPDATE_FIRST="n" USE_LOG='n' CHROOTNAME=${CHCOPY} MAKEPKG_ARGS="" +update_config='n' #libremakepkg own args -libremakepkgargs='hcun:I:M:' +libremakepkgargs='hcuUn:I:M:' #now makepkg args libremakepkgargs+='ACdefiLmop:rRs' @@ -113,7 +118,8 @@ while getopts ${libremakepkgargs} arg ; do h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; - n) chrootname="$OPTARG"; echo $chrootname ;; + U) update_config='y' + n) CHROOTNAME="$OPTARG" ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; L) MAKEPKG_ARGS+=" -$arg $OPTARG" USE_LOG='y';; @@ -150,7 +156,7 @@ if [ "${CLEAN_FIRST}" = y ]; then fi msg "Creating the package" -makechrootpkg -r ${CHROOTDIR} -l "${CHROOTNAME}" -- ${MAKEPKG_ARGS} +makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS} ev=$? # exit value [ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && { -- cgit v1.2.2 From 75f8632e677bd11bb88be037aa6aab32a79ab008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 14:17:50 -0500 Subject: some fixes --- fullpkg | 1 + libremakepkg | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fullpkg b/fullpkg index 7a08112..35598eb 100755 --- a/fullpkg +++ b/fullpkg @@ -133,6 +133,7 @@ function find_deps { [ $? -eq 20 ] && return 20 popd > /dev/null break 1 # found, go to next dep + fi done # if search pkgname in repo doesn't work # this should find pkgsplits diff --git a/libremakepkg b/libremakepkg index e446833..b8d8c9a 100755 --- a/libremakepkg +++ b/libremakepkg @@ -32,6 +32,7 @@ function usage { echo ' -h show this message.' echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' + echo ' -U copy pacman, makepkg, and mtag config files to the chroot' echo ' -n use this dir instead of "${CHCOPY}".' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo @@ -44,11 +45,13 @@ function buildenv { mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done - - for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do - msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" - cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 - done + + if [ "$update_config" = 'y']; then + for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do + msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" + cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 + done + fi } # Clean packages with pacman @@ -74,6 +77,7 @@ while [ "\$clean" = 'false' ]; do done EOF ) > "${CHROOTDIR}/${CHROOTNAME}/clean" + chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" } @@ -102,9 +106,10 @@ UPDATE_FIRST="n" USE_LOG='n' CHROOTNAME=${CHCOPY} MAKEPKG_ARGS="" +update_config='n' #libremakepkg own args -libremakepkgargs='hcun:I:M:' +libremakepkgargs='hcuUn:I:M:' #now makepkg args libremakepkgargs+='ACdefiLmop:rRs' @@ -113,7 +118,8 @@ while getopts ${libremakepkgargs} arg ; do h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; - n) chrootname="$OPTARG"; echo $chrootname ;; + U) update_config='y' + n) CHROOTNAME="$OPTARG" ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; L) MAKEPKG_ARGS+=" -$arg $OPTARG" USE_LOG='y';; @@ -150,7 +156,7 @@ if [ "${CLEAN_FIRST}" = y ]; then fi msg "Creating the package" -makechrootpkg -r ${CHROOTDIR} -l "${CHROOTNAME}" -- ${MAKEPKG_ARGS} +makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS} ev=$? # exit value [ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && { -- cgit v1.2.2 From eb5cbeea0dc649d18ea4d6330c0787fc5a962b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 16:41:39 -0500 Subject: fixes and tabs -> spaces --- aur | 4 +- fullpkg | 12 ++-- libremessages | 50 +++++++-------- librerelease | 110 ++++++++++++++++---------------- librerepkg | 2 +- librestage | 14 ++--- libretools.conf | 3 +- mipsrelease | 12 ++-- prfullpkg | 12 ++-- prmipsrelease | 134 +++++++++++++++++++-------------------- toru | 192 ++++++++++++++++++++++++++++---------------------------- 11 files changed, 272 insertions(+), 273 deletions(-) diff --git a/aur b/aur index a7408b7..011dc45 100755 --- a/aur +++ b/aur @@ -30,8 +30,8 @@ function usage { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; - *) usage; exit 1 ;; + h) usage; exit 0 ;; + *) usage; exit 1 ;; esac done diff --git a/fullpkg b/fullpkg index 35598eb..cae91da 100755 --- a/fullpkg +++ b/fullpkg @@ -59,12 +59,12 @@ guess_repo() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir diff --git a/libremessages b/libremessages index c297f2d..d333f3f 100755 --- a/libremessages +++ b/libremessages @@ -28,49 +28,49 @@ export TEXTDOMAINDIR='/usr/share/locale' unset ALL_OFF BOLD BLUE GREEN RED YELLOW if tput setaf 0 &>/dev/null; then - ALL_OFF="$(tput sgr0)" - BOLD="$(tput bold)" - BLUE="${BOLD}$(tput setaf 4)" - GREEN="${BOLD}$(tput setaf 2)" - RED="${BOLD}$(tput setaf 1)" - YELLOW="${BOLD}$(tput setaf 3)" - PURPLE="${ALL_OFF}$(tput setaf 5)" + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + RED="${BOLD}$(tput setaf 1)" + YELLOW="${BOLD}$(tput setaf 3)" + PURPLE="${ALL_OFF}$(tput setaf 5)" else - ALL_OFF="\033[1;0m" - BOLD="\033[1;1m" - BLUE="${BOLD}\033[1;34m" - GREEN="${BOLD}\033[1;32m" - RED="${BOLD}\033[1;31m" - YELLOW="${BOLD}\033[1;33m" - PURPLE="${BOLD}\033[1;30;40m" + ALL_OFF="\033[1;0m" + BOLD="\033[1;1m" + BLUE="${BOLD}\033[1;34m" + GREEN="${BOLD}\033[1;32m" + RED="${BOLD}\033[1;31m" + YELLOW="${BOLD}\033[1;33m" + PURPLE="${BOLD}\033[1;30;40m" fi stdnull() { - eval "$@ >/dev/null 2>&1" + eval "$@ >/dev/null 2>&1" } plain() { - local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } msg() { - local mesg=$1; shift - printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } msg2() { - local mesg=$1; shift - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } warning() { - local mesg=$1; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } error() { - local mesg=$1; shift - printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } diff --git a/librerelease b/librerelease index 4e7c491..ed221c8 100755 --- a/librerelease +++ b/librerelease @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Librerelease # Uploads packages into [staging] @@ -21,67 +21,67 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -source /etc/libretools.conf -custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf + source /etc/libretools.conf + custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -function usage { - echo "$(gettext "Usage: $0")" - echo - echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" - echo "$(gettext "to parabola server.")" - echo - echo "$(gettext "OPTIONS:")" - echo "$(gettext " -h this message.")" - echo "$(gettext " -l only list packages but not upload them.")" - echo "$(gettext " -c clean packages on $WORKDIR/staging.")" -} + function usage { + echo "$(gettext "Usage: $0")" + echo + echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" + echo "$(gettext "to parabola server.")" + echo + echo "$(gettext "OPTIONS:")" + echo "$(gettext " -h this message.")" + echo "$(gettext " -l only list packages but not upload them.")" + echo "$(gettext " -c clean packages on $WORKDIR/staging.")" + } -function list_packages { - repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) - for _repo in ${repos[@]}; do - msg2 "$_repo" - find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" - done - unset repos -} + function list_packages { + repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) + for _repo in ${repos[@]}; do + msg2 "$_repo" + find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" + done + unset repos + } -function clean_non_packages { - find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete -} + function clean_non_packages { + find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete + } -function clean_packages { - find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete -} + function clean_packages { + find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete + } -while getopts 'hlc' arg; do - case $arg in - h) usage; exit 0 ;; - l) list_packages; exit 0 ;; - c) clean_packages; exit $? ;; - esac -done + while getopts 'hlc' arg; do + case $arg in + h) usage; exit 0 ;; + l) list_packages; exit 0 ;; + c) clean_packages; exit $? ;; + esac + done -[[ -e $custom_config ]] && source $custom_config + [[ -e $custom_config ]] && source $custom_config -[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" + [[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" -clean_non_packages -msg "Uploading packages..." -rsync --recursive \ - --copy-links \ - --hard-links \ - --partial \ - --prune-empty-dirs \ - --human-readable \ - --progress \ - -e "ssh " \ - ${WORKDIR}/staging \ - ${PARABOLAHOST}:${LIBREDESTDIR}/ || { - error "Sync failed, try again" - exit 1 -} + clean_non_packages + msg "Uploading packages..." + rsync --recursive \ + --copy-links \ + --hard-links \ + --partial \ + --prune-empty-dirs \ + --human-readable \ + --progress \ + -e "ssh " \ + ${WORKDIR}/staging \ + ${PARABOLAHOST}:${LIBREDESTDIR}/ || { + error "Sync failed, try again" + exit 1 + } -msg "Removing packages from local [staging]" -clean_packages + msg "Removing packages from local [staging]" + clean_packages -exit 0 + exit 0 diff --git a/librerepkg b/librerepkg index 5125023..883dabf 100755 --- a/librerepkg +++ b/librerepkg @@ -43,7 +43,7 @@ usage() { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done diff --git a/librestage b/librestage index 917c9bf..07e9ca9 100755 --- a/librestage +++ b/librestage @@ -5,19 +5,19 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - + # This file is part of Parabola. - + # Parabola is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. - + # Parabola is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - + # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . @@ -46,7 +46,7 @@ repos=$@ while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done @@ -98,7 +98,7 @@ for _arch in ${ARCHES[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" - staged='y' + staged='y' } } || { ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { @@ -106,7 +106,7 @@ for _arch in ${ARCHES[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" - staged='y' + staged='y' } } done diff --git a/libretools.conf b/libretools.conf index d19e265..18284a0 100644 --- a/libretools.conf +++ b/libretools.conf @@ -46,7 +46,6 @@ HOOKLOCALRELEASE="mipsrelease" # Don't change unless you know what you're doing and you won't screw # anything ;) LIBREDESTDIR=/home/parabolavnx/parabolagnulinux.org/repo -LIBRESRCDIR=/home/parabolavnx/parabolagnulinux.org/repo/pkgbuilds ## ABSLibre ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git @@ -65,7 +64,7 @@ FULLBUILDCMD="sudo libremakepkg -cumL -M --noconfirm -M --nocheck" # Checks if vars aren't empty for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \ - LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT \ + BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT \ COMMITCMD DIFFTOOL FULLBUILDCMD; do [[ -z ${!VAR} ]] && { diff --git a/mipsrelease b/mipsrelease index 5228bd9..dae489c 100755 --- a/mipsrelease +++ b/mipsrelease @@ -22,12 +22,12 @@ usage() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } repo=$1; shift diff --git a/prfullpkg b/prfullpkg index 458eefa..2ec9661 100755 --- a/prfullpkg +++ b/prfullpkg @@ -62,12 +62,12 @@ guess_repo() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir diff --git a/prmipsrelease b/prmipsrelease index cd4d4ba..29da6e0 100755 --- a/prmipsrelease +++ b/prmipsrelease @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Lic: GPLv3+ # Author: Nicolas Reynolds # Local release of mips64el packages + clean ABS sync @@ -7,94 +7,94 @@ # $1 repo # $2+ packages -source /etc/makepkg.conf -source /etc/libretools.conf -source /etc/libretools.d/prtools.conf + source /etc/makepkg.conf + source /etc/libretools.conf + source /etc/libretools.d/prtools.conf -usage() { - echo "$0 repo package1 [ package2 ... packageN ]" - echo - echo " release packages locally on ${PKGDEST}/stage3." - echo " and make a clean ABS sync " -} + usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " + } ## # usage : get_full_version( $epoch, $pkgver, $pkgrel ) # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} - -repo=$1; shift -repo-add ${PKGDEST}/stage3.db.tar.gz $@ + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } + + repo=$1; shift + repo-add ${PKGDEST}/stage3.db.tar.gz $@ # Get all needed sources -source PKGBUILD -fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) -pkgbase=${pkgbase:-$pkgname[0]} + source PKGBUILD + fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-$pkgname[0]} -msg "Adding packages to [stage3]..." -repo-add $@ -for name in ${pkgname[@]}; do - msg2 "${name} ${fullver}" - repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* -done + msg "Adding packages to [stage3]..." + repo-add $@ + for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* + done # Copy PKGBUILD and sources -msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" -dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" -mkdir -p ${dest_dir} >/dev/null -rm -rf ${dest_dir}/* #if package existed already there + msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" + dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" + mkdir -p ${dest_dir} >/dev/null + rm -rf ${dest_dir}/* #if package existed already there # Set target CARCH as it might be used within the PKGBUILD to select correct sources -eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") -export CARCH -source=($(. "PKGBUILD"; echo ${source[@]})) -cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" -for f in ${source[@]}; do - basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') - if [ -f "$basef" ]; then - cp --remove-destination "$basef" "${dest_dir}" - fi -done - -( . PKGBUILD - for i in 'changelog' 'install'; do - filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) - for file in $filelist; do - # evaluate any bash variables used - eval file=${file} - if [ -f "$file" ]; then - cp --remove-destination "$file" "${dest_dir}" - fi - done - done -) + eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") + export CARCH + source=($(. "PKGBUILD"; echo ${source[@]})) + cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" + for f in ${source[@]}; do + basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') + if [ -f "$basef" ]; then + cp --remove-destination "$basef" "${dest_dir}" + fi + done + + ( . PKGBUILD + for i in 'changelog' 'install'; do + filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [ -f "$file" ]; then + cp --remove-destination "$file" "${dest_dir}" + fi + done + done + ) # END add clean abs # Commit the changes - pushd "$dest_dir" >/dev/null + pushd "$dest_dir" >/dev/null - source "${dest_dir}/PKGBUILD" - epoch=${epoch:-0} - fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) - pkgbase=${pkgbase:-${pkgname[0]}} + source "${dest_dir}/PKGBUILD" + epoch=${epoch:-0} + fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-${pkgname[0]}} - git add "${dest_dir}/." # add using .gitignore + git add "${dest_dir}/." # add using .gitignore - git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ - msg2 "${pkgbase} ${fullver} ${repo}" + git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ + msg2 "${pkgbase} ${fullver} ${repo}" - popd >/dev/null + popd >/dev/null # END commit -exit $? + exit $? diff --git a/toru b/toru index e411b3b..e211878 100755 --- a/toru +++ b/toru @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Queries the ABS # License: GPL3 @@ -13,8 +13,8 @@ # * Possibility to hook up ABS dirs besides ABSROOT (low priority) # * Tell updates and non available binary packages (working on this) -source /etc/abs.conf -source /etc/libretools.conf + source /etc/abs.conf + source /etc/libretools.conf #[ ! -w / ] && { # error "This script must be run as root." @@ -23,53 +23,53 @@ source /etc/libretools.conf # Stores the lastsync date -lastsync() { - [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { - error "The sync date can't be saved. ${lastsyncfile} isn't writable." - return 1 - } + lastsync() { + [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { + error "The sync date can't be saved. ${lastsyncfile} isn't writable." + return 1 + } - date +%s > ${lastsyncfile} - touch ${lastsyncfile} -} + date +%s > ${lastsyncfile} + touch ${lastsyncfile} + } ## # usage : get_full_version( $epoch, $pkgver, $pkgrel ) # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } # Outputs an ordered package-fullpkgver array -print_package_array() { - echo "$@" | tr " " "\n" | sort -V -u -} + print_package_array() { + echo "$@" | tr " " "\n" | sort -V -u + } # Gets repo.db contents # $1 repo -get_db_contents() { - [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 + get_db_contents() { + [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 - bsdtar -tf /var/lib/pacman/sync/$1.db | \ - cut -d'/' -f1 | \ - sort -V -u -} + bsdtar -tf /var/lib/pacman/sync/$1.db | \ + cut -d'/' -f1 | \ + sort -V -u + } -extract_pkgname() { - echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" -} + extract_pkgname() { + echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" + } -extract_fullpkgver() { - echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" -} + extract_fullpkgver() { + echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" + } # Updates the database by finding all PKGBUILDS @@ -78,103 +78,103 @@ extract_fullpkgver() { # * Get all packages already on package repos # * Compare them # Args: -update() { + update() { # The PKGBUILDs found - local pkgbuilds=() + local pkgbuilds=() # The list of pkgname-fullpkgver - local packages_to_sync=() - local packages_in_sync=() - local needed_updates=() - local old_versions=() + local packages_to_sync=() + local packages_in_sync=() + local needed_updates=() + local old_versions=() # Find all the PKGBUILDs newer than the last update # Update newer, otherwise everything - if [ $force ] || [ ! -e ${lastsyncfile} ]; then - $quiet || msg "Forcing upgrade" - pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) - else - pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) - fi + if [ $force ] || [ ! -e ${lastsyncfile} ]; then + $quiet || msg "Forcing upgrade" + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) + else + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) + fi # Inform how many PKGBUILDS were found and quit immediately if none - $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" - [ ${#pkgbuilds[*]} -eq 1 ] && { - $quiet || msg2 "There's nothing to be done. Phew!" - exit 0 - } + $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" + [ ${#pkgbuilds[*]} -eq 1 ] && { + $quiet || msg2 "There's nothing to be done. Phew!" + exit 0 + } - for _pkgbuild in ${pkgbuilds[@]}; do + for _pkgbuild in ${pkgbuilds[@]}; do # The repo name is guessed # You *must* use repo/pkgbase structure - _pkgpath=$(dirname "${_pkgbuild}") - _pkgbase=$(basename "${_pkgpath}") - _pkgrepo=$(basename $(dirname "${_pkgpath}")) + _pkgpath=$(dirname "${_pkgbuild}") + _pkgbase=$(basename "${_pkgpath}") + _pkgrepo=$(basename $(dirname "${_pkgpath}")) - source ${_pkgbuild} + source ${_pkgbuild} - for _pkg in ${pkgname[@]}; do + for _pkg in ${pkgname[@]}; do # Fill the list of packages to find - packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) - done + packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) + done - unset pkgbase pkgname pkgver pkgrel source epoch - done + unset pkgbase pkgname pkgver pkgrel source epoch + done # Get repo database contents - packages_in_sync=($(get_db_contents ${_pkgrepo})) - print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync - print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync + packages_in_sync=($(get_db_contents ${_pkgrepo})) + print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync + print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync # We've orderer the files! - needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) - old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) - $quiet || msg "This packages are available to update" - for _update in ${needed_updates[@]}; do - pkg=$(extract_pkgname $_update) + $quiet || msg "This packages are available to update" + for _update in ${needed_updates[@]}; do + pkg=$(extract_pkgname $_update) - $quiet && echo $pkg - $quiet || { - ver=$(extract_fullpkgver $_update) - oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) + $quiet && echo $pkg + $quiet || { + ver=$(extract_fullpkgver $_update) + oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) - msg2 "$pkg $oldver => $ver" - } + msg2 "$pkg $oldver => $ver" + } - done + done # lastsync -} + } ## MAIN -commands=() -repos=() -quiet=false -force=false -while getopts 'hqfu' arg; do - case $arg in - h) usage; exit 0 ;; - q) quiet=true ;; - f) force=true ;; - u) commands+=(update);; - esac - - shift $((OPTIND-1)) -done + commands=() + repos=() + quiet=false + force=false + while getopts 'hqfu' arg; do + case $arg in + h) usage; exit 0 ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + esac + + shift $((OPTIND-1)) + done # This is the syncfile, stores the last date as content and mtime #lastsyncfile=${ABSROOT}/toru.lastsync -TMPDIR=$(mktemp -d) + TMPDIR=$(mktemp -d) -[[ -z ${TMPDIR} ]] && exit 1 + [[ -z ${TMPDIR} ]] && exit 1 -${commands[0]} ${@} + ${commands[0]} ${@} -rm -rf ${TMPDIR} + rm -rf ${TMPDIR} -exit $? + exit $? -- cgit v1.2.2 From f303abe1eb26dd9037824889dc3c02df74ed9fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 18:46:24 -0500 Subject: libremakepkg uses find to copy logs and has no trailing space --- libremakepkg | 84 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/libremakepkg b/libremakepkg index b8d8c9a..b2f8aa8 100755 --- a/libremakepkg +++ b/libremakepkg @@ -3,32 +3,32 @@ # Copyright 2011 Joshua Ismael Haase Hernández # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf source /etc/makepkg.conf function usage { - echo 'cd to a dir containing a PKGBUILD and run:' + echo 'cd to a dir containing a PKGBUILD and run:' echo '$0 [options] [makepkg args]' echo 'This script will build your package on a chroot.' echo echo 'OPTIONS:' - echo + echo echo ' -h show this message.' echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' @@ -45,8 +45,8 @@ function buildenv { mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done - - if [ "$update_config" = 'y']; then + + if [ "$update_config" = 'y' ] ; then for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 @@ -78,19 +78,19 @@ done EOF ) > "${CHROOTDIR}/${CHROOTNAME}/clean" chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" - mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" -} + mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" +} # End inmediately but print a useful message trap_exit() { - - for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do - umount "${CHROOTDIR}/${CHCOPY}${mp}" - done - error "$@" + for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do + umount "${CHROOTDIR}/${CHCOPY}${mp}" + done - exit 1 + error "$@" + + exit 1 } ## Trap signals @@ -115,15 +115,15 @@ libremakepkgargs+='ACdefiLmop:rRs' while getopts ${libremakepkgargs} arg ; do case "${arg}" in - h) usage; exit 0 ;; - c) CLEAN_FIRST="y" ;; - u) UPDATE_FIRST="y" ;; - U) update_config='y' - n) CHROOTNAME="$OPTARG" ;; - M) MAKEPKG_ARGS+=" $OPTARG" ;; - L) MAKEPKG_ARGS+=" -$arg $OPTARG" + h) usage; exit 0 ;; + c) CLEAN_FIRST="y" ;; + u) UPDATE_FIRST="y" ;; + U) update_config='y' ;; + n) CHROOTNAME="$OPTARG" ;; + M) MAKEPKG_ARGS+=" $OPTARG" ;; + L) MAKEPKG_ARGS+=" -$arg $OPTARG" USE_LOG='y';; - *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;; + *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;; esac done @@ -135,8 +135,8 @@ fi msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree - error "PKGBUILD contains non-free issues" - exit 15 + error "PKGBUILD contains non-free issues" + exit 15 else true fi @@ -144,23 +144,23 @@ pkgbuild-check-nonfree ||{ buildenv -if [ "${UPDATE_FIRST}" = y ]; then +if [ "${UPDATE_FIRST}" = 'y' ]; then msg "Updating the chroot in use..." # -c option in mkarchroot indicates cache mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" fi -if [ "${CLEAN_FIRST}" = y ]; then +if [ "${CLEAN_FIRST}" = 'y' ]; then msg "Cleaning" clean_chroot fi msg "Creating the package" -makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS} +makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" ev=$? # exit value -[ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && { - cp ${CHROOTDIR}/${chrootname}/build/*.log ./ +if [ "${USE_LOG}" == 'y' ]; then + find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; } exit $ev -- cgit v1.2.2 From 6e704feb5f40c65ca7aba5b058d77249761c1156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 27 Jun 2011 20:53:35 -0300 Subject: Specify trunk dir. Now repo goes first($1). --- diff-unfree | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/diff-unfree b/diff-unfree index 86a537f..e4004d6 100755 --- a/diff-unfree +++ b/diff-unfree @@ -27,7 +27,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf msg "Diff-Unfree helps you diff build scripts from ABSLibre against (Unfree) ABS. Package name and repo will we guessed if you don't specify them." - msg2 "Usage: $0 [repo] [unfree-package]" + msg2 "Usage: $0 [community|packages] [unfree-package] [repo]" exit 0 } @@ -40,6 +40,7 @@ package_guess=$(basename $PWD) repo=${1:-$(basename $(dirname $PWD))} package=${2:-${package_guess/-libre}} +trunk=${3:-trunk} tmp_dir=$(mktemp -d /tmp/${package}.XXXXXX) @@ -55,7 +56,7 @@ case $repo in ;; esac -unfree_dir="${tmp_dir}/${svnrepo}/${package}/trunk" +unfree_dir="${tmp_dir}/${svnrepo}/${package}/${trunk}" [[ ! -d "${tmp_dir}" ]] && { error "Can't create temp dir" -- cgit v1.2.2 From 7310a3f4243b9fafb3f01d5430fa96575bfd0819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 27 Jun 2011 20:57:52 -0300 Subject: Fixed typos --- libremakepkg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libremakepkg b/libremakepkg index b8d8c9a..18e1c22 100755 --- a/libremakepkg +++ b/libremakepkg @@ -118,11 +118,11 @@ while getopts ${libremakepkgargs} arg ; do h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; - U) update_config='y' + U) update_config='y' ;; n) CHROOTNAME="$OPTARG" ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; - L) MAKEPKG_ARGS+=" -$arg $OPTARG" - USE_LOG='y';; + L) MAKEPKG_ARGS+=" -$arg $OPTARG" + USE_LOG='y';; *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;; esac done @@ -156,7 +156,7 @@ if [ "${CLEAN_FIRST}" = y ]; then fi msg "Creating the package" -makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS} +makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" ev=$? # exit value [ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && { -- cgit v1.2.2 From 1a60b54ff583a39e1069dcd527c347f23bbc2b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 27 Jun 2011 21:00:12 -0300 Subject: Several fixes --- aur | 7 +++++++ librerepkg | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/aur b/aur index a7408b7..7c2860b 100755 --- a/aur +++ b/aur @@ -37,6 +37,11 @@ done missing_deps=() for _pkg in ${@}; do + +# Remove the version +# TODO check downloaded PKGBUILD version + _pkg="${_pkg%%[<>=]*}" + msg "Downloading $_pkg..." wget -O - -q http://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \ tar xzf - >/dev/null 2>&1 @@ -75,6 +80,8 @@ for _pkg in ${@}; do if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then missing_deps=(${missing_deps} $_dep) fi + else + msg2 "$_dep is on repos" fi done diff --git a/librerepkg b/librerepkg index 5125023..6232406 100755 --- a/librerepkg +++ b/librerepkg @@ -58,6 +58,6 @@ msg2 "Updating md5sums" makepkg -gp rePKGBUILD >> rePKGBUILD msg "Repackaging using makepkg" -makepkg -Lcp rePKGBUILD +makepkg -Lcdp rePKGBUILD stdnull popd ${tempdir} -- cgit v1.2.2 From 6633c1d07a2b408dd74ad909326a54f94b2fdfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 28 Jun 2011 15:14:32 -0500 Subject: libremakepkg does not update config --- libremakepkg | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/libremakepkg b/libremakepkg index b2f8aa8..0baaed2 100755 --- a/libremakepkg +++ b/libremakepkg @@ -32,7 +32,6 @@ function usage { echo ' -h show this message.' echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' - echo ' -U copy pacman, makepkg, and mtag config files to the chroot' echo ' -n use this dir instead of "${CHCOPY}".' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo @@ -40,18 +39,11 @@ function usage { function buildenv { msg "Building env" - for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do + for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST}; do msg2 "binding ${mp} to ${CHROOTDIR}/${CHCOPY}${mp}" mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done - - if [ "$update_config" = 'y' ] ; then - for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do - msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}" - cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1 - done - fi } # Clean packages with pacman @@ -81,6 +73,13 @@ EOF mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" } +copy_log() { + if [ "${USE_LOG}" == 'y' ]; then + find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; + fi +} + + # End inmediately but print a useful message trap_exit() { @@ -88,6 +87,8 @@ trap_exit() { umount "${CHROOTDIR}/${CHCOPY}${mp}" done + copy_log + error "$@" exit 1 @@ -106,7 +107,6 @@ UPDATE_FIRST="n" USE_LOG='n' CHROOTNAME=${CHCOPY} MAKEPKG_ARGS="" -update_config='n' #libremakepkg own args libremakepkgargs='hcuUn:I:M:' @@ -118,7 +118,6 @@ while getopts ${libremakepkgargs} arg ; do h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; - U) update_config='y' ;; n) CHROOTNAME="$OPTARG" ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; L) MAKEPKG_ARGS+=" -$arg $OPTARG" @@ -159,8 +158,6 @@ msg "Creating the package" makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" ev=$? # exit value -if [ "${USE_LOG}" == 'y' ]; then - find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; -} +copy_log exit $ev -- cgit v1.2.2 From 207a930a564e8157e24c3e7f5fbe987494b73d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 28 Jun 2011 21:23:49 -0500 Subject: * Cleanup code + arch specific separated --- TODO | 7 - createworkdir | 60 ++++---- diff-unfree | 30 ++-- fullpkg | 366 ++++++++++++++++++++++---------------------- librechroot | 32 ++-- librecommit | 30 ++-- librediff | 32 ++-- libremakepkg | 85 +++++++---- librerelease | 32 ++-- librerepkg | 30 ++-- librestage | 24 +-- libretools.conf | 15 +- mips64el/mips-add | 6 + mips64el/mips64el.conf | 12 ++ mips64el/mipsrelease | 53 +++++++ mipsrelease | 53 ------- pkgbuild-check-nonfree | 150 +++++++++--------- prfullpkg | 403 ------------------------------------------------- prmipsrelease | 100 ------------ prtools.conf | 4 - prtools/prfullpkg | 397 ++++++++++++++++++++++++++++++++++++++++++++++++ prtools/prmipsrelease | 98 ++++++++++++ prtools/prtools.conf | 4 + prtools/prtoru | 173 +++++++++++++++++++++ rePKGBUILD.proto | 7 +- toru | 10 +- 26 files changed, 1215 insertions(+), 998 deletions(-) delete mode 100644 TODO create mode 100644 mips64el/mips-add create mode 100644 mips64el/mips64el.conf create mode 100755 mips64el/mipsrelease delete mode 100755 mipsrelease delete mode 100755 prfullpkg delete mode 100755 prmipsrelease delete mode 100644 prtools.conf create mode 100755 prtools/prfullpkg create mode 100755 prtools/prmipsrelease create mode 100644 prtools/prtools.conf create mode 100644 prtools/prtoru diff --git a/TODO b/TODO deleted file mode 100644 index 2f019b2..0000000 --- a/TODO +++ /dev/null @@ -1,7 +0,0 @@ -* A tool for repackaging. For instance, some packages need changing that can be -done without rebuilding everything (OO.o's change of extension dir, for -instance, changes on default config files) - What should it do? - - Retrieve the package from official repos - - Extract it to pkg/ - - Repackage diff --git a/createworkdir b/createworkdir index 53298f6..b443c08 100755 --- a/createworkdir +++ b/createworkdir @@ -5,35 +5,46 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf [[ -e $custom_config ]] && source $custom_config -# Create the WORKDIR -[[ ! -d ${WORKDIR} ]] && { +[[ ! -d ${WORKDIR} ]] && { # Create the WORKDIR + msg "Creating WORKDIR on ${WORKDIR}" mkdir -p ${WORKDIR} ||{ - error "Could not create ${WORKDIR}" - exit 1 + error "Could not create ${WORKDIR}"; exit 1 } + } +for _repo in ${REPOS[@]}; do # Create the staging dirs + + [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { + mkdir -p ${WORKDIR}/staging/${_repo} || { + error "Can't create ${WORKDIR}/staging/${_repo}" + exit 1 + } + } + +done + [[ ! -d ${WORKDIR}/abslibre/.git ]] && { msg "Cloning into ABSLibre" CMD="git clone ${ABSLIBREGIT} ${WORKDIR}/abslibre" @@ -46,17 +57,6 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf } } - -# Create the staging dirs -for _repo in ${REPOS[@]}; do - [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { - mkdir -p ${WORKDIR}/staging/${_repo} || { - error "Can't create ${WORKDIR}/staging/${_repo}" - exit 1 - } - } -done - msg "Finished, your packaging dir tree looks like this now:" ls --color=always ${WORKDIR}/*/* diff --git a/diff-unfree b/diff-unfree index 86a537f..03e4324 100755 --- a/diff-unfree +++ b/diff-unfree @@ -4,21 +4,21 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf diff --git a/fullpkg b/fullpkg index cae91da..be26956 100755 --- a/fullpkg +++ b/fullpkg @@ -1,25 +1,23 @@ #!/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 /etc/libretools.d/prtools.conf -# Avoid /libretools dir doesn't exist errors -if [ -z $XDG_CONFIG_HOME ]; then - error "There's no XDG_CONFIG_HOME var set" - exit 1 -fi -# set ban_file -[ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ - source $XDG_CONFIG_HOME/libretools/libretools.conf -ban_file=$XDG_CONFIG_HOME/libretools/ban +if [ -z $XDG_CONFIG_HOME ]; then # Avoid /libretools dir doesn't exist errors + + error "There's no XDG_CONFIG_HOME var set"; exit 1 + +elif [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + + source $XDG_CONFIG_HOME/libretools/libretools.conf +fi -##### 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 " @@ -30,131 +28,144 @@ function usage { echo " -a absdir : set absdir as ABSROOT." echo " -b build_dir : use a fullpkg build_dir and only build." echo " -c : check deps only, do not build." + echo " -C : cleanup the build_dir." 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 exit 1 -} -## Build order management ## +} -# Removes a package from the buildorder +function remove_buildorder { # Removes a package from the buildorder # $1 package name # $2 buildorder file -remove_buildorder() { + grep -Evw "${1}" ${2} > ${2}2 mv -f ${2}2 ${2} + } -# Guesses the repo name according to the parent dir of the current package -# assuming the form repo/package/PKGBUILD -guess_repo() { - basename $(dirname $(pwd)) +function guess_repo { # Get repo name. Asumes ${ABSROOT}/repo/package/PKGBUILD + + basename $(dirname $(pwd)) # Variable in prfullpkg + } -## -# usage : get_full_version( $epoch, $pkgver, $pkgrel ) -# return : full version spec, including epoch (if necessary), pkgver, pkgrel -## -get_full_version() { +function get_fullver { # return : full version spec, including epoch (if necessary), pkgver, pkgrel + +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) + if [[ $1 -eq 0 ]]; then # zero epoch case, don't include it in version echo $2-$3 else echo $1:$2-$3 fi + } -# Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir -# cleans the build_dir -function cleanup { -# Do nothing OR -# Already cleaned - [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 +function cleanup { # Cleans the build_dir. + + [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 # Do nothing or already cleaned. -# Only do cleanup on level 0 msg "Cleaning up..." - [ $level -eq 0 ] && rm -rf $build_dir/* + [ $level -eq 0 ] && rm -rf $build_dir/* # Only do cleanup on level 0. + } -# Check PKGBUILD and find non built or outdated deps -# on ABSROOT which should be abslibre-misp64el -function find_deps { - ## Check this level. - source PKGBUILD +function find_deps { # Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated. + + source PKGBUILD ## Check this level. + local repo=${repo:-$(guess_repo)} local pkgbase=${pkgbase:-${pkgname[0]}} local epoch=${epoch:-0} - local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + local fullver=$(get_fullver ${epoch} ${pkgver} ${pkgrel}) -# If package and correct ${fullver} is built exit if is_built "${pkgbase}>=${fullver}"; then - exit 0 + exit 0 # pkg is built and updated fi -# Tell which packages are deeper in deps (even if they are on build_dir) -# so we can build them first. - echo "${level}:${pkgbase}" >> "${build_dir}/BUILDORDER" + echo "${level}:${pkgbase}" >> "${build_dir}/BUILDORDER" # greater levels are built first + + if [ -d "${build_dir}/${pkgbase}" ]; then # PKGBUILD is already there -# if pkgbuild directory is on build_dir, do not copy and exit - if [ -d "${build_dir}/${pkgbase}" ]; then exit 0 - else -# Copy dir to build_dir + + else # Copy dir to build_dir +## variable block for prfullpkg + cp -r ../${pkgbase}/ ${build_dir}/ -# Info to eval later - echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" + + echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" # to identify repo later fi -# Inform the current package plus a space for every level for indent - msg2 "%${level}s${pkgbase}-${fullver}" + msg2 "%${level}s${pkgbase}-${fullver}" # current package plus a space for every level + + declare -i next_level=$level+1 ## Check next levels -## Check next levels -# Clean version checking deps=$(echo "${depends[@]} ${makedepends[@]}" | \ sed "s/[=<>]\+[^ ]\+//g" | \ tr ' ' "\n" | \ - sort -u) - -# Increase build level - declare -i next_level=$level+1 + sort -u) # All deps in separate line, only once, without version. 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} + local found=false + + for _repo in ${REPOS[@]}; do - # Circular deps must fail - [ $? -eq 20 ] && return 20 + if [ -e "${ABSROOT}/${_repo}/${_dep}/PKGBUILD" ]; then # ABSROOT/repo/package + + pushd "${ABSROOT}/${_repo}/${_dep}" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} # run this cmd on dep's PKGBUILD dir + [ $? -eq 20 ] && return 20 # probable circular deps popd > /dev/null - break 1 # found, go to next dep - fi - done -# if search pkgname in repo doesn't work -# this should find pkgsplits - for _repo in ${REPOS[@]}; do - if _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ - "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); - then - _dir=$(dirname $(echo $_dir | cut -d: -f1)) - plain "guess for $_dep -> $_dir" - pushd $_dir > /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 + local found=true + break 1 # found, end cycle fi + done + + if ( ${found} ); then + + continue 1 # go to next dep + + else # pkgsplit, needs guess + + for _repo in ${REPOS[@]}; do + if _dir=($(find "$ABSROOT/${_repo}" -type f \ + -name PKGBUILD -print0 2>/dev/null | \ + "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | \ + grep -w "$_dep" 2>&1)); + + then + + _dir=$(dirname $(echo $_dir | cut -d: -f1)) + plain "guess for $_dep -> $_dir" + + pushd "$_dir" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} # run this cmd on dep's PKGBUILD dir + [ $? -eq 20 ] && return 20 # probable circular deps + popd > /dev/null + local found=true + break 1 # found, end cycle + fi + + done + + if ( ${found} ); then + continue 1 # go to next dep + else + echo "dep_not_found:$_dep" >> $build_dir/log + fi + done +## End variable block + unset next_level dir # unset PKGBUILD variables unset pkgname pkgver pkgrel epoch pkgdesc arch url license groups depends \ @@ -162,67 +173,64 @@ function find_deps { options install changelog source noextract md5sums build check package } -function _pkg_build () { +function __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)) + + build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first while [ ${#build_packages[@]} -ge 1 ]; do pushd $build_dir/${build_packages[0]} > /dev/null - source PKGBUILD + source PKGBUILD msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" msg2 "Checking for non free deps" pkgbuild-check-nonfree || { if [ $? -eq 15 ]; then # this error means nonfree others means fail. -# log they have nonfree deps and so didn't build + echo "nonfree:$(basename $PWD)" >> $build_dir/log -# take out package from $buildorder - remove_buildorder "$(basename $PWD)" $buildorder -# continue building next package - continue + + remove_buildorder "$(basename $PWD)" $buildorder # take out package from $buildorder + + continue # build next package fi } msg2 "Building $(basename $PWD)" -# this buildcmd is on libretools.conf - $FULLBUILDCMD; r=$? + + $FULLBUILDCMD; r=$? # this buildcmd is on libretools.conf + case $r in -###### Succesfull Build ###### - 0) + + 0) ## Succesfull build + plain "The build was succesful." - source .INFO && [ -n $repo ] && { + if source .INFO && [ -n $repo ]; then -# Calls a local release script if it's used - [ -z $HOOKLOCALRELEASE ] || \ - find -name "*.pkg.tar.?z" -print0 | \ - xargs -0 $HOOKLOCALRELEASE $repo + # Calls a local release script if it's used + if [ ! -z $HOOKLOCALRELEASE ]; then + find -name "*.pkg.tar.?z" -print0 | xargs -0 $HOOKLOCALRELEASE $repo + fi -# Stage for releasing - librestage $repo || { - echo "unstaged:$(basename $PWD)" >> $build_dir/log - } + librestage $repo || echo "unstaged:$(basename $PWD)" >> $build_dir/log msg "Updating pacman db and packages" sudo pacman -Sy || true - } + + fi echo "built:$(basename $PWD)" >> $build_dir/log ;; -###### Failed Build ###### - *) - error "There were errors while trying to build the package." + + *) ## Build failed + error "There were errors while trying to build the package." echo "failed:$(basename $PWD)" >> $build_dir/log ;; esac -# Package was built or failed: take it out of $buildorder remove_buildorder "${build_packages[0]}" $buildorder || true -# Set build_packages before next cycle run - build_packages=($(sort -gr $buildorder | cut -d: -f2)) + build_packages=($(sort -gr $buildorder | cut -d: -f2)) # which is next package? popd > /dev/null done @@ -249,8 +257,7 @@ function _pkg_build () { popd > /dev/null } -# End inmediately but print a useful message -trap_exit() { +function trap_exit { # End inmediately but print a useful message error "$@" warning "Leftover files left on $build_dir" @@ -258,16 +265,14 @@ trap_exit() { exit 1 } -## END FUNCTIONS ## - -## Trap signals -# From makepkg +# Trap signals from makepkg set -E trap 'cleanup' 0 -trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT -trap 'trap_exit "Aborted by user! Exiting..."' INT -trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR +trap 'trap_exit "(prfullpkg:${level}) TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "(prfullpkg:${level}) Aborted by user! Exiting..."' INT +trap 'trap_exit "(prfullpkg:${level}) An unknown error has occurred. Exiting..."' ERR +ban_file=$XDG_CONFIG_HOME/libretools/ban force_build="" level=0 noupdate='n' @@ -275,26 +280,24 @@ build_only='n' check_deps_only='n' do_cleanup='n' max_level=21 -OFFLINE=false + while getopts 'ha:b:cCd:l:nm:r:' arg; do case $arg in h) usage ;; a) ABSROOT="$OPTARG" ;; - b) build_only='y' + b) build_only='y' build_dir="$OPTARG" - [ -z ${build_dir} ] && { + if [ -z ${build_dir} ]; then usage - } - [ ! -r ${build_dir}/BUILDORDER ] && { + fi + if [ ! -r ${build_dir}/BUILDORDER ] ; then error "${build_dir}/BUILDORDER doesn't exist." exit 1 - };; + fi;; c) check_deps_only='y' ;; C) do_cleanup='y';; d) build_dir="$OPTARG" ;; -# hidden option to know what to build first. -# if $level > 0 it will not build - l) level=$OPTARG ;; + l) level=$OPTARG ;; # hidden option to know dep level. n) noupdate='y';; m) max_level=$OPTARG ;; r) FULLBUILDCMD="$OPTARG" ;; @@ -303,92 +306,95 @@ done if [ ${build_only} == 'n' ]; then -# Check if we are actually on a build directory -# Do this early - - [ ! -r PKGBUILD ] && { + [ ! -r PKGBUILD ] && { # Check if we are actually on a build directory. Do this early. error "This isn't a build directory" usage } -# Add mips64el if missing from arch=() and it isn't an 'any' package - if ! grep mips64el PKGBUILD >/dev/null; then - warning "Adding mips64el arch" - sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + if [ ! -z "$HOOKPKGBUILDMOD" ]; then + "$HOOKPKGBUILDMOD" fi fi -# Only on level 0 if [ $level -eq 0 ]; then -# if build_dir exist use it, else make a build_dir - build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} - mkdir -p ${build_dir} # in case of -d option -# make files for log and buildorder - touch ${build_dir}/{log,BUILDORDER} + build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} # use -d option or else mktemp + + if [ ! -d ${build_dir} ]; then # in case of custom -d option + mkdir -p ${build_dir} + else + cleanup # files already there can screw find_deps + fi + + touch ${build_dir}/{log,BUILDORDER} ${ban_file} # make files for log and buildorder buildorder=${build_dir}/BUILDORDER - [ ${noupdate} = 'n' ] && { + if [ ${noupdate} = 'n' ]; then + msg "Updating pacman db and packages" sudo pacman -Syu --noconfirm || true - } -# Build only - [ ${build_only} == 'y' ] && { + fi + + if [ ${build_only} == 'y' ]; then + msg "Build Packages" - _pkg_build + + __build + exit 0 - } + + fi msg "Checking dependencies" fi -## if $level = 20 it's highly likely there are circular deps -[ $level -ge $max_level ] && exit 20 +[ $level -ge $max_level ] && exit 20 # Probable circular deps -# Tries to find deps and build order -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 +find_deps || { + + if [ $? -eq 20 ]; then # Probable circular deps + + if [ $level -eq 0 ]; then # Show error only on level 0 + error "Check for circular deps on $build_dir/BUILDORDER"; + fi + + fi + exit 20 # Pass message 20 } -# levels greater than 0 must only check deps -[ $check_deps_only = 'y' -o $level -gt 0 ] && exit 0 +[ $check_deps_only = 'y' -o $level -gt 0 ] && exit 0 # only build on level 0 + +if [ $level -eq 0 -a -d $build_dir ]; then # Sanity check + + if [ ! -w $ban_file -o ! -r $ban_file ]; then # Check ban_file permisions -# 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)" + chmod a+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} ] && { -# Use local copy of ban file if it is avaliable and continue. + warning "Failed to get ban list" && [ -r ${ban_file} ] && { # use local copy if it exist + search=$(cat ${ban_file} | tr "\n" "|") -# Keep track of banned files - egrep -w "$search" ${buildorder} >> ${build_dir}/banned -# Take banned packages out from buildorder - egrep -vw "$search" ${buildorder} > ${buildorder}2 + + egrep -w "$search" ${buildorder} >> ${build_dir}/banned # Keep track of banned files + + egrep -vw "$search" ${buildorder} > ${buildorder}2 # Take banned packages out of buildorder + mv -f ${buildorder}2 ${buildorder} + unset search } } fi -} +fi -## START Building msg "Building packages:" -# Build the package -_pkg_build +__build # Build the packages echo msg2 "Check if your system works fine and librerelease if it does" diff --git a/librechroot b/librechroot index b308b7d..8071ca9 100755 --- a/librechroot +++ b/librechroot @@ -5,21 +5,21 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf @@ -32,7 +32,7 @@ function usage { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done diff --git a/librecommit b/librecommit index d9a9164..d3ddbff 100755 --- a/librecommit +++ b/librecommit @@ -2,21 +2,21 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf diff --git a/librediff b/librediff index 59a9791..1f39eb9 100755 --- a/librediff +++ b/librediff @@ -4,21 +4,21 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . usage() { echo "Usage: $0 [ ...]" @@ -54,7 +54,7 @@ for package in $@; do continue } - source ./${package}-libre/PKGBUILD + source ./${package}-libre/PKGBUILD [[ -z ${pkgbase} ]] && pkgbase=${pkgname} # Generate a diff file, no -r since we don't want to patch src/ nor pkg/ diff --git a/libremakepkg b/libremakepkg index 0baaed2..13e7617 100755 --- a/libremakepkg +++ b/libremakepkg @@ -22,7 +22,8 @@ source /etc/libretools.conf source /etc/makepkg.conf -function usage { +function usage { # Display message and exit + echo 'cd to a dir containing a PKGBUILD and run:' echo '$0 [options] [makepkg args]' echo 'This script will build your package on a chroot.' @@ -35,19 +36,22 @@ function usage { echo ' -n use this dir instead of "${CHCOPY}".' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo + exit 1 } -function buildenv { +function buildenv { # Mounts *DEST from makepkg.conf + msg "Building env" for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST}; do msg2 "binding ${mp} to ${CHROOTDIR}/${CHCOPY}${mp}" mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done + } -# Clean packages with pacman -function clean_chroot { +function clean_chroot { # Clean packages with pacman + plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" + } -copy_log() { +function copy_log { # copy logs if they exist + if [ "${USE_LOG}" == 'y' ]; then find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; fi + } +function trap_exit { # End inmediately but print a useful message -# End inmediately but print a useful message -trap_exit() { +# args are treated as part of the message - for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do + for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST}; do umount "${CHROOTDIR}/${CHCOPY}${mp}" done @@ -94,8 +101,7 @@ trap_exit() { exit 1 } -## Trap signals -# From makepkg +# Trap signals from makepkg set -E trap 'trap_exit "(libremakepkg): TERM signal caught. Exiting..."' TERM HUP QUIT trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT @@ -108,14 +114,12 @@ USE_LOG='n' CHROOTNAME=${CHCOPY} MAKEPKG_ARGS="" -#libremakepkg own args -libremakepkgargs='hcuUn:I:M:' -#now makepkg args -libremakepkgargs+='ACdefiLmop:rRs' +libremakepkgargs='hcuUn:I:M:' # libremakepkg own args +libremakepkgargs+='ACdefiLmop:rRs' # makepkg args while getopts ${libremakepkgargs} arg ; do case "${arg}" in - h) usage; exit 0 ;; + h) usage ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; n) CHROOTNAME="$OPTARG" ;; @@ -131,32 +135,53 @@ if [ ${UID} -ne 0 ]; then exit 1 fi +if [ ! -r PKGBUILD ]; then # Check if we are actually on a build directory. Do this early. + + error "This isn't a build directory"; usage + +fi + msg "Checking PKGBUILD for non-free issues" -pkgbuild-check-nonfree ||{ - if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree +if ! pkgbuild-check-nonfree; then + + if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree error "PKGBUILD contains non-free issues" exit 15 else true fi -} -buildenv - -if [ "${UPDATE_FIRST}" = 'y' ]; then - msg "Updating the chroot in use..." -# -c option in mkarchroot indicates cache - mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" fi -if [ "${CLEAN_FIRST}" = 'y' ]; then - msg "Cleaning" - clean_chroot -fi +buildenv msg "Creating the package" -makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" -ev=$? # exit value +if [ -d "${CHROOTDIR}/${CHROOTNAME}" ]; then # use chroot + + if [ "${UPDATE_FIRST}" = 'y' ]; then + msg "Updating the chroot in use..." + mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" # -c option is for cache + fi + + if [ "${CLEAN_FIRST}" = 'y' ]; then + msg "Cleaning" + clean_chroot + fi + + makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" + ev=$? # exit value + +else # build new chroot before using + + if [ "${UPDATE_FIRST}" = 'y' ]; then # update CHROOT + msg "Updating the chroot in use..." + mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOT}" # -c option is for cache + fi + + makechrootpkg -c -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" + ev=$? # exit value + +fi copy_log diff --git a/librerelease b/librerelease index ed221c8..169ca0e 100755 --- a/librerelease +++ b/librerelease @@ -1,25 +1,25 @@ - #!/bin/bash +#!/bin/bash # Librerelease # Uploads packages into [staging] # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf diff --git a/librerepkg b/librerepkg index 883dabf..94a1e9e 100755 --- a/librerepkg +++ b/librerepkg @@ -2,21 +2,21 @@ # Copyright 2011 Joshua Ismael Haase Hernandez # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf diff --git a/librestage b/librestage index 07e9ca9..d1784ab 100755 --- a/librestage +++ b/librestage @@ -6,20 +6,20 @@ # ---------- GNU General Public License 3 ---------- -# This file is part of Parabola. +# This file is part of Parabola. -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf @@ -88,7 +88,7 @@ for _arch in ${ARCHES[@]}; do if [ -e "${pkgpath}" ]; then msg "Found ${pkgfile}" - canonical="" + canonical="" for _repo in ${repos[@]}; do [[ -z "$canonical" ]] && { diff --git a/libretools.conf b/libretools.conf index 18284a0..fa5d4b2 100644 --- a/libretools.conf +++ b/libretools.conf @@ -35,13 +35,6 @@ PARABOLAHOST=parabola ## Run a command before releasing a package (ie. SSH connection, SSH tunnel, etc.) HOOKPRERELEASE="ssh -fN parabola" -## Run a command for local releasing of packages -# Useful for mass packaging (ie. mips port) -# Must accept the following parameters even if the command won't use them: -# $1 repo name -# $2+ packages -HOOKLOCALRELEASE="mipsrelease" - ## Server destination of libre packages # Don't change unless you know what you're doing and you won't screw # anything ;) @@ -75,6 +68,14 @@ done source /usr/bin/libremessages +## These are architecture specific files. +## Uncomment them if you installed libretools-arch +#source /etc/libretools.d/mips64el.conf +#source /etc/libretools.d/x86_64.conf +#source /etc/libretools.d/i686.conf + + + ## Recommended SSH Config follows # SSH host, it's better if you have it configured on ~/.ssh/config # with ControlMaster auto (and a shell opened somewhere else) diff --git a/mips64el/mips-add b/mips64el/mips-add new file mode 100644 index 0000000..0d4e494 --- /dev/null +++ b/mips64el/mips-add @@ -0,0 +1,6 @@ +#!/bin/bash +if ! grep mips64el PKGBUILD >/dev/null; then # Add mips64el in ${arch} array if it isn't 'any' + warning "Adding mips64el arch" + sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + librecommit PKGBUILD +fi diff --git a/mips64el/mips64el.conf b/mips64el/mips64el.conf new file mode 100644 index 0000000..48674b2 --- /dev/null +++ b/mips64el/mips64el.conf @@ -0,0 +1,12 @@ +## Arquitecture specific commands + +## Run a command for PKGBUILD modifications before building +## Like adding 'mips64el' to arch if it's not there +HOOKPKGBUILDMOD="mipsadd" + +## Run a command for local releasing of packages +# Useful for mass packaging (ie. mips port) +# Must accept the following parameters even if the command won't use them: +# $1 repo name +# $2+ packages +HOOKLOCALRELEASE="mipsrelease" diff --git a/mips64el/mipsrelease b/mips64el/mipsrelease new file mode 100755 index 0000000..dae489c --- /dev/null +++ b/mips64el/mipsrelease @@ -0,0 +1,53 @@ +#!/bin/bash +# Lic: GPLv3+ +# Author: Nicolas Reynolds +# Local release of mips64el packages + clean ABS sync +# Called by HOOKLOCALRELEASE + +# $1 repo +# $2+ packages + +source /etc/makepkg.conf +source /etc/libretools.conf + +usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +repo=$1; shift + +# Get all needed sources +source PKGBUILD +fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) +makepkg --source -f + +msg "Adding packages to [stage3]..." +for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* +done + + +mkdir -p ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null + +pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null + tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-${fullver}${SRCEXT} +popd >/dev/null + +exit $? diff --git a/mipsrelease b/mipsrelease deleted file mode 100755 index dae489c..0000000 --- a/mipsrelease +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Lic: GPLv3+ -# Author: Nicolas Reynolds -# Local release of mips64el packages + clean ABS sync -# Called by HOOKLOCALRELEASE - -# $1 repo -# $2+ packages - -source /etc/makepkg.conf -source /etc/libretools.conf - -usage() { - echo "$0 repo package1 [ package2 ... packageN ]" - echo - echo " release packages locally on ${PKGDEST}/stage3." - echo " and make a clean ABS sync " -} - -## -# usage : get_full_version( $epoch, $pkgver, $pkgrel ) -# return : full version spec, including epoch (if necessary), pkgver, pkgrel -## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} - -repo=$1; shift - -# Get all needed sources -source PKGBUILD -fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) -makepkg --source -f - -msg "Adding packages to [stage3]..." -for name in ${pkgname[@]}; do - msg2 "${name} ${fullver}" - repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* -done - - -mkdir -p ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null - -pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null - tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-${fullver}${SRCEXT} -popd >/dev/null - -exit $? diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index 5ecb5f7..21842ac 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -3,82 +3,96 @@ # Copyright 2010 Joshua Ismael Haase Hernández, Joseph Graham # ---------- GNU General Public License 3 ---------- - -# This file is part of Parabola. - -# Parabola is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# Parabola is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with Parabola. If not, see . -source /etc/libretools.conf -[[ -f $XDG_CONFIG_HOME/libretools/libretools.conf ]] && \ - source $XDG_CONFIG_HOME/libretools/libretools.conf +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. -mkdir -p $XDG_CONFIG_HOME/libretools -pushd $XDG_CONFIG_HOME/libretools/ >/dev/null +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -# This is the exit status. -ev=0 +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see . -# Check if the blacklist variable is empty, and if so error. -[[ ${#BLACKLIST} -eq 0 ]] && { - error "BLACKLIST variable is not set your libretools.conf file" - exit 1 +function in_array { # usage : in_array( $needle, $haystack ) + + [[ $2 ]] || return 1 # Not found + local needle=$1; shift + local item + for item in "$@"; do + [[ ${item#@} = $needle ]] && return 0 # Found + done + return 1 # Not Found } -# Download the blacklist. -msg "Downloading the blacklist of proprietary software packages." -wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || { - [ -e $XDG_CONFIG_HOME/libretools/blacklist.txt ] || { - error "Download failed, exiting" - exit 1 - } - warning "Using local copy of blacklist" + +function get_blacklist { # Download the blacklist. + + msg "Downloading the blacklist of proprietary software packages." + wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || { + [ -e $XDG_CONFIG_HOME/libretools/blacklist.txt ] || { + error "Download failed, exiting" + exit 1 + } + warning "Using local copy of blacklist" } -# Get everything before the `:' in the blacklist (that's the names of the -# packages). -unfree=($(cut -d: -f1 blacklist.txt)) -freerep=($(cut -d: -f2 blacklist.txt)) - -popd >/dev/null - -source /etc/rc.d/functions # We want the `in_array' function. -source ./PKGBUILD - -# The following piece of code will check whether a package is, or depends on; -# any non free package(s). - -# The `pkgname', `depends', `makedepends' arrays have been sourced from -# ./PKGBUILD. -msg "Looking for unfree dependencies" -for item in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ; do -# We cycle through all of the programs in the array (if any), and check if -# they are in the `unfree' array. - if in_array $item ${unfree[@]} ; then -# If the package has a replacement of the same name, skip - if in_array $item ${freerep[@]} ; then - warning "$item is repackaged with the same name." - ev=0 - continue -# if item has a free replacement, use error 16. - elif in_array $item-libre ${freerep[@]} ; then - warning "$item -> $item-libre" - ev=16 - else - ev=15 - msg2 "found $item" +function check_deps { # Check wheter a package depends on non-free + + pushd $XDG_CONFIG_HOME/libretools/ >/dev/null + local unfree=($(cut -d: -f1 blacklist.txt)) # pkgname:free-replacement:comments + local freerep=($(cut -d: -f2 blacklist.txt)) # pkgname:free-replacement:comments + popd >/dev/null + + msg "Looking for unfree dependencies" + for item in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ; do + + if in_array $item ${unfree[@]} ; then + + if in_array $item ${freerep[@]} ; then + warning "$item is repackaged with the same name." + continue + + elif in_array $item-libre ${freerep[@]} ; then + warning "$item -> $item-libre" + continue + else + ev=15 + msg2 "found $item" + fi fi - fi -done + done +} + +source /etc/libretools.conf + +if [ -z $XDG_CONFIG_HOME ]; then # Avoid /libretools dir doesn't exist errors + error "There's no XDG_CONFIG_HOME var set"; exit 1 +elif [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + source $XDG_CONFIG_HOME/libretools/libretools.conf +fi + +if [ -z "${BLACKLIST}" ]; then + error "BLACKLIST variable is not set your libretools.conf file"; exit 1 +fi + +if [ -r PKGBUILD ]; then + source PKGBUILD +else + error "There is no PKGBUILD in dir"; exit 1 +fi + +if [ ! -d "$XDG_CONFIG_HOME/libretools" ]; then + mkdir -p $XDG_CONFIG_HOME/libretools +fi + +get_blacklist + +check_deps exit $ev diff --git a/prfullpkg b/prfullpkg deleted file mode 100755 index 2ec9661..0000000 --- a/prfullpkg +++ /dev/null @@ -1,403 +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 /etc/libretools.d/prtools.conf - -# Avoid /libretools dir doesn't exist errors -if [ -z $XDG_CONFIG_HOME ]; then - error "There's no XDG_CONFIG_HOME var set" - exit 1 -fi -# set ban_file -[ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ - source $XDG_CONFIG_HOME/libretools/libretools.conf -ban_file=$XDG_CONFIG_HOME/libretools/ban - - -##### 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 build_dir : use a fullpkg build_dir and only build." - 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\"" -# echo " -t : build from testing" - echo - exit 1 -} - - -## Build order management ## - -# Removes a package from the buildorder -# $1 package name -# $2 buildorder file -remove_buildorder() { - grep -Evw "${1}" ${2} > ${2}2 - mv -f ${2}2 ${2} -} - -# Guesses the repo name according to the parent dir of the current package -# assuming the form ${ABSROOT}/package/repo/PKGBUILD -guess_repo() { - basename $(pwd) -} - -## -# usage : get_full_version( $epoch, $pkgver, $pkgrel ) -# return : full version spec, including epoch (if necessary), pkgver, pkgrel -## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} - -# Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir -# cleans the build_dir -function cleanup { -# Do nothing OR -# Already cleaned - [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 - -# Only do cleanup on level 0 - msg "Cleaning up..." - [ $level -eq 0 ] && rm -rf $build_dir/* -} - -# 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)} - local pkgbase=${pkgbase:-${pkgname[0]}} - local epoch=${epoch:-0} - local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) - -# If package and correct ${fullver} is built exit - if is_built "${pkgbase}>=${fullver}"; 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}:${pkgbase}" >> "${build_dir}/BUILDORDER" - -# if pkgbuild directory is on build_dir, do not copy and exit - if [ -d "${build_dir}/${pkgbase}" ]; then - exit 0 - else -# Copy dir to build_dir - mkdir ${build_dir}/${pkgbase} - cp -r $(pwd)/* ${build_dir}/${pkgbase} -# Info to eval later - echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" - fi - -# Inform the current package plus a space for every level for indent - msg2 "%${level}s${pkgbase}-${fullver}" - -## Check next levels -# Clean version checking - deps=$(echo "${depends[@]} ${makedepends[@]}" | \ - sed "s/[=<>]\+[^ ]\+//g" | \ - tr ' ' "\n" | \ - sort -u) - - # Increase build level - declare -i next_level=$level+1 - - for _dep in ${deps[@]}; do - if [ -d "${ABSROOT}/${_dep}" ]; then - # search in REPOS array order - for _repo in ${REPOS[@]}; do - if [ -e "${ABSROOT}/${_dep}/${_repo}/PKGBUILD" ]; then - - pushd "${ABSROOT}/${_dep}/${_repo}" > /dev/null - $0 -c -d ${build_dir} -l ${next_level} - [ $? -eq 20 ] && return 20 # probable circular deps - popd > /dev/null - break 1 # found, go to next dep - - fi - done - - else # pkgsplit, needs guess - - for _repo in ${REPOS[@]}; do - if _dir=($(find "$ABSROOT/" -type f \ - -wholename "*/${_repo}/PKGBUILD" -print0 2>/dev/null | \ - "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | \ - grep -w "$_dep" 2>&1)) ; - then - - _dir=$(dirname $(echo $_dir | cut -d: -f1)) - plain "guess for $_dep -> $_dir" - - pushd "$_dir" > /dev/null - $0 -c -d ${build_dir} -l ${next_level} - [ $? -eq 20 ] && return 20 # probable circular dep - popd > /dev/null - break 1 # found, go to next dep - fi - done - fi - 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" - - msg2 "Checking for non free deps" - pkgbuild-check-nonfree || { - if [ $? -eq 15 ]; then # this error means nonfree others means fail. -# log they have nonfree deps and so didn't build - echo "nonfree:$(basename $PWD)" >> $build_dir/log -# take out package from $buildorder - remove_buildorder "$(basename $PWD)" $buildorder -# continue building next package - continue - fi - } - - msg2 "Building $(basename $PWD)" -# this buildcmd is on libretools.conf - $FULLBUILDCMD; r=$? - case $r in -###### Succesfull Build ###### - 0) - plain "The build was succesful." - source .INFO && [ -n $repo ] && { - -# Calls a local release script if it's used - [ -z $HOOKLOCALRELEASE ] || \ - find -name "*.pkg.tar.?z" -print0 | \ - xargs -0 $HOOKLOCALRELEASE $repo - -# Stage for releasing - librestage $repo || { - echo "unstaged:$(basename $PWD)" >> $build_dir/log - } - - msg "Updating pacman db and packages" - sudo pacman -Sy || true - } - - echo "built:$(basename $PWD)" >> $build_dir/log - ;; -###### Failed Build ###### - *) - error "There were errors while trying to build the package." - echo "failed:$(basename $PWD)" >> $build_dir/log - ;; - esac - -# Package was built or failed: take it out of $buildorder - remove_buildorder "${build_packages[0]}" $buildorder || true - -# Set build_packages before next cycle run - build_packages=($(sort -gr $buildorder | cut -d: -f2)) - popd > /dev/null - done - - pkgs=($(grep "nonfree:" $build_dir/log)) && { - error "Those packages contain nonfree deps:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - pkgs=($(grep "built:" $build_dir/log)) && { - msg "Those packages were built and staged:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - pkgs=($(grep "failed:" $build_dir/log)) && { - error "Those packages failed to build:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - pkgs=($(grep "unstaged:" $build_dir/log)) && { - error "Those packages couldn't be staged because of missing reponame:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - popd > /dev/null -} - -# End inmediately but print a useful message -trap_exit() { - - error "$@" - warning "Leftover files left on $build_dir" - - exit 1 -} - -## END FUNCTIONS ## - -## Trap signals -# From makepkg -set -E -trap 'cleanup' 0 -trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT -trap 'trap_exit "Aborted by user! Exiting..."' INT -trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR - -force_build="" -level=0 -noupdate='n' -build_only='n' -check_deps_only='n' -do_cleanup='n' -max_level=21 -OFFLINE=false -while getopts 'ha:b:cCd:l:nm:r:' arg; do - case $arg in - h) usage ;; - a) ABSROOT="$OPTARG" ;; - b) build_only='y' - build_dir="$OPTARG" - [ -z ${build_dir} ] && { - usage - } - [ ! -r ${build_dir}/BUILDORDER ] && { - error "${build_dir}/BUILDORDER doesn't exist." - exit 1 - };; - c) check_deps_only='y' ;; - C) do_cleanup='y';; - 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 - -if [ ${build_only} == 'n' ]; then - -# Check if we are actually on a build directory -# Do this early - - [ ! -r PKGBUILD ] && { - error "This isn't a build directory" - usage - } - - # Add mips64el if missing from arch=() and it isn't an 'any' package - if ! grep mips64el PKGBUILD >/dev/null; then - warning "Adding mips64el arch" - sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" - fi - -fi - -# Only on level 0 -if [ $level -eq 0 ]; then - # if build_dir exist use it, else make a build_dir - build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} - mkdir -p ${build_dir} # in case of -d option - - # 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 || true - } - -# Build only - [ ${build_only} == 'y' ] && { - msg "Build Packages" - _pkg_build - exit 0 - } - - msg "Checking dependencies" -fi - -## if $level = 20 it's highly likely there are circular deps -[ $level -ge $max_level ] && exit 20 - -# Tries to find deps and build order -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} ] && { - -# Use local copy of ban file if it is avaliable and continue. - search=$(cat ${ban_file} | tr "\n" "|") -# Keep track of banned files - egrep -w "$search" ${buildorder} >> ${build_dir}/banned -# Take banned packages out from buildorder - egrep -vw "$search" ${buildorder} > ${buildorder}2 - mv -f ${buildorder}2 ${buildorder} - unset search - } - } - fi -} - -## START Building -msg "Building packages:" - -# Build the package -_pkg_build - -echo -msg2 "Check if your system works fine and librerelease if it does" - -exit 0 diff --git a/prmipsrelease b/prmipsrelease deleted file mode 100755 index 29da6e0..0000000 --- a/prmipsrelease +++ /dev/null @@ -1,100 +0,0 @@ - #!/bin/bash -# Lic: GPLv3+ -# Author: Nicolas Reynolds -# Local release of mips64el packages + clean ABS sync -# Called by HOOKLOCALRELEASE - -# $1 repo -# $2+ packages - - source /etc/makepkg.conf - source /etc/libretools.conf - source /etc/libretools.d/prtools.conf - - usage() { - echo "$0 repo package1 [ package2 ... packageN ]" - echo - echo " release packages locally on ${PKGDEST}/stage3." - echo " and make a clean ABS sync " - } - -## -# usage : get_full_version( $epoch, $pkgver, $pkgrel ) -# return : full version spec, including epoch (if necessary), pkgver, pkgrel -## - get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi - } - - repo=$1; shift - repo-add ${PKGDEST}/stage3.db.tar.gz $@ - -# Get all needed sources - source PKGBUILD - fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) - pkgbase=${pkgbase:-$pkgname[0]} - - msg "Adding packages to [stage3]..." - repo-add $@ - for name in ${pkgname[@]}; do - msg2 "${name} ${fullver}" - repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* - done - -# Copy PKGBUILD and sources - - msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" - dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" - mkdir -p ${dest_dir} >/dev/null - rm -rf ${dest_dir}/* #if package existed already there - -# Set target CARCH as it might be used within the PKGBUILD to select correct sources - eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") - export CARCH - source=($(. "PKGBUILD"; echo ${source[@]})) - cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" - for f in ${source[@]}; do - basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') - if [ -f "$basef" ]; then - cp --remove-destination "$basef" "${dest_dir}" - fi - done - - ( . PKGBUILD - for i in 'changelog' 'install'; do - filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) - for file in $filelist; do - # evaluate any bash variables used - eval file=${file} - if [ -f "$file" ]; then - cp --remove-destination "$file" "${dest_dir}" - fi - done - done - ) -# END add clean abs - -# Commit the changes - - pushd "$dest_dir" >/dev/null - - source "${dest_dir}/PKGBUILD" - epoch=${epoch:-0} - fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) - pkgbase=${pkgbase:-${pkgname[0]}} - - git add "${dest_dir}/." # add using .gitignore - - git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ - msg2 "${pkgbase} ${fullver} ${repo}" - - popd >/dev/null - -# END commit - - exit $? diff --git a/prtools.conf b/prtools.conf deleted file mode 100644 index 5b41216..0000000 --- a/prtools.conf +++ /dev/null @@ -1,4 +0,0 @@ - -# Absroot for libretools-pr -ABSROOT=$WORKDIR/prabs -HOOKLOCALRELEASE="prmipsrelease" \ No newline at end of file diff --git a/prtools/prfullpkg b/prtools/prfullpkg new file mode 100755 index 0000000..e3a022b --- /dev/null +++ b/prtools/prfullpkg @@ -0,0 +1,397 @@ +#!/bin/bash + +source /etc/makepkg.conf +source /etc/abs.conf +source /etc/libretools.conf +source /etc/libretools.d/prtools.conf + +if [ -z $XDG_CONFIG_HOME ]; then # Avoid /libretools dir doesn't exist errors + + error "There's no XDG_CONFIG_HOME var set"; exit 1 + +elif [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + + source $XDG_CONFIG_HOME/libretools/libretools.conf + +fi + + +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 build_dir : use a fullpkg build_dir and only build." + 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\"" + echo + exit 1 + +} + +function remove_buildorder { # Removes a package from the buildorder +# $1 package name +# $2 buildorder file + + grep -Evw "${1}" ${2} > ${2}2 + mv -f ${2}2 ${2} + +} + +function guess_repo { # Get repo name. Asumes ${ABSROOT}/package/repo/PKGBUILD + + basename $(pwd) + +} + +function get_fullver { # return : full version spec, including epoch (if necessary), pkgver, pkgrel + +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) + + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + +} + +function cleanup { # Cleans the build_dir. + + [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 # Do nothing or already cleaned. + + msg "Cleaning up..." + [ $level -eq 0 ] && rm -rf $build_dir/* # Only do cleanup on level 0. + +} + +function find_deps { # Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated. + + source PKGBUILD ## Check this level. + + local repo=${repo:-$(guess_repo)} + local pkgbase=${pkgbase:-${pkgname[0]}} + local epoch=${epoch:-0} + local fullver=$(get_fullver ${epoch} ${pkgver} ${pkgrel}) + + if is_built "${pkgbase}>=${fullver}"; then + exit 0 # pkg is built and updated + fi + + echo "${level}:${pkgbase}" >> "${build_dir}/BUILDORDER" # greater levels are built first + + if [ -d "${build_dir}/${pkgbase}" ]; then # PKGBUILD is already there + + exit 0 + + else # Copy dir to build_dir + + mkdir ${build_dir}/${pkgbase} + cp -r $(pwd)/* ${build_dir}/${pkgbase} + + echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" # to identify repo later + fi + + msg2 "%${level}s${pkgbase}-${fullver}" # current package plus a space for every level + + declare -i next_level=$level+1 ## Check next deps level. + + deps=$(echo "${depends[@]} ${makedepends[@]}" | \ + sed "s/[=<>]\+[^ ]\+//g" | \ + tr ' ' "\n" | \ + sort -u) # All deps in separate line, only once, without version. + + for _dep in ${deps[@]}; do + + local found=false + + if [ -d "${ABSROOT}/${_dep}" ]; then # ABSROOT/package/repo + + for _repo in ${REPOS[@]}; do # Use PKGBUILD from repo in REPOS array order + + if [ -e "${ABSROOT}/${_dep}/${_repo}/PKGBUILD" ]; then + + pushd "${ABSROOT}/${_dep}/${_repo}" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} # run this cmd on dep's PKGBUILD dir + [ $? -eq 20 ] && return 20 # probable circular deps + popd > /dev/null + local found=true + break 1 # found, go to next dep + fi + + done + + else # pkgsplit, needs guess + + for _repo in ${REPOS[@]}; do + + if _dir=($(find "$ABSROOT/" -type f \ + -wholename "*/${_repo}/PKGBUILD" -print0 2>/dev/null | \ + "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | \ + grep -w "$_dep" 2>&1)) ; + + then + + _dir=$(dirname $(echo $_dir | cut -d: -f1)) + plain "guess for $_dep -> $_dir" + + pushd "$_dir" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} # run this cmd on dep's PKGBUILD dir + [ $? -eq 20 ] && return 20 # probable circular dep + popd > /dev/null + local found=true + break 1 # found, go to next dep + fi + + done + + fi + + if ( ${found} ); then + continue 1 # go to next dep + else + echo "dep_not_found:$_dep" >> $build_dir/log + fi + + 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 __build () { + pushd ${build_dir} > /dev/null + + build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first + + while [ ${#build_packages[@]} -ge 1 ]; do + pushd $build_dir/${build_packages[0]} > /dev/null + source PKGBUILD + + msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" + + msg2 "Checking for non free deps" + pkgbuild-check-nonfree || { + if [ $? -eq 15 ]; then # this error means nonfree others means fail. + + echo "nonfree:$(basename $PWD)" >> $build_dir/log + + remove_buildorder "$(basename $PWD)" $buildorder # take out package from $buildorder + + continue # build next package + fi + } + + msg2 "Building $(basename $PWD)" + + $FULLBUILDCMD; r=$? # this buildcmd is on libretools.conf + + case $r in + + 0) ## Succesfull build + + plain "The build was succesful." + if source .INFO && [ -n $repo ]; then + + if [ ! -z $HOOKLOCALRELEASE ]; then # Calls a local release script if it's used + find -name "*.pkg.tar.?z" -print0 | xargs -0 $HOOKLOCALRELEASE $repo + fi + + librestage $repo || echo "unstaged:$(basename $PWD)" >> $build_dir/log + + msg "Updating pacman db and packages" + sudo pacman -Sy || true + + fi + + echo "built:$(basename $PWD)" >> $build_dir/log + ;; + + *) ## Build failed + error "There were errors while trying to build the package." + echo "failed:$(basename $PWD)" >> $build_dir/log + ;; + esac + + remove_buildorder "${build_packages[0]}" $buildorder || true + + build_packages=($(sort -gr $buildorder | cut -d: -f2)) # which is next package? + popd > /dev/null + done + + pkgs=($(grep "nonfree:" $build_dir/log)) && { + error "Those packages contain nonfree deps:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "built:" $build_dir/log)) && { + msg "Those packages were built and staged:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "failed:" $build_dir/log)) && { + error "Those packages failed to build:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "unstaged:" $build_dir/log)) && { + error "Those packages couldn't be staged because of missing reponame:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + popd > /dev/null +} + +function trap_exit { # End inmediately but print a useful message + + error "$@" + warning "Leftover files left on $build_dir" + + exit 1 +} + +# Trap signals from makepkg +set -E +trap 'cleanup' 0 +trap 'trap_exit "(prfullpkg:${level}) TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "(prfullpkg:${level}) Aborted by user! Exiting..."' INT +trap 'trap_exit "(prfullpkg:${level}) An unknown error has occurred. Exiting..."' ERR + +ban_file=$XDG_CONFIG_HOME/libretools/ban +force_build="" +level=0 +noupdate='n' +build_only='n' +check_deps_only='n' +max_level=21 + +while getopts 'ha:b:cd:l:nm:r:' arg; do + case $arg in + h) usage ;; + a) ABSROOT="$OPTARG" ;; + b) build_only='y' + build_dir="$OPTARG" + if [ -z ${build_dir} ]; then + usage + fi + if [ ! -r ${build_dir}/BUILDORDER ] ; then + error "${build_dir}/BUILDORDER doesn't exist." + exit 1 + fi;; + c) check_deps_only='y' ;; + d) build_dir="$OPTARG" ;; + l) level=$OPTARG ;; # hidden option to know dep level. + n) noupdate='y';; + m) max_level=$OPTARG ;; + r) FULLBUILDCMD="$OPTARG" ;; + esac +done + +if [ ${build_only} == 'n' ]; then + + [ ! -r PKGBUILD ] && { # Check if we are actually on a build directory. Do this early. + error "This isn't a build directory" + usage + } + + if [ ! -z "$HOOKPKGBUILDMOD" ]; then + "$HOOKPKGBUILDMOD" + fi + +fi + +if [ $level -eq 0 ]; then + + build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} # use -d option or else mktemp + + if [ ! -d ${build_dir} ]; then # in case of custom -d option + mkdir -p ${build_dir} + else + cleanup # files already there can screw find_deps + fi + + touch ${build_dir}/{log,BUILDORDER} ${ban_file} # make files for log and buildorder + buildorder=${build_dir}/BUILDORDER + + if [ ${noupdate} = 'n' ]; then + + msg "Updating pacman db and packages" + sudo pacman -Syu --noconfirm || true + + fi + + if [ ${build_only} == 'y' ]; then + + msg "Build Packages" + + __build + + exit 0 + + fi + + msg "Checking dependencies" +fi + +[ $level -ge $max_level ] && exit 20 # Probable circular deps + +find_deps || { + + if [ $? -eq 20 ]; then # Probable circular deps + + if [ $level -eq 0 ]; then # Show error only on level 0 + error "Check for circular deps on $build_dir/BUILDORDER"; + fi + + fi + exit 20 # Pass message 20 +} + +[ $check_deps_only = 'y' -o $level -gt 0 ] && exit 0 # only build on level 0 + +if [ $level -eq 0 -a -d $build_dir ]; then # Sanity check + + if [ ! -w $ban_file -o ! -r $ban_file ]; then # Check ban_file permisions + + chmod a+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} ] && { # use local copy if it exist + + search=$(cat ${ban_file} | tr "\n" "|") + + egrep -w "$search" ${buildorder} >> ${build_dir}/banned # Keep track of banned files + + egrep -vw "$search" ${buildorder} > ${buildorder}2 # Take banned packages out of buildorder + + mv -f ${buildorder}2 ${buildorder} + + unset search + } + } + fi +fi + +msg "Building packages:" + +__build # Build the packages + +echo +msg2 "Check if your system works fine and librerelease if it does" + +exit 0 diff --git a/prtools/prmipsrelease b/prtools/prmipsrelease new file mode 100755 index 0000000..1fbd696 --- /dev/null +++ b/prtools/prmipsrelease @@ -0,0 +1,98 @@ +#!/bin/bash +# Lic: GPLv3+ +# Author: Nicolas Reynolds +# Local release of mips64el packages + clean ABS sync +# Called by HOOKLOCALRELEASE + +# $1 repo +# $2+ packages + + source /etc/makepkg.conf + source /etc/libretools.conf + source /etc/libretools.d/prtools.conf + + usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " + } + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } + + repo=$1; shift + repo-add "${PKGDEST}/stage3.db.tar.gz" $@ + +# Get all needed sources + source PKGBUILD + fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-$pkgname} + + msg "Adding packages to [stage3]..." + repo-add $@ + for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* + done + +# Copy PKGBUILD and sources + + msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" + dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" + mkdir -p ${dest_dir} >/dev/null + rm -rf ${dest_dir}/* # if package existed already there + + eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") # CARCH might be used in PKGBUILD to select sources. + export CARCH + source=($(. "PKGBUILD"; echo ${source[@]})) + cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" + for f in ${source[@]}; do + basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') + if [ -f "$basef" ]; then + cp --remove-destination "$basef" "${dest_dir}" + fi + done + + ( . PKGBUILD + for i in 'changelog' 'install'; do + filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [ -f "$file" ]; then + cp --remove-destination "$file" "${dest_dir}" + fi + done + done + ) +# END add clean abs + +# Commit the changes + + pushd "$dest_dir" >/dev/null + + source "${dest_dir}/PKGBUILD" + epoch=${epoch:-0} + fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-${pkgname[0]}} + + git add "${dest_dir}/." # add using .gitignore + + git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && msg2 "${pkgbase} ${fullver} ${repo}" + + popd >/dev/null + +# END commit + + exit $? diff --git a/prtools/prtools.conf b/prtools/prtools.conf new file mode 100644 index 0000000..5b41216 --- /dev/null +++ b/prtools/prtools.conf @@ -0,0 +1,4 @@ + +# Absroot for libretools-pr +ABSROOT=$WORKDIR/prabs +HOOKLOCALRELEASE="prmipsrelease" \ No newline at end of file diff --git a/prtools/prtoru b/prtools/prtoru new file mode 100644 index 0000000..2898b66 --- /dev/null +++ b/prtools/prtoru @@ -0,0 +1,173 @@ +#!/bin/bash +# Queries the ABS +# License: GPL3 + +## TODO +# * Add license text +# * Create symlinks from pkgbase to pkgname[@] for easy package finding +# * Use lastsync to store processed packages + +## GOALS +# * Have a searchable database of PKGBUILD metadata +# * Have an interface for source-only builds +# * Possibility to hook up ABS dirs besides ABSROOT (low priority) +# * Tell updates and non available binary packages (working on this) + +source /etc/abs.conf +source /etc/libretools.conf +source /etc/libretools.d/prtools.conf + +# Stores the lastsync date +lastsync() { + [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { + error "The sync date can't be saved. ${lastsyncfile} isn't writable." + return 1 + } + + date +%s > "$lastsyncfile" + touch "$lastsyncfile" +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +# Outputs an ordered package-fullpkgver array +print_package_array() { + echo "$@" | tr " " "\n" | sort -V -u +} + + +# Gets repo.db contents +# $1 repo +get_db_contents() { + [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 + + bsdtar -tf /var/lib/pacman/sync/$1.db | \ + cut -d'/' -f1 | \ + sort -V -u +} + + +extract_pkgname() { + echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" +} + +extract_fullpkgver() { + echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" +} + + +# Updates the database by finding all PKGBUILDS +# Workflow: +# * Find all PKGBUILDs on the ABS repo specified +# * Get all packages already on package repos +# * Compare them +# Args: +update() { +# The PKGBUILDs found + local pkgbuilds=() +# The list of pkgname-fullpkgver + local packages_to_sync=() + local packages_in_sync=() + local needed_updates=() + local old_versions=() + +# Find all the PKGBUILDs newer than the last update +# Update newer, otherwise everything + if [ $force ] || [ ! -e ${lastsyncfile} ]; then + $quiet || msg "Forcing upgrade" + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) + else + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) + fi + +# Inform how many PKGBUILDS were found and quit immediately if none + $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" + [ ${#pkgbuilds[*]} -eq 1 ] && { + $quiet || msg2 "There's nothing to be done. Phew!" + exit 0 + } + + for _pkgbuild in ${pkgbuilds[@]}; do + +# The repo name is guessed +# You *must* use repo/pkgbase structure + _pkgpath=$(dirname "${_pkgbuild}") + _pkgbase=$(basename "${_pkgpath}") + _pkgrepo=$(basename $(dirname "${_pkgpath}")) + + source ${_pkgbuild} + + for _pkg in ${pkgname[@]}; do +# Fill the list of packages to find + packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) + done + + unset pkgbase pkgname pkgver pkgrel source epoch + done + +# Get repo database contents + packages_in_sync=($(get_db_contents ${_pkgrepo})) + print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync + print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync + +# We've orderer the files! + needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + + $quiet || msg "This packages are available to update" + for _update in ${needed_updates[@]}; do + pkg=$(extract_pkgname $_update) + + $quiet && echo $pkg + $quiet || { + ver=$(extract_fullpkgver $_update) + oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) + + msg2 "$pkg $oldver => $ver" + } + + done + +# lastsync + +} + +## MAIN +commands=() +repos=() +quiet=false +force=false +while getopts 'hqfu' arg; do + case $arg in + h) usage; exit 0 ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + esac + + shift $((OPTIND-1)) +done + +# This is the syncfile, stores the last date as content and mtime +lastsyncfile=${ABSROOT}/toru.lastsync + +TMPDIR=$(mktemp -d) + +[[ -z ${TMPDIR} ]] && exit 1 + +${commands[0]} ${@} + +rm -rf ${TMPDIR} + +exit $? diff --git a/rePKGBUILD.proto b/rePKGBUILD.proto index ef3f037..c8b19bf 100644 --- a/rePKGBUILD.proto +++ b/rePKGBUILD.proto @@ -6,10 +6,11 @@ # Maintainer: Your Name source PKGBUILD unset build package md5sums source -_repo= # Put the repo here +_repo= # Put the repo here +_mirror=http://mirrors.kernel.org/archlinux # Put mirror here source=(PKGBUILD - http://mirrors.kernel.org/archlinux/${_repo}/os/${CARCH}/${pkgname%-libre}-$pkgver-$pkgrel-$CARCH$PKGEXT - # files for pkg modifications + "${_mirror}/${_repo}/os/${CARCH}/${pkgname%-libre}-$pkgver-$pkgrel-$CARCH$PKGEXT" + # files for pkg modifications below this line ) build() { diff --git a/toru b/toru index e211878..94cd220 100755 --- a/toru +++ b/toru @@ -1,4 +1,4 @@ - #!/bin/bash +#!/bin/bash # Queries the ABS # License: GPL3 @@ -16,12 +16,6 @@ source /etc/abs.conf source /etc/libretools.conf -#[ ! -w / ] && { -# error "This script must be run as root." -# exit 1 -#} - - # Stores the lastsync date lastsync() { [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { @@ -46,7 +40,7 @@ fi } -# Outputs an ordered package-fullpkgver array +# Outputs an ordered package-fullpkgver array print_package_array() { echo "$@" | tr " " "\n" | sort -V -u } -- cgit v1.2.2