Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deptarget = prereqs #14

Open
laaber opened this issue Sep 23, 2017 · 2 comments
Open

deptarget = prereqs #14

laaber opened this issue Sep 23, 2017 · 2 comments
Assignees

Comments

@laaber
Copy link

laaber commented Sep 23, 2017

Hi,
when running with DEPTARGET=PREREQS only .info-files with a PREREQS= line are considered when running build_dicts().
I'm not sure if this is intended behaviour, is it?

Reproduction:
on a new SBo repo run "hoorex -d -f". Around 2000 packages are found.
Running "DEPTARGET=PREREQS hoorex -d -f" results in zero packages.
Now add a PREREQS-line to any package and re-run the above command.

Patch:

diff --git a/hoorex b/hoorex
index 0829d69..06c15a2 100755
--- a/hoorex
+++ b/hoorex
@@ -353,6 +353,20 @@ def build_dicts(sbo_path, PkgData, deptarget='REQUIRES'):
                             DirectRequires[pkgname].remove('%README%')
                         except:
                             pass
+                    else:
+                        n = reg_requires.search(txt)
+			if n:
+                            value = ''
+                            if n.group('value'):
+                                # Remove line continuation backslashes
+                                value = n.group('value').replace('\\', '')
+                            hlog.debug("Adding %s ----- (%s)" % (pkgname, value))
+                            PkgCategory[pkgname] = category
+                            DirectRequires[pkgname] = value.split()
+                        try:
+                            DirectRequires[pkgname].remove('%README%')
+                        except:
+                            pass
 
     #print
     hlog.debug("Step 1 done - %d entries" % len(DirectRequires))

This works for me so far, but I didn't test it in depth.

And maybe it is possible to set the repoData filename and PREREQS==True from the config file? So we can have two config files, one with prereqs and one without them. I have to admid, I'm not sure if this would be useful.

Thanks for the tool and enjoy the weekend :)
Dennis

@cwilling
Copy link
Owner

cwilling commented Sep 24, 2017

Thanks for your input Dennis.

Yes the intended behaviour is to consider only those .info files which have an entry matching the DEPTARGET's value (or "REQUIRES" if DEPTARGET isn't explicitly set).

To include packages from REQUIRES entries when DEPTARGET is explicitly set (for instance to PREREQS), I include the REQUIRES values in my PREREQS entry e.g.

 PREREQS="abc def ghi $REQUIRES"

which means that PREREQS defines the need for packages abc, def and ghi as well as any other packages already specified by the REQUIRES entry.

About the two config files, I already have this same need myself. I started work on it but ran out of steam and then forgot about it. I have a workaround though and that is to keep the config files for the different DEPTARGETs in different places using the -p option to specify a path (for the DEPTARGET=REQUIRES option in my case). The downside of this is that the command itself becomes a bit unwieldy (and also requires remembering the non-default location each time) e.g. first

DEPTARGET=REQUIRES hoorex -f -p /var/cache/vmbuilder/.hoorex/

then

DEPTARGET=REQUIRES hoorex -l1 speex -p /var/cache/vmbuilder/.hoorex/

However since I only use this form via a higher level building/packaging script, it doesn't really concern me.

A maybe better future solution, allowing multiple config files to be kept in the same directory, would be to name them according to their DEPTARGET e.g. repoData.REQUIRES, repoData.PREREQS, repoData.XYZ etc.

Any comments?

@laaber
Copy link
Author

laaber commented Sep 26, 2017

Hey Chris,

thanks for taking the time to explain.

To stay with your example, setting
PREREQS="abc def ghi $REQUIRES"
would also require
PREREQS=""
in packages abc, def and ghi. That's where I got confused, thanks for clarification.

For the config files: yes, that naming scheme looks perfect.

Dennis

@cwilling cwilling self-assigned this Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants