Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
devtools
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
archlinux
devtools
Commits
4937422f
Commit
4937422f
authored
11 years ago
by
Jan Alexander Steffens (heftig)
Browse files
Options
Downloads
Patches
Plain Diff
makechrootpkg: Split out chrootbuild into a function
Now syntax highlighting works properly! :D
parent
4dcdbcaf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
makechrootpkg.in
+42
-28
42 additions, 28 deletions
makechrootpkg.in
with
42 additions
and
28 deletions
makechrootpkg.in
+
42
−
28
View file @
4937422f
...
@@ -237,34 +237,8 @@ EOF
...
@@ -237,34 +237,8 @@ EOF
# This is a little gross, but this way the script is recreated every time in the
# This is a little gross, but this way the script is recreated every time in the
# working copy
# working copy
cat
>
"
$copydir
/chrootbuild"
<<
EOF
printf
$'#!/bin/bash
\n
%s
\n
_chrootbuild %q %q'
"
$(
declare
-f
_chrootbuild
)
"
\
#!/bin/bash
"
$makepkg_args
"
"
$run_namcap
"
>
"
$copydir
/chrootbuild"
. /etc/profile
export HOME=/build
shopt -s nullglob
# Workaround makepkg disliking read-only dirs
ln -sft /srcdest /srcdest_host/*
ln -sft /startdir /startdir_host/*
# Keep PKGBUILD writable for pkgver()
rm /startdir/PKGBUILD*
cp /startdir_host/PKGBUILD* /startdir
chown nobody /startdir/PKGBUILD*
cd /startdir
sudo -u nobody makepkg
$makepkg_args
|| exit 1
if
$run_namcap
; then
pacman -S --needed --noconfirm namcap
for pkgfile in /startdir/PKGBUILD /pkgdest/*; do
echo "Checking
\$
{pkgfile##*/}"
sudo -u nobody namcap "
\$
pkgfile" 2>&1 | tee "/logdest/
\$
{pkgfile##*/}-namcap.log"
done
fi
exit 0
EOF
chmod
+x
"
$copydir
/chrootbuild"
chmod
+x
"
$copydir
/chrootbuild"
}
}
...
@@ -287,6 +261,46 @@ download_sources() {
...
@@ -287,6 +261,46 @@ download_sources() {
rm
-rf
$builddir
rm
-rf
$builddir
}
}
_chrootbuild
()
{
# This function isn't run in makechrootpkg,
# so no global variables
local
makepkg_args
=
"
$1
"
local
run_namcap
=
"
$2
"
.
/etc/profile
export
HOME
=
/build
shopt
-s
nullglob
# Workaround makepkg disliking read-only dirs
ln
-sft
/srcdest /srcdest_host/
*
ln
-sft
/startdir /startdir_host/
*
cd
/startdir
# Keep PKGBUILD writable for pkgver()
rm
PKGBUILD
*
cp
/startdir_host/PKGBUILD
*
.
chown
nobody PKGBUILD
*
# Safety check
if
[[
!
-w
PKGBUILD
]]
;
then
echo
"Can't write to PKGBUILD!"
exit
1
fi
sudo
-u
nobody makepkg
$makepkg_args
||
exit
1
if
$run_namcap
;
then
pacman
-S
--needed
--noconfirm
namcap
for
pkgfile
in
/startdir/PKGBUILD /pkgdest/
*
;
do
echo
"Checking
${
pkgfile
##*/
}
"
sudo
-u
nobody namcap
"
$pkgfile
"
2>&1 |
tee
"/logdest/
${
pkgfile
##*/
}
-namcap.log"
done
fi
exit
0
}
move_products
()
{
move_products
()
{
for
pkgfile
in
"
$copydir
"
/pkgdest/
*
;
do
for
pkgfile
in
"
$copydir
"
/pkgdest/
*
;
do
chown
"
$src_owner
"
"
$pkgfile
"
chown
"
$src_owner
"
"
$pkgfile
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment