Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 21544 - Repoman doesn't detect no IUSE variable
Summary: Repoman doesn't detect no IUSE variable
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 49929 54525 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-23 07:54 UTC by Tom Payne (RETIRED)
Modified: 2004-08-16 10:44 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
2.0.51-cache fix, and key/value flat cache format (portage-2.0.51_pre7-cache-fix.patch,13.99 KB, patch)
2004-05-12 00:02 UTC, Brian Harring (RETIRED)
Details | Diff
portage-2.0.51_pre7-cache-adjustments.patch (portage-2.0.51_pre7-cache-fix-optimization.patch,18.85 KB, patch)
2004-05-21 12:08 UTC, Brian Harring (RETIRED)
Details | Diff
.51_pre10 updated, w/ autodetect metacache class (cache.patch,28.92 KB, patch)
2004-06-04 14:57 UTC, Brian Harring (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Payne (RETIRED) gentoo-dev 2003-05-23 07:54:24 UTC
According to policy, IUSE must always be set in ebuilds. Repoman does not detect
ebuilds that don't set IUSE.

Tom
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2003-06-29 22:08:58 UTC
It can't really figure that out... Bash sets up IUSE, so it's treated as a
bash variable... Which is almost always defined regardless if how to read it.
Comment 2 SpanKY gentoo-dev 2003-07-18 15:20:30 UTC
IUSE is not mentioned in policy 
Comment 3 Tom Payne (RETIRED) gentoo-dev 2003-07-19 03:36:51 UTC
It's in:

http://www.gentoo.org/doc/en/gentoo-howto.xml

In this document: Contents of an ebuild File / 1. Variable Settings:

IUSE 	This is set to what USE variables your package uses. If your package uses none, you must set it to IUSE="" .

This would be a docs bug if IUSE is not actually required -- if so please reopen and reassign to docs.

Regards,

Tom
Comment 4 SpanKY gentoo-dev 2003-07-19 13:39:26 UTC
that is a howto ebuilds, not policy ;) 
 
and yes, i'm redoing the docs 
Comment 5 Marius Mauch (RETIRED) gentoo-dev 2004-04-06 04:02:58 UTC
IUSE is required -> reopening
Comment 6 Masatomo Nakano (RETIRED) gentoo-dev 2004-04-10 09:23:05 UTC
Added a IUSE missing check in cvs
Comment 7 Brian Harring (RETIRED) gentoo-dev 2004-05-01 01:22:27 UTC
The repoman IUSE check is broken for 2.0.51_pre7; specifically, it checks to see if the variable is empty, rather then if it's defined.

So, using net-www/dansguardian as an example, repoman scan will flag IUSE.missing for 2.7.6 and 2.7.1, even though IUSE _has_ been defined.

If I recall correctly, aux_get used to throw a key exception when trying to access a missing key- would be useful now, although that behaviour seems to have changed.
Comment 8 Masatomo Nakano (RETIRED) gentoo-dev 2004-05-01 05:49:52 UTC
I noticed that and I'm fixing it now..
Comment 9 Brian Harring (RETIRED) gentoo-dev 2004-05-07 22:30:36 UTC
*** Bug 49929 has been marked as a duplicate of this bug. ***
Comment 10 Brian Harring (RETIRED) gentoo-dev 2004-05-12 00:02:46 UTC
Created attachment 31241 [details, diff]
2.0.51-cache fix, and key/value flat cache format

This patch adjusts 3 areas to enable the missingvars repoman check to work
correctly-

A) ebuild.sh gives no indication if a variable was set, or is just null.  The
ebuild.sh modifications now outputs VARNAME=value pairs for dbkey; this removes
the requirement that the exported dbkey's variable order is the same as what
portage thinks it is (ancillary benefit), but mainly is a way of detecting if a
variable wasn't defined (if it's not defined, then ebuild.sh doesn't output
that variables pair).

B) moved the UNUSED_* auxdbkeys into a specific portage_db database- this frees
up portage to reorder auxdbkeys internally (and not maintain UNUSED_0-8 slots),
requiring portage_db_metacache to maintain the appropriate order/parsing. 
Changed the default textual cache file to portage_db_flat_hash , storing data
in KEY=value pairs.  Since portage_db_* just returns a dict for get_values, and
lets aux_get fill in the blanks- this isn't a change in aux_get's behaviour,
since it previously returned "" for unknown auxdbkey requests.

C) Took advantage of the strict parameter of aux_get- if an aux_get request is
made w/ strict enabled, it returns None for unknown auxdbkeys.	If strict isn't
set, then it returns "" for that requested variable.
Comment 11 Brian Harring (RETIRED) gentoo-dev 2004-05-12 00:18:02 UTC
Few additionals- the text hash cache format I added a .th extension to keep the original dbkeys-layout  flat cache files from getting uses w/ the text hash files.

It ought to be possible to create a portage_db_flat_automatic.database that detects if the cache is hash, or the older format- this would be useful for the current metacache.  If we switch the metacache format to an autodetect flatfile database, we maintain backwards compatability with the current format, but enable support *now* for later on using a hash metacache format, which eliminates a lot of issues w/ backwards compatability and the ordering/addition of variables.
This ^^^ is debatable, and likely quite flamable :)

Worth noting the repoman fix will not detect missing vars if the cache file is the current text format, or if the cache entry was imported from the current text format (eg, emerge metadata).
There isn't any way to detect if the variable was null, or undefined w/out rerunning ebuild.sh ebuild depend.

Also worth noting that a fix could be created just by changing 
echo `echo $DEPEND` >> $depkey
into
echo `echo ${DEPEND-unset}` >> $depkey
I didn't go that route, since it requires aux_get to identify the unset value, and treat it differently.  That route seemed a bit more prone to errors then just going key/value route.
Comment 12 Brian Harring (RETIRED) gentoo-dev 2004-05-21 12:08:25 UTC
Created attachment 31803 [details, diff]
portage-2.0.51_pre7-cache-adjustments.patch

Updated the patch, since it had a bug in ebuild.sh related to IUSE assignment-
dumb typo, IUSE="$IUSE E_IUSE" when it should've been IUSE="$IUSE $E_IUSE".

Made a few tweaks in aux_get beyond what earlier comments mentioned- basically,
aux_get pulls the keys from the cache (and/or regenerates those keys via
ebuild.sh), and stores them in a local cache for the function call duration.

It still updates the caches as needed, just uses the local dict rather then
going to disk every time a value is accessed.  Basically,
pkg_dict['desired_value"] rather then
self.auxdb[loc][cat][pkg]["desired_value"]

Seems to speed things up a nicely- pretty much an aux_get call now is typically
a single read (possible write if the cache is stale).
Comment 13 Brian Harring (RETIRED) gentoo-dev 2004-06-04 14:57:16 UTC
Created attachment 32659 [details, diff]
.51_pre10 updated, w/ autodetect metacache class

Fix- long standing issues w/ vardbapi.lock_held being left on when aux_get's
doebuild depend call fails- easy way to test/verify this, intentionally leave a
quote open in an ebuild, run emerge regen, and watch portage fail for *every*
ebuild after the broken ebuild.

I can't see any reason to leave the lock on since we were already unlock'ing
the dbkey file, so this patch also unlocked the vardbapi instance when bailing
from aux_get.

Meanwhile, reworked the patch.	threw out portage_db_flat_template, leaving
portage_db_metacache and portage_db_flat_hash.
portage_db_metacache is an autodetect class- since the extension for flat_hash
is different then the old flat format (addition of .th), autodetect first
checks for the new hash format, then the old format, importing in that order.

The current auxdbkeys (minus UNUSED_0*) has been copied into
portage_db_metadata- it's the modules responsibility to keep the order correct
now.
Also, added an addition to emerge metadata that checks for metadata/cache_keys;
cache_keys defines the keys that are used w/in the cache (eg, provide, iuse,
src_uri)- if the users portage.auxdbkeys defines keys that the
metadata/cache_keys lacks, then no point in trying to transfer metadata.

This actually is kind of needed since when the metacache is moved to flat_hash,
there isn't a way to detect removal of keys- basically an older client could
expect XYZ to be exported, but in the current metacache it's been removed.  The
emerge patch catches this condition, outputting an appropriate statement.

Aside from that, adjusted portage_util.grabdict/writedict so you can specify
the key/value seperator used, remove portage.py's versions of those functions,
and have portage just importing the functions from portage_util.
Comment 14 Jason Stubbs (RETIRED) gentoo-dev 2004-06-20 08:34:23 UTC
*** Bug 54525 has been marked as a duplicate of this bug. ***
Comment 15 Masatomo Nakano (RETIRED) gentoo-dev 2004-06-20 13:59:07 UTC
ferringb,

I've just fixed the problem by another solution in CVS.

I think your patch is better than mine. (ex. Your patch considers inherit but mine donen't)
But I don't have a time to look at your patch for now because your patch is big and modifying some files.
We would rewrite repoman for portage API and could use your patch at the time.
Comment 16 Brian Harring (RETIRED) gentoo-dev 2004-08-16 10:44:02 UTC
Closing in the meantime.
The patch above A) killed off the IUSE issues, but also optimized the cache, and added a textual hash format (good for mirrors).

I'll push for it later, as is the repoman fix is in.