Compare commits

...

44 Commits
0.4 ... 0.5

Author SHA1 Message Date
Simo Leone
0b0a7b3140 Change unionfs module loading
Checking /proc/filesystems for unionfs is
friendlier for kernels with unionfs builtin.
Also, a total lack of unionfs now causes
makechrootpkg to bail out.

Signed-off-by: Simo Leone <simo@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-06 10:10:14 -06:00
Simo Leone
e0f139ad0e Separate mounting from config copying
Copying the configs before installing stuff
caused conflicts. Running the host's pacman
uses the host's configuration anyway, so
there is no need to copy them in this case.

Signed-off-by: Simo Leone <simo@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-06 10:09:07 -06:00
Aaron Griffin
0410fb0a2f Add -r to the default makepkg args
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-29 11:41:21 -06:00
Aaron Griffin
3078cb535c Minor pathing cleanups
Reported-by: Jaroslaw Swierczynski <swiergot@juvepoland.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Aaron Griffin
484d36e931 Check for existing files when copying to chroot
Use basename when checking for files in the source array

This allows us to actually check for pre-downloaded
remote files and copy them to the build root as well.

Original-work-by: Jaroslaw Swierczynski <swiergot@juvepoland.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Aaron Griffin
a0ccba5622 Remove "use sudo" from default makechrootpkg makepkg args
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Aaron Griffin
a8a3c856bf Remove DBPath from mkarchroot
No longer needed in pacman 3.1

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Aaron Griffin
2c06da35d6 Don't clear build dir upon completion
Clear when creating the dir, and additionally DO not clear it if the user is
attempting to repack the package.

Original-work-by: Jaroslaw Swierczynski <swiergot@juvepoland.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Travis Willard
eb7646ca18 Ensure scp'ing the package file works when PKGDEST is defined.
Make the call to scp use $(basename $pkgfile) so that we don't get oddness.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Travis Willard
97d4a8bbd0 Ensure pkgurl is always fully-qualified pathname in checkpkg.
This keeps the pkgurl variable consistently fully-qualified, so that whenever we
use that variable we know it points straight at the package file.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Travis Willard
6748570413 Improve makepkg config loading for checkpkg and extrapkg.
Now, checkpkg and extrapkg will fail if /etc/makepkg.conf doesn't exist, and will also try to load in personal user's settings in ~/.makepkg.conf

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:38 -06:00
Travis Willard
d853dee3ed Fix getopts bug and be more specific when moving package file.
My recent commit adding the -c option and renaming the old -c to -r accidentally left out the new '-r' option from the getopts call.  Additionally, add ${pkgrel} to the mv line after building to be more specific about that file to move.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:37 -06:00
Travis Willard
9e627e219e Copy makepkg.conf and ~/.makepkg.conf into chroot.
This change allows all packager-defined settings (such as PACKAGER or OPTIONS) to propogate into the chroot when building packages.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:37 -06:00
Damir Perisa
113f51fbc0 Output full path to package in finddeps
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:37 -06:00
Travis Willard
fc7f570aad Added support for makepkg's PKGDEST and SRCDEST params.
This ensures that sources and packages built inside makechrootpkg go where
the user expects them to, as defined in their /etc/makepkg.conf and
~/.makepkg.conf files.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:37 -06:00
Travis Willard
5eb176f471 Renamed -c option to -r (for "root") and added -c option (for clean).
The old -c option, which specified a 'chroot', has been renamed to -r, since
most other scripts use -r for a different root.  A new -c option is
introduced, which cleans all files from ${chrootdir}/rw before beginning,
thus ensuring a clean chroot.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:37 -06:00
Aaron Griffin
59d373a62b Use full filename for scp upload
Fix an issue where a missing add directory causes the package to be uploaded as
a file named "add"

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-01-23 16:11:37 -06:00
Aaron Griffin
bc8a791ad6 Copy resolv.conf each time just like mtab
Resolv.conf changes, like mtab, so we can't just trust it to copy on build only

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-28 22:18:26 -06:00
Aaron Griffin
4a829ff1f7 Force symlink creation in the install target
Allows us to run 'make install' even if the symlinks exist (helpful for testing
locally)

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-28 21:44:11 -06:00
Aaron Griffin
5472d5ab5a Fixed a typo (mkarchchroot -> mkarchroot)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-28 21:28:29 -06:00
Dan McGee
f05495dfc8 Whitespace fixes/cleanup to all of the scripts
Add the same vim modeline to all the files, as well as cleanup the newly
added scripts a bit. If you look at this diff with the -w option, you'll see
it really isn't all that significant.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-28 21:20:24 -06:00
Aaron Griffin
c229a696a2 Add finddeps script from cvs-arch
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-28 21:00:07 -06:00
Aaron Griffin
e77986fc08 Add lddd script from cvs-arch
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-28 21:00:07 -06:00
Dan McGee
f7ab112f9a Use user's locale.gen instead of sed-magic
The sed-magic was wrong in many cases, including my default locale:
LANG=en_US.utf8
locale.gen line: en_US.UTF-8

If we copy the user's locale.gen file, we will generate all of their locales
instead of just the current one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-28 14:44:59 -06:00
Dan McGee
0986936143 Allow user to see invalid chrootpath in error message
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-28 13:06:51 -06:00
Dan McGee
e23b176f3e Fix some bashisms (but change #! to /bin/bash)
We need to use bash due to the usage of arrays, but we might as well fix
some bashisms that were used in the scripts anyways.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-28 09:10:41 -06:00
Armin Luntzer
f92e01ed28 makechrootpkg: clarify usage message
Signed-off-by: Jason Chu <jchu@xentac.net>
2007-11-27 16:45:28 -08:00
Armin Luntzer
ceb84394f9 makechrootpkg: Check if build was successful. Copy package to cwd and cleanup $chrootdir/rw/build on success, keep directory contents on failure.
Signed-off-by: Jason Chu <jchu@xentac.net>
2007-11-27 16:45:28 -08:00
Armin Luntzer
e71c9784b5 mkarchroot: create $working_dir/etc (fixes error msg when trying to copy /etc/mtab during chroot creation)
Signed-off-by: Jason Chu <jchu@xentac.net>
2007-11-27 16:45:28 -08:00
Armin Luntzer
e16136b8e8 mkarchroot: copy /etc/resolv.conf to chroot
Signed-off-by: Jason Chu <jchu@xentac.net>
2007-11-27 16:45:28 -08:00
Armin Luntzer
9e660ee86e mkarchroot: add -M switch for a custom makepkg.conf
Signed-off-by: Jason Chu <jchu@xentac.net>
2007-11-27 16:45:28 -08:00
Dan McGee
06a0d18bdc Add an uninstall target
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-27 18:15:00 -06:00
Dan McGee
84f29cd824 Clarify message when PKGBUILD does not exist and always have help available
makechrootpkg should check for a PKGBUILD and user credentials after the
option to print usage is granted.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-27 18:14:42 -06:00
Jason Chu
e32a2bb70c Make sure that build is owned by nobody, so that it can write to the directory 2007-11-04 15:44:53 -08:00
Jason Chu
974d8d11a6 Pass $MAKEPKG_ARGS as separate parameters to makepkg instead of one big string 2007-11-04 15:05:07 -08:00
Jason Chu
64ff97a171 Call mkarchroot not ./mkarchroot so that we can use makechrootpkg from any directory 2007-11-04 15:04:36 -08:00
Jason Chu
39aad4fe59 Escape the uniondir directory reference when creating $uniondir/etc/sudoers and set it to the proper permissions (440) 2007-11-04 15:02:55 -08:00
Jason Chu
411c07f2fb Copy the install file into the build directory because we need that too 2007-11-04 15:02:03 -08:00
Jason Chu
1e1e1e481e Accept options to makepkg after a -- so that we can accept longopts for makepkg and even options that are used by makechrootpkg 2007-11-04 15:01:22 -08:00
Jason Chu
bced48cecd Allow optional params to makechrootpkg (to actually accept extra makepkg args) 2007-11-04 14:56:43 -08:00
Jason Chu
e782cbd00b Copy mtab over to chroot so that pacman can detect disk space 2007-11-04 14:55:42 -08:00
Jason Chu
3ce2983ad6 Pass $RUN to chroot so that all the params are expanded properly 2007-11-04 14:55:02 -08:00
Jason Chu
b528eba028 Install the custom pacman.conf in the chroot so that it can be used for later updates 2007-11-03 09:57:26 -07:00
Daniel Isenmann
7bb2c48c8f add -C option to mkarchroot
Signed-off-by: Jason Chu <jchu@xentac.net>
2007-11-03 09:40:18 -07:00
7 changed files with 371 additions and 121 deletions

View File

@@ -5,10 +5,25 @@ 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
# 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

View File

@@ -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:

135
extrapkg
View File

@@ -1,12 +1,23 @@
#!/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
source PKGBUILD
@@ -14,90 +25,92 @@ 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"
tag="CURRENT"
elif [ "$cmd" == "corepkg" ]; then
repo="core"
tag="CURRENT"
repo="core"
tag="CURRENT"
elif [ "$cmd" == "testingpkg" ]; then
repo="testing"
tag="TESTING"
repo="testing"
tag="TESTING"
elif [ "$cmd" == "unstablepkg" ]; then
repo="unstable"
tag="CURRENT"
repo="unstable"
tag="CURRENT"
elif [ "$cmd" == "communitypkg" ]; then
repo="community"
tag="CURRENT"
repo="community"
tag="CURRENT"
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
scp ${scpopts} ${pkgfile} archlinux.org:staging/$repo/add/$(basename ${pkgfile})
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
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 compatability"
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"
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"
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"
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"
fi
cvs tag -c -F -R $tag > /dev/null
if [ $? -ne 0 ]; then
echo "Cancelled"
exit 1
echo "Cancelled"
exit 1
fi
echo "===> Tagged as $tag"
# vim:ft=sh:ts=4:sw=4:et:

41
finddeps Executable file
View 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
View 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:

View File

@@ -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,18 @@
FORCE="n"
RUN=""
MAKEPKG_ARGS="-Ss"
MAKEPKG_ARGS="-sr"
REPACK=""
WORKDIR=$PWD
clean_first="0"
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 +31,56 @@ 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:h:c' arg; do
case "${arg}" in
c) chrootdir="$OPTARG" ;;
r) chrootdir="$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 +90,88 @@ 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 ];
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
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 ! 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
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 +180,29 @@ fi
#!/bin/bash
export LANG=$LOCALE
cd /build
sudo -u nobody makepkg "$MAKEPKG_ARGS"
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"
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
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/*
echo "Build complete"
fi
# vim:ft=sh:ts=4:sw=4:et:

View File

@@ -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: