Gentoo Archives: gentoo-dev

From: Daniel Campbell <zlg@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] SRC_URI="gogdownloader://..."
Date: Mon, 03 Oct 2016 00:35:42
Message-Id: bf61f64a-029c-dd39-bba0-73fe54ebb151@gentoo.org
In Reply to: [gentoo-dev] SRC_URI="gogdownloader://..." by James Le Cuirot
1 On 10/02/2016 01:48 PM, James Le Cuirot wrote:
2 > Hi guys,
3 >
4 > As the newest member of the games team, I've had a somewhat
5 > off-the-wall idea. Like many gamers, I have a sizeable collection of
6 > games purchased from GOG.com. There have been efforts to package some
7 > of these, mainly in overlays, and I'd like to see more in the tree.
8 >
9 > There are basically 3 methods for downloading their games. The first is
10 > manually from the web site. The second is via their Galaxy client,
11 > which is not yet available for Linux. The third is via their
12 > "gogdownloader" links, which were created for their older client. This
13 > client is no longer maintained but an open source alternative for Linux
14 > called LGOGDownloader is still active.
15 >
16 > GOG have not said that the gogdownloader links are going away. They
17 > have simply said that the API is subject to change, which suggests that
18 > they are also used by Galaxy. In any case, I'm sure that LGOGDownloader
19 > will adapt.
20 >
21 > So wouldn't it be great if Portage could handle these gogdownloader://
22 > URLs? Before you throw your arms up at what appears to be proprietary
23 > nonsense, rest assured that this protocol is really just HTTP with
24 > authentication via OAuth. No doubt they chose their own scheme so that
25 > these links would fire up in their own client. This benefits us too as
26 > Portage uses the scheme to determine which fetch command to use.
27 >
28 > I recently added LGOGDownloader to the tree and some initial
29 > experiments with Portage have proved fruitful. Here are the key bits of
30 > an example ebuild.
31 >
32 > SRC_URI="gogdownloader://tomb_raider_1/en1installer1 -> setup_tomb_raider_${PV}.exe"
33 > IUSE="gogdownloader"
34 > RESTRICT="!gogdownloader? ( fetch ) mirror"
35 > DEPEND="games-util/lgogdownloader"
36 >
37 > pkg_nofetch() {
38 > einfo "Please purchase and download from GOG.com, etc…"
39 > }
40 >
41 > Some of this could go into a gog eclass. I've seen one in an overlay
42 > already. Ebuilds that support non-GOG sources could put this stuff
43 > behind a gog USE flag.
44 >
45 > I thought I would need pkg_pretend but I didn't realise that Portage
46 > attempts to fetch twice, once during the parallel fetch and again at
47 > build time if the first attempt fails. This means that even though you
48 > might not have lgogdownloader the first time, you will have it because
49 > of DEPEND the second time.
50 >
51 > The problem is that you will still have to configure Portage for this
52 > protocol manually unless it is added to the stock make.globals. Could
53 > this be done? If only everyone had make.conf as a directory then I
54 > could simply drop a file in there but even I don't. Paludis has the
55 > upper hand here as it supports several locations where you can drop
56 > "fetcher" configuration files. The configuration for Portage looks like
57 > this.
58 >
59 > FETCHCOMMAND_GOGDOWNLOADER="egogdownloader --output-file \"\${DISTDIR}/\${FILE}\" --download-file \"\${URI}\""
60 > RESUMECOMMAND_GOGDOWNLOADER="egogdownloader --output-file \"\${DISTDIR}/\${FILE}\" --download-file \"\${URI}\""
61 >
62 > egogdownloader is a small wrapper script that I have attached. It
63 > obviously simplifies what is needed above but also allows users to use
64 > the tool manually if they really want.
65 >
66 > lgogdownloader writes to ${XDG_CONFIG_HOME}/lgogdownloader and doesn't
67 > include a command line option to change this but we can obviously just
68 > set XDG_CONFIG_HOME to /etc. Portage already executes fetch commands
69 > with umask 002 but I added that for manual use. This ensures the
70 > configuration will always be writeable by those in the portage group. I
71 > had to write a patch (submitted, not yet in Portage) to add an option
72 > that prevents lgogdownloader from chmoding the sensitive files to 600.
73 >
74 > So what's the < /dev/null for? We don't want lgogdownloader to prompt
75 > for input and this effectively kills that. It normally prompts for your
76 > credentials if you're not already logged in or your session has
77 > expired. This behaviour actually seems broken as logging in only seems
78 > to work properly when you explicitly perform the --login action. It
79 > doesn't matter much for us but I'll file a bug about this later. For
80 > our users, I will add a pkg_config to the lgogdownloader package. The
81 > session lasts for a year so it's not like users will need to do this
82 > often.
83 >
84 > pkg_config() {
85 > umask 002
86 > XDG_CONFIG_HOME=/etc lgogdownloader --respect-umask --login
87 > }
88 >
89 > The only questions I have right now relate to Paludis. I've never used
90 > it and don't intend to but I want to try and do the right thing. Does
91 > it use the portage group to write distfiles? If not, does anyone have
92 > an idea for how I could handle this more portably, given that I'm
93 > creating /etc/lgogdownloader with root:portage? I'm also looking for a
94 > Paludis guinea pig.
95 >
96 > Other than that, I'm just looking for feedback. Please be kind. This is
97 > very much opt-in via the gogdownloader flag so if you don't have any
98 > major technical qualms with it, don't spoil the fun. :)
99 >
100 > Cheers,
101 >
102 I like this idea, and I would probably consider buying more games for
103 GNU/Linux if Portage had better support for it and/or if we could agree
104 on the way to build game ebuilds.
105
106 I have a few games from Humble Bundle that I'm looking to package
107 (Rocketbirds, A Virus Named Tom, and Wizorb), but the drama with games
108 team vs QA makes me question whether I should bother, because there
109 isn't a suitable document that outlines how we should package games. "Do
110 it like any other package" isn't good enough advice, because games are
111 often stored in /opt or some other location and have their own set of
112 problems like bundled-libs and so on.
113
114 None of this is aimed at you specifically, chewi. I think your idea here
115 is good and I'm sure the pickier people among us can find a good way to
116 make GOG games packageable while also retaining quality ebuilds. I would
117 join you in the games team if there were docs or guidelines, or even a
118 group of people who could give solid, _constructive_ criticism on game
119 ebuilds.
120
121 --
122 Daniel Campbell - Gentoo Developer
123 OpenPGP Key: 0x1EA055D6 @ hkp://keys.gnupg.net
124 fpr: AE03 9064 AE00 053C 270C 1DE4 6F7A 9091 1EA0 55D6

Attachments

File name MIME type
signature.asc application/pgp-signature