The first (and longest) in the seriese of patches. This patch cleans up the
spacing and indentation in the dbscripts to make them more readable and
make merging the rest of the changes made possible. This patchset merges
Aaron's dbscripts working branch with the main master branch.
case "${DBEXT}" in
- *.gz) TAR_OPT="z" ;;
- *.bz2) TAR_OPT="j" ;;
- *.xz) TAR_OPT="J" ;;
- *) echo "Unknown compression type for DBEXT=${DBEXT}" && exit 1 ;;
+ *.gz) TAR_OPT="z" ;;
+ *.bz2) TAR_OPT="j" ;;
+ *.xz) TAR_OPT="J" ;;
+ *) echo "Unknown compression type for DBEXT=${DBEXT}" && exit 1 ;;
esac
FILESEXT="${DBEXT//db/files}"
for repo in $repos; do
- REPO_DB_FILE="${repo}$DBEXT"
- FILES_DB_FILE="${repo}$FILESEXT"
- for arch in ${ARCHES[@]}; do
-# echo "Running for architecture $arch, repo $repo"
- cd "$reposdir"
+ REPO_DB_FILE="${repo}$DBEXT"
+ FILES_DB_FILE="${repo}$FILESEXT"
+ for arch in ${ARCHES[@]}; do
+# echo "Running for architecture $arch, repo $repo"
+ cd "$reposdir"
if [ -f "$LOCKFILE" ]; then
@@ -40,53 +40,55 @@ FAILED_PKGS=""
echo "Errors occured during run:" > "$srcbase/errors.txt"
for repo in $repos; do
- for arch in ${ARCHES[@]} any; do
- ftppath="$ftpbase/$repo/os/$arch"
- if [ ! -d "$ftppath" ]; then
- echo "FTP path does not exist: $ftppath" >2
- continue
- fi
- cd $ftppath
- for pkg in *$PKGEXT; do
- [ -f "$pkg" ] || continue
- pkgbase=$(getpkgbase $pkg)
- srcpath="$srcbase/"
- srcpkg="${pkg//$PKGEXT/$SRCEXT}"
- srcpkg="${srcpkg//-$arch/}"
- srcpkgname="${srcpkg%-*-*$SRCEXT}"
- srcpkgbase="${srcpkg/$srcpkgname/$pkgbase}"
-
- #Don't do anything for package in this 'blacklist'
- if grep "^$pkgbase$" "$dirname/sourceballs.skip" >/dev/null 2>&1; then
- continue
- fi
-
- #This pkgbase has already failed. No sense in trying it again this run
- if echo $FAILED_PKGS | grep "<$pkgbase>" >&/dev/null; then
- continue
- fi
-
- #Use this file to 'whitelist' or force building some sourceballs,
- # skipping the license check
- force=""
- if grep "^$pkgbase$" "$dirname/sourceballs.force" >/dev/null 2>&1; then
- force="-f"
- fi
-
- if [ ! ( -f "$srcpath$srcpkg" -o -f "$srcpath$srcpkgbase" ) ]; then
- if ! $dirname/../misc-scripts/make-sourceball $force
- $pkgbase $repo $arch 2>>"$srcbase/errors.txt"; then
- FAILED_PKGS="$FAILED_PKGS $pkgbase"
- fi
- fi
- done
- done
+ for arch in ${ARCHES[@]} any; do
+ ftppath="$ftpbase/$repo/os/$arch"
+ if [ ! -d "$ftppath" ]; then
+ echo "FTP path does not exist: $ftppath" >2
+ continue
+ fi
+ cd $ftppath
+ for pkg in *$PKGEXT; do
+ [ -f "$pkg" ] || continue
+ pkgbase=$(getpkgbase $pkg)
+ srcpath="$srcbase/"
+ srcpkg="${pkg//$PKGEXT/$SRCEXT}"
+ srcpkg="${srcpkg//-$arch/}"
+ srcpkgname="${srcpkg%-*-*$SRCEXT}"
+ srcpkgbase="${srcpkg/$srcpkgname/$pkgbase}"
+
+ #Don't do anything for package in this 'blacklist'
+ if grep "^$pkgbase$" "$dirname/sourceballs.skip" >/dev/null 2>&1; then
+ continue
+ fi
+
+ #This pkgbase has already failed. No sense in trying it again this run
+ if echo $FAILED_PKGS | grep "<$pkgbase>" >&/dev/null; then
+ continue
+ fi
+
+ #Use this file to 'whitelist' or force building some sourceballs,
+ # skipping the license check
+ force=""
+ if grep "^$pkgbase$" "$dirname/sourceballs.force" >/dev/null 2>&1; then
+ force="-f"
+ fi
+
+ if [ ! ( -f "$srcpath$srcpkg" -o -f "$srcpath$srcpkgbase" ) ]; then
+ if ! $dirname/../misc-scripts/make-sourceball $force
+ $pkgbase $repo $arch 2>>"$srcbase/errors.txt"; then
+ FAILED_PKGS="$FAILED_PKGS $pkgbase"
+ fi
+ fi
+ done
+ done
done
if [ -n "$FAILED_PKGS" ]; then
- [ -e "$srcbase/failed.txt" ] && /bin/mv "$srcbase/failed.txt" "$srcbase/failed.txt.old"
- echo "The following package bases failed:" > "$srcbase/failed.txt"
- echo -e $FAILED_PKGS | sed "s| |
|g" | sort -u >> "$srcbase/failed.txt"
+ [ -e "$srcbase/failed.txt" ] && /bin/mv "$srcbase/failed.txt" "$srcbase/failed.txt.old"
+ echo "The following package bases failed:" > "$srcbase/failed.txt"
+ echo -e $FAILED_PKGS | sed "s| |
|g" | sort -u >> "$srcbase/failed.txt"
fi
if [ $# -eq 2 ]; then
- _lockblock=true
- _trial=0
+ _lockblock=true
+ _trial=0
elif [ $# -eq 3 ]; then
- _lockblock=false
- _timeout=$3
- let _trial=$_timeout/$LOCK_DELAY
+ _lockblock=false
+ _timeout=$3
+ let _trial=$_timeout/$LOCK_DELAY
fi
_count=0
while [ $_count -le $_trial ] || $_lockblock ; do
- if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
- _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
- echo "error: Repo $1-$2 is already locked by $_owner. Retrying in $LOCK_DELAY seconds..." >&2
- else
- set_umask
- break
- fi
- sleep $LOCK_DELAY
- let _count=$_count+1
+ if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
+ _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
+ echo "error: Repo $1-$2 is already locked by $_owner. Retrying in $LOCK_DELAY seconds..." >&2
+ else
+ set_umask
+ break
+ fi
+ sleep $LOCK_DELAY
+ let _count=$_count+1
done
}
@@ -156,18 +156,18 @@ get_repos_for_host() {
#usage: chk_license ${license[@]}"
chk_license() {
- local l
- for l in "$@"; do
- l="$(echo $l | tr '[:upper:]' '[:lower:]')"
- for allowed in ${ALLOWED_LICENSES[@]}; do
- allowed="$(echo $allowed | tr '[:upper:]' '[:lower:]')"
- if [ "$l" = "$allowed" ]; then
- return 0
- fi
- done
- done
-
- return 1
+ local l
+ for l in "$@"; do
+ l="$(echo $l | tr '[:upper:]' '[:lower:]')"
+ for allowed in ${ALLOWED_LICENSES[@]}; do
+ allowed="$(echo $allowed | tr '[:upper:]' '[:lower:]')"
+ if [ "$l" = "$allowed" ]; then
+ return 0
+ fi
+ done
+ done
+
+ return 1
}
/usr/bin/svn up -q $packagebase
if [ -d "$packagebase/repos/$svnrepo_from" ]; then
- . "$packagebase/repos/$svnrepo_from/$BUILDSCRIPT"
-
- for i in ${pkgname[@]}; do
- _pkgfile="$i-$pkgver-$pkgrel-$_arch$PKGEXT"
- getpkgfile "$ftppath_from/${_arch}/"$_pkgfile >/dev/null
- done
-
- if [ -d "$packagebase/repos/$svnrepo_to" ]; then
- echo " Removing existing package from subversion"
- /usr/bin/svn rm --force -q "$packagebase/repos/$svnrepo_to"
- /usr/bin/svn commit -q -m "$(basename $0): $packagebase removed by $(id -un) for move to $repoto"
- fi
-
- echo " Moving svn entries"
- /usr/bin/svn mv -r HEAD "$packagebase/repos/$svnrepo_from" "$packagebase/repos/$svnrepo_to"
- /usr/bin/svn commit -m "$(basename $0): moved $packagebase from [$repofrom] to [$repoto] ($_arch)"
-
- echo " Moving package file and updating DBs"
- cd "$WORKDIR"
- [ -d build/ ] || mkdir build
- cd build/
+ . "$packagebase/repos/$svnrepo_from/$BUILDSCRIPT"
+
+ for i in ${pkgname[@]}; do
+ _pkgfile="$i-$pkgver-$pkgrel-$_arch$PKGEXT"
+ getpkgfile "$ftppath_from/${_arch}/"$_pkgfile >/dev/null
+ done
+
+ if [ -d "$packagebase/repos/$svnrepo_to" ]; then
+ echo " Removing existing package from subversion"
+ /usr/bin/svn rm --force -q "$packagebase/repos/$svnrepo_to"
+ /usr/bin/svn commit -q -m "$(basename $0): $packagebase removed by $(id -un) for move to $repoto"
+ fi
+
+ echo " Moving svn entries"
+ /usr/bin/svn mv -r HEAD "$packagebase/repos/$svnrepo_from" "$packagebase/repos/$svnrepo_to"
+ /usr/bin/svn commit -m "$(basename $0): moved $packagebase from [$repofrom] to [$repoto] ($_arch)"
+
+ echo " Moving package file and updating DBs"
+ cd "$WORKDIR"
+ [ -d build/ ] || mkdir build
+ cd build/
if [ "${_arch}" == "any" ]; then
arches="i686 x86_64"
@@ -83,18 +83,18 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
arches="${_arch}"
fi
- for architecture in $arches; do
+ for architecture in $arches; do
# copy the db file into our working area
if [ -f "$ftppath_from/$architecture/$repofrom$DBEXT" ]; then
- /bin/cp "$ftppath_from/$architecture/$repofrom$DBEXT" .
- /usr/bin/repo-remove -q "$repofrom$DBEXT" ${pkgname[@]} || die "Error in repo-remove"
- #use '*' to move the old DB too
- mv $repofrom$DBEXT* "$ftppath_from/$architecture"
- echo " Package files will be cleaned up automatically"
+ /bin/cp "$ftppath_from/$architecture/$repofrom$DBEXT" .
+ /usr/bin/repo-remove -q "$repofrom$DBEXT" ${pkgname[@]} || die "Error in repo-remove"
+ #use '*' to move the old DB too
+ mv $repofrom$DBEXT* "$ftppath_from/$architecture"
+ echo " Package files will be cleaned up automatically"
fi
if [ -f "$ftppath_to/$architecture/$repoto$DBEXT" ]; then
- /bin/cp "$ftppath_to/$architecture/$repoto$DBEXT" .
+ /bin/cp "$ftppath_to/$architecture/$repoto$DBEXT" .
fi
for i in ${pkgname[@]}; do
@@ -106,19 +106,21 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
done
#use '*' to move the old DB too
mv $repoto$DBEXT* $ftppath_to/$architecture
- for i in ${pkgname[@]}; do
- _pkgfile=$(getpkgfile "$i-$pkgver-$pkgrel-$_arch"$PKGEXT)
- [ $? -gt 0 ] && die
- if [ "${_arch}" == "any" ]; then
- mv ${_pkgfile} $ftppath_to/any
- ln -s ../any/${_pkgfile} $ftppath_to/$architecture/
- else
- mv ${_pkgfile} $ftppath_to/$architecture
- fi
- done
+ for i in ${pkgname[@]}; do
+ _pkgfile=$(getpkgfile "$i-$pkgver-$pkgrel-$_arch"$PKGEXT)
+ [ $? -gt 0 ] && die
+ if [ "${_arch}" == "any" ]; then
+ mv ${_pkgfile} $ftppath_to/any
+ ln -s ../any/${_pkgfile} $ftppath_to/$architecture/
+ else
+ mv ${_pkgfile} $ftppath_to/$architecture
+ fi
+ done
done
else
- die "Error: $packagebase is not in repo $repofrom"
+ die "Error: $packagebase is not in repo $repofrom"
fi
- repo_lock $reponame $arch $LOCK_TIMEOUT
-
- TMPDIR=$(mktemp -d /tmp/cleanup-XXXXXX) || exit 1
- ftppath="$ftppath_base/$arch"
- MISSINGFILES=""
- DELETEFILES=""
- DELETESYMLINKS=""
- EXTRAFILES=""
-
- if [ ! -d "$ftppath" ]; then
- echo "FTP path '$ftppath' does not exist"
- exit 1
- fi
-
- if ! cd "${TMPDIR}" ; then
- echo "Failed to cd to ${TMPDIR}"
- exit 1
- fi
-
- if [ ! -f "$ftppath/$reponame$DBEXT" ]; then
- echo ""
- echo "ERROR: The file "$ftppath/$reponame$DBEXT" could not be found, aborting."
- echo ""
- exit 1
- fi
-
- if ! bsdtar xf "$ftppath/$reponame$DBEXT"; then
- echo ""
- echo "ERROR: Command failed: bsdtar xf "$ftppath/$reponame$DBEXT""
- exit 1
- fi
-
- cd "$ftppath"
-
- for pkg in $TMPDIR/*; do
- filename=$(grep -A1 '^%FILENAME%$' "${pkg}/desc" | tail -n1)
-
- if [ ! -e "${filename}" ]; then
- MISSINGFILES="${MISSINGFILES} ${filename}"
- else
- pkgname="$(getpkgname ${filename})"
- for otherfile in ${pkgname}-*; do
- if [ "${otherfile}" != "${filename}" -a "${pkgname}" = "$(getpkgname ${otherfile})" ]; then
- if [ -h "${otherfile}" ]; then
- DELETESYMLINKS="${DELETESYMLINKS} ${otherfile}"
- else
- DELETEFILES="${DELETEFILES} ${otherfile}"
- fi
- fi
- done
- fi
- done
-
- for pkg in *$PKGEXT; do
- if [ ! -e "$pkg" ]; then
- continue
- fi
- pkgname="$(getpkgname $pkg)"
- for p in ${TMPDIR}/${pkgname}-*; do
- [ ! -d "${p}" ] || continue 2
- dbpkgname=$(grep -A1 '^%FILENAME%$' "${p}/desc" 2>/dev/null| tail -n1)
- if [ "${dbpkgname}" = "${pkgname}" ]; then
- continue 2
- fi
- done
- EXTRAFILES="$EXTRAFILES $pkg"
- done
-
- rm -rf ${TMPDIR}
-
- # Do a quick check to see if a missing ARCHINDEPFILE is in the any dir
- # If it is, and the file is MISSING, restore it
- missfiles="$MISSINGFILES"
- MISSINGFILES=""
- for mf in $missfiles; do
- if [ -e "${ftppath_base}/any/${mf}" ]; then
- echo "Restoring missing 'any' symlink: ${mf}"
- ${CLEANUP_DRYRUN} || ln -s "../any/${mf}" "${ftppath}"
- else
- MISSINGFILES="${MISSINGFILES} ${mf}"
- fi
- done
-
- repo_unlock $reponame $arch
-
- #Make sure we've done *something* before outputting anything
- if [ -z "$DELETEFILES$DELETESYMLINKS$MISSINGFILES$EXTRAFIL ES" ]; then
- continue
- fi
-
- echo "Scan complete for $reponame ($arch) at ${ftppath}"
-
- if [ -n "$DELETEFILES" ]; then
- echo " The following files are out of date"
- echo " They will be moved to '$dest'"
- for f in $DELETEFILES; do
- echo " $f"
- done
- echo ""
- fi
-
- if [ -n "$DELETESYMLINKS" ]; then
- echo " The following symlinks are out of date"
- echo " They will be deleted"
- for f in $DELETESYMLINKS; do
- echo " $f"
- done
- echo ""
- fi
-
- if [ -n "$MISSINGFILES" ]; then
- echo " The following files are missing in the repo"
- for f in $MISSINGFILES; do
- echo " $f"
- done
- echo ""
- fi
-
- if [ -n "$EXTRAFILES" ]; then
- echo " The following files are in the repo but not the db"
- echo " They will be moved to '$dest'"
- for f in $EXTRAFILES; do
- echo " $f"
- done
- fi
-
- if [ -n "${DELETEFILES}" ]; then
- ${CLEANUP_DRYRUN} || mv ${DELETEFILES} "$dest"
- echo ""
- fi
-
- if [ -n "${DELETESYMLINKS}" ]; then
- ${CLEANUP_DRYRUN} || rm -f ${DELETESYMLINKS}
- echo ""
- fi
-
- if [ -n "${EXTRAFILES}" ]; then
- ${CLEANUP_DRYRUN} || mv ${EXTRAFILES} "$dest"
- echo ""
- fi
+ repo_lock $reponame $arch $LOCK_TIMEOUT
+
+ TMPDIR=$(mktemp -d /tmp/cleanup-XXXXXX) || exit 1
+ ftppath="$ftppath_base/$arch"
+ MISSINGFILES=""
+ DELETEFILES=""
+ DELETESYMLINKS=""
+ EXTRAFILES=""
+
+ if [ ! -d "$ftppath" ]; then
+ echo "FTP path '$ftppath' does not exist"
+ exit 1
+ fi
+
+ if ! cd "${TMPDIR}" ; then
+ echo "Failed to cd to ${TMPDIR}"
+ exit 1
+ fi
+
+ if [ ! -f "$ftppath/$reponame$DBEXT" ]; then
+ echo ""
+ echo "ERROR: The file "$ftppath/$reponame$DBEXT" could not be found, aborting."
+ echo ""
+ exit 1
+ fi
+
+ if ! bsdtar xf "$ftppath/$reponame$DBEXT"; then
+ echo ""
+ echo "ERROR: Command failed: bsdtar xf "$ftppath/$reponame$DBEXT""
+ exit 1
+ fi
+
+ cd "$ftppath"
+
+ for pkg in $TMPDIR/*; do
+ filename=$(grep -A1 '^%FILENAME%$' "${pkg}/desc" | tail -n1)
+
+ if [ ! -e "${filename}" ]; then
+ MISSINGFILES="${MISSINGFILES} ${filename}"
+ else
+ pkgname="$(getpkgname ${filename})"
+ for otherfile in ${pkgname}-*; do
+ if [ "${otherfile}" != "${filename}" -a "${pkgname}" = "$(getpkgname ${otherfile})" ]; then
+ if [ -h "${otherfile}" ]; then
+ DELETESYMLINKS="${DELETESYMLINKS} ${otherfile}"
+ else
+ DELETEFILES="${DELETEFILES} ${otherfile}"
+ fi
+ fi
+ done
+ fi
+ done
+
+ for pkg in *$PKGEXT; do
+ if [ ! -e "$pkg" ]; then
+ continue
+ fi
+ pkgname="$(getpkgname $pkg)"
+ for p in ${TMPDIR}/${pkgname}-*; do
+ [ ! -d "${p}" ] || continue 2
+ dbpkgname=$(grep -A1 '^%FILENAME%$' "${p}/desc" 2>/dev/null| tail -n1)
+ if [ "${dbpkgname}" = "${pkgname}" ]; then
+ continue 2
+ fi
+ done
+ EXTRAFILES="$EXTRAFILES $pkg"
+ done
+
+ rm -rf ${TMPDIR}
+
+ # Do a quick check to see if a missing ARCHINDEPFILE is in the any dir
+ # If it is, and the file is MISSING, restore it
+ missfiles="$MISSINGFILES"
+ MISSINGFILES=""
+ for mf in $missfiles; do
+ if [ -e "${ftppath_base}/any/${mf}" ]; then
+ echo "Restoring missing 'any' symlink: ${mf}"
+ ${CLEANUP_DRYRUN} || ln -s "../any/${mf}" "${ftppath}"
+ else
+ MISSINGFILES="${MISSINGFILES} ${mf}"
+ fi
+ done
+
+ repo_unlock $reponame $arch
+
+ #Make sure we've done *something* before outputting anything
+ if [ -z "$DELETEFILES$DELETESYMLINKS$MISSINGFILES$EXTRAFIL ES" ]; then
+ continue
+ fi
+
+ echo "Scan complete for $reponame ($arch) at ${ftppath}"
+
+ if [ -n "$DELETEFILES" ]; then
+ echo " The following files are out of date"
+ echo " They will be moved to '$dest'"
+ for f in $DELETEFILES; do
+ echo " $f"
+ done
+ echo ""
+ fi
+
+ if [ -n "$DELETESYMLINKS" ]; then
+ echo " The following symlinks are out of date"
+ echo " They will be deleted"
+ for f in $DELETESYMLINKS; do
+ echo " $f"
+ done
+ echo ""
+ fi
+
+ if [ -n "$MISSINGFILES" ]; then
+ echo " The following files are missing in the repo"
+ for f in $MISSINGFILES; do
+ echo " $f"
+ done
+ echo ""
+ fi
+
+ if [ -n "$EXTRAFILES" ]; then
+ echo " The following files are in the repo but not the db"
+ echo " They will be moved to '$dest'"
+ for f in $EXTRAFILES; do
+ echo " $f"
+ done
+ fi
+
+ if [ -n "${DELETEFILES}" ]; then
+ ${CLEANUP_DRYRUN} || mv ${DELETEFILES} "$dest"
+ echo ""
+ fi
+
+ if [ -n "${DELETESYMLINKS}" ]; then
+ ${CLEANUP_DRYRUN} || rm -f ${DELETESYMLINKS}
+ echo ""
+ fi
+
+ if [ -n "${EXTRAFILES}" ]; then
+ ${CLEANUP_DRYRUN} || mv ${EXTRAFILES} "$dest"
+ echo ""
+ fi
done
ARCHINDEPFILES=""
if [ -d "$ftppath_base/any" ]; then
- cd "$ftppath_base/any"
- for pkg in *$PKGEXT; do
- [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz"
- found=0
- #check for any existing symlinks
- for arch in ${ARCHES[@]}; do
- if [ -h "$ftppath_base/$arch/$pkg" ]; then
- found=1
- break
- fi
- done
- if [ $found -eq 0 ]; then
- # We found no symlinks to this, delete it
- ARCHINDEPFILES="$ARCHINDEPFILES $pkg"
- fi
- done
+ cd "$ftppath_base/any"
+ for pkg in *$PKGEXT; do
+ [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz"
+ found=0
+ #check for any existing symlinks
+ for arch in ${ARCHES[@]}; do
+ if [ -h "$ftppath_base/$arch/$pkg" ]; then
+ found=1
+ break
+ fi
+ done
+ if [ $found -eq 0 ]; then
+ # We found no symlinks to this, delete it
+ ARCHINDEPFILES="$ARCHINDEPFILES $pkg"
+ fi
+ done
fi
if [ -n "$ARCHINDEPFILES" ]; then
- echo " The following architecture independent packages"
- echo " are not symlinked in the architecture repositories."
- echo " They will be moved to '$dest'"
- for f in $ARCHINDEPFILES; do
- echo " $f"
- done
+ echo " The following architecture independent packages"
+ echo " are not symlinked in the architecture repositories."
+ echo " They will be moved to '$dest'"
+ for f in $ARCHINDEPFILES; do
+ echo " $f"
+ done
fi
if [ -d "$ftppath_base/any" -a -n "${ARCHINDEPFILES}" ]; then
- cd "$ftppath_base/any"
- ${CLEANUP_DRYRUN} || mv ${ARCHINDEPFILES} "$dest"
- echo ""
+ cd "$ftppath_base/any"
+ ${CLEANUP_DRYRUN} || mv ${ARCHINDEPFILES} "$dest"
+ echo ""
fi
+
+# vim: set ts=4 sw=4 noet ft=sh:
diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball
index 8899fca..fca6ac4 100755
--- a/misc-scripts/make-sourceball
+++ b/misc-scripts/make-sourceball
@@ -1,9 +1,9 @@
#!/bin/bash
if [ $# -ne 3 -a $# -ne 4 ]; then
- echo "usage: $(basename $0) [-f] <packagename> <repo> <arch>"
- echo " -f Force building. Skip license checks"
- exit 1
+ echo "usage: $(basename $0) [-f] <packagename> <repo> <arch>"
+ echo " -f Force building. Skip license checks"
+ exit 1
fi
. "$(dirname $0)/../db-functions"
@@ -11,8 +11,8 @@ fi
FORCE=0
if [ "$1" = "-f" ]; then
- FORCE=1
- shift
+ FORCE=1
+ shift
fi
pkgname_from_src() {
- local tmp
- tmp=${1##*/}
- tmp=${tmp%$SRCEXT}
- for a in ${ARCHES[@]}; do
- tmp=${tmp%-$a}
- done
- tmp=${tmp%-any}
- echo ${tmp%-*-*}
+ local tmp
+ tmp=${1##*/}
+ tmp=${tmp%$SRCEXT}
+ for a in ${ARCHES[@]}; do
+ tmp=${tmp%-$a}
+ done
+ tmp=${tmp%-any}
+ echo ${tmp%-*-*}
}
pkgver_from_src() {
- tmp=${1##*/}
- tmp=${tmp%$SRCEXT}
- for a in ${ARCHES[@]}; do
- tmp=${tmp%-$a}
- done
- tmp=${tmp%-any}
- echo $tmp | sed 's|.*-(.*-.*)$|1|g'
+ tmp=${1##*/}
+ tmp=${tmp%$SRCEXT}
+ for a in ${ARCHES[@]}; do
+ tmp=${tmp%-$a}
+ done
+ tmp=${tmp%-any}
+ echo $tmp | sed 's|.*-(.*-.*)$|1|g'
}
create_srcpackage() {
- if [ -d "$1" ]; then
- pushd "$1" >/dev/null
- . "$BUILDSCRIPT"
- if ! [ $FORCE == 1 ] && ! chk_license ${license[@]} ; then
- #Removed so as not to clutter failed.txt
- #echo -e " $packagename license (${license[@]}) does not require source tarballs" >&2
- cleanup 0
- else
- echo "Creating source tarball for $packagename-$pkgver-$pkgrel"
- fi
-
- local logfile="$logpath/$packagename"
- if ! /usr/bin/makepkg --allsource --ignorearch >"$logfile" 2>&1; then
- popd >/dev/null
- /bin/gzip -f -9 "$logfile"
- die " Failed to download source for $packagename-$pkgver-$pkgrel ($reponame-$_arch)"
- fi
- /bin/rm -f "$logfile"{,.gz}
-
- local pkg_file="${packagename}-${pkgver}-${pkgrel}${SRCEXT}"
-
- if [ ! -d "$srcpath" ]; then
- mkdir -p "$srcpath"
- fi
- cp "$pkg_file" "$srcpath"
-
- popd >/dev/null
-
- return 0
- fi
+ if [ -d "$1" ]; then
+ pushd "$1" >/dev/null
+ . "$BUILDSCRIPT"
+ if ! [ $FORCE == 1 ] && ! chk_license ${license[@]} ; then
+ #Removed so as not to clutter failed.txt
+ #echo -e " $packagename license (${license[@]}) does not require source tarballs" >&2
+ cleanup 0
+ else
+ echo "Creating source tarball for $packagename-$pkgver-$pkgrel"
+ fi
+
+ local logfile="$logpath/$packagename"
+ if ! /usr/bin/makepkg --allsource --ignorearch >"$logfile" 2>&1; then
+ popd >/dev/null
+ /bin/gzip -f -9 "$logfile"
+ die " Failed to download source for $packagename-$pkgver-$pkgrel ($reponame-$_arch)"
+ fi
+ /bin/rm -f "$logfile"{,.gz}
+
+ local pkg_file="${packagename}-${pkgver}-${pkgrel}${SRCEXT}"
+
+ if [ ! -d "$srcpath" ]; then
+ mkdir -p "$srcpath"
+ fi
+ cp "$pkg_file" "$srcpath"
+
+ popd >/dev/null
+
+ return 0
+ fi
}
remove_old() {
- if [ -d "$1" ]; then
- pushd "$1" >/dev/null
- PKGVERS=""
- for repo in *; do
- cd "$repo"
- . "$BUILDSCRIPT"
- PKGVERS="$PKGVERS $pkgver-$pkgrel"
- cd ..
- done
-
- for srcpkg in "$srcpath/$packagename-"*; do
- [ -f "$srcpkg" ] || continue
- if [ "$(pkgname_from_src $srcpkg)" == "$packagename" ]; then
- skip=0
- pver="$(pkgver_from_src $srcpkg)"
- for v in $PKGVERS; do
- if [ "$v" = "$pver" ]; then
- skip=1
- break
- fi
- done
- if [ $skip -ne 1 ]; then
- mv "$srcpkg" $SOURCE_CLEANUP_DESTDIR
- fi
- fi
- done
-
- popd >/dev/null
- fi
+ if [ -d "$1" ]; then
+ pushd "$1" >/dev/null
+ PKGVERS=""
+ for repo in *; do
+ cd "$repo"
+ . "$BUILDSCRIPT"
+ PKGVERS="$PKGVERS $pkgver-$pkgrel"
+ cd ..
+ done
+
+ for srcpkg in "$srcpath/$packagename-"*; do
+ [ -f "$srcpkg" ] || continue
+ if [ "$(pkgname_from_src $srcpkg)" == "$packagename" ]; then
+ skip=0
+ pver="$(pkgver_from_src $srcpkg)"
+ for v in $PKGVERS; do
+ if [ "$v" = "$pver" ]; then
+ skip=1
+ break
+ fi
+ done
+ if [ $skip -ne 1 ]; then
+ mv "$srcpkg" $SOURCE_CLEANUP_DESTDIR
+ fi
+ fi
+ done
+
+ popd >/dev/null
+ fi
}
trap ctrl_c 2
@@ -135,8 +135,10 @@ set_umask
cd "$WORKDIR"
if /usr/bin/svn export -q "$SVNREPO/$packagename" $packagename; then
- remove_old "$packagename/repos/"
- create_srcpackage "$packagename/repos/$reponame-$_arch"
+ remove_old "$packagename/repos/"
+ create_srcpackage "$packagename/repos/$reponame-$_arch"
else
- die " Package '$packagename' does not exist in repo '$reponame-$_arch'"
+ die " Package '$packagename' does not exist in repo '$reponame-$_arch'"
fi
+
+# vim: set ts=4 sw=4 noet ft=sh:
diff --git a/testing2community b/testing2community
index 557b39d..b8de926 100755
--- a/testing2community
+++ b/testing2community
@@ -1,11 +1,13 @@
#!/bin/bash
trap ctrl_c 2
@@ -33,23 +33,25 @@ cd "${WORKDIR}"
cd checkout
for pkg in $*; do
- moved=0
- /usr/bin/svn up -q ${pkg}
- if [ -f "${pkg}/repos/testing-${_arch}/${BUILDSCRIPT}" ]; then
- for repo in core extra; do
- if [ -f "${pkg}/repos/${repo}-${_arch}/${BUILDSCRIPT}" ]; then
- echo "===> Moving package '${pkg}': testing-${_arch} -> ${repo}-${_arch}"
- $(dirname $0)/db-move "${pkg}" "testing" "${repo}" "${_arch}"
- moved=1
- break
- fi
- done
- if [ ${moved} -eq 0 ]; then
- echo "===> Warning: ${pkg} is only in testing-${_arch}, cannot determine where to move it"
- fi
- else
- echo "===> Warning: ${pkg} is not in testing-${_arch}"
- fi
+ moved=0
+ /usr/bin/svn up -q ${pkg}
+ if [ -f "${pkg}/repos/testing-${_arch}/${BUILDSCRIPT}" ]; then
+ for repo in core extra; do
+ if [ -f "${pkg}/repos/${repo}-${_arch}/${BUILDSCRIPT}" ]; then
+ echo "===> Moving package '${pkg}': testing-${_arch} -> ${repo}-${_arch}"
+ $(dirname $0)/db-move "${pkg}" "testing" "${repo}" "${_arch}"
+ moved=1
+ break
+ fi
+ done
+ if [ ${moved} -eq 0 ]; then
+ echo "===> Warning: ${pkg} is only in testing-${_arch}, cannot determine where to move it"
+ fi
+ else
+ echo "===> Warning: ${pkg} is not in testing-${_arch}"
+ fi
done