[pacman-dev] [PATCH v2 1/2] makepkg: add internal variable to track when we're building a package

Eli Schwartz eschwartz at archlinux.org
Tue Nov 27 15:46:43 UTC 2018


On 11/27/18 6:33 AM, Allan McRae wrote:
> On 14/11/18 11:55 am, Eli Schwartz wrote:
>> There are state variables for everything else, and we use them to do
>> conditional checks on things, but it's currently a bit difficult to test
>> whether a package is being built, as it's the default action if *no*
>> options are specified.
>>
>> Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
>> ---
>>
>> This makes the next patch simpler, and will be reused in some patches I
>> intend to submit in the future.
>>
>>  scripts/makepkg.sh.in | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 3ac03d11..be8b761e 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -59,6 +59,7 @@ known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512')
>>  # Options
>>  ASDEPS=0
>>  BUILDFUNC=0
>> +BUILDPKG=1
>>  CHECKFUNC=0
>>  CLEANBUILD=0
>>  CLEANUP=0
>> @@ -1256,7 +1257,7 @@ while true; do
>>  		--noprogressbar)  PACMAN_OPTS+=("--noprogressbar") ;;
>>  
>>  		# Makepkg Options
>> -		--allsource)      SOURCEONLY=2 ;;
>> +		--allsource)      BUILDPKG=0 SOURCEONLY=2 ;;
>>  		-A|--ignorearch)  IGNOREARCH=1 ;;
>>  		-c|--clean)       CLEANUP=1 ;;
>>  		-C|--cleanbuild)  CLEANBUILD=1 ;;
>> @@ -1267,7 +1268,7 @@ while true; do
>>  		-f|--force)       FORCE=1 ;;
>>  		-F)               INFAKEROOT=1 ;;
>>  		# generating integrity checks does not depend on architecture
>> -		-g|--geninteg)    GENINTEG=1 IGNOREARCH=1;;
>> +		-g|--geninteg)    BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;;
>>  		--holdver)        HOLDVER=1 ;;
>>  		-i|--install)     INSTALL=1 ;;
>>  		--key)            shift; GPGKEY=$1 ;;
>> @@ -1279,8 +1280,8 @@ while true; do
>>  		--nosign)         SIGNPKG='n' ;;
>>  		-o|--nobuild)     NOBUILD=1 ;;
> 
> BUILDPKG=0

My rationale here was that running source extraction, prepare() and
pkgver() are part of the general category of building a package -- and
if you use --nobuild, I expect you're likely going to use --noextract
shortly after.

e.g. in followup patches I would like to check whether (( BUILDPKG ||
SOURCEONLY == 2 || VERIFYSOURCE )) to determine if we should check for
vcs software, or || ( BUILDPKG && !SKIPCHECKSUMS ) as a modification to
checking for the checksum binaries.

>>  		-p)               shift; BUILDFILE=$1 ;;
>> -		--packagelist)    PACKAGELIST=1 IGNOREARCH=1;;
>> -		--printsrcinfo)   PRINTSRCINFO=1 IGNOREARCH=1;;
>> +		--packagelist)    BUILDPKG=0 PACKAGELIST=1 IGNOREARCH=1;;
>> +		--printsrcinfo)   BUILDPKG=0 PRINTSRCINFO=1 IGNOREARCH=1;;
>>  		-r|--rmdeps)      RMDEPS=1 ;;
>>  		-R|--repackage)   REPKG=1 ;;
>>  		--sign)           SIGNPKG='y' ;;
>> @@ -1289,7 +1290,7 @@ while true; do
>>  		--skippgpcheck)   SKIPPGPCHECK=1;;
>>  		-s|--syncdeps)    DEP_BIN=1 ;;
>>  		-S|--source)      SOURCEONLY=1 ;;
> 
> BUILDPKG=0

Will fix once I'm sure how to handle the above case.

>> -		--verifysource)   VERIFYSOURCE=1 ;;
>> +		--verifysource)   BUILDPKG=0 VERIFYSOURCE=1 ;;
>>  
>>  		-h|--help)        usage; exit $E_OK ;;
>>  		-V|--version)     version; exit $E_OK ;;
>>

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20181127/f5767476/attachment.asc>


More information about the pacman-dev mailing list