Discussion:
[Gnewsense-dev] How to write a gen script
Sam Geeraerts
2017-12-26 22:15:12 UTC
Permalink
I've assigned the task for apt [1] to myself. I wrote part of the
gen-script [2] and annotated it with comments to make it more clear what
the intention is. Let's walk through it.

Apt has 2 issues: it should have an example sources.list for gNewsense
and it points users to the non-free component of the packages
repository (which we don't have of course). I wrote some code to fix
the first issue.

A gen-script starts by reading Builder's configuration. This lives in a
file called config. It contains most of the variables that are needed
to turn Debian into gNewSense, e.g. the name of the distribution
("gNewSense"). You can override these values using a file called
config.local. This is read by config. I've attached a small
config.local. It contains more than necessary, but I wanted to show all
the variables that are used in the apt script.

The script then flushes the working folder and downloads the source
package. That automatically unpacks it to a folder called
apt-1.0.9.8.4. It installs all the packages that are needed to build
apt and then descends into the unpacked source.

The steps so far are the same for any gen-script. After that the real
work starts.

The vendor specific information lives in the "vendor" folder. You can
follow along with Debian's Git web interface [3]. There we create a
"gnewsense" folder and add files "apt-vendor.ent" and
"sources.list.in". The first sets some information about repository
keyrings. The second is an example sources.list file. Both are created
using a here file.

Then we add a new entry to the package's changelog (debian/changelog).
This is what the dch command is for. We give it the name of our release
using option -D. We also extract the last used version string and
extend it with our own. So "1.0.9.8.4" becomes "1.0.9.8.4gnewsense1".
In the comment we give a short description of the change we made.

Then finally the package gets built.

You can run a gen-script without the rest of Builder. A minimal setup
would have gen-apt, config and config.local. The config.local file
should at least contain the DPKGOPTS line. You should make sure BASEDIR
exists. Then you should be able to run the gen-script as root on a
Jessie system. I've not yet tested my script, but you can already try
it to give you an idea of what it does.

I hope this clarified how gen-scripts work. If there are any questions,
please ask. I would love to see some of you trying this out for
yourself.

[1] https://savannah.nongnu.org/task/index.php?14784
[2]
http://bzr.savannah.gnu.org/lh/gnewsense/builder_samgee/view/head:/gen-apt
[3] https://anonscm.debian.org/cgit/apt/apt.git/tree/?h=debian/jessie
l***@riseup.net
2018-03-31 09:15:11 UTC
Permalink
Hi Samgee,

Great work, thanks for the examples.

I fetched your gen-apt script and tried running it,
also tried to run the other gen-scripts.
But the scripts fail.

- your gen-apt needed -p flag to mkdir the VENDOR folder.

- warning: specified GNU system type i486-linux-gnu
does not match gcc system type x86_64-linux-gnu,
try setting a correct CC environment variable
dpkg-buildpackage: host architecture i386

why is it building for i486?
It is just a warning it does not stop the script i think.

- Unmet build dependencies: libdb-dev gettext (>= 0.12)
libcurl4-gnutls-dev (>= 7.19.4~) zlib1g-dev libbz2-dev

This stops the script,
the apt-get build-deps stated nothing needed to be installed.
if i run dpkg-buildpackage with -d flag it fails a bit later not
finding dependency files
the other gen-scripts give me similar results, missing dependencies.



Any help is welcome :)
greetings,

lordeddi
Post by Sam Geeraerts
I've assigned the task for apt [1] to myself. I wrote part of the
gen-script [2] and annotated it with comments to make it more clear what
the intention is. Let's walk through it.
Apt has 2 issues: it should have an example sources.list for gNewsense
and it points users to the non-free component of the packages
repository (which we don't have of course). I wrote some code to fix
the first issue.
A gen-script starts by reading Builder's configuration. This lives in a
file called config. It contains most of the variables that are needed
to turn Debian into gNewSense, e.g. the name of the distribution
("gNewSense"). You can override these values using a file called
config.local. This is read by config. I've attached a small
config.local. It contains more than necessary, but I wanted to show all
the variables that are used in the apt script.
The script then flushes the working folder and downloads the source
package. That automatically unpacks it to a folder called
apt-1.0.9.8.4. It installs all the packages that are needed to build
apt and then descends into the unpacked source.
The steps so far are the same for any gen-script. After that the real
work starts.
The vendor specific information lives in the "vendor" folder. You can
follow along with Debian's Git web interface [3]. There we create a
"gnewsense" folder and add files "apt-vendor.ent" and
"sources.list.in". The first sets some information about repository
keyrings. The second is an example sources.list file. Both are created
using a here file.
Then we add a new entry to the package's changelog (debian/changelog).
This is what the dch command is for. We give it the name of our release
using option -D. We also extract the last used version string and
extend it with our own. So "1.0.9.8.4" becomes "1.0.9.8.4gnewsense1".
In the comment we give a short description of the change we made.
Then finally the package gets built.
You can run a gen-script without the rest of Builder. A minimal setup
would have gen-apt, config and config.local. The config.local file
should at least contain the DPKGOPTS line. You should make sure BASEDIR
exists. Then you should be able to run the gen-script as root on a
Jessie system. I've not yet tested my script, but you can already try
it to give you an idea of what it does.
I hope this clarified how gen-scripts work. If there are any questions,
please ask. I would love to see some of you trying this out for
yourself.
[1] https://savannah.nongnu.org/task/index.php?14784
[2]
http://bzr.savannah.gnu.org/lh/gnewsense/builder_samgee/view/head:/gen-apt
[3] https://anonscm.debian.org/cgit/apt/apt.git/tree/?h=debian/jessie
_______________________________________________
gNewSense-dev mailing list
https://lists.nongnu.org/mailman/listinfo/gnewsense-dev
Sam Geeraerts
2018-04-02 09:05:29 UTC
Permalink
Op Sat, 31 Mar 2018 11:15:11 +0200
Post by l***@riseup.net
- your gen-apt needed -p flag to mkdir the VENDOR folder.
Hm, it works without -p for me. Upstream apt already has the vendor/
folder and we just make a gnewsense/ folder below that.
Post by l***@riseup.net
- warning: specified GNU system type i486-linux-gnu
does not match gcc system type x86_64-linux-gnu,
try setting a correct CC environment variable
dpkg-buildpackage: host architecture i386
why is it building for i486?
It is just a warning it does not stop the script i think.
See config.auto. It defaults to building for i386. Add

BUILDARCH=amd64

to your config.local if your building for 64-bit. That also solves the
build dependency problem.
l***@riseup.net
2018-04-07 12:45:08 UTC
Permalink
Hi,

Thanks,
the buildarch setting did the trick, i missed it in the config.auto.
maybe it can become a setting in the config/config.local?

I will take a look at apt-setup and create a gen-script for it.

Thanks again,

lordeddi
Post by Sam Geeraerts
Op Sat, 31 Mar 2018 11:15:11 +0200
Post by l***@riseup.net
- your gen-apt needed -p flag to mkdir the VENDOR folder.
Hm, it works without -p for me. Upstream apt already has the vendor/
folder and we just make a gnewsense/ folder below that.
Post by l***@riseup.net
- warning: specified GNU system type i486-linux-gnu
does not match gcc system type x86_64-linux-gnu,
try setting a correct CC environment variable
dpkg-buildpackage: host architecture i386
why is it building for i486?
It is just a warning it does not stop the script i think.
See config.auto. It defaults to building for i386. Add
BUILDARCH=amd64
to your config.local if your building for 64-bit. That also solves the
build dependency problem.
_______________________________________________
gNewSense-dev mailing list
https://lists.nongnu.org/mailman/listinfo/gnewsense-dev
Sam Geeraerts
2018-04-07 19:52:44 UTC
Permalink
Op Sat, 7 Apr 2018 14:45:08 +0200
Post by l***@riseup.net
the buildarch setting did the trick, i missed it in the config.auto.
maybe it can become a setting in the config/config.local?
Or make it dynamic using uname -m.
Post by l***@riseup.net
I will take a look at apt-setup and create a gen-script for it.
Ok, I've assigned the task [1] to you.

[1] https://savannah.nongnu.org/task/index.php?14785
l***@riseup.net
2018-04-14 09:36:52 UTC
Permalink
hi,

i just pushed a refactor of builder to debian jessie.
normally it should run with only 1 error, debian-installer's empty
Packages.gz is never fetched using debmirror.
i am still looking into this
for now downloading that file manualy does the trick.

thanks

eddi
Post by Sam Geeraerts
Op Sat, 7 Apr 2018 14:45:08 +0200
Post by l***@riseup.net
the buildarch setting did the trick, i missed it in the config.auto.
maybe it can become a setting in the config/config.local?
Or make it dynamic using uname -m.
i'll check that
Post by Sam Geeraerts
Post by l***@riseup.net
I will take a look at apt-setup and create a gen-script for it.
Ok, I've assigned the task [1] to you.
appreciated thanks.
Post by Sam Geeraerts
[1] https://savannah.nongnu.org/task/index.php?14785
_______________________________________________
gNewSense-dev mailing list
https://lists.nongnu.org/mailman/listinfo/gnewsense-dev
Loading...