Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • trisquel/package-helpers
  • aklis/package-helpers
  • leny2010/package-helpers
  • fr33domlover/package-helpers
  • Legimet/package-helpers
  • ralphtheninja/package-helpers
  • damo22/package-helpers
  • wherrfrye/package-helpers
  • habs/package-helpers
  • pehjota/package-helpers
  • kpengboy/package-helpers
  • alvaro/package-helpers
  • salman/package-helpers
  • pabloyoyoista/package-helpers
  • mixalis/package-helpers
  • jorgesumle/package-helpers
  • a_slacker_here/package-helpers
  • chaosmonk/package-helpers
  • Beformed/package-helpers
  • dknight/package-helpers
  • proninyaroslav/package-helpers
  • adfeno/package-helpers
  • snd/package-helpers
  • davidpgil/package-helpers
  • diopon/package-helpers
  • ruben/package-helpers
  • bandali/package-helpers
  • joshaspinall/package-helpers
  • GNUtoo/package-helpers
  • Ark74/package-helpers
  • dragestil/package-helpers
  • bill-auger/package-helpers
  • andi89gi/package-helpers
  • Fikar/package-helpers
  • davidl/package-helpers
  • jas/package-helpers
  • parodper/package-helpers
  • David_Hedlund/package-helpers
  • dinomug/package-helpers
  • bf/package-helpers
  • hartkemd/package-helpers
  • del111/package-helpers
  • jxself/package-helpers
  • JacobK/package-helpers
44 results
Show changes
Commits on Source (28)
Showing
with 663 additions and 908 deletions
# Contributing
# Contributing
Whether you've got a bugfix, documentation update, or new feature for us, these are the steps to follow to contribute code back into the main trisquel repo.
Whether you've got a bug fix, documentation update, or new feature for us, these are the steps to follow to contribute code back into the main Trisquel repository.
## 1. Prerequisites
1. Install needed packages for both, sources and binary builds
```
sudo apt-get install dpkg-dev devscripts git pbuilder quilt patch sed rpl parsewiki
sudo apt-get install dpkg-dev devscripts git quilt patch sed rpl parsewiki
```
1. Configure build environment for binary packages
```
git clone https://devel.trisquel.info/trisquel/trisquel-builder.git
ln -s $(readlink -f trisquel-builder/pbuilderrc) ~/.pbuilderrc
sudo ln -s $(readlink -f trisquel-builder/hooks) /var/cache/pbuilder/hooks.d
```
1. Create the build environment for each distribution/architecture you want to work with
```
sudo BUILDDIST=belenos BUILDARCH=amd64 pbuilder create
```
Follow the instructions in the [README.md](https://devel.trisquel.info/trisquel/trisquel-builder/blob/master/README.md) file of the repository just cloned.
## 2. Get the latest code from GitLab
## 2. Get the latest code from gitlab
You'll need to understand a little bit about how git and GitLab work before this step (GitHub works the same way, but we like free software). In simple terms, log in [our GitLab instance](https://devel.trisquel.info/users/sign_in?redirect_to_referer=yes), visit the [trisquel/package-helpers project page there](https://devel.trisquel.info/trisquel/package-helpers), and click the "Fork" button to create your own copy of the repo. You will push your changes to this new repo under your own GitLab account, and we will pull changes into the main repo from there.
You'll need to understand a little bit about how git and gitlab work before this step (GitHub works the same way, but we like free software). In simple terms, log in [here](https://devel.trisquel.info/users/sign_in?redirect_to_referer=yes), visit the [trisquel/package-helpers project page](https://devel.trisquel.info/trisquel/package-helpers), and click the "fork" button to create your own copy of the repo. You will push your changes to this new repo under your own git account, and we will pull changes into the main repo from there.
For the sake of the rest of the examples in this guide, we're going to assume your GitLab account is "**richardtorvalds**" and you will be working with the "**hello**" package, and use those in our examples.
For the sake of the rest of the examples in this guide, we're going to assume your gitlab username is "**richardtorvalds**" and you will be working with the "**hello**" package, and use those in our examples.
Now, we want to grab the latest from this newly created repository and pull it down to your local machine. Getting the latest code from your repo is simple, just clone it:
Now, we want to grab the latest from this newly created repository and pull it down to your local machine. Getting the latest code from your repository is simple, just clone it and go inside:
```bash
git clone https://devel.trisquel.info/richardtorvalds/package-helpers.git
cd package-helpers
```
This will give you a directory called "package-helpers" on your local machine with the latest checkout from your fork of the main package-helpers repo. **Note:** this is *not* a direct reference to the main trisquel repo. When you make changes in your fork, you'll need to let us know about it so we can pull it over....but that's later in the process.
This will give you a directory called "package-helpers" on your local machine with the latest checkout from your fork of the main package-helpers repository. **Note:** this is *not* a direct reference to the main trisquel repository. When you make changes in your fork, you'll need to let us know about it so we can pull it over... but that's later in the process.
## 3. Add a remote for the main package-helpers repo
## 3. Add a remote for the main package-helpers repository
One thing you'll need to do to make things easier to integrate and keep up to date in your fork is to add the main repo as a remote reference. This way you can fetch the latest code from the production version and integrate it. So, here's how to set that up:
One thing you'll need to do to make things easier to integrate and keep up to date in your fork is to add the main repository as a remote reference. This way you can fetch the latest code from the production version and integrate it. So, here's how to set that up:
```bash
git remote add upstream https://devel.trisquel.info/trisquel/package-helpers.git
git remote (this will list out your remotes, showing the new one we added)
git remote
```
Then, when you need to pull the latest from the main trisquel repo, you just fetch and merge the master branch:
The last part will list out your remotes, showing the new one we added.
Then, when you need to pull the latest from the main trisquel repository, you just fetch and merge the master branch:
```bash
git fetch upstream
git merge upstream/belenos
git merge upstream/master
```
You can also use *git pull upstream belenos* if you want it all in one step.
You can also use *git pull upstream master* if you want it all in one step.
## 4. Making a branch for your changes
When adding features or bug fixes, please create a separate branch for each changeset you want us to pull in, either with the issue number in the branch name or with an indication of what the feature is (feature, bugfix...).
When adding features or bug fixes, please create a separate branch for each set/subject of changes you want us to pull in, either with the issue number in the branch name or with an indication of what the feature is (example: feature, bug fix).
To list all branches made so far, do:
```bash
git branch (lists your current branches)
git checkout -b bugfix-hello (makes a new branch called bugfix-hello)
git branch
```
Now, as an example, to make a branch for a bug fix called `bugfix-hello`, do:
```bash
git checkout -b bugfix-hello
```
## 5. Building the source package
If you want to create a new package, apache2 is a good starting point, so:
```
If you want to create a new help for, say, the `hello` package, the `make-apache2` file is a good starting point, so:
```bash
cd helpers
cp make-apache2 make-hello
```
For importing free packages from ppa's or other sources, check [make-toxcore](https://devel.trisquel.info/trisquel/package-helpers/blob/belenos/helpers/make-toxcore) and update the _EXTERNAL_ , _SIGNKEY_ and _changelog_ lines with your own values.
This goes to the `helpers` directory and copies `make-apache2` to `make-hello`. From now one you can make changes to `make-hello` when needed.
Then, run the helper with
```
For importing free packages from PPA's or other sources, check [make-toxcore](https://devel.trisquel.info/trisquel/package-helpers/blob/belenos/helpers/make-toxcore) and update the _EXTERNAL_ , _SIGNKEY_ and _changelog_ lines with your own values.
Once the changes are done, prepare the source package by running the helper with
```bash
bash make-hello
```
If everything goes fine, you will have your new source package ready at _PACKAGES/hello/_
If everything goes fine, you will have your new `.DSC` source package ready at `PACKAGES/hello`.
## 6. Build and test the binary package
The last step generated a source package file, so we need to build the binary one:
The last step generated a source package file, so we need to build the binary one.
First switch to the `PACKAGES/hello` directory.
```bash
cd PACKAGES/hello
```
sudo BUILDDIST=belenos BUILDARCH=amd64 pbuilder build PACKAGES/hello/*.dsc
Then, as is pointed out in the [README.md](https://devel.trisquel.info/trisquel/trisquel-builder/blob/master/README.md) of the trisquel-builder repository, you can do so by doing the following:
```bash
sbuild -v --dist $CODENAME --arch $ARCH $PACKAGE_DSC_FILE
```
Or as follows if you also want to build the architecture-independent packages:
```bash
sbuild -v --dist $CODENAME --arch $ARCH --arch-all $PACKAGE_DSC_FILE
```
Keep in mind that in both the last command suggestions, `$CODENAME` and `$ARCH` must be replaced by you since they are the codename of the Trisquel release and the architecture that you want to test against (to see the host architecture, that is the one your system is on, you can use `dpkg --print-architecture`), and for this to work, a `schroot` matching both `$CODENAME` and `$ARCH` must be available - which should be all set if all went well when following the [README.md](https://devel.trisquel.info/trisquel/trisquel-builder/blob/master/README.md) of trisquel-builder (see `schroot --list`). Besides this, `$PACKAGE_DSC_FILE` must be manually replaced with the name of a `.DSC` file that was created by `sbuild` in the previous section.
Having said that, both the alternative commands above should put all the `.DEB` packages in the same directory, including or excluding the architecture-independent ones, respectively to which of the previous command alternatives were used.
The binary packages will be avaliable at _/var/cache/pbuilder/jenkins-repos/$BUILDDIST/_
From now on you can either install the packages in the Trisquel installation you're using or, if there is an issue with the result, use a testing session as optionally advised in the next session.
After testing, considering that all went well, you can jump to the last section.
## 7. Push your code and make a pull request
## 7. Installing the packages in a testing session
When you have finished making your changes, you'll need to push up your changes to your fork so we can grab them. With them all committed, push them:
Sometimes the issues with a given package vary depending on the environment, and in such cases it's a good idea to test it inside a `schroot` session.
To do so, begin the session and get its location as follows:
```bash
git push origin bugfix-hello
TEST_SCHROOT_SESSION=$(schroot --begin-session -c $CODENAME-$ARCH)
TEST_SCHROOT_SESSION_PATH=$(schroot --location -c session:$TEST_SCHROOT_SESSION)
echo $TEST_SCHROOT_SESSION_PATH
```
This pushes everything in that branch up. Then you can go back to your forked package-helpers gitlab page and issue a pull request from there. Tell us what you want us to merge and what it does/fixes, and one of us will pick it up.
This should output a path, for future reference, it will be available for you in the variable `$TEST_SCHROOT_SESSION_PATH`, as well as the session identity in `$TEST_SCHROOT_SESSION`.
That lets us know that there's something new from you that needs to be pulled in. We'll review it and get back to you about it if we have any questions. Otherwise, we'll integrate it and let you know when it's in!
To install the packages, you must copy the `.DEB` files from `PACKAGES/hello` to a place inside `$TEST_SCHROOT_SESSION_PATH`, like so:
```bash
sudo cp -t $TEST_SCHROOT_SESSION_PATH/root *.deb
```
In the example above, all the `.DEB` files are copied to `$TEST_SCHROOT_SESSION_PATH/root`.
It's time to run the session, first as root, in order to install the packages, like so:
```bash
schroot -r -c $TEST_SCHROOT_SESSION -u root
```
Hope this guide helps you get started in contributing to the trisquel project! If you still have questions, don't hesitate to join us on IRC - we're in #trisquel-dev on freenode -, or send a mail to the development mailing list trisquel-devel at listas.trisquel.info.
In the new shell, the installation is first done by adding the files of the packages to do so, then using the repositories to fix these according to the dependencies needed, as follows:
```bash
dpkg -i /root/*.deb
apt-get -f install
```
The `dpkg` command might end with errors, but those can be ignored. `apt-get` may ask permission to download packages, which in most cases is expected. If all the packages built are installed and configured, `apt-get` mustn't exit with errors.
If all went well so far, now is time to decide if the package needs super user/root permissions or not. If the privileged access is needed, exit by either using the `exit` command or by typing Ctrl + D. Then, switch user by doing the following:
```bash
schroot -r -c $TEST_SCHROOT_SESSION
```
This continues the session as normal user.
From now on, you can take the necessary steps to test the package.
Considering that the job is done and being aware that all changes will be lost, exit the `schroot` session and do:
```bash
schroot -e -c $TEST_SCHROOT_SESSION
```
## 8. Commit/register the changes, push your code and make a pull request
When you have finished making your changes, you'll need to push up your changes to your fork so we can grab them.
Now it's required that you commit/register the changes and add a detailed comment of what was done, both can be done by manually adding the files to be committed with `git add`, like so:
```bash
git add ../../make-hello
```
When all the new or changed files are added, make the commit with the following example command:
```bash
EDITOR=pluma git commit
```
Inside the Pluma text editor tab that opened, in the first uncommented line make a summary of what was done, like an email subject, then in the other lines describe in detail what was done.
With all commits done, push them with:
```bash
git push origin bugfix-hello
```
This pushes everything in that branch up. Then you can go back to your forked package-helpers GitLab page and issue a pull request from there. Tell us what you want us to merge and, if you haven't done so in the commit messages, what it does/fixes, and one of us will pick it up.
That lets us know that there's something new from you that needs to be pulled in. We'll review it and get back to you about it if we have any questions. Otherwise, we'll integrate it and let you know when it's in!
Hope this guide helps you get started in contributing to the Trisquel project! If you still have questions, don't hesitate to join us on IRC - we're in #trisquel-dev on Freenode -, or send a mail to the development mailing list trisquel-devel at listas.trisquel.info.
......@@ -30,7 +30,7 @@ Those are the steps done by the helpers:
* You don't need to use sudo in order to run those scripts, but some extra packages are needed:
`sudo apt-get install dpkg-dev sed git rpl devscripts quilt patch cdbs`
`sudo apt-get install dpkg-dev sed git gnupg-curl rpl devscripts quilt patch cdbs`
* Take care to use the right sourcePackageName, many source packages produce
several binary packages. `apt-cache showsrc binary-package` can help you.
......
trisquel
\ No newline at end of file
--- EDITME.exim4-light 2017-10-28 05:55:04.237289646 +0000
+++ EDITME.exim4-heavy 2017-10-28 05:57:59.084259142 +0000
@@ -217,7 +217,7 @@
# This one is very special-purpose, so is not included by default.
-# ROUTER_IPLOOKUP=yes
+ROUTER_IPLOOKUP=yes
#------------------------------------------------------------------------------
@@ -249,7 +249,7 @@
SUPPORT_MAILDIR=yes
SUPPORT_MAILSTORE=yes
-# SUPPORT_MBX=yes
+SUPPORT_MBX=yes
#------------------------------------------------------------------------------
@@ -310,16 +310,16 @@
LOOKUP_CDB=yes
LOOKUP_DSEARCH=yes
# LOOKUP_IBASE=yes
-# LOOKUP_LDAP=yes
-# LOOKUP_MYSQL=yes
+LOOKUP_LDAP=yes
+LOOKUP_MYSQL=yes
# LOOKUP_MYSQL_PC=mariadb
LOOKUP_NIS=yes
# LOOKUP_NISPLUS=yes
# LOOKUP_ORACLE=yes
LOOKUP_PASSWD=yes
-# LOOKUP_PGSQL=yes
+LOOKUP_PGSQL=yes
# LOOKUP_REDIS=yes
-# LOOKUP_SQLITE=yes
+LOOKUP_SQLITE=yes
# LOOKUP_SQLITE_PC=sqlite3
# LOOKUP_WHOSON=yes
@@ -340,7 +340,7 @@
# with Solaris 7 onwards. Uncomment whichever of these you are using.
# LDAP_LIB_TYPE=OPENLDAP1
-# LDAP_LIB_TYPE=OPENLDAP2
+LDAP_LIB_TYPE=OPENLDAP2
# LDAP_LIB_TYPE=NETSCAPE
# LDAP_LIB_TYPE=SOLARIS
@@ -379,6 +379,9 @@
# LOOKUP_LIBS=-L/usr/local/lib -lldap -llber -lmysqlclient -lpq -lgds -lsqlite3
+LOOKUP_INCLUDE=-I/usr/include/mysql -I`pg_config --includedir`
+LOOKUP_LIBS=-lldap -llber -lmysqlclient -lpq -lsqlite3
+
#------------------------------------------------------------------------------
# Compiling the Exim monitor: If you want to compile the Exim monitor, a
# program that requires an X11 display, then EXIM_MONITOR should be set to the
@@ -387,7 +390,7 @@
# files are defaulted in the OS/Makefile-Default file, but can be overridden in
# local OS-specific make files.
-EXIM_MONITOR=eximon.bin
+# EXIM_MONITOR=eximon.bin
#------------------------------------------------------------------------------
@@ -397,7 +400,7 @@
# and the MIME ACL. Please read the documentation to learn more about these
# features.
-# WITH_CONTENT_SCAN=yes
+WITH_CONTENT_SCAN=yes
#------------------------------------------------------------------------------
# If you're using ClamAV and are backporting fixes to an old version, instead
@@ -459,9 +462,9 @@
# installed on your system (www.libspf2.org). Depending on where it is installed
# you may have to edit the CFLAGS and LDFLAGS lines.
-# EXPERIMENTAL_SPF=yes
-# CFLAGS += -I/usr/local/include
-# LDFLAGS += -lspf2
+EXPERIMENTAL_SPF=yes
+CFLAGS += -I/usr/local/include
+LDFLAGS += -lspf2
# Uncomment the following lines to add SRS (Sender rewriting scheme) support.
# You need to have libsrs_alt installed on your system (srs.mirtol.com).
@@ -474,10 +477,10 @@
# Uncomment the following line to add DMARC checking capability, implemented
# using libopendmarc libraries. You must have SPF support enabled also.
-# EXPERIMENTAL_DMARC=yes
-# DMARC_TLD_FILE= /etc/exim/opendmarc.tlds
-# CFLAGS += -I/usr/local/include
-# LDFLAGS += -lopendmarc
+EXPERIMENTAL_DMARC=yes
+DMARC_TLD_FILE= /etc/exim4/opendmarc.tlds
+CFLAGS += -I/usr/local/include
+LDFLAGS += -lopendmarc
# Uncomment the following lines to add Brightmail AntiSpam support. You need
# to have the Brightmail client SDK installed. Please check the experimental
@@ -634,16 +637,16 @@
# configuration to make use of the mechanism(s) selected.
AUTH_CRAM_MD5=yes
-# AUTH_CYRUS_SASL=yes
-# AUTH_DOVECOT=yes
+AUTH_CYRUS_SASL=yes
+AUTH_DOVECOT=yes
# AUTH_GSASL=yes
# AUTH_GSASL_PC=libgsasl
# AUTH_HEIMDAL_GSSAPI=yes
# AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
# AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi heimdal-krb5
AUTH_PLAINTEXT=yes
-# AUTH_SPA=yes
-# AUTH_TLS=yes
+AUTH_SPA=yes
+AUTH_TLS=yes
# Heimdal through 1.5 required pkg-config 'heimdal-gssapi'; Heimdal 7.1
# requires multiple pkg-config files to work with Exim, so the second example
@@ -656,7 +659,7 @@
# Similarly for GNU SASL, unless pkg-config is used via AUTH_GSASL_PC.
# Ditto for AUTH_HEIMDAL_GSSAPI(_PC).
-# AUTH_LIBS=-lsasl2
+AUTH_LIBS=-lsasl2
# AUTH_LIBS=-lgsasl
# AUTH_LIBS=-lgssapi -lheimntlm -lkrb5 -lhx509 -lcom_err -lhcrypto -lasn1 -lwind -lroken -lcrypt
@@ -930,7 +933,7 @@
# (version 5.004 or later) installed, set EXIM_PERL to perl.o. Using embedded
# Perl costs quite a lot of resources. Only do this if you really need it.
-# EXIM_PERL=perl.o
+EXIM_PERL=perl.o
#------------------------------------------------------------------------------
@@ -940,7 +943,7 @@
# that the local_scan API is made available by the linker. You may also need
# to add -ldl to EXTRALIBS so that dlopen() is available to Exim.
-# EXPAND_DLFUNC=yes
+EXPAND_DLFUNC=yes
#------------------------------------------------------------------------------
@@ -950,11 +953,11 @@
# support, which is intended for use in conjunction with the SMTP AUTH
# facilities, is included only when requested by the following setting:
-# SUPPORT_PAM=yes
+SUPPORT_PAM=yes
# You probably need to add -lpam to EXTRALIBS, and in some releases of
# GNU/Linux -ldl is also needed.
-EXTRALIBS=-ldl
+EXTRALIBS=-lpam -export-dynamic
#------------------------------------------------------------------------------
@@ -968,7 +971,7 @@
# If you may want to use inbound (server-side) proxying, using Proxy Protocol,
# uncomment the line below.
-# SUPPORT_PROXY=yes
+SUPPORT_PROXY=yes
#------------------------------------------------------------------------------
@@ -1313,7 +1316,7 @@
# local part) can be increased by changing this value. It should be set to
# a multiple of 16.
-# MAX_NAMED_LIST=16
+MAX_NAMED_LIST=32
#------------------------------------------------------------------------------
......@@ -10,4 +10,4 @@ DIST_SUBDIR = 'browser'
export('DIST_SUBDIR')
include('../branding-common.mozbuild')
AbrowserBranding()
FirefoxBranding()
This diff is collapsed.
......@@ -152,6 +152,8 @@ pref("privacy.resistFingerprinting", true);
pref("webgl.disabled", true);
// Don't reveal your internal IP when WebRTC is enabled
pref("media.peerconnection.ice.no_host", true);
pref("privacy.trackingprotection.cryptomining.enabled", true);
pref("privacy.trackingprotection.fingerprinting.enabled", true);
// Services
pref("gecko.handlerService.schemes.mailto.0.name", "");
......@@ -220,6 +222,8 @@ pref("extensions.pocket.enabled", false);
// disable xpi signing verification
pref("xpinstall.signatures.required", false);
// enable extensions by default in private mode
pref("extensions.allowPrivateBrowsingByDefault",true);
// disable screenshots extension
pref("extensions.screenshots.disabled", true);
......@@ -250,3 +254,5 @@ pref("extensions.blocklist.url", "");
// Disable recommended extensions
pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr", false);
pref("extensions.htmlaboutaddons.discover.enabled", false);
pref("extensions.htmlaboutaddons.recommendations.enabled", false);
#!/usr/bin/python
import optparse, sys, os, tempfile, re
try: import readline
except ImportError: pass
from stat import *
def show_license(*eat):
print """rpl - replace strings in files
Copyright (C) 2004-2005 Goran Weinholt <weinholt@debian.org>
Copyright (C) 2004 Christian Haggstrom <chm@c00.info>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
sys.exit(0)
def get_files(filenames, recurse, suffixen, verbose, hidden_files):
new_files = []
for filename in filenames:
try:
perms = os.lstat(filename)
except OSError, e:
sys.stderr.write("\nrpl: Unable to read permissions of %s."
% filename)
sys.stderr.write("\nrpl: Error: %s" % e)
sys.stderr.write("\nrpl: SKIPPING %s\n\n" % filename)
continue
if S_ISDIR(perms.st_mode):
if recurse:
if verbose:
sys.stderr.write("Scanning Directory: %s\n" % filename)
for f in os.listdir(filename):
if not hidden_files and f.startswith('.'):
if verbose:
sys.stderr.write("Skipping: %s (hidden)\n"
% os.path.join(filename, f))
continue
new_files += get_files([os.path.join(filename, f)],
recurse, suffixen, verbose,
hidden_files)
else:
if verbose:
sys.stderr.write("Directory: %s skipped.\n" % filename)
continue
elif S_ISREG(perms.st_mode):
if suffixen != [] and \
not True in [ filename.endswith(s) for s in suffixen ]:
sys.stderr.write("Skipping: %s (suffix not in list)\n"
% filename)
continue
new_files += [(filename, perms)]
else:
sys.stderr.write("Skipping: %s (not a regular file)\n"
% filename)
return new_files
def unescape(s):
regex = re.compile(r'\\([0-7]{1,3}|x[0-9a-fA-F]{2}|[nrtvafb\\])')
return regex.sub(lambda match: eval('"%s"' % match.group()), s)
def blockrepl(instream, outstream, regex, before, after, blocksize=None):
patlen = len(before)
sum = 0
if not blocksize: blocksize = 2*patlen
tonext = ''
while 1:
block = instream.read(blocksize)
if not block: break
parts = regex.split(tonext+block)
sum += len(parts)-1
lastpart = parts[-1]
if lastpart:
tonext = lastpart[-patlen:]
parts[-1] = lastpart[:-len(tonext)]
else:
tonext = ''
outstream.write(after.join(parts))
outstream.write(tonext)
return sum
def main():
# First we parse the command line arguments...
usage = "usage: %prog [options] old_string new_string target_file(s)"
parser = optparse.OptionParser(usage, version="%prog 1.5.2")
parser.add_option("-L", "--license", action="callback",
callback=show_license, help="show the software license")
parser.add_option("-x", metavar="SUFFIX",
action="append", dest="suffixen", default=[],
help="specify file suffix to match")
parser.add_option("-i", "--ignore-case",
action="store_true", dest="ignore_case", default=False,
help="do a case insensitive match")
parser.add_option("-w", "--whole-words",
action="store_true", dest="whole_words", default=False,
help="whole words (old_string matches on word boundaries only)")
parser.add_option("-b", "--backup",
action="store_true", dest="do_backup", default=False,
help="make a backup before overwriting files")
parser.add_option("-q", "--quiet",
action="store_true", dest="quiet", default=False,
help="quiet mode")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
help="verbose mode")
parser.add_option("-s", "--dry-run",
action="store_true", dest="dry_run", default=False,
help="simulation mode")
parser.add_option("-R", "--recursive",
action="store_true", dest="recurse", default=False,
help="recurse into subdirectories")
parser.add_option("-e", "--escape",
action="store_true", dest="escapes", default=False,
help="expand escapes in old_string and new_string")
parser.add_option("-p", "--prompt",
action="store_true", dest="prompt", default=False,
help="prompt before modifying each file")
parser.add_option("-f", "--force",
action="store_true", dest="force", default=False,
help="ignore errors when trying to preserve permissions")
parser.add_option("-d", "--keep-times",
action="store_true", dest="keep_times", default=False,
help="keep the modification times on modified files")
parser.add_option("-t", "--use-tmpdir",
action="store_true", dest="use_tmpdir", default=False,
help="use $TMPDIR for storing temporary files")
parser.add_option("-a", "--all",
action="store_true", dest="hidden_files", default=False,
help="do not ignore files and directories starting with .")
(opts, args) = parser.parse_args()
# args should now contain old_str, new_str and a list of files/dirs
if len(args) < 3:
parser.error("must have at least three arguments")
if args[0] == "":
parser.error("must have something to replace")
old_str = args[0]
new_str = args[1]
files = args[2:]
# See if all the files actually exist
for file in files:
if not os.path.exists(file):
sys.stderr.write("\nrpl: File \"%s\" not found.\n" % file)
sys.exit(os.EX_DATAERR)
if new_str == "" and not opts.quiet:
sys.stderr.write("Really DELETE all occurences of %s " % old_str)
if opts.ignore_case:
sys.stderr.write("(ignoring case)? (Y/[N]) ")
else:
sys.stderr.write("(case sensitive)? (Y/[N]) ")
line = raw_input()
if line != "" and line[0] in "nN":
sys.stderr.write("\nrpl: User cancelled operation.\n")
sys.exit(os.EX_TEMPFAIL)
# Tell the user what is going to happen
if opts.dry_run:
sys.stderr.write("Simulating replacement of \"%s\" with \"%s\" "
% (old_str, new_str))
else:
sys.stderr.write("Replacing \"%s\" with \"%s\" " % (old_str, new_str))
if opts.ignore_case: sys.stderr.write("(ignoring case) ")
else: sys.stderr.write("(case sensitive) ")
if opts.whole_words: sys.stderr.write("(whole words only)\n")
else: sys.stderr.write("(partial words matched)\n")
if opts.dry_run and not opts.quiet:
sys.stderr.write("The files listed below would be modified in a replace operation.\n")
if opts.escapes:
old_str = unescape(old_str)
new_str = unescape(new_str)
if opts.whole_words:
regex = re.compile(r"(?:(?<=\s)|^)" + re.escape(old_str) + r"(?=\s|$)",
opts.ignore_case and re.I or 0)
else:
regex = re.compile(re.escape(old_str), opts.ignore_case and re.I or 0)
total_matches = 0
files = get_files(files, opts.recurse, opts.suffixen, opts.verbose, opts.hidden_files)
for filename, perms in files:
# Open the input file
try: f = open(filename, "rb")
except IOError, e:
sys.stderr.write("\nrpl: Unable to open %s for reading." % fn)
sys.stderr.write("\nrpl: Error: %s" % e)
sys.stderr.write("\nrpl: SKIPPING %s\n\n" % fn)
continue
# Find out where we should put the temporary file
if opts.use_tmpdir: tempfile.tempdir = None
else: tempfile.tempdir = os.path.dirname(filename)
# Create the output file
try:
o, tmp_path = tempfile.mkstemp("", ".tmp.")
o = os.fdopen(o, "wb")
except OSError, e:
sys.stderr.write("\nrpl: Unable to create temp file.")
sys.stderr.write("\nrpl: Error: %s" % e)
sys.stderr.write("\nrpl: (Type \"rpl -h\" and consider \"-t\" to specify temp file location.)")
sys.stderr.write("\nrpl: SKIPPING %s\n\n" % filename)
continue
# Set permissions and owner
try:
os.chown(tmp_path, perms.st_uid, perms.st_gid)
os.chmod(tmp_path, perms.st_mode)
except OSError, e:
sys.stderr.write("\nrpl: Unable to set owner/group/perms of %s"
% filename)
sys.stderr.write("\nrpl: Error: %s" % e)
if opts.force:
sys.stderr.write("\nrpl: WARNING: New owner/group/perms may not match!\n\n")
else:
sys.stderr.write("\nrpl: SKIPPING %s!\n\n" % filename)
os.unlink(tmp_path)
continue
if opts.verbose and not opts.dry_run:
sys.stderr.write("Processing: %s\n" % filename)
elif not opts.quiet and not opts.dry_run:
sys.stderr.write(".")
sys.stderr.flush()
# Do the actual work now
matches = blockrepl(f, o, regex, old_str, new_str, 1024)
f.close()
o.close()
if matches == 0:
os.unlink(tmp_path)
continue
if opts.dry_run:
try:
fn = os.path.realpath(filename)
except OSError, e:
fn = filename
if not opts.quiet: sys.stderr.write(" %s\n" % fn)
os.unlink(tmp_path)
total_matches += matches
continue
if opts.prompt:
sys.stderr.write("\nSave '%s' ? ([Y]/N) " % filename)
line = ""
while line == "" or line[0] not in "Yy\nnN":
line = raw_input()
if line[0] in "nN":
sys.stderr.write("Not Saved.\n")
os.unlink(tmp_path)
continue
sys.stderr.write("Saved.\n")
if opts.do_backup:
try: os.rename(filename, filename + "~")
except OSError, e:
sys.stderr.write("rpl: An error occured renaming %s to %s." % (filename, filename + "~"))
sys.stderr.write("\nrpl: Error: %s" % e)
continue
# Rename the file
try: os.rename(tmp_path, filename)
except OSError, e:
sys.stderr.write("rpl: An error occured replacing %s with %s."
% (tmp_path, filename))
sys.stderr.write("\nrpl: Error: %s" % e)
os.unlink(tmp_path)
continue
# Restore the times
if opts.keep_times:
try: os.utime(filename, (perms.st_atime, perms.st_mtime))
except OSError, e:
sys.stderr.write("\nrpl: An error occured setting the access time and mod time of the file %s.", filename)
sys.stderr.write("\nrpl: Error: %s" % e)
total_matches += matches
# We're about to exit, give a summary
if not opts.quiet:
if opts.dry_run:
sys.stderr.write("\nA Total of %lu matches found in %lu file%s searched."
% (total_matches,
len(files),
len(files) != 1 and "s" or ""))
sys.stderr.write("\nNone replaced (simulation mode).\n")
else:
sys.stderr.write("\nA Total of %lu matches replaced in %lu file%s searched.\n"
% (total_matches,
len(files),
len(files) != 1 and "s" or ""))
if __name__ == "__main__":
main()
......@@ -47,6 +47,11 @@ DEVELMIRROR=http://devel.trisquel.info/trisquel/$CODENAME
LOCALMIRROR=http://archive.trisquel.info/trisquel
LOCAL_APT=`mktemp -d`
export RPL=$PWD/DATA/rpl
rpl(){
$RPL $@
}
pkgversion(){
dpkg-parsechangelog --show-field Version
}
......@@ -82,6 +87,7 @@ Dir::Etc::SourceList "${LOCAL_APT}/etc/apt.sources.list";
Dir::Cache "${LOCAL_APT}/var/cache/apt";
pkgCacheGen::Essential "none";
Dir::Etc::Trusted "${LOCAL_APT}/etc/trusted.gpg";
Acquire::ForceIPv4 "true";
EOF
export TRUSTEDFILE=${LOCAL_APT}/etc/trusted.gpg
......@@ -122,20 +128,16 @@ cd PACKAGES/$PACKAGE
apt-get update -c $LOCAL_APT/etc/apt.conf
apt-get source $PACKAGE --download-only -c ${LOCAL_APT}/etc/apt.conf
# Verify it first
# Import the key for the package uploader
# Use the one listed in the helper if available, otherwise download the one listed in the dsc
if [ "1$SIGNKEY" != "1" ] ; then
apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --recv-keys --keyserver keyserver.ubuntu.com $SIGNKEY > /dev/null
gpgv --keyring ${LOCAL_APT}/etc/trusted.gpg *.dsc
if grep -q "BEGIN PGP SIGNATURE" *.dsc; then
KEY=$(gpg2 --keyid-format 0xlong --verify *.dsc 2>&1 | grep 0x | sed 's/.*0x//' || true)
[ -z "$KEY" ] && KEY=$(gpgv --keyring ${LOCAL_APT}/etc/trusted.gpg *.dsc 2>&1 | egrep ".SA key" | sed 's/.*.SA key //' || true)
apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --recv-keys --keyserver hkps://keyserver.ubuntu.com:443 $KEY > /dev/null
touch ${LOCAL_APT}/keyring.gpg
gpg2 --keyring ${LOCAL_APT}/keyring.gpg --import ${LOCAL_APT}/etc/trusted.gpg
gpg2 --verify --keyring ${LOCAL_APT}/etc/trusted.gpg *.dsc
else
if grep -q "BEGIN PGP SIGNATURE" *.dsc; then
KEY=$(gpgv --keyring ${LOCAL_APT}/etc/trusted.gpg *.dsc 2>&1 | grep "key ID" | sed 's/.*key ID //' || true)
apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --recv-keys --keyserver keyserver.ubuntu.com $KEY > /dev/null
gpgv --keyring ${LOCAL_APT}/etc/trusted.gpg *.dsc
else
echo WARNING! The dsc file is not gpg signed!
[ -z "$EXTERNAL" ] && exit 1
fi
echo WARNING! The dsc file is not gpg signed!
[ -z "$EXTERNAL" ] && exit 1
fi
dpkg-source --no-check -x --skip-patches *.dsc source
......
#!/bin/sh
#
# Copyright (C) 2019 Ruben Rodriguez <ruben@trisquel.info>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
VERSION=1
EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu bionic main universe'
REPOKEY=7638D0442B90D010
. ./config
changelog "Backported from bionic"
compile