Jump to content

Under the hood


tforsman

Recommended Posts

Please do NOT reply to this thread. Use the

discussion thread for comments. This thread is being managed as a tutorial. Thank you. ~Eric

The topic reveals a little.I know some users in here love to dig under the hood in their Linux OS. So this is exactly what we will look into little deeper in Foresight Linux and Conary.Lets look how we create a package from scratch (even with creating accounts).If you didnt use development iso to install FL, you might need to install devel packages. Just install this group and you are on the way:

sudo conary update group-gnome-dist-devel

1: create an account at: Rbuilder online (rpath) + seems to hard to reach at the moment. (poked the rpath guys about it)create a own repo, with an easy label.Guide to setup a personal repo here: https://github.com/zhangsen/fldev/wiki/how-...onal-repository (more info in there about create the rpath account and info, + more)2: Create ~.conaryrc and ~.rmakerc filesconaryrc: first 3 lines is personal info, 3 line is the nick and pass from Rbuilder online.Line 8 is the name we will use as a context. So conary knows what label we want to use. Easy to specify multiple labels to create packages for.Line 9 is the repo name i created in section 1 with the label @fl:2.Line 10 is the repo I want to use for the packages i creating for. Like those repo have buildreqs for anything i build online.rmakercline 4,5,6 is the info we adds manually.line 4: is context, that points out what repo we want to use.line 5: make sure troves get resolvedline 6: what buildlabel i plan to use. Same repo name we created in rbuilder online.these 2 aren't needed if I plan to build a local package only. This is only needed for creating a package for you to easily use on several computers and share with other FL users.Also can be private repo, that you can specify that only users you want to get access, get access to it. (can be good for stuff that you own and so on)So far: created an account and created a repo. Created .conaryrc and .rmakerc files.now its time to create a folder in computer where we should work in. Open up Terminal and write:

mkdir -p ~/conary/personal

cd conary/personal

Time to point out the context:

cvc context gameway

The context name can be anything, just make sure it's the same context name in rmakerc and conaryrc file and the context we just pointed out in "personal" folder.all done. Time to create the package from scratch:We still are in "personal" folder and write:

cvc newpkg --template=binary spotify

cvc newpkg = telling conary to create a new package.--template=binary = use a template recipe called binaryspotify = the name of the package we want to create.That will create a folder in personal folder called spotify, will have 2 files: CONARY and spotify.recipeWe are interested in spotify.recipelets open it with gedit or something similar.as i know where spotify packages are located, i specify package location, and change dir to / instead. As rpm and deb files should go into that directory to go in to right places in Foresight. (and yes, conary can do packages from rpm and deb too)And we add a version number, then save the file.Back to terminal:

cd spotify

Time to cook the recipe.

cvc cook spotify.recipe

-This happens-After the cook are done, we need to add the buildreqs, they are written for you already from cvc cook..warning: Suggested buildRequires additions: ['binutils:runtime', 'desktop-file-utils:runtime']we add them in spotify.recipeNow we can test the package out:

sudo conary update spotify-0.4.8.306.ccs

if we hate it, uninstall or rollback:

sudo conary erase spotify

All done testing it.Now V.T. Eric Layton want to try it.Well im a nice dude and share my unique package with him then :yes: Back to terminal in spotify folder:

cvc ci -m "spotify client"

ci = commit-m = message and the message of the source gets written afterwards.you see something similar:The following commits will be performed: spotify:source=/gameway.rpath.org@fl:2/1.1-1continue with commit? [Y/n] push enter.Now the recipe and source file are online on rbuilder.time to make a online package.Doesn't mather where you are in terminal and write:

rmake build --context gameway spotify{{x86,x86_64}}

rmake build = build onlione--context gameway = says to look for gameway in rmakerc file and build against that repo.spotify{{x86,x86_64}} = package spotify and 32bit and 64bit. (as i got 64bit computer with fl 64bit, can build both)now you see this:

Added Job 821  spotify:source=gameway.rpath.org@fl:2/1.1-1[14:32:23] Watching job 821			[14:32:25] [821] Downloading 1 recipes...[14:32:26] [821] Loading 1 out of 2: spotify:source[14:32:29] [821] Downloading 1 recipes...[14:32:29] [821] Loading 2 out of 2: spotify:source[14:32:30] [821] - State: Loaded	   [14:32:31] [821] - job troves set		 [14:32:31] [821] - State: Building				 [14:32:31] [821] - Building troves				 [14:32:32] [821] - spotify:source{x86} - State: Queued[14:32:32] [821] - spotify:source{x86_64} - State: Queued[14:32:32] [821] - spotify:source{x86} - State: Resolving[14:32:32] [821] - spotify:source{x86_64} - State: Resolving[14:32:58] [821] - spotify:source{x86} - State: Queued[14:32:59] [821] - spotify:source{x86_64} - State: Queued[14:32:59] [821] - spotify:source{x86} - State: Creating Chroot[14:32:59] [821] - spotify:source{x86_64} - State: Creating Chroot[14:33:40] [821] - spotify:source{x86_64} - State: Building [14:33:41] [821] - spotify:source{x86} - State: Building	[14:34:05] [821] - spotify:source{x86_64} - State: Built	[14:34:07] [821] - spotify:source{x86} - State: Built[14:34:07] [821] - State: Built					  [14:34:07] [821] - build job finished successfully

push Q to be able to write in terminal again.now time to send the built online files to my repo:

rmake ci 821

you see something like:

[tforsman@fdev ~]$ rmake ci 821Creating database transaction (10 of 10)							  Committed job 821:	spotify:source=/gameway.rpath.org@fl:2/1.1-1[is: x86(~cmov,~i486,~i586,~i686,~mmx,~nx,~sse,~sse2)]{x86} ->	   spotify=/gameway.rpath.org@fl:2/1.1-1-1[is: x86]	spotify:source=/gameway.rpath.org@fl:2/1.1-1[is: x86_64(~3dnow,~3dnowext,~nx)]{x86_64} ->	   spotify=/gameway.rpath.org@fl:2/1.1-1-1[is: x86_64]

to get V.T. Eric Layton to install it in his computer:

sudo conary update spotify=gameway.rpath.org@fl:2

to get him to update to later version later on: sudo conary updateall (as it will be auto updated with the rest of computer)to uninstall it: sudo conary erase spotifyTook longer to write this than i thought :)Hope its readable :hysterical:Edit 01: added info about install group-gnome-dist-develEdit 02: Added link: https://github.com/zhangsen/fldev/wiki/how-...onal-repository

Edited by tforsman
Link to comment
Share on other sites

Conary can make packages of almost anything :)deb, rpm, source, files, .sh, .zip and so on.So i choosed to use a .deb in above post to see how easy it is to make a package were the source isnt available or a binary package.How to update a package that are available in foresight already?open terminal:

cvc co scribus

that will create a scribus folder in your home folder with scribus.recipeopen it, change version number to latest.

cd scribus

cvc cook scribus.recipe

sudo conary update scribus-1.3.8-1.ccs

done locally.if you want to use it in your personal online repo.go to your personal folder and type:

cvc newpkg scribus

copy in scribus.recipe to newly created /personal/scribus folderand do as i explained in first post.can't do cvc co scribus in your personal folder, as scribus dont have your context, only gets the context when creating new packages.very easy to update stuff.

Edited by tforsman
Link to comment
Share on other sites

Different Recipe Templates

When we create new packages, we can use a template to get started faster.When we use: cvc newpgk --template=*** packagenameWe can use these ones:binarycpanforesightgnomejavapythonrpm (need to be added little more info)rubysvnI always start out from foresight recipe and modify it after the needs of the package.I also usually grab all recipes thats in foresight repo with this command:

conary rq --verbose --install-label foresight.rpath.org@fl:2-devel | grep :source | time xargs -tL 100 cvc co

Before i run that command, i made sure i created a foresight folder first. like ~/conary/foresightAnd then run it in there.That way I get all foresight recipes, when it's done, i use fgrep to get info from what im looking for. Like:

fgrep remove */*.recipe

i get hits like:netpbm/netpbm.recipe: r.Remove('%(libdir)s/lib*.a')gtk/gtk.recipe: r.Remove('%(sysconfdir)s/gtk-2.0/gtk.immodules')f-spot/f-spot.recipe: r.Remove('%(libdir)s/pkgconfig/f-spot.pc')That gives me the info how i can remove files from a package that shoulden't be in the package for users.Also i see what recipe the info is in. So that way I can find related info and get it to work.

Link to comment
Share on other sites

Check out installed Packages

When we installed a package, we might want to know what files it installed, we then use:

[TForsman@localhost ~]$ conary q spotify --ls/usr/share/applications/spotify.desktop/usr/share/pixmaps/spotify-linux-512x512.png/usr/share/spotify/licenses.xhtml/usr/share/spotify/theme/default/add-button.png/usr/share/spotify/theme/default/album-multidisc_indicator.png/usr/share/spotify/theme/default/album-version_group-bg.png/usr/share/spotify/theme/default/album-version_group-div.png/usr/share/spotify/theme/default/alert_message-flag.png/usr/share/spotify/theme/default/bar-bright-button.png/usr/share/spotify/theme/default/biography-image_border.png/usr/share/spotify/theme/default/button-disabled.png/usr/share/spotify/theme/default/button-down.png/usr/share/spotify/theme/default/button-mini-disabled.png.........

To check out which troves we got installed from a package:

[TForsman@localhost ~]$ conary q spotify --trovesspotify=foresight.rpath.org@fl:2-devel/1.1-1-1  spotify:data=foresight.rpath.org@fl:2-devel/1.1-1-1  spotify:runtime=foresight.rpath.org@fl:2-devel/1.1-1-1  spotify:supdoc=foresight.rpath.org@fl:2-devel/1.1-1-1[TForsman@localhost ~]$

To see what package do that file belong, or even see which trove.

[TForsman@localhost ~]$ conary q --path /usr/share/applications/spotify.desktopspotify:data=foresight.rpath.org@fl:2-devel/1.1-1-1

Restore broken file

Sometimes you managed to modify a file and forogt how it was from beginning. then Conary got a great way to fix it:

sudo conary repair /usr/shareapplications/spotify.desktop

repair Undo local changes to files owned by troves+ alot more ways, Like rollbackone thumbrule, if you start to make your own packages. You will never install anything the normal way. You will always create a recipe for it. ;) I even make recipes for themes, as i want to easily want to remove the packages/files i don't want anymore.

Link to comment
Share on other sites

  • 2 weeks later...

Offline Rollback

To be able to use offline rollback, we need to activate it. As it's inactive from start. (taking more space)open terminal and write:

sudo gedit /etc/conary/config.d/localRollback

write in:

localRollbacks True

Remember it takes alot more space, so it can be good to keep an eye on the file. here is 2 good commands for it:

 sudo du -sh /var/lib/conarydb/rollbacks

Or see the rollbacks as each ones:

 sudo du -sh /var/lib/conarydb/rollbacks/\*

to see the rollbacks:

sudo conary rblist|less

sudo rmrb r.45

or something to remove r.45 and everything before it. To save spave.to actually rollback, we always use sudo conary rollback r.45 to rollback current operations to r.45 (not r.44 or earlier)

Edited by tforsman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...