Compare commits

...

20 Commits

Author SHA1 Message Date
Pierre Schmitz
9840730880 Prepare release 2012-03-05 18:02:22 +01:00
Pierre Schmitz
502813a107 commitpkg: Pass through the -f parameter to archrelease so unofficial repos can be used 2012-03-05 16:48:19 +01:00
Pierre Schmitz
181646d03b makechrootpkg: Install the built packages before running namcap to reduce false positives and check inter split package dependencies. 2012-03-05 16:28:09 +01:00
Gerardo Exequiel Pozzi
2d9a99ee15 Add -d param to optionally support devtmpfs
The main intention of this patch is to take advantage of
/dev/loop-control and loop devices.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-03-05 14:30:26 +01:00
Pierre Schmitz
cecd257786 Add script to move packages between [extra] and [community] 2012-03-05 01:48:27 +01:00
Pierre Schmitz
82dcc19ff9 commitpkg: Add ability to override the server
This might be useful for unofficial repos
2012-03-04 22:38:07 +01:00
Florian Pritz
c5893672a6 find-libdeps: fix extraction of soname
libperl.so results in soname="libperl.so.so" which is wrong.

This returns the correct string: "libperl.so"

Fix-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-03-04 22:25:22 +01:00
Pierre Schmitz
73d61f43c7 prepare release 2012-02-15 11:33:12 +01:00
Allan McRae
afc93f3430 Always sign unsigned packages
We do not allow packages to be uploaded without signatures so force
all unsigned packages to be signed.  This has the bonus of not
breaking makepkg signing support by requiring you use an internal
makepkg variable.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-02-15 11:25:49 +01:00
Lukas Fleischer
9ab0d94578 archrelease: Validate tags before releasing
Compare every single tag with a list of valid tags. This prevents broken
releases which occurred whenever someone made a typo on the command
line:

    $ ./archrelease community i686
    ==> ERROR: archrelease: Invalid tag: "community" (use -f to force release)

Since the list is used in the ZSH completion as well, break it out to a
separate file and move it to "lib/". Also, add a command line parameter
to allow for releasing to an unknown repository when necessary.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-02-12 12:35:14 +01:00
Lukas Fleischer
5e8cb67603 zsh_completion: Remove multilib*-{i686, any}
These tags make no sense. Remove them from our valid tag array that is
used for tab completion.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-02-08 12:53:13 +01:00
Pierre Schmitz
65365f1853 prepare release 2012-02-06 21:17:44 +01:00
Florian Pritz
06a681ca3d commitpkg: use absolute paths when uploading files
This fixes a problem where rsync won't work if the pkgver contains a
colon (epoch). In this case rsync assumes that the colon is a
remote:path separator and having src and dest both being remote
arguments is not supported.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-02-06 21:15:57 +01:00
Pierre Schmitz
b763788b16 Fix typo: It's PKGDEST and not DESTDIR 2012-01-19 18:45:01 +01:00
Pierre Schmitz
c2d9a0e7b1 Set correct pacman.conf
Commit ee4edefa2f reverted too much and left pacman.conf unset
2012-01-18 16:56:41 +01:00
Pierre Schmitz
ee4edefa2f Remove any pacman 4 related workarounds 2012-01-18 11:24:07 +01:00
Allan McRae
a8b64995ee makechrootpkg: fix error message
Passing a directory that does not exist to makechrootpkg results in
an error message:

==> ERROR: No chroot dir defined, or invalid path ''

The path is not being printed as the readlink command blanks it if
the directory does not exist. Fix this.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-01-18 11:06:52 +01:00
Jan Alexander Steffens (heftig)
2c9855fe6b Fix up usage help, the Default line belongs to -l
Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-01-18 11:06:52 +01:00
Florian Pritz
4d4ffb5d8f find-libdeps: fix syntax error
The problem has been introduced in commit
56d4dec19f

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-01-18 11:06:52 +01:00
Dave Reisner
2d79191c97 commitpkg: behavior more sanely in searching for built pkgs
In the case of a .pkg.tar.xz and a .pkg.tar.gz existing in the same
directory, all commitpkg would say is:

  ==> WARNING: Could not find . Skipping x86_64

Upon digging into the logic, we did a few things poorly, mostly in
getpkgfile:

- getpkgfile tried to die in a subshell (within the command substituion
  assignment to 'pkgfile'). This will never work.
- We assumed that proper glob expansion happened when we received
  exactly 1 arg. This isn't necessarily true without nullglob in effect.
- We dumped the real error (spewed by getpkgfile) to /dev/null.
- We checked for the package twice in both $PWD and $DESTDIR/.
- We checked for file existance multiple times.

Address this by:

- not hiding errors. revamp the wording a little bit to make it more
  obvious why we failed, particularly in the case of a glob expanding to
  more than 1 file. Logic here is simplified to pointing out the failure
  cases of 0 and >1.
- setting nullglob so the number of arguments passed into getpkgfile is
  meaningful from a 'did it decisively resolve' point of view.
- not trying to exit the entire script from a subshell. Just return a
  value (and use it).
- avoiding the package file existance check afterwards. this is a
  freebie from getpkgfile when the glob passed fails to expand.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-01-18 11:06:51 +01:00
19 changed files with 232 additions and 109 deletions

1
.gitignore vendored
View File

@@ -14,3 +14,4 @@ mkarchroot
rebuildpkgs rebuildpkgs
zsh_completion zsh_completion
find-libdeps find-libdeps
crossrepomove

View File

@@ -1,4 +1,4 @@
V=20120114 V=20120305
PREFIX = /usr/local PREFIX = /usr/local
@@ -12,7 +12,8 @@ BINPROGS = \
lddd \ lddd \
finddeps \ finddeps \
rebuildpkgs \ rebuildpkgs \
find-libdeps find-libdeps \
crossrepomove
SBINPROGS = \ SBINPROGS = \
mkarchroot \ mkarchroot \
@@ -59,6 +60,10 @@ ARCHBUILD_LINKS = \
gnome-unstable-i686-build \ gnome-unstable-i686-build \
gnome-unstable-x86_64-build gnome-unstable-x86_64-build
CROSSREPOMOVE_LINKS = \
extra2community \
community2extra
all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g" edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g"
@@ -82,6 +87,7 @@ install:
install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/devtools install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/devtools
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools
install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
@@ -93,6 +99,7 @@ uninstall:
for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/$$f; done for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/$$f; done
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
rm $(DESTDIR)/etc/bash_completion.d/devtools rm $(DESTDIR)/etc/bash_completion.d/devtools
rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
rm -f $(DESTDIR)$(PREFIX)/bin/communityco rm -f $(DESTDIR)$(PREFIX)/bin/communityco

View File

@@ -2,8 +2,7 @@
m4_include(lib/common.sh) m4_include(lib/common.sh)
# FIXME: temporary added curl until pacman 4.0 moves to [core] base_packages=(base base-devel sudo)
base_packages=(base base-devel sudo curl)
cmd="${0##*/}" cmd="${0##*/}"
if [[ "${cmd%%-*}" == 'multilib' ]]; then if [[ "${cmd%%-*}" == 'multilib' ]]; then
@@ -53,27 +52,13 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
done done
exec 9>&- exec 9>&-
# FIXME: temporary workaround until pacman 4.0 moves to [core]
if pacman -V | grep -q 'v4.' && ( [[ "$repo" == 'extra' || "$repo" == 'multilib' ]] ); then
pacman_conf=$(mktemp)
cp "@pkgdatadir@/pacman-${repo}.conf" "${pacman_conf}"
sed -r 's/^#(SigLevel = Never)/\1/' -i "${pacman_conf}"
else
pacman_conf="@pkgdatadir@/pacman-${repo}.conf"
fi
rm -rf "${chroots}/${repo}-${arch}" rm -rf "${chroots}/${repo}-${arch}"
mkdir -p "${chroots}/${repo}-${arch}" mkdir -p "${chroots}/${repo}-${arch}"
setarch "${arch}" mkarchroot \ setarch "${arch}" mkarchroot \
-C "${pacman_conf}" \ -C "@pkgdatadir@/pacman-${repo}.conf" \
-M "@pkgdatadir@/makepkg-${arch}.conf" \ -M "@pkgdatadir@/makepkg-${arch}.conf" \
"${chroots}/${repo}-${arch}/root" \ "${chroots}/${repo}-${arch}/root" \
"${base_packages[@]}" "${base_packages[@]}"
# FIXME: temporary workaround until pacman 4.0 moves to [core]
if pacman -V | grep -q 'v4.' && ( [[ "$repo" == 'extra' || "$repo" == 'multilib' ]] ); then
cp "@pkgdatadir@/pacman-${repo}.conf" "${chroots}/${repo}-${arch}/root/etc/pacman.conf"
fi
else else
setarch ${arch} mkarchroot \ setarch ${arch} mkarchroot \
-u \ -u \

View File

@@ -1,13 +1,32 @@
#!/bin/bash #!/bin/bash
m4_include(lib/common.sh) m4_include(lib/common.sh)
m4_include(lib/valid-tags.sh)
if [[ -z $1 ]]; then # parse command line options
echo 'Usage: archrelease <repo>...' FORCE=
while getopts ':f' flag; do
case $flag in
f) FORCE=1 ;;
:) die "Option requires an argument -- '$OPTARG'" ;;
\?) die "Invalid option -- '$OPTARG'" ;;
esac
done
shift $(( OPTIND - 1 ))
if ! (( $# )); then
echo 'Usage: archrelease [-f] <repo>...'
exit 1 exit 1
fi fi
# TODO: validate repo is really repo-arch # validate repo is really repo-arch
if [[ -z $FORCE ]]; then
for tag in "$@"; do
if ! in_array "$tag" "${_tags[@]}"; then
die 'archrelease: Invalid tag: "'$tag'" (use -f to force release)'
fi
done
fi
if [[ ! -f PKGBUILD ]]; then if [[ ! -f PKGBUILD ]]; then
die 'archrelease: PKGBUILD not found' die 'archrelease: PKGBUILD not found'

View File

@@ -3,13 +3,19 @@
m4_include(lib/common.sh) m4_include(lib/common.sh)
getpkgfile() { getpkgfile() {
if [[ ${#} -ne 1 ]]; then case $# in
die 'No canonical package found!' 0)
elif [[ ! -f $1 ]]; then error 'No canonical package found!'
die "Package ${1} not found!" return 1
fi ;;
[!1])
error 'Failed to canonicalize package name -- multiple packages found:'
msg2 '%s' "$@"
return 1
;;
esac
echo ${1} echo "$1"
} }
# Source makepkg.conf; fail if it is not found # Source makepkg.conf; fail if it is not found
@@ -36,7 +42,7 @@ pkgbase=${pkgbase:-$pkgname}
case "$cmd" in case "$cmd" in
commitpkg) commitpkg)
if (( $# == 0 )); then if (( $# == 0 )); then
die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' die 'usage: commitpkg <reponame> [-f] [-s server] [-l limit] [-a arch] [commit message]'
fi fi
repo="$1" repo="$1"
shift shift
@@ -45,20 +51,10 @@ case "$cmd" in
repo="${cmd%pkg}" repo="${cmd%pkg}"
;; ;;
*) *)
die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' die 'usage: commitpkg <reponame> [-f] [-s server] [-l limit] [-a arch] [commit message]'
;; ;;
esac esac
case "$repo" in
core|extra|testing|staging|kde-unstable|gnome-unstable)
server='gerolde.archlinux.org' ;;
community*|multilib*)
server='aur.archlinux.org' ;;
*)
server='gerolde.archlinux.org'
msg "Non-standard repository $repo in use, defaulting to server $server" ;;
esac
# check if all local source files are under version control # check if all local source files are under version control
for s in "${source[@]}"; do for s in "${source[@]}"; do
if [[ $s != *://* ]] && ! svn status -v "$s" | grep -q '^[ AMRX~]'; then if [[ $s != *://* ]] && ! svn status -v "$s" | grep -q '^[ AMRX~]'; then
@@ -77,18 +73,32 @@ for i in 'changelog' 'install'; do
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
done done
# see if any limit options were passed, we'll send them to rsync
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y) rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
while getopts ':l:a:' flag; do archreleaseopts=()
while getopts ':l:a:s:f' flag; do
case $flag in case $flag in
l) rsyncopts+=("--bwlimit=$2") ;; f) archreleaseopts+=('-f') ;;
a) commit_arch=$2 ;; s) server=$OPTARG ;;
l) rsyncopts+=("--bwlimit=$OPTARG") ;;
a) commit_arch=$OPTARG ;;
:) die "Option requires an argument -- '$OPTARG'" ;; :) die "Option requires an argument -- '$OPTARG'" ;;
\?) die "Invalid option -- '$OPTARG'" ;; \?) die "Invalid option -- '$OPTARG'" ;;
esac esac
done done
shift $(( OPTIND - 1 )) shift $(( OPTIND - 1 ))
if [[ -z $server ]]; then
case "$repo" in
core|extra|testing|staging|kde-unstable|gnome-unstable)
server='gerolde.archlinux.org' ;;
community*|multilib*)
server='aur.archlinux.org' ;;
*)
server='gerolde.archlinux.org'
msg "Non-standard repository $repo in use, defaulting to server $server" ;;
esac
fi
if [[ -n $(svn status -q) ]]; then if [[ -n $(svn status -q) ]]; then
msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n' msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n'
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
@@ -127,36 +137,27 @@ for _arch in ${arch[@]}; do
for _pkgname in ${pkgname[@]}; do for _pkgname in ${pkgname[@]}; do
fullver=$(get_full_version $_pkgname) fullver=$(get_full_version $_pkgname)
pkgfile=$(getpkgfile "$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null)
pkgdestfile=$(getpkgfile "$PKGDEST/$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null)
if [[ -f $pkgfile ]]; then if ! pkgfile=$(shopt -s nullglob;
pkgfile="./$pkgfile" getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
elif [[ -f $pkgdestfile ]]; then warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
pkgfile="$pkgdestfile"
else
warning "Could not find ${pkgfile}. Skipping ${_arch}"
skip_arches+=($_arch) skip_arches+=($_arch)
continue 2 continue 2
fi fi
uploads+=("$pkgfile") uploads+=("$pkgfile")
sigfile="${pkgfile}.sig" sigfile="${pkgfile}.sig"
if [[ $SIGNPKG == 'y' && ! -f $sigfile ]]; then if [[ ! -f $sigfile ]]; then
msg "Signing package ${pkgfile}..." msg "Signing package ${pkgfile}..."
if [[ -n $GPGKEY ]]; then if [[ -n $GPGKEY ]]; then
SIGNWITHKEY="-u ${GPGKEY}" SIGNWITHKEY="-u ${GPGKEY}"
fi fi
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
fi fi
if [[ -f $sigfile ]]; then if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then die "Signature ${pkgfile}.sig is incorrect!"
die "Signature ${pkgfile}.sig is incorrect!"
fi
uploads+=("$sigfile")
else
die "Signature ${pkgfile}.sig was not found"
fi fi
uploads+=("$sigfile")
done done
done done
@@ -165,7 +166,17 @@ for _arch in ${arch[@]}; do
commit_arches+=($_arch) commit_arches+=($_arch)
fi fi
done done
archrelease "${commit_arches[@]/#/$repo-}" || die archrelease "${archreleaseopts[@]}" "${commit_arches[@]/#/$repo-}" || die
new_uploads=()
# convert to absolute paths so rsync can work with colons (epoch)
while read -r -d '' upload; do
new_uploads+=("$upload")
done < <(realpath -z "${uploads[@]}")
uploads=("${new_uploads[@]}")
unset new_uploads
if [[ ${#uploads[*]} -gt 0 ]]; then if [[ ${#uploads[*]} -gt 0 ]]; then
msg 'Uploading all package and signature files' msg 'Uploading all package and signature files'

86
crossrepomove.in Normal file
View File

@@ -0,0 +1,86 @@
#!/bin/bash
m4_include(lib/common.sh)
scriptname=${0##*/}
if [[ -z $1 ]]; then
echo 'Usage: '$scriptname' [pkgbase]'
exit 1
fi
pkgbase="${1}"
packages_svn='svn+ssh://gerolde.archlinux.org/srv/svn-packages'
packages_server='gerolde.archlinux.org'
community_svn='svn+ssh://aur.archlinux.org/srv/svn-packages'
community_server='aur.archlinux.org'
mirror='http://mirrors.kernel.org/archlinux'
case $scriptname in
extra2community)
source_svn="${packages_svn}"
target_svn="${community_svn}"
source_server="${packages_server}"
target_server="${community_server}"
source_repo='extra'
target_repo='community'
;;
community2extra)
source_svn="${community_svn}"
target_svn="${packages_svn}"
source_server="${community_server}"
target_server="${packages_server}"
source_repo='community'
target_repo='extra'
;;
*)
die "Couldn't find configuration for $scriptname"
;;
esac
setup_workdir
pushd $WORKDIR >/dev/null
msg "Downloading sources for ${pkgbase}"
svn -q checkout -N "${target_svn}" target_checkout
mkdir -p "target_checkout/${pkgbase}/repos"
svn -q export "${source_svn}/${pkgbase}/trunk" "target_checkout/${pkgbase}/trunk" || die
. "target_checkout/${pkgbase}/trunk/PKGBUILD"
msg "Downloading packages for ${pkgbase}"
for _arch in ${arch[@]}; do
if [[ "${_arch[*]}" == 'any' ]]; then
repo_arch='x86_64'
else
repo_arch=${_arch}
fi
for _pkgname in ${pkgname[@]}; do
fullver=$(get_full_version $_pkgname)
# FIXME: this only works with .xz packages
ssh "${target_server}" "cd staging/${target_repo}
curl -O ${mirror}/${source_repo}/os/${repo_arch}/$_pkgname-$fullver-${_arch}.pkg.tar.xz
curl -O ${mirror}/${source_repo}/os/${repo_arch}/$_pkgname-$fullver-${_arch}.pkg.tar.xz.sig" || die
done
done
msg "Adding ${pkgbase} to ${target_repo}"
svn -q add "target_checkout/${pkgbase}"
svn -q propset svn:keywords 'Id' "target_checkout/${pkgbase}/trunk/PKGBUILD"
svn -q commit -m"${scriptname}: Moving ${pkgbase} from ${source_repo} to ${target_repo}" target_checkout
pushd "target_checkout/${pkgbase}/trunk" >/dev/null
archrelease "${arch[@]/#/$target_repo-}" || die
popd >/dev/null
ssh "${target_server}" '/arch/db-update' || die
msg "Removing ${pkgbase} from ${source_repo}"
for _arch in ${arch[@]}; do
ssh "${source_server}" "/arch/db-remove ${source_repo} ${_arch} ${pkgbase}"
done
svn -q checkout -N "${source_svn}" source_checkout
svn -q up "source_checkout/${pkgbase}"
svn -q rm "source_checkout/${pkgbase}"
svn -q commit -m"${scriptname}: Moving ${pkgbase} from ${source_repo} to ${target_repo}" source_checkout
popd >/dev/null

View File

@@ -3,6 +3,7 @@
m4_include(lib/common.sh) m4_include(lib/common.sh)
set -e set -e
shopt -s extglob
IGNORE_INTERNAL=0 IGNORE_INTERNAL=0
@@ -40,7 +41,7 @@ fi
process_sofile() { process_sofile() {
# extract the library name: libfoo.so # extract the library name: libfoo.so
soname="${sofile%%\.so\.*}.so" soname="${sofile%.so?(+(.+([0-9])))}".so
# extract the major version: 1 # extract the major version: 1
soversion="${sofile##*\.so\.}" soversion="${sofile##*\.so\.}"
if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then
@@ -73,7 +74,7 @@ find . -type f $find_args | while read filename; do
if [[ $script_mode = "provides" ]]; then if [[ $script_mode = "provides" ]]; then
# get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1 # get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1
sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p') sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
[[ -z $sofile" ]] && sofile="${filename##*/}" [[ -z $sofile ]] && sofile="${filename##*/}"
process_sofile process_sofile
elif [[ $script_mode = "deps" ]]; then elif [[ $script_mode = "deps" ]]; then
# process all libraries needed by the binary # process all libraries needed by the binary

20
lib/valid-tags.sh Normal file
View File

@@ -0,0 +1,20 @@
_arch=(
i686
x86_64
any
)
_tags=(
core-i686 core-x86_64 core-any
extra-i686 extra-x86_64 extra-any
multilib-x86_64
staging-i686 staging-x86_64 staging-any
testing-i686 testing-x86_64 testing-any
multilib-testing-x86_64
multilib-staging-x86_64
community-i686 community-x86_64 community-any
community-staging-i686 community-staging-x86_64 community-staging-any
community-testing-i686 community-testing-x86_64 community-testing-any
kde-unstable-i686 kde-unstable-x86_64 kde-unstable-any
gnome-unstable-i686 gnome-unstable-x86_64 gnome-unstable-any
)

View File

@@ -20,6 +20,7 @@ install_pkg=
add_to_db=false add_to_db=false
run_namcap=false run_namcap=false
chrootdir= chrootdir=
passeddir=
default_copy=$USER default_copy=$USER
[[ -n $SUDO_USER ]] && default_copy=$SUDO_USER [[ -n $SUDO_USER ]] && default_copy=$SUDO_USER
@@ -52,8 +53,8 @@ usage() {
echo '-I <pkg> Install a package into the working copy of the chroot' echo '-I <pkg> Install a package into the working copy of the chroot'
echo '-l <copy> The directory to use as the working copy of the chroot' echo '-l <copy> The directory to use as the working copy of the chroot'
echo ' Useful for maintaining multiple copies.' echo ' Useful for maintaining multiple copies.'
echo '-n Run namcap on the package'
echo " Default: $default_copy" echo " Default: $default_copy"
echo '-n Run namcap on the package'
exit 1 exit 1
} }
@@ -63,16 +64,16 @@ while getopts 'hcudr:I:l:n' arg; do
c) clean_first=true ;; c) clean_first=true ;;
u) update_first=true ;; u) update_first=true ;;
d) add_to_db=true ;; d) add_to_db=true ;;
r) chrootdir="$OPTARG" ;; r) passeddir="$OPTARG" ;;
I) install_pkg="$OPTARG" ;; I) install_pkg="$OPTARG" ;;
l) copy="$OPTARG" ;; l) copy="$OPTARG" ;;
n) run_namcap=true ;; n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
*) makepkg_args="$makepkg_args -$arg $OPTARG" ;; *) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
esac esac
done done
# Canonicalize chrootdir, getting rid of trailing / # Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$chrootdir") chrootdir=$(readlink -e "$passeddir")
if [[ ${copy:0:1} = / ]]; then if [[ ${copy:0:1} = / ]]; then
copydir=$copy copydir=$copy
@@ -101,7 +102,7 @@ if [[ ! -f PKGBUILD && -z $install_pkg ]]; then
fi fi
if [[ ! -d $chrootdir ]]; then if [[ ! -d $chrootdir ]]; then
die "No chroot dir defined, or invalid path '$chrootdir'" die "No chroot dir defined, or invalid path '$passeddir'"
fi fi
if [[ ! -d $chrootdir/root ]]; then if [[ ! -d $chrootdir/root ]]; then

View File

@@ -13,6 +13,7 @@ m4_include(lib/common.sh)
FORCE='n' FORCE='n'
RUN='' RUN=''
NOCOPY='n' NOCOPY='n'
USE_DEVTMPFS='n'
working_dir='' working_dir=''
@@ -29,11 +30,12 @@ usage() {
echo ' -M <file> Location of a makepkg config file' echo ' -M <file> Location of a makepkg config file'
echo ' -n Do not copy config files into the chroot' echo ' -n Do not copy config files into the chroot'
echo ' -c <dir> Set pacman cache. Default: /var/cache/pacman/pkg' echo ' -c <dir> Set pacman cache. Default: /var/cache/pacman/pkg'
echo ' -d Use devtmpfs instead of minimal /dev (tmpfs)'
echo ' -h This message' echo ' -h This message'
exit 1 exit 1
} }
while getopts 'r:ufnhC:M:c:' arg; do while getopts 'r:ufnhC:M:c:d' arg; do
case "${arg}" in case "${arg}" in
r) RUN="$OPTARG" ;; r) RUN="$OPTARG" ;;
u) RUN='/bin/sh -c "pacman -Syu --noconfirm && (pacman -Qqu >/dev/null && pacman -Su --noconfirm || exit 0)"' ;; u) RUN='/bin/sh -c "pacman -Syu --noconfirm && (pacman -Qqu >/dev/null && pacman -Su --noconfirm || exit 0)"' ;;
@@ -42,6 +44,7 @@ while getopts 'r:ufnhC:M:c:' arg; do
M) makepkg_conf="$OPTARG" ;; M) makepkg_conf="$OPTARG" ;;
n) NOCOPY='y' ;; n) NOCOPY='y' ;;
c) cache_dir="$OPTARG" ;; c) cache_dir="$OPTARG" ;;
d) USE_DEVTMPFS="y" ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) error "invalid argument '${arg}'"; usage ;; *) error "invalid argument '${arg}'"; usage ;;
esac esac
@@ -90,20 +93,24 @@ chroot_mount() {
mount -t proc proc "${working_dir}/proc" mount -t proc proc "${working_dir}/proc"
[[ -e "${working_dir}/dev" ]] || mkdir "${working_dir}/dev" [[ -e "${working_dir}/dev" ]] || mkdir "${working_dir}/dev"
mount -t tmpfs dev "${working_dir}/dev" -o mode=0755,size=10M,nosuid if [[ ${USE_DEVTMPFS} = "y" ]]; then
mknod -m 666 "${working_dir}/dev/null" c 1 3 mount -t devtmpfs dev "${working_dir}/dev" -o mode=0755,nosuid
mknod -m 666 "${working_dir}/dev/zero" c 1 5 else
mknod -m 600 "${working_dir}/dev/console" c 5 1 mount -t tmpfs dev "${working_dir}/dev" -o mode=0755,size=10M,nosuid
mknod -m 644 "${working_dir}/dev/random" c 1 8 mknod -m 666 "${working_dir}/dev/null" c 1 3
mknod -m 644 "${working_dir}/dev/urandom" c 1 9 mknod -m 666 "${working_dir}/dev/zero" c 1 5
mknod -m 666 "${working_dir}/dev/tty" c 5 0 mknod -m 600 "${working_dir}/dev/console" c 5 1
mknod -m 666 "${working_dir}/dev/tty0" c 4 0 mknod -m 644 "${working_dir}/dev/random" c 1 8
mknod -m 666 "${working_dir}/dev/full" c 1 7 mknod -m 644 "${working_dir}/dev/urandom" c 1 9
ln -s /proc/kcore "${working_dir}/dev/core" mknod -m 666 "${working_dir}/dev/tty" c 5 0
ln -s /proc/self/fd "${working_dir}/dev/fd" mknod -m 666 "${working_dir}/dev/tty0" c 4 0
ln -s /proc/self/fd/0 "${working_dir}/dev/stdin" mknod -m 666 "${working_dir}/dev/full" c 1 7
ln -s /proc/self/fd/1 "${working_dir}/dev/stdout" ln -s /proc/kcore "${working_dir}/dev/core"
ln -s /proc/self/fd/2 "${working_dir}/dev/stderr" ln -s /proc/self/fd "${working_dir}/dev/fd"
ln -s /proc/self/fd/0 "${working_dir}/dev/stdin"
ln -s /proc/self/fd/1 "${working_dir}/dev/stdout"
ln -s /proc/self/fd/2 "${working_dir}/dev/stderr"
fi
[[ -e "${working_dir}/dev/shm" ]] || mkdir "${working_dir}/dev/shm" [[ -e "${working_dir}/dev/shm" ]] || mkdir "${working_dir}/dev/shm"
mount -t tmpfs shm "${working_dir}/dev/shm" -o nodev,nosuid,size=128M mount -t tmpfs shm "${working_dir}/dev/shm" -o nodev,nosuid,size=128M

View File

@@ -47,8 +47,8 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
#SigLevel = Never SigLevel = Never
# #
# REPOSITORIES # REPOSITORIES

View File

@@ -47,7 +47,7 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
SigLevel = Never SigLevel = Never
# #

View File

@@ -47,7 +47,7 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
SigLevel = Never SigLevel = Never
# #

View File

@@ -47,7 +47,7 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
SigLevel = Never SigLevel = Never
# #

View File

@@ -47,7 +47,7 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
SigLevel = Never SigLevel = Never
# #

View File

@@ -47,8 +47,8 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
#SigLevel = Never SigLevel = Never
# #
# REPOSITORIES # REPOSITORIES

View File

@@ -47,7 +47,7 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
SigLevel = Never SigLevel = Never
# #

View File

@@ -47,7 +47,7 @@ Architecture = auto
# the following line. This will treat any key imported into pacman's keyring as # the following line. This will treat any key imported into pacman's keyring as
# trusted. # trusted.
#SigLevel = Optional TrustAll #SigLevel = Optional TrustAll
# Disable signature checks for now # For now, off by default unless you read the above.
SigLevel = Never SigLevel = Never
# #

View File

@@ -1,21 +1,6 @@
#compdef archbuild archco archrelease archrm commitpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-i686-build=archbuild extra-x86_64-build=archbuild testing-i686-build=archbuild testing-x86_64-build=archbuild staging-i686-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-i686-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-i686-build=archbuild gnome-unstable-x86_64-build=archbuild communityco=archco #compdef archbuild archco archrelease archrm commitpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-i686-build=archbuild extra-x86_64-build=archbuild testing-i686-build=archbuild testing-x86_64-build=archbuild staging-i686-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-i686-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-i686-build=archbuild gnome-unstable-x86_64-build=archbuild communityco=archco
_arch=(i686 x86_64 any) m4_include(lib/valid-tags.sh)
_tags=(
core-i686 core-x86_64 core-any
extra-i686 extra-x86_64 extra-any
multilib-i686 multilib-x86_64 multilib-any
staging-i686 staging-x86_64 staging-any
testing-i686 testing-x86_64 testing-any
multilib-testing-i686 multilib-testing-x86_64 multilib-testing-any
multilib-staging-i686 multilib-staging-x86_64 multilib-staging-any
community-i686 community-x86_64 community-any
community-staging-i686 community-staging-x86_64 community-staging-any
community-testing-i686 community-testing-x86_64 community-testing-any
kde-unstable-i686 kde-unstable-x86_64 kde-unstable-any
gnome-unstable-i686 gnome-unstable-x86_64 gnome-unstable-any
)
_archbuild_args=( _archbuild_args=(
'-c[Recreate the chroot before building]' '-c[Recreate the chroot before building]'