mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
65 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
80d0aa8912 | ||
![]() |
0dec86c4c3 | ||
![]() |
182c12ec4a | ||
![]() |
4c56be5601 | ||
![]() |
17ecb862f2 | ||
![]() |
6805bc54f4 | ||
![]() |
b54ddd2cf4 | ||
![]() |
0b36e8ecb3 | ||
![]() |
f71a0fabb7 | ||
![]() |
718a6d802d | ||
![]() |
bd6a5df0ab | ||
![]() |
ba6e6648e9 | ||
![]() |
d01f3d53e8 | ||
![]() |
fd04791f5b | ||
![]() |
38dc2efcd5 | ||
![]() |
a78c8f2cb9 | ||
![]() |
7c3bb0642a | ||
![]() |
8842f31551 | ||
![]() |
e76a1b2def | ||
![]() |
e8490b3f14 | ||
![]() |
ff1fc799c3 | ||
![]() |
0b0a7b3140 | ||
![]() |
e0f139ad0e | ||
![]() |
0410fb0a2f | ||
![]() |
3078cb535c | ||
![]() |
484d36e931 | ||
![]() |
a0ccba5622 | ||
![]() |
a8a3c856bf | ||
![]() |
2c06da35d6 | ||
![]() |
eb7646ca18 | ||
![]() |
97d4a8bbd0 | ||
![]() |
6748570413 | ||
![]() |
d853dee3ed | ||
![]() |
9e627e219e | ||
![]() |
113f51fbc0 | ||
![]() |
fc7f570aad | ||
![]() |
5eb176f471 | ||
![]() |
59d373a62b | ||
![]() |
bc8a791ad6 | ||
![]() |
4a829ff1f7 | ||
![]() |
5472d5ab5a | ||
![]() |
f05495dfc8 | ||
![]() |
c229a696a2 | ||
![]() |
e77986fc08 | ||
![]() |
f7ab112f9a | ||
![]() |
0986936143 | ||
![]() |
e23b176f3e | ||
![]() |
f92e01ed28 | ||
![]() |
ceb84394f9 | ||
![]() |
e71c9784b5 | ||
![]() |
e16136b8e8 | ||
![]() |
9e660ee86e | ||
![]() |
06a0d18bdc | ||
![]() |
84f29cd824 | ||
![]() |
e32a2bb70c | ||
![]() |
974d8d11a6 | ||
![]() |
64ff97a171 | ||
![]() |
39aad4fe59 | ||
![]() |
411c07f2fb | ||
![]() |
1e1e1e481e | ||
![]() |
bced48cecd | ||
![]() |
e782cbd00b | ||
![]() |
3ce2983ad6 | ||
![]() |
b528eba028 | ||
![]() |
7bb2c48c8f |
28
Makefile
28
Makefile
@@ -5,10 +5,32 @@ install:
|
||||
mkdir -p $(DESTDIR)/usr/bin
|
||||
install -m 755 checkpkg $(DESTDIR)/usr/bin
|
||||
install -m 755 extrapkg $(DESTDIR)/usr/bin
|
||||
ln -s extrapkg $(DESTDIR)/usr/bin/corepkg
|
||||
ln -s extrapkg $(DESTDIR)/usr/bin/testingpkg
|
||||
ln -s extrapkg $(DESTDIR)/usr/bin/unstablepkg
|
||||
ln -sf extrapkg $(DESTDIR)/usr/bin/corepkg
|
||||
ln -sf extrapkg $(DESTDIR)/usr/bin/testingpkg
|
||||
ln -sf extrapkg $(DESTDIR)/usr/bin/unstablepkg
|
||||
# arch{co,release,rm}
|
||||
install -m 755 archco $(DESTDIR)/usr/bin
|
||||
install -m 755 archrelease $(DESTDIR)/usr/bin
|
||||
install -m 755 archrm $(DESTDIR)/usr/bin
|
||||
# new chroot tools, only usable by root
|
||||
mkdir -p $(DESTDIR)/usr/sbin
|
||||
install -m 755 mkarchroot $(DESTDIR)/usr/sbin
|
||||
install -m 755 makechrootpkg $(DESTDIR)/usr/sbin
|
||||
#Additional packaging helper scripts
|
||||
install -m 755 lddd $(DESTDIR)/usr/bin
|
||||
install -m 755 finddeps $(DESTDIR)/usr/bin
|
||||
|
||||
uninstall:
|
||||
# remove all files we installed
|
||||
rm $(DESTDIR)/usr/bin/checkpkg
|
||||
rm $(DESTDIR)/usr/bin/extrapkg
|
||||
rm $(DESTDIR)/usr/bin/corepkg
|
||||
rm $(DESTDIR)/usr/bin/testingpkg
|
||||
rm $(DESTDIR)/usr/bin/unstablepkg
|
||||
rm $(DESTDIR)/usr/sbin/mkarchroot
|
||||
rm $(DESTDIR)/usr/sbin/makechrootpkg
|
||||
rm $(DESTDIR)/usr/bin/lddd
|
||||
rm $(DESTDIR)/usr/bin/finddeps
|
||||
rm $(DESTDIR)/usr/bin/archco
|
||||
rm $(DESTDIR)/usr/bin/archrelease
|
||||
rm $(DESTDIR)/usr/bin/archrm
|
||||
|
10
archco
Executable file
10
archco
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Usage: archco <package name> [<package name>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in "$@"; do
|
||||
svn co svn+ssh://svn.archlinux.org/home/svn-packages/$i
|
||||
done
|
48
archrelease
Executable file
48
archrelease
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Usage: archrelease <repo>"
|
||||
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
|
||||
svnmerge init
|
||||
svn commit -F svnmerge-commit-message.txt
|
||||
rm svnmerge-commit-message.txt
|
||||
popd
|
||||
popd
|
||||
else
|
||||
svnmerge merge ../repos/$1
|
||||
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"
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
|
13
archrm
Executable file
13
archrm
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Usage: archrm <path to checkout>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# FIXME: Check if there are uncommited changes
|
||||
#pushd $1
|
||||
#
|
||||
#popd
|
||||
|
||||
rm -rf $1
|
44
checkpkg
44
checkpkg
@@ -1,6 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/makepkg.conf
|
||||
# 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
|
||||
|
||||
strip_url() {
|
||||
echo $1 | sed 's|^.*://.*/||g'
|
||||
@@ -16,18 +27,17 @@ 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
|
||||
if [ -f "$(pwd)/$pkgfile" ]; then
|
||||
pkgfile=$(pwd)/$pkgfile
|
||||
elif [ -f "$PKGDEST/$pkgfile" ]; then
|
||||
pkgfile=$PKGDEST/$pkgfile
|
||||
elif [ -f "$(pwd)/$oldstylepkgfile" ]; then
|
||||
pkgfile=$(pwd)/$oldstylepkgfile
|
||||
elif [ -f "$PKGDEST/$oldstylepkgfile" ]; then
|
||||
pkgfile=$PKGDEST/$oldstylepkgfile
|
||||
else
|
||||
echo "File \"$pkgfile\" doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmp=`pacman -Spd --noconfirm $pkgname`
|
||||
@@ -41,7 +51,7 @@ pkgurl=`echo $tmp | rev | cut -d ' ' -f 1 | rev`
|
||||
|
||||
oldpkg=`strip_url $pkgurl`
|
||||
|
||||
if [ "$oldpkg" = "$pkgfile" ]; then
|
||||
if [ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]; then
|
||||
echo "The built package is the one in the repo right now!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -55,7 +65,7 @@ if [ ! -f $oldpkg ]; then
|
||||
fi
|
||||
|
||||
tar tzf $oldpkg > filelist-old
|
||||
tar tzf $pkgfile > filelist
|
||||
tar tzf "$pkgfile" > filelist
|
||||
|
||||
sort -o filelist filelist
|
||||
sort -o filelist-old filelist-old
|
||||
@@ -65,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
|
||||
tar xzf "$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
|
||||
@@ -73,3 +83,5 @@ if diff filelist-old filelist | grep '\.so\.' > /dev/null 2>&1; then
|
||||
else
|
||||
echo "No filename differences"
|
||||
fi
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
||||
|
141
extrapkg
141
extrapkg
@@ -1,12 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/makepkg.conf
|
||||
# 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
|
||||
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
|
||||
@@ -14,90 +30,89 @@ 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
|
||||
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"
|
||||
tag="CURRENT"
|
||||
repo="extra"
|
||||
elif [ "$cmd" == "corepkg" ]; then
|
||||
repo="core"
|
||||
tag="CURRENT"
|
||||
repo="core"
|
||||
elif [ "$cmd" == "testingpkg" ]; then
|
||||
repo="testing"
|
||||
tag="TESTING"
|
||||
repo="testing"
|
||||
elif [ "$cmd" == "unstablepkg" ]; then
|
||||
repo="unstable"
|
||||
tag="CURRENT"
|
||||
repo="unstable"
|
||||
elif [ "$cmd" == "communitypkg" ]; then
|
||||
repo="community"
|
||||
tag="CURRENT"
|
||||
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
|
||||
scpopts="$1 $2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
if [ "$repo" != "community" ]; then
|
||||
scp ${scpopts} ${pkgfile} archlinux.org:staging/$repo/add
|
||||
if [ "$(md5sum ${pkgfile} | cut -d' ' -f1)" != "$(ssh archlinux.org md5sum staging/${repo}/add/$(basename ${pkgfile}) | cut -d' ' -f1)" ]; then
|
||||
echo "File got corrupted during upload, cancelled."
|
||||
exit 1
|
||||
else
|
||||
echo "File integrity okay."
|
||||
fi
|
||||
# combine what we know into a variable
|
||||
uploadto="staging/${repo}/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
|
||||
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 compatibility"
|
||||
mv $pkgfile $oldstylepkgfile
|
||||
pkgfile=$oldstylepkgfile
|
||||
fi
|
||||
tupkg $pkgfile
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Uploaded $pkgfile"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
cvs 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"
|
||||
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
|
||||
cvs 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"
|
||||
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
|
||||
|
||||
cvs tag -c -F -R $tag > /dev/null
|
||||
archrelease $repo-$CARCH
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
echo "Cancelled"
|
||||
exit 1
|
||||
fi
|
||||
echo "===> Tagged as $tag"
|
||||
echo "===> Tagged for $repo-$CARCH"
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
||||
|
41
finddeps
Executable file
41
finddeps
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# finddeps - find packages that depend on a given depname
|
||||
#
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "usage: finddeps <depname>"
|
||||
echo ""
|
||||
echo "Find packages that depend on a given depname."
|
||||
echo "Run this script from the top-level directory of your ABS tree."
|
||||
echo ""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
match=$1
|
||||
tld=$(pwd)
|
||||
|
||||
for d in $(find . -type d); do
|
||||
cd $d
|
||||
if [ -f PKGBUILD ]; then
|
||||
unset pkgname depends makedepends
|
||||
. PKGBUILD
|
||||
for dep in "${depends[@]}"; do
|
||||
# lose the version comaparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
if [ "$depname" = "$match" ]; then
|
||||
echo "$d (depends)"
|
||||
fi
|
||||
done
|
||||
for dep in "${makedepends[@]}"; do
|
||||
# lose the version comaparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
if [ "$depname" = "$match" ]; then
|
||||
echo "$d (makedepends)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
cd $tld
|
||||
done
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
47
lddd
Executable file
47
lddd
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# lddd - find broken library links on your machine
|
||||
#
|
||||
|
||||
ifs=$IFS
|
||||
IFS=':'
|
||||
|
||||
libdirs="/lib:/usr/lib:/opt/qt/lib:/opt/kde/lib:/usr/lib/libfakeroot:/opt/NX/lib"
|
||||
extras=
|
||||
|
||||
TEMPDIR=$(mktemp /tmp/lddd-script.XXXX)
|
||||
rm $TEMPDIR
|
||||
mkdir -p $TEMPDIR
|
||||
|
||||
echo " Go out and drink some tea, this will take a while :) ..."
|
||||
# Check ELF binaries in the PATH and specified dir trees.
|
||||
for tree in $PATH $libdirs $extras
|
||||
do
|
||||
echo DIR $tree
|
||||
|
||||
# Get list of files in tree.
|
||||
files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! -name '*.rb' ! -name '*.ko' ! -name '*.pc' ! -name '*.enc' ! -name '*.cf' ! -name '*.def' ! -name '*.rules' ! -name '*.cmi' ! -name '*.mli' ! -name '*.ml' ! -name '*.cma' ! -name '*.cmx' ! -name '*.cmxa' ! -name '*.pod' ! -name '*.pm' ! -name '*.pl' ! -name '*.al' ! -name '*.tcl' ! -name '*.bs' ! -name '*.o' ! -name '*.png' ! -name '*.gif' ! -name '*.cmo' ! -name '*.cgi' ! -name '*.defs' ! -name '*.conf' ! -name '*_LOCALE' ! -name 'Compose' ! -name '*_OBJS' ! -name '*.msg' ! -name '*.mcopclass' ! -name '*.mcoptype')
|
||||
IFS=$ifs
|
||||
for i in $files
|
||||
do
|
||||
if [ `file $i | grep -c 'ELF'` -ne 0 ]; then
|
||||
# Is an ELF binary.
|
||||
if [ `ldd $i 2>/dev/null | grep -c 'not found'` -ne 0 ]; then
|
||||
# Missing lib.
|
||||
echo "$i:" >> $TEMPDIR/raw.txt
|
||||
ldd $i 2>/dev/null | grep 'not found' >> $TEMPDIR/raw.txt
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
grep '^/' $TEMPDIR/raw.txt | sed -e 's/://g' >> $TEMPDIR/affected-files.txt
|
||||
# invoke pacman
|
||||
for i in $(cat $TEMPDIR/affected-files.txt); do
|
||||
pacman -Qo $i | awk '{print $4,$5}' >> $TEMPDIR/pacman.txt
|
||||
done
|
||||
# clean list
|
||||
sort -u $TEMPDIR/pacman.txt >> $TEMPDIR/possible-rebuilds.txt
|
||||
|
||||
echo "Files saved to $TEMPDIR"
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
168
makechrootpkg
168
makechrootpkg
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# This program 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; version 2 of the License.
|
||||
@@ -10,26 +10,19 @@
|
||||
|
||||
FORCE="n"
|
||||
RUN=""
|
||||
MAKEPKG_ARGS="-Ss"
|
||||
MAKEPKG_ARGS="-sr"
|
||||
REPACK=""
|
||||
WORKDIR=$PWD
|
||||
clean_first="0"
|
||||
install_pkg=""
|
||||
|
||||
chrootdir="$CHROOT_SHELL"
|
||||
|
||||
APPNAME=$(basename "${0}")
|
||||
|
||||
if [ ! -f PKGBUILD ]; then
|
||||
echo "This must be run in the directory of a built package."
|
||||
exit 1
|
||||
fi
|
||||
source PKGBUILD
|
||||
|
||||
if [ "$EUID" != "0" ]; then
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage ()
|
||||
{
|
||||
echo "usage ${APPNAME} [-h] [-c CHROOT_SHELL] [makepkg args]"
|
||||
echo "usage ${APPNAME} [-h] [-c] [-r CHROOT_SHELL] [--] [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."
|
||||
@@ -39,24 +32,57 @@ usage ()
|
||||
echo " directories: \$CHROOT_SHELL/{root, rw, union} but only 'root' is"
|
||||
echo " required 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 "command:"
|
||||
echo " mkarchroot \$CHROOT_SHELL base base-devel sudo"
|
||||
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 ""
|
||||
echo "Default makepkg args: $MAKEPKG_ARGS"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts 'c:h' arg; do
|
||||
while getopts ':r:i:h:c' arg; do
|
||||
case "${arg}" in
|
||||
c) chrootdir="$OPTARG" ;;
|
||||
r) chrootdir="$OPTARG" ;;
|
||||
i) install_pkg="$OPTARG" ;;
|
||||
c) clean_first=1 ;;
|
||||
h|?) usage ;;
|
||||
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
#Get rid of trailing / in chrootdir
|
||||
[ "$chrootdir" != "/" ] && chrootdir=$(echo $chrootdir | sed 's#/$##')
|
||||
|
||||
# Pass all arguments after -- right to makepkg
|
||||
MAKEPKG_ARGS="$MAKEPKG_ARGS ${*:$OPTIND}"
|
||||
|
||||
# See if -R was passed to makepkg
|
||||
for arg in ${*:$OPTIND}; do
|
||||
if [ "$arg" = "-R" ]; then
|
||||
REPACK=1
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$EUID" != "0" ]; then
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f PKGBUILD ]; then
|
||||
echo "This must be run in a directory containing a PKGBUILD."
|
||||
exit 1
|
||||
fi
|
||||
source PKGBUILD
|
||||
|
||||
if [ ! -d "$chrootdir" ]; then
|
||||
echo "No \$CHROOT_SHELL defined, or invalid path"
|
||||
echo "No \$CHROOT_SHELL defined, or invalid path ($chrootdir)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -66,35 +92,104 @@ if [ ! -d "$chrootdir/root" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
[ -d "$chrootdir/rw" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/rw/"
|
||||
[ -d "$chrootdir/rw" ] || mkdir "$chrootdir/rw"
|
||||
[ -d "$chrootdir/union" ] || mkdir "$chrootdir/union"
|
||||
|
||||
function cleanup ()
|
||||
cleanup ()
|
||||
{
|
||||
echo "cleaning up unioned mounts"
|
||||
umount "$chrootdir/union/pkgdest" 2>/dev/null
|
||||
umount "$chrootdir/union/srcdest" 2>/dev/null
|
||||
umount "$chrootdir/union"
|
||||
}
|
||||
|
||||
uniondir="$chrootdir/union"
|
||||
echo "building union chroot"
|
||||
modprobe -q unionfs
|
||||
grep -Fq unionfs /proc/filesystems
|
||||
if [ $? -ne 0 ]; then
|
||||
modprobe -q unionfs
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: No unionfs available. Abandon ship!" && exit 1
|
||||
fi
|
||||
fi
|
||||
mount -t unionfs none -o "dirs=$chrootdir/rw=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
|
||||
|
||||
echo "moving build files to chroot"
|
||||
[ -d "$uniondir/build" ] || mkdir "$uniondir/build"
|
||||
|
||||
if [ "$REPACK" != "1" ]; then
|
||||
#Remove anything in there UNLESS -R (repack) was passed to makepkg
|
||||
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
|
||||
|
||||
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"
|
||||
fi
|
||||
|
||||
chown -R nobody "$uniondir/build"
|
||||
chown -R nobody "$uniondir/srcdest"
|
||||
chown -R nobody "$uniondir/pkgdest"
|
||||
|
||||
# Copy PKGBUILD and sources
|
||||
source PKGBUILD
|
||||
cp PKGBUILD "$uniondir/build/"
|
||||
for f in ${source[@]}; do
|
||||
if [ -f "$f" ]; then
|
||||
cp "$f" "$uniondir/build/"
|
||||
basef=$(basename $f)
|
||||
if [ -f "$basef" ]; then
|
||||
cp "$basef" "$uniondir/srcdest/"
|
||||
fi
|
||||
done
|
||||
if [ "$install" != "" -a -f "$install" ]; then
|
||||
cp "$install" "$uniondir/build/"
|
||||
fi
|
||||
|
||||
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"
|
||||
echo "nobody ALL=(ALL) NOPASSWD: ALL" >> $uniondir/etc/sudoers
|
||||
touch "$uniondir/etc/sudoers"
|
||||
echo "nobody ALL=(ALL) NOPASSWD: ALL" >> "$uniondir/etc/sudoers"
|
||||
chmod 440 "$uniondir/etc/sudoers"
|
||||
fi
|
||||
|
||||
#This is a little gross, but this way the script is recreated every time in the
|
||||
@@ -103,12 +198,31 @@ fi
|
||||
#!/bin/bash
|
||||
export LANG=$LOCALE
|
||||
cd /build
|
||||
sudo -u nobody makepkg "$MAKEPKG_ARGS"
|
||||
export HOME=/build
|
||||
sudo -u nobody makepkg $MAKEPKG_ARGS || touch BUILD_FAILED
|
||||
EOF
|
||||
) > "$uniondir/chrootbuild"
|
||||
chmod +x "$uniondir/chrootbuild"
|
||||
|
||||
./mkarchroot -r "/chrootbuild" "$uniondir"
|
||||
mkarchroot -r "/chrootbuild" "$uniondir"
|
||||
|
||||
# TODO move relevant files here
|
||||
echo "build complete... check \$CHROOT_SHELL/build for build results"
|
||||
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
|
||||
|
||||
if [ -e ${chrootdir}/rw/build/BUILD_FAILED ]; then
|
||||
echo "Build failed, check \$CHROOT_DIR/rw/build"
|
||||
rm ${chrootdir}/rw/build/BUILD_FAILED
|
||||
else
|
||||
rm -rf ${chrootdir}/rw/build/*
|
||||
echo "Build complete"
|
||||
fi
|
||||
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
||||
|
56
mkarchroot
56
mkarchroot
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# This program 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; version 2 of the License.
|
||||
@@ -23,15 +23,19 @@ usage ()
|
||||
echo " -r <app> Run 'app' within the context of the chroot"
|
||||
echo " -u Update the chroot via pacman"
|
||||
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 " -h This message"
|
||||
exit $1
|
||||
}
|
||||
|
||||
while getopts 'r:ufh' arg; do
|
||||
while getopts 'r:ufhC:M:' arg; do
|
||||
case "${arg}" in
|
||||
r) RUN="$OPTARG" ;;
|
||||
u) RUN="pacman -Syu" ;;
|
||||
f) FORCE="y" ;;
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
M) makepkg_conf="$OPTARG" ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -44,7 +48,7 @@ fi
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
if [ "$RUN" == "" -a $# -lt 2 ]; then
|
||||
if [ "$RUN" = "" -a $# -lt 2 ]; then
|
||||
echo "you must specify a directory and one or more packages"
|
||||
usage 1
|
||||
elif [ $# -lt 1 ]; then
|
||||
@@ -59,7 +63,7 @@ shift 1
|
||||
|
||||
# {{{ functions
|
||||
|
||||
function chroot_mount ()
|
||||
chroot_mount ()
|
||||
{
|
||||
echo "mounting sysfs : /sys"
|
||||
[ -e "${working_dir}/sys" ] || mkdir "${working_dir}/sys"
|
||||
@@ -80,7 +84,17 @@ function chroot_mount ()
|
||||
trap 'chroot_umount' 0 1 2 15
|
||||
}
|
||||
|
||||
function chroot_umount ()
|
||||
copy_hostconf ()
|
||||
{
|
||||
echo "copying mtab : /etc/mtab"
|
||||
cp /etc/mtab "${working_dir}/etc/mtab"
|
||||
|
||||
echo "copying resolv.conf : /etc/resolv.conf"
|
||||
cp /etc/resolv.conf "${working_dir}/etc/resolv.conf"
|
||||
|
||||
}
|
||||
|
||||
chroot_umount ()
|
||||
{
|
||||
echo "cleaning up mounts"
|
||||
umount "${working_dir}/proc"
|
||||
@@ -91,36 +105,40 @@ function chroot_umount ()
|
||||
# }}}
|
||||
|
||||
if [ "$RUN" != "" ]; then
|
||||
# run chroot {{{
|
||||
# run chroot {{{
|
||||
#Sanity check
|
||||
if [ ! -f "${working_dir}/.arch-chroot" ]; then
|
||||
echo "error: '${working_dir}' does not appear to be a Arch chroot"
|
||||
echo " please build the image using mkarchchroot"
|
||||
echo " please build the image using mkarchroot"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chroot_mount
|
||||
copy_hostconf
|
||||
|
||||
echo "starting chroot ($RUN)"
|
||||
chroot "${working_dir}" "${RUN}"
|
||||
chroot "${working_dir}" ${RUN}
|
||||
|
||||
# }}}
|
||||
# }}}
|
||||
else
|
||||
# {{{ build chroot
|
||||
# {{{ build chroot
|
||||
if [ -e "${working_dir}" -a "${FORCE}" = "n" ]; then
|
||||
echo "error: working dir '${working_dir}' already exists - try using -f"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${working_dir}/var/lib/pacman/"
|
||||
mkdir -p "${working_dir}/etc/"
|
||||
|
||||
chroot_mount
|
||||
|
||||
pacargs="--noconfirm -v " #--noprogressbar -v
|
||||
pacargs="$pacargs --root=${working_dir}"
|
||||
# pacman takes these as relative to the given root
|
||||
pacargs="$pacargs --dbpath=/var/lib/pacman"
|
||||
pacargs="$pacargs --cachedir=/var/cache/pacman/pkg"
|
||||
if [ "$pac_conf" != "" ]; then
|
||||
pacargs="$pacargs --config=${pac_conf}"
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "no packages to install"
|
||||
@@ -129,7 +147,7 @@ else
|
||||
for i in $@; do echo -e "\t$i"; done
|
||||
|
||||
op="-Sy"
|
||||
if [ "$FORCE" == "y" ]; then
|
||||
if [ "$FORCE" = "y" ]; then
|
||||
op="${op}f"
|
||||
fi
|
||||
if ! pacman ${op} ${pacargs} $@; then
|
||||
@@ -143,14 +161,24 @@ else
|
||||
ldconfig -r "${working_dir}"
|
||||
fi
|
||||
|
||||
if [ "$pac_conf" != "" ]; then
|
||||
echo "installing custom pacman.conf"
|
||||
cp ${pac_conf} ${working_dir}/etc/pacman.conf
|
||||
fi
|
||||
|
||||
if [ "$makepkg_conf" != "" ]; then
|
||||
echo "installing custom makepkg.conf"
|
||||
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
|
||||
fi
|
||||
|
||||
echo "generating default locales"
|
||||
sed -i "s|^#\(.*$LANG\)|\1|g" "${working_dir}/etc/locale.gen"
|
||||
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
|
||||
chroot "${working_dir}" locale-gen
|
||||
|
||||
if [ ! -e "${working_dir}/.arch-chroot" ]; then
|
||||
date +%s > "${working_dir}/.arch-chroot"
|
||||
fi
|
||||
# }}}
|
||||
# }}}
|
||||
fi
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:
|
||||
|
Reference in New Issue
Block a user