mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
56 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
760c1c6c5f | ||
![]() |
f9aa28f895 | ||
![]() |
30aab9b936 | ||
![]() |
d8d0c87614 | ||
![]() |
4bc819a20e | ||
![]() |
d837403780 | ||
![]() |
568e21f1ac | ||
![]() |
b7c19c56b8 | ||
![]() |
7fa8af659c | ||
![]() |
032febfac4 | ||
![]() |
b5955a0d59 | ||
![]() |
47e7a3706b | ||
![]() |
a3f1558b28 | ||
![]() |
7c97db47cb | ||
![]() |
2ba39720a0 | ||
![]() |
04e79e71fd | ||
![]() |
360fcd2f0e | ||
![]() |
e03dfc4665 | ||
![]() |
5dbb964d66 | ||
![]() |
1401d57115 | ||
![]() |
2269e5c9c8 | ||
![]() |
fef3f4af90 | ||
![]() |
49947d8fb3 | ||
![]() |
ea73c2b08b | ||
![]() |
8deaebf69f | ||
![]() |
bcb0e39a0b | ||
![]() |
70794e8dec | ||
![]() |
f7c44611fe | ||
![]() |
b3b1cfba42 | ||
![]() |
486375ba0a | ||
![]() |
3a78a87739 | ||
![]() |
d4dbb527dc | ||
![]() |
bf48e3ad8f | ||
![]() |
9ec1e72e65 | ||
![]() |
97f7e2f2c3 | ||
![]() |
f6f7a52f4b | ||
![]() |
ca99683972 | ||
![]() |
1d1eef1959 | ||
![]() |
623acfaa9e | ||
![]() |
dd45bbcaf3 | ||
![]() |
c67729af98 | ||
![]() |
9dd60741bd | ||
![]() |
1b178621a5 | ||
![]() |
aa39a8a11f | ||
![]() |
d40455cabd | ||
![]() |
a80fe69f4b | ||
![]() |
80d0aa8912 | ||
![]() |
0dec86c4c3 | ||
![]() |
182c12ec4a | ||
![]() |
4c56be5601 | ||
![]() |
17ecb862f2 | ||
![]() |
6805bc54f4 | ||
![]() |
b54ddd2cf4 | ||
![]() |
0b36e8ecb3 | ||
![]() |
f71a0fabb7 | ||
![]() |
718a6d802d |
14
Makefile
14
Makefile
@@ -1,13 +1,14 @@
|
||||
all:
|
||||
|
||||
install:
|
||||
# extrapkg/checkpkg and friends
|
||||
# commitpkg/checkpkg and friends
|
||||
mkdir -p $(DESTDIR)/usr/bin
|
||||
install -m 755 checkpkg $(DESTDIR)/usr/bin
|
||||
install -m 755 extrapkg $(DESTDIR)/usr/bin
|
||||
ln -sf extrapkg $(DESTDIR)/usr/bin/corepkg
|
||||
ln -sf extrapkg $(DESTDIR)/usr/bin/testingpkg
|
||||
ln -sf extrapkg $(DESTDIR)/usr/bin/unstablepkg
|
||||
install -m 755 commitpkg $(DESTDIR)/usr/bin
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/extrapkg
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/corepkg
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/testingpkg
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/communitypkg
|
||||
# arch{co,release,rm}
|
||||
install -m 755 archco $(DESTDIR)/usr/bin
|
||||
install -m 755 archrelease $(DESTDIR)/usr/bin
|
||||
@@ -23,10 +24,11 @@ install:
|
||||
uninstall:
|
||||
# remove all files we installed
|
||||
rm $(DESTDIR)/usr/bin/checkpkg
|
||||
rm $(DESTDIR)/usr/bin/commitpkg
|
||||
rm $(DESTDIR)/usr/bin/extrapkg
|
||||
rm $(DESTDIR)/usr/bin/corepkg
|
||||
rm $(DESTDIR)/usr/bin/testingpkg
|
||||
rm $(DESTDIR)/usr/bin/unstablepkg
|
||||
rm $(DESTDIR)/usr/bin/communitypkg
|
||||
rm $(DESTDIR)/usr/sbin/mkarchroot
|
||||
rm $(DESTDIR)/usr/sbin/makechrootpkg
|
||||
rm $(DESTDIR)/usr/bin/lddd
|
||||
|
2
archco
2
archco
@@ -6,5 +6,5 @@ if [ "$1" = "" ]; then
|
||||
fi
|
||||
|
||||
for i in "$@"; do
|
||||
svn co svn+ssh://svn.archlinux.org/home/svn-packages/$i
|
||||
svn co svn+ssh://gerolde.archlinux.org/srv/svn-packages/$i
|
||||
done
|
||||
|
19
archrelease
19
archrelease
@@ -5,8 +5,19 @@ if [ "$1" = "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "PKGBUILD" ]; then
|
||||
echo "archrelease: PKGBUILD not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(basename $(readlink -f .))" != "trunk" ]; then
|
||||
echo "archrelease: Not in a package trunk dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d ../repos/$1 ]; then
|
||||
pushd ..
|
||||
[ -d repos ] || mkdir repos
|
||||
svn copy -r HEAD trunk repos/$1
|
||||
svn commit -m "archrelease: new repo $1"
|
||||
pushd repos/$1
|
||||
@@ -20,6 +31,14 @@ else
|
||||
pushd ..
|
||||
if [ -f trunk/svnmerge-commit-message.txt ]; then
|
||||
svn commit -F trunk/svnmerge-commit-message.txt
|
||||
if [ $? -ne 0 ]; then
|
||||
# The user is going to have to clean things up a bit
|
||||
echo "*** ATTENTION: There was a problem merging the package changes ***"
|
||||
echo "To fix it, edit the conflicting files in repos/$1 (the ones that are C in svn status)."
|
||||
echo "Once you have resolved conflicts, execute 'svn resolved <path to file>' to tell svn the error was resolved."
|
||||
echo "Then to finish the merge commit, execute 'svn commit -F trunk/svnmerge-commit-message.txt' and, if there are no problems, delete trunk/svnmerge-commit-message.txt"
|
||||
exit $?
|
||||
fi
|
||||
rm trunk/svnmerge-commit-message.txt
|
||||
else
|
||||
echo "Nothing to commit"
|
||||
|
10
checkpkg
10
checkpkg
@@ -24,8 +24,8 @@ fi
|
||||
|
||||
source PKGBUILD
|
||||
|
||||
pkgfile=${pkgname}-${pkgver}-${pkgrel}-${CARCH}.pkg.tar.gz
|
||||
oldstylepkgfile=${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz
|
||||
pkgfile=${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
|
||||
oldstylepkgfile=${pkgname}-${pkgver}-${pkgrel}${PKGEXT}
|
||||
|
||||
if [ -f "$(pwd)/$pkgfile" ]; then
|
||||
pkgfile=$(pwd)/$pkgfile
|
||||
@@ -64,8 +64,8 @@ if [ ! -f $oldpkg ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
tar tzf $oldpkg > filelist-old
|
||||
tar tzf "$pkgfile" > filelist
|
||||
bsdtar tf $oldpkg > filelist-old
|
||||
bsdtar tf "$pkgfile" > filelist
|
||||
|
||||
sort -o filelist filelist
|
||||
sort -o filelist-old filelist-old
|
||||
@@ -75,7 +75,7 @@ diff filelist-old filelist
|
||||
if diff filelist-old filelist | grep '\.so\.' > /dev/null 2>&1; then
|
||||
mkdir -p pkg
|
||||
cd pkg
|
||||
tar xzf "$pkgfile" > /dev/null
|
||||
bsdtar xf "$pkgfile" > /dev/null
|
||||
for i in `diff ../filelist-old ../filelist | grep \> | grep \.so\. | awk '{print $2}'`; do
|
||||
echo -n "${i}: "
|
||||
objdump -p $i | grep SONAME
|
||||
|
119
commitpkg
Executable file
119
commitpkg
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source makepkg.conf; fail if it is not found
|
||||
if [ -r "/etc/makepkg.conf" ]; then
|
||||
source "/etc/makepkg.conf"
|
||||
else
|
||||
echo "/etc/makepkg.conf not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source user-specific makepkg.conf overrides
|
||||
if [ -r ~/.makepkg.conf ]; then
|
||||
source ~/.makepkg.conf
|
||||
fi
|
||||
|
||||
cmd=$(basename $0)
|
||||
|
||||
if [ ! -f PKGBUILD ]; then
|
||||
echo "No PKGBUILD file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CARCH" ]; then
|
||||
echo "CARCH must be set to a recognized value!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source PKGBUILD
|
||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
||||
|
||||
for _pkgname in ${pkgname[@]}; do
|
||||
pkgfile=${_pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
|
||||
anypkgfile=${_pkgname}-${pkgver}-${pkgrel}-any${PKGEXT}
|
||||
|
||||
if [ ! -f $pkgfile ]; then
|
||||
if [ -f $PKGDEST/$pkgfile ]; then
|
||||
pkgfile=$PKGDEST/$pkgfile
|
||||
elif [ -f $anypkgfile ]; then
|
||||
pkgfile=$anypkgfile
|
||||
CARCH=any
|
||||
elif [ -f $PKGDEST/$anypkgfile ]; then
|
||||
pkgfile=$PKGDEST/$anypkgfile
|
||||
CARCH=any
|
||||
else
|
||||
echo "File $pkgfile doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up repo-specific opts depending on how we were called
|
||||
server="gerolde.archlinux.org"
|
||||
if [ "$cmd" == "extrapkg" ]; then
|
||||
repo="extra"
|
||||
elif [ "$cmd" == "corepkg" ]; then
|
||||
repo="core"
|
||||
elif [ "$cmd" == "testingpkg" ]; then
|
||||
repo="testing"
|
||||
elif [ "$cmd" == "communitypkg" ]; then
|
||||
repo="community"
|
||||
server="aur.archlinux.org"
|
||||
else
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "usage: commitpkg <reponame> [-l limit] [commit message]"
|
||||
exit 1
|
||||
fi
|
||||
repo="$1"
|
||||
shift
|
||||
fi
|
||||
|
||||
# see if any limit options were passed, we'll send them to SCP
|
||||
unset scpopts
|
||||
if [ "$1" = "-l" ]; then
|
||||
scpopts="$1 $2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
# combine what we know into a variable
|
||||
uploadto="staging/${repo}/$(basename ${pkgfile})"
|
||||
scp ${scpopts} "${pkgfile}" "${server}:${uploadto}"
|
||||
if [ "$(md5sum "${pkgfile}" | cut -d' ' -f1)" != "$(ssh ${server} md5sum "${uploadto}" | cut -d' ' -f1)" ]; then
|
||||
echo "File got corrupted during upload, cancelled."
|
||||
exit 1
|
||||
else
|
||||
echo "File integrity okay."
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Uploaded $pkgfile"
|
||||
done
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
svn commit -m "upgpkg: $pkgbase $pkgver-$pkgrel
|
||||
$1" > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Commited with \"upgpkg: $pkgbase $pkgver-$pkgrel
|
||||
$1\" message"
|
||||
else
|
||||
svn commit >/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Commited with \"upgpkg: $pkgbase $pkgver-$pkgrel\" message"
|
||||
fi
|
||||
|
||||
archrelease $repo-$CARCH
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Tagged for $repo-$CARCH"
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
33
commitpkg2any
Executable file
33
commitpkg2any
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# This script commits an existing package as an 'any'
|
||||
# package. It is simply to help aid in the conversion
|
||||
# to any-based packages
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Syntax: $(basename $0) <repo>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo=$1
|
||||
|
||||
source PKGBUILD
|
||||
|
||||
sed -i 's|^arch=.\+$|arch=(any)|' PKGBUILD
|
||||
|
||||
svn commit -m "upgpkg: $pkgname $pkgver-$pkgrel
|
||||
Converted to arch=any" > /dev/null
|
||||
|
||||
archrelease $repo-any
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Tagged for $repo-any"
|
||||
|
||||
pushd ..
|
||||
svn rm $repo-i686
|
||||
svn rm $repo-x86_64
|
||||
svn commit -m "removed $repo-i686 and $repo-x86_64 for $pkgname"
|
||||
popd
|
||||
|
||||
echo "Don't forget to run \"/arch/db-update $repo\" on gerolde"
|
10
communityco
Executable file
10
communityco
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Usage: communityco <package name> [<package name>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in "$@"; do
|
||||
svn co svn+ssh://aur.archlinux.org/srv/svn-packages/$i
|
||||
done
|
123
extrapkg
123
extrapkg
@@ -1,123 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source makepkg.conf; fail if it is not found
|
||||
if [ -r "/etc/makepkg.conf" ]; then
|
||||
source "/etc/makepkg.conf"
|
||||
else
|
||||
echo "/etc/makepkg.conf not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source user-specific makepkg.conf overrides
|
||||
if [ -r ~/.makepkg.conf ]; then
|
||||
source ~/.makepkg.conf
|
||||
fi
|
||||
|
||||
cmd=`basename $0`
|
||||
|
||||
if [ ! -f PKGBUILD ]; then
|
||||
echo "No PKGBUILD file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# define staging areas based on architecture
|
||||
if [ "$CARCH" = "i686" ]; then
|
||||
suffix=''
|
||||
elif [ "$CARCH" = "x86_64" ]; then
|
||||
suffix='64'
|
||||
else
|
||||
echo "CARCH must be set to a recognized value!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source PKGBUILD
|
||||
pkgfile=${pkgname}-${pkgver}-${pkgrel}-${CARCH}.pkg.tar.gz
|
||||
oldstylepkgfile=${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz
|
||||
|
||||
if [ ! -f $pkgfile ]; then
|
||||
if [ -f $PKGDEST/$pkgfile ]; then
|
||||
pkgfile=$PKGDEST/$pkgfile
|
||||
oldstylepkgfile=$PKGDEST/$oldstylepkgfile
|
||||
elif [ -f $oldstylepkgfile ]; then
|
||||
pkgfile=$oldstylepkgfile
|
||||
elif [ -f $PKGDEST/$oldstylepkgfile ]; then
|
||||
pkgfile=$PKGDEST/$oldstylepkgfile
|
||||
else
|
||||
echo "File $pkgfile doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$cmd" == "extrapkg" ]; then
|
||||
repo="extra"
|
||||
elif [ "$cmd" == "corepkg" ]; then
|
||||
repo="core"
|
||||
elif [ "$cmd" == "testingpkg" ]; then
|
||||
repo="testing"
|
||||
elif [ "$cmd" == "unstablepkg" ]; then
|
||||
repo="unstable"
|
||||
elif [ "$cmd" == "communitypkg" ]; then
|
||||
repo="community"
|
||||
fi
|
||||
|
||||
# see if any limit options were passed, we'll send them to SCP
|
||||
unset scpopts
|
||||
if [ "$1" = "-l" ]; then
|
||||
scpopts="$1 $2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
if [ "$repo" != "community" ]; then
|
||||
# combine what we know into a variable (suffix defined based on $CARCH)
|
||||
uploadto="staging/${repo}${suffix}/add/$(basename ${pkgfile})"
|
||||
scp ${scpopts} "${pkgfile}" "archlinux.org:${uploadto}"
|
||||
if [ "$(md5sum "${pkgfile}" | cut -d' ' -f1)" != "$(ssh archlinux.org md5sum "${uploadto}" | cut -d' ' -f1)" ]; then
|
||||
echo "File got corrupted during upload, cancelled."
|
||||
exit 1
|
||||
else
|
||||
echo "File integrity okay."
|
||||
fi
|
||||
else
|
||||
if [ ! -f ~/.tupkg ]; then
|
||||
echo "Must configure tupkg via ~/.tupkg, cancelled"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(basename $pkgfile)" != "$(basename $oldstylepkgfile)" ]; then
|
||||
echo "Renaming makepkg3 package for compatability"
|
||||
mv $pkgfile $oldstylepkgfile
|
||||
pkgfile=$oldstylepkgfile
|
||||
fi
|
||||
tupkg $pkgfile
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Uploaded $pkgfile"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
svn commit -m "upgpkg: $pkgname $pkgver-$pkgrel
|
||||
$1" > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Commited with \"upgpkg: $pkgname $pkgver-$pkgrel
|
||||
$1\" message"
|
||||
else
|
||||
svn commit -m "upgpkg: $pkgname $pkgver-$pkgrel" > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Commited with \"upgpkg: $pkgname $pkgver-$pkgrel\" message"
|
||||
fi
|
||||
|
||||
archrelease $repo-$CARCH
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Tagged for $repo-$CARCH"
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
189
makechrootpkg
189
makechrootpkg
@@ -12,44 +12,58 @@ FORCE="n"
|
||||
RUN=""
|
||||
MAKEPKG_ARGS="-sr"
|
||||
REPACK=""
|
||||
LAYER="rw"
|
||||
WORKDIR=$PWD
|
||||
clean_first="0"
|
||||
|
||||
chrootdir="$CHROOT_SHELL"
|
||||
update_first="0"
|
||||
clean_first="0"
|
||||
install_pkg=""
|
||||
add_to_db=0
|
||||
|
||||
chrootdir=""
|
||||
|
||||
APPNAME=$(basename "${0}")
|
||||
|
||||
usage ()
|
||||
{
|
||||
echo "usage ${APPNAME} [-h] [-c] [-r CHROOT_SHELL] [--] [makepkg args]"
|
||||
echo "usage ${APPNAME} [options] -r <chrootdir> [--] [makepkg args]"
|
||||
echo " Run this script in a PKGBUILD dir to build a package inside a"
|
||||
echo " clean chroot. All unrecognized arguments passed to this script"
|
||||
echo " will be passed to makepkg."
|
||||
echo ""
|
||||
echo "The \$CHROOT_SHELL environment variable is used to determine where"
|
||||
echo " your chroot shell is. The shell consists of the following"
|
||||
echo " directories: \$CHROOT_SHELL/{root, rw, union} but only 'root' is"
|
||||
echo " required by default. The rest will be created as needed"
|
||||
echo " The chroot dir consists of the following directories:"
|
||||
echo " <chrootdir>/{root, rw, union} but only 'root' is required"
|
||||
echo " by default. The rest will be created as needed"
|
||||
echo ""
|
||||
echo "The -c flag, if specified, will remove all files created by previous"
|
||||
echo "builds using makechrootpkg. This will ensure a clean chroot is used."
|
||||
echo ""
|
||||
echo "The chroot shell 'root' directory must be created via the following"
|
||||
echo "The chroot 'root' directory must be created via the following"
|
||||
echo "command:"
|
||||
echo " mkarchroot \$CHROOT_SHELL/root base base-devel sudo"
|
||||
echo ""
|
||||
echo "If you have problems passing params to makepkg or need to pass long"
|
||||
echo "options, put -- between the makechrootpkg args and the makepkg args"
|
||||
echo " mkarchroot <chrootdir>/root base base-devel sudo"
|
||||
echo ""
|
||||
echo "Default makepkg args: $MAKEPKG_ARGS"
|
||||
echo ""
|
||||
echo "Flags:"
|
||||
echo "-h This help"
|
||||
echo "-c Clean the chroot before building"
|
||||
echo "-u Update the rw layer of the chroot before building"
|
||||
echo " This is useful for rebuilds without dirtying the pristine"
|
||||
echo " chroot"
|
||||
echo "-d Add the package to a local db at /repo after building"
|
||||
echo "-r <dir> The chroot shell to use"
|
||||
echo "-I <pkg> Install a package into the rw layer of the chroot"
|
||||
echo "-l <layer> The directory to use as the rw layer of the union"
|
||||
echo " Useful for maintain multiple layers. Default: rw"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts ':r:h:c' arg; do
|
||||
while getopts 'hcudr:I:l:' arg; do
|
||||
case "${arg}" in
|
||||
r) chrootdir="$OPTARG" ;;
|
||||
h) usage ;;
|
||||
c) clean_first=1 ;;
|
||||
h|?) usage ;;
|
||||
u) update_first=1 ;;
|
||||
d) add_to_db=1 ;;
|
||||
r) chrootdir="$OPTARG" ;;
|
||||
I) install_pkg="$OPTARG" ;;
|
||||
l) LAYER="$OPTARG" ;;
|
||||
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
||||
esac
|
||||
done
|
||||
@@ -80,18 +94,18 @@ fi
|
||||
source PKGBUILD
|
||||
|
||||
if [ ! -d "$chrootdir" ]; then
|
||||
echo "No \$CHROOT_SHELL defined, or invalid path ($chrootdir)"
|
||||
echo "No chroot dir defined, or invalid path '$chrootdir'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$chrootdir/root" ]; then
|
||||
echo "Missing \$CHROOT_SHELL root directory."
|
||||
echo "Try using: mkarchroot \$CHROOT_SHELL base base-devel sudo"
|
||||
echo "Missing chroot dir root directory."
|
||||
echo "Try using: mkarchroot $chrootdir/root base base-devel sudo"
|
||||
usage
|
||||
fi
|
||||
|
||||
[ -d "$chrootdir/rw" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/rw/"
|
||||
[ -d "$chrootdir/rw" ] || mkdir "$chrootdir/rw"
|
||||
[ -d "$chrootdir/$LAYER" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/$LAYER/"
|
||||
[ -d "$chrootdir/$LAYER" ] || mkdir "$chrootdir/$LAYER"
|
||||
[ -d "$chrootdir/union" ] || mkdir "$chrootdir/union"
|
||||
|
||||
cleanup ()
|
||||
@@ -104,16 +118,32 @@ cleanup ()
|
||||
|
||||
uniondir="$chrootdir/union"
|
||||
echo "building union chroot"
|
||||
grep -Fq unionfs /proc/filesystems
|
||||
grep -Fq aufs /proc/filesystems
|
||||
if [ $? -ne 0 ]; then
|
||||
modprobe -q unionfs
|
||||
modprobe -q aufs
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: No unionfs available. Abandon ship!" && exit 1
|
||||
echo "ERROR: No aufs available. Abandon ship!" && exit 1
|
||||
fi
|
||||
fi
|
||||
mount -t unionfs none -o "dirs=$chrootdir/rw=rw:$chrootdir/root=ro" "$uniondir"
|
||||
mount -t aufs none -o "dirs=$chrootdir/$LAYER=rw:$chrootdir/root=ro" "$uniondir"
|
||||
trap 'cleanup' 0 1 2 15
|
||||
|
||||
if [ -n "$install_pkg" ]; then
|
||||
pkgname="$(basename "$install_pkg")"
|
||||
echo "installing '$pkgname' in chroot"
|
||||
cp "$install_pkg" "$uniondir/$pkgname"
|
||||
mkarchroot -r "pacman -U /$pkgname" "$uniondir"
|
||||
ret=$?
|
||||
rm "$uniondir/$pkgname"
|
||||
#exit early, we've done all we need to
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
if [ $update_first -eq 1 ]; then
|
||||
echo "updating chroot"
|
||||
mkarchroot -r "pacman -Syu --noconfirm" "$uniondir"
|
||||
fi
|
||||
|
||||
echo "moving build files to chroot"
|
||||
[ -d "$uniondir/build" ] || mkdir "$uniondir/build"
|
||||
|
||||
@@ -122,30 +152,15 @@ if [ "$REPACK" != "1" ]; then
|
||||
rm -rf "$uniondir/build/"*
|
||||
fi
|
||||
|
||||
# Copy makepkg.conf and ~/.makepkg.conf into the chroot so packager has
|
||||
# all their custom variables set.
|
||||
if [ -r "/etc/makepkg.conf" ]; then
|
||||
rm $uniondir/etc/makepkg.conf
|
||||
cp /etc/makepkg.conf $uniondir/etc/makepkg.conf
|
||||
fi
|
||||
if [ -r ~/.makepkg.conf ]; then
|
||||
cat ~/.makepkg.conf >> $uniondir/etc/makepkg.conf
|
||||
fi
|
||||
|
||||
source $uniondir/etc/makepkg.conf
|
||||
|
||||
# Magic trickery with PKGDEST and SRCDEST, so that the built
|
||||
# files end up where they're expected in the _real_ filesystem
|
||||
[ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest"
|
||||
[ -d "$uniondir/pkgdest" ] || mkdir "$uniondir/pkgdest"
|
||||
[ ! -z "$PKGDEST" ] && mount --bind "$PKGDEST" "$uniondir/pkgdest"
|
||||
[ ! -z "$SRCDEST" ] && mount --bind "$SRCDEST" "$uniondir/srcdest"
|
||||
|
||||
if ! grep "PKGDEST=/pkgdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then
|
||||
echo "Setting PKGDEST in makepkg.conf"
|
||||
echo "PKGDEST=/pkgdest" >> "$uniondir/etc/makepkg.conf"
|
||||
fi
|
||||
|
||||
[ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest"
|
||||
if ! grep "SRCDEST=/srcdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then
|
||||
echo "Setting SRCDEST in makepkg.conf"
|
||||
echo "SRCDEST=/srcdest" >> "$uniondir/etc/makepkg.conf"
|
||||
@@ -159,17 +174,36 @@ chown -R nobody "$uniondir/pkgdest"
|
||||
source PKGBUILD
|
||||
cp PKGBUILD "$uniondir/build/"
|
||||
for f in ${source[@]}; do
|
||||
basef=$(basename $f)
|
||||
basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g')
|
||||
if [ -f "$basef" ]; then
|
||||
cp "$basef" "$uniondir/srcdest/"
|
||||
elif [ -f "$SRCDEST/$basef" ]; then
|
||||
cp "$SRCDEST/$basef" "$uniondir/srcdest/"
|
||||
fi
|
||||
done
|
||||
if [ "$install" != "" -a -f "$install" ]; then
|
||||
cp "$install" "$uniondir/build/"
|
||||
|
||||
install_files=$(grep "install=" PKGBUILD)
|
||||
for pkg in ${pkgname[@]}; do
|
||||
install_files+=' '
|
||||
install_files+=$(echo $install_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/")
|
||||
done
|
||||
|
||||
install_files=$(eval echo $install_files |tr '[:blank:]' '\n'|sort |uniq)
|
||||
|
||||
for f in $install_files;do
|
||||
install="${f#"install="}"
|
||||
if [ "$install" != "" -a -f "$install" ]; then
|
||||
cp "$install" "$uniondir/build/"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f "ChangeLog" ]; then
|
||||
cp ChangeLog "$uniondir/build/"
|
||||
fi
|
||||
|
||||
if ! grep "^nobody" "$uniondir/etc/sudoers" >/dev/null 2>&1; then
|
||||
echo "allowing 'nobody' sudo rights in the chroot"
|
||||
touch "$uniondir/etc/sudoers"
|
||||
echo "nobody ALL=(ALL) NOPASSWD: ALL" >> "$uniondir/etc/sudoers"
|
||||
chmod 440 "$uniondir/etc/sudoers"
|
||||
fi
|
||||
@@ -182,27 +216,58 @@ export LANG=$LOCALE
|
||||
cd /build
|
||||
export HOME=/build
|
||||
sudo -u nobody makepkg $MAKEPKG_ARGS || touch BUILD_FAILED
|
||||
[ -f BUILD_FAILED ] && exit 1
|
||||
which namcap &>/dev/null && namcap /build/PKGBUILD /pkgdest/*${PKGEXT} > /pkgdest/namcap.log
|
||||
exit 0
|
||||
EOF
|
||||
) > "$uniondir/chrootbuild"
|
||||
chmod +x "$uniondir/chrootbuild"
|
||||
|
||||
mkarchroot -r "/chrootbuild" "$uniondir"
|
||||
|
||||
if [ -e ${chrootdir}/rw/build/BUILD_FAILED ]; then
|
||||
echo "Build failed, check \$CHROOT_DIR/rw/build"
|
||||
rm ${chrootdir}/rw/build/BUILD_FAILED
|
||||
exit 1
|
||||
else
|
||||
if mkarchroot -r "/chrootbuild" "$uniondir"; then
|
||||
source ${WORKDIR}/PKGBUILD
|
||||
if [ -z "$(mount | grep ${chrootdir}/union/pkgdest)" ]; then
|
||||
echo "Moving completed package file to ${WORKDIR}"
|
||||
mv ${chrootdir}/union/pkgdest/${pkgname}-${pkgver}-${pkgrel}-*.pkg.tar.gz ${WORKDIR}
|
||||
fi
|
||||
if [ -z "$(mount | grep ${chrootdir}/union/srcdest)" ]; then
|
||||
echo "Moving downloaded source files to ${WORKDIR}"
|
||||
mv ${chrootdir}/union/srcdest/* ${WORKDIR}
|
||||
fi
|
||||
rm -rf ${chrootdir}/rw/build/*
|
||||
|
||||
for _pkgname in ${pkgname[@]}; do
|
||||
pkgfile="${chrootdir}"/union/pkgdest/${_pkgname}-*${PKGEXT}
|
||||
|
||||
if [ -n "$add_to_db" -a -e "$pkgfile" ]; then
|
||||
[ -d "${chrootdir}/union/repo" ] || mkdir -p "${chrootdir}/union/repo"
|
||||
pushd "${chrootdir}/union/repo" >/dev/null
|
||||
cp "$pkgfile" .
|
||||
repo-add repo.db.tar.${DB_COMPRESSION} ${_pkgname}-${pkgver}-${pkgrel}-*${PKGEXT}
|
||||
popd >/dev/null
|
||||
fi
|
||||
|
||||
if [ -e $pkgfile ]; then
|
||||
if [ -n "$PKGDEST" ]; then
|
||||
echo "Moving completed ${_pkgname} package file to ${PKGDEST}"
|
||||
mv $pkgfile "${PKGDEST}"
|
||||
else
|
||||
echo "Moving completed ${_pkgname} package file to ${WORKDIR}"
|
||||
mv $pkgfile "${WORKDIR}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for f in ${chrootdir}/union/srcdest/*; do
|
||||
[ -e "$f" ] || continue
|
||||
if [ -n "$SRCDEST" ]; then
|
||||
echo "Moving downloaded source file $(basename $f) to ${SRCDEST}"
|
||||
mv "$f" "${SRCDEST}"
|
||||
else
|
||||
echo "Moving downloaded source file $(basename $f) to ${WORKDIR}"
|
||||
mv "$f" "${WORKDIR}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
#just in case. We returned 1, make sure we fail
|
||||
touch ${chrootdir}/union/build/BUILD_FAILED
|
||||
fi
|
||||
|
||||
if [ -e ${chrootdir}/union/build/BUILD_FAILED ]; then
|
||||
echo "Build failed, check $chrootdir/$LAYER/build"
|
||||
rm ${chrootdir}/union/build/BUILD_FAILED
|
||||
else
|
||||
rm -rf ${chrootdir}/union/build/*
|
||||
echo "Build complete"
|
||||
fi
|
||||
|
||||
|
15
mkarchroot
15
mkarchroot
@@ -10,6 +10,7 @@
|
||||
|
||||
FORCE="n"
|
||||
RUN=""
|
||||
NOCOPY="n"
|
||||
|
||||
working_dir=""
|
||||
|
||||
@@ -25,6 +26,7 @@ usage ()
|
||||
echo " -f Force overwrite of files in the working-dir"
|
||||
echo " -C <file> location of a pacman config file"
|
||||
echo " -M <file> location of a makepkg config file"
|
||||
echo " -n do not copy config files into the chroot"
|
||||
echo " -h This message"
|
||||
exit $1
|
||||
}
|
||||
@@ -36,6 +38,7 @@ while getopts 'r:ufhC:M:' arg; do
|
||||
f) FORCE="y" ;;
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
M) makepkg_conf="$OPTARG" ;;
|
||||
n) NOCOPY="y" ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -161,19 +164,21 @@ else
|
||||
ldconfig -r "${working_dir}"
|
||||
fi
|
||||
|
||||
if [ "$pac_conf" != "" ]; then
|
||||
if [ "$pac_conf" != "" -a "$NOCOPY" = "n" ]; then
|
||||
echo "installing custom pacman.conf"
|
||||
cp ${pac_conf} ${working_dir}/etc/pacman.conf
|
||||
fi
|
||||
|
||||
if [ "$makepkg_conf" != "" ]; then
|
||||
if [ "$makepkg_conf" != "" -a "$NOCOPY" = "n" ]; then
|
||||
echo "installing custom makepkg.conf"
|
||||
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
|
||||
fi
|
||||
|
||||
echo "generating default locales"
|
||||
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
|
||||
chroot "${working_dir}" locale-gen
|
||||
if [ -e "${working_dir}/etc/locale.gen" ]; then
|
||||
echo "generating default locales from host system"
|
||||
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
|
||||
chroot "${working_dir}" locale-gen
|
||||
fi
|
||||
|
||||
if [ ! -e "${working_dir}/.arch-chroot" ]; then
|
||||
date +%s > "${working_dir}/.arch-chroot"
|
||||
|
101
rebuildpkgs
Executable file
101
rebuildpkgs
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
# This script rebuilds a list of packages in order
|
||||
# and reports anything that fails
|
||||
#
|
||||
# Due to sudo usage, it is recommended to allow makechrootpkg
|
||||
# to be run with NOPASSWD in your sudoers file
|
||||
#
|
||||
# FIXME
|
||||
# Currently uses $(pwd)/rebuilds as the directory for rebuilding...
|
||||
# TODO make this work for community too
|
||||
|
||||
if [ $# -le 1 ]; then
|
||||
echo "usage: $(basename $0) <chrootdir> <packages to rebuild>"
|
||||
echo " example: $(basename $0) ~/chroot readline bash foo bar baz"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source makepkg.conf; fail if it is not found
|
||||
if [ -r "/etc/makepkg.conf" ]; then
|
||||
source "/etc/makepkg.conf"
|
||||
else
|
||||
echo "/etc/makepkg.conf not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
die () {
|
||||
echo $@ >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
bump_pkgrel () {
|
||||
# Get the current pkgrel from SVN and update the working copy with it
|
||||
# This prevents us from incrementing out of control :)
|
||||
pbuild=".svn/text-base/PKGBUILD.svn-base"
|
||||
oldrel=$(grep "pkgrel=" $pbuild | cut -d= -f2)
|
||||
|
||||
#remove decimals
|
||||
rel=$(echo $oldrel | cut -d. -f1)
|
||||
|
||||
newrel=$(($rel + 1))
|
||||
|
||||
sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD
|
||||
}
|
||||
|
||||
pkg_from_pkgbuild () {
|
||||
# we want the sourcing to be done in a subshell so we don't pollute our current namespace
|
||||
export CARCH PKGEXT
|
||||
(. PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
|
||||
}
|
||||
|
||||
chrootdir="$1"; shift
|
||||
pkgs="$@"
|
||||
|
||||
SVNPATH="svn+ssh://gerolde.archlinux.org/srv/svn-packages"
|
||||
|
||||
echo ":: Work will be done in $(pwd)/rebuilds"
|
||||
|
||||
REBUILD_ROOT="$(pwd)/rebuilds"
|
||||
mkdir -p "$REBUILD_ROOT"
|
||||
cd "$REBUILD_ROOT"
|
||||
|
||||
/usr/bin/svn co -N $SVNPATH
|
||||
|
||||
FAILED=""
|
||||
for pkg in $pkgs; do
|
||||
cd "$REBUILD_ROOT/svn-packages"
|
||||
|
||||
echo ":: Building '$pkg'"
|
||||
/usr/bin/svn update "$pkg"
|
||||
if [ ! -d "$pkg/trunk" ]; then
|
||||
FAILED="$FAILED $pkg"
|
||||
echo ":: $pkg does not exist in SVN"
|
||||
continue
|
||||
fi
|
||||
cd "$pkg/trunk/"
|
||||
|
||||
bump_pkgrel
|
||||
|
||||
if ! sudo makechrootpkg -u -d -r "$chrootdir" -- --noconfirm; then
|
||||
FAILED="$FAILED $pkg"
|
||||
echo ":: $pkg Failed!"
|
||||
else
|
||||
pkgfile=$(pkg_from_pkgbuild)
|
||||
if [ -e "$pkgfile" ]; then
|
||||
echo ":: $pkg Complete"
|
||||
else
|
||||
FAILED="$FAILED $pkg"
|
||||
echo ":: $pkg Failed, no package built!"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd "$REBUILD_ROOT"
|
||||
if [ "$FAILED" != "" ]; then
|
||||
echo "Packages failed:"
|
||||
for pkg in $FAILED; do
|
||||
echo -e "\t$pkg"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "SVN pkgbumps in svn-packages/ - commit when ready"
|
Reference in New Issue
Block a user